Gamecoding in machinecode on a ZX81.

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
dr beep
Posts: 2084
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Gamecoding in machinecode on a ZX81.

Post by dr beep »

upkey loops until no key is pressed

nokey loops as long no key is pressed
MrVertigo
Posts: 106
Joined: Fri May 27, 2022 9:06 pm

Re: Gamecoding in machinecode on a ZX81.

Post by MrVertigo »

So we use both routines together in the code?
dr beep
Posts: 2084
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Gamecoding in machinecode on a ZX81.

Post 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
MrVertigo
Posts: 106
Joined: Fri May 27, 2022 9:06 pm

Re: Gamecoding in machinecode on a ZX81.

Post by MrVertigo »

Thank you!
salvacam
Posts: 52
Joined: Wed Jul 21, 2021 4:50 pm

Re: Gamecoding in machinecode on a ZX81.

Post 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
My games

ZX81 hoy Blog (in Spanish) of new games and applications for the ZX81
Karl_G
Posts: 3
Joined: Sun Apr 28, 2024 4:49 pm

Re: Gamecoding in machinecode on a ZX81.

Post 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!
dr beep
Posts: 2084
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Gamecoding in machinecode on a ZX81.

Post 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
User avatar
mrtinb
Posts: 1914
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Gamecoding in machinecode on a ZX81.

Post 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
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Post Reply