Created
March 31, 2020 17:59
-
-
Save ISSOtm/3d560d0a9ee9de17e35925324dc0e29e to your computer and use it in GitHub Desktop.
Help me code golf this pls
This file contains hidden or 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
jr z, .noVRAMTransfer ; This JR is out of range | |
ld c, a | |
ldh a, [hConsoleType] | |
and a | |
jr z, .GDMA | |
ld [wSP], sp | |
ldh a, [hVRAMCopySrc] | |
ld l, a | |
ldh a, [hVRAMCopySrc+1] | |
ld h, a | |
ld sp, hl | |
ldh a, [hVRAMCopyDest] | |
ld l, a | |
ldh a, [hVRAMCopyDest+1] | |
ld h, a | |
ld a, c | |
cp 14 | |
jr c, .copyTile | |
ld c, 14 | |
.copyTile | |
REPT 16 / 2 ; Copy 1 tile (16 bytes), 2 bytes per "block" | |
pop de | |
ld a, e | |
ld [hli], a | |
ld a, d | |
ld [hli], a | |
ENDR | |
dec c | |
jr nz, .copyTile | |
ld hl, wSP | |
ld a, [hli] | |
ld h, [hl] | |
ld l, a | |
ld sp, hl | |
jr c, .finishedVRAMTransfer | |
ld hl, hVRAMCopyNbTiles | |
ld a, [hl] | |
sub 14 | |
ld [hli], a | |
ld a, [hl] | |
add a, 14 * 16 | |
ld [hli], a | |
jr nc, .noCarry | |
inc [hl] | |
.noCarry | |
inc hl | |
ld a, [hl] | |
add a, 14 * 16 | |
ld [hli], a | |
jr nc, .noVRAMTransfer | |
inc [hl] | |
jr .noVRAMTransfer | |
.GDMA | |
ldh a, [hVRAMCopySrc] | |
ldh [rHDMA2], a | |
ldh a, [hVRAMCopySrc+1] | |
ldh [rHDMA1], a | |
ldh a, [hVRAMCopyDest] | |
ldh [rHDMA4], a | |
ldh a, [hVRAMCopyDest+1] | |
ldh [rHDMA3], a | |
ld a, c | |
dec a | |
ldh [rHDMA5], a | |
.finishedVRAMTransfer | |
xor a | |
ldh [hVRAMCopyNbTiles], a | |
.noVRAMTransfer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment