From 19126df7f4b69ca8001b6d2ca6b2c703b7625195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= Date: Sun, 3 May 2020 22:41:56 +0200 Subject: [PATCH] Save 8 bytes in the CGB boot ROM --- BootROMs/cgb_boot.asm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/BootROMs/cgb_boot.asm b/BootROMs/cgb_boot.asm index 6ae869b..618e11a 100644 --- a/BootROMs/cgb_boot.asm +++ b/BootROMs/cgb_boot.asm @@ -984,14 +984,13 @@ BrightenColor: and $1F cp $1F jr nz, .blueNotMaxed - res 0, c + dec c .blueNotMaxed ; Is green maxed? ld a, e - and $E0 cp $E0 - jr nz, .greenNotMaxed + jr c, .greenNotMaxed ld a, d and $3 cp $3 @@ -1007,18 +1006,13 @@ BrightenColor: res 2, b .redNotMaxed - ; Add de to bc - push hl - ld h, d - ld l, e - add hl, bc - ld d, h - ld e, l - pop hl - + ; add de, bc + ; ld [hli], de ld a, e + add c ld [hli], a ld a, d + adc b ld [hli], a ret @@ -1155,7 +1149,7 @@ ReplaceColorInAllPalettes: dec c jr nz, .loop ret - + LoadDMGTilemap: push af call WaitFrame