Harmonize home/ with pokegold

This commit is contained in:
Rangi 2020-06-16 15:49:32 -04:00
parent 7b2515d1e4
commit c552390a15
11 changed files with 49 additions and 42 deletions

View File

@ -211,7 +211,7 @@
; Japanese control characters (see home/text.asm) ; Japanese control characters (see home/text.asm)
charmap "<JP_18>", $18 ; "ノ゛"? (ungrammatical) charmap "<JP_18>", $18 ; "ノ゛" (ungrammatical)
charmap "<NI>", $1d ; "に " charmap "<NI>", $1d ; "に "
charmap "<TTE>", $1e ; "って" charmap "<TTE>", $1e ; "って"
charmap "<WO>", $1f ; "を " charmap "<WO>", $1f ; "を "

View File

@ -16,13 +16,13 @@ GameTimer::
ld a, BANK(wGameTime) ld a, BANK(wGameTime)
ldh [rSVBK], a ldh [rSVBK], a
call UpdateGameTimer call .Function
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
ret ret
UpdateGameTimer:: .Function
; Increment the game timer by one frame. ; Increment the game timer by one frame.
; The game timer is capped at 999:59:59.00. ; The game timer is capped at 999:59:59.00.

View File

@ -1,4 +1,5 @@
; Functions to copy data from ROM. TILES_PER_CYCLE EQU 8
MOBILE_TILES_PER_CYCLE EQU 6
Get2bppViaHDMA:: Get2bppViaHDMA::
ldh a, [rLCDC] ldh a, [rLCDC]
@ -31,7 +32,7 @@ FarCopyBytesDouble_DoubleBankSwitch::
rst Bankswitch rst Bankswitch
ret ret
UnreferencedOldDMATransfer: Unreferenced_DMATransfer:
dec c dec c
ldh a, [hBGMapMode] ldh a, [hBGMapMode]
push af push af
@ -55,12 +56,12 @@ UnreferencedOldDMATransfer:
ld a, l ld a, l
and $f0 and $f0
ldh [rHDMA4], a ; target LSB ldh [rHDMA4], a ; target LSB
; stop when c < 8 ; stop when c < TILES_PER_CYCLE
ld a, c ld a, c
cp $8 cp TILES_PER_CYCLE
jr c, .done jr c, .done
; decrease c by 8 ; decrease c by TILES_PER_CYCLE
sub $8 sub TILES_PER_CYCLE
ld c, a ld c, a
; DMA transfer state ; DMA transfer state
ld a, $f ld a, $f
@ -198,7 +199,7 @@ Request2bpp::
ldh a, [hTilesPerCycle] ldh a, [hTilesPerCycle]
push af push af
ld a, $8 ld a, TILES_PER_CYCLE
ldh [hTilesPerCycle], a ldh [hTilesPerCycle], a
ld a, [wLinkMode] ld a, [wLinkMode]
@ -207,7 +208,7 @@ Request2bpp::
ldh a, [hMobile] ldh a, [hMobile]
and a and a
jr nz, .NotMobile jr nz, .NotMobile
ld a, $6 ld a, MOBILE_TILES_PER_CYCLE
ldh [hTilesPerCycle], a ldh [hTilesPerCycle], a
.NotMobile: .NotMobile:
@ -223,7 +224,7 @@ Request2bpp::
ld a, c ld a, c
ld hl, hTilesPerCycle ld hl, hTilesPerCycle
cp [hl] cp [hl]
jr nc, .iterate jr nc, .cycle
ld [wRequested2bpp], a ld [wRequested2bpp], a
.wait .wait
@ -242,7 +243,7 @@ Request2bpp::
ldh [hBGMapMode], a ldh [hBGMapMode], a
ret ret
.iterate .cycle
ldh a, [hTilesPerCycle] ldh a, [hTilesPerCycle]
ld [wRequested2bpp], a ld [wRequested2bpp], a
@ -272,7 +273,7 @@ Request1bpp::
ldh a, [hTilesPerCycle] ldh a, [hTilesPerCycle]
push af push af
ld a, $8 ld a, TILES_PER_CYCLE
ldh [hTilesPerCycle], a ldh [hTilesPerCycle], a
ld a, [wLinkMode] ld a, [wLinkMode]
@ -281,7 +282,7 @@ Request1bpp::
ldh a, [hMobile] ldh a, [hMobile]
and a and a
jr nz, .NotMobile jr nz, .NotMobile
ld a, $6 ld a, MOBILE_TILES_PER_CYCLE
ldh [hTilesPerCycle], a ldh [hTilesPerCycle], a
.NotMobile: .NotMobile:
@ -297,7 +298,7 @@ Request1bpp::
ld a, c ld a, c
ld hl, hTilesPerCycle ld hl, hTilesPerCycle
cp [hl] cp [hl]
jr nc, .iterate jr nc, .cycle
ld [wRequested1bpp], a ld [wRequested1bpp], a
.wait .wait
@ -316,7 +317,7 @@ Request1bpp::
ldh [hBGMapMode], a ldh [hBGMapMode], a
ret ret
.iterate .cycle
ldh a, [hTilesPerCycle] ldh a, [hTilesPerCycle]
ld [wRequested1bpp], a ld [wRequested1bpp], a
@ -348,7 +349,7 @@ Copy2bpp:
; bank ; bank
ld a, b ld a, b
; bc = c * $10 ; bc = c * LEN_2BPP_TILE
push af push af
swap c swap c
ld a, $f ld a, $f
@ -376,7 +377,7 @@ Copy1bpp::
; bank ; bank
ld a, b ld a, b
; bc = c * $10 / 2 ; bc = c * LEN_1BPP_TILE
push af push af
ld h, 0 ld h, 0
ld l, c ld l, c

View File

@ -21,15 +21,15 @@ Reset::
_Start:: _Start::
cp $11 cp $11
jr z, .cgb jr z, .cgb
xor a xor a ; FALSE
jr .load jr .load
.cgb .cgb
ld a, $1 ld a, TRUE
.load .load
ldh [hCGB], a ldh [hCGB], a
ld a, $1 ld a, TRUE
ldh [hSystemBooted], a ldh [hSystemBooted], a
Init:: Init::
@ -74,7 +74,7 @@ Init::
or c or c
jr nz, .ByteFill jr nz, .ByteFill
ld sp, wStack ld sp, wStackTop
; Clear HRAM ; Clear HRAM
ldh a, [hCGB] ldh a, [hCGB]
@ -97,7 +97,7 @@ Init::
call ClearSprites call ClearSprites
call ClearsScratch call ClearsScratch
ld a, BANK(GameInit) ; aka BANK(WriteOAMDMACodeToHRAM) ld a, BANK(WriteOAMDMACodeToHRAM) ; aka BANK(GameInit)
rst Bankswitch rst Bankswitch
call WriteOAMDMACodeToHRAM call WriteOAMDMACodeToHRAM
@ -142,7 +142,7 @@ Init::
farcall StartClock farcall StartClock
xor a xor a ; SRAM_DISABLE
ld [MBC3LatchClock], a ld [MBC3LatchClock], a
ld [MBC3SRamEnable], a ld [MBC3SRamEnable], a
@ -160,7 +160,7 @@ Init::
call DelayFrame call DelayFrame
predef InitSGBBorder ; SGB init predef InitSGBBorder
call InitSound call InitSound
xor a xor a

View File

@ -15,7 +15,7 @@ LCD::
and a and a
jr z, .done jr z, .done
; At this point it's assumed we're in WRAM bank 5! ; At this point it's assumed we're in BANK(wLYOverrides)!
push bc push bc
ldh a, [rLY] ldh a, [rLY]
ld c, a ld c, a

View File

@ -116,8 +116,8 @@ RestoreTileBackup::
ret ret
PopWindow:: PopWindow::
ld b, $10 ld b, wMenuHeaderEnd - wMenuHeader
ld de, wMenuFlags ld de, wMenuHeader
.loop .loop
ld a, [hld] ld a, [hld]
ld [de], a ld [de], a
@ -148,8 +148,8 @@ CopyMenuData::
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld de, wMenuDataFlags ld de, wMenuData
ld bc, wMenuDataEnd - wMenuDataFlags ld bc, wMenuDataEnd - wMenuData
call CopyBytes call CopyBytes
pop af pop af
pop bc pop bc

View File

@ -81,6 +81,7 @@ DmgToCgbBGPals::
push hl push hl
push de push de
push bc push bc
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
@ -102,6 +103,7 @@ DmgToCgbBGPals::
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
pop bc pop bc
pop de pop de
pop hl pop hl
@ -127,6 +129,7 @@ DmgToCgbObjPals::
push hl push hl
push de push de
push bc push bc
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
@ -148,6 +151,7 @@ DmgToCgbObjPals::
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
pop bc pop bc
pop de pop de
pop hl pop hl

View File

@ -15,7 +15,7 @@ _CheckTrainerBattle::
; Skip the player object. ; Skip the player object.
ld a, 1 ld a, 1
ld de, wMapObjects + MAPOBJECT_LENGTH ld de, wMap1Object
.loop .loop

View File

@ -184,8 +184,8 @@ VBlank1::
call Serve2bppRequest_VBlank call Serve2bppRequest_VBlank
call hTransferVirtualOAM call hTransferVirtualOAM
.done
.done
xor a xor a
ld [wVBlankOccurred], a ld [wVBlankOccurred], a

View File

@ -31,8 +31,9 @@ UpdateBGMapBuffer::
ldh a, [rVBK] ldh a, [rVBK]
push af push af
ld [hSPBuffer], sp
; Relocate the stack pointer to wBGMapBufferPtrs
ld [hSPBuffer], sp
ld hl, wBGMapBufferPtrs ld hl, wBGMapBufferPtrs
ld sp, hl ld sp, hl
@ -80,6 +81,7 @@ endr
jr nz, .next jr nz, .next
; Restore the stack pointer
ldh a, [hSPBuffer] ldh a, [hSPBuffer]
ld l, a ld l, a
ldh a, [hSPBuffer + 1] ldh a, [hSPBuffer + 1]

View File

@ -242,14 +242,14 @@ link_battle_record: MACRO
ENDM ENDM
trademon: MACRO trademon: MACRO
\1Species:: db ; wc6d0 | wc702 \1Species:: db
\1SpeciesName:: ds MON_NAME_LENGTH ; wc6d1 | wc703 \1SpeciesName:: ds MON_NAME_LENGTH
\1Nickname:: ds MON_NAME_LENGTH ; wc6dc | wc70e \1Nickname:: ds MON_NAME_LENGTH
\1SenderName:: ds NAME_LENGTH ; wc6e7 | wc719 \1SenderName:: ds NAME_LENGTH
\1OTName:: ds NAME_LENGTH ; wc6f2 | wc724 \1OTName:: ds NAME_LENGTH
\1DVs:: dw ; wc6fd | wc72f \1DVs:: dw
\1ID:: dw ; wc6ff | wc731 \1ID:: dw
\1CaughtData:: db ; wc701 | wc733 \1CaughtData:: db
\1End:: \1End::
ENDM ENDM