ref: 2a7ba6685afac73b824f611bbff228ff73cc51da
parent: 3c6c80f1b24487ae4aa9d250d1dff290f09c231e
author: xCrystal <rgr.crystal@gmail.com>
date: Fri Dec 29 14:22:33 EST 2017
Clean up changes in 3c6c80f
--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -50,6 +50,7 @@
OAM_Y_FLIP EQU 6
OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
+; BP Map attribute flags
PALETTE_MASK EQU %111
VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08
OBP_NUM EQU 1 << OAM_OBP_NUM ; $10
@@ -57,6 +58,10 @@
Y_FLIP EQU 1 << OAM_Y_FLIP ; $40
BEHIND_BG EQU 1 << OAM_PRIORITY ; $80
+; Other useful constants
+LCDC_DEFAULT EQU %11100011
+LY_VBLANK EQU 144
+
; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W)
rSB EQU $ff01 ; Serial transfer data (R/W)
@@ -114,16 +119,14 @@
rWave_e EQU $ff3e
rWave_f EQU $ff3f
rLCDC EQU $ff40 ; LCD Control (R/W)
-rLCDC_SPRITE_ENABLE EQU 1
-rLCDC_SPRITE_SIZE EQU 2
-rLCDC_WINDOW_TILEMAP EQU 6
-rLCDC_ENABLE EQU 7
-rLCDC_DEFAULT EQU %11100011
+rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On
+rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16
+rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF
+rLCDC_ENABLE EQU 7 ; 0=Off, 1=On
rSTAT EQU $ff41 ; LCDC Status (R/W)
rSCY EQU $ff42 ; Scroll Y (R/W)
rSCX EQU $ff43 ; Scroll X (R/W)
rLY EQU $ff44 ; LCDC Y-Coordinate (R)
-LY_VBLANK EQU 144
rLYC EQU $ff45 ; LY Compare (R/W)
rDMA EQU $ff46 ; DMA Transfer and Start Address (W)
rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -1073,7 +1073,7 @@
ld bc, $100 tiles
call CopyData
call DrawDefaultTiles
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ld hl, PalPacket_9d06
call PushSGBPals
@@ -1107,7 +1107,7 @@
ld bc, 16 palettes
call CopyData
call DrawDefaultTiles
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ld hl, PalPacket_9d46
call PushSGBPals
@@ -1131,7 +1131,7 @@
dec b
jr nz, .loop
call DrawDefaultTiles
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ld hl, PalPacket_9d36
call PushSGBPals
--- a/engine/dummy_game.asm
+++ b/engine/dummy_game.asm
@@ -34,7 +34,7 @@
ld [wJumptableIndex], a
ld a, $1
ld [hBGMapMode], a
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ld a, $e4
call DmgToCgbBGPals
--- a/engine/mystery_gift.asm
+++ b/engine/mystery_gift.asm
@@ -116,7 +116,7 @@
.PrintTextAndExit: ; 1049c5 (41:49c5)
call PrintText
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ret
; 1049cd (41:49cd)
@@ -1497,7 +1497,7 @@
asm_105726: ; 105726 (41:5726)
call PrintText
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ret
; 10572e (41:572e)
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -48,7 +48,7 @@
call DisableLCD
call LoadNamingScreenGFX
call NamingScreen_InitText
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
call .GetNamingScreenSetup
call WaitBGMap
@@ -1017,7 +1017,7 @@
add hl, bc
ld [hl], $0
call .InitCharset
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
call .initwNamingScreenMaxNameLength
ld b, SCGB_DIPLOMA
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -59,7 +59,7 @@
call InitPokegearModeIndicatorArrow
ld a, 8
call SkipMusic
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
call TownMap_InitCursorAndPlayerIconPositions
xor a
@@ -1851,7 +1851,7 @@
farcall ClearSpriteAnims
ld a, 8
call SkipMusic
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
call TownMap_GetCurrentLandmark
ld [wTownMapPlayerIconLandmark], a
--- a/engine/unown_puzzle.asm
+++ b/engine/unown_puzzle.asm
@@ -85,7 +85,7 @@
call ClearBGPalettes
call ClearTileMap
call ClearSprites
- ld a, rLCDC_DEFAULT
+ ld a, LCDC_DEFAULT
ld [rLCDC], a
ret
; e124e
--- a/engine/unused_title.asm
+++ b/engine/unused_title.asm
@@ -55,7 +55,7 @@
call EnableLCD
ld a, [rLCDC]
- set rLCDC_SPRITE_ENABLE, a
+ set rLCDC_SPRITES_ENABLE, a
set rLCDC_SPRITE_SIZE, a
ld [rLCDC], a
--- a/home/init.asm
+++ b/home/init.asm
@@ -125,7 +125,7 @@
ld [hWX], a
ld [rWX], a
- ld a, rLCDC_DEFAULT ; %11100011
+ ld a, LCDC_DEFAULT ; %11100011
; LCD on
; Win tilemap 1
; Win on
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -62,7 +62,7 @@
jr nz, .wait
ld a, [rLCDC]
- and $ff ^ 1 << rLCDC_ENABLE
+ and $ff ^ (1 << rLCDC_ENABLE)
ld [rLCDC], a
xor a