This is a discussion on 128 ROM paging alternative - Sinclair ; No takers on WoS so... Would this work (with the appropriate code in each ROM)? ; 128 rom paging routine ; use rst 28h with call address stored after restart ;;rom0 paging org 0x0028 ld hl, 0x0000 ; sp to ...
No takers on WoS so...
Would this work (with the appropriate code in each ROM)?
; 128 rom paging routine
; use rst 28h with call address stored after restart
;;rom0
paging
org 0x0028
ld hl, 0x0000 ; sp to hl
add hl, sp ;
ld e, (hl) ; (sp) to de
inc hl ;
ld d, (hl) ;
ex de, hl ; skip two bytes
inc hl ; to create
inc hl ; return address
ex (sp), hl ; call address to hl
; return address to (sp)
ld de, back_to_r0 ; address in rom1 of the return routine
push de ; put this address on the stack
push hl ; put the routine to call on the stack
ld hl, bankm ; hl holds address of system variable
set 4, (hl) ; set rom1
ld a, (hl) ; get value
ld bc, 0x7ffd ; bc holds port address
di ; disable interrupts for page
out (c),a ; and page
; continued in rom1
ei ; enable interrupts
ret ; call the required routine
; ret ; the ret at the end of the routine will be to
; back_to_r0
back_to_r0
ld hl, bankm ; hl holds address of system variable
res 4, (hl) ; set rom0
ld a, (hl) ; get value
ld bc, 0x7ffd ; bc holds port address
di ; disable interrupts for page
out (c),a ; and page
; continued in rom0
ei ; enable interrupts
ret ; back to the next instruction after the original rst
; and address