-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
z80ufixedbank: file was not added in updating
- Loading branch information
1 parent
eca8250
commit 3f780a6
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |