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