From 4ad0bda0f5b60b187908ff6bc0dee20361fb4a34 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 13 Sep 2021 14:19:39 +0700 Subject: [PATCH 1/7] identify a few map-related things --- banks/bank_05.asm | 6 +- banks/bank_06.asm | 1 + banks/bank_0b.asm | 2 +- home/bank0.asm | 150 +++++++++++++++++++++++++--------------------- home/text.asm | 84 +++++++++++++++----------- hram.asm | 13 ++-- wram.asm | 32 +++++----- 7 files changed, 158 insertions(+), 130 deletions(-) diff --git a/banks/bank_05.asm b/banks/bank_05.asm index 2688592..68073a9 100755 --- a/banks/bank_05.asm +++ b/banks/bank_05.asm @@ -30,7 +30,7 @@ ParseCurrentMapEvents:: srl h rr l ld c, l - ldh a, [hFF97] + ldh a, [hMapOffsetY] add a add c ld c, a @@ -57,12 +57,12 @@ ParseCurrentMapEvents:: srl h rr l ld b, l - ldh a, [hFF96] + ldh a, [hMapOffsetX] add a add b ld b, a - ld hl, wdf00 + ld hl, wMapEvents MapEventLoop: .check_x diff --git a/banks/bank_06.asm b/banks/bank_06.asm index bdf2730..d55c61f 100755 --- a/banks/bank_06.asm +++ b/banks/bank_06.asm @@ -1,3 +1,4 @@ +Tilesets:: Tileset_006_4000: tileset_fragment gfx_016_4000, $9000, $560 tileset_fragment gfx_016_4560, $9570, $280 diff --git a/banks/bank_0b.asm b/banks/bank_0b.asm index fd94baf..92694f5 100755 --- a/banks/bank_0b.asm +++ b/banks/bank_0b.asm @@ -1468,7 +1468,7 @@ Script_2e: ld b, a call GetScriptByte ld a, [wScriptByte] - ld hl, wc100 + ld hl, wMapLayout add hl, bc ld [hl], a xor a diff --git a/home/bank0.asm b/home/bank0.asm index 140b974..5466e95 100755 --- a/home/bank0.asm +++ b/home/bank0.asm @@ -364,9 +364,9 @@ Func_0531:: Func_0557:: ld a, [_BANKNUM] push af - ld a, [wd0c9] + ld a, [wPlayerSpriteX] ld [wcd01], a - ld a, [wd0ca] + ld a, [wPlayerSpriteY] ld [wcd00], a ld a, 1 ld [wcd02], a @@ -462,7 +462,7 @@ Func_05ff:: ld a, [_BANKNUM] push af call LoadMapData - call Func_2433 + call LoadMapAttrs call LoadMapGFX call Func_24be call Func_1fee @@ -732,6 +732,7 @@ Func_0817:: ret Func_0827:: + ; on getting item homecall Func_01e_41e8 ret @@ -1051,11 +1052,11 @@ Func_0a0a:: ld a, [_BANKNUM] push af - ldh a, [hFFB2] + ldh a, [hMapAttrBank] rst Bankswitch - ld a, [wd0a8] + ld a, [wMapPalettesPointer] ld l, a - ld a, [wd0a8 + 1] + ld a, [wMapPalettesPointer + 1] ld h, a ld de, wcab0 ld c, $40 @@ -1341,20 +1342,20 @@ IncFillBoxVRAM:: ldh [rVBK], a ret -Func_0f36:: +LoadMapGFX2:: ld a, [_BANKNUM] push af - ldh a, [hFFB2] + ldh a, [hMapAttrBank] rst Bankswitch call Func_259b - ld a, [wd0aa] + ld a, [wMapTileset1Pointer] ld l, a - ld a, [wd0aa + 1] + ld a, [wMapTileset1Pointer + 1] ld h, a or l jr nz, .not_zero - call Func_25a9 + call LoadTilesetHeader pop af rst Bankswitch ret @@ -1363,9 +1364,9 @@ Func_0f36:: ld de, $9000 ld bc, $800 call CopyBytesVRAM - ld a, [wd0ac] + ld a, [wMapTileset2Pointer] ld l, a - ld a, [wd0ac + 1] + ld a, [wMapTileset2Pointer + 1] ld h, a ld de, $8800 ld bc, $300 @@ -1377,17 +1378,17 @@ Func_0f36:: LoadMapGFX:: ld a, [_BANKNUM] push af - ldh a, [hFFB2] + ldh a, [hMapAttrBank] rst Bankswitch call Func_25a2 - ld a, [wd0aa] + ld a, [wMapTileset1Pointer] ld l, a - ld a, [wd0aa + 1] + ld a, [wMapTileset1Pointer + 1] ld h, a or l jr nz, .not_zero - call Func_25a9 + call LoadTilesetHeader pop af rst Bankswitch ret @@ -1397,9 +1398,9 @@ LoadMapGFX:: ld bc, $800 call CopyBytesVRAM call DelayFrame - ld a, [wd0ac] + ld a, [wMapTileset2Pointer] ld l, a - ld a, [wd0ac + 1] + ld a, [wMapTileset2Pointer + 1] ld h, a ld de, $8800 ld bc, $300 @@ -2224,9 +2225,9 @@ Func_13d5:: push af ldh a, [hScriptBank] rst Bankswitch - ld a, [wd0cd] + ld a, [wObjectEventPointer] ld l, a - ld a, [wd0cd + 1] + ld a, [wObjectEventPointer + 1] ld h, a ld de, wda00 .asm_13e7 @@ -2996,20 +2997,25 @@ Func_19b6:: INCLUDE "home/text.asm" -Func_2433:: - ldh a, [hFFB2] +LoadMapAttrs:: +; load map attribute pointer + ldh a, [hMapAttrBank] rst Bankswitch - ld a, [wd0cb] + ld a, [wMapAttrPointer] ld l, a - ld a, [wd0cb + 1] + ld a, [wMapAttrPointer + 1] ld h, a - ld de, hFF98 + +; map size + ld de, hMapWidth ld a, [hli] ld [de], a - inc de + inc de ; hMapHeight ld a, [hli] ld [de], a - ld de, wd0a0 + +; copy map attribute data + ld de, wMapAttributes ld c, $12 .copy ld a, [hli] @@ -3018,15 +3024,16 @@ Func_2433:: dec c jr nz, .copy +; load map layout? ld a, $98 ld [wd0ba + 1], a ld a, $00 ld [wd0ba], a - ldh a, [hFF98] + ldh a, [hMapWidth] add a sub 10 ldh [hFFA8], a - ldh a, [hFF99] + ldh a, [hMapHeight] add a sub 9 ldh [hFFA9], a @@ -3038,7 +3045,7 @@ Func_2433:: jr .asm_2478 .asm_2473 - ldh a, [hFF96] + ldh a, [hMapOffsetX] add a ldh [hFFAA], a @@ -3061,7 +3068,7 @@ ENDR jr .asm_24a2 .asm_249d - ldh a, [hFF97] + ldh a, [hMapOffsetY] add a ldh [hFFAB], a @@ -3134,13 +3141,13 @@ Func_24e6:: ret Func_2529:: - ld hl, wc100 - ldh a, [hFF97] + ld hl, wMapLayout + ldh a, [hMapOffsetY] ld b, a and a jr z, .skip - ldh a, [hFF98] + ldh a, [hMapWidth] ld e, a ld d, 0 .asm_2537 @@ -3149,20 +3156,20 @@ Func_2529:: jr nz, .asm_2537 .skip - ldh a, [hFF96] + ldh a, [hMapOffsetX] ld e, a ld d, 0 add hl, de ld a, l - ld [wd0a0], a + ld [wMapLayoutPointer], a ld a, h - ld [wd0a0 + 1], a + ld [wMapLayoutPointer + 1], a ret Func_254a:: - ld a, [wd0a6] + ld a, [wMapGBCAttrPointer] ld l, a - ld a, [wd0a6 + 1] + ld a, [wMapGBCAttrPointer + 1] ld h, a ld de, wce00 .asm_2555 @@ -3175,15 +3182,15 @@ Func_254a:: .asm_255e call Func_2c03 - ld a, [wd0b0] + ld a, [wMapCollisionsPointer] ld l, a - ld a, [wd0b0 + 1] + ld a, [wMapCollisionsPointer + 1] ld h, a ld de, wcf00 ld a, e - ld [wd0b0], a + ld [wMapCollisionsPointer], a ld a, d - ld [wd0b0 + 1], a + ld [wMapCollisionsPointer + 1], a .asm_2574 ld a, [hli] cp $ff @@ -3193,17 +3200,17 @@ Func_254a:: jr .asm_2574 Func_257c:: - ld a, [wd0a0] + ld a, [wMapLayoutPointer] ld l, a - ld a, [wd0a0 + 1] + ld a, [wMapLayoutPointer + 1] ld h, a ld a, [hli] ld [wd0f4], a - ld de, wc100 - ldh a, [hFF99] + ld de, wMapLayout + ldh a, [hMapHeight] ld b, a .asm_258e - ldh a, [hFF98] + ldh a, [hMapWidth] ld c, a .asm_2591 ld a, [hli] @@ -3225,39 +3232,48 @@ Func_25a2:: call Func_0a46 ret -Func_25a9:: - ld a, $06 +LoadTilesetHeader:: +; always from bank 06 + ld a, BANK(Tilesets) rst Bankswitch - ld a, [wd0ac] + + ld a, [wMapTileset2Pointer] ld l, a - ld a, [wd0ac + 1] + ld a, [wMapTileset2Pointer + 1] ld h, a -.asm_25b4 +.load_tileset ld a, [hli] - cp $ff + cp -1 ret z - ld [wd9f9], a +; load params for CopyBytesVRAM +; bank + ld [wTilesetBank], a +; location ld a, [hli] ld e, a ld a, [hli] ld d, a +; byte count ld a, [hli] ld c, a ld a, [hli] ld b, a +; GFX address ld a, [hli] push hl ld h, [hl] ld l, a - ld a, [wd9f9] +; load tileset to VRAM + ld a, [wTilesetBank] rst Bankswitch call CopyBytesVRAM pop hl inc hl - ld a, $06 +; bankswitch back + ld a, BANK(Tilesets) rst Bankswitch - jp .asm_25b4 ; jr + jp .load_tileset ; jr Func_25d6:: ld a, [wd08f] @@ -3431,16 +3447,16 @@ CopyBytes2:: ret Func_26e1:: - ldh a, [hFFB2] + ldh a, [hMapAttrBank] rst Bankswitch ld hl, wc740 ld a, l ld [wd0b2], a ld a, h ld [wd0b2 + 1], a - ld a, [wd0a0] + ld a, [wMapLayoutPointer] ld l, a - ld a, [wd0a0 + 1] + ld a, [wMapLayoutPointer + 1] ld h, a ld b, 5 .asm_26f9 @@ -3451,9 +3467,9 @@ Func_26e1:: push hl ld l, a ld h, 0 - ld a, [wd0a2] + ld a, [wMapBlocksPointer] ld e, a - ld a, [wd0a2 + 1] + ld a, [wMapBlocksPointer + 1] ld d, a add hl, hl add hl, hl @@ -3468,9 +3484,9 @@ Func_26e1:: ld h, 0 add hl, hl add hl, hl - ld a, [wd0a4] + ld a, [wMapMetatilesPointer] ld e, a - ld a, [wd0a4 + 1] + ld a, [wMapMetatilesPointer + 1] ld d, a add hl, de ld a, [wd0b2] @@ -3510,7 +3526,7 @@ Func_26e1:: dec c jp nz, .asm_26fb - ldh a, [hFF98] + ldh a, [hMapWidth] sub 6 add l ld l, a diff --git a/home/text.asm b/home/text.asm index 81133ca..b2f5ed3 100755 --- a/home/text.asm +++ b/home/text.asm @@ -1079,9 +1079,9 @@ Func_1fe9:: Func_1fee:: ldh a, [hScriptBank] rst Bankswitch - ld a, [wd0cd] + ld a, [wObjectEventPointer] ld l, a - ld a, [wd0cd + 1] + ld a, [wObjectEventPointer + 1] ld h, a ld de, wda00 .read_byte @@ -1106,6 +1106,7 @@ Func_1fee:: ret LoadMapData:: +; Load map group ld de, .MapGroupPointers ldh a, [hMapGroup] ld l, a @@ -1124,6 +1125,7 @@ LoadMapData:: ld a, [hli] ld d, a +; Load map header from map number ldh a, [hMapNumber] ld l, a ld h, 0 @@ -1132,48 +1134,58 @@ LoadMapData:: ld a, [hli] ld h, [hl] ld l, a - ld de, hFFB2 + +; Load map attribute bank and etc. + ld de, hMapAttrBank REPT 4 ld a, [hli] ld [de], a inc de ENDR + +; Map attribute pointer ld a, [hli] - ld [wd0cb], a + ld [wMapAttrPointer], a ld a, [hli] - ld [wd0cb + 1], a + ld [wMapAttrPointer + 1], a + +; warp data length ld bc, $0c + +; get warp data ldh a, [hWarpNumber] and a - jr z, .asm_2052 - -.asm_204e + jr z, .got_warp +.get_warp add hl, bc dec a - jr nz, .asm_204e - -.asm_2052 + jr nz, .get_warp +.got_warp ld a, [wd9d2] and a - jr z, .asm_205e + jr z, .get_spawn_position +; skip placing player ld a, [hli] ld a, [hli] ld a, [hli] ld a, [hli] - jr .asm_206c + jr .get_scripts -.asm_205e +.get_spawn_position +; offset the map ld a, [hli] - ldh [hFF96], a + ldh [hMapOffsetX], a ld a, [hli] - ldh [hFF97], a + ldh [hMapOffsetY], a +; where the player is placed on the screen ld a, [hli] - ld [wd0c9], a + ld [wPlayerSpriteX], a ld a, [hli] - ld [wd0ca], a + ld [wPlayerSpriteY], a -.asm_206c +.get_scripts +; Script and object event bank ld de, hScriptBank ld a, [hli] ld [de], a @@ -1186,27 +1198,29 @@ ENDR ld a, [hli] inc de +; Load object event pointer ld a, [hli] - ld [wd0cd], a + ld [wObjectEventPointer], a ld a, [hli] - ld [wd0cd + 1], a + ld [wObjectEventPointer + 1], a + +; Copy map events to df00 ld a, [hli] ld h, [hl] ld l, a - ld de, wdf00 -.asm_2086 + ld de, wMapEvents +.copy_map_events ld a, [hli] ld [de], a inc de - cp $ff + cp -1 ret z - REPT 5 ld a, [hli] ld [de], a inc de ENDR - jr .asm_2086 + jr .copy_map_events ret ; ? .MapGroupPointers: @@ -1221,14 +1235,14 @@ ENDR dba Group02_Maps Func_20b9:: - ldh a, [hFFB2] + ldh a, [hMapAttrBank] rst Bankswitch push de - ldh a, [hFF97] + ldh a, [hMapOffsetY] add c ld c, a - ld hl, wc100 - ld a, [hFF98] + ld hl, wMapLayout + ld a, [hMapWidth] ld e, a ld d, 0 ld a, c @@ -1245,13 +1259,13 @@ Func_20b9:: ld a, d ld c, a ld d, 0 - ldh a, [hFF96] + ldh a, [hMapOffsetX] add e ld e, a add hl, de - ld a, [wd0a2] + ld a, [wMapBlocksPointer] ld e, a - ld a, [wd0a2 + 1] + ld a, [wMapBlocksPointer + 1] ld d, a ld a, [hl] ld l, a @@ -1272,9 +1286,9 @@ Func_20b9:: inc hl .asm_20f6 - ld a, [wd0b0] + ld a, [wMapCollisionsPointer] ld e, a - ld a, [wd0b0 + 1] + ld a, [wMapCollisionsPointer + 1] ld d, a ld a, [hl] ld l, a diff --git a/hram.asm b/hram.asm index 5c445f4..6428a9e 100755 --- a/hram.asm +++ b/hram.asm @@ -18,11 +18,11 @@ hFF93:: ds 1 hJoypadPressed:: ds 1 hJoypadDown:: ds 1 -hFF96:: ds 1 -hFF97:: ds 1 +hMapOffsetX:: ds 1 +hMapOffsetY:: ds 1 -hFF98:: ds 1 -hFF99:: ds 1 +hMapWidth:: ds 1 +hMapHeight:: ds 1 hMapGroup:: ds 1 hMapNumber:: ds 1 @@ -50,10 +50,7 @@ hFFAF:: ds 1 hSCY:: ds 1 hFFB1:: ds 1 -hFFB2:: ds 1 -hFFB3:: ds 1 -hFFB4:: ds 1 -hFFB5:: ds 1 +hMapAttrBank:: ds 4 hScriptBank:: ds 1 hFFB7:: ds 1 hFFB8:: ds 1 diff --git a/wram.asm b/wram.asm index f51c89a..1b098b0 100755 --- a/wram.asm +++ b/wram.asm @@ -53,7 +53,7 @@ wBGMapBufferPointers:: ds $38 wc0e8:: ds $18 -wc100:: ds $640 +wMapLayout:: ds $640 wc740:: ds $1e0 @@ -205,16 +205,16 @@ wd090:: ds 1 wd091:: ds 1 wd092:: ds $e -wd0a0:: ds 2 -wd0a2:: ds 2 -wd0a4:: ds 2 -wd0a6:: ds 2 -wd0a8:: ds 2 -wd0aa:: ds 2 -wd0ac:: ds 2 +wMapAttributes:: +wMapLayoutPointer:: ds 2 +wMapBlocksPointer:: ds 2 +wMapMetatilesPointer:: ds 2 +wMapGBCAttrPointer:: ds 2 +wMapPalettesPointer:: ds 2 +wMapTileset1Pointer:: ds 2 +wMapTileset2Pointer:: ds 2 wd0ae:: ds 2 - -wd0b0:: ds 2 +wMapCollisionsPointer:: ds 2 wd0b2:: ds 2 wd0b4:: ds 1 wd0b5:: ds 5 @@ -230,11 +230,11 @@ wd0c4:: ds 2 wd0c6:: ds 2 wd0c8:: ds 1 -wd0c9:: ds 1 -wd0ca:: ds 1 -wd0cb:: ds 2 +wPlayerSpriteX:: ds 1 +wPlayerSpriteY:: ds 1 +wMapAttrPointer:: ds 2 -wd0cd:: ds 2 +wObjectEventPointer:: ds 2 wTextboxPointer:: ds 2 wd0d1:: ds 2 wd0d3:: ds 1 @@ -489,7 +489,7 @@ wd9eb:: ds 5 wTempBank:: ds 1 wd9f1:: ds 2 wd9f3:: ds 6 -wd9f9:: ds 1 +wTilesetBank:: ds 1 wd9fa:: ds 1 wd9fb:: ds 1 wd9fc:: ds 1 @@ -624,7 +624,7 @@ wde6e:: ds $16 wde84:: ds $16 wde9a:: ds $66 -wdf00:: ds $ff +wMapEvents:: ds $ff wdfff:: ds 1 From 112bb84fb07461977807e0ec6d069e4a8e3cb1db Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 4 Oct 2021 14:26:42 +0700 Subject: [PATCH 2/7] [skip ci] display disassembled banks in ok.py --- .github/ok/ok.py | 19 ++++++++++++++++++- .github/ok/webhook.py | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/ok/ok.py b/.github/ok/ok.py index a13079c..fd0188a 100644 --- a/.github/ok/ok.py +++ b/.github/ok/ok.py @@ -68,9 +68,26 @@ def check_syms(symfile): if check_md5('shi_kong_xing_shou.gbc', '24e73734490ad40f9d8228a80ff15c0b'): print('OK') else: - print('MISMATCHED') + print('NON MATCH') exit_state += 1 + # enum banks + print() + bank_file = check_dr('banks/', 0, True) + bank_list = {} + for key, val in bank_file.items(): + bank_num = re.search('banks/bank_([0-9a-f]{2})',key) + if bank_num: + bank_list[int(bank_num.group(1), 16)] = val + + # assume the bank is filled if not on this list + for bank in range(0x7f): + if (bank+1) not in bank_list: + bank_list[bank+1] = 0 + + for bank in range(0x7f): + print('bank %02x: %5d bytes left (%.1f%%)' % (bank+1, bank_list[bank+1], 100-(bank_list[bank+1]/16384*100))) + # check percentage with open('baserom.gbc', 'rb') as rom: rom.seek(0, 2) diff --git a/.github/ok/webhook.py b/.github/ok/webhook.py index 3f46d19..345e13a 100644 --- a/.github/ok/webhook.py +++ b/.github/ok/webhook.py @@ -19,7 +19,7 @@ if ok.check_md5('shi_kong_xing_shou.gbc', '24e73734490ad40f9d8228a80ff15c0b'): match_string = 'OK' else: - match_string = 'FAILED' + match_string = 'NON MATCH' # check percentage with open('baserom.gbc', 'rb') as rom: From 8d01742133122eb055cfc8d6f8a5389ce7e921c7 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 4 Oct 2021 14:27:15 +0700 Subject: [PATCH 3/7] figure out a few more script commands --- banks/bank_0b.asm | 8 +++---- macros/scripts/script.asm | 47 +++++++++++++++++++++++++++++++++++++-- utils/dump_scripts.py | 31 ++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/banks/bank_0b.asm b/banks/bank_0b.asm index 92694f5..87e3341 100755 --- a/banks/bank_0b.asm +++ b/banks/bank_0b.asm @@ -84,7 +84,7 @@ ScriptCommandTable: dw Script_spriteface ; $01 dw Script_delay ; $02 dw Script_03 ; $03 - dw Script_04 ; $04 + dw Script_04 ; $04 another textbox command? dw Script_face ; $05 dw Script_spritewalk ; $06 dw Script_07 ; $07 @@ -102,7 +102,7 @@ ScriptCommandTable: dw Script_13 ; $13 dw Script_text ; $14 dw Script_emote ; $15 - dw Script_16 ; $16 + dw Script_16 ; $16 load sprite definitions? dw Script_17 ; $17 dw Script_18 ; $18 dw Script_19 ; $19 @@ -139,7 +139,7 @@ ScriptCommandTable: dw Script_38 ; $38 dw Script_39 ; $39 dw Script_3a ; $3a - dw Script_3b ; $3b + dw Script_3b ; $3b start a battle? dw Script_3c ; $3c dw Script_3d ; $3d dw Script_3e ; $3e @@ -183,7 +183,7 @@ ScriptCommandTable: dw Script_64 ; $64 dw Script_65 ; $65 dw Script_66 ; $66 - dw Script_67 ; $67 + dw Script_67 ; $67 follower related? dw Script_68 ; $68 dw Script_69 ; $69 dw Script_6a ; $6a diff --git a/macros/scripts/script.asm b/macros/scripts/script.asm index c99b341..cbc4f36 100755 --- a/macros/scripts/script.asm +++ b/macros/scripts/script.asm @@ -146,7 +146,7 @@ scr_emote: MACRO db \2 ; emote ENDM - const script_16 ; $16 + const script_16 ; $16 load sprite definitions? scr_16: MACRO db script_16 dw \1 @@ -213,6 +213,18 @@ scr_20: MACRO db script_20 ENDM + const_def $24 + + const script_24 ; $24 +scr_24: MACRO + db script_24 +ENDM + + const script_25 ; $25 +scr_25: MACRO + db script_25 +ENDM + const_def $2a const script_farjump ; $2a @@ -237,7 +249,13 @@ scr_30: MACRO db \1, \2 ; pointer? ENDM - const_def $34 + const_def $33 + + const script_33 ; $33 +scr_33: MACRO + db script_33 + db \1 +ENDM const script_34 ; $34 scr_34: MACRO @@ -268,6 +286,14 @@ scr_3b: MACRO dw \1 ENDM + const_def $3e + + const script_jump ; $3e +scr_jump: MACRO + db script_jump + dw \1 +ENDM + const_def $44 const script_44 ; $44 @@ -307,6 +333,11 @@ scr_4e: MACRO dw \2 ENDM + const script_52 ; $52 +scr_52: MACRO + db script_52 +ENDM + const_def $5e const script_5e ; $5e @@ -315,6 +346,11 @@ scr_5e: MACRO db \1 ; follower ENDM + const script_5f ; $5f +scr_5f: MACRO + db script_5f +ENDM + const_def $61 const script_61 ; $61 @@ -344,3 +380,10 @@ scr_65: MACRO db script_65 db \1 ENDM + + const_def $69 + + const script_69 ; $69 +scr_69: MACRO + db script_69 +ENDM diff --git a/utils/dump_scripts.py b/utils/dump_scripts.py index 247779a..8c566f8 100755 --- a/utils/dump_scripts.py +++ b/utils/dump_scripts.py @@ -148,6 +148,11 @@ arg1 = int.from_bytes(rom.read(1), "little") arg2 = int.from_bytes(rom.read(1), "little") print("\tscr_emote $%02x, $%02x ; TEMP" % (arg1, arg2)) + + elif byte == 0x16: + arg = int.from_bytes(rom.read(2), "little") + sym = get_symbol(rom_sym, addr2offset(bank, arg)) + print("\tscr_16 %s ; TEMP" % (sym)) elif byte == 0x1a: arg1 = int.from_bytes(rom.read(1), "little") @@ -167,6 +172,12 @@ elif byte == 0x1f: arg = int.from_bytes(rom.read(1), "little") print("\tscr_1f $%02x ; TEMP" % arg) + + elif byte == 0x24: + print("\tscr_24") + + elif byte == 0x25: + print("\tscr_25") elif byte == 0x2a: new_bank = int.from_bytes(rom.read(1), "little") @@ -183,6 +194,10 @@ arg = int.from_bytes(rom.read(1), "little") arg2 = int.from_bytes(rom.read(1), "little") print("\tscr_30 $%02x, $%02x ; TEMP" % (arg,arg2)) + + elif byte == 0x33: + arg = int.from_bytes(rom.read(1), "little") + print("\tscr_33 $%02x ; TEMP" % (arg)) elif byte == 0x34: arg1 = int.from_bytes(rom.read(1), "little") @@ -203,6 +218,11 @@ elif byte == 0x3b: arg = int.from_bytes(rom.read(2), "little") print("\tscr_3b %s" % get_symbol(rom_sym, addr2offset(bank, arg))) + + elif byte == 0x3e: + arg2 = int.from_bytes(rom.read(2), "little") + sym = get_symbol(rom_sym, addr2offset(bank, arg2)) + print("\tscr_jump %s" % (sym)) elif byte == 0x44: print("\tscr_44") @@ -226,11 +246,17 @@ arg2 = int.from_bytes(rom.read(2), "little") sym = get_symbol(rom_sym, addr2offset(bank, arg2)) print("\tscr_4e $%02x, %s" % (arg1, sym)) + + elif byte == 0x52: + print("\tscr_52") elif byte == 0x5e: arg = int.from_bytes(rom.read(1), "little") print("\tscr_5e $%02x ; TEMP" % arg) + elif byte == 0x5f: + print("\tscr_5f") + elif byte == 0x61: print("\tscr_61") @@ -249,6 +275,11 @@ arg = int.from_bytes(rom.read(1), "little") print("\tscr_65 $%02x ; TEMP" % arg) + elif byte == 0x69: + print("\tscr_69") + print("") + break + else: print("\tdb $%02x ; TEMP" % byte) From 6561aa48b1323276c7b05afe78d8f6314e0efbdb Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 4 Oct 2021 14:27:47 +0700 Subject: [PATCH 4/7] fix a mismatched symbol --- banks/bank_0e.asm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/banks/bank_0e.asm b/banks/bank_0e.asm index 5b92c49..47ff496 100755 --- a/banks/bank_0e.asm +++ b/banks/bank_0e.asm @@ -611,9 +611,10 @@ unk_00e_4642: Script_00e_464e: scr_text text_0e_5b91 +unk_00e_4651: scr_end -unk_00e_4651: +unk_00e_4652: scr_face $02 ; TEMP scr_spriteface $02, $03 ; TEMP scr_text text_0e_5b91 From 98930a014c080c14189e814e8fd87b2b3bde76c7 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 4 Oct 2021 14:28:17 +0700 Subject: [PATCH 5/7] [NON-MATCHING] disasm bank 12 scripts --- banks/bank_12.asm | 1297 ++++++++++++++++++++++++++++++++++--- data/text/bank12_41f1.txt | 5 + 2 files changed, 1196 insertions(+), 106 deletions(-) create mode 100644 data/text/bank12_41f1.txt diff --git a/banks/bank_12.asm b/banks/bank_12.asm index a299d48..d57d3ca 100755 --- a/banks/bank_12.asm +++ b/banks/bank_12.asm @@ -1,10 +1,10 @@ Script_012_4000: scr_face $03 ; TEMP - scr_63 $02, unk_012_400a + scr_63 $02, Script_012_400a scr_text text_12_6443 scr_end -unk_012_400a: +Script_012_400a: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -16,19 +16,19 @@ unk_012_400a: Script_012_401b: scr_face $01 ; TEMP - scr_63 $02, unk_012_400a + scr_63 $02, Script_012_400a scr_text text_12_6443 scr_end Script_012_4025: scr_face $00 ; TEMP - scr_63 $02, unk_012_400a + scr_63 $02, Script_012_400a scr_text text_12_6443 scr_end Script_012_402f: scr_face $02 ; TEMP - scr_63 $02, unk_012_400a + scr_63 $02, Script_012_400a scr_text text_12_6443 scr_end @@ -62,11 +62,11 @@ Script_012_405e: Script_012_4068: scr_face $00 ; TEMP - scr_63 $02, unk_012_4072 + scr_63 $02, Script_012_4072 scr_text text_12_6443 scr_end -unk_012_4072: +Script_012_4072: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -78,17 +78,17 @@ unk_012_4072: Script_012_4083: scr_face $01 ; TEMP - scr_63 $02, unk_012_4072 + scr_63 $02, Script_012_4072 scr_text text_12_6443 scr_end Script_012_408d: scr_face $03 ; TEMP - scr_63 $02, unk_012_4097 + scr_63 $02, Script_012_4097 scr_text text_12_6443 scr_end -unk_012_4097: +Script_012_4097: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -100,23 +100,23 @@ unk_012_4097: Script_012_40a8: scr_face $00 ; TEMP - scr_63 $02, unk_012_4097 + scr_63 $02, Script_012_4097 scr_text text_12_6443 scr_end Script_012_40b2: scr_face $02 ; TEMP - scr_63 $02, unk_012_4097 + scr_63 $02, Script_012_4097 scr_text text_12_6443 scr_end Script_012_40bc: scr_face $01 ; TEMP - scr_63 $02, unk_012_40c6 + scr_63 $02, Script_012_40c6 scr_text text_12_6443 scr_end -unk_012_40c6: +Script_012_40c6: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -128,17 +128,17 @@ unk_012_40c6: Script_012_40d7: scr_face $00 ; TEMP - scr_63 $02, unk_012_40c6 + scr_63 $02, Script_012_40c6 scr_text text_12_6443 scr_end Script_012_40e1: scr_face $01 ; TEMP - scr_63 $02, unk_012_40eb + scr_63 $02, Script_012_40eb scr_text text_12_6443 scr_end -unk_012_40eb: +Script_012_40eb: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -150,17 +150,17 @@ unk_012_40eb: Script_012_40fc: scr_face $00 ; TEMP - scr_63 $02, unk_012_40eb + scr_63 $02, Script_012_40eb scr_text text_12_6443 scr_end Script_012_4106: scr_face $01 ; TEMP - scr_63 $02, unk_012_4110 + scr_63 $02, Script_012_4110 scr_text text_12_6443 scr_end -unk_012_4110: +Script_012_4110: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -172,17 +172,17 @@ unk_012_4110: Script_012_4121: scr_face $00 ; TEMP - scr_63 $02, unk_012_4110 + scr_63 $02, Script_012_4110 scr_text text_12_6443 scr_end Script_012_412b: scr_face $01 ; TEMP - scr_63 $02, unk_012_4135 + scr_63 $02, Script_012_4135 scr_text text_12_6443 scr_end -unk_012_4135: +Script_012_4135: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -194,17 +194,17 @@ unk_012_4135: Script_012_4146: scr_face $00 ; TEMP - scr_63 $02, unk_012_4135 + scr_63 $02, Script_012_4135 scr_text text_12_6443 scr_end Script_012_4150: scr_face $03 ; TEMP - scr_63 $02, unk_012_415a + scr_63 $02, Script_012_415a scr_text text_12_6443 scr_end -unk_012_415a: +Script_012_415a: db $67 ; TEMP scr_delay $03, $10 ; TEMP db $49 ; TEMP @@ -216,32 +216,32 @@ unk_012_415a: Script_012_416b: scr_face $02 ; TEMP - scr_63 $02, unk_012_415a + scr_63 $02, Script_012_415a scr_text text_12_6443 scr_end Script_012_4175: scr_face $01 ; TEMP - scr_63 $02, unk_012_415a + scr_63 $02, Script_012_415a scr_text text_12_6443 scr_end Script_012_417f: scr_face $00 ; TEMP - scr_63 $02, unk_012_415a + scr_63 $02, Script_012_415a scr_text text_12_6443 scr_end -unk_012_4189: +Script_012_4189: db $53 ; TEMP scr_spriteface $00, $02 ; TEMP scr_end Script_012_418e: - scr_63 $01, unk_012_4193 + scr_63 $01, Script_012_4193 scr_end -unk_012_4193: +Script_012_4193: scr_face $02 ; TEMP scr_spriteface $01, $02 ; TEMP scr_1a $01, $00, $f0, $00 ; TEMP @@ -257,10 +257,10 @@ unk_012_4193: scr_end Script_012_41b5: - scr_63 $01, unk_012_41ba + scr_63 $01, Script_012_41ba scr_end -unk_012_41ba: +Script_012_41ba: scr_face $03 ; TEMP scr_spriteface $01, $03 ; TEMP scr_1a $01, $00, $f0, $00 ; TEMP @@ -275,145 +275,1230 @@ unk_012_41ba: scr_spriteface $01, $03 ; TEMP scr_end -ObjectEvents_012_41dc:: - dr $481dc, $481fe +ObjectEvents_012_41dc: + objects_end -ObjectEvents_012_41fe:: - dr $481fe, $48262 +ObjectEvents_012_41dd: + object_event $2a, 9, 9, 0, $00, $00, $00, $00, Script_012_41e9 + objects_end -ObjectEvents_012_4262:: - dr $48262, $48279 +Script_012_41e9: + scr_04 text_12_41f1 + scr_3b unk_012_506b + db $67 ; TEMP + scr_end + +INCLUDE "data/text/bank12_41f1.asm" + +ObjectEvents_012_41fe: + object_event $15, 8, 4, 0, $00, $00, $0a, $00, Script_012_4613 + object_event $21, 3, 8, 0, $00, $00, $0b, $01, Script_012_4617 + object_event $12, 8, 10, 0, $00, $00, $08, $02, Script_012_461b + object_event $23, 11, 14, 0, $00, $00, $07, $03, Script_012_4629 + object_event $18, 21, 8, 0, $00, $00, $0a, $04, Script_012_4637 + object_event $1c, 32, 8, 0, $00, $00, $05, $00, Script_012_465d + object_event $1f, 32, 14, 0, $00, $00, $05, $01, Script_012_467f + object_event $16, 23, 17, 0, $00, $00, $05, $02, Script_012_468d + object_event $19, 9, 20, 0, $00, $00, $08, $03, Script_012_469e + objects_end + +ObjectEvents_012_4262: + object_event $16, 4, 6, 0, $00, $00, $09, $00, Script_012_46a2 + object_event $19, 8, 6, 0, $00, $00, $06, $01, Script_012_46a6 + objects_end + +ObjectEvents_012_4279: + object_event $1b, 5, 4, 0, $00, $00, $06, $00, Script_012_46aa + object_event $1a, 9, 6, 0, $00, $00, $07, $01, Script_012_46ae + objects_end + +ObjectEvents_012_4290: + object_event $1c, 6, 3, 0, $00, $00, $07, $00, Script_012_46b2 + object_event $1a, 4, 6, 0, $00, $00, $0b, $01, Script_012_46b6 + object_event $15, 6, 7, 0, $00, $00, $06, $02, Script_012_46ba + objects_end + +ObjectEvents_012_42b2: + object_event $22, 7, 5, 0, $00, $00, $06, $00, Script_012_46be + objects_end + +ObjectEvents_012_42be: + object_event $2d, 6, 5, wdaa3, $02, $00, $00, $00, Script_012_46c2 + objects_end + +ObjectEvents_012_42ca: + object_event $24, 6, 13, wdaa4, $06, $00, $00, $00, Script_012_46fb + objects_end + +ObjectEvents_012_42d6: + object_event $17, 15, 6, 0, $00, $00, $09, $00, Script_012_48b7 + object_event $20, 9, 8, 0, $00, $00, $08, $01, Script_012_48bb + object_event $12, 4, 16, 0, $00, $00, $08, $02, Script_012_48c9 + object_event $1d, 14, 16, 0, $00, $00, $07, $03, Script_012_48d7 + object_event $21, 11, 20, 0, $00, $00, $08, $04, Script_012_48e5 + object_event $19, 17, 22, 0, $00, $00, $06, $00, Script_012_48e9 + object_event $1a, 11, 25, 0, $00, $00, $09, $01, Script_012_48f7 + objects_end + +ObjectEvents_012_4324: + object_event $23, 3, 3, 0, $00, $00, $0b, $00, Script_012_4905 + object_event $25, 5, 5, 0, $00, $00, $06, $01, Script_012_4913 + objects_end + +ObjectEvents_012_433b: + object_event $22, 3, 5, 0, $00, $00, $09, $00, Script_012_4917 + object_event $21, 8, 6, 0, $00, $00, $06, $01, Script_012_491b + objects_end + +ObjectEvents_012_4352: + object_event $1e, 9, 3, 0, $00, $00, $00, $00, Script_012_491f + object_event $1f, 5, 3, 0, $00, $00, $06, $01, Script_012_492d + object_event $18, 6, 6, 0, $00, $00, $05, $02, Script_012_493b + objects_end + +ObjectEvents_012_4374: + object_event $16, 7, 5, 0, $00, $00, $08, $00, Script_012_495d + objects_end + +ObjectEvents_012_4380: + object_event $30, 5, 7, wdaa4, $07, $00, $00, $00, Script_012_44cc + object_event $04, 6, 8, wdaa4, $07, $00, $00, $02, Script_012_44cc + objects_end + +Script_012_4397: + scr_checkbit wdaa3, $06, Script_012_43a1 + +Script_012_439d: + scr_setmap $07, $00 ; TEMP + scr_end + +Script_012_43a1: + scr_checkbit wdaa4, $07, Script_012_439d + scr_65 $00 ; TEMP + scr_setmap $07, $01 ; TEMP + scr_spriteface 3, FACE_UP + scr_emote $02, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_6bc1 + scr_spriteface 2, FACE_UP + scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_DOWN + scr_text text_12_6c0b + scr_spriteface 2, FACE_DOWN + scr_text text_12_6c54 + scr_text text_12_6ca6 + scr_text text_12_6cd1 + scr_spriteface 2, FACE_UP + scr_16 unk_012_4486 ; TEMP + scr_4e $04, unk_012_50b7 + scr_spriteface 4, FACE_UP + scr_16 unk_012_4492 ; TEMP + scr_4e $05, unk_012_4f8c + scr_1c $05 ; TEMP + scr_16 unk_012_4492 ; TEMP + scr_4e $05, unk_012_503c + scr_1c $05 ; TEMP + scr_16 unk_012_4492 ; TEMP + scr_4e $05, unk_012_5065 + scr_1c $05 ; TEMP + scr_16 unk_012_4492 ; TEMP + scr_4e $05, unk_012_508e + scr_1c $05 ; TEMP + scr_spriteface 4, FACE_LEFT + scr_4e $04, unk_012_50f6 + scr_1c $04 ; TEMP + scr_spriteface 2, $04 ; TEMP + scr_delay $03, $10 ; TEMP + scr_1c $00 ; TEMP + scr_1c $01 ; TEMP + scr_1c $02 ; TEMP + scr_1c $03 ; TEMP + scr_16 unk_012_446e ; TEMP + scr_16 unk_012_447a ; TEMP + scr_spriteface 2, $04 ; TEMP + scr_34 $08, $07, $01 ; TEMP + scr_face $01 ; TEMP + scr_spriteface 1, FACE_UP + scr_spriteface 3, FACE_UP + scr_text text_12_6e65 + scr_spritewalk 3, MOVE_DOWN + scr_spriteface 3, FACE_LEFT + scr_face $02 ; TEMP + scr_spriteface 1, FACE_LEFT + scr_spriteface 2, FACE_RIGHT + scr_text text_12_6e7d + scr_text text_12_6ea8 + scr_spriteface 3, FACE_DOWN + scr_face $00 ; TEMP + scr_spriteface 1, FACE_DOWN + scr_spriteface 2, FACE_DOWN + scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_UP + scr_1c $02 ; TEMP + scr_spritewalk 3, MOVE_UP + scr_text text_12_6ef7 + scr_spriteface 3, FACE_RIGHT + scr_44 + scr_spritewalk 3, MOVE_RIGHT + scr_1c $03 ; TEMP + scr_setbit $daa4, $07 ; TEMP + scr_end + +unk_012_446e: + dr $4846e, $4847a + +unk_012_447a: + dr $4847a, $48486 + +unk_012_4486: + dr $48486, $48492 + +unk_012_4492: + dr $48492, $4849e + +ObjectEvents_012_449e: + object_event $30, 7, 3, wdaa3, $06, $00, $00, $00, Script_012_44cc + object_event $04, 8, 4, wdaa3, $06, $00, $00, $02, Script_012_44cc + objects_end + +ObjectEvents_012_44b5: + object_event $47, 8, 3, 0, $00, $00, $00, $00, Script_012_44cc + object_event $04, 8, 4, 0, $00, $00, $00, $02, Script_012_44cc + objects_end + +Script_012_44cc: + scr_end + +Script_012_44cd: + scr_checkbit wdaa3, $05, Script_012_44db + scr_setmap $16, $00 ; TEMP + scr_end + +Script_012_44d7: + scr_setmap $16, $03 ; TEMP + scr_end + +Script_012_44db: + scr_checkbit wdaa3, $06, Script_012_44d7 + scr_65 $00 ; TEMP + scr_setmap $16, $01 ; TEMP + scr_spriteface 3, FACE_UP + scr_face $01 ; TEMP + scr_text text_12_6898 + scr_4d $02, $08 + scr_spriteface 2, FACE_LEFT + scr_spriteface 2, FACE_LEFT + scr_spriteface 2, FACE_LEFT + scr_setmap $16, $02 ; TEMP + scr_spriteface 3, FACE_UP + scr_face $01 ; TEMP + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_spritewalk 2, MOVE_UP + scr_spriteface 2, FACE_RIGHT + scr_spriteface 3, FACE_LEFT + scr_text text_12_68c4 + scr_text text_12_68ce + scr_text text_12_68e4 + scr_emote $03, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_68f5 + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_691e + scr_spriteface 2, FACE_DOWN + scr_spritewalk 2, MOVE_UP + scr_face $02 ; TEMP + scr_text text_12_6927 + scr_spriteface 3, FACE_DOWN + scr_spriteface 2, FACE_RIGHT + scr_text text_12_6953 + scr_text text_12_69a3 + scr_text text_12_69ac + scr_text text_12_6a58 + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_6aa0 + scr_spriteface 2, FACE_DOWN + scr_4e $02, unk_012_4e4a + scr_1c $02 ; TEMP + scr_emote $00, $00 ; TEMP + scr_emote $03, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_face $01 ; TEMP + scr_text text_12_6adb + scr_text text_12_6b0f + scr_text text_12_6b30 + scr_text text_12_6b6a + scr_emote $00, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_6b93 + scr_text text_12_6bb4 + scr_44 + scr_spritewalk 3, MOVE_UP + scr_1c $03 ; TEMP + scr_setbit $daa3, $06 ; TEMP + scr_end + +ObjectEvents_012_4589: + object_event $47, 8, 3, 0, $00, $00, $00, $00, Script_012_45ab + object_event $05, 8, 4, wdaa3, $04, $00, $00, $01, Script_012_45af + object_event $04, 7, 2, wdaa3, $04, $00, $00, $02, Script_012_45b3 + objects_end -ObjectEvents_012_4279:: - dr $48279, $48290 +Script_012_45ab: + scr_text text_12_6159 + scr_end + +Script_012_45af: + scr_04 text_12_6164 + scr_end + +Script_012_45b3: + scr_04 text_12_6171 + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_61be + scr_text text_12_61cb + scr_checkbit wdaa3, $02, .unk_012_45c9 + scr_end +.unk_012_45c9 + scr_face $03 ; TEMP + scr_emote $00, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_6253 + scr_text text_12_629b + scr_face $01 ; TEMP + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_62f3 + scr_text text_12_6300 + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_636e + scr_emote $04, $02 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_6394 + scr_44 + scr_spritewalk 4, MOVE_UP + scr_1c $04 ; TEMP + scr_44 + scr_spritewalk 3, MOVE_LEFT + scr_1c $03 ; TEMP + scr_61 + scr_delay $62, $02 ; TEMP + scr_spriteface 20, $f5 ; TEMP + scr_63 $14, text_12_640c + scr_setbit $daa3, $04 ; TEMP + scr_end + +Script_012_4613: + scr_04 text_12_5194 + scr_end -ObjectEvents_012_4290:: - dr $48290, $482b2 +Script_012_4617: + scr_04 text_12_51a6 + scr_end -ObjectEvents_012_42b2:: - dr $482b2, $482be +Script_012_461b: + scr_checkbit wdaa4, $02, unk_012_4625 + scr_04 text_12_51d9 + scr_end + +unk_012_4625: + scr_04 text_12_723c + scr_end -ObjectEvents_012_42be:: - dr $482be, $482ca +Script_012_4629: + scr_checkbit wdaa4, $02, unk_012_4633 + scr_04 text_12_5223 + scr_end -ObjectEvents_012_42ca:: - dr $482ca, $482d6 +unk_012_4633: + scr_04 text_12_7267 + scr_end -ObjectEvents_012_42d6:: - dr $482d6, $48324 +Script_012_4637: + scr_checkbit wdaa4, $02, unk_012_4641 + scr_04 text_12_52aa + scr_end -ObjectEvents_012_4324:: - dr $48324, $4833b +unk_012_4641: + scr_checkbit wdaa4, $03, unk_012_464b + scr_04 text_12_72ef + scr_end -ObjectEvents_012_433b:: - dr $4833b, $48352 +unk_012_464b: + scr_checkbit wdaa4, $05, unk_012_4659 + scr_04 text_12_76dc + scr_setbit $daa4, $04 ; TEMP + scr_end -ObjectEvents_012_4352:: - dr $48352, $48374 +unk_012_4659: + scr_04 text_12_7885 + scr_end -ObjectEvents_012_4374:: - dr $48374, $48380 +Script_012_465d: + scr_checkbit wdaa4, $02, unk_012_4667 + scr_04 text_12_530c + scr_end -ObjectEvents_012_4380:: - dr $48380, $48397 +unk_012_4667: + scr_checkbit wdaa4, $03, unk_012_4671 + scr_04 text_12_7320 + scr_end -Script_012_4397:: - dr $48397, $4849e +unk_012_4671: + scr_checkbit wdaa4, $05, unk_012_467b + scr_04 text_12_7746 + scr_end -ObjectEvents_012_449e:: - dr $4849e, $484b5 +unk_012_467b: + scr_04 text_12_735b + scr_end -ObjectEvents_012_44b5:: - dr $484b5, $484cd +Script_012_467f: + scr_checkbit wdaa4, $02, unk_012_4689 + scr_04 text_12_5338 + scr_end -Script_012_44cd:: - dr $484cd, $48589 +unk_012_4689: + scr_04 text_12_736f + scr_end -ObjectEvents_012_4589:: - dr $48589, $4870f +Script_012_468d: + scr_04 text_12_5396 + scr_checkbit wdaa3, $03, unk_012_469a + scr_text text_12_53b6 + scr_end + +unk_012_469a: + scr_text text_12_53a4 + scr_end + +Script_012_469e: + scr_04 text_12_546f + scr_end + +Script_012_46a2: + scr_04 text_12_54b8 + scr_end + +Script_012_46a6: + scr_04 text_12_5528 + scr_end + +Script_012_46aa: + scr_04 text_12_5589 + scr_end + +Script_012_46ae: + scr_04 text_12_560d + scr_end + +Script_012_46b2: + scr_04 text_12_563e + scr_end + +Script_012_46b6: + scr_04 text_12_5682 + scr_end + +Script_012_46ba: + scr_04 text_12_56ec + scr_end + +Script_012_46be: + scr_04 text_12_5733 + scr_end + +Script_012_46c2: + scr_24 + scr_face $01 ; TEMP + scr_5f + scr_spriteface 1, FACE_UP + scr_text text_12_579d + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_57fa + scr_text text_12_580d + scr_text text_12_58ef + scr_spriteface 2, FACE_LEFT + scr_spritewalk 2, MOVE_LEFT + scr_spriteface 2, FACE_DOWN + scr_text text_12_58fd + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_599a + scr_4e $02, unk_012_4e4a + scr_1c $02 ; TEMP + scr_setbit $daa3, $02 ; TEMP + scr_end + +Script_012_46fb: + scr_checkbit wdaa4, $04, Script_012_4705 + +Script_012_4701: + scr_04 text_12_5b24 + scr_end + +Script_012_4705: + scr_checkbit wdaa4, $05, Script_012_4701 + scr_04 text_12_7787 + scr_end Script_012_470f:: - dr $4870f, $4871d + scr_checkbit wdaa4, $04, Script_012_4719 + scr_setmap $0d, $01 ; TEMP + scr_69 + +Script_012_4719: + scr_setmap $0d, $00 ; TEMP + scr_69 ObjectEvents_012_471d:: - dr $4871d, $48781 + object_event $33, 5, 3, wdaa4, $05, $00, $00, $00, Script_012_4735 + objects_end + +ObjectEvents_012_4729: + object_event $48, 5, 3, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +Script_012_4735: + scr_04 text_12_77ea + scr_text text_12_77ff + scr_text text_12_7870 + scr_3b unk_012_4b50 + scr_checkbit wdaa3, $03, Script_012_4780 + scr_spriteface 2, FACE_UP + scr_16 ObjectEvents_012_4729 ; TEMP + scr_4e $03, unk_012_4f8c + scr_1c $03 ; TEMP + scr_16 ObjectEvents_012_4729 ; TEMP + scr_4e $03, unk_012_4fb5 + scr_1c $03 ; TEMP + scr_16 ObjectEvents_012_4729 ; TEMP + scr_4e $03, unk_012_4fe2 + scr_1c $03 ; TEMP + scr_16 ObjectEvents_012_4729 ; TEMP + scr_4e $03, unk_012_500f + scr_1c $03 ; TEMP + scr_16 ObjectEvents_012_4729 ; TEMP + scr_4e $03, unk_012_503c + scr_1c $03 ; TEMP + scr_1c $02 ; TEMP + scr_setbit $daa4, $05 ; TEMP + scr_1f $0a ; TEMP + scr_end + +Script_012_4780: + scr_end + +Script_012_4781: + scr_65 $00 ; TEMP + scr_setmap $11, $01 ; TEMP + scr_face $02 ; TEMP + scr_spriteface 2, FACE_RIGHT + scr_text text_12_7945 + scr_text text_12_7970 + scr_emote $02, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7977 + scr_text text_12_799d + scr_text text_12_79cc + scr_face $00 ; TEMP + scr_spriteface 2, FACE_DOWN + scr_4e $02, unk_012_4e4a + scr_1c $02 ; TEMP + scr_face $01 ; TEMP + scr_34 $04, $0e, $04 ; TEMP + scr_text text_12_7a96 + scr_text text_12_7aac + scr_emote $02, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_spritewalk 2, MOVE_UP + scr_text text_12_7ad7 + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7b78 + scr_text text_12_7b83 + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7bbb + scr_text text_12_7be4 + scr_text text_12_7c4b + scr_48 $02, $0a + scr_text text_12_7c5a + scr_text text_12_7ca6 + scr_text text_12_7cb9 + scr_text text_12_7cdd + scr_62 $02, $00 ; TEMP + scr_setbit $daa4, $06 ; TEMP + scr_1f $0b ; TEMP + scr_end + +ObjectEvents_012_47f7: + object_event $2f, 5, 4, 0, $00, $00, $00, $00, unk_012_4819 + object_event $30, 4, 4, 0, $00, $00, $00, $01, unk_012_481d + object_event $04, 6, 5, wdab7, $07, $00, $00, $02, unk_012_4827 + objects_end -Script_012_4781:: - dr $48781, $487f7 +unk_012_4819: + scr_04 text_12_7e2d + scr_end -ObjectEvents_012_47f7:: - dr $487f7, $4882b +unk_012_481d: + scr_checkbit wdaa4, $06, unk_012_4826 + scr_04 text_12_7e6d -Script_012_482b:: - dr $4882b, $48850 +unk_012_4826: + scr_end + +unk_012_4827: + scr_04 text_12_7cdd + scr_end + +Script_012_482b: + scr_text text_12_7cf0 + scr_spritewalk 4, MOVE_UP + scr_face $01 ; TEMP + scr_move MovementData_OneUp + scr_44 + scr_spritewalk 1, MOVE_UP + scr_spriteface 1, FACE_UP + scr_face $03 ; TEMP + scr_move MovementData_OneRight + scr_face $01 ; TEMP + scr_spriteface 1, FACE_RIGHT + scr_spritewalk 1, MOVE_RIGHT + scr_spriteface 1, FACE_UP + scr_jump Script_012_4862 Script_012_4850:: - dr $48850, $4896b + scr_text text_12_7cf0 + scr_spritewalk 4, MOVE_UP + scr_face $01 ; TEMP + scr_move MovementData_OneUp + scr_44 + scr_spritewalk 1, MOVE_UP + scr_spriteface 1, FACE_UP + +Script_012_4862: + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7d04 + scr_text text_12_7d0e + scr_spriteface 2, FACE_DOWN + scr_spriteface 4, FACE_UP + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7d79 + scr_spritewalk 3, MOVE_UP + scr_spritewalk 3, MOVE_UP + scr_spriteface 3, FACE_RIGHT + scr_spriteface 4, FACE_LEFT + scr_text text_12_7d90 + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7de7 + scr_spriteface 2, FACE_DOWN + scr_spriteface 4, FACE_DOWN + scr_text text_12_7df5 + scr_text text_12_7e02 + scr_text text_12_7e1a + scr_spritewalk 4, MOVE_UP + scr_44 + scr_spritewalk 4, MOVE_UP + scr_1c $04 ; TEMP + scr_62 $02, $01 ; TEMP + scr_1f $0c ; TEMP + scr_setbit $dab7, $07 ; TEMP + scr_end + +Script_012_48b7: + scr_04 text_12_5b82 + scr_end + +Script_012_48bb: + scr_checkbit wdaa3, $05, unk_012_48c5 + scr_04 text_12_5ba7 + scr_end + +unk_012_48c5: + scr_04 text_12_6550 + scr_end + +Script_012_48c9: + scr_checkbit wdaa3, $05, unk_012_48d3 + scr_04 text_12_5bd5 + scr_end -ObjectEvents_012_496b:: - dr $4896b, $4898a +unk_012_48d3: + scr_04 text_12_65ab + scr_end + +Script_012_48d7: + scr_checkbit wdaa3, $05, unk_012_48e1 + scr_04 text_12_5c51 + scr_end + +unk_012_48e1: + scr_04 text_12_6629 + scr_end + +Script_012_48e5: + scr_04 text_12_5c92 + scr_end + +Script_012_48e9: + scr_checkbit wdaa3, $05, unk_012_48f3 + scr_04 text_12_5d14 + scr_end + +unk_012_48f3: + scr_04 text_12_6655 + scr_end + +Script_012_48f7: + scr_checkbit wdaa3, $05, unk_012_4901 + scr_04 text_12_5d7a + scr_end + +unk_012_4901: + scr_04 text_12_66e4 + scr_end + +Script_012_4905: + scr_checkbit wdaa3, $05, unk_012_490f + scr_04 text_12_5dab + scr_end + +unk_012_490f: + scr_04 text_12_673b + scr_end + +Script_012_4913: + scr_04 text_12_5dff + scr_end + +Script_012_4917: + scr_04 text_12_5e82 + scr_end + +Script_012_491b: + scr_04 text_12_5f2e + scr_end + +Script_012_491f: + scr_checkbit wdaa3, $05, Script_012_4929 + scr_04 text_12_5fa8 + scr_end + +Script_012_4929: + scr_04 text_12_6796 + scr_end + +Script_012_492d: + scr_checkbit wdaa3, $05, unk_012_4937 + scr_04 text_12_5fc7 + scr_end + +unk_012_4937: + scr_04 text_12_67b8 + scr_end + +Script_012_493b: + scr_checkbit wdaa3, $05, unk_012_4948 + scr_04 text_12_6032 + scr_text text_12_6064 + scr_end + +unk_012_4948: + scr_checkbit wdaa3, $07, unk_012_4959 + scr_04 text_12_6812 + scr_text text_12_6864 + scr_setbit $daa3, $07 ; TEMP + scr_end + +unk_012_4959: + scr_04 text_12_6812 + scr_end + +Script_012_495d: + scr_checkbit wdaa3, $05, unk_012_4967 + scr_04 text_12_60b5 + scr_end + +unk_012_4967: + scr_04 text_12_686f + scr_end + +ObjectEvents_012_496b: + object_event $25, 4, 2, 0, $00, $00, $00, $00, unk_012_4982 + object_event $25, 8, 2, 0, $00, $00, $00, $01, unk_012_4986 + objects_end + +unk_012_4982: + scr_text unk_012_7ebe + scr_end + +unk_012_4986: + scr_text unk_012_7ed6 + scr_end Script_012_498a:: - dr $4898a, $48998 + scr_face $01 ; TEMP + scr_text unk_012_7ebe + scr_checkbit wdaa3, $03, unk_012_4997 + scr_37 + scr_end + +unk_012_4997: + scr_end Script_012_4998:: - dr $48998, $489a6 + scr_face $01 ; TEMP + scr_text unk_012_7ed6 + scr_checkbit wdaa3, $03, unk_012_49a5 + scr_36 + scr_end + +unk_012_49a5: + scr_end ObjectEvents_012_49a6:: - dr $489a6, $489b6 + object_event $22, 2, 3, 0, $00, $00, $00, $00, unk_012_49b2 + objects_end -Script_012_49b6:: - dr $489b6, $489c8 +unk_012_49b2: + scr_04 unk_012_7f05 + scr_end + +Script_012_49b6: + scr_face $02 ; TEMP + scr_spriteface 2, FACE_RIGHT + scr_text unk_012_7f05 + scr_checkbit wdaa4, $01, unk_012_49c7 + scr_35 $01 ; TEMP + scr_end -Script_012_49c8:: - dr $489c8, $489d9 +unk_012_49c7: + scr_end + +Script_012_49c8: + scr_face $02 ; TEMP + scr_spriteface 2, FACE_RIGHT + scr_text unk_012_7f05 + scr_checkbit wdaa4, $01, unk_012_49c7 + scr_35 $02 ; TEMP + scr_end Script_012_49d9:: - dr $489d9, $489f9 + scr_checkbit wdaa4, $02, unk_012_49f8 + scr_text text_12_5a30 + scr_checkbit wdaa3, $02, unk_012_49e9 + scr_end -ObjectEvents_012_49f9:: - dr $489f9, $48b0c +unk_012_49e9: + scr_checkbit wdaa4, $07, unk_012_49f8 + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_5abd + +unk_012_49f8: + scr_end +ObjectEvents_012_49f9:: + object_event $32, 6, 5, wdaa3, $05, $00, $00, $00, unk_012_4a05 + objects_end + +unk_012_4a05: + scr_04 text_12_6471 + scr_text text_12_6486 + scr_3b unk_012_4b40 ; XXX + scr_checkbit wdaa3, $03, Script_012_4780 + scr_spriteface 2, FACE_UP + scr_spriteface 2, FACE_LEFT + scr_spriteface 2, FACE_RIGHT + scr_1c $02 ; TEMP + scr_16 unk_012_4a93 ; TEMP + scr_4e $03, unk_012_4f8c + scr_1c $03 ; TEMP + scr_16 unk_012_4a9f ; TEMP + scr_4e $03, unk_012_4fb5 + scr_1c $03 ; TEMP + scr_16 unk_012_4aab ; TEMP + scr_4e $03, unk_012_4fe2 + scr_1c $03 ; TEMP + scr_16 unk_012_4ab7 ; TEMP + scr_4e $03, unk_012_500f + scr_1c $03 ; TEMP + scr_16 unk_012_4ac3 ; TEMP + scr_4e $03, unk_012_503c + scr_1c $03 ; TEMP + scr_setmap $02, $09 ; TEMP + scr_spriteface 2, FACE_UP + scr_16 unk_012_4ad0 ; TEMP + scr_4e $03, unk_012_5167 + scr_1c $03 ; TEMP + scr_16 unk_012_4adc ; TEMP + scr_4e $03, unk_012_5167 + scr_1c $03 ; TEMP + scr_16 unk_012_4ae8 ; TEMP + scr_4e $03, unk_012_5167 + scr_1c $03 ; TEMP + scr_16 unk_012_4af4 ; TEMP + scr_4e $03, unk_012_5167 + scr_1c $03 ; TEMP + scr_16 unk_012_4b00 ; TEMP + scr_4e $03, unk_012_5167 + scr_1c $03 ; TEMP + scr_text text_12_64ba + scr_setmap $05, $01 ; TEMP + scr_text text_12_64fb + scr_text text_12_653d + scr_48 $02, $08 + scr_setbit $daa3, $05 ; TEMP + scr_end + +unk_012_4a93: + object_event $48, 6, 5, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4a9f: + object_event $48, 6, 5, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4aab: + object_event $48, 6, 5, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4ab7: + object_event $48, 6, 5, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4ac3: + object_event $48, 6, 5, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +Script_012_4acf: + scr_end + +unk_012_4ad0: + object_event $48, 13, 11, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4adc: + object_event $48, 18, 11, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4ae8: + object_event $48, 16, 11, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4af4: + object_event $48, 14, 11, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + +unk_012_4b00: + object_event $48, 17, 11, 0, $00, $00, $00, $01, Script_012_4acf + objects_end + ObjectEvents_012_4b0c:: - dr $48b0c, $48b18 + object_event $1d, 14, 18, 0, $00, $00, $00, $00, Script_012_4acf + objects_end ObjectEvents_012_4b18:: - dr $48b18, $48b45 + object_event $2f, 4, 2, wdaa4, $02, $00, $00, $00, Script_012_44cc + object_event $2d, 6, 3, wdaa4, $02, $00, $00, $01, Script_012_44cc + object_event $30, 5, 2, wdaa4, $02, $00, $00, $02, Script_012_44cc + + db $04, 4, 4 + dw wdaa4 + db $02, $00 +unk_012_4b40: ; VF moment + db $00, $03 + dw Script_012_44cc + objects_end ObjectEvents_012_4b45:: - dr $48b45, $48b72 + object_event $2f, 5, 3, wdaa4, $02, $00, $00, $00, Script_012_44cc + +unk_012_4b50: + object_event $2d, 6, 3, wdaa4, $02, $00, $00, $01, Script_012_44cc + object_event $30, 5, 2, wdaa4, $02, $00, $00, $02, Script_012_44cc + object_event $04, 4, 4, wdaa4, $02, $00, $00, $03, Script_012_44cc + objects_end Script_012_4b72:: - dr $48b72, $48c71 + scr_checkbit wdaa4, $07, unk_012_4b94 + scr_setmap $0e, $00 ; TEMP + scr_end + +unk_012_4b7c: + scr_checkbit wdaa4, $03, unk_012_4b86 + scr_setmap $0e, $00 ; TEMP + scr_end + +unk_012_4b86: + scr_checkbit wdaa4, $06, unk_012_4b90 + scr_setmap $0e, $05 ; TEMP + scr_end + +unk_012_4b90: + scr_setmap $0e, $04 ; TEMP + scr_end + +unk_012_4b94: + scr_checkbit wdaa4, $02, unk_012_4b7c + scr_65 $00 ; TEMP + scr_setmap $0e, $02 ; TEMP + scr_spriteface 3, FACE_LEFT + scr_spriteface 5, FACE_UP + scr_spriteface 4, FACE_LEFT + scr_text text_12_6f16 + scr_spriteface 2, FACE_RIGHT + scr_text text_12_6f1e + scr_spriteface 2, FACE_DOWN + scr_spriteface 4, FACE_DOWN + scr_spriteface 3, FACE_DOWN + scr_text text_12_6f2f + scr_text text_12_6f96 + scr_spriteface 2, FACE_RIGHT + scr_spriteface 4, FACE_LEFT + scr_text text_12_6faa + scr_text text_12_6fc4 + scr_text text_12_6fcc + scr_spriteface 4, FACE_DOWN + scr_spriteface 2, FACE_DOWN + scr_spritewalk 2, MOVE_UP + scr_spriteface 2, FACE_RIGHT + scr_spritewalk 2, MOVE_RIGHT + scr_spriteface 2, FACE_DOWN + scr_text text_12_6fe9 + scr_emote $00, $02 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7033 + scr_48 $02, $09 + scr_52 ; TEMP + scr_34 $0d, $0e, $07 ; TEMP + scr_spriteface 3, FACE_LEFT + scr_spriteface 5, FACE_UP + scr_spriteface 2, FACE_LEFT + scr_spritewalk 2, MOVE_LEFT + scr_spriteface 2, FACE_DOWN + scr_text text_12_7042 + scr_text text_12_70a2 + scr_text text_12_70af + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_spriteface 2, FACE_UP + scr_spritewalk 2, MOVE_DOWN + scr_spriteface 2, FACE_RIGHT + scr_spriteface 4, FACE_LEFT + scr_text text_12_70ec + scr_spriteface 2, FACE_DOWN + scr_spriteface 4, FACE_DOWN + scr_text text_12_7122 + scr_text text_12_7159 + scr_spritewalk 2, MOVE_UP + scr_text text_12_7169 + scr_text text_12_71f8 + scr_spriteface 2, FACE_UP + scr_spritewalk 2, MOVE_DOWN + scr_spriteface 2, FACE_RIGHT + scr_spriteface 4, FACE_LEFT + scr_text text_12_7203 + scr_spriteface 2, FACE_LEFT + scr_1a $04, $02, $00, $10 ; TEMP + scr_4e $02, unk_012_4e29 + scr_1b $04 ; TEMP + scr_1c $02 ; TEMP + scr_1c $04 ; TEMP + scr_spriteface 3, FACE_DOWN + scr_4e $03, unk_012_4e4a + scr_1c $03 ; TEMP + scr_spriteface 5, FACE_RIGHT + scr_44 + scr_spritewalk 5, MOVE_RIGHT + scr_1c $05 ; TEMP + scr_setbit $daa4, $02 ; TEMP + scr_1f $08 ; TEMP + scr_end ObjectEvents_012_4c71:: - dr $48c71, $48c7d + object_event $04, 6, 6, 0, $00, $00, $00, $00, Script_012_44cc + objects_end ObjectEvents_012_4c7d:: - dr $48c7d, $48c95 + object_event $11, 5, 2, 0, $00, $00, $00, $00, Script_012_44cc + objects_end + +unk_012_4c89: + object_event $04, 1, 6, 0, $00, $00, $00, $00, Script_012_44cc + objects_end Script_012_4c95:: - dr $48c95, $48d14 + scr_65 $00 ; TEMP + scr_setmap $11, $01 ; TEMP + scr_face $02 ; TEMP + scr_spriteface 2, FACE_RIGHT + scr_text text_12_739a + scr_text text_12_73c5 + scr_text text_12_7412 + scr_emote $00, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_748c + scr_text text_12_7497 + scr_text text_12_74d8 + scr_text text_12_74df + scr_spriteface 2, FACE_DOWN + scr_4e $02, unk_012_4e4a + scr_1c $02 ; TEMP + scr_face $01 ; TEMP + scr_5e $00 ; TEMP + scr_setmap $23, $00 ; TEMP + scr_text text_12_74f8 + scr_text text_12_751b + scr_text text_12_755b + scr_text text_12_756e + scr_spriteface 2, FACE_UP + scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_DOWN + scr_1c $02 ; TEMP + scr_move MovementData_OneUp + scr_text text_12_7576 + scr_face $00 ; TEMP + scr_5e $02 ; TEMP + scr_setmap $11, $02 ; TEMP + scr_emote $00, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_75b7 + scr_text text_12_75c0 + scr_16 unk_012_4c89 ; TEMP + scr_spriteface 2, FACE_RIGHT + scr_4e $02, unk_012_4df8 + scr_text text_12_75ce + scr_44 + scr_spritewalk 2, MOVE_RIGHT + scr_1c $02 ; TEMP + scr_setbit $daa4, $03 ; TEMP + scr_1f $09 ; TEMP + scr_end Script_012_4d14:: - dr $48d14, $48d2c + scr_checkbit wdaa4, $03, unk_012_4d1e + scr_setmap $0e, $01 ; TEMP + scr_69 + +unk_012_4d1e: + scr_checkbit wdaa4, $06, unk_012_4d28 + scr_setmap $0e, $03 ; TEMP + scr_69 + +unk_012_4d28: + scr_setmap $0e, $06 ; TEMP + scr_69 ObjectEvents_012_4d2c:: - dr $48d2c, $48d71 + object_event $2d, 6, 5, 0, $00, $00, $00, $00, unk_012_4d38 + objects_end + +unk_012_4d38: + scr_checkbit wdaa4, $05, unk_012_4d6d + scr_24 + scr_face $01 ; TEMP + scr_5f + scr_spriteface 1, FACE_UP + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_75f9 + scr_emote $02, $00 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_763c + scr_face $02 ; TEMP + scr_move MovementData_OneLeft + scr_44 + scr_spritewalk 1, MOVE_DOWN + scr_spriteface 1, FACE_LEFT + scr_emote $00, $03 ; TEMP + scr_delay $03, $20 ; TEMP + scr_text text_12_7696 + scr_end -Script_012_4d71:: - dr $48d71, $48d76 +unk_012_4d6d: + scr_04 text_12_78bd + scr_end + +Script_012_4d71: + db $66 ; TEMP + db $84 ; TEMP + db $43 ; TEMP + db $4f ; TEMP + scr_end unk_012_4d76:: dr $48d76, $48db7 unk_012_4db7:: - dr $48db7, $49194 + dr $48db7, $48df8 + +unk_012_4df8:: + dr $48df8, $48e29 + +unk_012_4e29:: + dr $48e29, $48e4a + +unk_012_4e4a:: + dr $48e4a, $48f8c + +unk_012_4f8c:: + dr $48f8c, $48fb5 + +unk_012_4fb5:: + dr $48fb5, $48fe2 + +unk_012_4fe2:: + dr $48fe2, $4900f + +unk_012_500f:: + dr $4900f, $4903c + +unk_012_503c:: + dr $4903c, $49065 + +unk_012_5065:: + dr $49065, $4906b + +unk_012_506b:: + dr $4906b, $4908e + +unk_012_508e:: + dr $4908e, $490b7 + +unk_012_50b7:: + dr $490b7, $490f6 + +unk_012_50f6:: + dr $490f6, $49167 + +unk_012_5167:: + dr $49167, $49194 INCLUDE "data/text/bank12_misc.asm" text_12_7eac: - dr $4beac, $4bf1c + dr $4beac, $4bebe + +unk_012_7ebe: + dr $4bebe, $4bed6 + +unk_012_7ed6: + dr $4bed6, $4bf05 + +unk_012_7f05: + dr $4bf05, $4bf1c SECTION "banknum12", ROMX[$7fff], BANK[$12] db $12 diff --git a/data/text/bank12_41f1.txt b/data/text/bank12_41f1.txt new file mode 100644 index 0000000..2945649 --- /dev/null +++ b/data/text/bank12_41f1.txt @@ -0,0 +1,5 @@ +@org $12, $41f1: + init $00, $1a; # TEMP + text "嗯,找死!"; + line ""; + done; \ No newline at end of file From fd3b39fbabcd56c22a9e83331e0ee7b96c9b9399 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Tue, 5 Oct 2021 08:28:04 +0700 Subject: [PATCH 6/7] utils: make util to print nearest symbol to address --- utils/get_nearest_symbol.py | 38 +++++++++++++++++++++++++++++++++++++ utils/lib/gbtool.py | 3 +++ 2 files changed, 41 insertions(+) create mode 100644 utils/get_nearest_symbol.py diff --git a/utils/get_nearest_symbol.py b/utils/get_nearest_symbol.py new file mode 100644 index 0000000..5977658 --- /dev/null +++ b/utils/get_nearest_symbol.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +import re +import sys +from lib.gbtool import * + +def get_relative_symbol(sym_table, address): + relative = 0 + while not (is_symbol_defined(sym_table, address)): + address -= 1 + relative += 1 + if relative == 0: + return get_symbol(sym_table, address) + return '%s + %d' % (get_symbol(sym_table, address), relative) + +if __name__ == '__main__': + if len(sys.argv) < 2: + print(f'{sys.argv[0]} address') + print('\taddress can be in BB:AAAA form or as a hex number') + exit(0) + + addr_str = lambda x: '%03x:%04x' % x + + # extract symbols + with open('shi_kong_xing_shou.sym', 'r') as sym: + string = sym.read() + symbol = read_symbols(string) + rom_sym = symbol['rom'] + ram_sym = symbol['ram'] + + # get address + s = sys.argv[1] + s_= re.match('([0-9a-fA-F]+):([0-9a-fA-F]{4})$', s) + if s_: + start = addr2offset(*str2addr(s)) + else: + start = int(s, 16) + + print(get_relative_symbol(rom_sym, start)) \ No newline at end of file diff --git a/utils/lib/gbtool.py b/utils/lib/gbtool.py index 67c2e00..c1b2eaa 100644 --- a/utils/lib/gbtool.py +++ b/utils/lib/gbtool.py @@ -86,6 +86,9 @@ def get_symbol(symbol_table, address): else: return 'unk_%03x_%04x' % offset2addr(address) +def is_symbol_defined(symbol_table, address): + return address in symbol_table + # syntactic sugar get_number = lambda src, bytes: int.from_bytes(src.read(bytes), byteorder='little') From 89e9893b21c646ed351d92a62e06118d06fab4d9 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Tue, 5 Oct 2021 08:28:15 +0700 Subject: [PATCH 7/7] whoops --- banks/bank_07.asm | 2 +- banks/bank_0e.asm | 1 - banks/bank_12.asm | 54 +++++++++++++++++++-------------------- macros/scripts/script.asm | 2 ++ utils/dump_scripts.py | 4 +-- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/banks/bank_07.asm b/banks/bank_07.asm index 6696430..312f9cc 100755 --- a/banks/bank_07.asm +++ b/banks/bank_07.asm @@ -963,7 +963,7 @@ unk_007_4ed2: unk_007_4edf: warp_event ABSOLUTE, 8, $2d, $0a, $00 - event_04 4, 3, 0, unk_00e_4651 + event_04 4, 3, 0, unk_00e_4652 events_end unk_007_4eec: diff --git a/banks/bank_0e.asm b/banks/bank_0e.asm index 47ff496..6a46478 100755 --- a/banks/bank_0e.asm +++ b/banks/bank_0e.asm @@ -611,7 +611,6 @@ unk_00e_4642: Script_00e_464e: scr_text text_0e_5b91 -unk_00e_4651: scr_end unk_00e_4652: diff --git a/banks/bank_12.asm b/banks/bank_12.asm index d57d3ca..98f5c9e 100755 --- a/banks/bank_12.asm +++ b/banks/bank_12.asm @@ -381,8 +381,8 @@ Script_012_43a1: scr_delay $03, $20 ; TEMP scr_text text_12_6bc1 scr_spriteface 2, FACE_UP - scr_spritewalk 2, MOVE_DOWN - scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_UP scr_text text_12_6c0b scr_spriteface 2, FACE_DOWN scr_text text_12_6c54 @@ -421,7 +421,7 @@ Script_012_43a1: scr_spriteface 1, FACE_UP scr_spriteface 3, FACE_UP scr_text text_12_6e65 - scr_spritewalk 3, MOVE_DOWN + scr_spritewalk 3, MOVE_UP scr_spriteface 3, FACE_LEFT scr_face $02 ; TEMP scr_spriteface 1, FACE_LEFT @@ -432,11 +432,11 @@ Script_012_43a1: scr_face $00 ; TEMP scr_spriteface 1, FACE_DOWN scr_spriteface 2, FACE_DOWN - scr_spritewalk 2, MOVE_UP - scr_spritewalk 2, MOVE_UP - scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_DOWN scr_1c $02 ; TEMP - scr_spritewalk 3, MOVE_UP + scr_spritewalk 3, MOVE_DOWN scr_text text_12_6ef7 scr_spriteface 3, FACE_RIGHT scr_44 @@ -495,7 +495,7 @@ Script_012_44db: scr_face $01 ; TEMP scr_emote $02, $00 ; TEMP scr_delay $03, $20 ; TEMP - scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_DOWN scr_spriteface 2, FACE_RIGHT scr_spriteface 3, FACE_LEFT scr_text text_12_68c4 @@ -508,7 +508,7 @@ Script_012_44db: scr_delay $03, $20 ; TEMP scr_text text_12_691e scr_spriteface 2, FACE_DOWN - scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_DOWN scr_face $02 ; TEMP scr_text text_12_6927 scr_spriteface 3, FACE_DOWN @@ -536,7 +536,7 @@ Script_012_44db: scr_text text_12_6b93 scr_text text_12_6bb4 scr_44 - scr_spritewalk 3, MOVE_UP + scr_spritewalk 3, MOVE_DOWN scr_1c $03 ; TEMP scr_setbit $daa3, $06 ; TEMP scr_end @@ -581,7 +581,7 @@ Script_012_45b3: scr_delay $03, $20 ; TEMP scr_text text_12_6394 scr_44 - scr_spritewalk 4, MOVE_UP + scr_spritewalk 4, MOVE_DOWN scr_1c $04 ; TEMP scr_44 scr_spritewalk 3, MOVE_LEFT @@ -817,7 +817,7 @@ Script_012_4781: scr_text text_12_7aac scr_emote $02, $03 ; TEMP scr_delay $03, $20 ; TEMP - scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_DOWN scr_text text_12_7ad7 scr_emote $00, $03 ; TEMP scr_delay $03, $20 ; TEMP @@ -861,11 +861,11 @@ unk_012_4827: Script_012_482b: scr_text text_12_7cf0 - scr_spritewalk 4, MOVE_UP + scr_spritewalk 4, MOVE_DOWN scr_face $01 ; TEMP scr_move MovementData_OneUp scr_44 - scr_spritewalk 1, MOVE_UP + scr_spritewalk 1, MOVE_DOWN scr_spriteface 1, FACE_UP scr_face $03 ; TEMP scr_move MovementData_OneRight @@ -877,11 +877,11 @@ Script_012_482b: Script_012_4850:: scr_text text_12_7cf0 - scr_spritewalk 4, MOVE_UP + scr_spritewalk 4, MOVE_DOWN scr_face $01 ; TEMP scr_move MovementData_OneUp scr_44 - scr_spritewalk 1, MOVE_UP + scr_spritewalk 1, MOVE_DOWN scr_spriteface 1, FACE_UP Script_012_4862: @@ -894,8 +894,8 @@ Script_012_4862: scr_emote $02, $00 ; TEMP scr_delay $03, $20 ; TEMP scr_text text_12_7d79 - scr_spritewalk 3, MOVE_UP - scr_spritewalk 3, MOVE_UP + scr_spritewalk 3, MOVE_DOWN + scr_spritewalk 3, MOVE_DOWN scr_spriteface 3, FACE_RIGHT scr_spriteface 4, FACE_LEFT scr_text text_12_7d90 @@ -907,9 +907,9 @@ Script_012_4862: scr_text text_12_7df5 scr_text text_12_7e02 scr_text text_12_7e1a - scr_spritewalk 4, MOVE_UP + scr_spritewalk 4, MOVE_DOWN scr_44 - scr_spritewalk 4, MOVE_UP + scr_spritewalk 4, MOVE_DOWN scr_1c $04 ; TEMP scr_62 $02, $01 ; TEMP scr_1f $0c ; TEMP @@ -1272,7 +1272,7 @@ unk_012_4b94: scr_text text_12_6fcc scr_spriteface 4, FACE_DOWN scr_spriteface 2, FACE_DOWN - scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_DOWN scr_spriteface 2, FACE_RIGHT scr_spritewalk 2, MOVE_RIGHT scr_spriteface 2, FACE_DOWN @@ -1294,7 +1294,7 @@ unk_012_4b94: scr_emote $02, $00 ; TEMP scr_delay $03, $20 ; TEMP scr_spriteface 2, FACE_UP - scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_UP scr_spriteface 2, FACE_RIGHT scr_spriteface 4, FACE_LEFT scr_text text_12_70ec @@ -1302,11 +1302,11 @@ unk_012_4b94: scr_spriteface 4, FACE_DOWN scr_text text_12_7122 scr_text text_12_7159 - scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_DOWN scr_text text_12_7169 scr_text text_12_71f8 scr_spriteface 2, FACE_UP - scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_UP scr_spriteface 2, FACE_RIGHT scr_spriteface 4, FACE_LEFT scr_text text_12_7203 @@ -1364,8 +1364,8 @@ Script_012_4c95:: scr_text text_12_755b scr_text text_12_756e scr_spriteface 2, FACE_UP - scr_spritewalk 2, MOVE_DOWN - scr_spritewalk 2, MOVE_DOWN + scr_spritewalk 2, MOVE_UP + scr_spritewalk 2, MOVE_UP scr_1c $02 ; TEMP scr_move MovementData_OneUp scr_text text_12_7576 @@ -1420,7 +1420,7 @@ unk_012_4d38: scr_face $02 ; TEMP scr_move MovementData_OneLeft scr_44 - scr_spritewalk 1, MOVE_DOWN + scr_spritewalk 1, MOVE_UP scr_spriteface 1, FACE_LEFT scr_emote $00, $03 ; TEMP scr_delay $03, $20 ; TEMP diff --git a/macros/scripts/script.asm b/macros/scripts/script.asm index cbc4f36..fe615ed 100755 --- a/macros/scripts/script.asm +++ b/macros/scripts/script.asm @@ -333,6 +333,8 @@ scr_4e: MACRO dw \2 ENDM + const_def $52 + const script_52 ; $52 scr_52: MACRO db script_52 diff --git a/utils/dump_scripts.py b/utils/dump_scripts.py index 8c566f8..8f906f6 100755 --- a/utils/dump_scripts.py +++ b/utils/dump_scripts.py @@ -77,9 +77,9 @@ if arg2 == 0: print("\tscr_spritewalk %2d, MOVE_DELAY" % arg1) elif arg2 == 1: - print("\tscr_spritewalk %2d, MOVE_UP" % arg1) - elif arg2 == 2: print("\tscr_spritewalk %2d, MOVE_DOWN" % arg1) + elif arg2 == 2: + print("\tscr_spritewalk %2d, MOVE_UP" % arg1) elif arg2 == 3: print("\tscr_spritewalk %2d, MOVE_LEFT" % arg1) elif arg2 == 4: