Re: Gamecoding in machinecode on a ZX81.
Posted: Fri Aug 04, 2023 4:10 pm
upkey loops until no key is pressed
nokey loops as long no key is pressed
nokey loops as long no key is pressed
Discussion forums for users of the Sinclair 8-bit range of computers - ZX80, ZX81, ZX Spectrum, Z88, clones...
https://www.sinclairzxworld.com/
I get an error when trying to compile this change. Label not found: screendr beep wrote: ↑Sun Jan 31, 2021 4:25 pmCode: Select all
gamecode ld a,63 showa ld (screen),a dec a jr nz,showa jr gamecode
Code: Select all
screen
block 20,128 ; BLOCK places 20x character 128,inverted space
db 118
Code: Select all
; 12 bytes from #4000 to #400B free reuseble for own "variables"
org #4009
; in LOWRES more sysvar are used, but in this way the shortest code
; over sysvar to start machinecode. This saves 11 bytes of BASIC
; DO NOT CHANGE AFTER BASIC+3 (=DFILE)
basic ld h,dfile/256 ; highbyte of dfile
jr init1
db 236 ; BASIC over DFILE data
db 212,28
db 126,143,0,18
eline dw last
chadd dw last-1
db 0,0,0,0,0,0 ; x
berg db 0 ; x
mem db 0,0 ; x OVERWRITTEN ON LOAD
The code always loads at #4009 so you need to start at #4009.Karl_G wrote: ↑Sun Apr 28, 2024 6:05 pm
The comments say that I can use #4000 to #400B for variables, but the org starts at #4009. Would I start it at #4000 if I wanted to make use of that RAM?
Would I leave the rest of this snippet alone for my own game? I assume I could at least use the two bytes with the mem label after initialization?
Also, is there anything else I should keep in mind when modifying this template for my own use?
Thanks again for this tutorial!
Know that DrBeep has just published all this knowledge in his new book. And it is very cheap indeed.
Thanks! Ordered!mrtinb wrote: ↑Mon Apr 29, 2024 2:29 am Know that DrBeep has just published all this knowledge in his new book. And it is very cheap indeed.
The ultimate 1K coding book: How to fully use the 1K ZX81 https://amzn.eu/d/cPnqyX1