There's no function or command "fill", allowing to pass two coordinates and making the computer to fill all delimited pixels with the current color.
Code:
circle 50, 50, 30
fill 50, 50
In the eighties, I used to fill a circle with a for loop:
Code:
circle 50, 50, 30
for i = 1 to 30
circle 50, 50, i
next i
I suppose I could do something like this for rectangles, as well. This is, however, slow, ugly (certain pixels remain unplotted), and clumsy. Is there an alternate way?
Thanks,
Hello,
I'm trying to code a simple headerless LOAD routine in ZX Basic using the inline assembly feature of the compiler. The basic idea here is to write a function that uses assembly to set up the necessary registers and call the ROM routine 0556h for a headerless load (e.g. to load an extra level from the tape). I have some progress in this area, but it looks like I misunderstand how to clean up things correctly after the ROM routine returns and my function ends, so the poor Speccy either hangs or is reset after the code loading routine completes. I tried a few things so far, but the experiment that went the farthest so far is this one:
Code:
function hload(addr as uInteger, size as uInteger) as uByte
asm
pop hl
pop de
pop ix
ld a, 255
scf
call 0556h
push hl
end asm
end function
The expected result is that calling this function, for instance, in this way:
Code:
hload(16384, 6912)
should be able to load standard ZX screen data correctly. Trying to load a screen this way indicates that the screen is indeed loaded into the right area of memory, but once the loading completes, the computer is reset.
I'm pretty sure that this indicates that something is screwed up at the end of the function call. Could be due to the fact that SP or something else is modified from within 0556h and that changes the register state, or something else along those lines, but I can't quite figure it out :/ I would appreciate some help since I'm not sure how to proceed. I tried a few other cleanup tricks, but none of them worked.
Another question is: how do I properly return a value from this function? As far as I understand, the return value can be stored in the A register. Suppose I wanted to indicate that the tape loaded correctly with a value of 0, would I simply LD A, 0 at the end of the function and that would be enough? This, of course, is a separate issue once I can actually get this function to load anything without resetting the PC or hanging
I had an issue with my Boriel that prevented me from using the debugger. This has been fixed with help from the forum and me installing the latest version of the Boriel ZXBasicStudio.
My issue now is that I can no longer see Key Words when entering code (see attachment). If anyone could help on this it would be highly appreciated.
I checked with the older version and that does show the KeyWords, but won't run in debug mode.
I am working my way through the book 'Boriel Basic for Beginners'. It is a very good book and well written. I have convinced my friend to buy a copy too.
On page 166 in the example the first command is '#INCLUDE "ship.gdu.bas". When I exported the UDG's as per the instructions on page 165 it creates a file 'ship.gdu.zxbas'
I was wondering why it did not export with the extension '.bas'. I understand I just need to change the extension in the code and it loads in fine, I just want to understand why. It may be something I have done wrong.
Well, the code should be straightforward. I also know it should work because I ported it from C, the same source code I used wtith z88dk. Unfortunately, it does not work, or it does not always work... (check the image).
if x1 = 3 (or any positive number) the correct result (9) is printed.
If x1 = -3 I get no result in the output (nothing is printed on the screen) and no message is shown.
I've tried to define x1 and x2 as integer, with the same problem.
I'm using 1.17.3 version with ZX Basic Studio, but I also tried with Visual Studio Code and Fuse (same result).
I'm doing something wrong or it's a bug?
Thanks