From f40819b0e540023c66e5564e6ad8099266c37751 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 23 Nov 2014 22:25:22 +0100 Subject: [PATCH] [Reverse-engineering] frame_delay --- th02/frame_delay.asm | 3 ++ th02/frame_delay_.asm | 3 ++ th02/frame_delay_macro.asm | 20 ++++++++ th02/th02.asm | 1 + th02_main.asm | 71 ++++++++++------------------- th02_maine.asm | 93 +++++++++++++++----------------------- th02_op.asm | 91 +++++++++++-------------------------- th03/th03.asm | 1 + th03_main.asm | 34 +++----------- th03_mainl.asm | 54 +++++++--------------- th03_op.asm | 81 +++++++++------------------------ th04/th04.asm | 1 + th04_main.asm | 54 ++++++++-------------- th04_main_seg3+4.inc | 2 +- th04_maine.asm | 48 ++++++-------------- th04_op.asm | 85 ++++++++++------------------------ th05/frame_delay.asm | 13 ++++++ th05_main.asm | 43 ++++++------------ th05_main_seg3+4.inc | 2 +- th05_maine.asm | 48 +++++++------------- th05_op.asm | 53 ++++++++-------------- 21 files changed, 281 insertions(+), 520 deletions(-) create mode 100644 th02/frame_delay.asm create mode 100644 th02/frame_delay_.asm create mode 100644 th02/frame_delay_macro.asm create mode 100644 th05/frame_delay.asm diff --git a/th02/frame_delay.asm b/th02/frame_delay.asm new file mode 100644 index 00000000..83f0ae4b --- /dev/null +++ b/th02/frame_delay.asm @@ -0,0 +1,3 @@ +frame_delay proc + frame_delay_macro +frame_delay endp diff --git a/th02/frame_delay_.asm b/th02/frame_delay_.asm new file mode 100644 index 00000000..271aba7b --- /dev/null +++ b/th02/frame_delay_.asm @@ -0,0 +1,3 @@ +frame_delay_ proc + frame_delay_macro +frame_delay_ endp diff --git a/th02/frame_delay_macro.asm b/th02/frame_delay_macro.asm new file mode 100644 index 00000000..703101dd --- /dev/null +++ b/th02/frame_delay_macro.asm @@ -0,0 +1,20 @@ +; This needs to be in a separate file because there's a second copy of that +; function in TH02's, TH03's and TH04's OP.EXE, and TASM requires macros to be +; defined *before* they are invoked, even with two-pass assembly. + +; int __cdecl frame_delay(int frames) +frame_delay_macro macro + local _loop +@@frames = word ptr (cPtrSize + 2) + + push bp + mov bp, sp + mov vsync_Count1, 0 + +_loop: + mov ax, vsync_Count1 + cmp ax, [bp+@@frames] + jb short _loop + pop bp + ret 2 +endm diff --git a/th02/th02.asm b/th02/th02.asm index 48783fd4..b95336ca 100644 --- a/th02/th02.asm +++ b/th02/th02.asm @@ -1 +1,2 @@ GAME = 2 +include th02/frame_delay_macro.asm diff --git a/th02_main.asm b/th02_main.asm index 3f0f54a5..dca7304b 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -2947,7 +2947,7 @@ loc_BCA0: loc_BCA4: push 1 - call sub_F618 + call frame_delay jmp loc_BA1D ; --------------------------------------------------------------------------- @@ -3802,14 +3802,14 @@ loc_C348: push 0E1h call gaiji_putsa push 1 - call sub_F618 + call frame_delay dec si loc_C3E5: cmp si, 0Ch jge loc_C348 push 1Eh - call sub_F618 + call frame_delay mov word_1FFA8, 0 jmp short loc_C400 ; --------------------------------------------------------------------------- @@ -3895,7 +3895,7 @@ loc_C4CA: loc_C4E5: push 1 - call sub_F618 + call frame_delay jmp short loc_C47A ; --------------------------------------------------------------------------- @@ -7788,7 +7788,7 @@ loc_E147: cmp si, 18h jl short loc_E103 push 2 - call sub_F618 + call frame_delay inc [bp+var_4] loc_E156: @@ -10122,7 +10122,7 @@ sub_F464 proc far call key_sense or si, ax push 2 - nopcall sub_F618 + nopcall frame_delay mov al, byte_1E300 cbw push ax @@ -10318,28 +10318,7 @@ arg_12 = word ptr 18h retf 14h sub_F5B1 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_F618 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_F621: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_F621 - pop bp - retf 2 -sub_F618 endp - -; --------------------------------------------------------------------------- +include th02/frame_delay.asm db 0 ; =============== S U B R O U T I N E ======================================= @@ -10926,14 +10905,14 @@ sub_F9F6 endp cmp byte_1E30A, 0 jnz short loc_FA25 push 64h ; 'd' - nopcall sub_F618 + nopcall frame_delay pop bp retf ; --------------------------------------------------------------------------- loc_FA25: push 1 - nopcall sub_F618 + nopcall frame_delay mov ah, 5 cmp byte_1FFAB, 1 jz short loc_FA39 @@ -17524,7 +17503,7 @@ loc_12E4F: mov ax, [bp+var_4] mov [bp+var_2], ax push 1 - call sub_F618 + call frame_delay call sub_12CB1 push 200140h push 1800050h @@ -17583,7 +17562,7 @@ loc_12EC5: mov ax, [bp+var_4] mov [bp+var_2], ax push 1 - call sub_F618 + call frame_delay call sub_12CB1 push 200140h push 1800050h @@ -17846,7 +17825,7 @@ loc_130CF: loc_130DE: mov [bp+var_2], 3 push 1 - call sub_F618 + call frame_delay loc_130EA: mov ax, di @@ -18394,26 +18373,26 @@ sub_13439 proc near call sub_13055 call sub_13414 push 0Ah - call sub_F618 + call frame_delay push 69h ; 'i' call sub_13055 push 1Eh - call sub_F618 + call frame_delay call sub_13414 push 14h - call sub_F618 + call frame_delay push 69h ; 'i' call sub_13055 push 14h - call sub_F618 + call frame_delay push 69h ; 'i' call sub_13055 call sub_13414 push 14h - call sub_F618 + call frame_delay call sub_13414 push 14h - call sub_F618 + call frame_delay call sub_13414 push 3 call palette_white_out @@ -30083,7 +30062,7 @@ sub_199B3 proc far call sub_13328 mov vsync_Count1, 0 push 0Ah - call sub_F618 + call frame_delay call sub_1A529 push 8000C0h call super_clean @@ -30366,7 +30345,7 @@ sub_19C8D proc near push 0Ah call palette_white_out push 32h ; '2' - call sub_F618 + call frame_delay add dword_1E598, 0C350h call sub_19C1D mov ax, 1 @@ -31387,7 +31366,7 @@ loc_1A54E: push dx call grcg_circle push 1 - call sub_F618 + call frame_delay push 0C00000h call grcg_setcolor push 0E00090h @@ -31473,7 +31452,7 @@ loc_1A697: mov PaletteTone, dx call far ptr palette_show push 3 - call sub_F618 + call frame_delay inc si loc_1A6B2: @@ -31512,7 +31491,7 @@ sub_1A6C5 proc near call graph_clear mov vsync_Count1, 0 push 1 - call sub_F618 + call frame_delay push 0 call graph_scrollup mov dx, 0A6h ; '¦' @@ -31606,7 +31585,7 @@ sub_1A7D5 proc far call sub_1315B mov vsync_Count1, 0 push 0Ah - call sub_F618 + call frame_delay call sub_1A529 push 0 call sub_1310B @@ -35951,7 +35930,7 @@ loc_1CCF7: loc_1CCFE: push 1 - call sub_F618 + call frame_delay mov ax, word_1FFA8 mov [bp+var_A], ax cmp [bp+var_A], 0 diff --git a/th02_maine.asm b/th02_maine.asm index 671123bd..1e91d512 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -355,7 +355,7 @@ loc_96B9: push [bp+arg_0] loc_96BC: - call sub_B520 + call frame_delay loc_96C1: add di, 2 @@ -381,7 +381,7 @@ loc_96E4: push 2 loc_96E6: - call sub_B520 + call frame_delay inc si loc_96EC: @@ -561,7 +561,7 @@ loc_9830: cmp si, [bp+arg_4] jl short loc_9810 push 0Ah - call sub_B520 + call frame_delay inc di loc_983D: @@ -990,7 +990,7 @@ sub_9AD4 proc near push (offset aKkuukkuukkuukk+60h) call sub_95A3 push 1Eh - call sub_B520 + call frame_delay push 1 call palette_white_out push 600h @@ -1029,7 +1029,7 @@ loc_9B1B: call grcg_boxfill call grcg_off push 1 - call sub_B520 + call frame_delay sub si, 4 loc_9B5C: @@ -1081,7 +1081,7 @@ sub_9B64 proc near push 2 call palette_black_in push 28h ; '(' - call sub_B520 + call frame_delay push 0 call sub_98B5 mov byte_F02A, 2Fh ; '/' @@ -1093,7 +1093,7 @@ sub_9B64 proc near push 6 call sub_9643 push 14h - call sub_B520 + call frame_delay push 1 call palette_black_out push 1 @@ -1182,7 +1182,7 @@ loc_9C91: push 6 call sub_9643 push 14h - call sub_B520 + call frame_delay push 90014Ch push 2Ch ; ',' push ds @@ -1210,7 +1210,7 @@ loc_9CDE: push 2 call sub_99E4 push 1 - call sub_B520 + call frame_delay inc si loc_9D10: @@ -1632,7 +1632,7 @@ sub_A09D proc near push 2 call palette_black_in push 28h ; '(' - call sub_B520 + call frame_delay push 0 call sub_98B5 mov byte_F02A, 2Fh ; '/' @@ -1644,7 +1644,7 @@ sub_A09D proc near push 6 call sub_9643 push 14h - call sub_B520 + call frame_delay push 1 call palette_black_out mov dx, 0A6h ; '¦' @@ -1896,7 +1896,7 @@ loc_A353: push 6 call sub_9643 push 0Ah - call sub_B520 + call frame_delay les bx, dword_FB02 cmp byte ptr es:[bx+26h], 0 jnz loc_A4EC @@ -1907,7 +1907,7 @@ loc_A353: push 6 call sub_9643 push 1Eh - call sub_B520 + call frame_delay push 2 call sub_98B5 mov byte_F02A, 2Fh ; '/' @@ -2072,7 +2072,7 @@ loc_A4EC: push 6 call sub_9643 push 1Eh - call sub_B520 + call frame_delay push 2 call sub_98B5 mov byte_F02A, 2Fh ; '/' @@ -2235,7 +2235,7 @@ loc_A6B6: push 6 call sub_9643 push 1Eh - call sub_B520 + call frame_delay push 2 call sub_98B5 mov byte_F02A, 2Fh ; '/' @@ -2448,7 +2448,7 @@ arg_4 = word ptr 8 push [bp+arg_2] call sub_9942 push 4 - call sub_B520 + call frame_delay mov PaletteTone, 64h ; 'd' call far ptr palette_show pop bp @@ -2479,7 +2479,7 @@ loc_A90C: push si call sub_A874 push 4 - call sub_B520 + call frame_delay add si, 5 loc_A920: @@ -2522,7 +2522,7 @@ loc_A947: call sub_B200 add sp, 0Ah push 1 - call sub_B520 + call frame_delay add si, 4 loc_A992: @@ -2797,7 +2797,7 @@ loc_A992: push 4 call palette_black_in push 64h ; 'd' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -2814,7 +2814,7 @@ loc_A992: call sub_97F1 add sp, 6 push 0C8h ; 'È' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -2834,7 +2834,7 @@ loc_A992: call sub_97F1 add sp, 6 push 64h ; 'd' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -2858,7 +2858,7 @@ loc_A992: call sub_97F1 add sp, 6 push 64h ; 'd' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -2885,7 +2885,7 @@ loc_A992: call sub_97F1 add sp, 6 push 64h ; 'd' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -2910,7 +2910,7 @@ loc_A992: call sub_97F1 add sp, 6 push 64h ; 'd' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -2935,7 +2935,7 @@ loc_A992: call sub_97F1 add sp, 6 push 96h - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -3069,13 +3069,13 @@ loc_AF56: call sub_97F1 add sp, 6 push 78h ; 'x' - call sub_B520 + call frame_delay push 180120h push 0C0h call sub_97F1 add sp, 6 push 0C8h ; 'È' - call sub_B520 + call frame_delay mov dx, 0A6h ; '¦' mov al, 1 out dx, al @@ -3132,7 +3132,7 @@ sub_AFE7 proc far push 2 call palette_black_in push 96h - call sub_B520 + call frame_delay push ds push offset aBut_pi ; "but.pi" push 0 @@ -3184,7 +3184,7 @@ sub_B07F proc far push 2 call palette_black_in push 96h - call sub_B520 + call frame_delay push ds push offset aExtra_pi ; "extra.pi" push 0 @@ -3269,7 +3269,7 @@ loc_B189: push offset aEndft_bft ; "endft.bft" call super_entry_bfnt push 64h ; 'd' - call sub_B520 + call frame_delay les bx, dword_FB02 cmp byte ptr es:[bx+16h], 4 jz short loc_B1C2 @@ -3650,7 +3650,7 @@ sub_B45F proc far call key_sense or si, ax push 2 - nopcall sub_B520 + nopcall frame_delay mov al, byte_D70A cbw push ax @@ -3711,28 +3711,7 @@ sub_B4CC proc far sub_B4CC endp include th02/formats/pi_slot_load.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_B520 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_B529: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_B529 - pop bp - retf 2 -sub_B520 endp - -; --------------------------------------------------------------------------- +include th02/frame_delay.asm db 0 ; =============== S U B R O U T I N E ======================================= @@ -4206,14 +4185,14 @@ arg_0 = word ptr 6 cmp byte_D714, 0 jnz short loc_B868 push 64h ; 'd' - nopcall sub_B520 + nopcall frame_delay pop bp retf ; --------------------------------------------------------------------------- loc_B868: push 1 - nopcall sub_B520 + nopcall frame_delay mov ah, 5 cmp byte_FAF1, 1 jz short loc_B87C @@ -5138,7 +5117,7 @@ loc_BF78: loc_BF7F: push 1 - call sub_B520 + call frame_delay mov ax, word_FAEE mov [bp+var_A], ax cmp [bp+var_A], 0 @@ -5555,7 +5534,7 @@ loc_C29D: push [bp+var_C] call sub_C045 push 1 - call sub_B520 + call frame_delay inc si loc_C2AE: diff --git a/th02_op.asm b/th02_op.asm index 29592c3b..6d55d593 100644 --- a/th02_op.asm +++ b/th02_op.asm @@ -476,7 +476,7 @@ loc_9DED: mov PaletteTone, dx call far ptr palette_show push 1 - call sub_B2D2 + call frame_delay inc [bp+var_2] loc_9E0F: @@ -494,7 +494,7 @@ loc_9E1C: mov PaletteTone, dx call far ptr palette_show push 1 - call sub_B2D2 + call frame_delay inc [bp+var_2] loc_9E39: @@ -530,7 +530,7 @@ loc_9E7D: loc_9E97: push 12h - call sub_B2D2 + call frame_delay call sub_B2E8 mov PaletteTone, 0C8h ; 'È' call far ptr palette_show @@ -600,7 +600,7 @@ sub_9F37 proc near pop cx call sub_B296 push 14h - call sub_B2D2 + call frame_delay les bx, dword_F3DC mov al, byte_F3E1 mov es:[bx+15h], al @@ -1959,7 +1959,7 @@ loc_AAD7: adc word ptr es:[bx+1Eh], 0 inc word_E8FC push 1 - call sub_B2D2 + call frame_delay loc_AAF0: cmp byte_D6C2, 0 @@ -2449,27 +2449,7 @@ loc_AEAE: retf 8 sub_AE00 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_AEBB proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_AEC4: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_AEC4 - pop bp - retf 2 -sub_AEBB endp - +include th02/frame_delay_.asm ; =============== S U B R O U T I N E ======================================= @@ -2952,14 +2932,14 @@ sub_B203 endp cmp byte_DBEE, 0 jnz short loc_B232 push 64h ; 'd' - nopcall sub_AEBB + nopcall frame_delay_ pop bp retf ; --------------------------------------------------------------------------- loc_B232: push 1 - nopcall sub_AEBB + nopcall frame_delay_ mov ah, 5 cmp byte_F3CB, 1 jz short loc_B246 @@ -3060,26 +3040,7 @@ locret_B2D1: retf sub_B296 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_B2D2 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_B2DB: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_B2DB - pop bp - retf 2 -sub_B2D2 endp +include th02/frame_delay.asm seg002 ends @@ -3168,7 +3129,7 @@ loc_B363: loc_B368: push 1 - call sub_B2D2 + call frame_delay inc si loc_B370: @@ -3842,7 +3803,7 @@ loc_B81D: loc_B829: call sub_B6BB push 1 - call sub_B2D2 + call frame_delay mov dx, 0A6h ; '¦' mov al, [bp+var_1] out dx, al @@ -3858,7 +3819,7 @@ loc_B829: loc_B84F: mov word_F3C8, 0 push 14h - call sub_B2D2 + call frame_delay push 0 push 0 push 27Fh @@ -4540,7 +4501,7 @@ loc_BD6A: call sub_BA20 add sp, 4 push 1 - call sub_B2D2 + call frame_delay push 0 mov al, byte_DD20 cbw @@ -4548,7 +4509,7 @@ loc_BD6A: call sub_B90D add sp, 4 push 1 - call sub_B2D2 + call frame_delay mov al, byte_DD20 cbw push ax @@ -4573,7 +4534,7 @@ loc_BD6A: call sub_B17D add sp, 6 push 1 - call sub_B2D2 + call frame_delay mov al, byte_DD20 cbw add ax, ax @@ -4601,7 +4562,7 @@ loc_BD6A: loc_BE0F: push 1 - call sub_B2D2 + call frame_delay push 1 mov al, byte_DD20 cbw @@ -4609,7 +4570,7 @@ loc_BE0F: call sub_B90D add sp, 4 push 1 - call sub_B2D2 + call frame_delay push 0Ch mov al, byte_DD20 cbw @@ -4617,7 +4578,7 @@ loc_BE0F: call sub_BA20 add sp, 4 push 1 - call sub_B2D2 + call frame_delay mov al, byte_DD20 cbw push ax @@ -4652,7 +4613,7 @@ loc_BE77: call sub_B90D add sp, 4 push 1 - call sub_B2D2 + call frame_delay mov al, byte_DD20 cbw push ax @@ -4677,7 +4638,7 @@ loc_BE77: call sub_B17D add sp, 6 push 1 - call sub_B2D2 + call frame_delay push 7 mov al, byte_DD20 cbw @@ -4685,7 +4646,7 @@ loc_BE77: call sub_BA20 add sp, 4 push 1 - call sub_B2D2 + call frame_delay mov al, byte_DD20 cbw add ax, ax @@ -4713,7 +4674,7 @@ loc_BE77: loc_BF1C: push 1 - call sub_B2D2 + call frame_delay push 1 mov al, byte_DD20 cbw @@ -4721,7 +4682,7 @@ loc_BF1C: call sub_B90D add sp, 4 push 1 - call sub_B2D2 + call frame_delay push 0Ch mov al, byte_DD20 cbw @@ -4729,7 +4690,7 @@ loc_BF1C: call sub_BA20 add sp, 4 push 1 - call sub_B2D2 + call frame_delay mov al, byte_DD20 cbw push ax @@ -4765,7 +4726,7 @@ loc_BF88: loc_BF95: push 1 - call sub_B2D2 + call frame_delay mov si, word_F3C8 or si, si jz short loc_BFB2 @@ -5313,7 +5274,7 @@ sub_C3AC proc near mov dx, 0A6h ; '¦' out dx, al push 1 - call sub_B2D2 + call frame_delay pop bp retn sub_C3AC endp diff --git a/th03/th03.asm b/th03/th03.asm index c5daf647..ddeb4f11 100644 --- a/th03/th03.asm +++ b/th03/th03.asm @@ -1 +1,2 @@ GAME = 3 +include th02/frame_delay_macro.asm diff --git a/th03_main.asm b/th03_main.asm index 4410b058..b795d363 100644 --- a/th03_main.asm +++ b/th03_main.asm @@ -5326,7 +5326,7 @@ loc_C7C8: loc_C7DB: call sub_EA8C push 1 - call sub_EA77 + call frame_delay loc_C7E7: cmp word ptr unk_1EFFA, 0 @@ -5339,14 +5339,14 @@ loc_C7EE: test byte_1EFFB, 10h jnz short loc_C816 push 1 - call sub_EA77 + call frame_delay jmp short loc_C7EE ; --------------------------------------------------------------------------- loc_C80A: call sub_EA8C push 1 - call sub_EA77 + call frame_delay loc_C816: cmp word ptr unk_1EFFA, 0 @@ -5705,7 +5705,7 @@ loc_CA99: loc_CAA8: push 1 - call sub_EA77 + call frame_delay mov ax, si and ax, 1 imul ax, 32h @@ -9867,27 +9867,7 @@ arg_4 = word ptr 0Ah retf sub_EA5D endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_EA77 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_EA80: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_EA80 - pop bp - retf 2 -sub_EA77 endp - +include th02/frame_delay.asm ; =============== S U B R O U T I N E ======================================= @@ -10409,7 +10389,7 @@ loc_EE81: cmp word ptr unk_1EFFA, 0 jz short loc_EE95 push 1 - nopcall sub_EA77 + nopcall frame_delay jmp short loc_EE81 ; --------------------------------------------------------------------------- @@ -10426,7 +10406,7 @@ loc_EE9E: jnz short loc_EEBD inc di push 1 - nopcall sub_EA77 + nopcall frame_delay cmp si, 270Fh jnz short loc_EEB9 xor di, di diff --git a/th03_mainl.asm b/th03_mainl.asm index b0bdd4e3..d5fa840f 100644 --- a/th03_mainl.asm +++ b/th03_mainl.asm @@ -665,7 +665,7 @@ loc_97E8: push si call sub_D712 push 6 - call sub_CB52 + call frame_delay inc si loc_97FC: @@ -691,7 +691,7 @@ loc_97FC: push 1 call palette_white_in push 8 - call sub_CB52 + call frame_delay call sub_973E call sub_9887 or ax, ax @@ -703,7 +703,7 @@ loc_9868: cmp word_100FC, 0 jnz short loc_987D push 1 - call sub_CB52 + call frame_delay jmp short loc_9868 ; --------------------------------------------------------------------------- @@ -1607,7 +1607,7 @@ loc_A0B0: loc_A0BB: push 1 - call sub_CB52 + call frame_delay jmp loc_A00B ; --------------------------------------------------------------------------- @@ -2487,7 +2487,7 @@ loc_A7A2: cmp [bp+arg_0], 6Bh ; 'k' jz short loc_A7C4 push [bp+var_2] - call sub_CB52 + call frame_delay jmp loc_AB90 ; --------------------------------------------------------------------------- @@ -2568,7 +2568,7 @@ loc_A85F: cmp byte_105CE, 0 jnz short loc_A87B push 1 - call sub_CB52 + call frame_delay loc_A87B: mov ax, [bp+var_2] @@ -2649,7 +2649,7 @@ loc_A91D: cmp byte_105CE, 0 jnz short loc_A930 push 1 - call sub_CB52 + call frame_delay loc_A930: inc [bp+var_4] @@ -2868,7 +2868,7 @@ loc_AB16: cmp byte_105CE, 0 jnz short loc_AB32 push [bp+var_4] - call sub_CB52 + call frame_delay loc_AB32: inc si @@ -3120,7 +3120,7 @@ loc_ACFB: cmp word_100FC, 0 jnz short loc_AD7A push word_105D4 - call sub_CB52 + call frame_delay jmp loc_ACA3 ; --------------------------------------------------------------------------- @@ -3142,7 +3142,7 @@ loc_AD8F: loc_AD94: push si - call sub_CB52 + call frame_delay loc_AD9A: inc [bp+var_2] @@ -4508,7 +4508,7 @@ loc_B738: loc_B73C: push 1 - call sub_CB52 + call frame_delay loc_B743: cmp [bp+var_B], 0 @@ -4819,7 +4819,7 @@ loc_B9DD: mov PaletteTone, 0 call far ptr palette_show push 60h - call sub_CB52 + call frame_delay mov dx, 0A6h ; '¦' mov al, 0 out dx, al @@ -6301,7 +6301,7 @@ loc_C4D8: mov byte_10BB6, 1 mov byte_10BB5, 1 push 1 - call sub_CB52 + call frame_delay mov vsync_Count1, 0 loc_C657: @@ -6942,27 +6942,7 @@ sub_CA88 endp ; --------------------------------------------------------------------------- nop -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CB52 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_CB5B: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_CB5B - pop bp - retf 2 -sub_CB52 endp - -; --------------------------------------------------------------------------- +include th02/frame_delay.asm db 0 ; =============== S U B R O U T I N E ======================================= @@ -8069,7 +8049,7 @@ arg_2 = word ptr 8 cmp byte_EC70, 0 jnz short loc_D412 push [bp+arg_0] - nopcall sub_CB52 + nopcall frame_delay pop bp retf 4 ; --------------------------------------------------------------------------- @@ -8424,7 +8404,7 @@ loc_D6CF: cmp word_100FC, 0 jz short loc_D6E3 push 1 - nopcall sub_CB52 + nopcall frame_delay jmp short loc_D6CF ; --------------------------------------------------------------------------- @@ -8441,7 +8421,7 @@ loc_D6EC: jnz short loc_D70B inc di push 1 - nopcall sub_CB52 + nopcall frame_delay cmp si, 270Fh jnz short loc_D707 xor di, di diff --git a/th03_op.asm b/th03_op.asm index a5a7d2a2..ca1eb54f 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -711,7 +711,7 @@ loc_9C70: loc_9C7E: mov si, word_F296 push 1 - call sub_C19E + call frame_delay jmp short loc_9C1B ; --------------------------------------------------------------------------- @@ -912,7 +912,7 @@ loc_9E24: loc_9E3C: push 1 - call sub_C19E + call frame_delay loc_9E43: cmp word_F296, 0 @@ -931,7 +931,7 @@ loc_9E5C: push 1000002h call super_put push 1 - call sub_C19E + call frame_delay add si, 8 loc_9E76: @@ -1779,7 +1779,7 @@ loc_A4EE: les bx, dword_FC54 inc dword ptr es:[bx+10h] push 1 - call sub_C19E + call frame_delay loc_A4FE: cmp byte_D952, 0 @@ -2260,7 +2260,7 @@ sub_A899 proc near mov dx, 0A6h ; '¦' out dx, al push 1 - call sub_CB86 + call frame_delay_ pop bp retn sub_A899 endp @@ -2929,7 +2929,7 @@ var_2 = word ptr -2 loc_AEA0: push 1 - call sub_C19E + call frame_delay mov al, byte ptr [bp+var_2] mov Palettes+45, al mov Palettes+46, al @@ -2978,7 +2978,7 @@ loc_AF09: call far ptr palette_show add [bp+var_2], 2 push 1 - call sub_C19E + call frame_delay loc_AF25: cmp [bp+var_2], 0FFh @@ -2997,11 +2997,11 @@ loc_AF40: mov PaletteTone, 0C8h ; 'È' call far ptr palette_show push 1 - call sub_C19E + call frame_delay mov PaletteTone, 64h ; 'd' call far ptr palette_show push 1 - call sub_C19E + call frame_delay inc si loc_AF65: @@ -3022,11 +3022,11 @@ loc_AF65: push 0 call sub_C37B push 1 - call sub_C19E + call frame_delay mov PaletteTone, 64h ; 'd' call far ptr palette_show push 1 - call sub_C19E + call frame_delay xor si, si jmp short loc_AFD9 ; --------------------------------------------------------------------------- @@ -3035,11 +3035,11 @@ loc_AFB4: mov PaletteTone, 0C8h ; 'È' call far ptr palette_show push 1 - call sub_C19E + call frame_delay mov PaletteTone, 64h ; 'd' call far ptr palette_show push 1 - call sub_C19E + call frame_delay inc si loc_AFD9: @@ -3119,7 +3119,7 @@ loc_B094: mov PaletteTone, si call far ptr palette_show push 1 - call sub_C19E + call frame_delay add si, 4 loc_B0A7: @@ -3150,7 +3150,7 @@ loc_B0B8: push 1000002h call super_put push 1 - call sub_C19E + call frame_delay add si, 8 loc_B0D2: @@ -3182,7 +3182,7 @@ loc_B0E4: push 1000002h call super_put push 1 - call sub_C19E + call frame_delay sub si, 8 loc_B101: @@ -4574,7 +4574,7 @@ loc_BAED: loc_BAF9: push 10h - call sub_C19E + call frame_delay mov word_FC62, 0 loc_BB06: @@ -5412,27 +5412,7 @@ sub_C0D4 endp ; --------------------------------------------------------------------------- nop -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C19E proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_C1A7: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_C1A7 - pop bp - retf 2 -sub_C19E endp - -; --------------------------------------------------------------------------- +include th02/frame_delay.asm db 0 ; =============== S U B R O U T I N E ======================================= @@ -6564,7 +6544,7 @@ loc_CAB3: cmp word_F296, 0 jz short loc_CAC7 push 1 - nopcall sub_C19E + nopcall frame_delay jmp short loc_CAB3 ; --------------------------------------------------------------------------- @@ -6581,7 +6561,7 @@ loc_CAD0: jnz short loc_CAEF inc di push 1 - nopcall sub_C19E + nopcall frame_delay cmp si, 270Fh jnz short loc_CAEB xor di, di @@ -6700,26 +6680,7 @@ loc_CB7D: retf sub_CB68 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CB86 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_CB8F: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_CB8F - pop bp - retf 2 -sub_CB86 endp +include th02/frame_delay_.asm seg002 ends diff --git a/th04/th04.asm b/th04/th04.asm index 160d66b2..8114ea8c 100644 --- a/th04/th04.asm +++ b/th04/th04.asm @@ -1 +1,2 @@ GAME = 4 +include th02/frame_delay_macro.asm diff --git a/th04_main.asm b/th04_main.asm index 7308e9e3..a1e0af6e 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -486,7 +486,7 @@ sub_AB88 proc near push si mov word_266D0, 1 push 1 - call sub_131B7 + call frame_delay call far ptr sub_1379C loc_AB9E: @@ -5605,7 +5605,7 @@ loc_D0A6: push si call sub_CFBE push 0Ch - call sub_131B7 + call frame_delay inc si loc_D0C2: @@ -5801,7 +5801,7 @@ loc_D20A: push ax call sub_D0CA push 1 - call sub_131B7 + call frame_delay mov ax, [bp+var_2] mov PaletteTone, ax call far ptr palette_show @@ -5892,7 +5892,7 @@ loc_D2DF: loc_D2E2: call graph_scrollup push 1 - call sub_131B7 + call frame_delay inc si loc_D2EF: @@ -5945,7 +5945,7 @@ loc_D350: push ax call sub_D0CA push 1 - call sub_131B7 + call frame_delay cmp word_255D4, 0 jnz short loc_D38A push 2000F0h @@ -5986,7 +5986,7 @@ loc_D3B0: push ax call sub_D193 push 1 - call sub_131B7 + call frame_delay push [bp+var_4] push [bp+var_6] push [bp+var_2] @@ -6348,7 +6348,7 @@ loc_D6D2: push 1 loc_D6DC: - call sub_131B7 + call frame_delay jmp loc_D63F ; --------------------------------------------------------------------------- @@ -6385,7 +6385,7 @@ sub_D6EB proc far mov al, byte_25A3C out dx, al push 1 - call sub_131B7 + call frame_delay pop bp retf sub_D6EB endp @@ -8355,7 +8355,7 @@ loc_E556: or al, al jnz short loc_E566 push 1 - call sub_131B7 + call frame_delay jmp short loc_E556 ; --------------------------------------------------------------------------- @@ -8368,7 +8368,7 @@ loc_E571: or al, al jnz short loc_E581 push 1 - call sub_131B7 + call frame_delay jmp short loc_E571 ; --------------------------------------------------------------------------- @@ -8383,7 +8383,7 @@ loc_E588: push 0E1h call gaiji_putca push 1 - call sub_131B7 + call frame_delay push [bp+var_2] push 0Ch push ds @@ -8405,7 +8405,7 @@ loc_E5C2: push 0E1h call gaiji_putca push 1 - call sub_131B7 + call frame_delay push [bp+var_2] push 0Ch push ds @@ -8435,7 +8435,7 @@ loc_E61E: or al, al jnz short loc_E62E push 1 - call sub_131B7 + call frame_delay jmp short loc_E61E ; --------------------------------------------------------------------------- @@ -8450,7 +8450,7 @@ loc_E63F: or al, al jnz short loc_E64F push 1 - call sub_131B7 + call frame_delay jmp short loc_E63F ; --------------------------------------------------------------------------- @@ -8598,7 +8598,7 @@ loc_E783: loc_E787: call far ptr sub_1379C push 1 - call sub_131B7 + call frame_delay jmp loc_E703 ; --------------------------------------------------------------------------- @@ -18307,25 +18307,7 @@ sub_13117 endp pop bp retf 14h -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_131B7 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_131C0: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_131C0 - pop bp - retf 2 -sub_131B7 endp +include th02/frame_delay.asm ; --------------------------------------------------------------------------- push di @@ -18400,7 +18382,7 @@ loc_1321D: push cs call sub_1379C push 1 - nopcall sub_131B7 + nopcall frame_delay loc_13229: nopcall sub_137A4 @@ -18417,7 +18399,7 @@ loc_1323E: push cs call sub_1379C push 1 - nopcall sub_131B7 + nopcall frame_delay nopcall sub_137A4 cmp word_24CB4, 0 jnz short loc_13263 diff --git a/th04_main_seg3+4.inc b/th04_main_seg3+4.inc index cfa51836..ecd95756 100644 --- a/th04_main_seg3+4.inc +++ b/th04_main_seg3+4.inc @@ -20938,7 +20938,7 @@ loc_1E8E5: inc byte ptr es:[bx+13h] mov byte_266D2, 2 push 1 - call sub_131B7 + call frame_delay loc_1E905: inc word_2671A diff --git a/th04_maine.asm b/th04_maine.asm index 5e380ae1..6c2b7148 100644 --- a/th04_maine.asm +++ b/th04_maine.asm @@ -581,7 +581,7 @@ loc_A1E9: push 204h call sub_CF8C push 64h ; 'd' - call sub_CCA3 + call frame_delay call sub_C814 jmp loc_A281 ; --------------------------------------------------------------------------- @@ -591,7 +591,7 @@ loc_A1FE: cmp byte ptr es:[bx+30h], 0FDh jnz short loc_A274 push 64h ; 'd' - call sub_CCA3 + call frame_delay call sub_C814 les bx, [bp+var_4] mov byte ptr es:[bx+5], 34h ; '4' @@ -622,7 +622,7 @@ loc_A1FE: loc_A274: push 64h ; 'd' - call sub_CCA3 + call frame_delay call sub_C814 loc_A27E: @@ -1393,7 +1393,7 @@ loc_A827: push si call sub_A78F push word_124C0 - call sub_CCA3 + call frame_delay inc si loc_A835: @@ -1561,7 +1561,7 @@ loc_A978: cmp byte_1247E, 0 jnz loc_ADB5 ; default push [bp+var_2] - call sub_CCA3 + call frame_delay jmp loc_AD2B ; --------------------------------------------------------------------------- @@ -1627,7 +1627,7 @@ loc_AA0E: cmp byte_1247E, 0 jnz short loc_AA2A push 1 - call sub_CCA3 + call frame_delay loc_AA2A: mov ax, [bp+var_2] @@ -1708,7 +1708,7 @@ loc_AACA: cmp byte_1247E, 0 jnz short loc_AADD push 1 - call sub_CCA3 + call frame_delay loc_AADD: inc [bp+var_4] @@ -1918,7 +1918,7 @@ loc_ACB2: cmp byte_1247E, 0 jnz short loc_ACCE push [bp+var_4] - call sub_CCA3 + call frame_delay loc_ACCE: inc si @@ -4013,7 +4013,7 @@ loc_C084: mov byte_124EF, 0 call file_close push 40h - call sub_CCA3 + call frame_delay push 400168h push 0Fh push ds @@ -5493,7 +5493,7 @@ loc_CB67: loc_CB6B: call far ptr sub_D48A push 1 - call sub_CCA3 + call frame_delay jmp loc_C9F6 ; --------------------------------------------------------------------------- @@ -5676,27 +5676,7 @@ sub_CC7A proc far retf sub_CC7A endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CCA3 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_CCAC: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_CCAC - pop bp - retf 2 -sub_CCA3 endp - +include th02/frame_delay.asm include th02/formats/pi_slot_palette_apply.asm ; =============== S U B R O U T I N E ======================================= @@ -5904,7 +5884,7 @@ loc_CE84: push cs call sub_D48A push 1 - nopcall sub_CCA3 + nopcall frame_delay nopcall sub_D492 cmp word_10072, 0 jnz short loc_CE84 @@ -5919,7 +5899,7 @@ loc_CEA5: push cs call sub_D48A push 1 - nopcall sub_CCA3 + nopcall frame_delay nopcall sub_D492 cmp word_10072, 0 jnz short loc_CECA @@ -6178,7 +6158,7 @@ arg_2 = word ptr 8 cmp byte_EAD1, 0 jnz short loc_D05C push [bp+arg_0] - nopcall sub_CCA3 + nopcall frame_delay pop bp retf 4 ; --------------------------------------------------------------------------- diff --git a/th04_op.asm b/th04_op.asm index a5434141..8560032a 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -1750,7 +1750,7 @@ loc_B46B: les bx, dword_10DA4 inc dword ptr es:[bx+14h] push 1 - call sub_DA3B + call frame_delay loc_B47B: cmp byte_F3DC, 0 @@ -1945,7 +1945,7 @@ loc_B5BE: push si call sub_B49F push 1 - call sub_DA3B + call frame_delay inc di add si, 8 @@ -2059,7 +2059,7 @@ loc_B674: push si call sub_B519 push 1 - call sub_DA3B + call frame_delay inc di sub si, 8 @@ -2303,7 +2303,7 @@ loc_B80E: push 0 call sub_DB62 push 1 - call sub_DA3B + call frame_delay test byte ptr word_11A50+1, 20h jnz short loc_B87A test byte ptr word_11A50, 20h @@ -2421,7 +2421,7 @@ loc_B92B: push 0 call sub_DB62 push 1 - call sub_DA3B + call frame_delay test byte ptr word_11A50+1, 20h jnz short loc_B997 test byte ptr word_11A50, 20h @@ -2515,7 +2515,7 @@ sub_B9CE proc near call palette_black_in call sub_B794 push 1 - call sub_DA3B + call frame_delay push 0 call graph_copy_page call sub_B8B1 @@ -3564,7 +3564,7 @@ sub_C244 proc near mov dx, 0A6h ; '¦' out dx, al push 1 - call sub_E6DE + call frame_delay_ pop bp retn sub_C244 endp @@ -4648,7 +4648,7 @@ loc_CADA: loc_CAE4: call far ptr sub_E1DC push 1 - call sub_DA3B + call frame_delay test byte ptr word_11A50+1, 20h jnz short loc_CB58 test byte ptr word_11A50, 20h @@ -4708,7 +4708,7 @@ loc_CB58: loc_CBB3: call far ptr sub_E1DC push 1 - call sub_DA3B + call frame_delay cmp word_11A50, 0 jnz short loc_CBB3 push 100h @@ -4944,7 +4944,7 @@ loc_CDB0: call far ptr palette_show add di, 2 push 1 - call sub_DA3B + call frame_delay inc si loc_CDC4: @@ -5023,7 +5023,7 @@ loc_CEC7: mov Palettes+2, al call far ptr palette_show push 1 - call sub_DA3B + call frame_delay inc si mov al, [bp+var_3] add al, 0F0h @@ -5076,7 +5076,7 @@ loc_CF34: jl short loc_CEFA call far ptr palette_show push 1 - call sub_DA3B + call frame_delay inc si mov al, [bp+var_3] add al, 0FCh @@ -6166,7 +6166,7 @@ loc_D816: call sub_D3A2 mov vsync_Count1, 0 push 1 - call sub_DA3B + call frame_delay mov dx, 0A4h ; '¤' mov al, 1 out dx, al @@ -6174,7 +6174,7 @@ loc_D816: call graph_copy_page mov vsync_Count1, 0 push 1 - call sub_DA3B + call frame_delay mov dx, 0A4h ; '¤' mov al, 0 out dx, al @@ -6247,7 +6247,7 @@ loc_D8DF: loc_D8EA: push 1 - call sub_DA3B + call frame_delay jmp loc_D7BB ; --------------------------------------------------------------------------- @@ -6287,7 +6287,7 @@ loc_D939: call sub_D465 mov vsync_Count1, 0 push 1 - call sub_DA3B + call frame_delay mov dx, 0A4h ; '¤' mov al, 1 out dx, al @@ -6295,7 +6295,7 @@ loc_D939: call graph_copy_page mov vsync_Count1, 0 push 1 - call sub_DA3B + call frame_delay mov dx, 0A4h ; '¤' mov al, 0 out dx, al @@ -6350,7 +6350,7 @@ loc_D9F8: loc_DA03: push 1 - call sub_DA3B + call frame_delay jmp loc_D8B0 ; --------------------------------------------------------------------------- @@ -6387,27 +6387,7 @@ sub_DA12 proc far retf sub_DA12 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_DA3B proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_DA44: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_DA44 - pop bp - retf 2 -sub_DA3B endp - +include th02/frame_delay.asm include th02/formats/pi_slot_palette_apply.asm ; =============== S U B R O U T I N E ======================================= @@ -6528,7 +6508,7 @@ loc_DB6C: push cs call sub_E1DC push 1 - nopcall sub_DA3B + nopcall frame_delay nopcall sub_E1E4 cmp word_11A50, 0 jnz short loc_DB6C @@ -6543,7 +6523,7 @@ loc_DB8D: push cs call sub_E1DC push 1 - nopcall sub_DA3B + nopcall frame_delay nopcall sub_E1E4 cmp word_11A50, 0 jnz short loc_DBB2 @@ -6855,7 +6835,7 @@ arg_2 = word ptr 8 cmp byte_FD21, 0 jnz short loc_DD96 push [bp+arg_0] - nopcall sub_DA3B + nopcall frame_delay pop bp retf 4 ; --------------------------------------------------------------------------- @@ -8239,26 +8219,7 @@ loc_E6D4: retf sub_E6D0 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_E6DE proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - mov vsync_Count1, 0 - -loc_E6E7: - mov ax, vsync_Count1 - cmp ax, [bp+arg_0] - jb short loc_E6E7 - pop bp - retf 2 -sub_E6DE endp +include th02/frame_delay_.asm seg002 ends diff --git a/th05/frame_delay.asm b/th05/frame_delay.asm new file mode 100644 index 00000000..c1c00944 --- /dev/null +++ b/th05/frame_delay.asm @@ -0,0 +1,13 @@ +; int __cdecl frame_delay(int frames) +frame_delay proc +@@frames = word ptr (cPtrSize + 2) + + mov bx, sp + mov bx, ss:[bx+4] + mov vsync_Count1, 0 + +@@loop: + cmp vsync_Count1, bx + jb short @@loop + ret 2 +frame_delay endp diff --git a/th05_main.asm b/th05_main.asm index 7cbbde80..de2a645a 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -534,7 +534,7 @@ sub_AEA6 proc near mov bp, sp mov word_25FE6, 1 push 1 - call sub_1510E + call frame_delay call far ptr sub_14FCE loc_AEBB: @@ -9595,7 +9595,7 @@ loc_EFBA: push si call sub_EE9A push 0Ch - call sub_1510E + call frame_delay inc si loc_EFD6: @@ -9647,7 +9647,7 @@ loc_F021: mov [bp+arg_0], al inc word ptr dword_2C930 push 1 - call sub_1510E + call frame_delay cmp word_2C938, 0 jnz short loc_F045 push 2000F0h @@ -9921,7 +9921,7 @@ loc_F296: push 1 loc_F29E: - call sub_1510E + call frame_delay jmp short loc_F227 ; --------------------------------------------------------------------------- @@ -10008,7 +10008,7 @@ loc_F333: mov al, byte_25352 out dx, al push 1 - call sub_1510E + call frame_delay pop bp retf sub_F2B4 endp @@ -10103,7 +10103,7 @@ loc_F421: loc_F432: push 1 - call sub_1510E + call frame_delay push [bp+arg_4] push [bp+arg_2] call sub_EF2A @@ -10856,7 +10856,7 @@ loc_F97F: or al, al jnz short loc_F98F push 1 - call sub_1510E + call frame_delay jmp short loc_F97F ; --------------------------------------------------------------------------- @@ -10869,7 +10869,7 @@ loc_F99A: or al, al jnz short loc_F9AA push 1 - call sub_1510E + call frame_delay jmp short loc_F99A ; --------------------------------------------------------------------------- @@ -10884,7 +10884,7 @@ loc_F9B1: push 0E1h call gaiji_putca push 1 - call sub_1510E + call frame_delay push [bp+var_2] push 0Ch push ds @@ -10906,7 +10906,7 @@ loc_F9EB: push 0E1h call gaiji_putca push 1 - call sub_1510E + call frame_delay push [bp+var_2] push 0Ch push ds @@ -10936,7 +10936,7 @@ loc_FA47: or al, al jnz short loc_FA57 push 1 - call sub_1510E + call frame_delay jmp short loc_FA47 ; --------------------------------------------------------------------------- @@ -10951,7 +10951,7 @@ loc_FA68: or al, al jnz short loc_FA78 push 1 - call sub_1510E + call frame_delay jmp short loc_FA68 ; --------------------------------------------------------------------------- @@ -11097,7 +11097,7 @@ loc_FBA7: loc_FBAB: push 1 - call sub_1510E + call frame_delay jmp loc_FB27 ; --------------------------------------------------------------------------- @@ -22316,22 +22316,7 @@ loc_1510A: retf 2 sub_150E4 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_1510E proc far - mov bx, sp - mov bx, ss:[bx+4] - mov vsync_Count1, 0 - -loc_1511A: - cmp vsync_Count1, bx - jb short loc_1511A - retf 2 -sub_1510E endp - -; --------------------------------------------------------------------------- +include th05/frame_delay.asm db 0 ; =============== S U B R O U T I N E ======================================= diff --git a/th05_main_seg3+4.inc b/th05_main_seg3+4.inc index a03f1c73..ff3819ca 100644 --- a/th05_main_seg3+4.inc +++ b/th05_main_seg3+4.inc @@ -20441,7 +20441,7 @@ loc_1FD35: inc byte ptr es:[bx+13h] mov byte_25FE8, 2 push 1 - call sub_1510E + call frame_delay loc_1FD51: mov word ptr dword_2C922, 0C190h diff --git a/th05_maine.asm b/th05_maine.asm index 1449d50e..90f79976 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -643,7 +643,7 @@ _envp = dword ptr 0Ch mov eax, es:[bx+28h] mov random_seed, eax push 64h ; 'd' - call sub_F282 + call frame_delay les bx, dword_11E6E cmp byte ptr es:[bx+1Ah], 0FEh jb short loc_A665 @@ -1038,7 +1038,7 @@ loc_A904: push si call sub_A866 push word_15008 - call sub_F282 + call frame_delay inc si loc_A912: @@ -1050,7 +1050,7 @@ loc_A917: call sub_A866 call egc_off push 1 - call sub_F282 + call frame_delay pop si pop bp retn @@ -1078,7 +1078,7 @@ loc_A93B: cmp word_12AFA, 0 jz short loc_A950 push 1 - call sub_F282 + call frame_delay jmp short loc_A93B ; --------------------------------------------------------------------------- @@ -1123,7 +1123,7 @@ loc_A962: loc_A9B4: push 1 - call sub_F282 + call frame_delay jmp short loc_A962 ; --------------------------------------------------------------------------- @@ -1298,7 +1298,7 @@ loc_AB17: cmp byte_14F8E, 0 jnz loc_AF8F ; default push [bp+var_2] - call sub_F282 + call frame_delay jmp loc_AF8F ; default ; --------------------------------------------------------------------------- @@ -1363,7 +1363,7 @@ loc_ABAC: cmp byte_14F8E, 0 jnz short loc_ABC8 push 1 - call sub_F282 + call frame_delay loc_ABC8: mov ax, [bp+var_2] @@ -1441,7 +1441,7 @@ loc_AC5F: cmp byte_14F8E, 0 jnz short loc_AC72 push 1 - call sub_F282 + call frame_delay loc_AC72: inc [bp+var_4] @@ -1591,7 +1591,7 @@ loc_AD9A: push ax call sub_A738 push 1 - call sub_F282 + call frame_delay mov dx, 0A4h mov al, 0 out dx, al @@ -1644,7 +1644,7 @@ loc_AE25: cmp byte_14F8E, 0 jnz short loc_AE41 push [bp+var_4] - call sub_F282 + call frame_delay loc_AE41: inc si @@ -1660,7 +1660,7 @@ loc_AE42: push [bp+var_2] call sub_EFDC push 1 - call sub_F282 + call frame_delay loc_AE64: push 0A00040h @@ -2261,7 +2261,7 @@ sub_B37C proc near push bp mov bp, sp push 2 - call sub_F282 + call frame_delay mov dx, 0A6h ; '¦' mov al, byte_1085E out dx, al @@ -3607,7 +3607,7 @@ sub_BD1E proc near call sub_EB1A call sub_BE76 push 1 - call sub_F282 + call frame_delay mov dx, 0A6h ; '¦' mov al, byte_11621 out dx, al @@ -5978,7 +5978,7 @@ sub_D1B1 proc near out dx, al call sub_CA9B push 40h - call sub_F282 + call frame_delay call sub_D16F push 0 call sub_F212 @@ -8128,7 +8128,7 @@ sub_E349 proc near call sub_D5E1 call sub_DFEC push 1 - call sub_F282 + call frame_delay mov dx, 0A6h ; '¦' mov al, byte_1183A out dx, al @@ -10194,7 +10194,7 @@ loc_F263: or si, si jge short loc_F277 push [bp+arg_0] - nopcall sub_F282 + nopcall frame_delay jmp short loc_F27C ; --------------------------------------------------------------------------- @@ -10211,21 +10211,7 @@ sub_F25F endp ; --------------------------------------------------------------------------- db 0 -; =============== S U B R O U T I N E ======================================= - - -sub_F282 proc far - mov bx, sp - mov bx, ss:[bx+4] - mov vsync_Count1, 0 - -loc_F28E: - cmp vsync_Count1, bx - jb short loc_F28E - retf 2 -sub_F282 endp - -; --------------------------------------------------------------------------- +include th05/frame_delay.asm db 0 mov byte_1082E, 1 nop diff --git a/th05_op.asm b/th05_op.asm index 95798eb3..c01ebafc 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -1832,7 +1832,7 @@ loc_B048: les bx, dword_11DCC inc dword ptr es:[bx+28h] push 1 - call sub_E15E + call frame_delay loc_B058: cmp byte_F072, 0 @@ -2026,7 +2026,7 @@ loc_B196: push si call sub_B077 push 1 - call sub_E15E + call frame_delay inc di add si, 8 @@ -2140,7 +2140,7 @@ loc_B24C: push si call sub_B0F1 push 1 - call sub_E15E + call frame_delay inc di sub si, 8 @@ -2384,7 +2384,7 @@ loc_B3E6: push 0 call sub_E0A4 push 1 - call sub_E15E + call frame_delay test byte ptr word_12A72+1, 20h jnz short loc_B452 test byte ptr word_12A72, 20h @@ -2502,7 +2502,7 @@ loc_B503: push 0 call sub_E0A4 push 1 - call sub_E15E + call frame_delay test byte ptr word_12A72+1, 20h jnz short loc_B56F test byte ptr word_12A72, 20h @@ -2597,7 +2597,7 @@ sub_B5A6 proc near call palette_black_in call sub_B36C push 1 - call sub_E15E + call frame_delay push 0 call graph_copy_page call sub_B489 @@ -3526,7 +3526,7 @@ loc_BD55: loc_BD81: push 1 - call sub_E15E + call frame_delay mov dx, 0A6h ; '¦' mov al, [bp+var_1] out dx, al @@ -3580,7 +3580,7 @@ loc_BDE8: mov dx, 0A4h out dx, al push 10h - call sub_E15E + call frame_delay xor si, si jmp short loc_BE46 ; --------------------------------------------------------------------------- @@ -3602,7 +3602,7 @@ loc_BE08: loc_BE25: push 1 - call sub_E15E + call frame_delay mov dx, 0A6h ; '¦' mov al, [bp+var_1] out dx, al @@ -4154,7 +4154,7 @@ sub_C293 proc near mov al, 0 out dx, al push 1 - call sub_E15E + call frame_delay mov dx, 0A4h mov al, byte ptr word_13E94+1 out dx, al @@ -5430,7 +5430,7 @@ loc_CC9F: loc_CCA9: call sub_E094 push 1 - call sub_E15E + call frame_delay test byte ptr word_12A72+1, 20h jnz short loc_CD17 test byte ptr word_12A72, 20h @@ -5490,7 +5490,7 @@ loc_CD17: loc_CD64: call sub_E094 push 1 - call sub_E15E + call frame_delay cmp word_12A72, 0 jnz short loc_CD64 push 100h @@ -6075,7 +6075,7 @@ loc_D1D0: call sub_CEFF mov vsync_Count1, 0 push 1 - call sub_E15E + call frame_delay mov dx, 0A4h mov al, 1 out dx, al @@ -6083,7 +6083,7 @@ loc_D1D0: call graph_copy_page mov vsync_Count1, 0 push 1 - call sub_E15E + call frame_delay mov dx, 0A4h mov al, 0 out dx, al @@ -6109,7 +6109,7 @@ loc_D231: call sub_CEFF mov vsync_Count1, 0 push 1 - call sub_E15E + call frame_delay mov dx, 0A4h mov al, 1 out dx, al @@ -6117,7 +6117,7 @@ loc_D231: call graph_copy_page mov vsync_Count1, 0 push 1 - call sub_E15E + call frame_delay mov dx, 0A4h mov al, 0 out dx, al @@ -6173,7 +6173,7 @@ loc_D2EC: loc_D2F7: push 1 - call sub_E15E + call frame_delay jmp loc_D1B5 ; --------------------------------------------------------------------------- leave @@ -8238,7 +8238,7 @@ loc_E0F5: or si, si jge short loc_E109 push [bp+arg_0] - nopcall sub_E15E + nopcall frame_delay jmp short loc_E10E ; --------------------------------------------------------------------------- @@ -8303,22 +8303,7 @@ loc_E14E: retf 6 sub_E114 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_E15E proc far - mov bx, sp - mov bx, ss:[bx+4] - mov vsync_Count1, 0 - -loc_E16A: - cmp vsync_Count1, bx - jb short loc_E16A - retf 2 -sub_E15E endp - -; --------------------------------------------------------------------------- +include th05/frame_delay.asm db 0 ; =============== S U B R O U T I N E =======================================