The code for the demo is quite simple. It pretty much sets up the undocumented screen mode, adds an interrupt handler which toggles the BG tiles every frame, either 0000h or 2000h. The colors are standard screen 0, i.e. whatever is in VDP(7). The BG map is also as screen 0, i.e. 40x20 bytes.
The code includes a vram binary that has tile data for odd pages at 0000h-1800h and even pages at 2000h-3800h. Then the BG map is at 1800h. So you could easily just create a vram dump yourselves if you want to play with the code.
;------------------------------------------------------
;
; Description: Views an image using undocumented screen mode
;
; The new VRAM map is:
; 0000-17FF : Pattern table 1
; 2000-37FF : Pattern table 2
; 1800-1BC0 : Name table
;
; Use asMSX to compile (although is easily adapted to other assemblers)
;
;------------------------------------------------------
.bios
.page 1
.rom
.start MAIN
RG2SAV equ $F3E1
RG4SAV equ $F3E3
MAIN:
ld hl,VDP_REGS
di
ld a,$80
ld c,$99
@@CPYLOOP:
outi
nop
nop
out ($99),a
inc a
cp $88
jp nz,@@CPYLOOP
ei
ld a,3
ld [VALUE],a
ld hl,VRAM_DATA
ld de,0
ld bc,$3800
call LDIRVM
; installs interupt hook
call INSTALLISR
@@HANG:
jp @@HANG
;
; Interrupt routine
;
ISR:
di
in a,($99)
ld a,[VALUE]
out [$99],a
xor 4
ld [VALUE],a
ld a,$84
out [$99],a
ei
ret
;
; Installs interrupt hook
;
INSTALLISR: di
ld hl,$FD9F
ld de,HOOK
ld bc,5
ldir
ld a,$C3
ld hl,ISR
ld [$FD9F],a
ld [$FD9F+1],hl
ei
ret
;
; Uninstalls interrupt hook (not used in this example! :P)
;
REMOVEISR: di
ld hl,HOOK
ld de,$FD9F
ld bc,5
ldir
ei
ret
VDP_REGS:
db 02h,f0h,06h,ffh,03h,36h,07h,b1h
VRAM_DATA:
.INCBIN "vram.dat"
;
; RAM variables
;
.page 3
VALUE: DS 1
HOOK: DS 5