mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-10-16 04:04:19 +13:00
Remove remaining raw $xxxx values, and replace "+ -1" with "- 1" (supported by rgbds 0.4.0)
This commit is contained in:
parent
7e92d5ba8c
commit
e4e0af4d67
|
@ -2,6 +2,19 @@
|
||||||
|
|
||||||
GBC EQU $11
|
GBC EQU $11
|
||||||
|
|
||||||
|
; memory map
|
||||||
|
VRAM_Begin EQU $8000
|
||||||
|
VRAM_End EQU $a000
|
||||||
|
SRAM_Begin EQU $a000
|
||||||
|
SRAM_End EQU $c000
|
||||||
|
WRAM0_Begin EQU $c000
|
||||||
|
WRAM0_End EQU $d000
|
||||||
|
WRAM1_Begin EQU $d000
|
||||||
|
WRAM1_End EQU $e000
|
||||||
|
; hardware registers $ff00-$ff80 (see below)
|
||||||
|
HRAM_Begin EQU $ff80
|
||||||
|
HRAM_End EQU $ffff
|
||||||
|
|
||||||
; MBC1
|
; MBC1
|
||||||
MBC1SRamEnable EQU $0000
|
MBC1SRamEnable EQU $0000
|
||||||
MBC1RomBank EQU $2000
|
MBC1RomBank EQU $2000
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
const SLASH ; a3
|
const SLASH ; a3
|
||||||
const SUBSTITUTE ; a4
|
const SUBSTITUTE ; a4
|
||||||
|
|
||||||
NUM_ATTACKS EQU const_value + -1
|
NUM_ATTACKS EQU const_value - 1
|
||||||
|
|
||||||
const STRUGGLE ; a5
|
const STRUGGLE ; a5
|
||||||
|
|
||||||
|
|
|
@ -151,4 +151,4 @@
|
||||||
const DEX_MEWTWO ; 150
|
const DEX_MEWTWO ; 150
|
||||||
const DEX_MEW ; 151
|
const DEX_MEW ; 151
|
||||||
|
|
||||||
NUM_POKEMON EQU const_value + -1
|
NUM_POKEMON EQU const_value - 1
|
||||||
|
|
|
@ -191,4 +191,4 @@
|
||||||
const WEEPINBELL ; $BD
|
const WEEPINBELL ; $BD
|
||||||
const VICTREEBEL ; $BE
|
const VICTREEBEL ; $BE
|
||||||
|
|
||||||
NUM_POKEMON_INDEXES EQU const_value + -1
|
NUM_POKEMON_INDEXES EQU const_value - 1
|
||||||
|
|
|
@ -7,7 +7,7 @@ MoveEffectPointerTable:
|
||||||
dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1
|
dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1
|
||||||
dw ExplodeEffect ; EXPLODE_EFFECT
|
dw ExplodeEffect ; EXPLODE_EFFECT
|
||||||
dw DrainHPEffect ; DREAM_EATER_EFFECT
|
dw DrainHPEffect ; DREAM_EATER_EFFECT
|
||||||
dw $0000 ; MIRROR_MOVE_EFFECT
|
dw NULL ; MIRROR_MOVE_EFFECT
|
||||||
dw StatModifierUpEffect ; ATTACK_UP1_EFFECT
|
dw StatModifierUpEffect ; ATTACK_UP1_EFFECT
|
||||||
dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT
|
dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT
|
||||||
dw StatModifierUpEffect ; SPEED_UP1_EFFECT
|
dw StatModifierUpEffect ; SPEED_UP1_EFFECT
|
||||||
|
@ -15,7 +15,7 @@ MoveEffectPointerTable:
|
||||||
dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT
|
dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT
|
||||||
dw StatModifierUpEffect ; EVASION_UP1_EFFECT
|
dw StatModifierUpEffect ; EVASION_UP1_EFFECT
|
||||||
dw PayDayEffect ; PAY_DAY_EFFECT
|
dw PayDayEffect ; PAY_DAY_EFFECT
|
||||||
dw $0000 ; SWIFT_EFFECT
|
dw NULL ; SWIFT_EFFECT
|
||||||
dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT
|
dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT
|
||||||
dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT
|
dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT
|
||||||
dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT
|
dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT
|
||||||
|
@ -38,12 +38,12 @@ MoveEffectPointerTable:
|
||||||
dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2
|
dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2
|
||||||
dw OneHitKOEffect ; OHKO_EFFECT
|
dw OneHitKOEffect ; OHKO_EFFECT
|
||||||
dw ChargeEffect ; CHARGE_EFFECT
|
dw ChargeEffect ; CHARGE_EFFECT
|
||||||
dw $0000 ; SUPER_FANG_EFFECT
|
dw NULL ; SUPER_FANG_EFFECT
|
||||||
dw $0000 ; SPECIAL_DAMAGE_EFFECT
|
dw NULL ; SPECIAL_DAMAGE_EFFECT
|
||||||
dw TrappingEffect ; TRAPPING_EFFECT
|
dw TrappingEffect ; TRAPPING_EFFECT
|
||||||
dw ChargeEffect ; FLY_EFFECT
|
dw ChargeEffect ; FLY_EFFECT
|
||||||
dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT
|
dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT
|
||||||
dw $0000 ; JUMP_KICK_EFFECT
|
dw NULL ; JUMP_KICK_EFFECT
|
||||||
dw MistEffect ; MIST_EFFECT
|
dw MistEffect ; MIST_EFFECT
|
||||||
dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT
|
dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT
|
||||||
dw RecoilEffect ; RECOIL_EFFECT
|
dw RecoilEffect ; RECOIL_EFFECT
|
||||||
|
@ -76,12 +76,12 @@ MoveEffectPointerTable:
|
||||||
dw StatModifierDownEffect ; unused effect
|
dw StatModifierDownEffect ; unused effect
|
||||||
dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT
|
dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT
|
||||||
dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT
|
dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT
|
||||||
dw $0000 ; unused effect
|
dw NULL ; unused effect
|
||||||
dw SubstituteEffect ; SUBSTITUTE_EFFECT
|
dw SubstituteEffect ; SUBSTITUTE_EFFECT
|
||||||
dw HyperBeamEffect ; HYPER_BEAM_EFFECT
|
dw HyperBeamEffect ; HYPER_BEAM_EFFECT
|
||||||
dw RageEffect ; RAGE_EFFECT
|
dw RageEffect ; RAGE_EFFECT
|
||||||
dw MimicEffect ; MIMIC_EFFECT
|
dw MimicEffect ; MIMIC_EFFECT
|
||||||
dw $0000 ; METRONOME_EFFECT
|
dw NULL ; METRONOME_EFFECT
|
||||||
dw LeechSeedEffect ; LEECH_SEED_EFFECT
|
dw LeechSeedEffect ; LEECH_SEED_EFFECT
|
||||||
dw SplashEffect ; SPLASH_EFFECT
|
dw SplashEffect ; SPLASH_EFFECT
|
||||||
dw DisableEffect ; DISABLE_EFFECT
|
dw DisableEffect ; DISABLE_EFFECT
|
||||||
|
|
|
@ -1735,7 +1735,7 @@ AnimationSlideMonDownAndHide:
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
call AnimationHideMonPic
|
call AnimationHideMonPic
|
||||||
ld hl, wTempPic
|
ld hl, wTempPic
|
||||||
ld bc, $0310
|
ld bc, $310
|
||||||
xor a
|
xor a
|
||||||
call FillMemory
|
call FillMemory
|
||||||
jp CopyTempPicToMonPic
|
jp CopyTempPicToMonPic
|
||||||
|
@ -1896,7 +1896,7 @@ AnimationSubstitute:
|
||||||
; Changes the pokemon's sprite to the mini sprite
|
; Changes the pokemon's sprite to the mini sprite
|
||||||
ld hl, wTempPic
|
ld hl, wTempPic
|
||||||
xor a
|
xor a
|
||||||
ld bc, $0310
|
ld bc, $310
|
||||||
call FillMemory
|
call FillMemory
|
||||||
ld a, [hWhoseTurn]
|
ld a, [hWhoseTurn]
|
||||||
and a
|
and a
|
||||||
|
@ -1932,7 +1932,7 @@ AnimationSubstitute:
|
||||||
jp AnimationShowMonPic
|
jp AnimationShowMonPic
|
||||||
|
|
||||||
CopySlowbroSpriteData:
|
CopySlowbroSpriteData:
|
||||||
ld bc, $0010
|
ld bc, $10
|
||||||
ld a, BANK(SlowbroSprite)
|
ld a, BANK(SlowbroSprite)
|
||||||
jp FarCopyData2
|
jp FarCopyData2
|
||||||
|
|
||||||
|
|
|
@ -582,7 +582,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP:
|
||||||
ld a, [de] ; increment toxic counter
|
ld a, [de] ; increment toxic counter
|
||||||
inc a
|
inc a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
ld hl, $0000
|
ld hl, 0
|
||||||
.toxicTicksLoop
|
.toxicTicksLoop
|
||||||
add hl, bc
|
add hl, bc
|
||||||
dec a
|
dec a
|
||||||
|
@ -5345,8 +5345,8 @@ MoveHitTest:
|
||||||
ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true)
|
ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true)
|
||||||
call CheckTargetSubstitute ; substitute check (note that this overwrites a)
|
call CheckTargetSubstitute ; substitute check (note that this overwrites a)
|
||||||
jr z, .checkForDigOrFlyStatus
|
jr z, .checkForDigOrFlyStatus
|
||||||
; this code is buggy. it's supposed to prevent HP draining moves from working on substitutes.
|
; This code is buggy. It's supposed to prevent HP draining moves from working on substitutes.
|
||||||
; since $7b79 overwrites a with either $00 or $01, it never works.
|
; Since CheckTargetSubstitute overwrites a with either $00 or $01, it never works.
|
||||||
cp DRAIN_HP_EFFECT
|
cp DRAIN_HP_EFFECT
|
||||||
jp z, .moveMissed
|
jp z, .moveMissed
|
||||||
cp DREAM_EATER_EFFECT
|
cp DREAM_EATER_EFFECT
|
||||||
|
@ -6335,9 +6335,9 @@ LoadPlayerBackPic:
|
||||||
ld de, vBackPic
|
ld de, vBackPic
|
||||||
call InterlaceMergeSpriteBuffers
|
call InterlaceMergeSpriteBuffers
|
||||||
ld a, $a
|
ld a, $a
|
||||||
ld [$0], a
|
ld [MBC1SRamEnable], a
|
||||||
xor a
|
xor a
|
||||||
ld [$4000], a
|
ld [MBC1SRamBank], a
|
||||||
ld hl, vSprites
|
ld hl, vSprites
|
||||||
ld de, sSpriteBuffer1
|
ld de, sSpriteBuffer1
|
||||||
ld a, [hLoadedROMBank]
|
ld a, [hLoadedROMBank]
|
||||||
|
@ -6345,7 +6345,7 @@ LoadPlayerBackPic:
|
||||||
ld c, 7 * 7
|
ld c, 7 * 7
|
||||||
call CopyVideoData
|
call CopyVideoData
|
||||||
xor a
|
xor a
|
||||||
ld [$0], a
|
ld [MBC1SRamEnable], a
|
||||||
ld a, $31
|
ld a, $31
|
||||||
ld [hStartTileID], a
|
ld [hStartTileID], a
|
||||||
coord hl, 1, 5
|
coord hl, 1, 5
|
||||||
|
|
|
@ -134,7 +134,7 @@ AIMoveChoiceModification1:
|
||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
ld hl, StatusAilmentMoveEffects
|
ld hl, StatusAilmentMoveEffects
|
||||||
ld de, $0001
|
ld de, 1
|
||||||
call IsInArray
|
call IsInArray
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
|
|
|
@ -9,7 +9,7 @@ DisplayDiploma::
|
||||||
call DisableLCD
|
call DisableLCD
|
||||||
ld hl, CircleTile
|
ld hl, CircleTile
|
||||||
ld de, vChars2 + $700
|
ld de, vChars2 + $700
|
||||||
ld bc, $0010
|
ld bc, $10
|
||||||
ld a, BANK(CircleTile)
|
ld a, BANK(CircleTile)
|
||||||
call FarCopyData2
|
call FarCopyData2
|
||||||
coord hl, 0, 0
|
coord hl, 0, 0
|
||||||
|
|
|
@ -131,10 +131,8 @@ GetPrizeMenuId:
|
||||||
coord hl, 13, 5
|
coord hl, 13, 5
|
||||||
; reg. c:
|
; reg. c:
|
||||||
; [low nybble] number of bytes
|
; [low nybble] number of bytes
|
||||||
; [bit 765 = %100] space-padding (not zero-padding)
|
; [bits 765 = %100] space-padding (not zero-padding)
|
||||||
ld c, (1 << 7 | 2)
|
ld c, (1 << 7 | 2)
|
||||||
; Function $15CD displays BCD value (same routine
|
|
||||||
; used by text-command $02)
|
|
||||||
call PrintBCDNumber
|
call PrintBCDNumber
|
||||||
ld de, wPrize2Price
|
ld de, wPrize2Price
|
||||||
coord hl, 13, 7
|
coord hl, 13, 7
|
||||||
|
|
|
@ -43,7 +43,7 @@ DisplayTextIDInit::
|
||||||
; the original direction they were facing must be restored after the dialogue is over
|
; the original direction they were facing must be restored after the dialogue is over
|
||||||
ld hl, wSpriteStateData1 + $19
|
ld hl, wSpriteStateData1 + $19
|
||||||
ld c, $0f
|
ld c, $0f
|
||||||
ld de, $0010
|
ld de, $10
|
||||||
.spriteFacingDirectionCopyLoop
|
.spriteFacingDirectionCopyLoop
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
inc h
|
inc h
|
||||||
|
@ -55,7 +55,7 @@ DisplayTextIDInit::
|
||||||
; loop to force all the sprites in the middle of animation to stand still
|
; loop to force all the sprites in the middle of animation to stand still
|
||||||
; (so that they don't like they're frozen mid-step during the dialogue)
|
; (so that they don't like they're frozen mid-step during the dialogue)
|
||||||
ld hl, wSpriteStateData1 + 2
|
ld hl, wSpriteStateData1 + 2
|
||||||
ld de, $0010
|
ld de, $10
|
||||||
ld c, e
|
ld c, e
|
||||||
.spriteStandStillLoop
|
.spriteStandStillLoop
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
|
|
|
@ -702,7 +702,7 @@ ClearSAV:
|
||||||
|
|
||||||
PadSRAM_FF:
|
PadSRAM_FF:
|
||||||
ld [MBC1SRamBank], a
|
ld [MBC1SRamBank], a
|
||||||
ld hl, $a000 ; start of SRAM
|
ld hl, SRAM_Begin
|
||||||
ld bc, $2000 ; size of SRAM
|
ld bc, SRAM_End - SRAM_Begin
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
jp FillMemory
|
jp FillMemory
|
||||||
|
|
|
@ -491,12 +491,12 @@ DrawTrainerInfo:
|
||||||
call CopyData
|
call CopyData
|
||||||
ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns
|
ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns
|
||||||
ld de, vChars2 + $770
|
ld de, vChars2 + $770
|
||||||
ld bc, $0080
|
ld bc, $80
|
||||||
push bc
|
push bc
|
||||||
call TrainerInfo_FarCopyData
|
call TrainerInfo_FarCopyData
|
||||||
ld hl, BlankLeaderNames
|
ld hl, BlankLeaderNames
|
||||||
ld de, vChars2 + $600
|
ld de, vChars2 + $600
|
||||||
ld bc, $0170
|
ld bc, $170
|
||||||
call TrainerInfo_FarCopyData
|
call TrainerInfo_FarCopyData
|
||||||
pop bc
|
pop bc
|
||||||
ld hl, BadgeNumbersTileGraphics ; badge number tile patterns
|
ld hl, BadgeNumbersTileGraphics ; badge number tile patterns
|
||||||
|
@ -504,14 +504,14 @@ DrawTrainerInfo:
|
||||||
call TrainerInfo_FarCopyData
|
call TrainerInfo_FarCopyData
|
||||||
ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns
|
ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns
|
||||||
ld de, vChars2 + $200
|
ld de, vChars2 + $200
|
||||||
ld bc, $0400
|
ld bc, $400
|
||||||
ld a, $03
|
ld a, $03
|
||||||
call FarCopyData2
|
call FarCopyData2
|
||||||
ld hl, TextBoxGraphics
|
ld hl, TextBoxGraphics
|
||||||
ld de, $00d0
|
ld de, $d0
|
||||||
add hl, de ; hl = colon tile pattern
|
add hl, de ; hl = colon tile pattern
|
||||||
ld de, vChars1 + $560
|
ld de, vChars1 + $560
|
||||||
ld bc, $0010
|
ld bc, $10
|
||||||
ld a, $04
|
ld a, $04
|
||||||
push bc
|
push bc
|
||||||
call FarCopyData2
|
call FarCopyData2
|
||||||
|
|
|
@ -317,7 +317,7 @@ DrawPlayerCharacter:
|
||||||
xor a
|
xor a
|
||||||
ld [wPlayerCharacterOAMTile], a
|
ld [wPlayerCharacterOAMTile], a
|
||||||
ld hl, wOAMBuffer
|
ld hl, wOAMBuffer
|
||||||
ld de, $605a
|
lb de, $60, $5a
|
||||||
ld b, 7
|
ld b, 7
|
||||||
.loop
|
.loop
|
||||||
push de
|
push de
|
||||||
|
|
|
@ -133,8 +133,7 @@ LoadMapSpriteTilePatterns:
|
||||||
jr nc, .fourTileSpriteVRAMAddr
|
jr nc, .fourTileSpriteVRAMAddr
|
||||||
ld d, a
|
ld d, a
|
||||||
dec d
|
dec d
|
||||||
; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM
|
; vSprites += [hVRAMSlot] * $C0 (the number of bytes in 12 tiles)
|
||||||
; slot and adding the result to $8000 (the VRAM base address).
|
|
||||||
.calculateVRAMAddrLoop
|
.calculateVRAMAddrLoop
|
||||||
add hl, bc
|
add hl, bc
|
||||||
dec d
|
dec d
|
||||||
|
|
|
@ -16,10 +16,10 @@ LoadWildData::
|
||||||
jr z, .NoGrassData ; if no grass data, skip to surfing data
|
jr z, .NoGrassData ; if no grass data, skip to surfing data
|
||||||
push hl
|
push hl
|
||||||
ld de, wGrassMons ; otherwise, load grass data
|
ld de, wGrassMons ; otherwise, load grass data
|
||||||
ld bc, $0014
|
ld bc, $14
|
||||||
call CopyData
|
call CopyData
|
||||||
pop hl
|
pop hl
|
||||||
ld bc, $0014
|
ld bc, $14
|
||||||
add hl, bc
|
add hl, bc
|
||||||
.NoGrassData
|
.NoGrassData
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
|
@ -27,7 +27,7 @@ LoadWildData::
|
||||||
and a
|
and a
|
||||||
ret z ; if no water data, we're done
|
ret z ; if no water data, we're done
|
||||||
ld de, wWaterMons ; otherwise, load surfing data
|
ld de, wWaterMons ; otherwise, load surfing data
|
||||||
ld bc, $0014
|
ld bc, $14
|
||||||
jp CopyData
|
jp CopyData
|
||||||
|
|
||||||
INCLUDE "data/wild/grass_water.asm"
|
INCLUDE "data/wild/grass_water.asm"
|
||||||
|
|
|
@ -254,7 +254,7 @@ PrintStatsBox:
|
||||||
ld c, 8
|
ld c, 8
|
||||||
call TextBoxBorder ; Draws the box
|
call TextBoxBorder ; Draws the box
|
||||||
coord hl, 1, 9 ; Start printing stats from here
|
coord hl, 1, 9 ; Start printing stats from here
|
||||||
ld bc, $0019 ; Number offset
|
ld bc, $19 ; Number offset
|
||||||
jr .PrintStats
|
jr .PrintStats
|
||||||
.DifferentBox
|
.DifferentBox
|
||||||
coord hl, 9, 2
|
coord hl, 9, 2
|
||||||
|
@ -262,7 +262,7 @@ PrintStatsBox:
|
||||||
ld c, 9
|
ld c, 9
|
||||||
call TextBoxBorder
|
call TextBoxBorder
|
||||||
coord hl, 11, 3
|
coord hl, 11, 3
|
||||||
ld bc, $0018
|
ld bc, $18
|
||||||
.PrintStats
|
.PrintStats
|
||||||
push bc
|
push bc
|
||||||
push hl
|
push hl
|
||||||
|
|
|
@ -31,7 +31,7 @@ PromptUserToPlaySlots:
|
||||||
xor a
|
xor a
|
||||||
ld [wSlotMachineAllowMatchesCounter], a
|
ld [wSlotMachineAllowMatchesCounter], a
|
||||||
ld hl, wStoppingWhichSlotMachineWheel
|
ld hl, wStoppingWhichSlotMachineWheel
|
||||||
ld bc, $0014
|
ld bc, $14
|
||||||
call FillMemory
|
call FillMemory
|
||||||
call MainSlotMachineLoop
|
call MainSlotMachineLoop
|
||||||
ld hl, wd730
|
ld hl, wd730
|
||||||
|
|
|
@ -41,8 +41,8 @@ rLCDC_DEFAULT EQU %11100011
|
||||||
|
|
||||||
ld sp, wStack
|
ld sp, wStack
|
||||||
|
|
||||||
ld hl, $c000 ; start of WRAM
|
ld hl, WRAM0_Begin
|
||||||
ld bc, $2000 ; size of WRAM
|
ld bc, WRAM1_End - WRAM0_Begin
|
||||||
.loop
|
.loop
|
||||||
ld [hl], 0
|
ld [hl], 0
|
||||||
inc hl
|
inc hl
|
||||||
|
@ -53,8 +53,8 @@ rLCDC_DEFAULT EQU %11100011
|
||||||
|
|
||||||
call ClearVram
|
call ClearVram
|
||||||
|
|
||||||
ld hl, $ff80 ; start of HRAM
|
ld hl, HRAM_Begin
|
||||||
ld bc, $ffff - $ff80 ; size of HRAM
|
ld bc, HRAM_End - HRAM_Begin
|
||||||
call FillMemory
|
call FillMemory
|
||||||
|
|
||||||
call ClearSprites
|
call ClearSprites
|
||||||
|
@ -119,8 +119,8 @@ rLCDC_DEFAULT EQU %11100011
|
||||||
jp SetDefaultNamesBeforeTitlescreen
|
jp SetDefaultNamesBeforeTitlescreen
|
||||||
|
|
||||||
ClearVram::
|
ClearVram::
|
||||||
ld hl, $8000
|
ld hl, VRAM_Begin
|
||||||
ld bc, $2000
|
ld bc, VRAM_End - VRAM_Begin
|
||||||
xor a
|
xor a
|
||||||
jp FillMemory
|
jp FillMemory
|
||||||
|
|
||||||
|
|
|
@ -454,7 +454,7 @@ PrintListMenuEntries::
|
||||||
ld [wLoadedMonLevel], a
|
ld [wLoadedMonLevel], a
|
||||||
.skipCopyingLevel
|
.skipCopyingLevel
|
||||||
pop hl
|
pop hl
|
||||||
ld bc, $001c
|
ld bc, $1c
|
||||||
add hl, bc
|
add hl, bc
|
||||||
call PrintLevel
|
call PrintLevel
|
||||||
pop af
|
pop af
|
||||||
|
|
|
@ -77,7 +77,7 @@ GetName::
|
||||||
ld h, d
|
ld h, d
|
||||||
ld l, e
|
ld l, e
|
||||||
ld de, wcd6d
|
ld de, wcd6d
|
||||||
ld bc, $0014
|
ld bc, $14
|
||||||
call CopyData
|
call CopyData
|
||||||
.gotPtr
|
.gotPtr
|
||||||
ld a, e
|
ld a, e
|
||||||
|
|
|
@ -1424,18 +1424,18 @@ LoadCurrentMapView::
|
||||||
dec b
|
dec b
|
||||||
jr nz, .rowLoop
|
jr nz, .rowLoop
|
||||||
ld hl, wTileMapBackup
|
ld hl, wTileMapBackup
|
||||||
ld bc, $0000
|
ld bc, $0
|
||||||
.adjustForYCoordWithinTileBlock
|
.adjustForYCoordWithinTileBlock
|
||||||
ld a, [wYBlockCoord]
|
ld a, [wYBlockCoord]
|
||||||
and a
|
and a
|
||||||
jr z, .adjustForXCoordWithinTileBlock
|
jr z, .adjustForXCoordWithinTileBlock
|
||||||
ld bc, $0030
|
ld bc, $30
|
||||||
add hl, bc
|
add hl, bc
|
||||||
.adjustForXCoordWithinTileBlock
|
.adjustForXCoordWithinTileBlock
|
||||||
ld a, [wXBlockCoord]
|
ld a, [wXBlockCoord]
|
||||||
and a
|
and a
|
||||||
jr z, .copyToVisibleAreaBuffer
|
jr z, .copyToVisibleAreaBuffer
|
||||||
ld bc, $0002
|
ld bc, $2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
.copyToVisibleAreaBuffer
|
.copyToVisibleAreaBuffer
|
||||||
coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank
|
coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank
|
||||||
|
@ -1739,7 +1739,7 @@ ScheduleSouthRowRedraw::
|
||||||
ld l, a
|
ld l, a
|
||||||
ld a, [wMapViewVRAMPointer + 1]
|
ld a, [wMapViewVRAMPointer + 1]
|
||||||
ld h, a
|
ld h, a
|
||||||
ld bc, $0200
|
ld bc, $200
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, h
|
ld a, h
|
||||||
and $03
|
and $03
|
||||||
|
@ -1835,7 +1835,7 @@ DrawTileBlock::
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
inc de
|
inc de
|
||||||
ld bc, $0015
|
ld bc, $15
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
dec c
|
dec c
|
||||||
|
@ -2180,7 +2180,7 @@ LoadMapHeader::
|
||||||
jr nz, .zeroSpriteDataLoop
|
jr nz, .zeroSpriteDataLoop
|
||||||
; initialize all C100-C1FF sprite entries to disabled (other than player's)
|
; initialize all C100-C1FF sprite entries to disabled (other than player's)
|
||||||
ld hl, wSpriteStateData1 + $12
|
ld hl, wSpriteStateData1 + $12
|
||||||
ld de, $0010
|
ld de, $10
|
||||||
ld c, $0f
|
ld c, $0f
|
||||||
.disableSpriteEntriesLoop
|
.disableSpriteEntriesLoop
|
||||||
ld [hl], $ff
|
ld [hl], $ff
|
||||||
|
|
|
@ -93,7 +93,7 @@ LoadUncompressedSpriteData::
|
||||||
add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes)
|
add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes)
|
||||||
ld [hSpriteOffset], a
|
ld [hSpriteOffset], a
|
||||||
xor a
|
xor a
|
||||||
ld [$4000], a
|
ld [MBC1SRamBank], a
|
||||||
ld hl, sSpriteBuffer0
|
ld hl, sSpriteBuffer0
|
||||||
call ZeroSpriteBuffer ; zero buffer 0
|
call ZeroSpriteBuffer ; zero buffer 0
|
||||||
ld de, sSpriteBuffer1
|
ld de, sSpriteBuffer1
|
||||||
|
@ -151,7 +151,7 @@ ZeroSpriteBuffer::
|
||||||
; de: output address
|
; de: output address
|
||||||
InterlaceMergeSpriteBuffers::
|
InterlaceMergeSpriteBuffers::
|
||||||
xor a
|
xor a
|
||||||
ld [$4000], a
|
ld [MBC1SRamBank], a
|
||||||
push de
|
push de
|
||||||
ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
|
ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
|
||||||
ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
|
ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
|
||||||
|
|
|
@ -119,7 +119,7 @@ CloseTextDisplay::
|
||||||
; loop to make sprites face the directions they originally faced before the dialogue
|
; loop to make sprites face the directions they originally faced before the dialogue
|
||||||
ld hl, wSpriteStateData2 + $19
|
ld hl, wSpriteStateData2 + $19
|
||||||
ld c, $0f
|
ld c, $0f
|
||||||
ld de, $0010
|
ld de, $10
|
||||||
.restoreSpriteFacingDirectionLoop
|
.restoreSpriteFacingDirectionLoop
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
dec h
|
dec h
|
||||||
|
|
|
@ -183,7 +183,7 @@ ENDM
|
||||||
;\3, \4, ... = additional (optional) event indices
|
;\3, \4, ... = additional (optional) event indices
|
||||||
SetEvents: MACRO
|
SetEvents: MACRO
|
||||||
SetEvent \1
|
SetEvent \1
|
||||||
rept (_NARG + -1)
|
rept _NARG - 1
|
||||||
SetEventReuseHL \2
|
SetEventReuseHL \2
|
||||||
shift
|
shift
|
||||||
endr
|
endr
|
||||||
|
@ -235,7 +235,7 @@ ENDM
|
||||||
;\3 = event index (optional)
|
;\3 = event index (optional)
|
||||||
ResetEvents: MACRO
|
ResetEvents: MACRO
|
||||||
ResetEvent \1
|
ResetEvent \1
|
||||||
rept (_NARG + -1)
|
rept _NARG - 1
|
||||||
ResetEventReuseHL \2
|
ResetEventReuseHL \2
|
||||||
shift
|
shift
|
||||||
endr
|
endr
|
||||||
|
@ -283,7 +283,7 @@ event_fill_start = event_start_byte + 1
|
||||||
event_fill_count = event_end_byte - event_start_byte - 1
|
event_fill_count = event_end_byte - event_start_byte - 1
|
||||||
|
|
||||||
IF ((\1) % 8) == 0
|
IF ((\1) % 8) == 0
|
||||||
event_fill_start = event_fill_start + -1
|
event_fill_start = event_fill_start - 1
|
||||||
event_fill_count = event_fill_count + 1
|
event_fill_count = event_fill_count + 1
|
||||||
ELSE
|
ELSE
|
||||||
ld a, [wEventFlags + event_start_byte]
|
ld a, [wEventFlags + event_start_byte]
|
||||||
|
@ -304,7 +304,7 @@ event_fill_count = event_fill_count + 1
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
ld hl, wEventFlags + event_fill_start
|
ld hl, wEventFlags + event_fill_start
|
||||||
|
|
||||||
REPT event_fill_count + -1
|
REPT event_fill_count - 1
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ENDR
|
ENDR
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ event_fill_start = event_start_byte + 1
|
||||||
event_fill_count = event_end_byte - event_start_byte - 1
|
event_fill_count = event_end_byte - event_start_byte - 1
|
||||||
|
|
||||||
IF ((\1) % 8) == 0
|
IF ((\1) % 8) == 0
|
||||||
event_fill_start = event_fill_start + -1
|
event_fill_start = event_fill_start - 1
|
||||||
event_fill_count = event_fill_count + 1
|
event_fill_count = event_fill_count + 1
|
||||||
ELSE
|
ELSE
|
||||||
ld a, [wEventFlags + event_start_byte]
|
ld a, [wEventFlags + event_start_byte]
|
||||||
|
@ -370,7 +370,7 @@ event_fill_count = event_fill_count + 1
|
||||||
xor a
|
xor a
|
||||||
ENDC
|
ENDC
|
||||||
|
|
||||||
REPT event_fill_count + -1
|
REPT event_fill_count - 1
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ENDR
|
ENDR
|
||||||
|
|
||||||
|
|
92
macros/wram.asm
Normal file
92
macros/wram.asm
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
; Used in wram.asm
|
||||||
|
|
||||||
|
flag_array: MACRO
|
||||||
|
ds ((\1) + 7) / 8
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2
|
||||||
|
|
||||||
|
box_struct: MACRO
|
||||||
|
\1Species:: db
|
||||||
|
\1HP:: dw
|
||||||
|
\1BoxLevel:: db
|
||||||
|
\1Status:: db
|
||||||
|
\1Type::
|
||||||
|
\1Type1:: db
|
||||||
|
\1Type2:: db
|
||||||
|
\1CatchRate:: db
|
||||||
|
\1Moves:: ds NUM_MOVES
|
||||||
|
\1OTID:: dw
|
||||||
|
\1Exp:: ds 3
|
||||||
|
\1HPExp:: dw
|
||||||
|
\1AttackExp:: dw
|
||||||
|
\1DefenseExp:: dw
|
||||||
|
\1SpeedExp:: dw
|
||||||
|
\1SpecialExp:: dw
|
||||||
|
\1DVs:: ds 2
|
||||||
|
\1PP:: ds NUM_MOVES
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
party_struct: MACRO
|
||||||
|
box_struct \1
|
||||||
|
\1Level:: db
|
||||||
|
\1Stats::
|
||||||
|
\1MaxHP:: dw
|
||||||
|
\1Attack:: dw
|
||||||
|
\1Defense:: dw
|
||||||
|
\1Speed:: dw
|
||||||
|
\1Special:: dw
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
battle_struct: MACRO
|
||||||
|
\1Species:: db
|
||||||
|
\1HP:: dw
|
||||||
|
\1PartyPos::
|
||||||
|
\1BoxLevel:: db
|
||||||
|
\1Status:: db
|
||||||
|
\1Type::
|
||||||
|
\1Type1:: db
|
||||||
|
\1Type2:: db
|
||||||
|
\1CatchRate:: db
|
||||||
|
\1Moves:: ds NUM_MOVES
|
||||||
|
\1DVs:: ds 2
|
||||||
|
\1Level:: db
|
||||||
|
\1Stats::
|
||||||
|
\1MaxHP:: dw
|
||||||
|
\1Attack:: dw
|
||||||
|
\1Defense:: dw
|
||||||
|
\1Speed:: dw
|
||||||
|
\1Special:: dw
|
||||||
|
\1PP:: ds NUM_MOVES
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
spritestatedata1: MACRO
|
||||||
|
\1PictureID:: db
|
||||||
|
\1MovementStatus:: db
|
||||||
|
\1ImageIndex:: db
|
||||||
|
\1YStepVector:: db
|
||||||
|
\1YPixels:: db
|
||||||
|
\1XStepVector:: db
|
||||||
|
\1XPixels:: db
|
||||||
|
\1IntraAnimFrameCounter:: db
|
||||||
|
\1AnimFrameCounter:: db
|
||||||
|
\1FacingDirection:: db
|
||||||
|
ds 6
|
||||||
|
\1End::
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
spritestatedata2: MACRO
|
||||||
|
\1WalkAnimationCounter:: db
|
||||||
|
ds 1
|
||||||
|
\1YDisplacement:: db
|
||||||
|
\1XDisplacement:: db
|
||||||
|
\1MapY:: db
|
||||||
|
\1MapX:: db
|
||||||
|
\1MovementByte1:: db
|
||||||
|
\1GrassPriority:: db
|
||||||
|
\1MovementDelay:: db
|
||||||
|
ds 5
|
||||||
|
\1ImageBaseOffset:: db
|
||||||
|
ds 1
|
||||||
|
\1End::
|
||||||
|
ENDM
|
|
@ -652,7 +652,7 @@ OaksLabScript18:
|
||||||
|
|
||||||
OaksLabScript_RemoveParcel:
|
OaksLabScript_RemoveParcel:
|
||||||
ld hl, wBagItems
|
ld hl, wBagItems
|
||||||
ld bc, $0000
|
ld bc, 0
|
||||||
.loop
|
.loop
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
cp $ff
|
cp $ff
|
||||||
|
|
|
@ -78,7 +78,7 @@ VermilionDock_1db9b:
|
||||||
ld d, $0
|
ld d, $0
|
||||||
ld e, $8
|
ld e, $8
|
||||||
.asm_1dbfa
|
.asm_1dbfa
|
||||||
ld hl, $0002
|
ld hl, $2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [wMapViewVRAMPointer], a
|
ld [wMapViewVRAMPointer], a
|
||||||
|
|
94
wram.asm
94
wram.asm
|
@ -1,63 +1,6 @@
|
||||||
INCLUDE "constants.asm"
|
INCLUDE "constants.asm"
|
||||||
|
|
||||||
flag_array: MACRO
|
INCLUDE "macros/wram.asm"
|
||||||
ds ((\1) + 7) / 8
|
|
||||||
ENDM
|
|
||||||
|
|
||||||
box_struct_length EQU 25 + NUM_MOVES * 2
|
|
||||||
box_struct: MACRO
|
|
||||||
\1Species:: db
|
|
||||||
\1HP:: dw
|
|
||||||
\1BoxLevel:: db
|
|
||||||
\1Status:: db
|
|
||||||
\1Type::
|
|
||||||
\1Type1:: db
|
|
||||||
\1Type2:: db
|
|
||||||
\1CatchRate:: db
|
|
||||||
\1Moves:: ds NUM_MOVES
|
|
||||||
\1OTID:: dw
|
|
||||||
\1Exp:: ds 3
|
|
||||||
\1HPExp:: dw
|
|
||||||
\1AttackExp:: dw
|
|
||||||
\1DefenseExp:: dw
|
|
||||||
\1SpeedExp:: dw
|
|
||||||
\1SpecialExp:: dw
|
|
||||||
\1DVs:: ds 2
|
|
||||||
\1PP:: ds NUM_MOVES
|
|
||||||
ENDM
|
|
||||||
|
|
||||||
party_struct: MACRO
|
|
||||||
box_struct \1
|
|
||||||
\1Level:: db
|
|
||||||
\1Stats::
|
|
||||||
\1MaxHP:: dw
|
|
||||||
\1Attack:: dw
|
|
||||||
\1Defense:: dw
|
|
||||||
\1Speed:: dw
|
|
||||||
\1Special:: dw
|
|
||||||
ENDM
|
|
||||||
|
|
||||||
battle_struct: MACRO
|
|
||||||
\1Species:: db
|
|
||||||
\1HP:: dw
|
|
||||||
\1PartyPos::
|
|
||||||
\1BoxLevel:: db
|
|
||||||
\1Status:: db
|
|
||||||
\1Type::
|
|
||||||
\1Type1:: db
|
|
||||||
\1Type2:: db
|
|
||||||
\1CatchRate:: db
|
|
||||||
\1Moves:: ds NUM_MOVES
|
|
||||||
\1DVs:: ds 2
|
|
||||||
\1Level:: db
|
|
||||||
\1Stats::
|
|
||||||
\1MaxHP:: dw
|
|
||||||
\1Attack:: dw
|
|
||||||
\1Defense:: dw
|
|
||||||
\1Speed:: dw
|
|
||||||
\1Special:: dw
|
|
||||||
\1PP:: ds NUM_MOVES
|
|
||||||
ENDM
|
|
||||||
|
|
||||||
|
|
||||||
SECTION "WRAM Bank 0", WRAM0
|
SECTION "WRAM Bank 0", WRAM0
|
||||||
|
@ -228,21 +171,6 @@ wSpriteStateData1::
|
||||||
; C1xD
|
; C1xD
|
||||||
; C1xE
|
; C1xE
|
||||||
; C1xF
|
; C1xF
|
||||||
spritestatedata1: MACRO
|
|
||||||
\1PictureID:: db
|
|
||||||
\1MovementStatus:: db
|
|
||||||
\1ImageIndex:: db
|
|
||||||
\1YStepVector:: db
|
|
||||||
\1YPixels:: db
|
|
||||||
\1XStepVector:: db
|
|
||||||
\1XPixels:: db
|
|
||||||
\1IntraAnimFrameCounter:: db
|
|
||||||
\1AnimFrameCounter:: db
|
|
||||||
\1FacingDirection:: db
|
|
||||||
ds 6
|
|
||||||
\1End::
|
|
||||||
endm
|
|
||||||
|
|
||||||
wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1
|
wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1
|
||||||
wSprite01StateData1:: spritestatedata1 wSprite01StateData1
|
wSprite01StateData1:: spritestatedata1 wSprite01StateData1
|
||||||
wSprite02StateData1:: spritestatedata1 wSprite02StateData1
|
wSprite02StateData1:: spritestatedata1 wSprite02StateData1
|
||||||
|
@ -280,22 +208,6 @@ wSpriteStateData2::
|
||||||
; C2xD
|
; C2xD
|
||||||
; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2)
|
; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2)
|
||||||
; C2xF
|
; C2xF
|
||||||
spritestatedata2: MACRO
|
|
||||||
\1WalkAnimationCounter:: db
|
|
||||||
ds 1
|
|
||||||
\1YDisplacement:: db
|
|
||||||
\1XDisplacement:: db
|
|
||||||
\1MapY:: db
|
|
||||||
\1MapX:: db
|
|
||||||
\1MovementByte1:: db
|
|
||||||
\1GrassPriority:: db
|
|
||||||
\1MovementDelay:: db
|
|
||||||
ds 5
|
|
||||||
\1ImageBaseOffset:: db
|
|
||||||
ds 1
|
|
||||||
\1End::
|
|
||||||
endm
|
|
||||||
|
|
||||||
wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2
|
wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2
|
||||||
wSprite01StateData2:: spritestatedata2 wSprite01StateData2
|
wSprite01StateData2:: spritestatedata2 wSprite01StateData2
|
||||||
wSprite02StateData2:: spritestatedata2 wSprite02StateData2
|
wSprite02StateData2:: spritestatedata2 wSprite02StateData2
|
||||||
|
@ -1050,7 +962,7 @@ wOptionsCancelCursorX::
|
||||||
ds 1
|
ds 1
|
||||||
|
|
||||||
wDayCarePerLevelCost::
|
wDayCarePerLevelCost::
|
||||||
; 2-byte BCD number (always set to $0100)
|
; 2-byte BCD number (always set to $100)
|
||||||
|
|
||||||
wHoFTeamIndex2::
|
wHoFTeamIndex2::
|
||||||
|
|
||||||
|
@ -3185,7 +3097,7 @@ wBoxSpecies:: ds MONS_PER_BOX + 1
|
||||||
|
|
||||||
wBoxMons::
|
wBoxMons::
|
||||||
wBoxMon1:: box_struct wBoxMon1
|
wBoxMon1:: box_struct wBoxMon1
|
||||||
wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1)
|
wBoxMon2:: ds BOX_STRUCT_LENGTH * (MONS_PER_BOX - 1)
|
||||||
|
|
||||||
wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX
|
wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX
|
||||||
wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX
|
wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX
|
||||||
|
|
Loading…
Reference in a new issue