Skip to content

Commit

Permalink
z80ufixedbank: file was not added in updating
Browse files Browse the repository at this point in the history
  • Loading branch information
EtchedPixels committed May 26, 2024
1 parent eca8250 commit 3f780a6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Kernel/lib/z80ufixedbank.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

#include "../lib/z80ufixedbank-core.s"
;
; This is related so we will keep it here. Copy the process memory
; for a fork. a is the page base of the parent, c of the child
;
; Assumption - fits into a fixed number of whole 256 byte blocks
;

.common

bankfork:
ld b, >U_DATA_STASH - PROGBASE
ld hl, PROGBASE ; base of memory to fork (vectors included)
bankfork_1:
push bc ; Save our counter and also child offset
push hl
call map_proc_a
ld de, bouncebuffer
ld bc, 256
ldir ; copy into the bounce buffer
pop de ; recover source of copy to bounce
; as destination in new bank
pop bc ; recover child page number
push bc
ld b, a ; save the parent bank id
ld a, c ; switch to the child
call map_proc_a
push bc ; save the bank pointers
ld hl, bouncebuffer
ld bc, 256
ldir ; copy into the child
pop bc ; recover the bank pointers
ex de, hl ; destination is now source for next bank
ld a, b ; parent bank is wanted in a
pop bc
djnz bankfork_1 ; rinse, repeat
ret

0 comments on commit 3f780a6

Please sign in to comment.