Remove unreferenced content in bank 0 (#1)

This commit is contained in:
xCrystal 2023-07-25 11:54:34 +02:00
parent fc7f2d4e0e
commit 60cacea4b0
22 changed files with 13 additions and 722 deletions

View File

@ -1,24 +1,3 @@
HDMATransferAttrmapAndTilemapToWRAMBank3::
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
decoord 0, 0
ld hl, wScratchTilemap
call PadTilemapForHDMATransfer
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
call HDMATransferToWRAMBank3
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
call HDMATransferToWRAMBank3
ret
HDMATransferTilemapToWRAMBank3::
ld hl, .Function
jp CallInSafeGFXMode

View File

@ -517,3 +517,12 @@ ScrollingMenu_GetListItemCoordAndFunctionArgs:
pop hl
pop de
ret
xor_a:
xor a
ret
xor_a_dec_a:
xor a
dec a
ret

View File

@ -286,11 +286,6 @@ MinVolume::
ld [wVolume], a
ret
FadeOutToMusic:: ; unreferenced
ld a, 4
ld [wMusicFade], a
ret
FadeInToMusic::
ld a, 4 | (1 << MUSIC_FADE_IN_F)
ld [wMusicFade], a
@ -436,11 +431,6 @@ SpecialMapMusic::
and a
ret
.bike ; unreferenced
ld de, MUSIC_BICYCLE
scf
ret
.surf
ld de, MUSIC_SURF
scf
@ -467,34 +457,6 @@ GetMapMusic_MaybeSpecial::
call GetMapMusic
ret
PlaceBCDNumberSprite:: ; unreferenced
; Places a BCD number at the upper center of the screen.
ld a, 4 * TILE_WIDTH
ld [wShadowOAMSprite38YCoord], a
ld [wShadowOAMSprite39YCoord], a
ld a, 10 * TILE_WIDTH
ld [wShadowOAMSprite38XCoord], a
ld a, 11 * TILE_WIDTH
ld [wShadowOAMSprite39XCoord], a
xor a
ld [wShadowOAMSprite38Attributes], a
ld [wShadowOAMSprite39Attributes], a
ld a, [wUnusedBCDNumber]
cp 100
jr nc, .max
add 1
daa
ld b, a
swap a
and $f
add "0"
ld [wShadowOAMSprite38TileID], a
ld a, b
and $f
add "0"
ld [wShadowOAMSprite39TileID], a
ret
.max
ld a, "9"
ld [wShadowOAMSprite38TileID], a

View File

@ -15,24 +15,6 @@ GetPartyLocation::
ld bc, PARTYMON_STRUCT_LENGTH
jp AddNTimes
GetDexNumber:: ; unreferenced
; Probably used in gen 1 to convert index number to dex number
; Not required in gen 2 because index number == dex number
push hl
ld a, b
dec a
ld b, 0
add hl, bc
ld hl, BaseData + BASE_DEX_NO
ld bc, BASE_DATA_SIZE
call AddNTimes
ld a, BANK(BaseData)
call GetFarWord
ld b, l
ld c, h
pop hl
ret
UserPartyAttr::
push af
ldh a, [hBattleTurn]

View File

@ -116,16 +116,3 @@ GetFarWRAMByte::
ldh [rSVBK], a
ldh a, [hFarByte]
ret
GetFarWRAMWord:: ; unreferenced
ldh [hTempBank], a
ldh a, [rSVBK]
push af
ldh a, [hTempBank]
ldh [rSVBK], a
ld a, [hli]
ld h, [hl]
ld l, a
pop af
ldh [rSVBK], a
ret

View File

@ -1,24 +1,5 @@
; Functions to fade the screen in and out.
TimeOfDayFade:: ; unreferenced
ld a, [wTimeOfDayPal]
ld b, a
ld hl, IncGradGBPalTable_11
ld a, l
sub b
ld l, a
jr nc, .okay
dec h
.okay
ld a, [hli]
ldh [rBGP], a
ld a, [hli]
ldh [rOBP0], a
ld a, [hli]
ldh [rOBP1], a
ret
RotateFourPalettesRight::
ldh a, [hCGB]
and a

View File

@ -101,30 +101,3 @@ CheckReceivedDex::
ld a, c
and a
ret
CheckBPressedDebug:: ; unreferenced
; Used in debug ROMs to walk through walls and avoid encounters.
ld a, [wDebugFlags]
bit DEBUG_FIELD_F, a
ret z
ldh a, [hJoyDown]
bit B_BUTTON_F, a
ret
xor_a::
xor a
ret
xor_a_dec_a::
xor a
dec a
ret
CheckFieldDebug:: ; unreferenced
push hl
ld hl, wDebugFlags
bit DEBUG_FIELD_F, [hl]
pop hl
ret

View File

@ -32,68 +32,6 @@ FarCopyBytesDouble_DoubleBankSwitch::
rst Bankswitch
ret
SafeHDMATransfer: ; unreferenced
dec c
ldh a, [hBGMapMode]
push af
xor a
ldh [hBGMapMode], a
ldh a, [hROMBank]
push af
ld a, b
rst Bankswitch
.loop
; load the source and target MSB and LSB
ld a, d
ldh [rHDMA1], a ; source MSB
ld a, e
and $f0
ldh [rHDMA2], a ; source LSB
ld a, h
and $1f
ldh [rHDMA3], a ; target MSB
ld a, l
and $f0
ldh [rHDMA4], a ; target LSB
; stop when c < TILES_PER_CYCLE
ld a, c
cp TILES_PER_CYCLE
jr c, .done
; decrease c by TILES_PER_CYCLE
sub TILES_PER_CYCLE
ld c, a
; DMA transfer state
ld a, $f
ldh [hDMATransfer], a
call DelayFrame
; add $100 to hl and de
ld a, l
add LOW($100)
ld l, a
ld a, h
adc HIGH($100)
ld h, a
ld a, e
add LOW($100)
ld e, a
ld a, d
adc HIGH($100)
ld d, a
jr .loop
.done
ld a, c
and $7f ; pretty silly, considering at most bits 0-2 would be set
ldh [hDMATransfer], a
call DelayFrame
pop af
rst Bankswitch
pop af
ldh [hBGMapMode], a
ret
UpdatePlayerSprite::
farcall _UpdatePlayerSprite
ret
@ -111,10 +49,6 @@ LoadFontsExtra::
farcall _LoadFontsExtra2
ret
LoadFontsExtra2: ; unreferenced
farcall _LoadFontsExtra2
ret
DecompressRequest2bpp::
push de
ld a, BANK(sScratch)

View File

@ -261,34 +261,6 @@ StopAutoInput::
ld [wInputType], a
ret
JoyTitleScreenInput:: ; unreferenced
.loop
call DelayFrame
push bc
call JoyTextDelay
pop bc
; Save data can be deleted by pressing Up + B + Select.
ldh a, [hJoyDown]
cp D_UP | SELECT | B_BUTTON
jr z, .keycombo
; Press Start or A to start the game.
ldh a, [hJoyLast]
and START | A_BUTTON
jr nz, .keycombo
dec c
jr nz, .loop
and a
ret
.keycombo
scf
ret
JoyWaitAorB::
.loop
call DelayFrame

View File

@ -1,14 +1,5 @@
; LCD handling
Function547:: ; unreferenced
ldh a, [hLCDCPointer]
cp LOW(rSCX)
ret nz
ld c, a
ld a, [wLYOverrides]
ldh [c], a
ret
LCD::
push af
ldh a, [hLCDCPointer]

View File

@ -366,14 +366,6 @@ CheckIndoorMap::
cp GATE
ret
CheckUnknownMap:: ; unreferenced
cp INDOOR
ret z
cp GATE
ret z
cp ENVIRONMENT_5
ret
LoadMapAttributes::
call CopyMapPartialAndAttributes
call SwitchToMapScriptsBank
@ -1105,16 +1097,10 @@ ObjectEventText::
text_far _ObjectEventText
text_end
BGEvent:: ; unreferenced
jumptext BGEventText
BGEventText::
text_far _BGEventText
text_end
CoordinatesEvent:: ; unreferenced
jumptext CoordinatesEventText
CoordinatesEventText::
text_far _CoordinatesEventText
text_end
@ -1330,13 +1316,6 @@ UpdateBGMapColumn::
ldh [hBGMapTileCount], a
ret
ClearBGMapBuffer:: ; unreferenced
ld hl, wBGMapBuffer
ld bc, wBGMapBufferEnd - wBGMapBuffer
xor a
call ByteFill
ret
LoadTilesetGFX::
ld hl, wTilesetAddress
ld a, [hli]
@ -2065,11 +2044,6 @@ SwitchToAnyMapAttributesBank::
rst Bankswitch
ret
GetMapAttributesBank:: ; unreferenced
ld a, [wMapGroup]
ld b, a
ld a, [wMapNumber]
ld c, a
GetAnyMapAttributesBank::
push hl
push de
@ -2159,9 +2133,6 @@ GetMapEnvironment::
pop hl
ret
Map_DummyFunction:: ; unreferenced
ret
GetAnyMapEnvironment::
push hl
push de

View File

@ -300,12 +300,6 @@ CheckObjectTime::
scf
ret
CopyMapObjectStruct:: ; unreferenced
ldh [hMapObjectIndex], a
call GetMapObject
call CopyObjectStruct
ret
UnmaskCopyMapObjectStruct::
ldh [hMapObjectIndex], a
call UnmaskObject
@ -362,35 +356,6 @@ CopyPlayerObjectTemplate::
call CopyBytes
ret
DeleteFollowerMapObject: ; unreferenced
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld a, [hl]
push af
ld [hl], -1
inc hl
ld bc, MAPOBJECT_LENGTH - 1
xor a
call ByteFill
pop af
cp -1
ret z
cp NUM_OBJECT_STRUCTS
ret nc
ld b, a
ld a, [wObjectFollow_Leader]
cp b
jr nz, .ok
ld a, -1
ld [wObjectFollow_Leader], a
.ok
ld a, b
call GetObjectStruct
farcall DeleteMapObject
ret
LoadMovementDataPointer::
; Load the movement data pointer for object a.
ld [wMovementObject], a
@ -574,16 +539,6 @@ _GetMovementIndex::
ld a, h
ret
SetVramState_Bit0:: ; unreferenced
ld hl, wVramState
set 0, [hl]
ret
ResetVramState_Bit0:: ; unreferenced
ld hl, wVramState
res 0, [hl]
ret
UpdateSprites::
ld a, [wVramState]
bit 0, a

View File

@ -47,12 +47,3 @@ Divide::
pop de
pop hl
ret
SubtractAbsolute:: ; unreferenced
; Return |a - b|, sign in carry.
sub b
ret nc
cpl
add 1
scf
ret

View File

@ -287,7 +287,7 @@ MenuBoxCoord2Attr::
ld b, a
; fallthrough
Coord2Attr:: ; unreferenced
Coord2Attr::
; Return the address of wAttrmap(c, b) in hl.
xor a
ld h, a
@ -331,9 +331,6 @@ MenuTextbox::
pop hl
jp PrintText
Menu_DummyFunction:: ; unreferenced
ret
LoadMenuTextbox::
ld hl, .MenuHeader
call LoadMenuHeader
@ -419,13 +416,6 @@ YesNoBox::
lb bc, SCREEN_WIDTH - 6, 7
PlaceYesNoBox::
jr _YesNoBox
PlaceGenericTwoOptionBox:: ; unreferenced
call LoadMenuHeader
jr InterpretTwoOptionMenu
_YesNoBox::
; Return nc (yes) or c (no).
push bc
ld hl, YesNoMenuHeader
@ -723,15 +713,6 @@ PlaceNthMenuStrings::
call PlaceString
ret
GetNthMenuStrings:: ; unreferenced
call GetMenuDataPointerTableEntry
inc hl
inc hl
ld a, [hli]
ld d, [hl]
ld e, a
ret
MenuJumptable::
ld a, [wMenuSelection]
call GetMenuDataPointerTableEntry

View File

@ -1,298 +0,0 @@
MobileAPI::
; Mobile
cp $2
ld [wMobileAPIIndex], a
ld a, l
ld [wc986], a
ld a, h
ld [wc987], a
jr nz, .okay
ld [wc982], a
ld a, l
ld [wc981], a
ld hl, wc983
ld a, c
ld [hli], a
ld a, b
ld [hl], a
.okay
ld hl, wc822
set 6, [hl]
ldh a, [hROMBank]
push af
ld a, BANK(_MobileAPI)
ld [wc981], a
rst Bankswitch
jp _MobileAPI
ReturnMobileAPI::
; Return from _MobileAPI
ld [wc986], a
ld a, l
ld [wc987], a
ld a, h
ld [wMobileAPIIndex], a
pop bc
ld a, b
ld [wc981], a
rst Bankswitch
ld hl, wc822
res 6, [hl]
ld hl, wc987
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wc986]
ret
MobileReceive::
ldh a, [hROMBank]
push af
ld a, BANK(_MobileReceive)
ld [wc981], a
rst Bankswitch
call _MobileReceive
pop bc
ld a, b
ld [wc981], a
rst Bankswitch
ret
MobileTimer::
push af
push bc
push de
push hl
ldh a, [hMobile]
and a
jr z, .pop_ret
xor a
ldh [rTAC], a
; Turn off timer interrupt
ldh a, [rIF]
and 1 << VBLANK | 1 << LCD_STAT | 1 << SERIAL | 1 << JOYPAD
ldh [rIF], a
ld a, [wc86a]
or a
jr z, .pop_ret
ld a, [wc822]
bit 1, a
jr nz, .skip_timer
ldh a, [rSC]
and 1 << rSC_ON
jr nz, .skip_timer
ldh a, [hROMBank]
push af
ld a, BANK(_Timer)
ld [wc981], a
rst Bankswitch
call _Timer
pop bc
ld a, b
ld [wc981], a
rst Bankswitch
.skip_timer
ldh a, [rTMA]
ldh [rTIMA], a
ld a, 1 << rTAC_ON | rTAC_65536_HZ
ldh [rTAC], a
.pop_ret
pop hl
pop de
pop bc
pop af
reti
Function3ed7:: ; unreferenced
ld [$dc02], a
ldh a, [hROMBank]
push af
ld a, BANK(Function114243)
rst Bankswitch
call Function114243
pop bc
ld a, b
rst Bankswitch
ld a, [$dc02]
ret
Function3eea::
push hl
push bc
ld de, wAttrmap - wTilemap
add hl, de
inc b
inc b
inc c
inc c
call Function3f35
pop bc
pop hl
call MobileHome_PlaceBox
ret
Function3efd:: ; unreferenced
push hl
hlcoord 0, 12
ld b, 4
ld c, 18
call .fill_attr
pop hl
call PrintTextboxText
ret
.fill_attr
push hl
push bc
ld de, wAttrmap - wTilemap
add hl, de
inc b
inc b
inc c
inc c
call Function3f35
pop bc
pop hl
call TextboxBorder
ret
Function3f20::
hlcoord 0, 0, wAttrmap
ld b, 6
ld c, 20
call Function3f35
hlcoord 0, 0
ld b, 4
ld c, 18
call MobileHome_PlaceBox
ret
Function3f35::
ld a, 6
ld de, SCREEN_WIDTH
.row
push bc
push hl
.col
ld [hli], a
dec c
jr nz, .col
pop hl
add hl, de
pop bc
dec b
jr nz, .row
ret
MobileHome_PlaceBox:
push bc
call .FillTop
pop bc
.RowLoop:
push bc
call .FillMiddle
pop bc
dec b
jr nz, .RowLoop
call .FillBottom
ret
.FillTop:
ld a, $63
ld d, $62
ld e, $64
jr .FillRow
.FillBottom:
ld a, $68
ld d, $67
ld e, $69
jr .FillRow
.FillMiddle:
ld a, $7f
ld d, $65
ld e, $66
.FillRow:
push hl
ld [hl], d
inc hl
.FillLoop:
ld [hli], a
dec c
jr nz, .FillLoop
ld [hl], e
pop hl
ld de, SCREEN_WIDTH
add hl, de
ret
Function3f7c::
call MenuBoxCoord2Tile
call GetMenuBoxDims
dec b
dec c
call Function3eea
ret
Function3f88::
ld hl, wDecompressScratch
ld b, 0
.row
push bc
ld c, 1 tiles / 2
.col
ld a, [de]
inc de
cpl
ld [hl], 0
inc hl
ld [hli], a
dec c
jr nz, .col
pop bc
dec c
jr nz, .row
ret
Function3f9f::
ld hl, wDecompressScratch
.row
push bc
ld c, 1 tiles / 2
.col
ld a, [de]
inc de
inc de
cpl
ld [hl], $0
inc hl
ld [hli], a
dec c
jr nz, .col
pop bc
dec c
jr nz, .row
ret

View File

@ -234,14 +234,6 @@ Print8BitNumLeftAlign::
ld b, PRINTNUM_LEFTALIGN | 1
jp PrintNum
GetNthMove:: ; unreferenced
ld hl, wListMoves_MoveIndicesBuffer
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
ret
GetBaseData::
push bc
push de

View File

@ -276,11 +276,6 @@ Serial_PrintWaitingTextAndSyncAndExchangeNybble::
call WaitLinkTransfer
jp SafeLoadTempTilemapToTilemap
Serial_SyncAndExchangeNybble:: ; unreferenced
call LoadTilemapToTempTilemap
callfar PlaceWaitingText
jp WaitLinkTransfer ; pointless
WaitLinkTransfer::
vc_hook Wireless_WaitLinkTransfer
ld a, $ff
@ -397,18 +392,3 @@ LinkDataReceived::
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ret
SetBitsForTimeCapsuleRequestIfNotLinked:: ; unreferenced
; Similar to SetBitsForTimeCapsuleRequest (see engine/link/link.asm).
ld a, [wLinkMode]
and a
ret nz
ld a, USING_INTERNAL_CLOCK
ldh [rSB], a
xor a
ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ret

View File

@ -128,10 +128,6 @@ SpeechTextbox::
ld c, TEXTBOX_INNERW
jp Textbox
GameFreakText:: ; unreferenced
text "ゲームフりーク!" ; "GAMEFREAK!"
done
RadioTerminator::
ld hl, .stop
ret
@ -177,10 +173,6 @@ PlaceNextChar::
pop hl
ret
DummyChar:: ; unreferenced
pop de
; fallthrough
NextChar::
inc de
jp PlaceNextChar
@ -241,11 +233,11 @@ ENDM
dict "<USER>", PlaceMoveUsersName
dict "<ENEMY>", PlaceEnemysName
dict "<PLAY_G>", PlaceGenderedPlayerName
dict "゚", .place ; should be .diacritic
dict "゙", .place ; should be .diacritic
dict "゚", .diacritic
dict "゙", .diacritic
jr .not_diacritic
.diacritic ; unreferenced
.diacritic
ld b, a
call Diacritic
jp NextChar

View File

@ -60,10 +60,6 @@ CGBOnly_CopyTilemapAtOnce::
CopyTilemapAtOnce::
jr _CopyTilemapAtOnce
CopyAttrmapAndTilemapToWRAMBank3: ; unreferenced
farcall HDMATransferAttrmapAndTilemapToWRAMBank3
ret
_CopyTilemapAtOnce:
ldh a, [hBGMapMode]
push af

View File

@ -248,17 +248,6 @@ SetClock::
call CloseSRAM ; unlatch clock, disable clock r/w
ret
ClearRTCStatus:: ; unreferenced
; clear sRTCStatusFlags
xor a
push af
ld a, BANK(sRTCStatusFlags)
call OpenSRAM
pop af
ld [sRTCStatusFlags], a
call CloseSRAM
ret
RecordRTCStatus::
; append flags to sRTCStatusFlags
ld hl, sRTCStatusFlags

View File

@ -203,30 +203,6 @@ FacingPlayerDistance::
and a
ret
CheckTrainerFlag:: ; unreferenced
push bc
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, bc
ld a, [hl]
call GetMapObject
ld hl, MAPOBJECT_SCRIPT_POINTER
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call GetMapScriptsBank
call GetFarWord
ld d, h
ld e, l
push de
ld b, CHECK_FLAG
call EventFlagAction
pop de
ld a, c
and a
pop bc
ret
PrintWinLossText::
ld a, [wBattleType]
cp BATTLETYPE_CANLOSE

View File

@ -91,7 +91,3 @@ SafeUpdateSprites::
pop af
ldh [hOAMUpdate], a
ret
SetCarryFlag:: ; unreferenced
scf
ret