Page 6 of 6
Re: Gamecoding in machinecode on a ZX81.
Posted: Fri Aug 04, 2023 4:10 pm
by dr beep
upkey loops until no key is pressed
nokey loops as long no key is pressed
Re: Gamecoding in machinecode on a ZX81.
Posted: Fri Aug 04, 2023 4:36 pm
by MrVertigo
So we use both routines together in the code?
Re: Gamecoding in machinecode on a ZX81.
Posted: Fri Aug 04, 2023 6:21 pm
by dr beep
MrVertigo wrote: ↑Fri Aug 04, 2023 4:36 pm
So we use both routines together in the code?
Yes or you can't keep up with the speed
Re: Gamecoding in machinecode on a ZX81.
Posted: Fri Aug 04, 2023 6:27 pm
by MrVertigo
Thank you!
Re: Gamecoding in machinecode on a ZX81.
Posted: Thu Apr 11, 2024 10:57 pm
by salvacam
I don't know if it has already been mentioned. I haven't read the whole thread yet.
dr beep wrote: ↑Sun Jan 31, 2021 4:25 pm
Code: Select all
gamecode
ld a,63
showa ld (screen),a
dec a
jr nz,showa
jr gamecode
I get an error when trying to compile this change. Label not found: screen
I have to put the screen label here for it to work
Code: Select all
screen
block 20,128 ; BLOCK places 20x character 128,inverted space
db 118
Re: Gamecoding in machinecode on a ZX81.
Posted: Sun Apr 28, 2024 6:05 pm
by Karl_G
Hello! Thank you for this tutorial. I have worked through it, and it is perfect for my style of learning (I learn best by just jumping in, and looking up stuff as I go).
I have a question in terms of reusing this template for other game projects below.
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 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!
Re: Gamecoding in machinecode on a ZX81.
Posted: Sun Apr 28, 2024 8:29 pm
by dr beep
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!
The code always loads at #4009 so you need to start at #4009.
You can use in your code the memory before #4009 to keep variables or so needed in the code.
My current program uses #4000 to store info who was first to place a guest on a table in a bar, computer or player
Re: Gamecoding in machinecode on a ZX81.
Posted: Mon Apr 29, 2024 2:29 am
by mrtinb
Karl_G wrote: ↑Sun Apr 28, 2024 6:05 pm
Hello! Thank you for this tutorial. I have worked through it, and it is perfect for my style of learning (I learn best by just jumping in, and looking up stuff as I go).
I have a question in terms of reusing this template for other game projects below.
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
Re: Gamecoding in machinecode on a ZX81.
Posted: Mon Apr 29, 2024 2:09 pm
by Karl_G
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
Thanks! Ordered!