From e447a2d6879fdc9010848de5594acbaf17cb0c16 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 27 Aug 2020 00:15:37 +0200 Subject: [PATCH] [Position independence] [th04/th05] Final data references in TH05's MAIN.EXE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And that's it, actual position dependence achieved! 🎉 Again, the website won't quite show 100% PI, but that (again) are all false positives, to be covered in an upcoming push… Completes P0112, funded by [Anonymous] and Blue Bolt. --- th04_main.asm | 11 +++++++---- th05/main/custom[bss].asm | 3 ++- th05_main.asm | 25 ++++++++++++++----------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/th04_main.asm b/th04_main.asm index e4c2dbc9..1fb4666b 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -1016,7 +1016,7 @@ var_4 = dword ptr -4 mov word ptr _DemoBuf+2, ax mov word ptr _DemoBuf, 0 mov word ptr [bp+var_4+2], ds - mov word ptr [bp+var_4], 1EDh + mov word ptr [bp+var_4], offset aDemo0_rec les bx, _resident mov al, es:[bx+resident_t.demo_num] add al, '0' @@ -3470,7 +3470,7 @@ var_1 = byte ptr -1 push si push di mov word ptr [bp+var_6+2], ds - mov word ptr [bp+var_6], 18A0h + mov word ptr [bp+var_6], offset _dialog_kanji_buf loc_D57A: les bx, dword_255CC @@ -29793,7 +29793,7 @@ loc_1D5CB: push [bp+arg_8] mov bx, [bp+arg_6] shl bx, 2 - pushd dword ptr [bx+1F3Ah] + pushd _STAGE_CLEAR_BONUS_DESC[bx] push ax call text_putsa pop si @@ -34951,7 +34951,8 @@ include th04/formats/dialog[data].asm byte_22BCA db 0 a_dm00_txt db '_DM00.TXT',0 a_dm04b_txt db '_DM04B.txt',0 - db ' ',0 +public _dialog_kanji_buf +_dialog_kanji_buf db ' ',0 aKao0_cd2_0 db 'KAO0.cd2',0 aKao1_cd2_0 db 'KAO1.cd2',0 aBss7_cd2 db 'bss7.cd2',0 @@ -35434,6 +35435,8 @@ aGensou_scr_1 db 'GENSOU.SCR',0 aGensou_scr_2 db 'GENSOU.SCR',0 byte_23278 db 0 db 0 +public _STAGE_CLEAR_BONUS_DESC +_STAGE_CLEAR_BONUS_DESC label dword dd aBOSS_FINAL_TIMEOUT dd aPENALTY_6 dd aPENALTY_5 diff --git a/th05/main/custom[bss].asm b/th05/main/custom[bss].asm index bd60840d..0f1ae501 100644 --- a/th05/main/custom[bss].asm +++ b/th05/main/custom[bss].asm @@ -147,4 +147,5 @@ b6balls equ <_custom_entities[1 * size b6ball_t]> ; -------------------- public _custom_entities -_custom_entities custom_t (CUSTOM_COUNT + 1) dup () +_custom_entities custom_t CUSTOM_COUNT dup () + custom_t ; 1 additional unused one, for some reason? diff --git a/th05_main.asm b/th05_main.asm index 35a9bfa0..60c0f75b 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -192,15 +192,15 @@ mptn_load_inner proc far mov bx, ax mov si, bx mov ah, 3Fh ; '?' - mov dx, 265Ch + mov dx, offset Palettes mov cx, 6 int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE ; BX = file handle, CX = number of bytes to read ; DS:DX -> buffer mov di, word ptr Palettes+4 mov ah, 3Fh ; '?' - mov dx, 265Ch - mov cx, 30h ; '0' + mov dx, offset Palettes + mov cx, size palette_t int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE ; BX = file handle, CX = number of bytes to read ; DS:DX -> buffer @@ -1172,10 +1172,10 @@ loc_B76F: mov word ptr _DemoBuf+2, ax mov word ptr _DemoBuf, 0 mov word ptr [bp+var_4+2], ds - mov word ptr [bp+var_4], 22Dh + mov word ptr [bp+var_4], offset aDemo0_rec les bx, _resident mov al, es:[bx+resident_t.demo_num] - add al, 2Fh ; '/' + add al, ('0' - 1) les bx, [bp+var_4] mov es:[bx+4], al push word ptr [bp+var_4+2] @@ -5386,7 +5386,7 @@ sub_EACE proc near push (size _pellets + size _bullets16) / 4 call sub_E708 push offset _custom_entities - push 1A0h + push size _custom_entities / 4 call sub_E708 push offset _circles push size _circles / 4 @@ -5922,7 +5922,7 @@ var_1 = byte ptr -1 enter 6, 0 push si mov word ptr [bp+var_6+2], ds - mov word ptr [bp+var_6], 1817h + mov word ptr [bp+var_6], offset _dialog_kanji_buf loc_F1B3: les bx, dword_2C930 @@ -12529,7 +12529,7 @@ loc_1641B: push ds mov bx, [bp+arg_6] add bx, bx - push word ptr [bx+1896h] + push _STAGE_CLEAR_BONUS_DESC[bx] push ax call text_putsa pop si @@ -25459,7 +25459,7 @@ loc_1E732: mov angle_2D085, 0 mov angle_2D084, 0 mov byte_2D082, 0 - mov off_2285A, 938Eh + mov off_2285A, offset sub_1E60E jmp loc_1E864 ; --------------------------------------------------------------------------- @@ -27829,7 +27829,8 @@ off_221D0 dd a_dm00_tx2 include th04/formats/dialog[data].asm byte_221EC db 0 a_dm00_tx2 db '_DM00.TX2',0 - db ' ',0 +public _dialog_kanji_buf +_dialog_kanji_buf db ' ',0 aSt06_bb1 db 'st06.bb1',0 aSt06_bb2 db 'st06.bb2',0 aSt06b db 'st06b',0 @@ -27849,7 +27850,9 @@ aBomb0_bft_0 db 'bomb0.bft',0 include th04/main/boss/explosions_big[data].asm byte_22274 db 0 byte_22275 db 0 -off_22276 dw offset aBOSS_FINAL_TIMEOUT +public _STAGE_CLEAR_BONUS_DESC +_STAGE_CLEAR_BONUS_DESC label word + dw offset aBOSS_FINAL_TIMEOUT dw offset aPENALTY_6 dw offset aPENALTY_5 dw offset aPENALTY_4