Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 305 online users. » 0 Member(s) | 302 Guest(s) Applebot, Bing, Google
|
Latest Threads |
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 198
|
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 262
|
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,526
|
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 520
|
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 420
|
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 291
|
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,016
|
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,855
|
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 398
|
ZXodus][Engine
Forum: ZX Basic Compiler
Last Post: boriel
02-19-2025, 11:43 PM
» Replies: 69
» Views: 213,494
|
|
|
Mute compiler warnings for included libraries |
Posted by: patters - 01-26-2021, 03:24 PM - Forum: Library
- Replies (1)
|
 |
Every time I compile I get a big wall of text of warnings about unused variables and functions in libraries that are included in my program (input.bas, attr.bas and its own includes, HRPrint.bas, fastTrig.bas). Could such warnings for libraries be muted by default perhaps and make them elective for library debugging, or at least allow me to exclude them in my build script? I didn't write these pieces of code, so I'm not interested in these warnings. However if I mute all warnings then I could miss an issue with my own code. Even with warnings enabled I have missed many genuine warnings because they were drowned out by the noise (variable unused is the classic one - when a name has been mistyped or the capitalisation is wrong somewhere in the listing).
|
|
|
Screen attribute statement ignored on SUB exit (*solved*) |
Posted by: patters - 01-26-2021, 12:22 PM - Forum: Bug Reports
- Replies (5)
|
 |
If I have multiple attribute changes on a single line, the last one is ignored on exit from a SUB.
Consider this example which exposes the problem:
Code: SUB screenAttributes
PAPER 3: INK 7: BRIGHT 1
END SUB
SUB screenAttributes2
PAPER 4: BRIGHT 1: INK 2
END SUB
CLS
screenAttributes()
PRINT AT 0,0;"test"
screenAttributes2()
PRINT AT 2,0;"test2"
For the first example print, it should be bright but it isn't.
The second example print should have red ink but it doesn't.
I thought I was going mad until I found this.
If I substitute another command in this last statement position of the SUB (like a PRINT for instance) then that works. It's only attribute assignments that seem to fail. Also, if I insert another command before the END SUB, then it all works as expected. e.g. the below code works fine:
Code: SUB screenAttributes
PAPER 3: INK 7: BRIGHT 1
BEEP 0.1,60
END SUB
SUB screenAttributes2
PAPER 4: BRIGHT 1: INK 2
BEEP 0.1,60
END SUB
CLS
screenAttributes()
PRINT AT 0,0;"test"
screenAttributes2()
PRINT AT 2,0;"test2"
On further testing, the issue is not related to multiple colon-separated statements on the same line. With the following code the compiler also loses the last statement in each Sub and fails to work as expected:
Code: SUB screenAttributes
PAPER 3
INK 7
BRIGHT 1
END SUB
SUB screenAttributes2
PAPER 4
BRIGHT 1
INK 2
END SUB
CLS
screenAttributes()
PRINT AT 0,0;"test"
screenAttributes2()
PRINT AT 2,0;"test2"
|
|
|
Creating a populated array of strings |
Posted by: patters - 01-26-2021, 01:07 AM - Forum: Help & Support
- Replies (1)
|
 |
Hi Boriel,
I notice that I cannot do the following:
Code: DIM stringArray(2) AS STRING => {"apples", "oranges", "pears"}
The compiler returns "error: Initializer expression is not constant."
Digging on this forum reveals a post from 2009, in which you state this is not possible because string lengths are dynamic. Is this still the case? As you posted in that thread, it ought to be simple to just have the compiler run a bunch of individual LET assignments, but it's a bit ugly to have to type them out.
Thanks,
Patters
|
|
|
Clearing an array |
Posted by: patters - 01-19-2021, 10:47 PM - Forum: Help & Support
- Replies (6)
|
 |
What is the recommended way to reset an array's contents? Do we have to run a FOR loop from 0 TO UBOUND and clear it element by element, or is there a neater way?
I see that the following doesn't work:
|
|
|
Custom TAP loader with SCREEN$ |
Posted by: patters - 01-17-2021, 06:24 PM - Forum: Help & Support
- Replies (6)
|
 |
I have a Sinclair BASIC loader for my game which will CLEAR 32767, load a SCREEN$, LOAD ""CODE, and finally RANDOMIZE USR 32678. I have assembled the loader and the SCREEN$ into a TAP file - but how to I get zxbc.py to append its output to this TAP file? I can't seem to get it to work.
When I try:
Code: ./zxbc.py -t --append-binary ../loader+scr.tap ../arti12.bas
I get a file arti12.tap as expected but it doesn't load the machine code. If I browse the TAP file in Fuse emulator I see that zxbc.py appears to have prepended an additional self-contained TAP file into the loader TAP file, rather than appended the binary data. Am I doing this wrong, or is this a bug?
I have managed to work around the issue by producing a .bin file instead, and then Fuse's 'Import Binary Data' option and then saving the memory range back out to the mounted TAP file - but it would be much nicer to automate that with zxbc.py if possible.
Thanks
|
|
|
Documentation frequently offline |
Posted by: patters - 01-13-2021, 12:01 PM - Forum: Documentation
- No Replies
|
 |
Hi,
I have been frequently referring to the ZX Basic documentation while I have been programming. I find that at random (but multiple times a day) the search feature on the wiki returns no results for a short period which is quite frustrating. It's happened again right now. During though outages, luckily I can consult the markdown files on GitHub. However, they don't have a search function, which is useful so I do prefer the wiki.
I also notice that the boriel.com landing site frequently drops off the Internet late at night too. Can you perhaps set up some kind of host monitoring to determine just how big a problem this is, or maybe raise a support ticket with the webhost?
Thanks,
Patters
|
|
|
First RND call is ignoring RANDOMIZE, subsequent calls are fine (*solved*) |
Posted by: patters - 01-13-2021, 02:38 AM - Forum: Bug Reports
- Replies (3)
|
 |
I have noticed while testing my program that the very first random number is always the same when the compiled program is loaded into an emulator. Subsequent ones are indeed random.
That first result is normal - you might think - because RND will be invoked at the same number of ticks after power-on each time. However, I use RANDOMIZE after an INPUT (which won't always be submitted at a consistent time by the user) before the first RND in the program is requested, so this should not happen. I presume this is a bug because after the first RND, it behaves as normal. If I deliberately insert a dummy RND before the RND values I need, then my program runs with the expected randomness.
Simple test case which demonstrates the issue:
Code: #include <input.bas>
DIM i$ AS STRING
CLS
i$=INPUT(1)
RANDOMIZE
PRINT INT (RND*100) 'this number is consistent every time the emulator is launched with the tap file
PRINT INT (RND*100) 'this number will be random
When I run the tap file in Fuse on Mac OS I usually get 60 for the first random number. Very occasionally I get 61 though, so that may help for debugging. It's always those two values though. The second number will be in the range 0-99 as expected.
This issue is present in release version 1.14 and in 1.14beta9
|
|
|
Printing an updated screenful in one go |
Posted by: worcestersource - 01-11-2021, 09:09 PM - Forum: Help & Support
- Replies (5)
|
 |
Hello everyone,
I'm loving the discovery of zxbc and having a great time working on the game I always wanted to make! Thanks Boriel!
I've written code that randomly generates a map (well, its floor), which is stored in an array. To keep the size in memory down, I store the rows as bits and have written a routine to make reading this back in the game code nice and simple. I can easily determine if any given coordinate is floor or not. I'm really happy with this. Bit operators are brilliant!
I'm now at the stage where I need to start putting my graphics on the screen. Using the map floor as a reference, I intend to display the walls and floor of the dungeon using 3x3 character blocks, with each successive row overprinting the bottom of the row before it. This way I should be able to display a 9 x 9 view with a pseudo 3D view and the player in the middle.
Using the floor as the starting point, what's I'm trying to work out right now is the best way to could assemble the whole view of this and print it to the screen in one go so the player doesn't see it redraw tile by tile. As the game is turn based, I don't mind if preparing and moving the updated screen isn't instant.
I've thought of two methods:
- Dynamically create a string and colour it in using control codes, to set everything up that is then printed in one go.
- Scroll the screen, a tile in whatever direction needed and then fill in the space.
I think the first would give the best results, if it's possible, and the second should be achievable with the scroll routines I've been reading about.
My questions are whether there are any other approaches I could take and if anyone kindly has any advice on manipulating and embedding control chars into strings. I've read some other posts but these don't go as far as constructing a string.
Thanks,
Steve
I'm probably going to keep throwing my thoughts into this thread (sorry - I do this on car forums when I'm fixing my old car!).
If I'm treating the string as a fake screen, could I use chr$ 22 as if it were AT? Does the string reorder itself if I do something like
LET s$ = s$ + chr$(22, y, x, 17, 1, 65)
And replace the 1 and the 65 with values from an array that stores the colour swatch and characters?
I'm then curious how the string is stored. Is it the logical concatenation of all of the statements like the above that I'll loop through 81 times or does it reorder itself if the AT equivalents were presented in a non-linear fashion?
|
|
|
|