Gamecoding in machinecode on a ZX81.
Re: Gamecoding in machinecode on a ZX81.
Thanks!
Zeddy: ZX80, ZX81/ZXpand, TS1000/ZXpand, TS1500/Zxpand+,Printer
Speccy: 48k, +, +2, +3, TS2068, "Bare Metal" Pi, Next KS2, IF1/Microdrives/Vdrive/Light Gun/VGA-Joy
QL: Minerva/QL-VGA/Custom PSU
C5: 24v, LiFE battery, Disc brakes
Speccy: 48k, +, +2, +3, TS2068, "Bare Metal" Pi, Next KS2, IF1/Microdrives/Vdrive/Light Gun/VGA-Joy
QL: Minerva/QL-VGA/Custom PSU
C5: 24v, LiFE battery, Disc brakes
Re: Gamecoding in machinecode on a ZX81.
Hello,
I am late starter hoping this discussion did not die yet.
First of all I have created a personal version: Since I use using FASM-ZX, you may need to adept to your assembler of choice. The weird character in the listing below is actually showing as a ZX81 graphics.
And the double colon makes the conversion to the ZX81 char set.
In my version when the time is up the actual dot gets replaced with an invers 'X'.
just before 'playon':
This is leaving me with some more "TODO's"
To make such chars blocking the player I continue at label test2: with:
Those code snippets make use of memory variables which I have defined upfront just before gamecode:.
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 am late starter hoping this discussion did not die yet.
First of all I have created a personal version: Since I use using FASM-ZX, you may need to adept to your assembler of choice. The weird character in the listing below is actually showing as a ZX81 graphics.
And the double colon makes the conversion to the ZX81 char set.
In my version when the time is up the actual dot gets replaced with an invers 'X'.
just before 'playon':
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
To make such chars blocking the player I continue at label test2: with:
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:
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?
Re: Gamecoding in machinecode on a ZX81.
Well, it is inactive and I nee to revive it.
Need to get some time for it, which might be possible since I stopped coding 1K hires games now for valid reasons.
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?
IY is a problem. When not set to #4000 the intrupt might crash.
The display uses IY at #294 and #297.
Re: Gamecoding in machinecode on a ZX81.
That’s what I’ve heard as well, but I haven’t used IY.
What does “Master Machine Code on your ZX81” say about using IY-register?
What does “Master Machine Code on your ZX81” say about using IY-register?
Re: Gamecoding in machinecode on a ZX81.
I’ve just looked through “Mastering Machine Code on your ZX81”, and I cannot find any mentioning of IY usage.
Re: Gamecoding in machinecode on a ZX81.
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.
It crashed on the use mentioned.
Re: Gamecoding in machinecode on a ZX81.
The book, Assembly language assembled for the Sinclair ZX81 written by Anthony Woods has programs plus a listing for the emulation "Life" which use the index registers but everything has to be run in fast mode when those registers are called.
The programs in the book, I find, don't do anything really useful and there are errors in places but hopefully you may find something of use concerning your problem.
The PDF can be found here...
https://datassette.nyc3.cdn.digitalocea ... r_zx81.pdf
The programs in the book, I find, don't do anything really useful and there are errors in places but hopefully you may find something of use concerning your problem.
The PDF can be found here...
https://datassette.nyc3.cdn.digitalocea ... r_zx81.pdf
Re: Gamecoding in machinecode on a ZX81.
Thanks for pointing to #292 and #297.
My first approach looking at the documentation (Ian Logan) made me first doubt because I read the '(MARGIN)' and '(CDFLAGS)' as simple references to the system vars as described in the original Sinclair handbook.
But thanks to today's emulators I could quickly verify, that indeed the IY-register is used: Seems reading the documentation is not that easy.
Thanks for the quick reply.
My first approach looking at the documentation (Ian Logan) made me first doubt because I read the '(MARGIN)' and '(CDFLAGS)' as simple references to the system vars as described in the original Sinclair handbook.
But thanks to today's emulators I could quickly verify, that indeed the IY-register is used: Seems reading the documentation is not that easy.
Thanks for the quick reply.
Re: Gamecoding in machinecode on a ZX81.
Not sure if this thread is still active, but the instructions fail for me right at the start. I drag the Game file to the Bat file. I get the dos window telling me to press any key. But I don’t get a .P file or a .LST file in the folder when dos window closes. I get nothing.
Any suggestions for why this is? I’m using Windows XP.
Any suggestions for why this is? I’m using Windows XP.
Re: Gamecoding in machinecode on a ZX81.
Hi,
COMPIL.BAT
The PAUSE will wait a key and will freeze the DOS screen, to allow to read the onscreen error restult.
Use:
to get ASM syntax,.
On DOS assembler, use the 8+3 format "12345678.123" file name format!
Try to close all editors text or binary used with your file.
Used to uncompress the zip before uses, it decompressed in a private temporary folder with long (Windows) name format...
Simple use a private folder "c:/ASM/TMP", never "c:/my_dally_work/my_precious_project"
Not on the Descktop, the Download or Temporary Windows directory !
Don't use any specials language characters... "âàéù"... and don't use the space character in the name too.
With Win 10, use an emulator like "DosBox" to run old DOS programs.
Is a relative jump, always in decimal.
LD C,(IY+59) to avoid to use LD A,($403B) ; LD C,A
... LD C,($403B) can't be use on the Z80 !
To retrieve BC, you had to get BC (16 bits;2 bytes) LD BC,($403B), but B is overwritten.
In DOS mode, just type a batch file (BAT) to launch the assembler...I get nothing.
COMPIL.BAT
Code: Select all
ASM myfile.bin myfile.TXT
PAUSE
Use:
Code: Select all
ASM -h
ASM -?
PAUSE
On DOS assembler, use the 8+3 format "12345678.123" file name format!
Try to close all editors text or binary used with your file.
Used to uncompress the zip before uses, it decompressed in a private temporary folder with long (Windows) name format...
Simple use a private folder "c:/ASM/TMP", never "c:/my_dally_work/my_precious_project"
Not on the Descktop, the Download or Temporary Windows directory !
Don't use any specials language characters... "âàéù"... and don't use the space character in the name too.
With Win 10, use an emulator like "DosBox" to run old DOS programs.
Code: Select all
LD C,(IY+$3B)
LD C,(IY+59) to avoid to use LD A,($403B) ; LD C,A
... LD C,($403B) can't be use on the Z80 !
To retrieve BC, you had to get BC (16 bits;2 bytes) LD BC,($403B), but B is overwritten.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)