Skip to content

Instantly share code, notes, and snippets.

@taylorza
Created September 6, 2026 14:50
Show Gist options
  • Select an option

  • Save taylorza/d15b6520b5baada0bff571a1db5733ad to your computer and use it in GitHub Desktop.

Select an option

Save taylorza/d15b6520b5baada0bff571a1db5733ad to your computer and use it in GitHub Desktop.
Example of replacing the MF ROM at runtime on the ZX Spectrum Next
#program mf
10 RUN AT 3: SAVE "mf.bas": CLEAR $bfff
20 .asm
30 ; org $c000
40 ;START
50 ; ;brk
60 ; ld bc,$243b
70 ; ld a,3
80 ; out (c),a
90 ; inc b
100 ; in a,(c)
110 ; ld (oldreg3),a
120 ; or @00000111
130 ; out (c),a
140 ; nreg 4,5
150 ; ld hl,ROM
160 ; ld de,0
170 ; ld bc,ROMLEN
180 ; ldir
190 ; ld a,(oldreg3)
200 ; nreg 3,a
210 ; and @01111000
220 ; nreg 3,a
230 ; nreg $50,$ff
240 ; nreg $51,$ff
250 ; ret
260 ;oldreg3 db 0
270 ;ROM
280 ; ds $38
290 ; ei
300 ; ret
310 ; ds ROM+$66-$
320 ; push af
330 ; ld a,3
340 ; out ($fe),a
350 ; pop af
370 ; retn
380 ;ROMLEN equ $-ROM
390 RANDOMIZE USR ($c000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment