mirror of
https://github.com/pret/poketcg.git
synced 2026-10-04 15:17:42 -04:00
Remove home bank address comments
This commit is contained in:
+7
-7
@@ -1,7 +1,7 @@
|
||||
; loads opponent deck at wOpponentDeckID to wOpponentDeck, and initializes wPlayerDuelistType.
|
||||
; on a duel against Sam, also loads PRACTICE_PLAYER_DECK to wPlayerDeck.
|
||||
; also, sets wRNG1, wRNG2, and wRNGCounter to $57.
|
||||
LoadOpponentDeck: ; 2b78 (0:2b78)
|
||||
LoadOpponentDeck:
|
||||
xor a
|
||||
ld [wIsPracticeDuel], a
|
||||
ld a, [wOpponentDeckID]
|
||||
@@ -45,27 +45,27 @@ LoadOpponentDeck: ; 2b78 (0:2b78)
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
AIDoAction_Turn: ; 2bbf (0:2bbf)
|
||||
AIDoAction_Turn:
|
||||
ld a, AIACTION_DO_TURN
|
||||
jr AIDoAction
|
||||
|
||||
AIDoAction_StartDuel: ; 2bc3 (0:2bc3)
|
||||
AIDoAction_StartDuel:
|
||||
ld a, AIACTION_START_DUEL
|
||||
jr AIDoAction
|
||||
|
||||
AIDoAction_ForcedSwitch: ; 2bc7 (0:2bc7)
|
||||
AIDoAction_ForcedSwitch:
|
||||
ld a, AIACTION_FORCED_SWITCH
|
||||
call AIDoAction
|
||||
ldh [hTempPlayAreaLocation_ff9d], a
|
||||
ret
|
||||
|
||||
AIDoAction_KOSwitch: ; 2bcf (0:2bcf)
|
||||
AIDoAction_KOSwitch:
|
||||
ld a, AIACTION_KO_SWITCH
|
||||
call AIDoAction
|
||||
ldh [hTemp_ffa0], a
|
||||
ret
|
||||
|
||||
AIDoAction_TakePrize: ; 2bd7 (0:2bd7)
|
||||
AIDoAction_TakePrize:
|
||||
ld a, AIACTION_TAKE_PRIZE
|
||||
jr AIDoAction ; this line is not needed
|
||||
|
||||
@@ -73,7 +73,7 @@ AIDoAction_TakePrize: ; 2bd7 (0:2bd7)
|
||||
; depending on the deck ID (see engine/ai/deck_ai.asm)
|
||||
; input:
|
||||
; - a = AIACTION_* constant
|
||||
AIDoAction: ; 2bdb (0:2bdb)
|
||||
AIDoAction:
|
||||
ld c, a
|
||||
|
||||
; load bank for Opponent Deck pointer table
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
SECTION "Audio Callback", ROM0
|
||||
|
||||
; jumps to 3f:hl, then switches to bank 3d
|
||||
Bankswitch3dTo3f:: ; 3fe0 (0:3fe0)
|
||||
Bankswitch3dTo3f::
|
||||
push af
|
||||
ld a, $3f
|
||||
ldh [hBankROM], a
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
; ...
|
||||
; $ff
|
||||
; for each struct, writes data to BGMap0-translated x,y
|
||||
WriteDataBlocksToBGMap0: ; 0695 (0:0695)
|
||||
WriteDataBlocksToBGMap0:
|
||||
call WriteDataBlockToBGMap0
|
||||
bit 7, [hl] ; check for $ff
|
||||
jr z, WriteDataBlocksToBGMap0
|
||||
@@ -13,7 +13,7 @@ WriteDataBlocksToBGMap0: ; 0695 (0:0695)
|
||||
; reads struct:
|
||||
; x (1 byte), y (1 byte), data (n bytes), $00
|
||||
; writes data to BGMap0-translated x,y
|
||||
WriteDataBlockToBGMap0: ; 069d (0:069d)
|
||||
WriteDataBlockToBGMap0:
|
||||
ld b, [hl]
|
||||
inc hl
|
||||
ld c, [hl]
|
||||
@@ -49,7 +49,7 @@ WriteDataBlockToBGMap0: ; 069d (0:069d)
|
||||
ret
|
||||
|
||||
; writes a to [v*BGMap0 + BG_MAP_WIDTH * c + b]
|
||||
WriteByteToBGMap0: ; 06c3 (0:06c3)
|
||||
WriteByteToBGMap0:
|
||||
push af
|
||||
ld a, [wLCDC]
|
||||
rla
|
||||
@@ -88,7 +88,7 @@ HblankWriteByteToBGMap0: ; 06d9
|
||||
ret
|
||||
|
||||
; copy a bytes of data from hl to vBGMap0 address pointed to by coord at bc
|
||||
CopyDataToBGMap0: ; 06ee (0:06ee)
|
||||
CopyDataToBGMap0:
|
||||
push bc
|
||||
push hl
|
||||
push af
|
||||
@@ -113,5 +113,5 @@ SafeCopyDataHLtoDE: ; 6fc (0:6fc)
|
||||
dec b
|
||||
jr nz, .lcd_off_loop
|
||||
ret
|
||||
JPHblankCopyDataHLtoDE: ; 0709 (0:0709)
|
||||
JPHblankCopyDataHLtoDE:
|
||||
jp HblankCopyDataHLtoDE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
CallHL2: ; 3c45 (0:3c45)
|
||||
CallHL2:
|
||||
jp hl
|
||||
|
||||
CallBC: ; 3c46 (0:3c46)
|
||||
CallBC:
|
||||
retbc
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; return, in hl, the total amount of cards owned anywhere, including duplicates
|
||||
GetAmountOfCardsOwned: ; 1caa (0:1caa)
|
||||
GetAmountOfCardsOwned:
|
||||
push de
|
||||
push bc
|
||||
call EnableSRAM
|
||||
@@ -43,7 +43,7 @@ GetAmountOfCardsOwned: ; 1caa (0:1caa)
|
||||
; return carry if the count in sCardCollection plus the count in each deck (sDeck*)
|
||||
; of the card with id given in a is 0 (if card not owned).
|
||||
; also return the count (total owned amount) in a.
|
||||
GetCardCountInCollectionAndDecks: ; 1ce1 (0:1ce1)
|
||||
GetCardCountInCollectionAndDecks:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -94,7 +94,7 @@ GetCardCountInCollectionAndDecks: ; 1ce1 (0:1ce1)
|
||||
|
||||
; return carry if the count in sCardCollection of the card with id given in a is 0.
|
||||
; also return the count (amount owned outside of decks) in a.
|
||||
GetCardCountInCollection: ; 1d1d (0:1d1d)
|
||||
GetCardCountInCollection:
|
||||
push hl
|
||||
call EnableSRAM
|
||||
ld h, HIGH(sCardCollection)
|
||||
@@ -108,7 +108,7 @@ GetCardCountInCollection: ; 1d1d (0:1d1d)
|
||||
ret
|
||||
|
||||
; creates a list at wTempCardCollection of every card the player owns and how many
|
||||
CreateTempCardCollection: ; 1d2e (0:1d2e)
|
||||
CreateTempCardCollection:
|
||||
call EnableSRAM
|
||||
ld hl, sCardCollection
|
||||
ld de, wTempCardCollection
|
||||
@@ -126,7 +126,7 @@ CreateTempCardCollection: ; 1d2e (0:1d2e)
|
||||
ret
|
||||
|
||||
; adds the cards from a deck to wTempCardCollection given de = sDeck*Name
|
||||
AddDeckCardsToTempCardCollection: ; 1d59 (0:1d59)
|
||||
AddDeckCardsToTempCardCollection:
|
||||
ld a, [de]
|
||||
or a
|
||||
ret z ; return if empty name (empty deck)
|
||||
@@ -147,7 +147,7 @@ AddDeckCardsToTempCardCollection: ; 1d59 (0:1d59)
|
||||
|
||||
; add card with id given in a to sCardCollection, provided that
|
||||
; the player has less than MAX_AMOUNT_OF_CARD (99) of them
|
||||
AddCardToCollection: ; 1d6e (0:1d6e)
|
||||
AddCardToCollection:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -174,7 +174,7 @@ AddCardToCollection: ; 1d6e (0:1d6e)
|
||||
ret
|
||||
|
||||
; remove a card with id given in a from sCardCollection (decrement its count if non-0)
|
||||
RemoveCardFromCollection: ; 1d91 (0:1d91)
|
||||
RemoveCardFromCollection:
|
||||
push hl
|
||||
call EnableSRAM
|
||||
ld h, HIGH(sCardCollection)
|
||||
@@ -191,7 +191,7 @@ RemoveCardFromCollection: ; 1d91 (0:1d91)
|
||||
|
||||
; return the amount of different cards that the player has collected in d
|
||||
; return NUM_CARDS in e, minus 1 if VENUSAUR1 or MEW2 has not been collected (minus 2 if neither)
|
||||
GetCardAlbumProgress: ; 1da4 (0:1da4)
|
||||
GetCardAlbumProgress:
|
||||
push hl
|
||||
call EnableSRAM
|
||||
ld e, NUM_CARDS
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
; return the turn holder's arena card's color in a, accounting for Venomoth's Shift Pokemon Power if active
|
||||
GetArenaCardColor: ; 36f6 (0:36f6)
|
||||
GetArenaCardColor:
|
||||
xor a
|
||||
; fallthrough
|
||||
|
||||
; input: a = play area location offset (PLAY_AREA_*) of the desired card
|
||||
; return the turn holder's card's color in a, accounting for Venomoth's Shift Pokemon Power if active
|
||||
GetPlayAreaCardColor: ; 36f7 (0:36f7)
|
||||
GetPlayAreaCardColor:
|
||||
push hl
|
||||
push de
|
||||
ld e, a
|
||||
@@ -41,7 +41,7 @@ GetPlayAreaCardColor: ; 36f7 (0:36f7)
|
||||
; return in a the weakness of the turn holder's arena or benchx Pokemon given the PLAY_AREA_* value in a
|
||||
; if a == 0 and [DUELVARS_ARENA_CARD_CHANGED_WEAKNESS] != 0,
|
||||
; return [DUELVARS_ARENA_CARD_CHANGED_WEAKNESS] instead
|
||||
GetPlayAreaCardWeakness: ; 3729 (0:3729)
|
||||
GetPlayAreaCardWeakness:
|
||||
or a
|
||||
jr z, GetArenaCardWeakness
|
||||
add DUELVARS_ARENA_CARD
|
||||
@@ -49,7 +49,7 @@ GetPlayAreaCardWeakness: ; 3729 (0:3729)
|
||||
|
||||
; return in a the weakness of the turn holder's arena Pokemon
|
||||
; if [DUELVARS_ARENA_CARD_CHANGED_WEAKNESS] != 0, return it instead
|
||||
GetArenaCardWeakness: ; 3730 (0:3730)
|
||||
GetArenaCardWeakness:
|
||||
ld a, DUELVARS_ARENA_CARD_CHANGED_WEAKNESS
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -57,7 +57,7 @@ GetArenaCardWeakness: ; 3730 (0:3730)
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
; fallthrough
|
||||
|
||||
GetCardWeakness: ; 3739 (0:3739)
|
||||
GetCardWeakness:
|
||||
call GetTurnDuelistVariable
|
||||
call LoadCardDataToBuffer2_FromDeckIndex
|
||||
ld a, [wLoadedCard2Weakness]
|
||||
@@ -66,7 +66,7 @@ GetCardWeakness: ; 3739 (0:3739)
|
||||
; return in a the resistance of the turn holder's arena or benchx Pokemon given the PLAY_AREA_* value in a
|
||||
; if a == 0 and [DUELVARS_ARENA_CARD_CHANGED_RESISTANCE] != 0,
|
||||
; return [DUELVARS_ARENA_CARD_CHANGED_RESISTANCE] instead
|
||||
GetPlayAreaCardResistance: ; 3743 (0:3743)
|
||||
GetPlayAreaCardResistance:
|
||||
or a
|
||||
jr z, GetArenaCardResistance
|
||||
add DUELVARS_ARENA_CARD
|
||||
@@ -74,7 +74,7 @@ GetPlayAreaCardResistance: ; 3743 (0:3743)
|
||||
|
||||
; return in a the resistance of the arena Pokemon
|
||||
; if [DUELVARS_ARENA_CARD_CHANGED_RESISTANCE] != 0, return it instead
|
||||
GetArenaCardResistance: ; 374a (0:374a)
|
||||
GetArenaCardResistance:
|
||||
ld a, DUELVARS_ARENA_CARD_CHANGED_RESISTANCE
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -82,7 +82,7 @@ GetArenaCardResistance: ; 374a (0:374a)
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
; fallthrough
|
||||
|
||||
GetCardResistance: ; 3753 (0:3753)
|
||||
GetCardResistance:
|
||||
call GetTurnDuelistVariable
|
||||
call LoadCardDataToBuffer2_FromDeckIndex
|
||||
ld a, [wLoadedCard2Resistance]
|
||||
@@ -90,7 +90,7 @@ GetCardResistance: ; 3753 (0:3753)
|
||||
|
||||
; this function checks if turn holder's CHARIZARD energy burn is active, and if so, turns
|
||||
; all energies at wAttachedEnergies except double colorless energies into fire energies
|
||||
HandleEnergyBurn: ; 375d (0:375d)
|
||||
HandleEnergyBurn:
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
call GetTurnDuelistVariable
|
||||
call GetCardIDFromDeckIndex
|
||||
|
||||
+10
-10
@@ -1,5 +1,5 @@
|
||||
; load data of card with text id of name at de to wLoadedCard1
|
||||
LoadCardDataToBuffer1_FromName: ; 2ecd (0:2ecd)
|
||||
LoadCardDataToBuffer1_FromName:
|
||||
ld hl, CardPointers + 2 ; skip first NULL pointer
|
||||
ld a, BANK(CardPointers)
|
||||
call BankpushROM2
|
||||
@@ -45,18 +45,18 @@ LoadCardDataToBuffer1_FromName: ; 2ecd (0:2ecd)
|
||||
ret
|
||||
|
||||
; load data of card with id at e to wLoadedCard2
|
||||
LoadCardDataToBuffer2_FromCardID: ; 2f0a (0:2f0a)
|
||||
LoadCardDataToBuffer2_FromCardID:
|
||||
push hl
|
||||
ld hl, wLoadedCard2
|
||||
jr LoadCardDataToHL_FromCardID
|
||||
|
||||
; load data of card with id at e to wLoadedCard1
|
||||
LoadCardDataToBuffer1_FromCardID: ; 2f10 (0:2f10)
|
||||
LoadCardDataToBuffer1_FromCardID:
|
||||
push hl
|
||||
ld hl, wLoadedCard1
|
||||
; fallthrough
|
||||
|
||||
LoadCardDataToHL_FromCardID: ; 2f14 (0:2f14)
|
||||
LoadCardDataToHL_FromCardID:
|
||||
push de
|
||||
push bc
|
||||
push hl
|
||||
@@ -81,7 +81,7 @@ LoadCardDataToHL_FromCardID: ; 2f14 (0:2f14)
|
||||
ret
|
||||
|
||||
; return in a the type (TYPE_* constant) of the card with id at e
|
||||
GetCardType: ; 2f32 (0:2f32)
|
||||
GetCardType:
|
||||
push hl
|
||||
call GetCardPointer
|
||||
jr c, .done
|
||||
@@ -96,7 +96,7 @@ GetCardType: ; 2f32 (0:2f32)
|
||||
ret
|
||||
|
||||
; return in de the 2-byte text id of the name of the card with id at e
|
||||
GetCardName: ; 2f45 (0:2f45)
|
||||
GetCardName:
|
||||
push hl
|
||||
call GetCardPointer
|
||||
jr c, .done
|
||||
@@ -114,7 +114,7 @@ GetCardName: ; 2f45 (0:2f45)
|
||||
ret
|
||||
|
||||
; from the card id in a, returns type into a, rarity into b, and set into c
|
||||
GetCardTypeRarityAndSet: ; 2f5d (0:2f5d)
|
||||
GetCardTypeRarityAndSet:
|
||||
push hl
|
||||
push de
|
||||
ld d, 0
|
||||
@@ -139,7 +139,7 @@ GetCardTypeRarityAndSet: ; 2f5d (0:2f5d)
|
||||
|
||||
; return at hl the pointer to the data of the card with id at e
|
||||
; return carry if e was out of bounds, so no pointer was returned
|
||||
GetCardPointer: ; 2f7c (0:2f7c)
|
||||
GetCardPointer:
|
||||
push de
|
||||
push bc
|
||||
ld l, e
|
||||
@@ -173,7 +173,7 @@ GetCardPointer: ; 2f7c (0:2f7c)
|
||||
; bc are supposed to be $30 (number of tiles of a card gfx) and TILE_SIZE respectively
|
||||
; card_gfx_index = (<Name>CardGfx - CardGraphics) / 8 (using absolute ROM addresses)
|
||||
; also copies the card's palette to wCardPalette
|
||||
LoadCardGfx: ; 2fa0 (0:2fa0)
|
||||
LoadCardGfx:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
push hl
|
||||
@@ -205,7 +205,7 @@ LoadCardGfx: ; 2fa0 (0:2fa0)
|
||||
ret
|
||||
|
||||
; identical to CopyFontsOrDuelGraphicsTiles
|
||||
CopyFontsOrDuelGraphicsTiles2: ; 2fcb (0:2fcb)
|
||||
CopyFontsOrDuelGraphicsTiles2:
|
||||
ld a, BANK(Fonts) ; BANK(DuelGraphics)
|
||||
call BankpushROM
|
||||
ld c, TILE_SIZE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; validate the saved data in SRAM
|
||||
; it must contain with the sequence $04, $21, $05 at s0a000
|
||||
ValidateSRAM: ; 080b (0:080b)
|
||||
ValidateSRAM:
|
||||
xor a
|
||||
call BankswitchSRAM
|
||||
ld hl, $a000
|
||||
@@ -41,7 +41,7 @@ ValidateSRAM: ; 080b (0:080b)
|
||||
ret
|
||||
|
||||
; zero all SRAM banks and set s0a000 to $04, $21, $05
|
||||
RestartSRAM: ; 084d (0:084d)
|
||||
RestartSRAM:
|
||||
ld a, 3
|
||||
.clear_loop
|
||||
call ClearSRAMBank
|
||||
@@ -57,7 +57,7 @@ RestartSRAM: ; 084d (0:084d)
|
||||
ret
|
||||
|
||||
; zero the loaded SRAM bank
|
||||
ClearSRAMBank: ; 0863 (0:0863)
|
||||
ClearSRAMBank:
|
||||
push af
|
||||
call BankswitchSRAM
|
||||
call EnableSRAM
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; displaying each result ([O] or [X]) starting from the top left corner of the screen.
|
||||
; text at de is printed in a text box during the coin toss.
|
||||
; returns: the number of heads in a and in wCoinTossNumHeads, and carry if at least one heads
|
||||
TossCoinATimes: ; 3071 (0:3071)
|
||||
TossCoinATimes:
|
||||
push hl
|
||||
ld hl, wCoinTossScreenTextID
|
||||
ld [hl], e
|
||||
@@ -16,7 +16,7 @@ TossCoinATimes: ; 3071 (0:3071)
|
||||
; text at de is printed in a text box during the coin toss.
|
||||
; returns: - carry, and 1 in a and in wCoinTossNumHeads if heads
|
||||
; - nc, and 0 in a and in wCoinTossNumHeads if tails
|
||||
TossCoin: ; 307d (0:307d)
|
||||
TossCoin:
|
||||
push hl
|
||||
ld hl, wCoinTossScreenTextID
|
||||
ld [hl], e
|
||||
@@ -30,7 +30,7 @@ TossCoin: ; 307d (0:307d)
|
||||
ret
|
||||
|
||||
; cp de, bc
|
||||
CompareDEtoBC: ; 3090 (0:3090)
|
||||
CompareDEtoBC:
|
||||
ld a, d
|
||||
cp b
|
||||
ret nz
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
; copy c bytes of data from hl to de, b times.
|
||||
; used to copy gfx data with c = TILE_SIZE
|
||||
CopyGfxData: ; 070c (0:070c)
|
||||
CopyGfxData:
|
||||
ld a, [wLCDC]
|
||||
rla
|
||||
jr nc, .next_tile
|
||||
@@ -35,7 +35,7 @@ CopyGfxData: ; 070c (0:070c)
|
||||
ret
|
||||
|
||||
; copy bc bytes from hl to de. preserves all registers except af
|
||||
CopyDataHLtoDE_SaveRegisters: ; 0732 (0:0732)
|
||||
CopyDataHLtoDE_SaveRegisters:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -46,7 +46,7 @@ CopyDataHLtoDE_SaveRegisters: ; 0732 (0:0732)
|
||||
ret
|
||||
|
||||
; copy bc bytes from hl to de
|
||||
CopyDataHLtoDE: ; 073c (0:073c)
|
||||
CopyDataHLtoDE:
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
; [wDamage] += a
|
||||
AddToDamage: ; 3055 (0:3055)
|
||||
AddToDamage:
|
||||
push hl
|
||||
ld hl, wDamage
|
||||
add [hl]
|
||||
@@ -11,7 +11,7 @@ AddToDamage: ; 3055 (0:3055)
|
||||
ret
|
||||
|
||||
; [wDamage] -= a
|
||||
SubtractFromDamage: ; 3061 (0:3061)
|
||||
SubtractFromDamage:
|
||||
push de
|
||||
push hl
|
||||
ld e, a
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; de = source of compressed data
|
||||
; b = HIGH byte of secondary buffer ($100 bytes of buffer space)
|
||||
; also clears this $100 byte space
|
||||
InitDataDecompression: ; 08bf (0:08bf)
|
||||
InitDataDecompression:
|
||||
ld hl, wDecompSourcePosPtr
|
||||
ld [hl], e
|
||||
inc hl
|
||||
@@ -36,7 +36,7 @@ InitDataDecompression: ; 08bf (0:08bf)
|
||||
; input:
|
||||
; bc = row width
|
||||
; de = buffer to place decompressed data
|
||||
DecompressData: ; 08de (0:08de)
|
||||
DecompressData:
|
||||
push hl
|
||||
push de
|
||||
.loop
|
||||
@@ -69,7 +69,7 @@ DecompressData: ; 08de (0:08de)
|
||||
; - if on -> off, then the data only provides the offset,
|
||||
; and the previous byte read for number of bytes to repeat, 0xXY, is reused
|
||||
; in which case (0x0Y + 2) bytes are repeated starting from the offset.
|
||||
.Decompress: ; 08ef (0:08ef)
|
||||
.Decompress:
|
||||
ld hl, wDecompNumBytesToRepeat
|
||||
ld a, [hl]
|
||||
or a
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; divides BC by DE. Stores result in BC and stores remainder in HL
|
||||
DivideBCbyDE: ; 3c5a (0:3c5a)
|
||||
DivideBCbyDE:
|
||||
ld hl, $0000
|
||||
rl c
|
||||
rl b
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
; copy DMA to hDMAFunction
|
||||
CopyDMAFunction: ; 0593 (0:0593)
|
||||
CopyDMAFunction:
|
||||
ld c, LOW(hDMAFunction)
|
||||
ld b, JumpToFunctionInTable - DMA
|
||||
ld hl, DMA
|
||||
@@ -12,7 +12,7 @@ CopyDMAFunction: ; 0593 (0:0593)
|
||||
ret
|
||||
|
||||
; CopyDMAFunction copies this function to hDMAFunction ($ff83)
|
||||
DMA: ; 05a1 (0:05a1)
|
||||
DMA:
|
||||
ld a, HIGH(wOAM)
|
||||
ldh [rDMA], a
|
||||
ld a, $28
|
||||
|
||||
@@ -8,7 +8,7 @@ SwitchToCGBNormalSpeed: ; 7db (0:7db)
|
||||
jr CGBSpeedSwitch
|
||||
|
||||
; switch to CGB Double Speed Mode if playing on CGB and current mode is Normal Speed Mode
|
||||
SwitchToCGBDoubleSpeed: ; 07e7 (0:07e7)
|
||||
SwitchToCGBDoubleSpeed:
|
||||
call CheckForCGB
|
||||
ret c
|
||||
ld hl, rKEY1
|
||||
@@ -17,7 +17,7 @@ SwitchToCGBDoubleSpeed: ; 07e7 (0:07e7)
|
||||
; fallthrough
|
||||
|
||||
; switch between CGB Double Speed Mode and Normal Speed Mode
|
||||
CGBSpeedSwitch: ; 07f1 (0:07f1)
|
||||
CGBSpeedSwitch:
|
||||
ldh a, [rIE]
|
||||
push af
|
||||
xor a
|
||||
|
||||
+94
-94
@@ -1,6 +1,6 @@
|
||||
; save duel state to SRAM
|
||||
; called between each two-player turn, just after player draws card (ROM bank 1 loaded)
|
||||
SaveDuelStateToSRAM: ; 100b (0:100b)
|
||||
SaveDuelStateToSRAM:
|
||||
ld a, $2
|
||||
call BankswitchSRAM
|
||||
; save duel data to sCurrentDuel
|
||||
@@ -57,7 +57,7 @@ SaveDuelStateToSRAM: ; 100b (0:100b)
|
||||
ret
|
||||
|
||||
; copies the deck pointed to by de to wPlayerDeck or wOpponentDeck (depending on whose turn it is)
|
||||
CopyDeckData: ; 1072 (0:1072)
|
||||
CopyDeckData:
|
||||
ld hl, wPlayerDeck
|
||||
ldh a, [hWhoseTurn]
|
||||
cp PLAYER_TURN
|
||||
@@ -104,7 +104,7 @@ CopyDeckData: ; 1072 (0:1072)
|
||||
ret
|
||||
|
||||
; return, in register a, the amount of prizes that the turn holder has not yet drawn
|
||||
CountPrizes: ; 10aa (0:10aa)
|
||||
CountPrizes:
|
||||
push hl
|
||||
ld a, DUELVARS_PRIZES
|
||||
call GetTurnDuelistVariable
|
||||
@@ -121,7 +121,7 @@ CountPrizes: ; 10aa (0:10aa)
|
||||
|
||||
; shuffles the turn holder's deck
|
||||
; if less than 60 cards remain in the deck, it makes sure that the rest are ignored
|
||||
ShuffleDeck: ; 10bc (0:10bc)
|
||||
ShuffleDeck:
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, a
|
||||
ld d, a
|
||||
@@ -139,7 +139,7 @@ ShuffleDeck: ; 10bc (0:10bc)
|
||||
; draw a card from the turn holder's deck, saving its location as CARD_LOCATION_JUST_DRAWN.
|
||||
; returns carry if deck is empty, nc if a card was successfully drawn.
|
||||
; AddCardToHand is meant to be called next (unless this function returned carry).
|
||||
DrawCardFromDeck: ; 10cf (0:10cf)
|
||||
DrawCardFromDeck:
|
||||
push hl
|
||||
ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
|
||||
call GetTurnDuelistVariable
|
||||
@@ -162,7 +162,7 @@ DrawCardFromDeck: ; 10cf (0:10cf)
|
||||
|
||||
; add a card to the top of the turn holder's deck
|
||||
; the card is identified by register a, which contains the deck index (0-59) of the card
|
||||
ReturnCardToDeck: ; 10e8 (0:10e8)
|
||||
ReturnCardToDeck:
|
||||
push hl
|
||||
push af
|
||||
ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
|
||||
@@ -182,7 +182,7 @@ ReturnCardToDeck: ; 10e8 (0:10e8)
|
||||
; search a card in the turn holder's deck, extract it, and set its location to
|
||||
; CARD_LOCATION_JUST_DRAWN. AddCardToHand is meant to be called next.
|
||||
; the card is identified by register a, which contains the deck index (0-59) of the card.
|
||||
SearchCardInDeckAndAddToHand: ; 10fc (0:10fc)
|
||||
SearchCardInDeckAndAddToHand:
|
||||
push af
|
||||
push hl
|
||||
push de
|
||||
@@ -218,7 +218,7 @@ SearchCardInDeckAndAddToHand: ; 10fc (0:10fc)
|
||||
|
||||
; adds a card to the turn holder's hand and increments the number of cards in the hand
|
||||
; the card is identified by register a, which contains the deck index (0-59) of the card
|
||||
AddCardToHand: ; 1123 (0:1123)
|
||||
AddCardToHand:
|
||||
push af
|
||||
push hl
|
||||
push de
|
||||
@@ -243,7 +243,7 @@ AddCardToHand: ; 1123 (0:1123)
|
||||
|
||||
; removes a card from the turn holder's hand and decrements the number of cards in the hand
|
||||
; the card is identified by register a, which contains the deck index (0-59) of the card
|
||||
RemoveCardFromHand: ; 1139 (0:1139)
|
||||
RemoveCardFromHand:
|
||||
push af
|
||||
push hl
|
||||
push bc
|
||||
@@ -281,7 +281,7 @@ RemoveCardFromHand: ; 1139 (0:1139)
|
||||
|
||||
; moves a card to the turn holder's discard pile, as long as it is in the hand
|
||||
; the card is identified by register a, which contains the deck index (0-59) of the card
|
||||
MoveHandCardToDiscardPile: ; 1160 (0:1160)
|
||||
MoveHandCardToDiscardPile:
|
||||
call GetTurnDuelistVariable
|
||||
ld a, [hl]
|
||||
and $ff ^ CARD_LOCATION_JUST_DRAWN
|
||||
@@ -292,7 +292,7 @@ MoveHandCardToDiscardPile: ; 1160 (0:1160)
|
||||
; fallthrough
|
||||
|
||||
; puts the turn holder's card with the deck index (0-59) given in a into the discard pile
|
||||
PutCardInDiscardPile: ; 116a (0:116a)
|
||||
PutCardInDiscardPile:
|
||||
push af
|
||||
push hl
|
||||
push de
|
||||
@@ -313,7 +313,7 @@ PutCardInDiscardPile: ; 116a (0:116a)
|
||||
; search a card in the turn holder's discard pile, extract it, and set its location to
|
||||
; CARD_LOCATION_JUST_DRAWN. AddCardToHand is meant to be called next.
|
||||
; the card is identified by register a, which contains the deck index (0-59) of the card
|
||||
MoveDiscardPileCardToHand: ; 1182 (0:1182)
|
||||
MoveDiscardPileCardToHand:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -347,7 +347,7 @@ MoveDiscardPileCardToHand: ; 1182 (0:1182)
|
||||
|
||||
; return in the z flag whether turn holder's prize a (0-7) has been drawn or not
|
||||
; z: drawn, nz: not drawn
|
||||
CheckPrizeTaken: ; 11a5 (0:11a5)
|
||||
CheckPrizeTaken:
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, PowersOf2
|
||||
@@ -366,7 +366,7 @@ PowersOf2:
|
||||
|
||||
; fill wDuelTempList with the turn holder's discard pile cards (their 0-59 deck indexes)
|
||||
; return carry if the turn holder has no cards in the discard pile
|
||||
CreateDiscardPileCardList: ; 11bf (0:11bf)
|
||||
CreateDiscardPileCardList:
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, a
|
||||
ld l, DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE
|
||||
@@ -395,7 +395,7 @@ CreateDiscardPileCardList: ; 11bf (0:11bf)
|
||||
|
||||
; fill wDuelTempList with the turn holder's remaining deck cards (their 0-59 deck indexes)
|
||||
; return carry if the turn holder has no cards left in the deck
|
||||
CreateDeckCardList: ; 11df (0:11df)
|
||||
CreateDeckCardList:
|
||||
ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
|
||||
call GetTurnDuelistVariable
|
||||
cp DECK_SIZE
|
||||
@@ -433,7 +433,7 @@ CreateDeckCardList: ; 11df (0:11df)
|
||||
; if a == 0: search in CARD_LOCATION_ARENA
|
||||
; if a != 0: search in CARD_LOCATION_BENCH_[A]
|
||||
; return carry if no energy cards were found
|
||||
CreateArenaOrBenchEnergyCardList: ; 120a (0:120a)
|
||||
CreateArenaOrBenchEnergyCardList:
|
||||
or CARD_LOCATION_PLAY_AREA
|
||||
ld c, a
|
||||
ld de, wDuelTempList
|
||||
@@ -471,7 +471,7 @@ CreateArenaOrBenchEnergyCardList: ; 120a (0:120a)
|
||||
; fill wDuelTempList with the turn holder's hand cards (their 0-59 deck indexes)
|
||||
; return carry if the turn holder has no cards in hand
|
||||
; and outputs in a number of cards.
|
||||
CreateHandCardList: ; 123b (0:123b)
|
||||
CreateHandCardList:
|
||||
call FindLastCardInHand
|
||||
inc b
|
||||
jr .skip_card
|
||||
@@ -500,7 +500,7 @@ CreateHandCardList: ; 123b (0:123b)
|
||||
|
||||
; sort the turn holder's hand cards by ID (highest to lowest ID)
|
||||
; makes use of wDuelTempList
|
||||
SortHandCardsByID: ; 1258 (0:1258)
|
||||
SortHandCardsByID:
|
||||
call FindLastCardInHand
|
||||
.loop
|
||||
ld a, [hld]
|
||||
@@ -524,7 +524,7 @@ SortHandCardsByID: ; 1258 (0:1258)
|
||||
; b = turn holder's number of cards in hand (DUELVARS_NUMBER_OF_CARDS_IN_HAND)
|
||||
; hl = pointer to turn holder's last (newest) card in DUELVARS_HAND
|
||||
; de = wDuelTempList
|
||||
FindLastCardInHand: ; 1271 (0:1271)
|
||||
FindLastCardInHand:
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, a
|
||||
ld l, DUELVARS_NUMBER_OF_CARDS_IN_HAND
|
||||
@@ -539,7 +539,7 @@ FindLastCardInHand: ; 1271 (0:1271)
|
||||
; input:
|
||||
; a = how many cards to shuffle
|
||||
; hl = DUELVARS_DECK_CARDS + [DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK]
|
||||
ShuffleCards: ; 127f (0:127f)
|
||||
ShuffleCards:
|
||||
or a
|
||||
ret z ; return if deck is empty
|
||||
push hl
|
||||
@@ -576,7 +576,7 @@ ShuffleCards: ; 127f (0:127f)
|
||||
|
||||
; sort a $ff-terminated list of deck index cards by ID (lowest to highest ID).
|
||||
; the list is wDuelTempList.
|
||||
SortCardsInDuelTempListByID: ; 12a3 (0:12a3)
|
||||
SortCardsInDuelTempListByID:
|
||||
ld hl, hTempListPtr_ff99
|
||||
ld [hl], LOW(wDuelTempList)
|
||||
inc hl
|
||||
@@ -587,7 +587,7 @@ SortCardsInDuelTempListByID: ; 12a3 (0:12a3)
|
||||
; the pointer to the list is given in hTempListPtr_ff99.
|
||||
; sorting by ID rather than deck index means that the order of equal (same ID) cards does not matter,
|
||||
; even if they have a different deck index.
|
||||
SortCardsInListByID: ; 12ad (0:12ad)
|
||||
SortCardsInListByID:
|
||||
; load [hTempListPtr_ff99] into hl and de
|
||||
ld hl, hTempListPtr_ff99
|
||||
ld a, [hli]
|
||||
@@ -648,7 +648,7 @@ SortCardsInListByID: ; 12ad (0:12ad)
|
||||
inc [hl]
|
||||
; fallthrough
|
||||
|
||||
SortCardsInListByID_CheckForListTerminator: ; 12ef (0:12ef)
|
||||
SortCardsInListByID_CheckForListTerminator:
|
||||
ld hl, hTempListPtr_ff99
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
@@ -659,7 +659,7 @@ SortCardsInListByID_CheckForListTerminator: ; 12ef (0:12ef)
|
||||
|
||||
; returns, in register bc, the id of the card with the deck index specified in register a
|
||||
; preserves hl
|
||||
GetCardIDFromDeckIndex_bc: ; 12fa (0:12fa)
|
||||
GetCardIDFromDeckIndex_bc:
|
||||
push hl
|
||||
call _GetCardIDFromDeckIndex
|
||||
ld c, a
|
||||
@@ -668,7 +668,7 @@ GetCardIDFromDeckIndex_bc: ; 12fa (0:12fa)
|
||||
ret
|
||||
|
||||
; return [wDuelTempList + a] in a and in hTempCardIndex_ff98
|
||||
GetCardInDuelTempList_OnlyDeckIndex: ; 1303 (0:1303)
|
||||
GetCardInDuelTempList_OnlyDeckIndex:
|
||||
push hl
|
||||
push de
|
||||
ld e, a
|
||||
@@ -684,7 +684,7 @@ GetCardInDuelTempList_OnlyDeckIndex: ; 1303 (0:1303)
|
||||
; given the deck index (0-59) of a card in [wDuelTempList + a], return:
|
||||
; - the id of the card with that deck index in register de
|
||||
; - [wDuelTempList + a] in hTempCardIndex_ff98 and in register a
|
||||
GetCardInDuelTempList: ; 1312 (0:1312)
|
||||
GetCardInDuelTempList:
|
||||
push hl
|
||||
ld e, a
|
||||
ld d, $0
|
||||
@@ -699,7 +699,7 @@ GetCardInDuelTempList: ; 1312 (0:1312)
|
||||
|
||||
; returns, in register de, the id of the card with the deck index (0-59) specified by register a
|
||||
; preserves af and hl
|
||||
GetCardIDFromDeckIndex: ; 1324 (0:1324)
|
||||
GetCardIDFromDeckIndex:
|
||||
push af
|
||||
push hl
|
||||
call _GetCardIDFromDeckIndex
|
||||
@@ -711,7 +711,7 @@ GetCardIDFromDeckIndex: ; 1324 (0:1324)
|
||||
|
||||
; remove card c from wDuelTempList (it contains a $ff-terminated list of deck indexes)
|
||||
; returns carry if no matches were found.
|
||||
RemoveCardFromDuelTempList: ; 132f (0:132f)
|
||||
RemoveCardFromDuelTempList:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -744,7 +744,7 @@ RemoveCardFromDuelTempList: ; 132f (0:132f)
|
||||
ret
|
||||
|
||||
; return the number of cards in wDuelTempList in a
|
||||
CountCardsInDuelTempList: ; 1351 (0:1351)
|
||||
CountCardsInDuelTempList:
|
||||
push hl
|
||||
push bc
|
||||
ld hl, wDuelTempList
|
||||
@@ -760,7 +760,7 @@ CountCardsInDuelTempList: ; 1351 (0:1351)
|
||||
ret
|
||||
|
||||
; returns, in register a, the id of the card with the deck index (0-59) specified in register a
|
||||
_GetCardIDFromDeckIndex: ; 1362 (0:1362)
|
||||
_GetCardIDFromDeckIndex:
|
||||
push de
|
||||
ld e, a
|
||||
ld d, $0
|
||||
@@ -776,7 +776,7 @@ _GetCardIDFromDeckIndex: ; 1362 (0:1362)
|
||||
ret
|
||||
|
||||
; load data of card with deck index a (0-59) to wLoadedCard1
|
||||
LoadCardDataToBuffer1_FromDeckIndex: ; 1376 (0:1376)
|
||||
LoadCardDataToBuffer1_FromDeckIndex:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -793,7 +793,7 @@ LoadCardDataToBuffer1_FromDeckIndex: ; 1376 (0:1376)
|
||||
ret
|
||||
|
||||
; load data of card with deck index a (0-59) to wLoadedCard2
|
||||
LoadCardDataToBuffer2_FromDeckIndex: ; 138c (0:138c)
|
||||
LoadCardDataToBuffer2_FromDeckIndex:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -812,7 +812,7 @@ LoadCardDataToBuffer2_FromDeckIndex: ; 138c (0:138c)
|
||||
; evolve a turn holder's Pokemon card in the play area slot determined by hTempPlayAreaLocation_ff9d
|
||||
; into another turn holder's Pokemon card identifier by its deck index (0-59) in hTempCardIndex_ff98.
|
||||
; return nc if evolution was successful.
|
||||
EvolvePokemonCardIfPossible: ; 13a2 (0:13a2)
|
||||
EvolvePokemonCardIfPossible:
|
||||
; first make sure the attempted evolution is viable
|
||||
ldh a, [hTempCardIndex_ff98]
|
||||
ld d, a
|
||||
@@ -824,7 +824,7 @@ EvolvePokemonCardIfPossible: ; 13a2 (0:13a2)
|
||||
|
||||
; evolve a turn holder's Pokemon card in the play area slot determined by hTempPlayAreaLocation_ff9d
|
||||
; into another turn holder's Pokemon card identifier by its deck index (0-59) in hTempCardIndex_ff98.
|
||||
EvolvePokemonCard: ; 13ac (0:13ac)
|
||||
EvolvePokemonCard:
|
||||
; place the evolved Pokemon card in the play area location of the pre-evolved Pokemon card
|
||||
ldh a, [hTempPlayAreaLocation_ff9d]
|
||||
ld e, a
|
||||
@@ -877,7 +877,7 @@ EvolvePokemonCard: ; 13ac (0:13ac)
|
||||
; e is the play area location offset (PLAY_AREA_*) of the Pokemon trying to evolve.
|
||||
; d is the deck index (0-59) of the Pokemon card that was selected to be the evolution target.
|
||||
; return carry if can't evolve, plus nz if the reason for it is the card was played this turn.
|
||||
CheckIfCanEvolveInto: ; 13f7 (0:13f7)
|
||||
CheckIfCanEvolveInto:
|
||||
push de
|
||||
ld a, e
|
||||
add DUELVARS_ARENA_CARD
|
||||
@@ -920,7 +920,7 @@ CheckIfCanEvolveInto: ; 13f7 (0:13f7)
|
||||
; e is the play area location offset (PLAY_AREA_*) of the Pokemon trying to evolve.
|
||||
; d is the deck index (0-59) of the Pokemon card that was selected to be the evolution target.
|
||||
; return carry if not basic to stage 2 evolution, or if evolution not possible this turn.
|
||||
CheckIfCanEvolveInto_BasicToStage2: ; 142b (0:142b)
|
||||
CheckIfCanEvolveInto_BasicToStage2:
|
||||
ld a, e
|
||||
add DUELVARS_ARENA_CARD_FLAGS
|
||||
call GetTurnDuelistVariable
|
||||
@@ -960,7 +960,7 @@ CheckIfCanEvolveInto_BasicToStage2: ; 142b (0:142b)
|
||||
; clear the status, all substatuses, and temporary duelvars of the turn holder's
|
||||
; arena Pokemon. called when sending a new Pokemon into the arena.
|
||||
; does not reset Headache, since it targets a player rather than a Pokemon.
|
||||
ClearAllStatusConditions: ; 1461 (0:1461)
|
||||
ClearAllStatusConditions:
|
||||
push hl
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, a
|
||||
@@ -994,7 +994,7 @@ ClearAllStatusConditions: ; 1461 (0:1461)
|
||||
; input:
|
||||
; a = deck index of the card
|
||||
; return carry if there is no room for more Pokemon
|
||||
PutHandPokemonCardInPlayArea: ; 1485 (0:1485)
|
||||
PutHandPokemonCardInPlayArea:
|
||||
push af
|
||||
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
|
||||
call GetTurnDuelistVariable
|
||||
@@ -1056,7 +1056,7 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485)
|
||||
; e = play area location offset (PLAY_AREA_*)
|
||||
; returns:
|
||||
; a = CARD_LOCATION_PLAY_AREA + e
|
||||
PutHandCardInPlayArea: ; 14d2 (0:14d2)
|
||||
PutHandCardInPlayArea:
|
||||
call RemoveCardFromHand
|
||||
call GetTurnDuelistVariable
|
||||
ld a, e
|
||||
@@ -1066,7 +1066,7 @@ PutHandCardInPlayArea: ; 14d2 (0:14d2)
|
||||
|
||||
; move the Pokemon card of the turn holder in the
|
||||
; PLAY_AREA_* location given in e to the discard pile
|
||||
MovePlayAreaCardToDiscardPile: ; 14dd (0:14dd)
|
||||
MovePlayAreaCardToDiscardPile:
|
||||
call EmptyPlayAreaSlot
|
||||
ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
|
||||
dec [hl]
|
||||
@@ -1089,7 +1089,7 @@ MovePlayAreaCardToDiscardPile: ; 14dd (0:14dd)
|
||||
|
||||
; init a turn holder's play area slot to empty
|
||||
; which slot (arena or benchx) is determined by the play area location offset (PLAY_AREA_*) in e
|
||||
EmptyPlayAreaSlot: ; 14f8 (0:14f8)
|
||||
EmptyPlayAreaSlot:
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, a
|
||||
ld d, -1
|
||||
@@ -1112,7 +1112,7 @@ EmptyPlayAreaSlot: ; 14f8 (0:14f8)
|
||||
ret
|
||||
|
||||
; shift play area Pokemon of both players to the first available play area (arena + benchx) slots
|
||||
ShiftAllPokemonToFirstPlayAreaSlots: ; 151e (0:151e)
|
||||
ShiftAllPokemonToFirstPlayAreaSlots:
|
||||
call ShiftTurnPokemonToFirstPlayAreaSlots
|
||||
call SwapTurn
|
||||
call ShiftTurnPokemonToFirstPlayAreaSlots
|
||||
@@ -1120,7 +1120,7 @@ ShiftAllPokemonToFirstPlayAreaSlots: ; 151e (0:151e)
|
||||
ret
|
||||
|
||||
; shift play area Pokemon of the turn holder to the first available play area (arena + benchx) slots
|
||||
ShiftTurnPokemonToFirstPlayAreaSlots: ; 152b (0:152b)
|
||||
ShiftTurnPokemonToFirstPlayAreaSlots:
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
call GetTurnDuelistVariable
|
||||
lb de, PLAY_AREA_ARENA, PLAY_AREA_ARENA
|
||||
@@ -1141,7 +1141,7 @@ ShiftTurnPokemonToFirstPlayAreaSlots: ; 152b (0:152b)
|
||||
; data of the turn holder's Pokemon card in play area e.
|
||||
; reset the status and all substatuses of the arena Pokemon before swapping.
|
||||
; e is the play area location offset of the bench Pokemon (PLAY_AREA_*).
|
||||
SwapArenaWithBenchPokemon: ; 1543 (0:1543)
|
||||
SwapArenaWithBenchPokemon:
|
||||
call ClearAllStatusConditions
|
||||
ld d, PLAY_AREA_ARENA
|
||||
; fallthrough
|
||||
@@ -1149,7 +1149,7 @@ SwapArenaWithBenchPokemon: ; 1543 (0:1543)
|
||||
; swap the data of the turn holder's Pokemon card in play area d with the
|
||||
; data of the turn holder's Pokemon card in play area e.
|
||||
; d and e are play area location offsets (PLAY_AREA_*).
|
||||
SwapPlayAreaPokemon: ; 1548 (0:1548)
|
||||
SwapPlayAreaPokemon:
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
@@ -1219,7 +1219,7 @@ SwapPlayAreaPokemon: ; 1548 (0:1548)
|
||||
; or a Pokemon card in the bench, depending on the value of register e.
|
||||
; input: e = location to check, i.e. PLAY_AREA_*
|
||||
; Feedback is returned in wAttachedEnergies and wTotalAttachedEnergies.
|
||||
GetPlayAreaCardAttachedEnergies: ; 159f (0:159f)
|
||||
GetPlayAreaCardAttachedEnergies:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -1288,7 +1288,7 @@ GetPlayAreaCardAttachedEnergies: ; 159f (0:159f)
|
||||
; e = card id to search
|
||||
; b = location to consider (CARD_LOCATION_*)
|
||||
; h = PLAYER_TURN or OPPONENT_TURN
|
||||
CountCardIDInLocation: ; 15ef (0:15ef)
|
||||
CountCardIDInLocation:
|
||||
push bc
|
||||
ld l, DUELVARS_CARD_LOCATIONS
|
||||
ld c, $0
|
||||
@@ -1314,7 +1314,7 @@ CountCardIDInLocation: ; 15ef (0:15ef)
|
||||
|
||||
; returns [[hWhoseTurn] << 8 + a] in a and in [hl]
|
||||
; i.e. duelvar a of the player whose turn it is
|
||||
GetTurnDuelistVariable: ; 160b (0:160b)
|
||||
GetTurnDuelistVariable:
|
||||
ld l, a
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, a
|
||||
@@ -1323,7 +1323,7 @@ GetTurnDuelistVariable: ; 160b (0:160b)
|
||||
|
||||
; returns [([hWhoseTurn] ^ $1) << 8 + a] in a and in [hl]
|
||||
; i.e. duelvar a of the player whose turn it is not
|
||||
GetNonTurnDuelistVariable: ; 1611 (0:1611)
|
||||
GetNonTurnDuelistVariable:
|
||||
ld l, a
|
||||
ldh a, [hWhoseTurn]
|
||||
ld h, OPPONENT_TURN
|
||||
@@ -1337,7 +1337,7 @@ GetNonTurnDuelistVariable: ; 1611 (0:1611)
|
||||
; when playing a Pokemon card, initializes some variables according to the
|
||||
; card played, and checks if the played card has Pokemon Power to show it to
|
||||
; the player, and possibly to use it if it triggers when the card is played.
|
||||
Func_161e: ; 161e (0:161e)
|
||||
Func_161e:
|
||||
ldh a, [hTempCardIndex_ff98]
|
||||
call ClearChangedTypesIfMuk
|
||||
ldh a, [hTempCardIndex_ff98]
|
||||
@@ -1413,7 +1413,7 @@ Func_161e: ; 161e (0:161e)
|
||||
; - Attack1 (if e == 0) or Attack2 (if e == 1) data into wLoadedAttack
|
||||
; - Also from that attack, its Damage field into wDamage
|
||||
; finally, clears wNoDamageOrEffect and wDealtDamage
|
||||
CopyAttackDataAndDamage_FromCardID: ; 16ad (0:16ad)
|
||||
CopyAttackDataAndDamage_FromCardID:
|
||||
push de
|
||||
push af
|
||||
ld a, e
|
||||
@@ -1432,7 +1432,7 @@ CopyAttackDataAndDamage_FromCardID: ; 16ad (0:16ad)
|
||||
; - Attack1 (if e == 0) or Attack2 (if e == 1) data into wLoadedAttack
|
||||
; - Also from that attack, its Damage field into wDamage
|
||||
; finally, clears wNoDamageOrEffect and wDealtDamage
|
||||
CopyAttackDataAndDamage_FromDeckIndex: ; 16c0 (0:16c0)
|
||||
CopyAttackDataAndDamage_FromDeckIndex:
|
||||
ld a, e
|
||||
ld [wSelectedAttack], a
|
||||
ld a, d
|
||||
@@ -1440,7 +1440,7 @@ CopyAttackDataAndDamage_FromDeckIndex: ; 16c0 (0:16c0)
|
||||
call LoadCardDataToBuffer1_FromDeckIndex
|
||||
; fallthrough
|
||||
|
||||
CopyAttackDataAndDamage: ; 16ca (0:16ca)
|
||||
CopyAttackDataAndDamage:
|
||||
ld a, [wLoadedCard1ID]
|
||||
ld [wTempCardID_ccc2], a
|
||||
ld hl, wLoadedCard1Atk1
|
||||
@@ -1471,7 +1471,7 @@ CopyAttackDataAndDamage: ; 16ca (0:16ca)
|
||||
; wTempNonTurnDuelistCardID to the non-turn holder's arena card, and zeroes other temp
|
||||
; variables that only last between each two-player turn.
|
||||
; this is called when a Pokemon card is played or when an attack is used
|
||||
Func_16f6: ; 16f6 (0:16f6)
|
||||
Func_16f6:
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
call GetTurnDuelistVariable
|
||||
ldh [hTempCardIndex_ff9f], a
|
||||
@@ -1497,7 +1497,7 @@ Func_16f6: ; 16f6 (0:16f6)
|
||||
ret
|
||||
|
||||
; Use an attack (from DuelMenu_Attack) or a Pokemon Power (from DuelMenu_PkmnPower)
|
||||
UseAttackOrPokemonPower: ; 1730 (0:1730)
|
||||
UseAttackOrPokemonPower:
|
||||
ld a, [wSelectedAttack]
|
||||
ld [wPlayerAttackingAttackIndex], a
|
||||
ldh a, [hTempCardIndex_ff9f]
|
||||
@@ -1541,7 +1541,7 @@ UseAttackOrPokemonPower: ; 1730 (0:1730)
|
||||
call SetOppAction_SerialSendDuelData
|
||||
; fallthrough
|
||||
|
||||
PlayAttackAnimation_DealAttackDamage: ; 179a (0:179a)
|
||||
PlayAttackAnimation_DealAttackDamage:
|
||||
call Func_7415
|
||||
ld a, [wLoadedAttackCategory]
|
||||
and RESIDUAL
|
||||
@@ -1583,7 +1583,7 @@ PlayAttackAnimation_DealAttackDamage: ; 179a (0:179a)
|
||||
call PrintKnockedOutIfHLZero
|
||||
jr Func_17fb
|
||||
|
||||
Func_17ed: ; 17ed (0:17ed)
|
||||
Func_17ed:
|
||||
call DrawWideTextBox_WaitForInput
|
||||
xor a
|
||||
ld hl, wDamage
|
||||
@@ -1593,7 +1593,7 @@ Func_17ed: ; 17ed (0:17ed)
|
||||
ld [wNoDamageOrEffect], a
|
||||
; fallthrough
|
||||
|
||||
Func_17fb: ; 17fb (0:17fb)
|
||||
Func_17fb:
|
||||
ld a, [wTempNonTurnDuelistCardID]
|
||||
push af
|
||||
ld a, EFFECTCMDTYPE_AFTER_DAMAGE
|
||||
@@ -1608,28 +1608,28 @@ Func_17fb: ; 17fb (0:17fb)
|
||||
or a
|
||||
ret
|
||||
|
||||
DisplayUsePokemonPowerScreen_WaitForInput: ; 1819 (0:1819)
|
||||
DisplayUsePokemonPowerScreen_WaitForInput:
|
||||
push hl
|
||||
call DisplayUsePokemonPowerScreen
|
||||
pop hl
|
||||
; fallthrough
|
||||
|
||||
DrawWideTextBox_WaitForInput_ReturnCarry: ; 181e (0:181e)
|
||||
DrawWideTextBox_WaitForInput_ReturnCarry:
|
||||
call DrawWideTextBox_WaitForInput
|
||||
; fallthrough
|
||||
|
||||
ReturnCarry: ; 1821 (0:1821)
|
||||
ReturnCarry:
|
||||
scf
|
||||
ret
|
||||
|
||||
ClearNonTurnTemporaryDuelvars_ResetCarry: ; 1823 (0:1823)
|
||||
ClearNonTurnTemporaryDuelvars_ResetCarry:
|
||||
bank1call ClearNonTurnTemporaryDuelvars
|
||||
or a
|
||||
ret
|
||||
|
||||
; called when attacker deals damage to itself due to confusion
|
||||
; display the corresponding animation and deal 20 damage to self
|
||||
HandleConfusionDamageToSelf: ; 1828 (0:1828)
|
||||
HandleConfusionDamageToSelf:
|
||||
bank1call DrawDuelMainScene
|
||||
ld a, 1
|
||||
ld [wIsDamageToSelf], a
|
||||
@@ -1646,7 +1646,7 @@ HandleConfusionDamageToSelf: ; 1828 (0:1828)
|
||||
ret
|
||||
|
||||
; use Pokemon Power
|
||||
UsePokemonPower: ; 184b (0:184b)
|
||||
UsePokemonPower:
|
||||
call Func_7415
|
||||
ld a, EFFECTCMDTYPE_INITIAL_EFFECT_2
|
||||
call TryExecuteEffectCommandFunction
|
||||
@@ -1668,7 +1668,7 @@ UsePokemonPower: ; 184b (0:184b)
|
||||
; called by UseAttackOrPokemonPower (on an attack only)
|
||||
; in a link duel, it's used to send the other game data about the
|
||||
; attack being in use, triggering a call to OppAction_BeginUseAttack in the receiver
|
||||
SendAttackDataToLinkOpponent: ; 1874 (0:1874)
|
||||
SendAttackDataToLinkOpponent:
|
||||
ld a, [wccec]
|
||||
or a
|
||||
ret nz
|
||||
@@ -1691,7 +1691,7 @@ SendAttackDataToLinkOpponent: ; 1874 (0:1874)
|
||||
ldh [hTemp_ffa0], a
|
||||
ret
|
||||
|
||||
Func_189d: ; 189d (0:189d)
|
||||
Func_189d:
|
||||
ld a, [wLoadedAttackCategory]
|
||||
bit RESIDUAL_F, a
|
||||
ret nz
|
||||
@@ -1725,7 +1725,7 @@ Func_189d: ; 189d (0:189d)
|
||||
ret
|
||||
|
||||
; return carry and 1 into wGotHeadsFromConfusionCheck if damage will be dealt to oneself due to confusion
|
||||
CheckSelfConfusionDamage: ; 18d7 (0:18d7)
|
||||
CheckSelfConfusionDamage:
|
||||
xor a
|
||||
ld [wGotHeadsFromConfusionCheck], a
|
||||
ld a, DUELVARS_ARENA_CARD_STATUS
|
||||
@@ -1750,7 +1750,7 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7)
|
||||
; play the trainer card with deck index at hTempCardIndex_ff98.
|
||||
; a trainer card is like an attack effect, with its own effect commands.
|
||||
; return nc if the card was played, carry if it wasn't.
|
||||
PlayTrainerCard: ; 18f9 (0:18f9)
|
||||
PlayTrainerCard:
|
||||
call CheckCantUseTrainerDueToHeadache
|
||||
jr c, .cant_use
|
||||
ldh a, [hWhoseTurn]
|
||||
@@ -1790,7 +1790,7 @@ PlayTrainerCard: ; 18f9 (0:18f9)
|
||||
|
||||
; loads the effect commands of a (trainer or energy) card with deck index (0-59) at hTempCardIndex_ff9f
|
||||
; into wLoadedAttackEffectCommands. in practice, only used for trainer cards
|
||||
LoadNonPokemonCardEffectCommands: ; 1944 (0:1944)
|
||||
LoadNonPokemonCardEffectCommands:
|
||||
ldh a, [hTempCardIndex_ff9f]
|
||||
call LoadCardDataToBuffer1_FromDeckIndex
|
||||
ld hl, wLoadedCard1EffectCommands
|
||||
@@ -1804,7 +1804,7 @@ LoadNonPokemonCardEffectCommands: ; 1944 (0:1944)
|
||||
|
||||
; Make turn holder deal A damage to self due to recoil (e.g. Thrash, Selfdestruct)
|
||||
; display recoil animation
|
||||
DealRecoilDamageToSelf: ; 1955 (0:1955)
|
||||
DealRecoilDamageToSelf:
|
||||
push af
|
||||
ld a, ATK_ANIM_RECOIL_HIT
|
||||
ld [wLoadedAttackAnimation], a
|
||||
@@ -1813,7 +1813,7 @@ DealRecoilDamageToSelf: ; 1955 (0:1955)
|
||||
|
||||
; Make turn holder deal A damage to self due to confusion
|
||||
; display animation at wLoadedAttackAnimation
|
||||
DealConfusionDamageToSelf: ; 195c (0:195c)
|
||||
DealConfusionDamageToSelf:
|
||||
ld hl, wDamage
|
||||
ld [hli], a
|
||||
ld [hl], 0
|
||||
@@ -1845,7 +1845,7 @@ DealConfusionDamageToSelf: ; 195c (0:195c)
|
||||
; - if the non-turn holder's arena card resists the turn holder's arena card color: reduce damage by 30
|
||||
; - also apply Pluspower, Defender, and other kinds of damage reduction accordingly
|
||||
; return resulting damage in de
|
||||
ApplyDamageModifiers_DamageToTarget: ; 1994 (0:1994)
|
||||
ApplyDamageModifiers_DamageToTarget:
|
||||
xor a
|
||||
ld [wDamageEffectiveness], a
|
||||
ld hl, wDamage
|
||||
@@ -1912,7 +1912,7 @@ ApplyDamageModifiers_DamageToTarget: ; 1994 (0:1994)
|
||||
ret
|
||||
|
||||
; convert a color to its equivalent WR_* (weakness/resistance) value
|
||||
TranslateColorToWR: ; 1a0e (0:1a0e)
|
||||
TranslateColorToWR:
|
||||
push hl
|
||||
add LOW(InvertedPowersOf2)
|
||||
ld l, a
|
||||
@@ -1923,14 +1923,14 @@ TranslateColorToWR: ; 1a0e (0:1a0e)
|
||||
pop hl
|
||||
ret
|
||||
|
||||
InvertedPowersOf2: ; 1a1a (0:1a1a)
|
||||
InvertedPowersOf2:
|
||||
db $80, $40, $20, $10, $08, $04, $02, $01
|
||||
|
||||
; given a damage value at wDamage:
|
||||
; - if the turn holder's arena card is weak to its own color: double damage
|
||||
; - if the turn holder's arena card resists its own color: reduce damage by 30
|
||||
; return resulting damage in de
|
||||
ApplyDamageModifiers_DamageToSelf: ; 1a22 (0:1a22)
|
||||
ApplyDamageModifiers_DamageToSelf:
|
||||
xor a
|
||||
ld [wDamageEffectiveness], a
|
||||
ld hl, wDamage
|
||||
@@ -1973,7 +1973,7 @@ ApplyDamageModifiers_DamageToSelf: ; 1a22 (0:1a22)
|
||||
ret
|
||||
|
||||
; increases de by 10 points for each Pluspower found in location b
|
||||
ApplyAttachedPluspower: ; 1a69 (0:1a69)
|
||||
ApplyAttachedPluspower:
|
||||
push de
|
||||
call GetTurnDuelistVariable
|
||||
ld de, PLUSPOWER
|
||||
@@ -1988,7 +1988,7 @@ ApplyAttachedPluspower: ; 1a69 (0:1a69)
|
||||
ret
|
||||
|
||||
; reduces de by 20 points for each Defender found in location b
|
||||
ApplyAttachedDefender: ; 1a7e (0:1a7e)
|
||||
ApplyAttachedDefender:
|
||||
push de
|
||||
call GetTurnDuelistVariable
|
||||
ld de, DEFENDER
|
||||
@@ -2008,7 +2008,7 @@ ApplyAttachedDefender: ; 1a7e (0:1a7e)
|
||||
; hl: address to subtract HP from
|
||||
; de: how much HP to subtract (damage to deal)
|
||||
; returns carry if the HP does not become 0 as a result
|
||||
SubtractHP: ; 1a96 (0:1a96)
|
||||
SubtractHP:
|
||||
push hl
|
||||
push de
|
||||
ld a, [hl]
|
||||
@@ -2031,7 +2031,7 @@ SubtractHP: ; 1a96 (0:1a96)
|
||||
|
||||
; given a play area location offset in a, check if the turn holder's Pokemon card in
|
||||
; that location has no HP left, and, if so, print that it was knocked out.
|
||||
PrintPlayAreaCardKnockedOutIfNoHP: ; 1aac (0:1aac)
|
||||
PrintPlayAreaCardKnockedOutIfNoHP:
|
||||
ld e, a
|
||||
add DUELVARS_ARENA_CARD_HP
|
||||
call GetTurnDuelistVariable
|
||||
@@ -2051,7 +2051,7 @@ PrintPlayAreaCardKnockedOutIfNoHP: ; 1aac (0:1aac)
|
||||
scf
|
||||
ret
|
||||
|
||||
PrintKnockedOutIfHLZero: ; 1ad0 (0:1ad0)
|
||||
PrintKnockedOutIfHLZero:
|
||||
ld a, [hl] ; this is supposed to point to a remaining HP value after some form of damage calculation
|
||||
or a
|
||||
ret nz
|
||||
@@ -2059,7 +2059,7 @@ PrintKnockedOutIfHLZero: ; 1ad0 (0:1ad0)
|
||||
|
||||
; print in a text box that the Pokemon card at wTempNonTurnDuelistCardID
|
||||
; was knocked out and wait 40 frames
|
||||
PrintKnockedOut: ; 1ad3 (0:1ad3)
|
||||
PrintKnockedOut:
|
||||
ld a, [wTempNonTurnDuelistCardID]
|
||||
ld e, a
|
||||
call LoadCardDataToBuffer1_FromCardID
|
||||
@@ -2082,7 +2082,7 @@ PrintKnockedOut: ; 1ad3 (0:1ad3)
|
||||
; damage to deal is given in de.
|
||||
; shows the defending player's play area screen when dealing the damage
|
||||
; instead of the main duel interface with regular attack animation.
|
||||
DealDamageToPlayAreaPokemon_RegularAnim: ; 1af3 (0:1af3)
|
||||
DealDamageToPlayAreaPokemon_RegularAnim:
|
||||
ld a, ATK_ANIM_BENCH_HIT
|
||||
ld [wLoadedAttackAnimation], a
|
||||
; fallthrough
|
||||
@@ -2092,7 +2092,7 @@ DealDamageToPlayAreaPokemon_RegularAnim: ; 1af3 (0:1af3)
|
||||
; shows the defending player's play area screen when dealing the damage
|
||||
; instead of the main duel interface.
|
||||
; plays animation that is loaded in wLoadedAttackAnimation.
|
||||
DealDamageToPlayAreaPokemon: ; 1af8 (0:1af8)
|
||||
DealDamageToPlayAreaPokemon:
|
||||
ld a, b
|
||||
ld [wTempPlayAreaLocation_cceb], a
|
||||
or a ; cp PLAY_AREA_ARENA
|
||||
@@ -2184,14 +2184,14 @@ DealDamageToPlayAreaPokemon: ; 1af8 (0:1af8)
|
||||
; draw duel main scene, then print the "<Pokemon Lvxx>'s <attack>" text
|
||||
; The Pokemon's name is the turn holder's arena Pokemon, and the
|
||||
; attack's name is taken from wLoadedAttackName.
|
||||
DrawDuelMainScene_PrintPokemonsAttackText: ; 1b8d (0:1b8d)
|
||||
DrawDuelMainScene_PrintPokemonsAttackText:
|
||||
bank1call DrawDuelMainScene
|
||||
; fallthrough
|
||||
|
||||
; print the "<Pokemon Lvxx>'s <attack>" text
|
||||
; The Pokemon's name is the turn holder's arena Pokemon, and the
|
||||
; attack's name is taken from wLoadedAttackName.
|
||||
PrintPokemonsAttackText: ; 1b90 (0:1b90)
|
||||
PrintPokemonsAttackText:
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
call GetTurnDuelistVariable
|
||||
call LoadCardDataToBuffer1_FromDeckIndex
|
||||
@@ -2211,7 +2211,7 @@ PrintPokemonsAttackText: ; 1b90 (0:1b90)
|
||||
call DrawWideTextBox_PrintText
|
||||
ret
|
||||
|
||||
Func_1bb4: ; 1bb4 (0:1bb4)
|
||||
Func_1bb4:
|
||||
call Func_3b31
|
||||
bank1call DrawDuelMainScene
|
||||
call DrawDuelHUDs
|
||||
@@ -2224,7 +2224,7 @@ Func_1bb4: ; 1bb4 (0:1bb4)
|
||||
|
||||
; prints one of the ThereWasNoEffectFrom*Text if wEffectFailed contains EFFECT_FAILED_NO_EFFECT,
|
||||
; and prints WasUnsuccessfulText if wEffectFailed contains EFFECT_FAILED_UNSUCCESSFUL
|
||||
Func_1bca: ; 1bca (0:1bca)
|
||||
Func_1bca:
|
||||
ld a, [wEffectFailed]
|
||||
or a
|
||||
ret z
|
||||
@@ -2259,7 +2259,7 @@ Func_1bca: ; 1bca (0:1bca)
|
||||
|
||||
; return in a the retreat cost of the turn holder's arena or bench Pokemon
|
||||
; given the PLAY_AREA_* value in hTempPlayAreaLocation_ff9d
|
||||
GetPlayAreaCardRetreatCost: ; 1c05 (0:1c05)
|
||||
GetPlayAreaCardRetreatCost:
|
||||
ldh a, [hTempPlayAreaLocation_ff9d]
|
||||
add DUELVARS_ARENA_CARD
|
||||
call GetTurnDuelistVariable
|
||||
@@ -2269,7 +2269,7 @@ GetPlayAreaCardRetreatCost: ; 1c05 (0:1c05)
|
||||
|
||||
; move the turn holder's card with ID at de to the discard pile
|
||||
; if it's currently in the arena.
|
||||
MoveCardToDiscardPileIfInArena: ; 1c13 (0:1c13)
|
||||
MoveCardToDiscardPileIfInArena:
|
||||
ld c, e
|
||||
ld b, d
|
||||
ld l, DUELVARS_CARD_LOCATIONS
|
||||
@@ -2302,7 +2302,7 @@ MoveCardToDiscardPileIfInArena: ; 1c13 (0:1c13)
|
||||
; output:
|
||||
; a = damage;
|
||||
; c = max HP.
|
||||
GetCardDamageAndMaxHP: ; 1c35 (0:1c35)
|
||||
GetCardDamageAndMaxHP:
|
||||
push hl
|
||||
push de
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
@@ -2327,7 +2327,7 @@ GetCardDamageAndMaxHP: ; 1c35 (0:1c35)
|
||||
; fffff = flag address counting from wLoadedAttackFlag1
|
||||
; bbb = flag bit
|
||||
; return carry if the flag is set
|
||||
CheckLoadedAttackFlag: ; 1c50 (0:1c50)
|
||||
CheckLoadedAttackFlag:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -2360,7 +2360,7 @@ CheckLoadedAttackFlag: ; 1c50 (0:1c50)
|
||||
; As a side effect, this also returns a duelist variable in a similar manner to
|
||||
; GetNonTurnDuelistVariable, but this function appears to be
|
||||
; only called to swap the turn value.
|
||||
SwapTurn: ; 1c72 (0:1c72)
|
||||
SwapTurn:
|
||||
push af
|
||||
push hl
|
||||
call GetNonTurnDuelistVariable
|
||||
@@ -2371,7 +2371,7 @@ SwapTurn: ; 1c72 (0:1c72)
|
||||
ret
|
||||
|
||||
; copy the TX_END-terminated player's name from sPlayerName to de
|
||||
CopyPlayerName: ; 1c7d (0:1c7d)
|
||||
CopyPlayerName:
|
||||
call EnableSRAM
|
||||
ld hl, sPlayerName
|
||||
.loop
|
||||
@@ -2388,7 +2388,7 @@ CopyPlayerName: ; 1c7d (0:1c7d)
|
||||
; if text ID at wOpponentName is non-0, copy it from there
|
||||
; else, if text at wc500 is non-0, copy if from there
|
||||
; else, copy Player2Text
|
||||
CopyOpponentName: ; 1c8e (0:1c8e)
|
||||
CopyOpponentName:
|
||||
ld hl, wOpponentName
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
OpenDuelCheckMenu: ; 3096 (0:3096)
|
||||
OpenDuelCheckMenu:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(_OpenDuelCheckMenu)
|
||||
@@ -8,7 +8,7 @@ OpenDuelCheckMenu: ; 3096 (0:3096)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
OpenInPlayAreaScreen_FromSelectButton: ; 30a6 (0:30a6)
|
||||
OpenInPlayAreaScreen_FromSelectButton:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(OpenInPlayAreaScreen)
|
||||
@@ -27,7 +27,7 @@ OpenInPlayAreaScreen_FromSelectButton: ; 30a6 (0:30a6)
|
||||
; similar to DrawYourOrOppPlayArea (bank 2) except it also draws a wide text box.
|
||||
; this is because bank 2's DrawYourOrOppPlayArea is supposed to come from the Check Menu,
|
||||
; so the text box is always already there.
|
||||
DrawYourOrOppPlayAreaScreen_Bank0: ; 30bc (0:30bc)
|
||||
DrawYourOrOppPlayAreaScreen_Bank0:
|
||||
ld a, h
|
||||
ld [wCheckMenuPlayAreaWhichDuelist], a
|
||||
ld a, l
|
||||
@@ -42,7 +42,7 @@ DrawYourOrOppPlayAreaScreen_Bank0: ; 30bc (0:30bc)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
DrawPlayersPrizeAndBenchCards: ; 30d7 (0:30d7)
|
||||
DrawPlayersPrizeAndBenchCards:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(_DrawPlayersPrizeAndBenchCards)
|
||||
@@ -52,7 +52,7 @@ DrawPlayersPrizeAndBenchCards: ; 30d7 (0:30d7)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
HandlePeekSelection: ; 30e7 (0:30e7)
|
||||
HandlePeekSelection:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(_HandlePeekSelection)
|
||||
@@ -64,7 +64,7 @@ HandlePeekSelection: ; 30e7 (0:30e7)
|
||||
ld a, b
|
||||
ret
|
||||
|
||||
DrawAIPeekScreen: ; 30f9 (0:30f9)
|
||||
DrawAIPeekScreen:
|
||||
ld b, a
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -76,7 +76,7 @@ DrawAIPeekScreen: ; 30f9 (0:30f9)
|
||||
ret
|
||||
|
||||
; a = number of prize cards for player to select to take
|
||||
SelectPrizeCards: ; 310a (0:310a)
|
||||
SelectPrizeCards:
|
||||
ld [wNumberOfPrizeCardsToSelect], a
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -87,7 +87,7 @@ SelectPrizeCards: ; 310a (0:310a)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
DrawPlayAreaToPlacePrizeCards: ; 311d (0:311d)
|
||||
DrawPlayAreaToPlacePrizeCards:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(_DrawPlayAreaToPlacePrizeCards)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
; input:
|
||||
; a = command type to check
|
||||
; [wLoadedAttackEffectCommands] = pointer to list of commands of current attack or trainer card
|
||||
TryExecuteEffectCommandFunction: ; 2fd9 (0:2fd9)
|
||||
TryExecuteEffectCommandFunction:
|
||||
push af
|
||||
; grab pointer to command list from wLoadedAttackEffectCommands
|
||||
ld hl, wLoadedAttackEffectCommands
|
||||
@@ -38,7 +38,7 @@
|
||||
; a = command type to check
|
||||
; hl = list of commands of current attack or trainer card
|
||||
; return nc if command type matching a is found, carry otherwise
|
||||
CheckMatchingCommand: ; 2ffe (0:2ffe)
|
||||
CheckMatchingCommand:
|
||||
ld c, a
|
||||
ld a, l
|
||||
or h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; initialize the screen by emptying the tilemap. used during screen transitions
|
||||
EmptyScreen: ; 04a2 (0:04a2)
|
||||
EmptyScreen:
|
||||
call DisableLCD
|
||||
call FillTileMap
|
||||
xor a
|
||||
@@ -13,7 +13,7 @@ EmptyScreen: ; 04a2 (0:04a2)
|
||||
call DisableLCD
|
||||
ret
|
||||
|
||||
AttrBlkPacket_EmptyScreen: ; 04bf (0:04bf)
|
||||
AttrBlkPacket_EmptyScreen:
|
||||
sgb ATTR_BLK, 1 ; sgb_command, length
|
||||
db 1 ; number of data sets
|
||||
; Control Code, Color Palette Designation, X1, Y1, X2, Y2
|
||||
@@ -23,7 +23,7 @@ AttrBlkPacket_EmptyScreen: ; 04bf (0:04bf)
|
||||
|
||||
; returns v*BGMap0 + BG_MAP_WIDTH * c + b in de.
|
||||
; used to map coordinates at bc to a BGMap0 address.
|
||||
BCCoordToBGMap0Address: ; 04cf (0:04cf)
|
||||
BCCoordToBGMap0Address:
|
||||
ld l, c
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; RST18
|
||||
; this function affects the stack so that it returns to the pointer following
|
||||
; the rst call. similar to rst 28, except this always loads bank 1
|
||||
Bank1Call: ; 09ae (0:09ae)
|
||||
Bank1Call:
|
||||
push hl
|
||||
push hl
|
||||
push hl
|
||||
@@ -30,7 +30,7 @@ Bank1Call: ; 09ae (0:09ae)
|
||||
ld a, $1
|
||||
; fallthrough
|
||||
|
||||
Bank1Call_FarCall_Common: ; 09ce (0:09ce)
|
||||
Bank1Call_FarCall_Common:
|
||||
call BankswitchROM
|
||||
ld hl, sp+$d
|
||||
inc de
|
||||
@@ -59,7 +59,7 @@ SwitchToBankAtSP: ; 9dc (0:9dc)
|
||||
; RST28
|
||||
; this function affects the stack so that it returns
|
||||
; to the three byte pointer following the rst call
|
||||
FarCall: ; 09e9 (0:09e9)
|
||||
FarCall:
|
||||
push hl
|
||||
push hl
|
||||
push hl
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
; calls DoFrame a times
|
||||
DoAFrames: ; 0536 (0:0536)
|
||||
DoAFrames:
|
||||
.loop
|
||||
push af
|
||||
call DoFrame
|
||||
@@ -10,7 +10,7 @@ DoAFrames: ; 0536 (0:0536)
|
||||
|
||||
; updates background, sprites and other game variables, halts until vblank, and reads user input
|
||||
; if wDebugPauseAllowed is not 0, the game can be paused (and resumed) by pressing the SELECT button
|
||||
DoFrame: ; 053f (0:053f)
|
||||
DoFrame:
|
||||
push af
|
||||
push hl
|
||||
push de
|
||||
@@ -42,7 +42,7 @@ DoFrame: ; 053f (0:053f)
|
||||
|
||||
; handle D-pad repeat counter
|
||||
; used to quickly scroll through menus when a relevant D-pad key is held
|
||||
HandleDPadRepeat: ; 0572 (0:0572)
|
||||
HandleDPadRepeat:
|
||||
ldh a, [hKeysHeld]
|
||||
ldh [hDPadHeld], a
|
||||
and D_PAD
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
; copy b bytes of data from hl to de, but only during hblank
|
||||
HblankCopyDataHLtoDE: ; 0c19 (0:0c19)
|
||||
HblankCopyDataHLtoDE:
|
||||
push bc
|
||||
.loop
|
||||
ei
|
||||
@@ -21,7 +21,7 @@ HblankCopyDataHLtoDE: ; 0c19 (0:0c19)
|
||||
ret
|
||||
|
||||
; copy c bytes of data from de to hl, but only during hblank
|
||||
HblankCopyDataDEtoHL: ; 0c32 (0:0c32)
|
||||
HblankCopyDataDEtoHL:
|
||||
push bc
|
||||
.loop
|
||||
ei
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
; read joypad data to refresh hKeysHeld, hKeysPressed, and hKeysReleased
|
||||
; the A + B + Start + Select combination resets the game
|
||||
ReadJoypad: ; 04de (0:04de)
|
||||
ReadJoypad:
|
||||
ld a, JOY_BTNS_SELECT
|
||||
ldh [rJOYP], a
|
||||
ldh a, [rJOYP]
|
||||
@@ -40,12 +40,12 @@ ReadJoypad: ; 04de (0:04de)
|
||||
call ResetSerial
|
||||
; fallthrough
|
||||
|
||||
Reset: ; 051b (0:051b)
|
||||
Reset:
|
||||
ld a, [wInitialA]
|
||||
di
|
||||
jp Start
|
||||
|
||||
SaveButtonsHeld: ; 0522 (0:0522)
|
||||
SaveButtonsHeld:
|
||||
ld a, c
|
||||
ldh [hKeysHeld], a
|
||||
ld a, JOY_BTNS_SELECT | JOY_DPAD_SELECT
|
||||
@@ -53,7 +53,7 @@ SaveButtonsHeld: ; 0522 (0:0522)
|
||||
ret
|
||||
|
||||
; clear joypad hmem data
|
||||
ClearJoypad: ; 052a (0:052a)
|
||||
ClearJoypad:
|
||||
push hl
|
||||
ld hl, hDPadRepeat
|
||||
xor a
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
; enable timer interrupt
|
||||
EnableInt_Timer: ; 02dd (0:02dd)
|
||||
EnableInt_Timer:
|
||||
ldh a, [rIE]
|
||||
or 1 << INT_TIMER
|
||||
ldh [rIE], a
|
||||
ret
|
||||
|
||||
; enable vblank interrupt
|
||||
EnableInt_VBlank: ; 02e4 (0:02e4)
|
||||
EnableInt_VBlank:
|
||||
ldh a, [rIE]
|
||||
or 1 << INT_VBLANK
|
||||
ldh [rIE], a
|
||||
ret
|
||||
|
||||
; enable lcdc interrupt on hblank mode
|
||||
EnableInt_HBlank: ; 02eb (0:02eb)
|
||||
EnableInt_HBlank:
|
||||
ldh a, [rSTAT]
|
||||
or 1 << STAT_MODE_HBLANK
|
||||
ldh [rSTAT], a
|
||||
@@ -25,7 +25,7 @@ EnableInt_HBlank: ; 02eb (0:02eb)
|
||||
ret
|
||||
|
||||
; disable lcdc interrupt and the hblank mode trigger
|
||||
DisableInt_HBlank: ; 02fb (0:02fb)
|
||||
DisableInt_HBlank:
|
||||
ldh a, [rSTAT]
|
||||
and ~(1 << STAT_MODE_HBLANK)
|
||||
ldh [rSTAT], a
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; jumps to index a in pointer table hl
|
||||
JumpToFunctionInTable: ; 05ab (0:05ab)
|
||||
JumpToFunctionInTable:
|
||||
add a
|
||||
add l
|
||||
ld l, a
|
||||
@@ -12,7 +12,7 @@ JumpToFunctionInTable: ; 05ab (0:05ab)
|
||||
jp hl
|
||||
|
||||
; call function at [hl] if non-NULL
|
||||
CallIndirect: ; 05b6 (0:05b6)
|
||||
CallIndirect:
|
||||
push af
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
@@ -26,5 +26,5 @@ CallIndirect: ; 05b6 (0:05b6)
|
||||
pop af
|
||||
; fallthrough
|
||||
|
||||
CallHL: ; 05c1 (0:05c1)
|
||||
CallHL:
|
||||
jp hl
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
; wait for VBlankHandler to finish unless lcd is off
|
||||
WaitForVBlank: ; 0264 (0:0264)
|
||||
WaitForVBlank:
|
||||
push hl
|
||||
ld a, [wLCDC]
|
||||
bit LCDC_ENABLE_F, a
|
||||
@@ -16,7 +16,7 @@ WaitForVBlank: ; 0264 (0:0264)
|
||||
ret
|
||||
|
||||
; turn LCD on
|
||||
EnableLCD: ; 0277 (0:0277)
|
||||
EnableLCD:
|
||||
ld a, [wLCDC] ;
|
||||
bit LCDC_ENABLE_F, a ;
|
||||
ret nz ; assert that LCD is off
|
||||
@@ -28,7 +28,7 @@ EnableLCD: ; 0277 (0:0277)
|
||||
ret
|
||||
|
||||
; wait for vblank, then turn LCD off
|
||||
DisableLCD: ; 028a (0:028a)
|
||||
DisableLCD:
|
||||
ldh a, [rLCDC] ;
|
||||
bit LCDC_ENABLE_F, a ;
|
||||
ret z ; assert that LCD is on
|
||||
@@ -55,28 +55,28 @@ DisableLCD: ; 028a (0:028a)
|
||||
ret
|
||||
|
||||
; set OBJ size: 8x8
|
||||
Set_OBJ_8x8: ; 02b9 (0:02b9)
|
||||
Set_OBJ_8x8:
|
||||
ld a, [wLCDC]
|
||||
and LCDC_OBJ8
|
||||
ld [wLCDC], a
|
||||
ret
|
||||
|
||||
; set OBJ size: 8x16
|
||||
Set_OBJ_8x16: ; 02c2 (0:02c2)
|
||||
Set_OBJ_8x16:
|
||||
ld a, [wLCDC]
|
||||
or LCDC_OBJ16
|
||||
ld [wLCDC], a
|
||||
ret
|
||||
|
||||
; set Window Display on
|
||||
Set_WD_on: ; 02cb (0:02cb)
|
||||
Set_WD_on:
|
||||
ld a, [wLCDC]
|
||||
or LCDC_WINON
|
||||
ld [wLCDC], a
|
||||
ret
|
||||
|
||||
; set Window Display off
|
||||
Set_WD_off: ; 02d4 (0:02d4)
|
||||
Set_WD_off:
|
||||
ld a, [wLCDC]
|
||||
and LCDC_WINOFF
|
||||
ld [wLCDC], a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
DoFrameIfLCDEnabled: ; 3c48 (0:3c48)
|
||||
DoFrameIfLCDEnabled:
|
||||
push af
|
||||
ldh a, [rLCDC]
|
||||
bit LCDC_ENABLE_F, a
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
; Save a pointer to a list, given at de, to wListPointer
|
||||
SetListPointer: ; 0c6c (0:0c6c)
|
||||
SetListPointer:
|
||||
push hl
|
||||
ld hl, wListPointer
|
||||
ld [hl], e
|
||||
@@ -10,7 +10,7 @@ SetListPointer: ; 0c6c (0:0c6c)
|
||||
|
||||
; Return the current element of the list at wListPointer,
|
||||
; and advance the list to the next element
|
||||
GetNextElementOfList: ; 0c75 (0:0c75)
|
||||
GetNextElementOfList:
|
||||
push hl
|
||||
push de
|
||||
ld hl, wListPointer
|
||||
@@ -21,7 +21,7 @@ GetNextElementOfList: ; 0c75 (0:0c75)
|
||||
inc de
|
||||
; fallthrough
|
||||
|
||||
SetListToNextPosition: ; 0c7f (0:0c7f)
|
||||
SetListToNextPosition:
|
||||
ld [hl], d
|
||||
dec hl
|
||||
ld [hl], e
|
||||
@@ -31,7 +31,7 @@ SetListToNextPosition: ; 0c7f (0:0c7f)
|
||||
|
||||
; Set the current element of the list at wListPointer to a,
|
||||
; and advance the list to the next element
|
||||
SetNextElementOfList: ; 0c85 (0:0c85)
|
||||
SetNextElementOfList:
|
||||
push hl
|
||||
push de
|
||||
ld hl, wListPointer
|
||||
|
||||
+15
-15
@@ -1,10 +1,10 @@
|
||||
; clear [SOMETHING] - something relating to animations
|
||||
Func_3ca0: ; 3ca0 (0:3ca0)
|
||||
Func_3ca0:
|
||||
xor a
|
||||
ld [wd5d7], a
|
||||
; fallthrough
|
||||
|
||||
Func_3ca4: ; 3ca4 (0:3ca4)
|
||||
Func_3ca4:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(Func_1296e)
|
||||
@@ -14,7 +14,7 @@ Func_3ca4: ; 3ca4 (0:3ca4)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
HandleAllSpriteAnimations: ; 3cb4 (0:3cb4)
|
||||
HandleAllSpriteAnimations:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(_HandleAllSpriteAnimations)
|
||||
@@ -26,7 +26,7 @@ HandleAllSpriteAnimations: ; 3cb4 (0:3cb4)
|
||||
|
||||
; hl - pointer to animation frame
|
||||
; wd5d6 - bank of animation frame
|
||||
DrawSpriteAnimationFrame: ; 3cc4 (0:3cc4)
|
||||
DrawSpriteAnimationFrame:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, [wd5d6]
|
||||
@@ -143,7 +143,7 @@ DrawSpriteAnimationFrame: ; 3cc4 (0:3cc4)
|
||||
; the current frame's offset
|
||||
; [wd4ca] - current frame offset
|
||||
; wTempPointer* - Pointer to current Animation
|
||||
GetAnimationFramePointer: ; 3d72 (0:3d72)
|
||||
GetAnimationFramePointer:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
push hl
|
||||
@@ -194,7 +194,7 @@ GetAnimationFramePointer: ; 3d72 (0:3d72)
|
||||
|
||||
; return hl pointing to the start of a sprite in wSpriteAnimBuffer.
|
||||
; the sprite is identified by its index in wWhichSprite.
|
||||
GetFirstSpriteAnimBufferProperty: ; 3db7 (0:3db7)
|
||||
GetFirstSpriteAnimBufferProperty:
|
||||
push bc
|
||||
ld c, SPRITE_ANIM_ENABLED
|
||||
call GetSpriteAnimBufferProperty
|
||||
@@ -203,11 +203,11 @@ GetFirstSpriteAnimBufferProperty: ; 3db7 (0:3db7)
|
||||
|
||||
; return hl pointing to the property (byte) c of a sprite in wSpriteAnimBuffer.
|
||||
; the sprite is identified by its index in wWhichSprite.
|
||||
GetSpriteAnimBufferProperty: ; 3dbf (0:3dbf)
|
||||
GetSpriteAnimBufferProperty:
|
||||
ld a, [wWhichSprite]
|
||||
; fallthrough
|
||||
|
||||
GetSpriteAnimBufferProperty_SpriteInA: ; 3dc2 (0:3dc2)
|
||||
GetSpriteAnimBufferProperty_SpriteInA:
|
||||
cp SPRITE_ANIM_BUFFER_CAPACITY
|
||||
jr c, .got_sprite
|
||||
debug_nop
|
||||
@@ -227,7 +227,7 @@ GetSpriteAnimBufferProperty_SpriteInA: ; 3dc2 (0:3dc2)
|
||||
pop bc
|
||||
ret
|
||||
|
||||
Func_3ddb: ; 3ddb (0:3ddb)
|
||||
Func_3ddb:
|
||||
push hl
|
||||
push bc
|
||||
ld c, SPRITE_ANIM_FLAGS
|
||||
@@ -237,7 +237,7 @@ Func_3ddb: ; 3ddb (0:3ddb)
|
||||
pop hl
|
||||
ret
|
||||
|
||||
Func_3de7: ; 3de7 (0:3de7)
|
||||
Func_3de7:
|
||||
push hl
|
||||
push bc
|
||||
ld c, SPRITE_ANIM_FLAGS
|
||||
@@ -247,7 +247,7 @@ Func_3de7: ; 3de7 (0:3de7)
|
||||
pop hl
|
||||
ret
|
||||
|
||||
LoadScene: ; 3df3 (0:3df3)
|
||||
LoadScene:
|
||||
push af
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -266,13 +266,13 @@ LoadScene: ; 3df3 (0:3df3)
|
||||
ret
|
||||
|
||||
; draws player's portrait at b,c
|
||||
DrawPlayerPortrait: ; 3e10 (0:3e10)
|
||||
DrawPlayerPortrait:
|
||||
ld a, $1
|
||||
ld [wd61e], a
|
||||
ld a, TILEMAP_PLAYER
|
||||
; fallthrough
|
||||
|
||||
Func_3e17: ; 3e17 (0:3e17)
|
||||
Func_3e17:
|
||||
ld [wCurTilemap], a
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -284,12 +284,12 @@ Func_3e17: ; 3e17 (0:3e17)
|
||||
ret
|
||||
|
||||
; draws opponent's portrait given in a at b,c
|
||||
Func_3e2a: ; 3e2a (0:3e2a)
|
||||
Func_3e2a:
|
||||
ld [wd61e], a
|
||||
ld a, TILEMAP_OPPONENT
|
||||
jr Func_3e17
|
||||
|
||||
Func_3e31: ; 3e31 (0:3e31)
|
||||
Func_3e31:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
call HandleAllSpriteAnimations
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; loads the deck id in a from DeckPointers and copies it to wPlayerDeck or to
|
||||
; wOpponentDeck, depending on whose turn it is.
|
||||
; sets carry flag if an invalid deck id is used.
|
||||
LoadDeck: ; 302c (0:302c)
|
||||
LoadDeck:
|
||||
push hl
|
||||
ld l, a
|
||||
ld h, $0
|
||||
|
||||
+27
-27
@@ -1,5 +1,5 @@
|
||||
|
||||
OverworldDoFrameFunction: ; 380e (0:380e)
|
||||
OverworldDoFrameFunction:
|
||||
ld a, [wOverworldNPCFlags]
|
||||
bit HIDE_ALL_NPC_SPRITES, a
|
||||
ret nz
|
||||
@@ -23,7 +23,7 @@ OverworldDoFrameFunction: ; 380e (0:380e)
|
||||
|
||||
; enable the play time counter and execute the game event at [wGameEvent].
|
||||
; then return to the overworld, or restart the game (only after Credits).
|
||||
ExecuteGameEvent: ; 383d (0:383d)
|
||||
ExecuteGameEvent:
|
||||
ld a, 1
|
||||
ld [wPlayTimeCounterEnable], a
|
||||
ldh a, [hBankROM]
|
||||
@@ -39,7 +39,7 @@ ExecuteGameEvent: ; 383d (0:383d)
|
||||
ret
|
||||
|
||||
; execute a game event at [wGameEvent] from GameEventPointerTable
|
||||
_ExecuteGameEvent: ; 3855 (0:3855)
|
||||
_ExecuteGameEvent:
|
||||
ld a, [wGameEvent]
|
||||
cp NUM_GAME_EVENTS
|
||||
jr c, .got_game_event
|
||||
@@ -48,7 +48,7 @@ _ExecuteGameEvent: ; 3855 (0:3855)
|
||||
ld hl, GameEventPointerTable
|
||||
jp JumpToFunctionInTable
|
||||
|
||||
GameEventPointerTable: ; 3864 (0:3864)
|
||||
GameEventPointerTable:
|
||||
dw GameEvent_Overworld
|
||||
dw GameEvent_Duel
|
||||
dw GameEvent_BattleCenter
|
||||
@@ -58,11 +58,11 @@ GameEventPointerTable: ; 3864 (0:3864)
|
||||
dw GameEvent_ChallengeMachine
|
||||
dw GameEvent_Overworld
|
||||
|
||||
GameEvent_Overworld: ; 3874 (0:3874)
|
||||
GameEvent_Overworld:
|
||||
scf
|
||||
ret
|
||||
|
||||
GameEvent_GiftCenter: ; 3876 (0:3876)
|
||||
GameEvent_GiftCenter:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
call PauseSong
|
||||
@@ -83,7 +83,7 @@ GameEvent_GiftCenter: ; 3876 (0:3876)
|
||||
scf
|
||||
ret
|
||||
|
||||
GameEvent_BattleCenter: ; 38a3 (0:38a3)
|
||||
GameEvent_BattleCenter:
|
||||
ld a, GAME_EVENT_BATTLE_CENTER
|
||||
ld [wActiveGameEvent], a
|
||||
xor a
|
||||
@@ -98,7 +98,7 @@ GameEvent_BattleCenter: ; 38a3 (0:38a3)
|
||||
scf
|
||||
ret
|
||||
|
||||
GameEvent_Duel: ; 38c0 (0:38c0)
|
||||
GameEvent_Duel:
|
||||
ld a, GAME_EVENT_DUEL
|
||||
ld [wActiveGameEvent], a
|
||||
xor a
|
||||
@@ -112,7 +112,7 @@ GameEvent_Duel: ; 38c0 (0:38c0)
|
||||
scf
|
||||
ret
|
||||
|
||||
GameEvent_ChallengeMachine: ; 38db (0:38db)
|
||||
GameEvent_ChallengeMachine:
|
||||
ld a, MUSIC_PC_MAIN_MENU
|
||||
ld [wDefaultSong], a
|
||||
call PlayDefaultSong
|
||||
@@ -128,7 +128,7 @@ GameEvent_ChallengeMachine: ; 38db (0:38db)
|
||||
scf
|
||||
ret
|
||||
|
||||
GameEvent_ContinueDuel: ; 38fb (0:38fb)
|
||||
GameEvent_ContinueDuel:
|
||||
xor a
|
||||
ld [wSongOverride], a
|
||||
bank1call TryContinueDuel
|
||||
@@ -140,12 +140,12 @@ GameEvent_ContinueDuel: ; 38fb (0:38fb)
|
||||
scf
|
||||
ret
|
||||
|
||||
GameEvent_Credits: ; 3911 (0:3911)
|
||||
GameEvent_Credits:
|
||||
farcall Credits_1d6ad
|
||||
or a
|
||||
ret
|
||||
|
||||
GetReceivedLegendaryCards: ; 3917 (0:3917)
|
||||
GetReceivedLegendaryCards:
|
||||
ld a, EVENT_RECEIVED_LEGENDARY_CARDS
|
||||
farcall GetEventValue
|
||||
call EnableSRAM
|
||||
@@ -154,7 +154,7 @@ GetReceivedLegendaryCards: ; 3917 (0:3917)
|
||||
ret
|
||||
|
||||
; return in a the permission byte corresponding to the current map's x,y coordinates at bc
|
||||
GetPermissionOfMapPosition: ; 3927 (0:3927)
|
||||
GetPermissionOfMapPosition:
|
||||
push hl
|
||||
call GetPermissionByteOfMapPosition
|
||||
ld a, [hl]
|
||||
@@ -162,7 +162,7 @@ GetPermissionOfMapPosition: ; 3927 (0:3927)
|
||||
ret
|
||||
|
||||
; set to a the permission byte corresponding to the current map's x,y coordinates at bc
|
||||
SetPermissionOfMapPosition: ; 392e (0:392e)
|
||||
SetPermissionOfMapPosition:
|
||||
push hl
|
||||
push af
|
||||
call GetPermissionByteOfMapPosition
|
||||
@@ -173,7 +173,7 @@ SetPermissionOfMapPosition: ; 392e (0:392e)
|
||||
|
||||
; set the permission byte corresponding to the current map's x,y coordinates at bc
|
||||
; to the value of register a anded by its current value
|
||||
UpdatePermissionOfMapPosition: ; 3937 (0:3937)
|
||||
UpdatePermissionOfMapPosition:
|
||||
push hl
|
||||
push bc
|
||||
push de
|
||||
@@ -190,7 +190,7 @@ UpdatePermissionOfMapPosition: ; 3937 (0:3937)
|
||||
|
||||
; returns in hl the address within wPermissionMap that corresponds to
|
||||
; the current map's x,y coordinates at bc
|
||||
GetPermissionByteOfMapPosition: ; 3946 (0:3946)
|
||||
GetPermissionByteOfMapPosition:
|
||||
push bc
|
||||
srl b
|
||||
srl c
|
||||
@@ -206,7 +206,7 @@ GetPermissionByteOfMapPosition: ; 3946 (0:3946)
|
||||
ret
|
||||
|
||||
; copy c bytes of data from hl in bank wTempPointerBank to de, b times.
|
||||
CopyGfxDataFromTempBank: ; 395a (0:395a)
|
||||
CopyGfxDataFromTempBank:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, [wTempPointerBank]
|
||||
@@ -217,20 +217,20 @@ CopyGfxDataFromTempBank: ; 395a (0:395a)
|
||||
ret
|
||||
|
||||
; Movement offsets for player movements
|
||||
PlayerMovementOffsetTable: ; 396b (0:396b)
|
||||
PlayerMovementOffsetTable:
|
||||
db 0, -1 ; NORTH
|
||||
db 1, 0 ; EAST
|
||||
db 0, 1 ; SOUTH
|
||||
db -1, 0 ; WEST
|
||||
|
||||
; Movement offsets for player movements, in tiles
|
||||
PlayerMovementOffsetTable_Tiles: ; 3973 (0:3973)
|
||||
PlayerMovementOffsetTable_Tiles:
|
||||
db 0, -2 ; NORTH
|
||||
db 2, 0 ; EAST
|
||||
db 0, 2 ; SOUTH
|
||||
db -2, 0 ; WEST
|
||||
|
||||
OverworldMapNames: ; 397b (0:397b)
|
||||
OverworldMapNames:
|
||||
tx OverworldMapMasonLaboratoryText
|
||||
tx OverworldMapMasonLaboratoryText
|
||||
tx OverworldMapIshiharasHouseText
|
||||
@@ -246,7 +246,7 @@ OverworldMapNames: ; 397b (0:397b)
|
||||
tx OverworldMapPokemonDomeText
|
||||
tx OverworldMapMysteryHouseText
|
||||
|
||||
Func_3997: ; 3997 (0:3997)
|
||||
Func_3997:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(Func_1c056)
|
||||
@@ -257,13 +257,13 @@ Func_3997: ; 3997 (0:3997)
|
||||
ret
|
||||
|
||||
; returns in hl a pointer to the first element for the a'th NPC
|
||||
GetLoadedNPCID: ; 39a7 (0:39a7)
|
||||
GetLoadedNPCID:
|
||||
ld l, LOADED_NPC_ID
|
||||
call GetItemInLoadedNPCIndex
|
||||
ret
|
||||
|
||||
; return in hl a pointer to the a'th items element l
|
||||
GetItemInLoadedNPCIndex: ; 39ad (0:39ad)
|
||||
GetItemInLoadedNPCIndex:
|
||||
push bc
|
||||
cp LOADED_NPC_MAX
|
||||
jr c, .asm_39b4
|
||||
@@ -286,7 +286,7 @@ GetItemInLoadedNPCIndex: ; 39ad (0:39ad)
|
||||
; Finds the index on wLoadedNPCs table of the npc in wTempNPC
|
||||
; returns it in a and puts it into wLoadedNPCTempIndex
|
||||
; c flag set if no npc found
|
||||
FindLoadedNPC: ; 39c3 (0:39c3)
|
||||
FindLoadedNPC:
|
||||
push hl
|
||||
push bc
|
||||
push de
|
||||
@@ -316,7 +316,7 @@ FindLoadedNPC: ; 39c3 (0:39c3)
|
||||
pop hl
|
||||
ret
|
||||
|
||||
GetNextNPCMovementByte: ; 39ea (0:39ea)
|
||||
GetNextNPCMovementByte:
|
||||
push bc
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -330,7 +330,7 @@ GetNextNPCMovementByte: ; 39ea (0:39ea)
|
||||
pop bc
|
||||
ret
|
||||
|
||||
PlayDefaultSong: ; 39fc (0:39fc)
|
||||
PlayDefaultSong:
|
||||
push hl
|
||||
push bc
|
||||
call AssertSongFinished
|
||||
@@ -356,7 +356,7 @@ PlayDefaultSong: ; 39fc (0:39fc)
|
||||
ret
|
||||
|
||||
; returns [wDefaultSong] or MUSIC_RONALD in a
|
||||
GetDefaultSong: ; 3a1f (0:3a1f)
|
||||
GetDefaultSong:
|
||||
ld a, [wRonaldIsInMap]
|
||||
or a
|
||||
jr z, .default_song
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
; returns a *= 10
|
||||
ATimes10: ; 0c4b (0:0c4b)
|
||||
ATimes10:
|
||||
push de
|
||||
ld e, a
|
||||
add a
|
||||
@@ -10,7 +10,7 @@ ATimes10: ; 0c4b (0:0c4b)
|
||||
ret
|
||||
|
||||
; returns hl *= 10
|
||||
HLTimes10: ; 0c53 (0:0c53)
|
||||
HLTimes10:
|
||||
push de
|
||||
ld l, a
|
||||
ld e, a
|
||||
@@ -25,7 +25,7 @@ HLTimes10: ; 0c53 (0:0c53)
|
||||
|
||||
; returns a /= 10
|
||||
; returns carry if a % 10 >= 5
|
||||
ADividedBy10: ; 0c5f (0:0c5f)
|
||||
ADividedBy10:
|
||||
push de
|
||||
ld e, -1
|
||||
.asm_c62
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
; input:
|
||||
; bc = row width
|
||||
; de = buffer to place decompressed data
|
||||
DecompressDataFromBank: ; 3be4 (0:3be4)
|
||||
DecompressDataFromBank:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, [wTempPointerBank]
|
||||
@@ -14,7 +14,7 @@ DecompressDataFromBank: ; 3be4 (0:3be4)
|
||||
ret
|
||||
|
||||
; Copies bc bytes from [wTempPointer] to de
|
||||
CopyBankedDataToDE: ; 3bf5 (0:3bf5)
|
||||
CopyBankedDataToDE:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
push hl
|
||||
@@ -31,7 +31,7 @@ CopyBankedDataToDE: ; 3bf5 (0:3bf5)
|
||||
ret
|
||||
|
||||
; fill bc bytes of data at hl with a
|
||||
FillMemoryWithA: ; 3c10 (0:3c10)
|
||||
FillMemoryWithA:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -49,7 +49,7 @@ FillMemoryWithA: ; 3c10 (0:3c10)
|
||||
ret
|
||||
|
||||
; fill 2*bc bytes of data at hl with d,e
|
||||
FillMemoryWithDE: ; 3c1f (0:3c1f)
|
||||
FillMemoryWithDE:
|
||||
push hl
|
||||
push bc
|
||||
.loop
|
||||
@@ -66,7 +66,7 @@ FillMemoryWithDE: ; 3c1f (0:3c1f)
|
||||
ret
|
||||
|
||||
; gets far byte a:hl, outputs value in a
|
||||
GetFarByte: ; 3c2d (0:3c2d)
|
||||
GetFarByte:
|
||||
push hl
|
||||
push af
|
||||
ldh a, [hBankROM]
|
||||
|
||||
+47
-47
@@ -3,7 +3,7 @@
|
||||
; a = list length
|
||||
; de = initial page scroll offset, initial item (in the visible page)
|
||||
; hl: 9 bytes with the rest of the parameters
|
||||
InitializeCardListParameters: ; 25ea (0:25ea)
|
||||
InitializeCardListParameters:
|
||||
ld [wNumListItems], a
|
||||
ld a, d
|
||||
ld [wListScrollOffset], a
|
||||
@@ -39,7 +39,7 @@
|
||||
; state of the list in a, d, and e if A or B were pressed. also returns carry
|
||||
; if A or B were pressed, nc otherwise. returns -1 in a if B was pressed.
|
||||
; used for example in the Hand card list and Discard Pile card list screens.
|
||||
HandleCardListInput: ; 2626 (0:2626)
|
||||
HandleCardListInput:
|
||||
call HandleMenuInput
|
||||
ret nc
|
||||
ld a, [wListScrollOffset]
|
||||
@@ -55,7 +55,7 @@ HandleCardListInput: ; 2626 (0:2626)
|
||||
; wCursorXPosition, wCursorYPosition, wYDisplacementBetweenMenuItems, wNumMenuItems,
|
||||
; wCursorTile, wTileBehindCursor, wMenuFunctionPointer.
|
||||
; also sets the current menu item (wCurMenuItem) to the one specified in register a.
|
||||
InitializeMenuParameters: ; 2636 (0:2636)
|
||||
InitializeMenuParameters:
|
||||
ld [wCurMenuItem], a
|
||||
ldh [hCurMenuItem], a
|
||||
ld de, wCursorXPosition
|
||||
@@ -73,7 +73,7 @@ InitializeMenuParameters: ; 2636 (0:2636)
|
||||
; returns with the carry flag set if A or B were pressed
|
||||
; returns a = 0 if A was pressed, a = -1 if B was pressed
|
||||
; note: return values still subject to those of the function at [wMenuFunctionPointer] if any
|
||||
HandleMenuInput: ; 264b (0:264b)
|
||||
HandleMenuInput:
|
||||
xor a
|
||||
ld [wRefreshMenuCursorSFX], a
|
||||
ldh a, [hDPadHeld]
|
||||
@@ -146,7 +146,7 @@ HandleMenuInput: ; 264b (0:264b)
|
||||
|
||||
; plays an "open screen" sound (SFX_02) if [hCurMenuItem] != 0xff
|
||||
; plays an "exit screen" sound (SFX_03) if [hCurMenuItem] == 0xff
|
||||
PlayOpenOrExitScreenSFX: ; 26c0 (0:26c0)
|
||||
PlayOpenOrExitScreenSFX:
|
||||
push af
|
||||
ldh a, [hCurMenuItem]
|
||||
inc a
|
||||
@@ -163,14 +163,14 @@ PlayOpenOrExitScreenSFX: ; 26c0 (0:26c0)
|
||||
; called once per frame when a menu is open
|
||||
; play the sound effect at wRefreshMenuCursorSFX if non-0 and blink the
|
||||
; cursor when wCursorBlinkCounter hits 16 (i.e. every 16 frames)
|
||||
RefreshMenuCursor_CheckPlaySFX: ; 26d1 (0:26d1)
|
||||
RefreshMenuCursor_CheckPlaySFX:
|
||||
ld a, [wRefreshMenuCursorSFX]
|
||||
or a
|
||||
jr z, RefreshMenuCursor
|
||||
call PlaySFX
|
||||
; fallthrough
|
||||
|
||||
RefreshMenuCursor: ; 26da (0:26da)
|
||||
RefreshMenuCursor:
|
||||
ld hl, wCursorBlinkCounter
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
@@ -183,12 +183,12 @@ RefreshMenuCursor: ; 26da (0:26da)
|
||||
; fallthrough
|
||||
|
||||
; set the tile at [wCursorXPosition],[wCursorYPosition] to [wTileBehindCursor]
|
||||
EraseCursor: ; 26e9 (0:26e9)
|
||||
EraseCursor:
|
||||
ld a, [wTileBehindCursor]
|
||||
; fallthrough
|
||||
|
||||
; set the tile at [wCursorXPosition],[wCursorYPosition] to a
|
||||
DrawCursor: ; 26ec (0:26ec)
|
||||
DrawCursor:
|
||||
ld c, a
|
||||
ld a, [wYDisplacementBetweenMenuItems]
|
||||
ld l, a
|
||||
@@ -210,12 +210,12 @@ DrawCursor: ; 26ec (0:26ec)
|
||||
ret
|
||||
|
||||
; set the tile at [wCursorXPosition],[wCursorYPosition] to [wCursorTile]
|
||||
DrawCursor2: ; 270b (0:270b)
|
||||
DrawCursor2:
|
||||
ld a, [wCursorTile]
|
||||
jr DrawCursor
|
||||
|
||||
; set wCurMenuItem, and hCurMenuItem to a, and zero wCursorBlinkCounter
|
||||
SetMenuItem: ; 2710 (0:2710)
|
||||
SetMenuItem:
|
||||
ld [wCurMenuItem], a
|
||||
ldh [hCurMenuItem], a
|
||||
xor a
|
||||
@@ -226,7 +226,7 @@ SetMenuItem: ; 2710 (0:2710)
|
||||
; only handles input not involving the B, START, or SELECT buttons, that is,
|
||||
; navigating through the menu or selecting an item with the A button.
|
||||
; other input in handled by PrintDuelMenuAndHandleInput.handle_input
|
||||
HandleDuelMenuInput: ; 271a (0:271a)
|
||||
HandleDuelMenuInput:
|
||||
ldh a, [hDPadHeld]
|
||||
or a
|
||||
jr z, .blink_cursor
|
||||
@@ -301,7 +301,7 @@ HandleDuelMenuInput: ; 271a (0:271a)
|
||||
or a
|
||||
ret
|
||||
|
||||
DuelMenuCursorCoords: ; 278d (0:278d)
|
||||
DuelMenuCursorCoords:
|
||||
db 2, 14 ; Hand
|
||||
db 2, 16 ; Attack
|
||||
db 8, 14 ; Check
|
||||
@@ -315,7 +315,7 @@ DuelMenuCursorCoords: ; 278d (0:278d)
|
||||
; a = list length
|
||||
; de = initial page scroll offset, initial item (in the visible page)
|
||||
; hl: 9 bytes with the rest of the parameters
|
||||
PrintCardListItems: ; 2799 (0:2799)
|
||||
PrintCardListItems:
|
||||
call InitializeCardListParameters
|
||||
ld hl, wMenuFunctionPointer
|
||||
ld a, LOW(CardListMenuFunction)
|
||||
@@ -330,7 +330,7 @@ PrintCardListItems: ; 2799 (0:2799)
|
||||
|
||||
; like PrintCardListItems, except more parameters are already initialized
|
||||
; called instead of PrintCardListItems to reload the list after moving up or down
|
||||
ReloadCardListItems: ; 27af (0:27af)
|
||||
ReloadCardListItems:
|
||||
ld e, SYM_SPACE
|
||||
ld a, [wListScrollOffset]
|
||||
or a
|
||||
@@ -402,7 +402,7 @@ ReloadCardListItems: ; 27af (0:27af)
|
||||
ret
|
||||
|
||||
; reload a list of cards, except don't print their names
|
||||
Func_2827: ; 2827 (0:2827)
|
||||
Func_2827:
|
||||
ld a, $01
|
||||
ldh [hffb0], a
|
||||
call ReloadCardListItems
|
||||
@@ -412,7 +412,7 @@ Func_2827: ; 2827 (0:2827)
|
||||
|
||||
; convert the number at a to TX_SYMBOL text format and write it to wDefaultText
|
||||
; if the first digit is a 0, delete it and shift the number one tile to the left
|
||||
OneByteNumberToTxSymbol_TrimLeadingZerosAndAlign: ; 2832 (0:2832)
|
||||
OneByteNumberToTxSymbol_TrimLeadingZerosAndAlign:
|
||||
call OneByteNumberToTxSymbol
|
||||
ld a, [hli]
|
||||
cp SYM_0
|
||||
@@ -426,7 +426,7 @@ OneByteNumberToTxSymbol_TrimLeadingZerosAndAlign: ; 2832 (0:2832)
|
||||
|
||||
; this function is always loaded to wMenuFunctionPointer by PrintCardListItems
|
||||
; takes care of things like handling page scrolling and calling the function at wListFunctionPointer
|
||||
CardListMenuFunction: ; 283f (0:283f)
|
||||
CardListMenuFunction:
|
||||
ldh a, [hDPadHeld]
|
||||
ld b, a
|
||||
ld a, [wNumMenuItems]
|
||||
@@ -595,7 +595,7 @@ CardListMenuFunction: ; 283f (0:283f)
|
||||
|
||||
; convert the number at a to TX_SYMBOL text format and write it to wDefaultText
|
||||
; replace leading zeros with SYM_SPACE
|
||||
OneByteNumberToTxSymbol_TrimLeadingZeros: ; 296a (0:296a)
|
||||
OneByteNumberToTxSymbol_TrimLeadingZeros:
|
||||
call OneByteNumberToTxSymbol
|
||||
ld a, [hl]
|
||||
cp SYM_0
|
||||
@@ -604,7 +604,7 @@ OneByteNumberToTxSymbol_TrimLeadingZeros: ; 296a (0:296a)
|
||||
ret
|
||||
|
||||
; convert the number at a to TX_SYMBOL text format and write it to wDefaultText
|
||||
OneByteNumberToTxSymbol: ; 2974 (0:2974)
|
||||
OneByteNumberToTxSymbol:
|
||||
ld hl, wDefaultText
|
||||
push hl
|
||||
ld e, SYM_0 - 1
|
||||
@@ -621,7 +621,7 @@ OneByteNumberToTxSymbol: ; 2974 (0:2974)
|
||||
ret
|
||||
|
||||
; translate the TYPE_* constant in wLoadedCard1Type to an index for CardSymbolTable
|
||||
CardTypeToSymbolID: ; 2988 (0:2988)
|
||||
CardTypeToSymbolID:
|
||||
ld a, [wLoadedCard1Type]
|
||||
cp TYPE_TRAINER
|
||||
jr nc, .trainer_card
|
||||
@@ -640,7 +640,7 @@ CardTypeToSymbolID: ; 2988 (0:2988)
|
||||
|
||||
; return the entry in CardSymbolTable of the TYPE_* constant in wLoadedCard1Type
|
||||
; also return the first byte of said entry (starting tile number) in a
|
||||
GetCardSymbolData: ; 299f (0:299f)
|
||||
GetCardSymbolData:
|
||||
call CardTypeToSymbolID
|
||||
add a
|
||||
ld c, a
|
||||
@@ -651,7 +651,7 @@ GetCardSymbolData: ; 299f (0:299f)
|
||||
ret
|
||||
|
||||
; draw, at de, the 2x2 tile card symbol associated to the TYPE_* constant in wLoadedCard1Type
|
||||
DrawCardSymbol: ; 29ac (0:29ac)
|
||||
DrawCardSymbol:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -699,21 +699,21 @@ CardSymbolTable:
|
||||
|
||||
; copy the name and level of the card at wLoadedCard1 to wDefaultText
|
||||
; a = length in number of tiles (the resulting string will be padded with spaces to match it)
|
||||
CopyCardNameAndLevel: ; 29f5 (0:29f5)
|
||||
CopyCardNameAndLevel:
|
||||
farcall _CopyCardNameAndLevel
|
||||
ret
|
||||
|
||||
; sets cursor parameters for navigating in a text box, but using
|
||||
; default values for the cursor tile (SYM_CURSOR_R) and the tile behind it (SYM_SPACE).
|
||||
; d,e: coordinates of the cursor
|
||||
SetCursorParametersForTextBox_Default: ; 29fa (0:29fa)
|
||||
SetCursorParametersForTextBox_Default:
|
||||
lb bc, SYM_CURSOR_R, SYM_SPACE ; cursor tile, tile behind cursor
|
||||
call SetCursorParametersForTextBox
|
||||
; fallthrough
|
||||
|
||||
; wait until A or B is pressed.
|
||||
; return carry if A is pressed, nc if B is pressed. erase the cursor either way
|
||||
WaitForButtonAorB: ; 2a00 (0:2a00)
|
||||
WaitForButtonAorB:
|
||||
call DoFrame
|
||||
call RefreshMenuCursor
|
||||
ldh a, [hKeysPressed]
|
||||
@@ -732,7 +732,7 @@ WaitForButtonAorB: ; 2a00 (0:2a00)
|
||||
; sets cursor parameters for navigating in a text box
|
||||
; d,e: coordinates of the cursor
|
||||
; b,c: tile numbers of the cursor and of the tile behind it
|
||||
SetCursorParametersForTextBox: ; 2a1a (0:2a1a)
|
||||
SetCursorParametersForTextBox:
|
||||
xor a
|
||||
ld hl, wCurMenuItem
|
||||
ld [hli], a
|
||||
@@ -752,13 +752,13 @@ SetCursorParametersForTextBox: ; 2a1a (0:2a1a)
|
||||
|
||||
; draw a 20x6 text box aligned to the bottom of the screen,
|
||||
; print the text at hl without letter delay, and wait for A or B pressed
|
||||
DrawWideTextBox_PrintTextNoDelay_Wait: ; 2a30 (0:2a30)
|
||||
DrawWideTextBox_PrintTextNoDelay_Wait:
|
||||
call DrawWideTextBox_PrintTextNoDelay
|
||||
jp WaitForWideTextBoxInput
|
||||
|
||||
; draw a 20x6 text box aligned to the bottom of the screen
|
||||
; and print the text at hl without letter delay
|
||||
DrawWideTextBox_PrintTextNoDelay: ; 2a36 (0:2a36)
|
||||
DrawWideTextBox_PrintTextNoDelay:
|
||||
push hl
|
||||
call DrawWideTextBox
|
||||
ld a, 19
|
||||
@@ -766,13 +766,13 @@ DrawWideTextBox_PrintTextNoDelay: ; 2a36 (0:2a36)
|
||||
|
||||
; draw a 12x6 text box aligned to the bottom left of the screen
|
||||
; and print the text at hl without letter delay
|
||||
DrawNarrowTextBox_PrintTextNoDelay: ; 2a3e (0:2a3e)
|
||||
DrawNarrowTextBox_PrintTextNoDelay:
|
||||
push hl
|
||||
call DrawNarrowTextBox
|
||||
ld a, 11
|
||||
; fallthrough
|
||||
|
||||
DrawTextBox_PrintTextNoDelay: ; 2a44 (0:2a44)
|
||||
DrawTextBox_PrintTextNoDelay:
|
||||
lb de, 1, 14
|
||||
call AdjustCoordinatesForBGScroll
|
||||
call InitTextPrintingInTextbox
|
||||
@@ -785,7 +785,7 @@ DrawTextBox_PrintTextNoDelay: ; 2a44 (0:2a44)
|
||||
|
||||
; draw a 20x6 text box aligned to the bottom of the screen
|
||||
; and print the text at hl with letter delay
|
||||
DrawWideTextBox_PrintText: ; 2a59 (0:2a59)
|
||||
DrawWideTextBox_PrintText:
|
||||
push hl
|
||||
call DrawWideTextBox
|
||||
ld a, 19
|
||||
@@ -797,7 +797,7 @@ DrawWideTextBox_PrintText: ; 2a59 (0:2a59)
|
||||
jp PrintText
|
||||
|
||||
; draw a 12x6 text box aligned to the bottom left of the screen
|
||||
DrawNarrowTextBox: ; 2a6f (0:2a6f)
|
||||
DrawNarrowTextBox:
|
||||
lb de, 0, 12
|
||||
lb bc, 12, 6
|
||||
call AdjustCoordinatesForBGScroll
|
||||
@@ -806,7 +806,7 @@ DrawNarrowTextBox: ; 2a6f (0:2a6f)
|
||||
|
||||
; draw a 12x6 text box aligned to the bottom left of the screen,
|
||||
; print the text at hl without letter delay, and wait for A or B pressed
|
||||
DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c)
|
||||
DrawNarrowTextBox_WaitForInput:
|
||||
call DrawNarrowTextBox_PrintTextNoDelay
|
||||
xor a
|
||||
ld hl, NarrowTextBoxMenuParameters
|
||||
@@ -820,7 +820,7 @@ DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c)
|
||||
jr z, .wait_A_or_B_loop
|
||||
ret
|
||||
|
||||
NarrowTextBoxMenuParameters: ; 2a96 (0:2a96)
|
||||
NarrowTextBoxMenuParameters:
|
||||
db 10, 17 ; cursor x, cursor y
|
||||
db 1 ; y displacement between items
|
||||
db 1 ; number of items
|
||||
@@ -829,7 +829,7 @@ NarrowTextBoxMenuParameters: ; 2a96 (0:2a96)
|
||||
dw NULL ; function pointer if non-0
|
||||
|
||||
; draw a 20x6 text box aligned to the bottom of the screen
|
||||
DrawWideTextBox: ; 2a9e (0:2a9e)
|
||||
DrawWideTextBox:
|
||||
lb de, 0, 12
|
||||
lb bc, 20, 6
|
||||
call AdjustCoordinatesForBGScroll
|
||||
@@ -838,12 +838,12 @@ DrawWideTextBox: ; 2a9e (0:2a9e)
|
||||
|
||||
; draw a 20x6 text box aligned to the bottom of the screen,
|
||||
; print the text at hl with letter delay, and wait for A or B pressed
|
||||
DrawWideTextBox_WaitForInput: ; 2aab (0:2aab)
|
||||
DrawWideTextBox_WaitForInput:
|
||||
call DrawWideTextBox_PrintText
|
||||
; fallthrough
|
||||
|
||||
; wait for A or B to be pressed on a wide (20x6) text box
|
||||
WaitForWideTextBoxInput: ; 2aae (0:2aae)
|
||||
WaitForWideTextBoxInput:
|
||||
xor a
|
||||
ld hl, WideTextBoxMenuParameters
|
||||
call InitializeMenuParameters
|
||||
@@ -857,7 +857,7 @@ WaitForWideTextBoxInput: ; 2aae (0:2aae)
|
||||
call EraseCursor
|
||||
ret
|
||||
|
||||
WideTextBoxMenuParameters: ; 2ac8 (0:2ac8)
|
||||
WideTextBoxMenuParameters:
|
||||
db 18, 17 ; cursor x, cursor y
|
||||
db 1 ; y displacement between items
|
||||
db 1 ; number of items
|
||||
@@ -866,7 +866,7 @@ WideTextBoxMenuParameters: ; 2ac8 (0:2ac8)
|
||||
dw NULL ; function pointer if non-0
|
||||
|
||||
; display a two-item horizontal menu with custom text provided in hl and handle input
|
||||
TwoItemHorizontalMenu: ; 2ad0 (0:2ad0)
|
||||
TwoItemHorizontalMenu:
|
||||
call DrawWideTextBox_PrintText
|
||||
lb de, 6, 16 ; x, y
|
||||
ld a, d
|
||||
@@ -878,7 +878,7 @@ TwoItemHorizontalMenu: ; 2ad0 (0:2ad0)
|
||||
call EnableLCD
|
||||
jp HandleYesOrNoMenu.refresh_menu
|
||||
|
||||
YesOrNoMenuWithText_SetCursorToYes: ; 2aeb (0:2aeb)
|
||||
YesOrNoMenuWithText_SetCursorToYes:
|
||||
ld a, $01
|
||||
ld [wDefaultYesOrNo], a
|
||||
; fallthrough
|
||||
@@ -886,13 +886,13 @@ YesOrNoMenuWithText_SetCursorToYes: ; 2aeb (0:2aeb)
|
||||
; display a yes / no menu in a 20x8 textbox with custom text provided in hl and handle input
|
||||
; wDefaultYesOrNo determines whether the cursor initially points to YES or to NO
|
||||
; returns carry if "no" selected
|
||||
YesOrNoMenuWithText: ; 2af0 (0:2af0)
|
||||
YesOrNoMenuWithText:
|
||||
call DrawWideTextBox_PrintText
|
||||
; fallthrough
|
||||
|
||||
; prints the YES / NO menu items at coordinates x,y = 7,16 and handles input
|
||||
; input: wDefaultYesOrNo. returns carry if "no" selected
|
||||
YesOrNoMenu: ; 2af3 (0:2af3)
|
||||
YesOrNoMenu:
|
||||
lb de, 7, 16 ; x, y
|
||||
call PrintYesOrNoItems
|
||||
lb de, 6, 16 ; x, y
|
||||
@@ -900,14 +900,14 @@ YesOrNoMenu: ; 2af3 (0:2af3)
|
||||
|
||||
; prints the YES / NO menu items at coordinates x,y = 3,16 and handles input
|
||||
; input: wDefaultYesOrNo. returns carry if "no" selected
|
||||
YesOrNoMenuWithText_LeftAligned: ; 2afe (0:2afe)
|
||||
YesOrNoMenuWithText_LeftAligned:
|
||||
call DrawNarrowTextBox_PrintTextNoDelay
|
||||
lb de, 3, 16 ; x, y
|
||||
call PrintYesOrNoItems
|
||||
lb de, 2, 16 ; x, y
|
||||
; fallthrough
|
||||
|
||||
HandleYesOrNoMenu: ; 2b0a (0:2b0a)
|
||||
HandleYesOrNoMenu:
|
||||
ld a, d
|
||||
ld [wLeftmostItemCursorX], a
|
||||
lb bc, SYM_CURSOR_R, SYM_SPACE ; cursor tile, tile behind cursor
|
||||
@@ -962,13 +962,13 @@ HandleYesOrNoMenu: ; 2b0a (0:2b0a)
|
||||
ret
|
||||
|
||||
; prints "YES NO" at de
|
||||
PrintYesOrNoItems: ; 2b66 (0:2b66)
|
||||
PrintYesOrNoItems:
|
||||
call AdjustCoordinatesForBGScroll
|
||||
ldtx hl, YesOrNoText
|
||||
call InitTextPrinting_ProcessTextFromID
|
||||
ret
|
||||
|
||||
ContinueDuel: ; 2b70 (0:2b70)
|
||||
ContinueDuel:
|
||||
ld a, BANK(_ContinueDuel)
|
||||
call BankswitchROM
|
||||
jp _ContinueDuel
|
||||
|
||||
@@ -43,7 +43,7 @@ SetManyObjectsAttributes: ; 950 (0:950)
|
||||
|
||||
; for the sprite at wOAM + [wOAMOffset] / 4, set its attributes from registers e, d, c, b
|
||||
; return carry if [wOAMOffset] > 40 * 4 (beyond the end of wOAM)
|
||||
SetOneObjectAttributes: ; 097f (0:097f)
|
||||
SetOneObjectAttributes:
|
||||
push hl
|
||||
ld a, [wOAMOffset]
|
||||
ld l, a
|
||||
@@ -69,7 +69,7 @@ SetOneObjectAttributes: ; 097f (0:097f)
|
||||
ret
|
||||
|
||||
; set the Y Position and X Position of all sprites in wOAM to $00
|
||||
ZeroObjectPositions: ; 099c (0:099c)
|
||||
ZeroObjectPositions:
|
||||
xor a
|
||||
ld [wOAMOffset], a
|
||||
ld hl, wOAM
|
||||
|
||||
+10
-10
@@ -1,25 +1,25 @@
|
||||
; Flush all non-CGB and CGB palettes
|
||||
FlushAllPalettes: ; 0404 (0:0404)
|
||||
FlushAllPalettes:
|
||||
ld a, FLUSH_ALL_PALS
|
||||
jr FlushPalettes
|
||||
|
||||
; Flush non-CGB palettes and a single CGB palette,
|
||||
; provided in a as an index between 0-7 (BGP) or 8-15 (OBP)
|
||||
FlushPalette: ; 0408 (0:0408)
|
||||
FlushPalette:
|
||||
or FLUSH_ONE_PAL
|
||||
jr FlushPalettes
|
||||
|
||||
; Set wBGP to the specified value, flush non-CGB palettes, and the first CGB palette.
|
||||
SetBGP: ; 040c (0:040c)
|
||||
SetBGP:
|
||||
ld [wBGP], a
|
||||
; fallthrough
|
||||
|
||||
; Flush non-CGB palettes and the first CGB palette
|
||||
FlushPalette0: ; 040f (0:040f)
|
||||
FlushPalette0:
|
||||
ld a, FLUSH_ONE_PAL
|
||||
; fallthrough
|
||||
|
||||
FlushPalettes: ; 0411 (0:0411)
|
||||
FlushPalettes:
|
||||
ld [wFlushPaletteFlags], a
|
||||
ld a, [wLCDC]
|
||||
rla
|
||||
@@ -34,12 +34,12 @@ FlushPalettes: ; 0411 (0:0411)
|
||||
ret
|
||||
|
||||
; Set wOBP0 to the specified value, flush non-CGB palettes, and the first CGB palette.
|
||||
SetOBP0: ; 0423 (0:0423)
|
||||
SetOBP0:
|
||||
ld [wOBP0], a
|
||||
jr FlushPalette0
|
||||
|
||||
; Set wOBP1 to the specified value, flush non-CGB palettes, and the first CGB palette.
|
||||
SetOBP1: ; 0428 (0:0428)
|
||||
SetOBP1:
|
||||
ld [wOBP1], a
|
||||
jr FlushPalette0
|
||||
|
||||
@@ -48,7 +48,7 @@ SetOBP1: ; 0428 (0:0428)
|
||||
; and [wObjectPalettesCGB+$00..wObjectPalettesCGB+$3f] (sprite palette).
|
||||
; Only flushes if [wFlushPaletteFlags] is nonzero, and only flushes
|
||||
; a single CGB palette if bit6 of that location is reset.
|
||||
FlushPalettesIfRequested: ; 042d (0:042d)
|
||||
FlushPalettesIfRequested:
|
||||
ld a, [wFlushPaletteFlags]
|
||||
or a
|
||||
ret z
|
||||
@@ -77,7 +77,7 @@ FlushPalettesIfRequested: ; 042d (0:042d)
|
||||
call CopyCGBPalettes
|
||||
jr .done
|
||||
|
||||
FlushAllCGBPalettes: ; 0458 (0:0458)
|
||||
FlushAllCGBPalettes:
|
||||
; flush 8 BGP palettes
|
||||
xor a
|
||||
ld b, 8 palettes
|
||||
@@ -90,7 +90,7 @@ FlushAllCGBPalettes: ; 0458 (0:0458)
|
||||
|
||||
; copy b bytes of CGB palette data starting at
|
||||
; (wBackgroundPalettesCGB + a palettes) into rBGPD or rOBPD.
|
||||
CopyCGBPalettes: ; 0467 (0:0467)
|
||||
CopyCGBPalettes:
|
||||
add a
|
||||
add a
|
||||
add a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; return nc if wd42a, wd4c0, and wAnimationQueue[] are all equal to $ff
|
||||
; nc means no animation is playing (or animation(s) has/have ended)
|
||||
CheckAnyAnimationPlaying: ; 3b52 (0:3b52)
|
||||
CheckAnyAnimationPlaying:
|
||||
push hl
|
||||
push bc
|
||||
ld a, [wd42a]
|
||||
@@ -23,7 +23,7 @@ CheckAnyAnimationPlaying: ; 3b52 (0:3b52)
|
||||
; and played in order, so they can be stacked
|
||||
; input:
|
||||
; - a = animation index
|
||||
PlayDuelAnimation: ; 3b6a (0:3b6a)
|
||||
PlayDuelAnimation:
|
||||
ld [wTempAnimation], a ; hold an animation temporarily
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -61,7 +61,7 @@ PlayDuelAnimation: ; 3b6a (0:3b6a)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
Func_3ba2: ; 3ba2 (0:3ba2)
|
||||
Func_3ba2:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(Func_1cac5)
|
||||
@@ -72,7 +72,7 @@ Func_3ba2: ; 3ba2 (0:3ba2)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
Func_3bb5: ; 3bb5 (0:3bb5)
|
||||
Func_3bb5:
|
||||
xor a
|
||||
ld [wd4c0], a
|
||||
ldh a, [hBankROM]
|
||||
@@ -88,14 +88,14 @@ Func_3bb5: ; 3bb5 (0:3bb5)
|
||||
ret
|
||||
|
||||
; writes from hl the pointer to the function to be called by DoFrame
|
||||
SetDoFrameFunction: ; 3bd2 (0:3bd2)
|
||||
SetDoFrameFunction:
|
||||
ld a, l
|
||||
ld [wDoFrameFunction], a
|
||||
ld a, h
|
||||
ld [wDoFrameFunction + 1], a
|
||||
ret
|
||||
|
||||
ResetDoFrameFunction: ; 3bdb (0:3bdb)
|
||||
ResetDoFrameFunction:
|
||||
push hl
|
||||
ld hl, NULL
|
||||
call SetDoFrameFunction
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
ScriptPlaySong: ; 3c83 (0:3c83)
|
||||
ScriptPlaySong:
|
||||
call PlaySong
|
||||
ret
|
||||
|
||||
Func_3c87: ; 3c87 (0:3c87)
|
||||
Func_3c87:
|
||||
push af
|
||||
call PauseSong
|
||||
pop af
|
||||
@@ -11,7 +11,7 @@ Func_3c87: ; 3c87 (0:3c87)
|
||||
call ResumeSong
|
||||
ret
|
||||
|
||||
WaitForSongToFinish: ; 3c96 (0:3c96)
|
||||
WaitForSongToFinish:
|
||||
call DoFrameIfLCDEnabled
|
||||
call AssertSongFinished
|
||||
or a
|
||||
|
||||
+28
-28
@@ -1,7 +1,7 @@
|
||||
; writes n items of text each given in the following format in hl:
|
||||
; x coord, y coord, text id
|
||||
; $ff-terminated
|
||||
PlaceTextItems: ; 2c08 (0:2c08)
|
||||
PlaceTextItems:
|
||||
ld d, [hl] ; x coord
|
||||
inc hl
|
||||
bit 7, d
|
||||
@@ -17,18 +17,18 @@ PlaceTextItems: ; 2c08 (0:2c08)
|
||||
jr PlaceTextItems ; do next item
|
||||
|
||||
; like ProcessTextFromID, except it calls InitTextPrinting first
|
||||
InitTextPrinting_ProcessTextFromID: ; 2c1b (0:2c1b)
|
||||
InitTextPrinting_ProcessTextFromID:
|
||||
call InitTextPrinting
|
||||
jr ProcessTextFromID
|
||||
|
||||
; like ProcessTextFromPointerToID, except it calls InitTextPrinting first
|
||||
InitTextPrinting_ProcessTextFromPointerToID: ; 2c20 (0:2c20)
|
||||
InitTextPrinting_ProcessTextFromPointerToID:
|
||||
call InitTextPrinting
|
||||
; fallthrough
|
||||
|
||||
; like ProcessTextFromID below, except a memory address containing a text ID is
|
||||
; provided in hl rather than the text ID directly.
|
||||
ProcessTextFromPointerToID: ; 2c23 (0:2c23)
|
||||
ProcessTextFromPointerToID:
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
ret z
|
||||
@@ -40,7 +40,7 @@ ProcessTextFromPointerToID: ; 2c23 (0:2c23)
|
||||
; given the ID of a text in hl, reads the characters from it processes them.
|
||||
; loops until TX_END is found. ignores TX_RAM1, TX_RAM2, and TX_RAM3 characters.
|
||||
; restores original ROM bank before returning.
|
||||
ProcessTextFromID: ; 2c29 (0:2c29)
|
||||
ProcessTextFromID:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
call GetTextOffsetFromTextID
|
||||
@@ -51,7 +51,7 @@ ProcessTextFromID: ; 2c29 (0:2c29)
|
||||
|
||||
; return, in a, the number of lines of the text given in hl as an ID
|
||||
; this is calculated by counting the amount of '\n' characters and adding 1 to the result
|
||||
CountLinesOfTextFromID: ; 2c37 (0:2c37)
|
||||
CountLinesOfTextFromID:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -86,11 +86,11 @@ CountLinesOfTextFromID: ; 2c37 (0:2c37)
|
||||
|
||||
; call PrintScrollableText with text box label, then wait for the
|
||||
; player to press A or B to advance the printed text
|
||||
PrintScrollableText_WithTextBoxLabel: ; 2c62 (0:2c62)
|
||||
PrintScrollableText_WithTextBoxLabel:
|
||||
call PrintScrollableText_WithTextBoxLabel_NoWait
|
||||
jr WaitForPlayerToAdvanceText
|
||||
|
||||
PrintScrollableText_WithTextBoxLabel_NoWait: ; 2c67 (0:2c67)
|
||||
PrintScrollableText_WithTextBoxLabel_NoWait:
|
||||
push hl
|
||||
ld hl, wTextBoxLabel
|
||||
ld [hl], e
|
||||
@@ -102,14 +102,14 @@ PrintScrollableText_WithTextBoxLabel_NoWait: ; 2c67 (0:2c67)
|
||||
|
||||
; call PrintScrollableText with no text box label, then wait for the
|
||||
; player to press A or B to advance the printed text
|
||||
PrintScrollableText_NoTextBoxLabel: ; 2c73 (0:2c73)
|
||||
PrintScrollableText_NoTextBoxLabel:
|
||||
xor a
|
||||
call PrintScrollableText
|
||||
; fallthrough
|
||||
|
||||
; when a text box is full or the text is over, prompt the player to
|
||||
; press A or B in order to clear the text and print the next lines.
|
||||
WaitForPlayerToAdvanceText: ; 2c77 (0:2c77)
|
||||
WaitForPlayerToAdvanceText:
|
||||
lb bc, SYM_CURSOR_D, SYM_BOX_BOTTOM ; cursor tile, tile behind cursor
|
||||
lb de, 18, 17 ; x, y
|
||||
call SetCursorParametersForTextBox
|
||||
@@ -121,7 +121,7 @@ WaitForPlayerToAdvanceText: ; 2c77 (0:2c77)
|
||||
; to advance the page or close the text. register a determines whether the textbox is
|
||||
; labeled or not. if labeled, the text id of the label is provided in wTextBoxLabel.
|
||||
; PrintScrollableText is used mostly for overworld NPC text.
|
||||
PrintScrollableText: ; 2c84 (0:2c84)
|
||||
PrintScrollableText:
|
||||
ld [wIsTextBoxLabeled], a
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -165,7 +165,7 @@ PrintScrollableText: ; 2c84 (0:2c84)
|
||||
|
||||
; zero wWhichTextHeader, wWhichTxRam2 and wWhichTxRam3, and set hJapaneseSyllabary to TX_KATAKANA
|
||||
; fill wTextHeader1 with TX_KATAKANA, wFontWidth, hBankROM, and register bc for the text's pointer.
|
||||
ResetTxRam_WriteToTextHeader: ; 2cc8 (0:2cc8)
|
||||
ResetTxRam_WriteToTextHeader:
|
||||
xor a
|
||||
ld [wWhichTextHeader], a
|
||||
ld [wWhichTxRam2], a
|
||||
@@ -176,7 +176,7 @@ ResetTxRam_WriteToTextHeader: ; 2cc8 (0:2cc8)
|
||||
|
||||
; fill the wTextHeader specified in wWhichTextHeader (0-3) with hJapaneseSyllabary,
|
||||
; wFontWidth, hBankROM, and register bc for the text's pointer.
|
||||
WriteToTextHeader: ; 2cd7 (0:2cd7)
|
||||
WriteToTextHeader:
|
||||
push hl
|
||||
call GetPointerToTextHeader
|
||||
pop bc
|
||||
@@ -194,7 +194,7 @@ WriteToTextHeader: ; 2cd7 (0:2cd7)
|
||||
; same as WriteToTextHeader, except it then increases wWhichTextHeader to
|
||||
; set the next text header to the current one (usually, because
|
||||
; it will soon be written to due to a TX_RAM command).
|
||||
WriteToTextHeader_MoveToNext: ; 2ceb (0:2ceb)
|
||||
WriteToTextHeader_MoveToNext:
|
||||
call WriteToTextHeader
|
||||
ld hl, wWhichTextHeader
|
||||
inc [hl]
|
||||
@@ -203,7 +203,7 @@ WriteToTextHeader_MoveToNext: ; 2ceb (0:2ceb)
|
||||
; read the wTextHeader specified in wWhichTextHeader (0-3) and use the data to
|
||||
; populate the corresponding memory addresses. also switch to the text's rombank
|
||||
; and return the address of the next character in hl.
|
||||
ReadTextHeader: ; 2cf3 (0:2cf3)
|
||||
ReadTextHeader:
|
||||
call GetPointerToTextHeader
|
||||
ld a, [hli]
|
||||
ld [hJapaneseSyllabary], a
|
||||
@@ -217,7 +217,7 @@ ReadTextHeader: ; 2cf3 (0:2cf3)
|
||||
ret
|
||||
|
||||
; return in hl, the address of the wTextHeader specified in wWhichTextHeader (0-3)
|
||||
GetPointerToTextHeader: ; 2d06 (0:2d06)
|
||||
GetPointerToTextHeader:
|
||||
ld a, [wWhichTextHeader]
|
||||
ld e, a
|
||||
add a
|
||||
@@ -232,7 +232,7 @@ GetPointerToTextHeader: ; 2d06 (0:2d06)
|
||||
; draws a wide text box with or without label depending on wIsTextBoxLabeled
|
||||
; if labeled, the label's text ID is provided in wTextBoxLabel
|
||||
; calls InitTextPrintingInTextbox after drawing the text box
|
||||
DrawTextReadyLabeledOrRegularTextBox: ; 2d15 (0:2d15)
|
||||
DrawTextReadyLabeledOrRegularTextBox:
|
||||
push hl
|
||||
lb de, 0, 12
|
||||
lb bc, 20, 6
|
||||
@@ -261,7 +261,7 @@ DrawTextReadyLabeledOrRegularTextBox: ; 2d15 (0:2d15)
|
||||
; then updates the current wTextHeader to point to the next character.
|
||||
; a TX_RAM command causes a switch to a wTextHeader in the level below, and a TX_END
|
||||
; command terminates the text unless there is a pending wTextHeader in the above level.
|
||||
ProcessTextHeader: ; 2d43 (0:2d43)
|
||||
ProcessTextHeader:
|
||||
call ReadTextHeader
|
||||
ld a, [hli]
|
||||
or a ; TX_END
|
||||
@@ -349,7 +349,7 @@ ProcessTextHeader: ; 2d43 (0:2d43)
|
||||
; hl: wWhichTxRam2 or wWhichTxRam3
|
||||
; return, in hl, the contents of the contents of the
|
||||
; wTxRam* buffer's current entry, and increment wWhichTxRam*.
|
||||
HandleTxRam2Or3: ; 2de0 (0:2de0)
|
||||
HandleTxRam2Or3:
|
||||
push de
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
@@ -365,7 +365,7 @@ HandleTxRam2Or3: ; 2de0 (0:2de0)
|
||||
|
||||
; uses the two byte text id in hl to read the three byte text offset
|
||||
; loads the correct bank for the specific text and returns the pointer in hl
|
||||
GetTextOffsetFromTextID: ; 2ded (0:2ded)
|
||||
GetTextOffsetFromTextID:
|
||||
push de
|
||||
ld e, l
|
||||
ld d, h
|
||||
@@ -399,7 +399,7 @@ GetTextOffsetFromTextID: ; 2ded (0:2ded)
|
||||
; if [wFontWidth] == FULL_WIDTH:
|
||||
; convert the number at hl to TX_SYMBOL text format and write it to wStringBuffer
|
||||
; replace leading zeros with SYM_SPACE
|
||||
TwoByteNumberToText_CountLeadingZeros: ; 2e12 (0:2e12)
|
||||
TwoByteNumberToText_CountLeadingZeros:
|
||||
ld a, [wFontWidth]
|
||||
or a ; FULL_WIDTH
|
||||
jp z, TwoByteNumberToTxSymbol_TrimLeadingZeros
|
||||
@@ -419,7 +419,7 @@ TwoByteNumberToText_CountLeadingZeros: ; 2e12 (0:2e12)
|
||||
|
||||
; in the overworld: copy the player's name to wStringBuffer
|
||||
; in a duel: copy the name of the duelist whose turn it is to wStringBuffer
|
||||
CopyPlayerNameOrTurnDuelistName: ; 2e2c (0:2e2c)
|
||||
CopyPlayerNameOrTurnDuelistName:
|
||||
ld de, wStringBuffer
|
||||
push de
|
||||
ldh a, [hWhoseTurn]
|
||||
@@ -435,7 +435,7 @@ CopyPlayerNameOrTurnDuelistName: ; 2e2c (0:2e2c)
|
||||
|
||||
; prints text with id at hl, with letter delay, in a textbox area.
|
||||
; the text must fit in the textbox; PrintScrollableText should be used instead.
|
||||
PrintText: ; 2e41 (0:2e41)
|
||||
PrintText:
|
||||
ld a, l
|
||||
or h
|
||||
jr z, .from_ram
|
||||
@@ -474,7 +474,7 @@ PrintText: ; 2e41 (0:2e41)
|
||||
|
||||
; prints text with id at hl, without letter delay, in a textbox area.
|
||||
; the text must fit in the textbox; PrintScrollableText should be used instead.
|
||||
PrintTextNoDelay: ; 2e76 (0:2e76)
|
||||
PrintTextNoDelay:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
call GetTextOffsetFromTextID
|
||||
@@ -488,7 +488,7 @@ PrintTextNoDelay: ; 2e76 (0:2e76)
|
||||
|
||||
; copies a text given its id at hl, to de
|
||||
; if hl is 0, the name of the turn duelist is copied instead
|
||||
CopyText: ; 2e89 (0:2e89)
|
||||
CopyText:
|
||||
ld a, l
|
||||
or h
|
||||
jr z, .special
|
||||
@@ -515,7 +515,7 @@ CopyText: ; 2e89 (0:2e89)
|
||||
; then terminate the text with TX_END if it doesn't contain it already.
|
||||
; fill any remaining bytes with spaces plus TX_END to match the length specified in a.
|
||||
; return the text's actual length in characters (i.e. before the first TX_END) in e.
|
||||
CopyTextData_FromTextID: ; 2ea9 (0:2ea9)
|
||||
CopyTextData_FromTextID:
|
||||
ldh [hff96], a
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -527,7 +527,7 @@ CopyTextData_FromTextID: ; 2ea9 (0:2ea9)
|
||||
ret
|
||||
|
||||
; text id (usually of a card name) for TX_RAM2
|
||||
LoadTxRam2: ; 2ebb (0:2ebb)
|
||||
LoadTxRam2:
|
||||
ld a, l
|
||||
ld [wTxRam2], a
|
||||
ld a, h
|
||||
@@ -535,7 +535,7 @@ LoadTxRam2: ; 2ebb (0:2ebb)
|
||||
ret
|
||||
|
||||
; a number between 0 and 65535 for TX_RAM3
|
||||
LoadTxRam3: ; 2ec4 (0:2ec4)
|
||||
LoadTxRam3:
|
||||
ld a, l
|
||||
ld [wTxRam3], a
|
||||
ld a, h
|
||||
|
||||
+15
-15
@@ -1,5 +1,5 @@
|
||||
; serial transfer-related
|
||||
SendPrinterPacket: ; 312d (0:312d)
|
||||
SendPrinterPacket:
|
||||
push hl
|
||||
ld hl, wce64
|
||||
; Preamble
|
||||
@@ -66,12 +66,12 @@ SendPrinterPacket: ; 312d (0:312d)
|
||||
scf
|
||||
ret
|
||||
|
||||
Func_3189: ; 3189 (0:3189)
|
||||
Func_3189:
|
||||
ld hl, PointerTable_3190
|
||||
dec a
|
||||
jp JumpToFunctionInTable
|
||||
|
||||
PointerTable_3190: ; 3190 (0:3190)
|
||||
PointerTable_3190:
|
||||
dw Func_31a8
|
||||
dw Func_31a8
|
||||
dw Func_31a8
|
||||
@@ -85,14 +85,14 @@ PointerTable_3190: ; 3190 (0:3190)
|
||||
dw Func_31ea
|
||||
dw Func_31f2
|
||||
|
||||
Func_31a8: ; 31a8 (0:31a8)
|
||||
Func_31a8:
|
||||
call Func_31fc
|
||||
Func_31ab: ; 31ab (0:31ab)
|
||||
Func_31ab:
|
||||
ld hl, wce63
|
||||
inc [hl]
|
||||
ret
|
||||
|
||||
Func_31b0: ; 31b0 (0:31b0)
|
||||
Func_31b0:
|
||||
call Func_31ab
|
||||
ld hl, wce68
|
||||
ld a, [hli]
|
||||
@@ -111,7 +111,7 @@ Func_31b0: ; 31b0 (0:31b0)
|
||||
ld [de], a
|
||||
; fallthrough
|
||||
|
||||
Func_31ca: ; 31ca (0:31ca)
|
||||
Func_31ca:
|
||||
call Func_31fc
|
||||
ld hl, wce68
|
||||
ld a, [hl]
|
||||
@@ -127,31 +127,31 @@ Func_31ca: ; 31ca (0:31ca)
|
||||
jr z, Func_31ab
|
||||
ret
|
||||
|
||||
Func_31dd: ; 31dd (0:31dd)
|
||||
Func_31dd:
|
||||
ld a, [wce6c]
|
||||
Func_31e0: ; 31e0 (0:31e0)
|
||||
Func_31e0:
|
||||
call Func_3212
|
||||
jr Func_31ab
|
||||
|
||||
Func_31e5: ; 31e5 (0:31e5)
|
||||
Func_31e5:
|
||||
ld a, [wce6d]
|
||||
jr Func_31e0
|
||||
|
||||
Func_31ea: ; 31ea (0:31ea)
|
||||
Func_31ea:
|
||||
ldh a, [rSB]
|
||||
ld [wce6e], a
|
||||
Func_31ef: ; 31ef (0:31ef)
|
||||
Func_31ef:
|
||||
xor a
|
||||
jr Func_31e0
|
||||
|
||||
Func_31f2: ; 31f2 (0:31f2)
|
||||
Func_31f2:
|
||||
ldh a, [rSB]
|
||||
ld [wPrinterStatus], a
|
||||
xor a
|
||||
ld [wce63], a
|
||||
ret
|
||||
|
||||
Func_31fc: ; 31fc (0:31fc)
|
||||
Func_31fc:
|
||||
ld hl, wSerialDataPtr
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
@@ -172,7 +172,7 @@ Func_31fc: ; 31fc (0:31fc)
|
||||
ld a, e
|
||||
; fallthrough
|
||||
|
||||
Func_3212: ; 3212 (0:3212)
|
||||
Func_3212:
|
||||
ldh [rSB], a
|
||||
ld a, SC_INTERNAL
|
||||
ldh [rSC], a
|
||||
|
||||
+26
-26
@@ -1,7 +1,7 @@
|
||||
; similar to ProcessText except it calls InitTextPrinting first
|
||||
; with the first two bytes of hl being used to set hTextBGMap0Address.
|
||||
; (the caller to ProcessText usually calls InitTextPrinting first)
|
||||
InitTextPrinting_ProcessText: ; 21ba (0:21ba)
|
||||
InitTextPrinting_ProcessText:
|
||||
push de
|
||||
push bc
|
||||
ld d, [hl]
|
||||
@@ -13,7 +13,7 @@ InitTextPrinting_ProcessText: ; 21ba (0:21ba)
|
||||
|
||||
; reads the characters from the text at hl processes them. loops until
|
||||
; TX_END is found. ignores TX_RAM1, TX_RAM2, and TX_RAM3 characters.
|
||||
ProcessText: ; 21c5 (0:21c5)
|
||||
ProcessText:
|
||||
push de
|
||||
push bc
|
||||
call InitTextFormat
|
||||
@@ -48,7 +48,7 @@ ProcessText: ; 21c5 (0:21c5)
|
||||
; processes the text character provided in a checking for specific control characters.
|
||||
; hl points to the text character coming right after the one loaded into a.
|
||||
; returns carry if the character was not processed by this function.
|
||||
ProcessSpecialTextCharacter: ; 21f2 (0:21f2)
|
||||
ProcessSpecialTextCharacter:
|
||||
or a ; TX_END
|
||||
jr z, .tx_end
|
||||
cp TX_HIRAGANA
|
||||
@@ -136,7 +136,7 @@ ProcessSpecialTextCharacter: ; 21f2 (0:21f2)
|
||||
; calls InitTextFormat, selects tiles at $8800-$97FF for text, and clears the wc600.
|
||||
; selects the first and last tile to be reserved for constructing text tiles in VRAM
|
||||
; based on the values given in d and e respectively.
|
||||
SetupText: ; 2275 (0:2275)
|
||||
SetupText:
|
||||
ld a, d
|
||||
dec a
|
||||
ld [wcd04], a
|
||||
@@ -162,7 +162,7 @@ SetupText: ; 2275 (0:2275)
|
||||
; hTextLineCurPos <- 0
|
||||
; wHalfWidthPrintState <- 0
|
||||
; hJapaneseSyllabary <- TX_KATAKANA
|
||||
InitTextFormat: ; 2298 (0:2298)
|
||||
InitTextFormat:
|
||||
xor a ; FULL_WIDTH
|
||||
ld [wFontWidth], a
|
||||
ldh [hTextLineCurPos], a
|
||||
@@ -173,7 +173,7 @@ InitTextFormat: ; 2298 (0:2298)
|
||||
|
||||
; call InitTextPrinting
|
||||
; hTextLineLength <- a
|
||||
InitTextPrintingInTextbox: ; 22a6 (0:22a6)
|
||||
InitTextPrintingInTextbox:
|
||||
push af
|
||||
call InitTextPrinting
|
||||
pop af
|
||||
@@ -185,7 +185,7 @@ InitTextPrintingInTextbox: ; 22a6 (0:22a6)
|
||||
; wCurTextLine <- 0
|
||||
; write BGMap0-translated DE to hTextBGMap0Address
|
||||
; call InitTextFormat
|
||||
InitTextPrinting: ; 22ae (0:22ae)
|
||||
InitTextPrinting:
|
||||
push hl
|
||||
ld a, d
|
||||
ldh [hTextHorizontalAlign], a
|
||||
@@ -208,7 +208,7 @@ InitTextPrinting: ; 22ae (0:22ae)
|
||||
; hffb0 == $0: generate and place text tile
|
||||
; hffb0 == $2 (bit 1 set): only generate text tile?
|
||||
; hffb0 == $1 (bit 0 set): not even generate it, but just update text buffers?
|
||||
Func_22ca: ; 22ca (0:22ca)
|
||||
Func_22ca:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -237,7 +237,7 @@ Func_22ca: ; 22ca (0:22ca)
|
||||
|
||||
; writes a to wCurTextTile and to the tile pointed to by hTextBGMap0Address,
|
||||
; then increments hTextBGMap0Address and hTextLineCurPos
|
||||
PlaceNextTextTile: ; 22f2 (0:22f2)
|
||||
PlaceNextTextTile:
|
||||
ld [wCurTextTile], a
|
||||
ld hl, hTextBGMap0Address
|
||||
ld e, [hl]
|
||||
@@ -260,7 +260,7 @@ PlaceNextTextTile: ; 22f2 (0:22f2)
|
||||
; when terminating half-width text with "\n" or TX_END, or switching to full-width
|
||||
; with TX_HALF2FULL or to symbols with TX_SYMBOL, check if it's necessary to append
|
||||
; a half-width space to finish an incomplete character pair.
|
||||
TerminateHalfWidthText: ; 230f (0:230f)
|
||||
TerminateHalfWidthText:
|
||||
ld a, [wFontWidth]
|
||||
or a ; FULL_WIDTH
|
||||
ret z
|
||||
@@ -277,7 +277,7 @@ TerminateHalfWidthText: ; 230f (0:230f)
|
||||
pop hl
|
||||
ret
|
||||
|
||||
Func_2325: ; 2325 (0:2325)
|
||||
Func_2325:
|
||||
call Func_235e
|
||||
ret c
|
||||
or a
|
||||
@@ -324,7 +324,7 @@ Func_2325: ; 2325 (0:2325)
|
||||
|
||||
; search linked-list for text characters e/d (registers), if found hoist
|
||||
; the result to head of list and return it. carry flag denotes success.
|
||||
Func_235e: ; 235e (0:235e)
|
||||
Func_235e:
|
||||
ld a, [wFontWidth]
|
||||
or a
|
||||
jr z, .print
|
||||
@@ -391,7 +391,7 @@ Func_235e: ; 235e (0:235e)
|
||||
ret ; (return new linked-list head in a)
|
||||
|
||||
; uppercases e if [wUppercaseHalfWidthLetters] is nonzero
|
||||
CaseHalfWidthLetter: ; 23b1 (0:23b1)
|
||||
CaseHalfWidthLetter:
|
||||
ld a, [wUppercaseHalfWidthLetters]
|
||||
or a
|
||||
ret z
|
||||
@@ -410,7 +410,7 @@ CaseHalfWidthLetter: ; 23b1 (0:23b1)
|
||||
; b = length of text in tiles
|
||||
; c = length of text in bytes
|
||||
; a = -b
|
||||
GetTextLengthInTiles: ; 23c1 (0:23c1)
|
||||
GetTextLengthInTiles:
|
||||
ld a, [hl]
|
||||
cp TX_HALFWIDTH
|
||||
jr nz, .full_width
|
||||
@@ -431,7 +431,7 @@ GetTextLengthInTiles: ; 23c1 (0:23c1)
|
||||
; b = length of text in half-tiles
|
||||
; c = length of text in bytes
|
||||
; a = -b
|
||||
GetTextLengthInHalfTiles: ; 23d3 (0:23d3)
|
||||
GetTextLengthInHalfTiles:
|
||||
push hl
|
||||
push de
|
||||
lb bc, $00, $00
|
||||
@@ -472,7 +472,7 @@ GetTextLengthInHalfTiles: ; 23d3 (0:23d3)
|
||||
; the text with TX_END if it doesn't contain it already.
|
||||
; fill any remaining bytes with spaces plus TX_END to match the length specified in a.
|
||||
; return the text's actual length in characters (i.e. before the first TX_END) in e.
|
||||
CopyTextData: ; 23fd (0:23fd)
|
||||
CopyTextData:
|
||||
ld [wTextMaxLength], a
|
||||
ld a, [hl]
|
||||
cp TX_HALFWIDTH
|
||||
@@ -552,7 +552,7 @@ CopyTextData: ; 23fd (0:23fd)
|
||||
|
||||
; convert the number at hl to TX_SYMBOL text format and write it to wStringBuffer
|
||||
; replace leading zeros with SYM_SPACE
|
||||
TwoByteNumberToTxSymbol_TrimLeadingZeros: ; 245d (0:245d)
|
||||
TwoByteNumberToTxSymbol_TrimLeadingZeros:
|
||||
push de
|
||||
push bc
|
||||
ld de, wStringBuffer
|
||||
@@ -614,7 +614,7 @@ TwoByteNumberToTxSymbol_TrimLeadingZeros: ; 245d (0:245d)
|
||||
; d = half-width character 1 (left)
|
||||
; e = half-width character 2 (right)
|
||||
; b = destination VRAM tile number
|
||||
GenerateTextTile: ; 24ac (0:24ac)
|
||||
GenerateTextTile:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -637,7 +637,7 @@ GenerateTextTile: ; 24ac (0:24ac)
|
||||
|
||||
; create, at wTextTileBuffer, a half-width font tile
|
||||
; made from the ascii characters given in d and e
|
||||
CreateHalfWidthFontTile: ; 24ca (0:24ca)
|
||||
CreateHalfWidthFontTile:
|
||||
push bc
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
@@ -673,7 +673,7 @@ CreateHalfWidthFontTile: ; 24ca (0:24ca)
|
||||
; copies a 1bpp tile corresponding to a half-width font character to de.
|
||||
; the ascii value of the character to copy is provided in a.
|
||||
; assumes BANK(HalfWidthFont) is already loaded.
|
||||
CopyHalfWidthCharacterToDE: ; 24fa (0:24fa)
|
||||
CopyHalfWidthCharacterToDE:
|
||||
sub $20 ; HalfWidthFont begins at ascii $20
|
||||
ld l, a
|
||||
ld h, $0
|
||||
@@ -695,7 +695,7 @@ CopyHalfWidthCharacterToDE: ; 24fa (0:24fa)
|
||||
; create, at wTextTileBuffer, a full-width font tile given its tile
|
||||
; number within the full-width font graphics (FullWidthFonts) in de.
|
||||
; return its v*Tiles address in hl, and return c = TILE_SIZE.
|
||||
CreateFullWidthFontTile_ConvertToTileDataAddress: ; 2510 (0:2510)
|
||||
CreateFullWidthFontTile_ConvertToTileDataAddress:
|
||||
push bc
|
||||
call GetFullWidthFontTileOffset
|
||||
call CreateFullWidthFontTile
|
||||
@@ -706,7 +706,7 @@ CreateFullWidthFontTile_ConvertToTileDataAddress: ; 2510 (0:2510)
|
||||
; wTilePatternSelector and wTilePatternSelectorCorrection are used to select the source:
|
||||
; - if wTilePatternSelector == $80 and wTilePatternSelectorCorrection == $00 -> $8000-$8FFF
|
||||
; - if wTilePatternSelector == $88 and wTilePatternSelectorCorrection == $80 -> $8800-$97FF
|
||||
ConvertTileNumberToTileDataAddress: ; 2518 (0:2518)
|
||||
ConvertTileNumberToTileDataAddress:
|
||||
ld hl, wTilePatternSelectorCorrection
|
||||
ld a, b
|
||||
xor [hl]
|
||||
@@ -725,7 +725,7 @@ ConvertTileNumberToTileDataAddress: ; 2518 (0:2518)
|
||||
|
||||
; create, at wTextTileBuffer, a full-width font tile given its
|
||||
; within the full-width font graphics (FullWidthFonts) in hl
|
||||
CreateFullWidthFontTile: ; 252e (0:252e)
|
||||
CreateFullWidthFontTile:
|
||||
ld a, BANK(Fonts) ; BANK(DuelGraphics)
|
||||
call BankpushROM
|
||||
ld de, wTextTileBuffer
|
||||
@@ -746,7 +746,7 @@ CreateFullWidthFontTile: ; 252e (0:252e)
|
||||
; given two text characters at de, use the char at e (first one)
|
||||
; to determine which type of text this pair of characters belongs to.
|
||||
; return carry if TX_FULLWIDTH1 to TX_FULLWIDTH4.
|
||||
ClassifyTextCharacterPair: ; 2546 (0:2546)
|
||||
ClassifyTextCharacterPair:
|
||||
ld a, [wFontWidth]
|
||||
or a ; FULL_WIDTH
|
||||
jr nz, .half_width
|
||||
@@ -786,7 +786,7 @@ ClassifyTextCharacterPair: ; 2546 (0:2546)
|
||||
; if d == TX_KATAKANA: get tile from the 0_0_katakana.1bpp font.
|
||||
; if d == TX_HIRAGANA or d == $0: get tile from the 0_1_hiragana.1bpp or 0_2_digits_kanji1.1bpp font.
|
||||
; if d >= TX_FULLWIDTH1 and d <= TX_FULLWIDTH4: get tile from one of the other full-width fonts.
|
||||
GetFullWidthFontTileOffset: ; 256d (0:256d)
|
||||
GetFullWidthFontTileOffset:
|
||||
ld bc, $50 tiles_1bpp
|
||||
ld a, d
|
||||
cp TX_HIRAGANA
|
||||
@@ -810,7 +810,7 @@ GetFullWidthFontTileOffset: ; 256d (0:256d)
|
||||
|
||||
; pointers to VRAM?
|
||||
; unreferenced
|
||||
Unknown_2589: ; 2589 (0:2589)
|
||||
Unknown_2589:
|
||||
db $18
|
||||
dw $8140
|
||||
dw $817e
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
; returns h * l in hl
|
||||
HtimesL: ; 0879 (0:0879)
|
||||
HtimesL:
|
||||
push de
|
||||
ld a, h
|
||||
ld e, l
|
||||
@@ -20,7 +20,7 @@ HtimesL: ; 0879 (0:0879)
|
||||
ret
|
||||
|
||||
; return a random number between 0 and a (exclusive) in a
|
||||
Random: ; 088f (0:088f)
|
||||
Random:
|
||||
push hl
|
||||
ld h, a
|
||||
call UpdateRNGSources
|
||||
@@ -31,7 +31,7 @@ Random: ; 088f (0:088f)
|
||||
ret
|
||||
|
||||
; get the next random numbers of the wRNG1 and wRNG2 sequences
|
||||
UpdateRNGSources: ; 089b (0:089b)
|
||||
UpdateRNGSources:
|
||||
push hl
|
||||
push de
|
||||
ld hl, wRNG1
|
||||
|
||||
+5
-5
@@ -1,22 +1,22 @@
|
||||
SaveGeneralSaveData: ; 3a3b (0:3a3b)
|
||||
SaveGeneralSaveData:
|
||||
farcall _SaveGeneralSaveData
|
||||
ret
|
||||
|
||||
LoadGeneralSaveData: ; 3a40 (0:3a40)
|
||||
LoadGeneralSaveData:
|
||||
farcall _LoadGeneralSaveData
|
||||
ret
|
||||
|
||||
ValidateGeneralSaveData: ; 3a45 (0:3a45)
|
||||
ValidateGeneralSaveData:
|
||||
farcall _ValidateGeneralSaveData
|
||||
ret
|
||||
|
||||
; adds card with card ID in register a to collection
|
||||
; and updates album progress in RAM
|
||||
AddCardToCollectionAndUpdateAlbumProgress: ; 3a4a (0:3a4a)
|
||||
AddCardToCollectionAndUpdateAlbumProgress:
|
||||
farcall _AddCardToCollectionAndUpdateAlbumProgress
|
||||
ret
|
||||
|
||||
SaveGame: ; 3a4f (0:3a4f)
|
||||
SaveGame:
|
||||
push af
|
||||
push bc
|
||||
push de
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
HandleMoveModeAPress: ; 3a5e (0:3a5e)
|
||||
HandleMoveModeAPress:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld l, MAP_SCRIPT_OBJECTS
|
||||
@@ -59,7 +59,7 @@ HandleMoveModeAPress: ; 3a5e (0:3a5e)
|
||||
; returns a map script pointer in hl given
|
||||
; current map in wCurMap and which sub-script in l
|
||||
; sets c if pointer is found
|
||||
GetMapScriptPointer: ; 3abd (0:3abd)
|
||||
GetMapScriptPointer:
|
||||
push bc
|
||||
push hl
|
||||
ld a, [wCurMap]
|
||||
@@ -100,12 +100,12 @@ GetMapScriptPointer: ; 3abd (0:3abd)
|
||||
; are stored in the script-related NPC data for normal gameplay
|
||||
; returns carry if a duel configuration was found
|
||||
; for the given NPC deck ID
|
||||
GetNPCDuelConfigurations: ; 3ae8 (0:3ae8)
|
||||
GetNPCDuelConfigurations:
|
||||
farcall _GetNPCDuelConfigurations
|
||||
ret
|
||||
|
||||
; finds a Script from the first byte and puts the next two bytes (usually arguments?) into cb
|
||||
RunOverworldScript: ; 3aed (0:3aed)
|
||||
RunOverworldScript:
|
||||
ld hl, wScriptPointer
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
@@ -132,7 +132,7 @@ RunOverworldScript: ; 3aed (0:3aed)
|
||||
pop bc
|
||||
jp hl
|
||||
|
||||
Func_3b11: ; 3b11 (0:3b11)
|
||||
Func_3b11:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(_GameLoop)
|
||||
@@ -142,7 +142,7 @@ Func_3b11: ; 3b11 (0:3b11)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
Func_3b21: ; 3b21 (0:3b21)
|
||||
Func_3b21:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(Func_1c8bc)
|
||||
@@ -152,7 +152,7 @@ Func_3b21: ; 3b21 (0:3b21)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
Func_3b31: ; 3b31 (0:3b31)
|
||||
Func_3b31:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
ld a, BANK(Func_1cb18)
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
; something window scroll
|
||||
Func_3e44: ; 3e44 (0:3e44)
|
||||
Func_3e44:
|
||||
push af
|
||||
push hl
|
||||
push bc
|
||||
@@ -57,7 +57,7 @@ Func_3e44: ; 3e44 (0:3e44)
|
||||
|
||||
; apply background scroll for lines 0 to 96 using the values at BGScrollData
|
||||
; skip if wApplyBGScroll is non-0
|
||||
ApplyBackgroundScroll: ; 3ea6 (0:3ea6)
|
||||
ApplyBackgroundScroll:
|
||||
push af
|
||||
push hl
|
||||
call DisableInt_LYCoincidence
|
||||
@@ -109,7 +109,7 @@ ApplyBackgroundScroll: ; 3ea6 (0:3ea6)
|
||||
pop af
|
||||
ret
|
||||
|
||||
BGScrollData: ; 3ef8 (0:3ef8)
|
||||
BGScrollData:
|
||||
db 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3
|
||||
db 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0
|
||||
db 0, -1, -1, -1, -2, -2, -2, -3, -3, -3, -4, -4, -4, -4, -4, -4
|
||||
@@ -118,7 +118,7 @@ BGScrollData: ; 3ef8 (0:3ef8)
|
||||
|
||||
; x = BGScrollData[(wVBlankCounter + a) & $3f]
|
||||
; return, in register a, x rotated right [wBGScrollMod]-1 times (max 3 times)
|
||||
GetNextBackgroundScroll: ; 3f38 (0:3f38)
|
||||
GetNextBackgroundScroll:
|
||||
ld hl, wVBlankCounter
|
||||
add [hl]
|
||||
and $3f
|
||||
@@ -145,7 +145,7 @@ GetNextBackgroundScroll: ; 3f38 (0:3f38)
|
||||
ret
|
||||
|
||||
; enable lcdc interrupt on LYC=LC coincidence
|
||||
EnableInt_LYCoincidence: ; 3f5a (0:3f5a)
|
||||
EnableInt_LYCoincidence:
|
||||
push hl
|
||||
ld hl, rSTAT
|
||||
set STAT_LYC, [hl]
|
||||
@@ -156,7 +156,7 @@ EnableInt_LYCoincidence: ; 3f5a (0:3f5a)
|
||||
ret
|
||||
|
||||
; disable lcdc interrupt and the LYC=LC coincidence trigger
|
||||
DisableInt_LYCoincidence: ; 3f68 (0:3f68)
|
||||
DisableInt_LYCoincidence:
|
||||
push hl
|
||||
ld hl, rSTAT
|
||||
res STAT_LYC, [hl]
|
||||
|
||||
+23
-23
@@ -1,5 +1,5 @@
|
||||
; called at roughly 240Hz by TimerHandler
|
||||
SerialTimerHandler: ; 0c91 (0:0c91)
|
||||
SerialTimerHandler:
|
||||
ld a, [wSerialOp]
|
||||
cp $29
|
||||
jr z, .begin_transfer
|
||||
@@ -35,7 +35,7 @@ SerialTimerHandler: ; 0c91 (0:0c91)
|
||||
ld [hl], $0
|
||||
ret
|
||||
|
||||
Func_0cc5: ; 0cc5 (0:0cc5)
|
||||
Func_0cc5:
|
||||
ld hl, wSerialRecvCounter
|
||||
or a
|
||||
jr nz, .asm_cdc
|
||||
@@ -94,7 +94,7 @@ Func_0cc5: ; 0cc5 (0:0cc5)
|
||||
scf
|
||||
ret
|
||||
|
||||
SerialHandler: ; 0d26 (0:0d26)
|
||||
SerialHandler:
|
||||
push af
|
||||
push hl
|
||||
push de
|
||||
@@ -148,7 +148,7 @@ SerialHandler: ; 0d26 (0:0d26)
|
||||
|
||||
; handles a byte read from serial transfer by decoding it and storing it into
|
||||
; the receive buffer
|
||||
SerialHandleRecv: ; 0d77 (0:0d77)
|
||||
SerialHandleRecv:
|
||||
ld hl, wSerialLastReadCA
|
||||
ld e, [hl]
|
||||
dec e
|
||||
@@ -210,7 +210,7 @@ SerialHandleRecv: ; 0d77 (0:0d77)
|
||||
|
||||
; prepares a byte to send over serial transfer, either from the send-save byte
|
||||
; slot or the send buffer
|
||||
SerialHandleSend: ; 0dc8 (0:0dc8)
|
||||
SerialHandleSend:
|
||||
ld hl, wSerialSendSave
|
||||
ld a, [hl]
|
||||
or a
|
||||
@@ -260,7 +260,7 @@ SerialHandleSend: ; 0dc8 (0:0dc8)
|
||||
ret
|
||||
|
||||
; store byte at a in wSerialSendBuf for sending
|
||||
SerialSendByte: ; 0e0a (0:0e0a)
|
||||
SerialSendByte:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -290,7 +290,7 @@ SerialSendByte: ; 0e0a (0:0e0a)
|
||||
ret
|
||||
|
||||
; sets carry if [wSerialRecvCounter] nonzero
|
||||
Func_0e32: ; 0e32 (0:0e32)
|
||||
Func_0e32:
|
||||
ld a, [wSerialRecvCounter]
|
||||
or a
|
||||
ret z
|
||||
@@ -298,7 +298,7 @@ Func_0e32: ; 0e32 (0:0e32)
|
||||
ret
|
||||
|
||||
; receive byte in wSerialRecvBuf
|
||||
SerialRecvByte: ; 0e39 (0:0e39)
|
||||
SerialRecvByte:
|
||||
push hl
|
||||
ld hl, wSerialRecvCounter
|
||||
ld a, [hl]
|
||||
@@ -331,7 +331,7 @@ SerialRecvByte: ; 0e39 (0:0e39)
|
||||
ret
|
||||
|
||||
; exchange c bytes. send bytes at hl and store received bytes in de
|
||||
SerialExchangeBytes: ; 0e63 (0:0e63)
|
||||
SerialExchangeBytes:
|
||||
ld b, c
|
||||
.asm_e64
|
||||
ld a, b
|
||||
@@ -368,7 +368,7 @@ SerialExchangeBytes: ; 0e63 (0:0e63)
|
||||
ret
|
||||
|
||||
; go into slave mode (external clock) for serial transfer?
|
||||
Func_0e8e: ; 0e8e (0:0e8e)
|
||||
Func_0e8e:
|
||||
call ClearSerialData
|
||||
ld a, $12
|
||||
ldh [rSB], a ; send $12
|
||||
@@ -383,7 +383,7 @@ Func_0e8e: ; 0e8e (0:0e8e)
|
||||
ret
|
||||
|
||||
; disable serial interrupt, and clear rSB, rSC, and serial registers in WRAM
|
||||
ResetSerial: ; 0ea6 (0:0ea6)
|
||||
ResetSerial:
|
||||
ldh a, [rIE]
|
||||
and ~(1 << INT_SERIAL)
|
||||
ldh [rIE], a
|
||||
@@ -393,7 +393,7 @@ ResetSerial: ; 0ea6 (0:0ea6)
|
||||
; fallthrough
|
||||
|
||||
; zero serial registers in WRAM
|
||||
ClearSerialData: ; 0eb1 (0:0eb1)
|
||||
ClearSerialData:
|
||||
ld hl, wSerialOp
|
||||
ld bc, wSerialEnd - wSerialOp
|
||||
.loop
|
||||
@@ -406,7 +406,7 @@ ClearSerialData: ; 0eb1 (0:0eb1)
|
||||
ret
|
||||
|
||||
; store bc bytes from hl in wSerialSendBuf for sending
|
||||
SerialSendBytes: ; 0ebf (0:0ebf)
|
||||
SerialSendBytes:
|
||||
push bc
|
||||
.send_loop
|
||||
ld a, [hli]
|
||||
@@ -427,7 +427,7 @@ SerialSendBytes: ; 0ebf (0:0ebf)
|
||||
ret
|
||||
|
||||
; receive bc bytes in wSerialRecvBuf and save them to hl
|
||||
SerialRecvBytes: ; 0ed5 (0:0ed5)
|
||||
SerialRecvBytes:
|
||||
push bc
|
||||
.recv_loop
|
||||
call SerialRecvByte
|
||||
@@ -452,7 +452,7 @@ SerialRecvBytes: ; 0ed5 (0:0ed5)
|
||||
scf
|
||||
ret
|
||||
|
||||
Func_0ef1: ; 0ef1 (0:0ef1)
|
||||
Func_0ef1:
|
||||
ld de, wcb79
|
||||
ld hl, sp+$fe
|
||||
ld a, l
|
||||
@@ -471,7 +471,7 @@ Func_0ef1: ; 0ef1 (0:0ef1)
|
||||
or a
|
||||
ret
|
||||
|
||||
Func_0f05: ; 0f05 (0:0f05)
|
||||
Func_0f05:
|
||||
push hl
|
||||
ld hl, wcb7b
|
||||
ld a, [hli]
|
||||
@@ -491,7 +491,7 @@ Func_0f05: ; 0f05 (0:0f05)
|
||||
scf
|
||||
ret
|
||||
|
||||
Func_0f1d: ; 0f1d (0:0f1d)
|
||||
Func_0f1d:
|
||||
ld a, [wSerialFlags]
|
||||
or a
|
||||
jr nz, .asm_f27
|
||||
@@ -510,7 +510,7 @@ Func_0f1d: ; 0f1d (0:0f1d)
|
||||
|
||||
; load the number at wSerialFlags (error code?) to TxRam3, print
|
||||
; TransmissionErrorText, exit the duel, and reset serial registers.
|
||||
DuelTransmissionError: ; 0f35 (0:0f35)
|
||||
DuelTransmissionError:
|
||||
ld a, [wSerialFlags]
|
||||
ld l, a
|
||||
ld h, 0
|
||||
@@ -530,7 +530,7 @@ DuelTransmissionError: ; 0f35 (0:0f35)
|
||||
ret
|
||||
|
||||
; exchange RNG during a link duel between both games
|
||||
ExchangeRNG: ; 0f58 (0:0f58)
|
||||
ExchangeRNG:
|
||||
ld a, [wDuelType]
|
||||
cp DUELTYPE_LINK
|
||||
jr z, .link_duel
|
||||
@@ -559,7 +559,7 @@ ExchangeRNG: ; 0f58 (0:0f58)
|
||||
; finally exchange RNG data.
|
||||
; the receiving side will use this data to read the OPPACTION_* value in
|
||||
; [hOppActionTableIndex] and match it by calling the corresponding OppAction* function
|
||||
SetOppAction_SerialSendDuelData: ; 0f7f (0:0f7f)
|
||||
SetOppAction_SerialSendDuelData:
|
||||
push hl
|
||||
push bc
|
||||
ldh [hOppActionTableIndex], a
|
||||
@@ -579,7 +579,7 @@ SetOppAction_SerialSendDuelData: ; 0f7f (0:0f7f)
|
||||
; receive 10 bytes of data from wSerialRecvBuf and store them into hOppActionTableIndex,
|
||||
; hTempCardIndex_ff9f, hTemp_ffa0, and hTempPlayAreaLocation_ffa1,
|
||||
; and hTempRetreatCostCards. also exchange RNG data.
|
||||
SerialRecvDuelData: ; 0f9b (0:0f9b)
|
||||
SerialRecvDuelData:
|
||||
push hl
|
||||
push bc
|
||||
ld hl, hOppActionTableIndex
|
||||
@@ -592,7 +592,7 @@ SerialRecvDuelData: ; 0f9b (0:0f9b)
|
||||
|
||||
; serial send 8 bytes at f, a, l, h, e, d, c, b
|
||||
; only during a duel against a link opponent
|
||||
SerialSend8Bytes: ; 0fac (0:0fac)
|
||||
SerialSend8Bytes:
|
||||
push hl
|
||||
push af
|
||||
ld a, DUELVARS_DUELIST_TYPE
|
||||
@@ -643,7 +643,7 @@ SerialSend8Bytes: ; 0fac (0:0fac)
|
||||
ret
|
||||
|
||||
; serial recv 8 bytes to f, a, l, h, e, d, c, b
|
||||
SerialRecv8Bytes: ; 0fe9 (0:0fe9)
|
||||
SerialRecv8Bytes:
|
||||
ld hl, wTempSerialBuf
|
||||
ld bc, 8
|
||||
push hl
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
; initialize scroll, window, and lcdc registers, set trampoline functions
|
||||
; for the lcdc and vblank interrupts, latch clock data, and enable SRAM/RTC
|
||||
SetupRegisters: ; 030b (0:030b)
|
||||
SetupRegisters:
|
||||
xor a
|
||||
ldh [rSCY], a
|
||||
ldh [rSCX], a
|
||||
@@ -28,11 +28,11 @@ SetupRegisters: ; 030b (0:030b)
|
||||
ld [MBC3LatchClock], a
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC3SRamEnable], a
|
||||
NoOp: ; 0348 (0:0348)
|
||||
NoOp:
|
||||
ret
|
||||
|
||||
; sets wConsole and, if CGB, selects WRAM bank 1 and switches to double speed mode
|
||||
DetectConsole: ; 0349 (0:0349)
|
||||
DetectConsole:
|
||||
ld b, CONSOLE_CGB
|
||||
cp GBC
|
||||
jr z, .got_console
|
||||
@@ -52,7 +52,7 @@ DetectConsole: ; 0349 (0:0349)
|
||||
ret
|
||||
|
||||
; initialize the palettes (both monochrome and color)
|
||||
SetupPalettes: ; 036a (0:036a)
|
||||
SetupPalettes:
|
||||
ld hl, wBGP
|
||||
ld a, %11100100
|
||||
ldh [rBGP], a
|
||||
@@ -82,14 +82,14 @@ SetupPalettes: ; 036a (0:036a)
|
||||
call FlushAllCGBPalettes
|
||||
ret
|
||||
|
||||
InitialPalette: ; 0399 (0:0399)
|
||||
InitialPalette:
|
||||
rgb 28, 28, 24
|
||||
rgb 21, 21, 16
|
||||
rgb 10, 10, 08
|
||||
rgb 00, 00, 00
|
||||
|
||||
; clear VRAM tile data ([wTileMapFill] should be an empty tile)
|
||||
SetupVRAM: ; 03a1 (0:03a1)
|
||||
SetupVRAM:
|
||||
call FillTileMap
|
||||
call CheckForCGB
|
||||
jr c, .vram0
|
||||
@@ -109,7 +109,7 @@ SetupVRAM: ; 03a1 (0:03a1)
|
||||
ret
|
||||
|
||||
; fill VRAM0 BG map 0 with [wTileMapFill] and VRAM1 BG map 0 with $00
|
||||
FillTileMap: ; 03c0 (0:03c0)
|
||||
FillTileMap:
|
||||
call BankswitchVRAM0
|
||||
ld hl, v0BGMap0
|
||||
ld bc, v0BGMap1 - v0BGMap0
|
||||
@@ -137,7 +137,7 @@ FillTileMap: ; 03c0 (0:03c0)
|
||||
ret
|
||||
|
||||
; zero work RAM, stack area, and high RAM ($C000-$DFFF, $FF80-$FFEF)
|
||||
ZeroRAM: ; 03ec (0:03ec)
|
||||
ZeroRAM:
|
||||
ld hl, $c000
|
||||
ld bc, $e000 - $c000
|
||||
.zero_wram_loop
|
||||
|
||||
+20
-20
@@ -1,5 +1,5 @@
|
||||
; setup SNES memory $810-$867 and palette
|
||||
InitSGB: ; 0a0d (0:0a0d)
|
||||
InitSGB:
|
||||
ld hl, MaskEnPacket_Freeze
|
||||
call SendSGB
|
||||
ld hl, DataSndPacket1
|
||||
@@ -24,65 +24,65 @@ InitSGB: ; 0a0d (0:0a0d)
|
||||
call SendSGB
|
||||
ret
|
||||
|
||||
DataSndPacket1: ; 0a50 (0:0a50)
|
||||
DataSndPacket1:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $085d, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00 ; data bytes
|
||||
|
||||
DataSndPacket2: ; 0a60 (0:0a60)
|
||||
DataSndPacket2:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $0852, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0 ; data bytes
|
||||
|
||||
DataSndPacket3: ; 0a70 (0:0a70)
|
||||
DataSndPacket3:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $0847, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28 ; data bytes
|
||||
|
||||
DataSndPacket4: ; 0a80 (0:0a80)
|
||||
DataSndPacket4:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $083c, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9 ; data bytes
|
||||
|
||||
DataSndPacket5: ; 0a90 (0:0a90)
|
||||
DataSndPacket5:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $0831, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e ; data bytes
|
||||
|
||||
DataSndPacket6: ; 0aa0 (0:0aa0)
|
||||
DataSndPacket6:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $0826, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0 ; data bytes
|
||||
|
||||
DataSndPacket7: ; 0ab0 (0:0ab0)
|
||||
DataSndPacket7:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $081b, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0 ; data bytes
|
||||
|
||||
DataSndPacket8: ; 0ac0 (0:0ac0)
|
||||
DataSndPacket8:
|
||||
sgb DATA_SND, 1 ; sgb_command, length
|
||||
dwb $0810, $00 ; destination address, bank
|
||||
db $0b ; number of bytes to write
|
||||
db $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea ; data bytes
|
||||
|
||||
MaskEnPacket_Freeze: ; 0ad0 (0:0ad0)
|
||||
MaskEnPacket_Freeze:
|
||||
sgb MASK_EN, 1 ; sgb_command, length
|
||||
db MASK_EN_FREEZE_SCREEN
|
||||
ds $0e
|
||||
|
||||
MaskEnPacket_Cancel: ; 0ae0 (0:0ae0)
|
||||
MaskEnPacket_Cancel:
|
||||
sgb MASK_EN, 1 ; sgb_command, length
|
||||
db MASK_EN_CANCEL_MASK
|
||||
ds $0e
|
||||
|
||||
Pal01Packet_InitSGB: ; 0af0 (0:0af0)
|
||||
Pal01Packet_InitSGB:
|
||||
sgb PAL01, 1 ; sgb_command, length
|
||||
rgb 28, 28, 24
|
||||
rgb 20, 20, 16
|
||||
@@ -93,7 +93,7 @@ Pal01Packet_InitSGB: ; 0af0 (0:0af0)
|
||||
rgb 7, 0, 0
|
||||
db $00
|
||||
|
||||
Pal23Packet_0b00: ; 0b00 (0:0b00)
|
||||
Pal23Packet_0b00:
|
||||
sgb PAL23, 1 ; sgb_command, length
|
||||
rgb 0, 31, 0
|
||||
rgb 0, 15, 0
|
||||
@@ -104,7 +104,7 @@ Pal23Packet_0b00: ; 0b00 (0:0b00)
|
||||
rgb 0, 0, 7
|
||||
db $00
|
||||
|
||||
AttrBlkPacket_0b10: ; 0b10 (0:0b10)
|
||||
AttrBlkPacket_0b10:
|
||||
sgb ATTR_BLK, 1 ; sgb_command, length
|
||||
db 1 ; number of data sets
|
||||
; Control Code, Color Palette Designation, X1, Y1, X2, Y2
|
||||
@@ -113,7 +113,7 @@ AttrBlkPacket_0b10: ; 0b10 (0:0b10)
|
||||
ds 2 ; data set 3
|
||||
|
||||
; send SGB packet at hl (or packets, if length > 1)
|
||||
SendSGB: ; 0b20 (0:0b20)
|
||||
SendSGB:
|
||||
ld a, [hl]
|
||||
and $7
|
||||
ret z ; return if packet length is 0
|
||||
@@ -157,7 +157,7 @@ SendSGB: ; 0b20 (0:0b20)
|
||||
|
||||
; SGB hardware detection
|
||||
; return carry if SGB detected and disable multi-controller mode before returning
|
||||
DetectSGB: ; 0b59 (0:0b59)
|
||||
DetectSGB:
|
||||
ld bc, 60
|
||||
call Wait
|
||||
ld hl, MltReq2Packet
|
||||
@@ -199,12 +199,12 @@ DetectSGB: ; 0b59 (0:0b59)
|
||||
scf
|
||||
ret
|
||||
|
||||
MltReq1Packet: ; 0bab (0:0bab)
|
||||
MltReq1Packet:
|
||||
sgb MLT_REQ, 1 ; sgb_command, length
|
||||
db MLT_REQ_1_PLAYER
|
||||
ds $0e
|
||||
|
||||
MltReq2Packet: ; 0bbb (0:0bbb)
|
||||
MltReq2Packet:
|
||||
sgb MLT_REQ, 1 ; sgb_command, length
|
||||
db MLT_REQ_2_PLAYERS
|
||||
ds $0e
|
||||
@@ -212,7 +212,7 @@ MltReq2Packet: ; 0bbb (0:0bbb)
|
||||
; fill v*Tiles1 and v*Tiles2 with data at hl
|
||||
; write $0d sequences of $80,$81,$82,...,$94 separated each by $0c bytes to v*BGMap0
|
||||
; send the SGB packet at de
|
||||
Func_0bcb: ; 0bcb (0:0bcb)
|
||||
Func_0bcb:
|
||||
di
|
||||
push de
|
||||
.wait_vblank
|
||||
@@ -255,7 +255,7 @@ Func_0bcb: ; 0bcb (0:0bcb)
|
||||
ret
|
||||
|
||||
; loops 63000 * bc cycles (~15 * bc ms)
|
||||
Wait: ; 0c08 (0:0c08)
|
||||
Wait:
|
||||
ld de, 1750
|
||||
.loop
|
||||
nop
|
||||
|
||||
+11
-11
@@ -1,38 +1,38 @@
|
||||
SetupSound: ; 377f (0:377f)
|
||||
SetupSound:
|
||||
farcall _SetupSound
|
||||
ret
|
||||
|
||||
StopMusic: ; 3784 (0:3784)
|
||||
StopMusic:
|
||||
xor a ; MUSIC_STOP
|
||||
PlaySong: ; 3785 (0:3785)
|
||||
PlaySong:
|
||||
farcall _PlaySong
|
||||
ret
|
||||
|
||||
; return a = 0: song finished, a = 1: song not finished
|
||||
AssertSongFinished: ; 378a (0:378a)
|
||||
AssertSongFinished:
|
||||
farcall _AssertSongFinished
|
||||
ret
|
||||
|
||||
; return a = 0: SFX finished, a = 1: SFX not finished
|
||||
AssertSFXFinished: ; 378f (0:378f)
|
||||
AssertSFXFinished:
|
||||
farcall _AssertSFXFinished
|
||||
ret
|
||||
|
||||
Func_3794: ; 3794 (0:3794)
|
||||
Func_3794:
|
||||
ld a, $04
|
||||
PlaySFX: ; 3796 (0:3796)
|
||||
PlaySFX:
|
||||
farcall _PlaySFX
|
||||
ret
|
||||
|
||||
PauseSong: ; 379b (0:379b)
|
||||
PauseSong:
|
||||
farcall _PauseSong
|
||||
ret
|
||||
|
||||
ResumeSong: ; 37a0 (0:37a0)
|
||||
ResumeSong:
|
||||
farcall _ResumeSong
|
||||
ret
|
||||
|
||||
Func_37a5: ; 37a5 (0:37a5)
|
||||
Func_37a5:
|
||||
ldh a, [hBankROM]
|
||||
push af
|
||||
push hl
|
||||
@@ -53,7 +53,7 @@ Func_37a5: ; 37a5 (0:37a5)
|
||||
call BankswitchROM
|
||||
ret
|
||||
|
||||
Func_37c5: ; 37c5 (0:37c5)
|
||||
Func_37c5:
|
||||
ld c, $08
|
||||
.asm_37c7
|
||||
ld b, $06
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
; switch SRAM bank to a
|
||||
BankswitchSRAM: ; 07a9 (0:07a9)
|
||||
BankswitchSRAM:
|
||||
push af
|
||||
ldh [hBankSRAM], a
|
||||
ld [MBC3SRamBank], a
|
||||
@@ -9,7 +9,7 @@ BankswitchSRAM: ; 07a9 (0:07a9)
|
||||
ret
|
||||
|
||||
; enable external RAM (SRAM)
|
||||
EnableSRAM: ; 07b6 (0:07b6)
|
||||
EnableSRAM:
|
||||
push af
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC3SRamEnable], a
|
||||
@@ -17,7 +17,7 @@ EnableSRAM: ; 07b6 (0:07b6)
|
||||
ret
|
||||
|
||||
; disable external RAM (SRAM)
|
||||
DisableSRAM: ; 07be (0:07be)
|
||||
DisableSRAM:
|
||||
push af
|
||||
xor a ; SRAM_DISABLE
|
||||
ld [MBC3SRamEnable], a
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
SECTION "start", ROM0
|
||||
Start: ; 0150 (0:0150)
|
||||
Start:
|
||||
di
|
||||
ld sp, $fffe
|
||||
push af
|
||||
|
||||
+32
-32
@@ -1,6 +1,6 @@
|
||||
; doubles the damage at de if swords dance or focus energy was used
|
||||
; in the last turn by the turn holder's arena Pokemon
|
||||
HandleDoubleDamageSubstatus: ; 321d (0:321d)
|
||||
HandleDoubleDamageSubstatus:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS3
|
||||
call GetTurnDuelistVariable
|
||||
bit SUBSTATUS3_THIS_TURN_DOUBLE_DAMAGE, [hl]
|
||||
@@ -31,7 +31,7 @@ HandleDoubleDamageSubstatus: ; 321d (0:321d)
|
||||
; check if the defending card (turn holder's arena card) has any substatus that
|
||||
; reduces the damage dealt to it this turn (SUBSTATUS1 or Pkmn Powers).
|
||||
; damage is given in de as input and the possibly updated damage is also returned in de.
|
||||
HandleDamageReduction: ; 3244 (0:3244)
|
||||
HandleDamageReduction:
|
||||
call HandleDamageReductionExceptSubstatus2
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
|
||||
call GetNonTurnDuelistVariable
|
||||
@@ -60,7 +60,7 @@ HandleDamageReduction: ; 3244 (0:3244)
|
||||
; check if the defending card (turn holder's arena card) has any substatus that
|
||||
; reduces the damage dealt to it this turn. (SUBSTATUS1 or Pkmn Powers)
|
||||
; damage is given in de as input and the possibly updated damage is also returned in de.
|
||||
HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269)
|
||||
HandleDamageReductionExceptSubstatus2:
|
||||
ld a, [wNoDamageOrEffect]
|
||||
or a
|
||||
jr nz, .no_damage
|
||||
@@ -150,7 +150,7 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269)
|
||||
|
||||
; check for Invisible Wall, Kabuto Armor, NShield, or Transparency, in order to
|
||||
; possibly reduce or make zero the damage at de.
|
||||
HandleDamageReductionOrNoDamageFromPkmnPowerEffects: ; 32f7 (0:32f7)
|
||||
HandleDamageReductionOrNoDamageFromPkmnPowerEffects:
|
||||
ld a, [wLoadedAttackCategory]
|
||||
cp POKEMON_POWER
|
||||
ret z
|
||||
@@ -173,7 +173,7 @@ HandleDamageReductionOrNoDamageFromPkmnPowerEffects: ; 32f7 (0:32f7)
|
||||
; attacking Pokemon (turn holder's arena Pokemon) takes 10 damage.
|
||||
; ignore if damage taken at de is 0.
|
||||
; used to bounce back a damaging attack.
|
||||
HandleStrikesBack_AgainstDamagingAttack: ; 3317 (0:3317)
|
||||
HandleStrikesBack_AgainstDamagingAttack:
|
||||
ld a, e
|
||||
or d
|
||||
ret z
|
||||
@@ -233,7 +233,7 @@ HandleStrikesBack_AgainstDamagingAttack: ; 3317 (0:3317)
|
||||
|
||||
; return carry if NShield or Transparency activate (if MEW1 or HAUNTER1 is
|
||||
; the turn holder's arena Pokemon), and print their corresponding text if so
|
||||
HandleNShieldAndTransparency: ; 337f (0:337f)
|
||||
HandleNShieldAndTransparency:
|
||||
push de
|
||||
ld a, DUELVARS_ARENA_CARD
|
||||
add e
|
||||
@@ -274,7 +274,7 @@ HandleNShieldAndTransparency: ; 337f (0:337f)
|
||||
|
||||
; return carry if the turn holder's arena Pokemon is under a condition that makes
|
||||
; it unable to attack. also return in hl the text id to be displayed
|
||||
HandleCantAttackSubstatus: ; 33c1 (0:33c1)
|
||||
HandleCantAttackSubstatus:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -296,7 +296,7 @@ HandleCantAttackSubstatus: ; 33c1 (0:33c1)
|
||||
|
||||
; return carry if the turn holder's arena Pokemon cannot use
|
||||
; selected attack at wSelectedAttack due to amnesia
|
||||
HandleAmnesiaSubstatus: ; 33e1 (0:33e1)
|
||||
HandleAmnesiaSubstatus:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -319,7 +319,7 @@ HandleAmnesiaSubstatus: ; 33e1 (0:33e1)
|
||||
ret
|
||||
|
||||
; return carry if the turn holder's attack was unsuccessful due to sand attack or smokescreen effect
|
||||
HandleSandAttackOrSmokescreenSubstatus: ; 3400 (0:3400)
|
||||
HandleSandAttackOrSmokescreenSubstatus:
|
||||
call CheckSandAttackOrSmokescreenSubstatus
|
||||
ret nc
|
||||
call TossCoin
|
||||
@@ -332,7 +332,7 @@ HandleSandAttackOrSmokescreenSubstatus: ; 3400 (0:3400)
|
||||
ret
|
||||
|
||||
; return carry if the turn holder's arena card is under the effects of sand attack or smokescreen
|
||||
CheckSandAttackOrSmokescreenSubstatus: ; 3414 (0:3414)
|
||||
CheckSandAttackOrSmokescreenSubstatus:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -355,7 +355,7 @@ CheckSandAttackOrSmokescreenSubstatus: ; 3414 (0:3414)
|
||||
; return carry if the defending card (turn holder's arena card) is under a substatus
|
||||
; that prevents any damage or effect dealt to it for a turn.
|
||||
; also return the cause of the substatus in wNoDamageOrEffect
|
||||
HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432)
|
||||
HandleNoDamageOrEffectSubstatus:
|
||||
xor a
|
||||
ld [wNoDamageOrEffect], a
|
||||
ld a, [wLoadedAttackCategory]
|
||||
@@ -408,7 +408,7 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432)
|
||||
; if the Pokemon being attacked is HAUNTER1, and its Transparency is active,
|
||||
; there is a 50% chance that any damage or effect is prevented
|
||||
; return carry if damage is prevented
|
||||
HandleTransparency: ; 348a (0:348a)
|
||||
HandleTransparency:
|
||||
ld a, [wTempNonTurnDuelistCardID]
|
||||
cp HAUNTER1
|
||||
jr z, .transparency
|
||||
@@ -436,7 +436,7 @@ HandleTransparency: ; 348a (0:348a)
|
||||
; return carry and return the appropriate text id in hl if the target has an
|
||||
; special status or power that prevents any damage or effect done to it this turn
|
||||
; input: a = NO_DAMAGE_OR_EFFECT_*
|
||||
CheckNoDamageOrEffect: ; 34b7 (0:34b7)
|
||||
CheckNoDamageOrEffect:
|
||||
ld a, [wNoDamageOrEffect]
|
||||
or a
|
||||
ret z
|
||||
@@ -461,7 +461,7 @@ CheckNoDamageOrEffect: ; 34b7 (0:34b7)
|
||||
scf
|
||||
ret
|
||||
|
||||
NoDamageOrEffectTextIDTable: ; 34d8 (0:34d8)
|
||||
NoDamageOrEffectTextIDTable:
|
||||
tx NoDamageOrEffectDueToAgilityText ; NO_DAMAGE_OR_EFFECT_AGILITY
|
||||
tx NoDamageOrEffectDueToBarrierText ; NO_DAMAGE_OR_EFFECT_BARRIER
|
||||
tx NoDamageOrEffectDueToFlyText ; NO_DAMAGE_OR_EFFECT_FLY
|
||||
@@ -469,7 +469,7 @@ NoDamageOrEffectTextIDTable: ; 34d8 (0:34d8)
|
||||
tx NoDamageOrEffectDueToNShieldText ; NO_DAMAGE_OR_EFFECT_NSHIELD
|
||||
|
||||
; return carry if turn holder has Omanyte and its Clairvoyance Pkmn Power is active
|
||||
IsClairvoyanceActive: ; 34e2 (0:34e2)
|
||||
IsClairvoyanceActive:
|
||||
ld a, MUK
|
||||
call CountPokemonIDInBothPlayAreas
|
||||
ccf
|
||||
@@ -480,11 +480,11 @@ IsClairvoyanceActive: ; 34e2 (0:34e2)
|
||||
|
||||
; returns carry if turn holder's arena card is paralyzed, asleep, confused,
|
||||
; and/or toxic gas in play, meaning that attack and/or pkmn power cannot be used
|
||||
CheckCannotUseDueToStatus: ; 34ef (0:34ef)
|
||||
CheckCannotUseDueToStatus:
|
||||
xor a
|
||||
|
||||
; same as above, but if a is non-0, only toxic gas is checked
|
||||
CheckCannotUseDueToStatus_OnlyToxicGasIfANon0: ; 34f0 (0:34f0)
|
||||
CheckCannotUseDueToStatus_OnlyToxicGasIfANon0:
|
||||
or a
|
||||
jr nz, .check_toxic_gas
|
||||
ld a, DUELVARS_ARENA_CARD_STATUS
|
||||
@@ -504,7 +504,7 @@ CheckCannotUseDueToStatus_OnlyToxicGasIfANon0: ; 34f0 (0:34f0)
|
||||
; play area of both duelists. Also return carry if the Pokemon card is at least found once.
|
||||
; if the arena Pokemon is asleep, confused, or paralyzed (Pkmn Power-incapable), it doesn't count.
|
||||
; input: a = Pokemon card ID to search
|
||||
CountPokemonIDInBothPlayAreas: ; 3509 (0:3509)
|
||||
CountPokemonIDInBothPlayAreas:
|
||||
push bc
|
||||
ld [wTempPokemonID_ce7c], a
|
||||
call CountPokemonIDInPlayArea
|
||||
@@ -526,7 +526,7 @@ CountPokemonIDInBothPlayAreas: ; 3509 (0:3509)
|
||||
; turn holder's play area. Also return carry if the Pokemon card is at least found once.
|
||||
; if the arena Pokemon is asleep, confused, or paralyzed (Pkmn Power-incapable), it doesn't count.
|
||||
; input: a = Pokemon card ID to search
|
||||
CountPokemonIDInPlayArea: ; 3525 (0:3525)
|
||||
CountPokemonIDInPlayArea:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -574,7 +574,7 @@ CountPokemonIDInPlayArea: ; 3525 (0:3525)
|
||||
|
||||
; return, in a, the retreat cost of the card in wLoadedCard1,
|
||||
; adjusting for any Dodrio's Retreat Aid Pkmn Power that is active.
|
||||
GetLoadedCard1RetreatCost: ; 356a (0:356a)
|
||||
GetLoadedCard1RetreatCost:
|
||||
ld c, 0
|
||||
ld a, DUELVARS_BENCH
|
||||
call GetTurnDuelistVariable
|
||||
@@ -607,7 +607,7 @@ GetLoadedCard1RetreatCost: ; 356a (0:356a)
|
||||
ret
|
||||
|
||||
; return carry if the turn holder's arena Pokemon is affected by Acid and can't retreat
|
||||
CheckCantRetreatDueToAcid: ; 3597 (0:3597)
|
||||
CheckCantRetreatDueToAcid:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -622,7 +622,7 @@ CheckCantRetreatDueToAcid: ; 3597 (0:3597)
|
||||
ret
|
||||
|
||||
; return carry if the turn holder is affected by Headache and trainer cards can't be used
|
||||
CheckCantUseTrainerDueToHeadache: ; 35a9 (0:35a9)
|
||||
CheckCantUseTrainerDueToHeadache:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS3
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -633,7 +633,7 @@ CheckCantUseTrainerDueToHeadache: ; 35a9 (0:35a9)
|
||||
ret
|
||||
|
||||
; return carry if any duelist has Aerodactyl and its Prehistoric Power Pkmn Power is active
|
||||
IsPrehistoricPowerActive: ; 35b7 (0:35b7)
|
||||
IsPrehistoricPowerActive:
|
||||
ld a, AERODACTYL
|
||||
call CountPokemonIDInBothPlayAreas
|
||||
ret nc
|
||||
@@ -646,7 +646,7 @@ IsPrehistoricPowerActive: ; 35b7 (0:35b7)
|
||||
; clears some SUBSTATUS2 conditions from the turn holder's active Pokemon.
|
||||
; more specifically, those conditions that reduce the damage from an attack
|
||||
; or prevent the opposing Pokemon from attacking the substatus condition inducer.
|
||||
ClearDamageReductionSubstatus2: ; 35c7 (0:35c7)
|
||||
ClearDamageReductionSubstatus2:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
|
||||
call GetTurnDuelistVariable
|
||||
or a
|
||||
@@ -667,7 +667,7 @@ ClearDamageReductionSubstatus2: ; 35c7 (0:35c7)
|
||||
ret
|
||||
|
||||
; clears the SUBSTATUS1 and updates the double damage condition of the player about to start his turn
|
||||
UpdateSubstatusConditions_StartOfTurn: ; 35e6 (0:35e6)
|
||||
UpdateSubstatusConditions_StartOfTurn:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS1
|
||||
call GetTurnDuelistVariable
|
||||
ld [hl], $0
|
||||
@@ -681,7 +681,7 @@ UpdateSubstatusConditions_StartOfTurn: ; 35e6 (0:35e6)
|
||||
ret
|
||||
|
||||
; clears the SUBSTATUS2, Headache, and updates the double damage condition of the player ending his turn
|
||||
UpdateSubstatusConditions_EndOfTurn: ; 35fa (0:35fa)
|
||||
UpdateSubstatusConditions_EndOfTurn:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS3
|
||||
call GetTurnDuelistVariable
|
||||
res SUBSTATUS3_HEADACHE, [hl]
|
||||
@@ -699,7 +699,7 @@ UpdateSubstatusConditions_EndOfTurn: ; 35fa (0:35fa)
|
||||
ret
|
||||
|
||||
; return carry if turn holder has Blastoise and its Rain Dance Pkmn Power is active
|
||||
IsRainDanceActive: ; 3615 (0:3615)
|
||||
IsRainDanceActive:
|
||||
ld a, BLASTOISE
|
||||
call CountPokemonIDInPlayArea
|
||||
ret nc ; return if no Pkmn Power-capable Blastoise found in turn holder's play area
|
||||
@@ -710,7 +710,7 @@ IsRainDanceActive: ; 3615 (0:3615)
|
||||
|
||||
; return carry if card at [hTempCardIndex_ff98] is a water energy card AND
|
||||
; if card at [hTempPlayAreaLocation_ff9d] is a water Pokemon card.
|
||||
CheckRainDanceScenario: ; 3622 (0:3622)
|
||||
CheckRainDanceScenario:
|
||||
ldh a, [hTempCardIndex_ff98]
|
||||
call GetCardIDFromDeckIndex
|
||||
call GetCardType
|
||||
@@ -728,7 +728,7 @@ CheckRainDanceScenario: ; 3622 (0:3622)
|
||||
|
||||
; if the defending (non-turn) card's HP is 0 and the attacking (turn) card's HP
|
||||
; is not, the attacking card faints if it was affected by destiny bond
|
||||
HandleDestinyBondSubstatus: ; 363b (0:363b)
|
||||
HandleDestinyBondSubstatus:
|
||||
ld a, DUELVARS_ARENA_CARD_SUBSTATUS1
|
||||
call GetNonTurnDuelistVariable
|
||||
cp SUBSTATUS1_DESTINY_BOND
|
||||
@@ -768,7 +768,7 @@ HandleDestinyBondSubstatus: ; 363b (0:363b)
|
||||
; when MACHAMP is damaged, if its Strikes Back is active, the
|
||||
; attacking Pokemon (turn holder's arena Pokemon) takes 10 damage.
|
||||
; used to bounce back an attack of the RESIDUAL category
|
||||
HandleStrikesBack_AgainstResidualAttack: ; 367b (0:367b)
|
||||
HandleStrikesBack_AgainstResidualAttack:
|
||||
ld a, [wTempNonTurnDuelistCardID]
|
||||
cp MACHAMP
|
||||
jr z, .strikes_back
|
||||
@@ -789,7 +789,7 @@ HandleStrikesBack_AgainstResidualAttack: ; 367b (0:367b)
|
||||
call nc, WaitForWideTextBoxInput
|
||||
ret
|
||||
|
||||
ApplyStrikesBack_AgainstResidualAttack: ; 36a2 (0:36a2)
|
||||
ApplyStrikesBack_AgainstResidualAttack:
|
||||
push hl
|
||||
call LoadTxRam3
|
||||
ld a, [wTempTurnDuelistCardID]
|
||||
@@ -822,7 +822,7 @@ ApplyStrikesBack_AgainstResidualAttack: ; 36a2 (0:36a2)
|
||||
|
||||
; if the id of the card provided in register a as a deck index is MUK,
|
||||
; clear the changed type of all arena and bench Pokemon
|
||||
ClearChangedTypesIfMuk: ; 36d9 (0:36d9)
|
||||
ClearChangedTypesIfMuk:
|
||||
call GetCardIDFromDeckIndex
|
||||
ld a, e
|
||||
cp MUK
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; switch to rombank (a + top2 of h shifted down),
|
||||
; set top2 of h to 01 (switchable ROM bank area),
|
||||
; return old rombank id on top-of-stack
|
||||
BankpushROM: ; 0745 (0:0745)
|
||||
BankpushROM:
|
||||
push hl
|
||||
push bc
|
||||
push af
|
||||
@@ -38,7 +38,7 @@ BankpushROM: ; 0745 (0:0745)
|
||||
|
||||
; switch to rombank a,
|
||||
; return old rombank id on top-of-stack
|
||||
BankpushROM2: ; 076f (0:076f)
|
||||
BankpushROM2:
|
||||
push hl
|
||||
push bc
|
||||
push af
|
||||
@@ -66,7 +66,7 @@ BankpushROM2: ; 076f (0:076f)
|
||||
ret
|
||||
|
||||
; restore rombank from top-of-stack
|
||||
BankpopROM: ; 078e (0:078e)
|
||||
BankpopROM:
|
||||
push hl
|
||||
push de
|
||||
ld hl, sp+$7
|
||||
@@ -87,7 +87,7 @@ BankpopROM: ; 078e (0:078e)
|
||||
ret
|
||||
|
||||
; switch ROM bank to a
|
||||
BankswitchROM: ; 07a3 (0:07a3)
|
||||
BankswitchROM:
|
||||
ldh [hBankROM], a
|
||||
ld [MBC3RomBank], a
|
||||
ret
|
||||
|
||||
+15
-15
@@ -1,7 +1,7 @@
|
||||
|
||||
; copy c bytes of data from de to hl
|
||||
; if LCD on, copy during h-blank only
|
||||
SafeCopyDataDEtoHL: ; 1dca (0:1dca)
|
||||
SafeCopyDataDEtoHL:
|
||||
ld a, [wLCDC] ;
|
||||
bit LCDC_ENABLE_F, a ;
|
||||
jr nz, .lcd_on ; assert that LCD is on
|
||||
@@ -17,7 +17,7 @@ SafeCopyDataDEtoHL: ; 1dca (0:1dca)
|
||||
|
||||
; returns v*BGMap0 + BG_MAP_WIDTH * e + d in hl.
|
||||
; used to map coordinates at de to a BGMap0 address.
|
||||
DECoordToBGMap0Address: ; 1ddb (0:1ddb)
|
||||
DECoordToBGMap0Address:
|
||||
ld l, e
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
@@ -34,7 +34,7 @@ DECoordToBGMap0Address: ; 1ddb (0:1ddb)
|
||||
ret
|
||||
|
||||
; Apply SCX and SCY correction to xy coordinates at de
|
||||
AdjustCoordinatesForBGScroll: ; 1deb (0:1deb)
|
||||
AdjustCoordinatesForBGScroll:
|
||||
push af
|
||||
ldh a, [hSCX]
|
||||
rra
|
||||
@@ -56,7 +56,7 @@ AdjustCoordinatesForBGScroll: ; 1deb (0:1deb)
|
||||
; Draws a bxc text box at de printing a name in the left side of the top border.
|
||||
; The name's text id must be at hl when this function is called.
|
||||
; Mostly used to print text boxes for talked-to NPCs, but occasionally used in duels as well.
|
||||
DrawLabeledTextBox: ; 1e00 (0:1e00)
|
||||
DrawLabeledTextBox:
|
||||
ld a, [wConsole]
|
||||
cp CONSOLE_SGB
|
||||
jr nz, .draw_textbox
|
||||
@@ -150,7 +150,7 @@ DrawLabeledTextBox: ; 1e00 (0:1e00)
|
||||
; Draws a bxc text box at de to print menu data in the overworld.
|
||||
; Also used to print a text box during a duel.
|
||||
; When talking to NPCs, DrawLabeledTextBox is used instead.
|
||||
DrawRegularTextBox: ; 1e7c (0:1e7c)
|
||||
DrawRegularTextBox:
|
||||
ld a, [wConsole]
|
||||
cp CONSOLE_CGB
|
||||
jr z, DrawRegularTextBoxCGB
|
||||
@@ -158,7 +158,7 @@ DrawRegularTextBox: ; 1e7c (0:1e7c)
|
||||
jp z, DrawRegularTextBoxSGB
|
||||
; fallthrough
|
||||
|
||||
DrawRegularTextBoxDMG: ; 1e88 (0:1e88)
|
||||
DrawRegularTextBoxDMG:
|
||||
call DECoordToBGMap0Address
|
||||
; top line (border) of the text box
|
||||
ld a, SYM_BOX_TOP
|
||||
@@ -168,7 +168,7 @@ DrawRegularTextBoxDMG: ; 1e88 (0:1e88)
|
||||
|
||||
; continue drawing a labeled or regular textbox on DMG or SGB:
|
||||
; body and bottom line of either type of textbox
|
||||
ContinueDrawingTextBoxDMGorSGB: ; 1e93 (0:1e93)
|
||||
ContinueDrawingTextBoxDMGorSGB:
|
||||
dec c
|
||||
dec c
|
||||
.draw_text_box_body_loop
|
||||
@@ -187,7 +187,7 @@ ContinueDrawingTextBoxDMGorSGB: ; 1e93 (0:1e93)
|
||||
; e = value of byte b
|
||||
; a = value of bytes [1, b-1]
|
||||
; b is supposed to be BG_MAP_WIDTH or smaller, else the stack would get corrupted
|
||||
CopyLine: ; 1ea5 (0:1ea5)
|
||||
CopyLine:
|
||||
add sp, -BG_MAP_WIDTH
|
||||
push hl
|
||||
push bc
|
||||
@@ -219,7 +219,7 @@ CopyLine: ; 1ea5 (0:1ea5)
|
||||
ret
|
||||
|
||||
; DrawRegularTextBox branches here on CGB console
|
||||
DrawRegularTextBoxCGB: ; 1ec9 (0:1ec9)
|
||||
DrawRegularTextBoxCGB:
|
||||
call DECoordToBGMap0Address
|
||||
; top line (border) of the text box
|
||||
ld a, SYM_BOX_TOP
|
||||
@@ -229,7 +229,7 @@ DrawRegularTextBoxCGB: ; 1ec9 (0:1ec9)
|
||||
|
||||
; continue drawing a labeled or regular textbox on CGB:
|
||||
; body and bottom line of either type of textbox
|
||||
ContinueDrawingTextBoxCGB: ; 1ed4 (0:1ed4)
|
||||
ContinueDrawingTextBoxCGB:
|
||||
dec c
|
||||
dec c
|
||||
.draw_text_box_body_loop
|
||||
@@ -257,13 +257,13 @@ ContinueDrawingTextBoxCGB: ; 1ed4 (0:1ed4)
|
||||
; e = id of top right tile
|
||||
; a = id of rest of tiles
|
||||
; Assumes b = SCREEN_WIDTH and that VRAM bank 0 is loaded
|
||||
CopyCurrentLineTilesAndAttrCGB: ; 1efb (0:1efb)
|
||||
CopyCurrentLineTilesAndAttrCGB:
|
||||
push hl
|
||||
call CopyLine
|
||||
pop hl
|
||||
; fallthrough
|
||||
|
||||
CopyCurrentLineAttrCGB: ; 1f00 (0:1f00)
|
||||
CopyCurrentLineAttrCGB:
|
||||
call BankswitchVRAM1
|
||||
ld a, [wTextBoxFrameType] ; on CGB, wTextBoxFrameType determines the palette and the other attributes
|
||||
ld e, a
|
||||
@@ -273,7 +273,7 @@ CopyCurrentLineAttrCGB: ; 1f00 (0:1f00)
|
||||
ret
|
||||
|
||||
; DrawRegularTextBox branches here on SGB console
|
||||
DrawRegularTextBoxSGB: ; 1f0f (0:1f0f)
|
||||
DrawRegularTextBoxSGB:
|
||||
push bc
|
||||
push de
|
||||
call DrawRegularTextBoxDMG
|
||||
@@ -284,7 +284,7 @@ DrawRegularTextBoxSGB: ; 1f0f (0:1f0f)
|
||||
ret z
|
||||
; fallthrough
|
||||
|
||||
ColorizeTextBoxSGB: ; 1f1b (0:1f1b)
|
||||
ColorizeTextBoxSGB:
|
||||
push bc
|
||||
push de
|
||||
ld hl, wTempSGBPacket
|
||||
@@ -326,7 +326,7 @@ ColorizeTextBoxSGB: ; 1f1b (0:1f1b)
|
||||
call SendSGB
|
||||
ret
|
||||
|
||||
AttrBlkPacket_TextBox: ; 1f4f (0:1f4f)
|
||||
AttrBlkPacket_TextBox:
|
||||
sgb ATTR_BLK, 1 ; sgb_command, length
|
||||
db 1 ; number of data sets
|
||||
; Control Code, Color Palette Designation, X1, Y1, X2, Y2
|
||||
|
||||
+23
-23
@@ -3,7 +3,7 @@
|
||||
; | a+0*l+0*h | a+0*l+1*h | a+0*l+2*h |
|
||||
; | a+1*l+0*h | a+1*l+1*h | a+1*l+2*h |
|
||||
; | a+2*l+0*h | a+2*l+1*h | a+2*l+2*h |
|
||||
FillRectangle: ; 1f5f (0:1f5f)
|
||||
FillRectangle:
|
||||
push de
|
||||
push af
|
||||
push hl
|
||||
@@ -46,7 +46,7 @@ FillRectangle: ; 1f5f (0:1f5f)
|
||||
pop de
|
||||
ret
|
||||
|
||||
Func_1f96: ; 1f96 (0:1f96)
|
||||
Func_1f96:
|
||||
add sp, -10
|
||||
ld hl, sp+0
|
||||
ld [hli], a ; sp-10 <- a
|
||||
@@ -179,7 +179,7 @@ Func_1f96: ; 1f96 (0:1f96)
|
||||
scf
|
||||
ret
|
||||
|
||||
Func_2046: ; 2046 (0:2046)
|
||||
Func_2046:
|
||||
ld hl, sp+3
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
@@ -189,15 +189,15 @@ Func_2046: ; 2046 (0:2046)
|
||||
jr z, Func_2055
|
||||
; fallthrough
|
||||
|
||||
Func_2051: ; 2051 (0:2051)
|
||||
Func_2051:
|
||||
ld hl, sp+9
|
||||
jr Func_2057
|
||||
|
||||
Func_2055: ; 2055 (0:2055)
|
||||
Func_2055:
|
||||
ld hl, sp+8
|
||||
; fallthrough
|
||||
|
||||
Func_2057: ; 2057 (0:2057)
|
||||
Func_2057:
|
||||
ld e, [hl]
|
||||
ld hl, sp+2
|
||||
ld a, [hl]
|
||||
@@ -212,7 +212,7 @@ Func_2057: ; 2057 (0:2057)
|
||||
|
||||
; loads the four tiles of the card set 2 icon constant provided in register a
|
||||
; returns carry if the specified set does not have an icon
|
||||
LoadCardSet2Tiles: ; 2066 (0:2066)
|
||||
LoadCardSet2Tiles:
|
||||
and $7 ; mask out PRO
|
||||
ld e, a
|
||||
ld d, 0
|
||||
@@ -237,7 +237,7 @@ LoadCardSet2Tiles: ; 2066 (0:2066)
|
||||
db -1, $0 tiles, $4 tiles, -1, -1, -1, -1, $8 tiles
|
||||
|
||||
; loads the Deck and Hand icons for the "Draw X card(s) from the deck." screen
|
||||
LoadDuelDrawCardsScreenTiles: ; 208d (0:208d)
|
||||
LoadDuelDrawCardsScreenTiles:
|
||||
ld hl, DuelOtherGraphics + $29 tiles
|
||||
ld de, v0Tiles1 + $74 tiles
|
||||
ld b, $08
|
||||
@@ -245,7 +245,7 @@ LoadDuelDrawCardsScreenTiles: ; 208d (0:208d)
|
||||
|
||||
; loads the 8 tiles that make up the border of the main duel menu as well as the border
|
||||
; of a large card picture (displayed after drawing the card or placing it in the arena).
|
||||
LoadCardOrDuelMenuBorderTiles: ; 2098 (0:2098)
|
||||
LoadCardOrDuelMenuBorderTiles:
|
||||
ld hl, DuelOtherGraphics + $15 tiles
|
||||
ld de, v0Tiles1 + $50 tiles
|
||||
ld b, $08
|
||||
@@ -253,7 +253,7 @@ LoadCardOrDuelMenuBorderTiles: ; 2098 (0:2098)
|
||||
|
||||
; loads the graphics of a card type header, used to display a picture of a card after drawing it
|
||||
; or placing it in the arena. register e determines which header (TRAINER, ENERGY, PoKéMoN)
|
||||
LoadCardTypeHeaderTiles: ; 20a2 (0:20a2)
|
||||
LoadCardTypeHeaderTiles:
|
||||
ld d, a
|
||||
ld e, 0
|
||||
ld hl, DuelCardHeaderGraphics - $4000
|
||||
@@ -263,7 +263,7 @@ LoadCardTypeHeaderTiles: ; 20a2 (0:20a2)
|
||||
jr CopyFontsOrDuelGraphicsTiles
|
||||
|
||||
; loads the symbols that are displayed near the names of a list of cards in the hand or discard pile
|
||||
LoadDuelCardSymbolTiles: ; 20b0 (0:20b0)
|
||||
LoadDuelCardSymbolTiles:
|
||||
ld hl, DuelDmgSgbSymbolGraphics - $4000
|
||||
ld a, [wConsole]
|
||||
cp CONSOLE_CGB
|
||||
@@ -276,7 +276,7 @@ LoadDuelCardSymbolTiles: ; 20b0 (0:20b0)
|
||||
|
||||
; loads the symbols for Stage 1 Pkmn card, Stage 2 Pkmn card, and Trainer card.
|
||||
; unlike LoadDuelCardSymbolTiles excludes the symbols for Basic Pkmn and all energies.
|
||||
LoadDuelCardSymbolTiles2: ; 20c4 (0:20c4)
|
||||
LoadDuelCardSymbolTiles2:
|
||||
ld hl, DuelDmgSgbSymbolGraphics + $4 tiles - $4000
|
||||
ld a, [wConsole]
|
||||
cp CONSOLE_CGB
|
||||
@@ -288,12 +288,12 @@ LoadDuelCardSymbolTiles2: ; 20c4 (0:20c4)
|
||||
jr CopyFontsOrDuelGraphicsTiles
|
||||
|
||||
; load the face down basic / stage1 / stage2 card images shown in the check Pokemon screens
|
||||
LoadDuelFaceDownCardTiles: ; 20d8 (0:20d8)
|
||||
LoadDuelFaceDownCardTiles:
|
||||
ld b, $10
|
||||
jr LoadDuelCheckPokemonScreenTiles.got_num_tiles
|
||||
|
||||
; same as LoadDuelFaceDownCardTiles, plus also load the ACT / BPx tiles
|
||||
LoadDuelCheckPokemonScreenTiles: ; 20dc (0:20dc)
|
||||
LoadDuelCheckPokemonScreenTiles:
|
||||
ld b, $24
|
||||
.got_num_tiles
|
||||
ld hl, DuelDmgSgbSymbolGraphics + $30 tiles - $4000
|
||||
@@ -306,7 +306,7 @@ LoadDuelCheckPokemonScreenTiles: ; 20dc (0:20dc)
|
||||
jr CopyFontsOrDuelGraphicsTiles
|
||||
|
||||
; load the tiles for the "Placing the prizes..." screen
|
||||
LoadPlacingThePrizesScreenTiles: ; 20f0 (0:20f0)
|
||||
LoadPlacingThePrizesScreenTiles:
|
||||
; load the Pokeball field tiles
|
||||
ld hl, DuelOtherGraphics
|
||||
ld de, v0Tiles1 + $20 tiles
|
||||
@@ -315,7 +315,7 @@ LoadPlacingThePrizesScreenTiles: ; 20f0 (0:20f0)
|
||||
; fallthrough
|
||||
|
||||
; load the Deck and the Discard Pile icons
|
||||
LoadDeckAndDiscardPileIcons: ; 20fb (0:20fb)
|
||||
LoadDeckAndDiscardPileIcons:
|
||||
ld hl, DuelDmgSgbSymbolGraphics + $54 tiles - $4000
|
||||
ld a, [wConsole]
|
||||
cp CONSOLE_CGB
|
||||
@@ -327,14 +327,14 @@ LoadDeckAndDiscardPileIcons: ; 20fb (0:20fb)
|
||||
jr CopyFontsOrDuelGraphicsTiles
|
||||
|
||||
; load the tiles for the [O] and [X] symbols used to display the results of a coin toss
|
||||
LoadDuelCoinTossResultTiles: ; 210f (0:210f)
|
||||
LoadDuelCoinTossResultTiles:
|
||||
ld hl, DuelOtherGraphics + $d tiles
|
||||
ld de, v0Tiles2 + $30 tiles
|
||||
ld b, $8
|
||||
jr CopyFontsOrDuelGraphicsTiles
|
||||
|
||||
; load the tiles of the text characters used with TX_SYMBOL
|
||||
LoadSymbolsFont: ; 2119 (0:2119)
|
||||
LoadSymbolsFont:
|
||||
ld hl, SymbolsFont - $4000
|
||||
ld de, v0Tiles2 ; destination
|
||||
ld b, (DuelCardHeaderGraphics - SymbolsFont) / TILE_SIZE ; number of tiles
|
||||
@@ -344,7 +344,7 @@ LoadSymbolsFont: ; 2119 (0:2119)
|
||||
; copy b tiles from Gfx1:(hl+$4000) to de
|
||||
; if $4000 ≤ hl ≤ $7fff
|
||||
; copy b tiles from Gfx2:hl to de
|
||||
CopyFontsOrDuelGraphicsTiles: ; 2121 (0:2121)
|
||||
CopyFontsOrDuelGraphicsTiles:
|
||||
ld a, BANK(Fonts) ; BANK(DuelGraphics)
|
||||
call BankpushROM
|
||||
ld c, TILE_SIZE
|
||||
@@ -353,7 +353,7 @@ CopyFontsOrDuelGraphicsTiles: ; 2121 (0:2121)
|
||||
ret
|
||||
|
||||
; this function copies gfx data into sram
|
||||
Func_212f: ; 212f (0:212f)
|
||||
Func_212f:
|
||||
; loads symbols fonts to sGfxBuffer1
|
||||
ld hl, SymbolsFont - $4000
|
||||
ld de, sGfxBuffer1
|
||||
@@ -383,7 +383,7 @@ Func_212f: ; 212f (0:212f)
|
||||
jr CopyFontsOrDuelGraphicsTiles
|
||||
|
||||
; load the graphics and draw the duel box message given a BOXMSG_* constant in a
|
||||
DrawDuelBoxMessage: ; 2167 (0:2167)
|
||||
DrawDuelBoxMessage:
|
||||
ld l, a
|
||||
ld h, 40 tiles / 4 ; boxes are 10x4 tiles
|
||||
call HtimesL
|
||||
@@ -403,7 +403,7 @@ DrawDuelBoxMessage: ; 2167 (0:2167)
|
||||
|
||||
; load the tiles for the latin, katakana, and hiragana fonts into VRAM
|
||||
; from gfx/fonts/full_width/3.1bpp and gfx/fonts/full_width/4.1bpp
|
||||
LoadFullWidthFontTiles: ; 2189 (0:2189)
|
||||
LoadFullWidthFontTiles:
|
||||
ld hl, FullWidthFonts + $3cc tiles_1bpp - $4000
|
||||
ld a, BANK(Fonts) ; BANK(DuelGraphics)
|
||||
call BankpushROM
|
||||
@@ -421,7 +421,7 @@ LoadFullWidthFontTiles: ; 2189 (0:2189)
|
||||
ret
|
||||
|
||||
; copy 128 1bpp tiles from de to hl as 2bpp
|
||||
Copy1bppTiles: ; 21ab (0:21ab)
|
||||
Copy1bppTiles:
|
||||
ld b, $80
|
||||
.tile_loop
|
||||
ld c, TILE_SIZE_1BPP
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
; timer interrupt handler
|
||||
TimerHandler: ; 01e6 (0:01e6)
|
||||
TimerHandler:
|
||||
push af
|
||||
push hl
|
||||
push de
|
||||
@@ -37,7 +37,7 @@ TimerHandler: ; 01e6 (0:01e6)
|
||||
reti
|
||||
|
||||
; increment play time counter by a tick
|
||||
IncrementPlayTimeCounter: ; 021c (0:021c)
|
||||
IncrementPlayTimeCounter:
|
||||
ld a, [wPlayTimeCounterEnable]
|
||||
or a
|
||||
ret z
|
||||
@@ -67,7 +67,7 @@ IncrementPlayTimeCounter: ; 021c (0:021c)
|
||||
ret
|
||||
|
||||
; setup timer to 16384/68 ≈ 240.94 Hz
|
||||
SetupTimer: ; 0241 (0:0241)
|
||||
SetupTimer:
|
||||
ld b, -68 ; Value for Normal Speed
|
||||
call CheckForCGB
|
||||
jr c, .set_timer
|
||||
@@ -85,7 +85,7 @@ SetupTimer: ; 0241 (0:0241)
|
||||
ret
|
||||
|
||||
; return carry if not CGB
|
||||
CheckForCGB: ; 025c (0:025c)
|
||||
CheckForCGB:
|
||||
ld a, [wConsole]
|
||||
cp CONSOLE_CGB
|
||||
ret z
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; x (1 byte), y (1 byte), data (n bytes), $00
|
||||
; writes data to BGMap0-translated x,y
|
||||
; important: make sure VRAM can be accessed first, else use WriteDataBlockToBGMap0
|
||||
UnsafeWriteDataBlockToBGMap0: ; 0492 (0:0492)
|
||||
UnsafeWriteDataBlockToBGMap0:
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [hli]
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
; vblank interrupt handler
|
||||
VBlankHandler: ; 019b (0:019b)
|
||||
VBlankHandler:
|
||||
push af
|
||||
push bc
|
||||
push de
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
; set current dest VRAM bank to 0
|
||||
BankswitchVRAM0: ; 07c5 (0:07c5)
|
||||
BankswitchVRAM0:
|
||||
push af
|
||||
xor a
|
||||
ldh [hBankVRAM], a
|
||||
@@ -8,7 +8,7 @@ BankswitchVRAM0: ; 07c5 (0:07c5)
|
||||
ret
|
||||
|
||||
; set current dest VRAM bank to 1
|
||||
BankswitchVRAM1: ; 07cd (0:07cd)
|
||||
BankswitchVRAM1:
|
||||
push af
|
||||
ld a, $1
|
||||
ldh [hBankVRAM], a
|
||||
@@ -17,7 +17,7 @@ BankswitchVRAM1: ; 07cd (0:07cd)
|
||||
ret
|
||||
|
||||
; set current dest VRAM bank to a
|
||||
BankswitchVRAM: ; 07d6 (0:07d6)
|
||||
BankswitchVRAM:
|
||||
ldh [hBankVRAM], a
|
||||
ldh [rVBK], a
|
||||
ret
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
; converts the two-digit BCD number provided in a to text (ascii) format,
|
||||
; writes them to [wStringBuffer] and [wStringBuffer + 1], and to the BGMap0 address at bc
|
||||
WriteTwoDigitBCDNumber: ; 05c2 (0:05c2)
|
||||
WriteTwoDigitBCDNumber:
|
||||
push hl
|
||||
push bc
|
||||
push de
|
||||
@@ -20,7 +20,7 @@ WriteTwoDigitBCDNumber: ; 05c2 (0:05c2)
|
||||
|
||||
; converts the one-digit BCD number provided in the lower nybble of a to text
|
||||
; (ascii) format, and writes it to [wStringBuffer] and to the BGMap0 address at bc
|
||||
WriteOneDigitBCDNumber: ; 05db (0:05db)
|
||||
WriteOneDigitBCDNumber:
|
||||
push hl
|
||||
push bc
|
||||
push de
|
||||
@@ -40,7 +40,7 @@ WriteOneDigitBCDNumber: ; 05db (0:05db)
|
||||
|
||||
; converts the four-digit BCD number provided in h and l to text (ascii) format,
|
||||
; writes them to [wStringBuffer] through [wStringBuffer + 3], and to the BGMap0 address at bc
|
||||
WriteFourDigitBCDNumber: ; 05f4 (0:05f4)
|
||||
WriteFourDigitBCDNumber:
|
||||
push hl
|
||||
push bc
|
||||
push de
|
||||
@@ -66,7 +66,7 @@ WriteFourDigitBCDNumber: ; 05f4 (0:05f4)
|
||||
; given two BCD digits in the two nybbles of register a,
|
||||
; write them in text (ascii) format to hl (most significant nybble first).
|
||||
; numbers above 9 end up converted to half-width font tiles.
|
||||
WriteBCDNumberInTextFormat: ; 0614 (0:0614)
|
||||
WriteBCDNumberInTextFormat:
|
||||
push af
|
||||
swap a
|
||||
call WriteBCDDigitInTextFormat
|
||||
@@ -75,7 +75,7 @@ WriteBCDNumberInTextFormat: ; 0614 (0:0614)
|
||||
|
||||
; given a BCD digit in the (lower nybble) of register a, write it in text (ascii)
|
||||
; format to hl. numbers above 9 end up converted to half-width font tiles.
|
||||
WriteBCDDigitInTextFormat: ; 061b (0:061b)
|
||||
WriteBCDDigitInTextFormat:
|
||||
and $0f
|
||||
add "0"
|
||||
cp "9" + 1
|
||||
@@ -87,7 +87,7 @@ WriteBCDDigitInTextFormat: ; 061b (0:061b)
|
||||
|
||||
; converts the one-byte number at a to text (ascii) format,
|
||||
; and writes it to [wStringBuffer] and the BGMap0 address at bc
|
||||
WriteOneByteNumber: ; 0627 (0:0627)
|
||||
WriteOneByteNumber:
|
||||
push bc
|
||||
push hl
|
||||
ld l, a
|
||||
@@ -112,7 +112,7 @@ WriteOneByteNumber: ; 0627 (0:0627)
|
||||
|
||||
; converts the two-byte number at hl to text (ascii) format,
|
||||
; and writes it to [wStringBuffer] and the BGMap0 address at bc
|
||||
WriteTwoByteNumber: ; 0650 (0:0650)
|
||||
WriteTwoByteNumber:
|
||||
push bc
|
||||
ld de, wStringBuffer
|
||||
push de
|
||||
@@ -125,7 +125,7 @@ WriteTwoByteNumber: ; 0650 (0:0650)
|
||||
ret
|
||||
|
||||
; convert the number at hl to text (ascii) format and write it to de
|
||||
TwoByteNumberToText: ; 0663 (0:0663)
|
||||
TwoByteNumberToText:
|
||||
push bc
|
||||
ld bc, -10000
|
||||
call .get_digit
|
||||
|
||||
Reference in New Issue
Block a user