From 2a7ba6685afac73b824f611bbff228ff73cc51da Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 29 Dec 2017 19:22:33 +0100 Subject: [PATCH] Clean up changes in 3c6c80f --- constants/hardware_constants.asm | 15 +++++++++------ engine/color.asm | 6 +++--- engine/dummy_game.asm | 2 +- engine/mystery_gift.asm | 4 ++-- engine/namingscreen.asm | 4 ++-- engine/pokegear.asm | 4 ++-- engine/unown_puzzle.asm | 2 +- engine/unused_title.asm | 2 +- home/init.asm | 2 +- home/lcd.asm | 2 +- 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index b84419815..7e7681acf 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -50,6 +50,7 @@ OAM_X_FLIP EQU 5 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 @@ X_FLIP EQU 1 << OAM_X_FLIP ; $20 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_d EQU $ff3d 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 diff --git a/engine/color.asm b/engine/color.asm index 35358934a..262bccbbb 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1073,7 +1073,7 @@ SGBBorder_PushBGPals: 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 @@ SGBBorder_MorePalPushing: 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 @@ SGBBorder_YetMorePalPushing: dec b jr nz, .loop call DrawDefaultTiles - ld a, rLCDC_DEFAULT + ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, PalPacket_9d36 call PushSGBPals diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index e5cc97dec..aecaa7425 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -34,7 +34,7 @@ _DummyGame: ; e1e5b (38:5e5b) 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 diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 574436b15..67ce10168 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -116,7 +116,7 @@ DoMysteryGift: ; 1048ba (41:48ba) .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 @@ Function10571a: ; 10571a (41:571a) asm_105726: ; 105726 (41:5726) call PrintText - ld a, rLCDC_DEFAULT + ld a, LCDC_DEFAULT ld [rLCDC], a ret ; 10572e (41:572e) diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 7eeed34a6..177f06f73 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -48,7 +48,7 @@ NamingScreen: ; 116c1 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 @@ _ComposeMailMessage: ; 11e75 (mail?) 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 diff --git a/engine/pokegear.asm b/engine/pokegear.asm index fff5174bd..dba071b28 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -59,7 +59,7 @@ PokeGear: ; 90b8d (24:4b8d) 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 @@ _TownMap: ; 9191c farcall ClearSpriteAnims ld a, 8 call SkipMusic - ld a, rLCDC_DEFAULT + ld a, LCDC_DEFAULT ld [rLCDC], a call TownMap_GetCurrentLandmark ld [wTownMapPlayerIconLandmark], a diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 3f76c7041..ee76f817c 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -85,7 +85,7 @@ UnownPuzzle: ; e1190 call ClearBGPalettes call ClearTileMap call ClearSprites - ld a, rLCDC_DEFAULT + ld a, LCDC_DEFAULT ld [rLCDC], a ret ; e124e diff --git a/engine/unused_title.asm b/engine/unused_title.asm index 0b7dc690d..650e17863 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -55,7 +55,7 @@ UnusedTitleScreen: ; 10c000 call EnableLCD ld a, [rLCDC] - set rLCDC_SPRITE_ENABLE, a + set rLCDC_SPRITES_ENABLE, a set rLCDC_SPRITE_SIZE, a ld [rLCDC], a diff --git a/home/init.asm b/home/init.asm index fc7a253f4..8895da0f9 100644 --- a/home/init.asm +++ b/home/init.asm @@ -125,7 +125,7 @@ Init:: ; 17d ld [hWX], a ld [rWX], a - ld a, rLCDC_DEFAULT ; %11100011 + ld a, LCDC_DEFAULT ; %11100011 ; LCD on ; Win tilemap 1 ; Win on diff --git a/home/lcd.asm b/home/lcd.asm index e516db9d6..dfb174ee1 100644 --- a/home/lcd.asm +++ b/home/lcd.asm @@ -62,7 +62,7 @@ DisableLCD:: ; 568 jr nz, .wait ld a, [rLCDC] - and $ff ^ 1 << rLCDC_ENABLE + and $ff ^ (1 << rLCDC_ENABLE) ld [rLCDC], a xor a