Skip to content

Commit

Permalink
[Decompilation] [th01] frame_delay
Browse files Browse the repository at this point in the history
Closes #7.
  • Loading branch information
Wintiger0222 authored and nmlgc committed Nov 18, 2019
1 parent fef0299 commit 01de290
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Makefile.mak
Expand Up @@ -41,12 +41,12 @@ th05:: $(TH05:\=bin\th05\)
bin\th01\zunsoft.com: th01\zunsoft.c
$(CC) $(CFLAGS) -mt -lt -nbin\th01\ $** masters.lib

bin\th01\op.exe: bin\th01\op.obj th01\op_03.c th01\op_04.c th01\op_10.c th01\op_11.c th01\op_12.cpp
bin\th01\op.exe: bin\th01\op.obj th01\op_02.c th01\op_03.c th01\op_04.c th01\op_10.c th01\op_11.c th01\op_12.cpp
$(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eOP.EXE @&&|
$**
|

bin\th01\reiiden.exe: bin\th01\reiiden.obj th01\main_03.c th01\main_04.c th01\main_12.c th01\main_13.c th01\main_14.c th01\main_16.c
bin\th01\reiiden.exe: bin\th01\reiiden.obj th01\main_02.c th01\main_03.c th01\main_04.c th01\main_12.c th01\main_13.c th01\main_14.c th01\main_16.c
$(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eREIIDEN.EXE @&&|
$**
|
Expand Down
9 changes: 9 additions & 0 deletions th01/hardware/frmdely.c
@@ -0,0 +1,9 @@
extern int vsync_frame;
#define z_vsync_reset1() (vsync_frame = 0)
// #define z_vsync_reset2() (vsync_unused = 0)

void far frame_delay(unsigned int frames)
{
while(vsync_frame < frames) {}
z_vsync_reset1();
}
6 changes: 6 additions & 0 deletions th01/main_02.c
@@ -0,0 +1,6 @@
/* ReC98
* -----
* Code segment #2 of TH01's REIIDEN.EXE
*/

#include "th01/hardware/frmdely.c"
6 changes: 6 additions & 0 deletions th01/op_02.c
@@ -0,0 +1,6 @@
/* ReC98
* -----
* Code segment #2 of TH01's OP.EXE
*/

#include "th01/hardware/frmdely.c"
37 changes: 7 additions & 30 deletions th01_op.asm
Expand Up @@ -764,7 +764,7 @@ loc_A6C8:
call sub_A629
pop cx
push 1
call sub_B269
call _frame_delay
pop cx

loc_A6F5:
Expand Down Expand Up @@ -816,7 +816,7 @@ sub_A719 proc far
pop cx
call sub_BC8B
push 64h ; 'd'
call sub_B269
call _frame_delay
pop cx
call sub_A66A
pop bp
Expand Down Expand Up @@ -1952,7 +1952,7 @@ loc_B0D6:

loc_B126:
push 1
call sub_B269
call _frame_delay
pop cx
push di
call sub_A92C
Expand Down Expand Up @@ -2031,7 +2031,7 @@ loc_B1C3:

loc_B1C9:
push 0Fh
call sub_B269
call _frame_delay
pop cx
mov byte_1232A, 0
jmp short loc_B1EE
Expand All @@ -2043,7 +2043,7 @@ loc_B1D8:
cmp ax, 4
jnz short loc_B1EE
push 0Fh
call sub_B269
call _frame_delay
pop cx
mov byte_1232A, 1

Expand All @@ -2060,7 +2060,7 @@ loc_B1EE:
mov byte ptr es:[0528h], 0
inc dword_13418
push 1
call sub_B269
call _frame_delay
pop cx

loc_B21A:
Expand Down Expand Up @@ -2097,30 +2097,7 @@ op_01_TEXT ends

; Segment type: Pure code
op_02_TEXT segment byte public 'CODE' use16
assume cs:op_02_TEXT
;org 9
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing

; =============== S U B R O U T I N E =======================================

; Attributes: bp-based frame

sub_B269 proc far

arg_0 = word ptr 6

push bp
mov bp, sp

loc_B26C:
mov ax, _vsync_frame
cmp ax, [bp+arg_0]
jb short loc_B26C
mov _vsync_frame, 0
pop bp
retf
sub_B269 endp

extern _frame_delay:proc
op_02_TEXT ends

; ===========================================================================
Expand Down

0 comments on commit 01de290

Please sign in to comment.