ZX81CRSS.ASM

Discussion about ZX80 / ZX81 Software
dr beep
Posts: 1153
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: ZX81CRSS.ASM

Post by dr beep » Fri Jan 11, 2019 8:50 pm

When you want the shortest start to MC you can use this.
Even the repair of Dfile can be done on the screen when you clear the screen and the code too,
but that is a bit harder.

Code: Select all

; Shortest code to autostart MC on a ZX81

	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

basic   ld h,dfile/256			; highbyte of dfile
        jr init1

	db 236				; BASIC over DFILE data
	db 212,28			; The RAND USR N will start MC at "basic"
	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

init1	ld l, dfile mod 256		; low byte of dfile
	jr init2			
		
lastk	db 255,255,255
margin  db 55

nxtlin  dw basic			; BASIC-line over sysvar	

	db 0,0
flagx	db 0

	db 0,0,0			; x
	db 0,0,0			; x

frames  dw 65535

init2	jp init4			; start your program
	db 0,0

cdflag  db 64

; THESE 3 BYTES ARE THE ONLY NOT USEABLE BYTES (but can be set on screen too)
start	ld (basic+3),hl			; repair lowres display

; HERE COMES YOUR PROGRAM
prog	jr prog				; start game, make screen over keytab

; The screen
dfile 	block 25,118


vars    db 128
last	equ $   	

end                	

nollkolltroll
Posts: 268
Joined: Sat Sep 27, 2014 8:02 pm
Location: Stockholm, Sweden

Re: ZX81CRSS.ASM

Post by nollkolltroll » Sat Jan 12, 2019 9:05 am

Very nice way to save some bytes in 1k-mode, which is truly needed.
/Adam

dr beep
Posts: 1153
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: ZX81CRSS.ASM

Post by dr beep » Sat Jan 12, 2019 9:18 am

nollkolltroll wrote:
Sat Jan 12, 2019 9:05 am
Very nice way to save some bytes in 1k-mode, which is truly needed.
In fact,when not returning to BASIC you could set a table or variables on some part of the sysvar.
Take a look at the source of RUB-1K where data is copied over sysvar and then that part of memory is used to set up
the sides of the cube. Reuse of 21 bytes. In 1K hires you can reuse dfile to lastk too.

Post Reply