copy.asm 356 B

12345678910111213141516171819202122232425
  1. FarCopyData::
  2. ; Copy bc bytes from a:hl to de.
  3. ld [wBuffer], a
  4. ld a, [H_LOADEDROMBANK]
  5. push af
  6. ld a, [wBuffer]
  7. ld [H_LOADEDROMBANK], a
  8. ld [MBC1RomBank], a
  9. call CopyData
  10. pop af
  11. ld [H_LOADEDROMBANK], a
  12. ld [MBC1RomBank], a
  13. ret
  14. CopyData::
  15. ; Copy bc bytes from hl to de.
  16. ld a, [hli]
  17. ld [de], a
  18. inc de
  19. dec bc
  20. ld a, c
  21. or b
  22. jr nz, CopyData
  23. ret