diff options
Diffstat (limited to 'home')
-rw-r--r-- | home/audio.asm | 11 | ||||
-rw-r--r-- | home/battle.asm | 12 | ||||
-rw-r--r-- | home/copy.asm | 25 | ||||
-rw-r--r-- | home/cry.asm | 7 | ||||
-rw-r--r-- | home/fade.asm | 2 | ||||
-rw-r--r-- | home/flag.asm | 8 | ||||
-rw-r--r-- | home/joypad.asm | 17 | ||||
-rw-r--r-- | home/map.asm | 334 | ||||
-rw-r--r-- | home/map_objects.asm | 264 | ||||
-rw-r--r-- | home/menu.asm | 65 | ||||
-rw-r--r-- | home/movement.asm | 18 | ||||
-rw-r--r-- | home/palettes.asm | 2 | ||||
-rw-r--r-- | home/text.asm | 42 | ||||
-rw-r--r-- | home/tilemap.asm | 12 | ||||
-rw-r--r-- | home/vblank.asm | 5 | ||||
-rw-r--r-- | home/video.asm | 3 | ||||
-rw-r--r-- | home/window.asm | 6 |
17 files changed, 434 insertions, 399 deletions
diff --git a/home/audio.asm b/home/audio.asm index 331999e78..3e22a1540 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -158,12 +158,9 @@ PlayCryHeader:: ; 3be3 ld [MBC3RomBank], a ld hl, CryHeaders +rept 6 add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de +endr ld e, [hl] inc hl @@ -321,7 +318,7 @@ Function3ca8:: ; 3ca8 ret ; 3cae -Function3cae:: ; 3cae +CrankUpTheVolume:: ; 3cae ld a, 4 | 1 << 7 ld [MusicFade], a ret @@ -423,7 +420,7 @@ EnterMapMusic:: ; 3d03 ret ; 3d2f -Function3d2f:: ; 3d2f +TryRestartMapMusic:: ; 3d2f ld a, [wc2c1] and a jr z, RestartMapMusic diff --git a/home/battle.asm b/home/battle.asm index 758c15ae1..9b89e673c 100644 --- a/home/battle.asm +++ b/home/battle.asm @@ -91,7 +91,7 @@ UpdateBattleMonInParty:: ; 399c ld a, [CurBattleMon] -Function399f:: ; 399f +UpdateBattleMon:: ; 399f ld hl, PartyMon1Level call GetPartyLocation @@ -153,8 +153,9 @@ GetBattleVarAddr:: ; 39e7 ld hl, .battlevarpairs ld c, a ld b, 0 +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] @@ -174,8 +175,9 @@ GetBattleVarAddr:: ; 39e7 ld b, 0 ld hl, .vars +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] @@ -260,7 +262,7 @@ GetBattleVarAddr:: ; 39e7 ; 3a90 -Function3a90:: ; 3a90 +FarJumpText:: ; 3a90 inc hl ld a, [hROMBank] push af @@ -310,7 +312,7 @@ BattleTextBox:: ; 3ac3 push hl call SpeechTextBox call MobileTextBorder - call Function1ad2 + call DrawOnMap call Function321c pop hl call PrintTextBoxText diff --git a/home/copy.asm b/home/copy.asm index e49094554..3cc64f091 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -56,7 +56,7 @@ Functiondfd:: ; dfd ld a, b rst Bankswitch -.asm_e09 +.loop ld a, d ld [rHDMA1], a ld a, e @@ -70,27 +70,27 @@ Functiondfd:: ; dfd ld [rHDMA4], a ld a, c cp $8 - jr c, .asm_e3c + jr c, .done sub $8 ld c, a ld a, $f ld [hDMATransfer], a call DelayFrame ld a, l - add $0 + add 0 ld l, a ld a, h - adc $1 + adc 1 ld h, a ld a, e - add $0 + add 0 ld e, a ld a, d - adc $1 + adc 1 ld d, a - jr .asm_e09 + jr .loop -.asm_e3c +.done ld a, c and $7f ld [hDMATransfer], a @@ -105,7 +105,7 @@ Functiondfd:: ; dfd -Functione4a:: ; e4a +Special_ReplaceKrisSprite:: ; e4a callba Function14135 ret ; e51 @@ -195,8 +195,9 @@ FarCopyBytesDouble:: ; e9b .loop ld a, [de] inc de +rept 2 ld [hli], a - ld [hli], a +endr .dec dec c jr nz, .loop @@ -406,9 +407,9 @@ Copy1bpp:: ; fa4 push af ld h, 0 ld l, c +rept 3 add hl, hl - add hl, hl - add hl, hl +endr ld b, h ld c, l pop af diff --git a/home/cry.asm b/home/cry.asm index 456037db4..ac9ac8029 100644 --- a/home/cry.asm +++ b/home/cry.asm @@ -66,12 +66,9 @@ LoadCryHeader:: ; 37f3 rst Bankswitch ld hl, CryHeaders +rept 6 add hl, bc - add hl, bc - add hl, bc - add hl, bc - add hl, bc - add hl, bc +endr ld e, [hl] inc hl diff --git a/home/fade.asm b/home/fade.asm index 2c8bc3baa..2559a0eb7 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -36,7 +36,7 @@ Function4a3:: ; 4a3 jr FadeOut ; 4b6 -Function4b6:: ; 4b6 +FadeToWhite:: ; 4b6 ld a, [hCGB] and a jr z, .asm_4c2 diff --git a/home/flag.asm b/home/flag.asm index 479a51c33..b4dff4531 100644 --- a/home/flag.asm +++ b/home/flag.asm @@ -1,11 +1,11 @@ -Function2e50:: ; 2e50 +ResetMapBufferEventFlags:: ; 2e50 xor a ld hl, EventFlags ld [hli], a ret ; 2e56 -Function2e56:: ; 2e56 +ResetBikeFlags:: ; 2e56 xor a ld hl, BikeFlags ld [hli], a @@ -13,8 +13,8 @@ Function2e56:: ; 2e56 ret ; 2e5d -Function2e5d:: ; 2e5d - ld a, [wd19a] +ResetFlashIfOutOfCave:: ; 2e5d + ld a, [wPermission] cp $2 jr z, .asm_2e69 cp $1 diff --git a/home/joypad.asm b/home/joypad.asm index 5a161fb14..78a1ac143 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -42,8 +42,9 @@ Joypad:: ; 935 ld a, D_PAD ld [rJOYP], a ; Read twice to give the request time to take. +rept 2 ld a, [rJOYP] - ld a, [rJOYP] +endr ; The Joypad register output is in the lo nybble (inversed). ; We make the hi nybble of our new container d-pad input. @@ -59,12 +60,9 @@ Joypad:: ; 935 ld a, BUTTONS ld [rJOYP], a ; Wait for input to stabilize. +rept 6 ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] +endr ; Buttons take the lo nybble. cpl and $f @@ -211,8 +209,9 @@ GetJoypad:: ; 984 jr nz, .next ; The current input is overwritten. +rept 2 dec hl - dec hl +endr ld b, NO_INPUT jr .finishauto @@ -312,7 +311,7 @@ Functiona36:: ; a36 jr Functiona36 ; a46 -Functiona46:: ; a46 +CloseText:: ; a46 ld a, [hOAMUpdate] push af ld a, 1 @@ -387,7 +386,7 @@ Functionaa5:: ; aa5 ret ; aaf -Functionaaf:: ; aaf +KeepTextOpen:: ; aaf ld a, [InLinkBattle] and a jr nz, .asm_ac1 diff --git a/home/map.asm b/home/map.asm index 259ed9503..2954c7d41 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1,6 +1,6 @@ ; Functions dealing with rendering and interacting with maps. -Function210f:: ; 210f +Clearwc7e8:: ; 210f ld hl, wc7e8 ld bc, $0018 ld a, $0 @@ -8,41 +8,49 @@ Function210f:: ; 210f ret ; 211b -Function211b:: ; 211b +CheckTriggers:: ; 211b +; Checks wCurrentMapTriggerPointer. If it's empty, returns -1 in a. Otherwise, returns the active trigger ID in a. push hl - ld hl, BikeFlags + 2 + ld hl, wCurrentMapTriggerPointer ld a, [hli] ld h, [hl] ld l, a or h ld a, [hl] - jr nz, .asm_2128 - ld a, $ff + jr nz, .triggerexists + ld a, -1 -.asm_2128 +.triggerexists pop hl ret ; 212a GetCurrentMapTrigger:: ; 212a +; Grabs the wram map trigger pointer for the current map and loads it into wCurrentMapTriggerPointer. +; If there are no triggers, both bytes of wCurrentMapTriggerPointer are wiped clean. +; Copy the current map group and number into bc. This is needed for GetMapTrigger. ld a, [MapGroup] ld b, a ld a, [MapNumber] ld c, a +; Blank out wCurrentMapTriggerPointer; this is the default scenario. xor a - ld [BikeFlags + 2], a - ld [BikeFlags + 3], a + ld [wCurrentMapTriggerPointer], a + ld [wCurrentMapTriggerPointer + 1], a call GetMapTrigger - ret c + ret c ; The map is not in the trigger table +; Load the trigger table pointer from de into wCurrentMapTriggerPointer ld a, e - ld [BikeFlags + 2], a + ld [wCurrentMapTriggerPointer], a ld a, d - ld [BikeFlags + 3], a + ld [wCurrentMapTriggerPointer + 1], a xor a ret ; 2147 GetMapTrigger:: ; 2147 +; Searches the trigger table for the map group and number loaded in bc, and returns the wram pointer in de. +; If the map is not in the trigger table, returns carry. push bc ld a, [hROMBank] push af @@ -50,34 +58,34 @@ GetMapTrigger:: ; 2147 rst Bankswitch ld hl, MapTriggers -.asm_2151 +.loop push hl - ld a, [hli] - cp $ff - jr z, .asm_2167 + ld a, [hli] ; map group, or terminator + cp -1 + jr z, .end ; the current map is not in the trigger table cp b - jr nz, .asm_2160 - ld a, [hli] + jr nz, .next ; map group did not match + ld a, [hli] ; map number cp c - jr nz, .asm_2160 - jr .asm_216a + jr nz, .next ; map number did not match + jr .found ; we found our map -.asm_2160 +.next pop hl - ld de, $0004 + ld de, 4 ; size of an entry in the trigger table add hl, de - jr .asm_2151 + jr .loop -.asm_2167 +.end scf - jr .asm_216d + jr .done -.asm_216a +.found ld e, [hl] inc hl ld d, [hl] -.asm_216d +.done pop hl pop bc ld a, b @@ -142,9 +150,9 @@ Function2198:: ; 2198 add a ld l, a ld h, 0 - add hl, hl - add hl, hl - add hl, hl +rept 3 + add hl,hl +endr ld a, [TilesetBlocksAddress] add l ld l, a @@ -234,7 +242,7 @@ Function2252:: ; 2252 ld a, [hROMBank] push af - call Function2c52 + call SwitchToMapScriptHeaderBank call Function2266 pop de @@ -295,8 +303,9 @@ Function2266:: ; 2266 ; 22a3 Function22a3:: ; 22a3 +rept 2 inc hl - inc hl +endr scf ret ; 22a7 @@ -305,7 +314,7 @@ Function22a7:: ; 22a7 ld a, [hROMBank] push af - call Function2c52 + call SwitchToMapScriptHeaderBank call Function22b4 pop af @@ -379,18 +388,18 @@ Function2300:: ; 2300 ; 2309 -Function2309:: ; 2309 +LoadMapAttributes:: ; 2309 call Function2326 - call Function2c52 + call SwitchToMapScriptHeaderBank call Function234f xor a call Function2336 ret ; 2317 -Function2317:: ; 2317 +LoadMapAttributes_IgnoreHidden:: ; 2317 call Function2326 - call Function2c52 + call SwitchToMapScriptHeaderBank call Function234f ld a, $1 call Function2336 @@ -412,8 +421,9 @@ Function2336:: ; 2336 ld a, [hli] ld h, [hl] ld l, a +rept 2 inc hl - inc hl +endr call Function23da call Function23f1 call Function2408 @@ -548,7 +558,7 @@ Function23da:: ; 23da Function23f1:: ; 23f1 ld a, [hli] ld c, a - ld [wdbfe], a + ld [wCurrentMapXYTriggerCount], a ld a, l ld [wdbff], a ld a, h @@ -564,7 +574,7 @@ Function23f1:: ; 23f1 Function2408:: ; 2408 ld a, [hli] ld c, a - ld [wdc01], a + ld [wCurrentMapSignpostCount], a ld a, l ld [wdc02], a ld a, h @@ -656,7 +666,7 @@ Function2471:: ; 2471 ret ; 248a -Function248a:: ; 248a +RestoreFacingAfterWarp:: ; 248a call GetMapScriptHeaderBank rst Bankswitch @@ -664,9 +674,9 @@ Function248a:: ; 248a ld a, [hli] ld h, [hl] ld l, a +rept 3 inc hl - inc hl - inc hl +endr ld a, [WarpNumber] dec a ld c, a @@ -683,7 +693,7 @@ Function248a:: ; 248a call Function24ba .asm_24b3 - callba Function10486d + callba GetCoordOfUpperLeftCorner ret ; 24ba @@ -697,21 +707,21 @@ Function24ba:: ; 24ba ret ; 24cd -Function24cd:: ; 24cd +LoadBlockData:: ; 24cd ld hl, OverworldMap ld bc, OverworldMapEnd - OverworldMap ld a, 0 call ByteFill - call Function24e4 + call ChangeMap call FillMapConnections ld a, $1 - call Function263b + call RunMapCallback ret ; 24e4 -Function24e4:: ; 24e4 +ChangeMap:: ; 24e4 ld a, [hROMBank] push af @@ -722,9 +732,9 @@ Function24e4:: ; 24e4 ld [hConnectionStripLength], a ld c, a ld b, 0 +rept 3 add hl, bc - add hl, bc - add hl, bc +endr ld c, 3 add hl, bc ld a, [MapBlockDataBank] @@ -938,7 +948,7 @@ FillEastConnectionStrip:: ; 25f6 ret ; 261b -Function261b:: ; 261b +LoadMapStatus:: ; 261b ld [MapStatus], a ret ; 261f @@ -968,11 +978,12 @@ Function2631:: ; 2631 jr CallScript ; 263b -Function263b:: ; 263b +RunMapCallback:: ; 263b +; Will run the first callback found in the map header with execution index equal to a. ld b, a ld a, [hROMBank] push af - call Function2c52 + call SwitchToMapScriptHeaderBank call Function2653 jr nc, .done @@ -980,7 +991,7 @@ Function263b:: ; 263b ld b, a ld d, h ld e, l - call Function2674 + call ExecuteCallbackScript .done pop af @@ -999,18 +1010,18 @@ Function2653:: ; 2653 ld l, a or h ret z - ld de, $0003 -.asm_2664 + ld de, 3 +.loop ld a, [hl] cp b - jr z, .asm_266e + jr z, .done add hl, de dec c - jr nz, .asm_2664 + jr nz, .loop xor a ret -.asm_266e +.done inc hl ld a, [hli] ld h, [hl] @@ -1019,7 +1030,7 @@ Function2653:: ; 2653 ret ; 2674 -Function2674:: ; 2674 +ExecuteCallbackScript:: ; 2674 callba Function974f3 ld a, [ScriptMode] push af @@ -1027,7 +1038,7 @@ Function2674:: ; 2674 ld a, [hl] push af set 1, [hl] - callba Function96c56 + callba EnableScriptMode callba ScriptEvents pop af ld [ScriptFlags], a @@ -1036,7 +1047,7 @@ Function2674:: ; 2674 ret ; 269a -Function269a:: ; 269a +MapTextbox:: ; 269a ld a, [hROMBank] push af @@ -1059,7 +1070,7 @@ Function269a:: ; 269a ret ; 26b7 -Function26b7:: ; 26b7 +Call_a_de:: ; 26b7 ; Call a:de. ld [hBuffer], a @@ -1079,7 +1090,7 @@ Function26b7:: ; 26b7 ret ; 26c7 -Function26c7:: ; 26c7 +GetMovementData:: ; 26c7 ld a, [hROMBank] push af ld a, b @@ -1315,8 +1326,9 @@ Function27d3:: ; 27d3 ld a, d ld [hli], a ld a, e +rept 2 inc a - inc a +endr and $1f ld b, a ld a, e @@ -1412,7 +1424,7 @@ Function2821:: ; 2821 ret ; 2879 -Function2879:: ; 2879 +BufferScreen:: ; 2879 ld hl, wd194 ld a, [hli] ld h, [hl] @@ -1441,7 +1453,7 @@ Function2879:: ; 2879 ret ; 289d -Function289d:: ; 289d +SaveScreen:: ; 289d ld hl, wd194 ld a, [hli] ld h, [hl] @@ -1491,7 +1503,7 @@ Function289d:: ; 289d jr Function28f7 -Function28e3:: ; 28e3 +LoadNeighboringBlockData:: ; 28e3 ld hl, wd194 ld a, [hli] ld h, [hl] @@ -1607,13 +1619,13 @@ Function298b:: ; 298b ld a, [TileDown] and $7 cp $2 - jr z, .asm_299f + jr z, .ok cp $6 - jr z, .asm_299f + jr z, .ok cp $7 ret nz -.asm_299f +.ok ld a, [TilePermissions] or $8 ld [TilePermissions], a @@ -1626,13 +1638,13 @@ Function29a8:: ; 29a8 ld a, [TileUp] and $7 cp $3 - jr z, .asm_29bc + jr z, .ok cp $4 - jr z, .asm_29bc + jr z, .ok cp $5 ret nz -.asm_29bc +.ok ld a, [TilePermissions] or $4 ld [TilePermissions], a @@ -1645,13 +1657,13 @@ Function29c5:: ; 29c5 ld a, [TileRight] and $7 cp $1 - jr z, .asm_29d9 + jr z, .ok cp $5 - jr z, .asm_29d9 + jr z, .ok cp $7 ret nz -.asm_29d9 +.ok ld a, [TilePermissions] or $1 ld [TilePermissions], a @@ -1664,13 +1676,13 @@ Function29e2:: ; 29e2 ld a, [TileLeft] and $7 cp $0 - jr z, .asm_29f6 + jr z, .ok cp $4 - jr z, .asm_29f6 + jr z, .ok cp $6 ret nz -.asm_29f6 +.ok ld a, [TilePermissions] or $2 ld [TilePermissions], a @@ -1696,8 +1708,9 @@ GetFacingTileCoord:: ; 2a07 srl a ld l, a ld h, 0 - add hl, hl - add hl, hl +rept 2 + add hl,hl +endr ld de, .Directions add hl, de @@ -1733,65 +1746,67 @@ GetFacingTileCoord:: ; 2a07 Function2a3c:: ; 2a3c - call Function2a66 + call GetBlockLocation ld a, [hl] and a - jr z, .asm_2a63 + jr z, .nope ld l, a ld h, $0 - add hl, hl - add hl, hl +rept 2 + add hl,hl +endr ld a, [TilesetCollisionAddress] ld c, a ld a, [TilesetCollisionAddress + 1] ld b, a add hl, bc rr d - jr nc, .asm_2a56 + jr nc, .nocarry inc hl -.asm_2a56 +.nocarry rr e - jr nc, .asm_2a5c - inc hl + jr nc, .nocarry2 +rept 2 inc hl +endr -.asm_2a5c +.nocarry2 ld a, [TilesetCollisionBank] call GetFarByte ret -.asm_2a63 - ld a, $ff +.nope + ld a, -1 ret ; 2a66 -Function2a66:: ; 2a66 +GetBlockLocation:: ; 2a66 ld a, [MapWidth] - add $6 + add 6 ld c, a - ld b, $0 + ld b, 0 ld hl, wc801 add hl, bc ld a, e srl a - jr z, .asm_2a84 + jr z, .nope and a -.asm_2a78 +.loop srl a - jr nc, .asm_2a7d + jr nc, .ok add hl, bc -.asm_2a7d +.ok sla c rl b and a - jr nz, .asm_2a78 + jr nz, .loop -.asm_2a84 +.nope ld c, d srl c - ld b, $0 + ld b, 0 add hl, bc ret ; 2a8b @@ -1799,128 +1814,138 @@ Function2a66:: ; 2a66 CheckFacingSign:: ; 2a8b call GetFacingTileCoord +; Load facing into b. ld b, a +; Convert the coordinates at de to within-boundaries coordinates. ld a, d sub 4 ld d, a ld a, e sub 4 ld e, a - ld a, [wdc01] +; If there are no signposts, we don't need to be here. + ld a, [wCurrentMapSignpostCount] and a ret z ld c, a ld a, [hROMBank] push af - call Function2c52 - call Function2aaa + call SwitchToMapScriptHeaderBank + call CheckIfFacingTileCoordIsSign pop hl ld a, h rst Bankswitch ret ; 2aaa -Function2aaa:: ; 2aaa +CheckIfFacingTileCoordIsSign:: ; 2aaa +; Checks to see if you are facing a signpost. If so, copies it into EngineBuffer1 and sets carry. ld hl, wdc02 ld a, [hli] ld h, [hl] ld l, a -.asm_2ab0 +.loop push hl ld a, [hli] cp e - jr nz, .asm_2abb + jr nz, .next ld a, [hli] cp d - jr nz, .asm_2abb - jr .asm_2ac8 + jr nz, .next + jr .copysign -.asm_2abb +.next pop hl - ld a, 5 + ld a, 5 ; signpost event length add l ld l, a - jr nc, .asm_2ac3 + jr nc, .nocarry inc h -.asm_2ac3 +.nocarry dec c - jr nz, .asm_2ab0 + jr nz, .loop xor a ret -.asm_2ac8 +.copysign pop hl ld de, EngineBuffer1 - ld bc, 5 + ld bc, 5 ; signpost event length call CopyBytes scf ret ; 2ad4 -Function2ad4:: ; 2ad4 - ld a, [wdbfe] +CheckCurrentMapXYTriggers:: ; 2ad4 +; If there are no xy triggers, we don't need to be here. + ld a, [wCurrentMapXYTriggerCount] and a ret z +; Copy the trigger count into c. ld c, a ld a, [hROMBank] push af - call Function2c52 - call Function2ae7 + call SwitchToMapScriptHeaderBank + call CheckStandingOnXYTrigger pop hl ld a, h rst Bankswitch ret ; 2ae7 -Function2ae7:: ; 2ae7 +CheckStandingOnXYTrigger:: ; 2ae7 +; Checks to see if you are standing on an xy-trigger. If yes, copies the trigger to EngineBuffer1 and sets carry. ld hl, wdbff ld a, [hli] ld h, [hl] ld l, a - call Function211b +; Load the active trigger ID into b + call CheckTriggers ld b, a +; Load your current coordinates into de. This will be used to check if your position is in the xy-trigger table for the current map. ld a, [MapX] - sub $4 + sub 4 ld d, a ld a, [MapY] - sub $4 + sub 4 ld e, a -.asm_2afd + +.loop push hl ld a, [hli] cp b - jr z, .asm_2b06 - cp $ff - jr nz, .asm_2b10 + jr z, .got_id + cp -1 + jr nz, .next -.asm_2b06 +.got_id ld a, [hli] cp e - jr nz, .asm_2b10 + jr nz, .next ld a, [hli] cp d - jr nz, .asm_2b10 - jr .asm_2b1d + jr nz, .next + jr .copytrigger -.asm_2b10 +.next pop hl - ld a, $8 + ld a, $8 ; xy-trigger size add l ld l, a - jr nc, .asm_2b18 + jr nc, .nocarry inc h -.asm_2b18 +.nocarry dec c - jr nz, .asm_2afd + jr nz, .loop xor a ret -.asm_2b1d +.copytrigger pop hl ld de, EngineBuffer1 - ld bc, $0008 + ld bc, $0008 ; xy-trigger size call CopyBytes scf ret @@ -1931,7 +1956,7 @@ FadeToMenu:: ; 2b29 xor a ld [hBGMapMode], a call Function1d6e - callba Function8c084 + callba FadeBlackBGMap call ClearSprites call Function2ed3 ret @@ -1941,7 +1966,7 @@ FadeToMenu:: ; 2b29 Function2b3c:: ; 2b3c call WhiteBGMap call Function2bae - call Function1ad2 + call DrawOnMap call Function1d7d call Functiond90 jr Function2b5c @@ -1951,7 +1976,7 @@ Function2b4d:: ; 2b4d call WhiteBGMap call Function1d7d call Function2bae - call Function1ad2 + call DrawOnMap call Functiond90 ; 2b5c @@ -1960,7 +1985,7 @@ Function2b5c:: ; 2b5c call GetSGBLayout callba Function49409 call Function3200 - callba Function8c079 + callba FadeInBGMap call Function2ee4 ret ; 2b74 @@ -1978,7 +2003,7 @@ Function2b74:: ; 0x2b74 call TextBox ld hl, VramState set 0, [hl] - call Function1ad2 + call DrawOnMap call Function3200 ld b, $9 call GetSGBLayout @@ -2041,8 +2066,9 @@ GetAnyMapHeaderPointer:: ; 0x2bed ld c, b ld b, 0 ld hl, MapGroupPointers +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] @@ -2139,7 +2165,7 @@ Function2c3d:: ; 2c3d ret ; 2c52 -Function2c52:: ; 2c52 +SwitchToMapScriptHeaderBank:: ; 2c52 ld a, [MapScriptHeaderBank] rst Bankswitch ret @@ -2292,23 +2318,23 @@ RADIO_TOWER_MUSIC EQU 7 jr .done ; 2cff -Function2cff:: ; 2cff - call Function2d0d +GetMapHeaderTimeOfDayNybble:: ; 2cff + call GetPhoneServiceTimeOfDayByte and $f ret ; 2d05 -Function2d05:: ; 2d05 - call Function2d0d +GetMapHeaderPhoneServiceNybble:: ; 2d05 + call GetPhoneServiceTimeOfDayByte and $f0 swap a ret ; 2d0d -Function2d0d:: ; 2d0d +GetPhoneServiceTimeOfDayByte:: ; 2d0d push hl push bc - ld de, $0007 + ld de, 7 ; phone service and time of day call GetMapHeaderMember ld a, c pop bc @@ -2320,7 +2346,7 @@ Function2d19:: ; 2d19 push de push hl push bc - ld de, $0008 + ld de, 8 ; fishing group call GetMapHeaderMember ld a, c pop bc diff --git a/home/map_objects.asm b/home/map_objects.asm index 4a2b58712..2b7bd9a92 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -19,33 +19,34 @@ Function180e:: ; 180e push hl push bc ld hl, UsedSprites + 2 - ld c, $1f + ld c, SPRITE_GFX_LIST_CAPACITY - 1 ld b, a ld a, [hConnectionStripLength] - cp $0 - jr z, .asm_182b + cp 0 + jr z, .nope ld a, b -.asm_181d +.loop cp [hl] - jr z, .asm_1830 - inc hl + jr z, .found +rept 2 inc hl +endr dec c - jr nz, .asm_181d + jr nz, .loop ld a, [UsedSprites + 1] scf - jr .asm_1833 + jr .done -.asm_182b +.nope ld a, [UsedSprites + 1] - jr .asm_1833 + jr .done -.asm_1830 +.found inc hl xor a ld a, [hl] -.asm_1833 +.done pop bc pop hl ret @@ -125,20 +126,20 @@ Function1875:: ; 1875 ld d, a and $f0 cp $10 - jr z, .asm_1882 + jr z, .ok_10 cp $20 - jr z, .asm_1888 + jr z, .ok_20 scf ret -.asm_1882 +.ok_10 ld a, d and 7 ret z scf ret -.asm_1888 +.ok_20 ld a, d and 7 ret z @@ -223,7 +224,7 @@ CheckStandingOnEntrance:: ; 18c3 GetMapObject:: ; 18d2 ; Return the location of map object a in bc. ld hl, MapObjects - ld bc, $10 + ld bc, OBJECT_LENGTH call AddNTimes ld b, h ld c, l @@ -232,93 +233,94 @@ GetMapObject:: ; 18d2 Function18de:: ; 18de +; Sets carry if the object is not visible on the screen. ld [hConnectionStripLength], a call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] - cp $ff - jr z, .asm_18f3 + cp -1 + jr z, .not_visible ld [hConnectedMapWidth], a - call Function1ae5 + call GetObjectStruct and a ret -.asm_18f3 +.not_visible scf ret ; 18f5 Function18f5:: ; 18f5 - ld hl, $0006 + ld hl, MAPOBJECT_HOUR add hl, bc ld a, [hl] - cp $ff - jr nz, .asm_1921 - ld hl, $0007 + cp -1 + jr nz, .check_hour + ld hl, MAPOBJECT_TIMEOFDAY add hl, bc ld a, [hl] - cp $ff - jr z, .asm_191c - ld hl, .data_191e + cp -1 + jr z, .timeofday_always + ld hl, .TimeOfDayValues_191e ld a, [TimeOfDay] add l ld l, a - jr nc, .asm_1912 + jr nc, .ok inc h -.asm_1912 +.ok ld a, [hl] - ld hl, $0007 + ld hl, MAPOBJECT_TIMEOFDAY add hl, bc and [hl] - jr nz, .asm_191c + jr nz, .timeofday_always scf ret -.asm_191c +.timeofday_always and a ret -.data_191e - db $1 - db $2 - db $4 +.TimeOfDayValues_191e + db 1 << MORN ; 1 + db 1 << DAY ; 2 + db 1 << NITE ; 4 -.asm_1921 - ld hl, $0006 +.check_hour + ld hl, MAPOBJECT_HOUR add hl, bc ld d, [hl] - ld hl, $0007 + ld hl, MAPOBJECT_TIMEOFDAY add hl, bc ld e, [hl] ld hl, hHours ld a, d cp e - jr z, .asm_1949 - jr c, .asm_193f + jr z, .yes + jr c, .check_timeofday ld a, [hl] cp d - jr nc, .asm_1949 + jr nc, .yes cp e - jr c, .asm_1949 - jr z, .asm_1949 - jr .asm_194b + jr c, .yes + jr z, .yes + jr .no -.asm_193f +.check_timeofday ld a, e cp [hl] - jr c, .asm_194b + jr c, .no ld a, [hl] cp d - jr nc, .asm_1949 - jr .asm_194b + jr nc, .yes + jr .no -.asm_1949 +.yes and a ret -.asm_194b +.no scf ret ; 194d @@ -326,34 +328,34 @@ Function18f5:: ; 18f5 Function194d:: ; 194d ld [hConnectionStripLength], a call GetMapObject - call Function80e7 + call CopyObjectStruct ret ; 1956 -Function1956:: ; 1956 +_CopyObjectStruct:: ; 1956 ld [hConnectionStripLength], a call Function271e ld a, [hConnectionStripLength] call GetMapObject - callba Function80e7 + callba CopyObjectStruct ret ; 1967 Function1967:: ; 1967 ld [hConnectionStripLength], a call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] - cp $ff + cp -1 ret z - ld [hl], $ff + ld [hl], -1 push af call Function1985 pop af - call Function1ae5 + call GetObjectStruct callba Function4357 ret ; 1985 @@ -361,20 +363,20 @@ Function1967:: ; 1967 Function1985:: ; 1985 ld hl, wd4cd cp [hl] - jr z, .asm_1990 + jr z, .ok ld hl, wd4ce cp [hl] ret nz -.asm_1990 +.ok callba Function581f - ld a, $ff + ld a, -1 ld [wd4cd], a ld [wd4ce], a ret ; 199f -Function199f:: ; 199f +DeleteObjectStruct:: ; 199f call Function1967 call Function2712 ret @@ -385,41 +387,41 @@ Function19a6:: ; 19a6 call GetMapObject ld d, b ld e, c - ld a, $ff + ld a, -1 ld [de], a inc de pop hl - ld bc, $000f + ld bc, OBJECT_LENGTH - 1 call CopyBytes ret ; 19b8 Function19b8:: ; 19b8 call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] push af - ld [hl], $ff + ld [hl], -1 inc hl - ld bc, $000f + ld bc, OBJECT_LENGTH - 1 xor a call ByteFill pop af - cp $ff + cp -1 ret z cp $d ret nc ld b, a ld a, [wd4cd] cp b - jr nz, .asm_19de - ld a, $ff + jr nz, .ok + ld a, -1 ld [wd4cd], a -.asm_19de +.ok ld a, b - call Function1ae5 + call GetObjectStruct callba Function4357 ret ; 19e9 @@ -437,12 +439,12 @@ Function19e9:: ; 19e9 ld a, [wc2e2] call Function18de ret c - ld hl, $0003 + ld hl, OBJECT_03 add hl, bc ld [hl], $14 - ld hl, $0009 + ld hl, OBJECT_09 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, VramState set 7, [hl] and a @@ -455,24 +457,24 @@ Function1a13:: ; 1a13 push bc push de ld hl, ObjectStructs - ld de, $0028 - ld c, $d -.asm_1a1d + ld de, OBJECT_STRUCT_LENGTH + ld c, NUM_OBJECT_STRUCTS +.loop ld a, [hl] and a - jr z, .asm_1a28 + jr z, .empty add hl, de dec c - jr nz, .asm_1a1d + jr nz, .loop xor a - jr .asm_1a2c + jr .done -.asm_1a28 +.empty ld a, $d sub c scf -.asm_1a2c +.done pop de pop bc ret @@ -481,23 +483,20 @@ Function1a13:: ; 1a13 Function1a2f:: ; 1a2f - ld hl, $0003 + ld hl, OBJECT_03 add hl, bc ld a, [hl] - cp $25 - jr c, .asm_1a39 + cp OBJECT_STRUCT_3_DATA_HEIGHT + jr c, .ok xor a -.asm_1a39 - ld hl, Data4273 +.ok + ld hl, ObjectStruct3_Data ld e, a ld d, 0 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de +rept OBJECT_STRUCT_3_DATA_WIDTH + add hl,de +endr ld a, [hl] ret ; 1a47 @@ -507,17 +506,15 @@ Function1a47:: ; 1a47 push de ld e, a ld d, 0 - ld hl, Data4273 + 1 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - ld a, BANK(Data4273) + ld hl, ObjectStruct3_Data + 1 +rept OBJECT_STRUCT_3_DATA_WIDTH + add hl,de +endr + ld a, BANK(ObjectStruct3_Data) call GetFarByte +rept 2 add a - add a +endr and $c pop de pop bc @@ -529,7 +526,7 @@ Function1a61:: ; 1a61 ld l, a ld a, [hROMBank] push af - ld a, BANK(Data4273) + ld a, BANK(ObjectStruct3_Data) rst Bankswitch ld a, l push bc @@ -544,19 +541,16 @@ Function1a61:: ; 1a61 ; 1a71 Function1a71:: ; 1a71 - ld hl, $0003 + ld hl, OBJECT_03 add hl, de ld [hl], a push de ld e, a ld d, 0 - ld hl, Data4273 + 1 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de + ld hl, ObjectStruct3_Data + 1 +rept OBJECT_STRUCT_3_DATA_WIDTH + add hl,de +endr ld b, h ld c, l pop de @@ -565,27 +559,27 @@ Function1a71:: ; 1a71 rlca rlca and $c - ld hl, $0008 + ld hl, OBJECT_FACING add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $000b + ld hl, OBJECT_11 add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $0004 + ld hl, OBJECT_04 add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $0005 + ld hl, OBJECT_FLAGS add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $0006 + ld hl, OBJECT_PALETTE add hl, de ld [hl], a ret @@ -599,12 +593,12 @@ Function1aae:: ; 1aae ld a, [hli] ld d, [hl] - ld hl, $001b + ld hl, OBJECT_27 add hl, bc add [hl] ld e, a ld a, d - adc $0 + adc 0 ld d, a inc [hl] ld a, [de] @@ -616,31 +610,31 @@ Function1aae:: ; 1aae ret ; 1ac6 -Function1ac6:: ; 1ac6 +SetVramState_Bit0:: ; 1ac6 ld hl, VramState set 0, [hl] ret ; 1acc -Function1acc:: ; 1acc +ResetVramState_Bit0:: ; 1acc ld hl, VramState res 0, [hl] ret ; 1ad2 -Function1ad2:: ; 1ad2 +DrawOnMap:: ; 1ad2 ld a, [VramState] bit 0, a ret z callba Function55e0 - callba Function5920 + callba RefreshMapAppearDisappear ret ; 1ae5 -Function1ae5:: ; 1ae5 - ld bc, $0028 +GetObjectStruct:: ; 1ae5 + ld bc, OBJECT_STRUCT_LENGTH ld hl, ObjectStructs call AddNTimes ld b, h @@ -648,23 +642,23 @@ Function1ae5:: ; 1ae5 ret ; 1af1 -Function1af1:: ; 1af1 - ld hl, $0000 +GetObjectSprite:: ; 1af1 + ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] and a ret ; 1af8 -Function1af8:: ; 1af8 +SetSpriteDirection:: ; 1af8 push af - ld hl, $0008 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - and $f3 + and %11110011 ld e, a pop af - and $c + and %00001100 or e ld [hl], a ret @@ -672,9 +666,9 @@ Function1af8:: ; 1af8 GetSpriteDirection:: ; 1b07 - ld hl, $0008 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - and $c + and %00001100 ret ; 1b0f diff --git a/home/menu.asm b/home/menu.asm index 21ce9c515..2b9885834 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -2,11 +2,11 @@ LoadMenuDataHeader:: ; 0x1d35 - call Function1d3c + call CopyMenuDataHeader call Function1c00 ret -Function1d3c:: ; 0x1d3c +CopyMenuDataHeader:: ; 0x1d3c ld de, wcf81 ld bc, $0010 call CopyBytes @@ -21,9 +21,9 @@ Function1d4b:: ; 1d4b ; 1d4f -Function1d4f:: ; 1d4f +MenuTextBox:: ; 1d4f push hl - call Function1d58 + call LoadMenuTextBox pop hl jp PrintText ; 1d57 @@ -32,7 +32,7 @@ Function1d57:: ; 1d57 ret ; 1d58 -Function1d58:: ; 1d58 +LoadMenuTextBox:: ; 1d58 ld hl, MenuDataHeader_0x1d5f call LoadMenuDataHeader ret @@ -46,9 +46,9 @@ MenuDataHeader_0x1d5f:: ; 1d5f db 0 ; default option ; 1d67 -Function1d67:: ; 1d67 - call Function1d4f - call Function1c17 +MenuTextBoxBackup:: ; 1d67 + call MenuTextBox + call WriteBackup ret ; 1d6e @@ -67,15 +67,15 @@ MenuDataHeader_0x1d75:: ; 1d75 ; 1d7d Function1d7d:: ; 1d7d - call Function1c07 + call ExitMenu ret ; 1d81 -Function1d81:: ; 0x1d81 +InterpretMenu2:: ; 0x1d81 xor a ld [hBGMapMode], a call Function1cbb - call Function1ad2 + call DrawOnMap call Function1c89 call Function321c call Function1c66 @@ -95,10 +95,10 @@ Function1d81:: ; 0x1d81 ret ; 0x1dab -Function1dab:: ; 1dab +GetMenu2:: ; 1dab call LoadMenuDataHeader - call Function1d81 - call Function1c17 + call InterpretMenu2 + call WriteBackup ld a, [wcfa9] ret ; 1db8 @@ -111,8 +111,9 @@ Function1db8:: ; 0x1db8 ld a, [hli] ld h, [hl] ld l, a +rept 2 inc hl - inc hl +endr pop af call GetNthString ld d, h @@ -138,7 +139,7 @@ _YesNoBox:: ; 1dd9 ; Return nc (yes) or c (no). push bc ld hl, YesNoMenuDataHeader - call Function1d3c + call CopyMenuDataHeader pop bc ld a, b cp $e @@ -158,11 +159,11 @@ _YesNoBox:: ; 1dd9 call Function1c00 Function1dfe:: ; 1dfe - call Function1d81 + call InterpretMenu2 push af ld c, $f call DelayFrames - call Function1c17 + call WriteBackup pop af jr c, .asm_1e16 ld a, [wcfa9] @@ -201,7 +202,7 @@ Function1e2e:: ; 1e2e Function1e35:: ; 1e35 push de - call Function1d3c + call CopyMenuDataHeader pop de ld a, [wcf83] ld h, a @@ -252,7 +253,7 @@ MenuFunc_1e7f:: ; 0x1e7f MenuWriteText:: ; 0x1e8c xor a ld [hBGMapMode], a - call Function1ebd ; sort out the text + call Function1ebd ; sort out the text call Function1eda ; actually write it call Function2e31 ld a, [hOAMUpdate] @@ -439,8 +440,9 @@ Function1f8d:: ; 1f8d push de ld a, [MenuSelection] call Function1fb1 +rept 2 inc hl - inc hl +endr ld a, [hli] ld d, [hl] ld e, a @@ -451,8 +453,9 @@ Function1f8d:: ; 1f8d Function1f9e:: ; 1f9e call Function1fb1 +rept 2 inc hl - inc hl +endr ld a, [hli] ld d, [hl] ld e, a @@ -475,10 +478,9 @@ Function1fb1:: ; 1fb1 ld a, [hli] ld h, [hl] ld l, a +rept 4 add hl, de - add hl, de - add hl, de - add hl, de +endr ret ; 1fbf @@ -497,8 +499,9 @@ Function1fbf:: ; 1fbf ld [rSVBK], a xor a ld hl, $dfff +rept 2 ld [hld], a - ld [hld], a +endr ld a, l ld [wcf71], a ld a, h @@ -530,7 +533,7 @@ Function1ff8:: ; 1ff8 ; 2009 -PlayClickSFX:: ; 2009 +PlayClickSFX:: ; 2009 push de ld de, SFX_READ_TEXT_2 call PlaySFX @@ -539,9 +542,9 @@ PlayClickSFX:: ; 2009 ; 0x2012 Function2012:: ; 2012 - call Function1d4f - call Functiona46 - call Function1c07 + call MenuTextBox + call CloseText + call ExitMenu ret ; 201c @@ -559,7 +562,7 @@ Function201c:: ; 201c ret ; 202a -Function202a:: ; 202a +InterpretMenu:: ; 202a ld a, [hROMBank] ld [wcf94], a callba Function2400e diff --git a/home/movement.asm b/home/movement.asm index f0869aa99..e6e2e1025 100644 --- a/home/movement.asm +++ b/home/movement.asm @@ -102,8 +102,9 @@ Function1b92:: ; 1b92 push hl ld l, b ld h, 0 +rept 2 add hl, hl - add hl, hl +endr ld e, a ld d, 0 add hl, de @@ -131,12 +132,13 @@ Function1bb1:: ; 1bb1 dec b jr nz, .asm_1bb8 ld a, $1 +rept 2 ld [hli], a - ld [hli], a +endr xor a +rept 3 ld [hli], a - ld [hli], a - ld [hli], a +endr pop bc pop hl ret @@ -193,7 +195,7 @@ Function1c00:: ; 1c00 ret ; 1c07 -Function1c07:: ; 0x1c07 +ExitMenu:: ; 0x1c07 push af callab Function243e8 pop af @@ -203,11 +205,11 @@ Function1c10:: ; 0x1c10 callab Function2446d ret -Function1c17:: ; 0x1c17 +WriteBackup:: ; 0x1c17 push af - call Function1c07 + call ExitMenu call Function321c - call Function1ad2 + call DrawOnMap pop af ret diff --git a/home/palettes.asm b/home/palettes.asm index 38f1d554d..1a24fbe89 100644 --- a/home/palettes.asm +++ b/home/palettes.asm @@ -302,7 +302,7 @@ Functiond90:: ; d90 ; d91 -Functiond91:: ; d91 +Special_ReloadSpritesNoPalettes:: ; d91 ld a, [hCGB] and a ret z diff --git a/home/text.asm b/home/text.asm index feb3eb734..98ca87051 100644 --- a/home/text.asm +++ b/home/text.asm @@ -126,10 +126,12 @@ TextBoxPalette:: ; 1024 ; Fill text box width c height b at hl with pal 7 ld de, AttrMap - TileMap add hl, de +rept 2 inc b - inc b - inc c +endr +rept 2 inc c +endr ld a, TEXTBOX_PAL .col push bc @@ -169,7 +171,7 @@ Function1052:: ; 1052 PrintText:: ; 1057 - call Function106c + call SetUpTextBox Function105a:: ; 105a push hl hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY @@ -183,10 +185,10 @@ PrintTextBoxText:: ; 1065 ret ; 106c -Function106c:: ; 106c +SetUpTextBox:: ; 106c push hl call SpeechTextBox - call Function1ad2 + call DrawOnMap call Function321c pop hl ret @@ -385,7 +387,7 @@ Char3F:: ; 121b ld de, String12a2 call PlaceString push bc - callab Function39939 + callab Battle_GetTrainerName pop hl ld de, StringBuffer1 jr Function126a @@ -517,7 +519,7 @@ Paragraph:: ; 12f2 .asm_1301 call Function13b6 - call Functionaaf + call KeepTextOpen hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW call ClearBox @@ -540,7 +542,7 @@ Char4B:: ; 131f call Function13b6 push de - call Functionaaf + call KeepTextOpen pop de ld a, [InLinkBattle] @@ -590,7 +592,7 @@ PromptText:: ; 135a .ok call Function13b6 - call Functionaaf + call KeepTextOpen ld a, [InLinkBattle] cp $3 jr z, DoneText @@ -626,10 +628,12 @@ Function138c:: ; 138c inc de dec c jr nz, .row +rept 2 inc de - inc de - inc hl +endr +rept 2 inc hl +endr pop af dec a jr nz, .col @@ -719,8 +723,9 @@ Function13f6:: ; 13f6 ld c, a ld b, 0 ld hl, TextCommands +rept 2 add hl, bc - add hl, bc +endr ld e, [hl] inc hl ld d, [hl] @@ -904,7 +909,7 @@ Text_06:: ; 149f push hl call Function13c7 push bc - call Functionaaf + call KeepTextOpen pop bc call Function13cd pop hl @@ -992,8 +997,9 @@ Text_PlaySound:: ; 1500 jr z, .done cp b jr z, .play +rept 2 inc hl - inc hl +endr jr .loop .play @@ -1066,7 +1072,7 @@ Text_0D:: ; 1562 ; display arrow push hl push bc - call Functionaaf + call KeepTextOpen pop bc pop hl ret @@ -1088,8 +1094,9 @@ Text_14:: ; 156a ld e, a ld d, 0 ld hl, Unknown_24000 +rept 2 add hl, de - add hl, de +endr ld a, BANK(Unknown_24000) call GetFarHalfword ld d, h @@ -1110,8 +1117,9 @@ Text_15:: ; 1582 ld c, a ld b, 0 ld hl, .Days +rept 2 add hl, bc - add hl, bc +endr ld a, [hli] ld h, [hl] ld l, a diff --git a/home/tilemap.asm b/home/tilemap.asm index ceda55dd2..c9eaaba67 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -175,11 +175,13 @@ GetTileCoord:: ; 1d05 ld a, c ld b, h ld c, l +rept 2 add hl, hl - add hl, hl +endr add hl, bc +rept 2 add hl, hl - add hl, hl +endr ld c, a xor a ld b, a @@ -203,11 +205,13 @@ GetAttrCoord:: ; 1d21 ld a, c ld b, h ld c, l +rept 2 add hl, hl - add hl, hl +endr add hl, bc +rept 2 add hl, hl - add hl, hl +endr ld c, a xor a ld b, a diff --git a/home/vblank.asm b/home/vblank.asm index 563e705fe..b8b8b0efb 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -19,8 +19,9 @@ VBlank:: ; 283 ld e, a ld d, 0 ld hl, .VBlanks +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] ld l, a @@ -363,7 +364,7 @@ VBlank5:: ; 400 ; bg map ; tiles ; joypad -; +; ld a, [hROMBank] ld [hROMBankBackup], a diff --git a/home/video.asm b/home/video.asm index 7392d6e0f..440c90307 100644 --- a/home/video.asm +++ b/home/video.asm @@ -77,8 +77,9 @@ endr ; We've done 2 16x8 blocks ld a, [$ffdc] +rept 2 dec a - dec a +endr ld [$ffdc], a jr nz, .next diff --git a/home/window.asm b/home/window.asm index 8c1e95134..850b7466e 100644 --- a/home/window.asm +++ b/home/window.asm @@ -40,8 +40,8 @@ Function2de2:: ; 2de2 call Function2e31 ld a, $90 ld [hWY], a - call Functione4a - callba Functionb8000 + call Special_ReplaceKrisSprite + callba ReturnFromMapSetupScript callba Function106594 ret ; 2e08 @@ -83,7 +83,7 @@ Function2e31:: ; 2e31 ld [hBGMapMode], a ld a, $1 ld [hOAMUpdate], a - call Function1ad2 + call DrawOnMap xor a ld [hOAMUpdate], a call DelayFrame |