Re: Gamecoding in machinecode on a ZX81.
Posted: Mon Apr 19, 2021 7:42 pm
Thanks!
Discussion forums for users of the Sinclair 8-bit range of computers - ZX80, ZX81, ZX Spectrum, Z88, clones...
https://www.sinclairzxworld.com/
Code: Select all
jr nz,playon ; time we still can play
push hl
ld hl,(dot) ; replace the dot with a block
ld (hl),,'ú' ; set a block
pop hl
//use a life counter?
jr newdot
// non-reachable code, when to end (life counter)?
jp gamecode ; temporary end of game
playon: push hl
Code: Select all
test2: cp 61+128 ; 'ú'
jr nz,goodpos
ld bc,(lastpos) ; reset position (don't move)
call field ; and screen pos to draw
goodpos:ld (hl),,'ð' ; we write an invers "O" on the screen
ld (lastpos),bc ; remember actual XY as last one
timecnt:
Code: Select all
dot dw $0000 ; position of actual dot
lastpos dw $0000 ; last position of the player
gamecode:
Well, it is inactive and I nee to revive it.
Yes, shadowregisters can be used, but not needed (yet) here.And this where I would like to ask: There are limitations set by the display routine, I know.
But still, Can't we make use of the shadow registers and at least IY?
I thought IY is only used by the Basic interpreter and could be simply reset to $4000 in case we intend to go back.
So what is/are the experience/recommendations here?
I tried using IY in my hires games, assuming that I could PUSH and POP it in intrupt or assuming my hires routine didn't use IY so it was free.
In DOS mode, just type a batch file (BAT) to launch the assembler...I get nothing.
Code: Select all
ASM myfile.bin myfile.TXT
PAUSE
Code: Select all
ASM -h
ASM -?
PAUSE
Code: Select all
LD C,(IY+$3B)