diff options
author | luckytyphlosion <alan.rj.huang@gmail.com> | 2015-05-11 12:16:36 -0400 |
---|---|---|
committer | luckytyphlosion <alan.rj.huang@gmail.com> | 2015-05-11 12:16:36 -0400 |
commit | 7a249b901a949b98f2da9fc46bddc484ad2b5a54 (patch) | |
tree | 90400010cd4c72ebbae4e7453fa9e2a30a65edea | |
parent | f281f6a35422f797e72a5c16ebaf7ae14a22d03d (diff) |
Update copy.asm
-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 |