diff options
-rw-r--r-- | home/copy.asm | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/home/copy.asm b/home/copy.asm index be9c8c0c..ff66f027 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -1,24 +1,34 @@ -FarCopyData:: +FarCopyData:: ; 009d (0:009d) ; Copy bc bytes from a:hl to de. - ld [wBuffer], a + ld [wd122+1], a ld a, [H_LOADEDROMBANK] push af - ld a, [wBuffer] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + ld a, [wd122+1] + call BankswitchCommon call CopyData pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret -CopyData:: +CopyData:: ; 00b1 (0:00b1) ; Copy bc bytes from hl to de. + ld a,b + and a + jr z, .copybytes + ld a,c + and a ; is lower byte 0 + jr z, .loop + inc b ; if not, increment b as there are <$100 bytes to copy +.loop + call .copybytes + dec b + jr nz,.loop + ret + +.copybytes ; 00c1 ld a, [hli] ld [de], a inc de - dec bc - ld a, c - or b - jr nz, CopyData + dec c + jr nz, .copybytes ret |