diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | data/maps/attributes.asm | 2 | ||||
-rw-r--r-- | engine/Intro.asm | 2 | ||||
-rw-r--r-- | engine/menu/main_menu.asm | 89 | ||||
-rw-r--r-- | pokegold-spaceworld.link | 6 | ||||
-rw-r--r-- | shim.sym | 22 | ||||
-rw-r--r-- | tools/fix_sections.py | 2 | ||||
-rw-r--r-- | wram.asm | 14 | ||||
-rw-r--r-- | zero_checksum.asm (renamed from zero_checksum.inc) | 0 |
10 files changed, 121 insertions, 19 deletions
@@ -23,6 +23,7 @@ shim.asm tools/scan_includes tools/pkmncompress tools/gfx +tools/fix_sections_directory.py *.exe *.pyc @@ -64,7 +64,7 @@ linkerscript: $(ROM:.gb=-gen.link) %.map: %.gb $(CORRECTEDROM): %-correctheader.gb: %.gb - $(RGBASM) $(RGBASMFLAGS) -o $(BUILD)/zero_checksum.o zero_checksum.inc + $(RGBASM) $(RGBASMFLAGS) -o $(BUILD)/zero_checksum.o zero_checksum.asm $(RGBLINK) -O $< -o $@ $(BUILD)/zero_checksum.o $(RGBFIX) -f hg -m 0x10 $@ cp $(<:.gb=.sym) $(@:.gb=.sym) diff --git a/data/maps/attributes.asm b/data/maps/attributes.asm index cfd58d4..cc8f3de 100644 --- a/data/maps/attributes.asm +++ b/data/maps/attributes.asm @@ -4609,4 +4609,4 @@ BullForestRoute3_MapEvents:: db 0 ; person events -BullForestRoute3_Blocks:: INCBIN "maps/blk/BullForestRoute3.blk" +BullForestRoute3_Blocks:: INCBIN "maps/blk/BullForestRoute3.blk"
\ No newline at end of file diff --git a/engine/Intro.asm b/engine/Intro.asm index 3a60696..04497e4 100644 --- a/engine/Intro.asm +++ b/engine/Intro.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "engine/Intro.asm", ROMX +SECTION "engine/intro.asm", ROMX DemoStart:: ; 558D ld de, OakPic diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 75fd00a..e32aa3d 100644 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -1,6 +1,91 @@ INCLUDE "constants.asm" -SECTION "engine/menu/main_menu.asm", ROMX +SECTION "engine/menu/main_menu.asm@Initialize new game WRAM", ROMX +; TODO: Move this to another file when surrounding +; functions have been disassembled. +InitializeNewGameWRAM: + ld a, [wSGB] + push af + + ; Clear a lot of in-game WRAM. + + ld hl, wVirtualOAM + ld bc, (wcd3f + 1) - wVirtualOAM + xor a + call ByteFill + + ld hl, wPlayerName + ld bc, $1164 + xor a + call ByteFill + + ; Lots of other setup. + + pop af + ld [wSGB], a + + ldh a, [rLY] + ldh [hRTCRandom], a + call DelayFrame + + ldh a, [hRandomSub] + ld [wce73], a + ldh a, [rLY] + ldh [hRTCRandom], a + call DelayFrame + + ldh a, [hRandomAdd] + ld [wce74], a + + ld hl, wPartyCount + call InitializeByteList + ld hl, wUnknownListLengthda83 + call InitializeByteList + ld hl, wNumBagItems + call InitializeByteList + ld hl, wNumKeyItems + call InitializeByteList + ld hl, wUnknownListLengthd1ea + call InitializeByteList + + xor a + ld [wMonType], a + ld [wd163], a + ld [wd164], a + ld [wd15b], a + ld [wd15c], a + ld [wd15d], a + + ld a, $0B + ld [wd15e], a + + ld a, $B8 + ld [wd15f], a + + ld hl, wUnknownListLengthd1ea + ld a, ITEM_REPEL + ld [wCurItem], a + ld a, 1 + ld [wItemQuantity], a + call ReceiveItem + + ld a, MAP_SILENT_HILL + ld [wMapId], a + ld a, GROUP_SILENT_HILL + ld [wMapGroup], a + + ret + +; Initializes a 0xFF-terminated list preceded by a length to +; length 0, with an immediate terminator. +InitializeByteList: + xor a + ld [hli], a + dec a + ld [hl], a + ret + +SECTION "engine/menu/main_menu.asm@MainMenu", ROMX MainMenu:: ; 01:53CC ld hl, wd4a9 @@ -197,7 +282,7 @@ StartNewGame:: ; 555C call LoadFontExtra xor a ldh [hBGMapMode], a - callba Function52f9 + callba InitializeNewGameWRAM call ClearTileMap call ClearWindowData xor a diff --git a/pokegold-spaceworld.link b/pokegold-spaceworld.link index da3d9ef..cbe7e94 100644 --- a/pokegold-spaceworld.link +++ b/pokegold-spaceworld.link @@ -110,9 +110,11 @@ ROMX $01 org $4153 "home/oam_dma.asm" ; $416b + org $52f9 + "engine/menu/main_menu.asm@Initialize new game WRAM" org $53cc - "engine/menu/main_menu.asm" - "engine/Intro.asm" + "engine/menu/main_menu.asm@MainMenu" + "engine/intro.asm" "engine/title.asm@Title screen" "engine/title.asm@Title screen TEMPORARY" "engine/predef.asm" @@ -1,4 +1,16 @@ -; ROMX +; WRAM0 + +00:CB6F wPlayerStepDirection + +01:D19E wItems +; The starting house's map script number is stored at d29a. Others are probably nearby. +01:D1EA wUnknownListLengthd1ea +01:D1EB wUnknownListd1eb +01:D35F wOptions +01:D513 wWarpNumber +01:DA3B wOTPartyMonOT +01:DA83 wUnknownListLengthda83 +01:DA84 wUnknownListda84 01:40FD Function40fd 01:5007 Function5007 @@ -219,14 +231,6 @@ 3F:6755 PicTestMenu.loop 3F:67A1 CallSubGameMenu -00:CB6F wPlayerStepDirection - -01:D19E wItems -; The starting house's map script number is stored at d29a. Others are probably nearby. -01:D35F wOptions -01:D513 wWarpNumber -01:DA3B wOTPartyMonOT - ; Maps 25:4062 Route2Gate1FTextPointers 25:4061 Route2Gate1FScriptLoader diff --git a/tools/fix_sections.py b/tools/fix_sections.py index 3d864ed..dc23f52 100644 --- a/tools/fix_sections.py +++ b/tools/fix_sections.py @@ -42,7 +42,7 @@ TEMP_PATH = fix_sections_directory.TEMP_DIRECTORY for root, dirs, files in os.walk(cwd): for file in files: rel_root = os.path.relpath(root, cwd) - if not rel_root.startswith("build") and not rel_root.startswith("temp") and file.endswith(".asm") and file != "rst.asm" and file != "wram.asm": + if not rel_root.startswith("build") and not rel_root.startswith("temp") and file.endswith(".asm") and file != "rst.asm" and file != "wram.asm" and file != "zero_checksum.asm": canonical_path = os.path.join(root, file) rel_path = os.path.relpath(canonical_path, cwd) with open(canonical_path, "r") as f: @@ -624,6 +624,8 @@ wTimeOfDay:: db ; ce3d ; 02 - Cave 35--50s ; 03 - Morning 06--09h 50--59s +wcd3f: ds 1 + SECTION "CE5F", WRAM0[$CE5F] wce5f:: ; ce5f ; debug menu writes $41 to it @@ -647,7 +649,11 @@ wPlayerName:: ds 6 ; ce67 wMomsName:: ds 6 ; ce6d -SECTION "CE7F", WRAM0[$CE76] +SECTION "CE73", WRAM0[$CE73] + +wce73: ds 1 ; ce73 +wce74: ds 1 ; ce74 +wce75: ds 1 ; ce75 wObjectFollow_Leader:: ; ce76 db @@ -732,7 +738,11 @@ wTimeOfDayPalset:: db ; d158 wCurTimeOfDay:: db ; d159 -SECTION "D15D", WRAM0[$D15D] +SECTION "D15B", WRAM0[$D15B] + +wd15b:: db ; d15b + +wd15c:: db ; d15c wd15d:: db ; d15d diff --git a/zero_checksum.inc b/zero_checksum.asm index c35e834..c35e834 100644 --- a/zero_checksum.inc +++ b/zero_checksum.asm |