[Naming] [th01] Game init and exit functions

This commit is contained in:
wintiger0222 2019-12-09 15:36:30 +09:00 committed by nmlgc
parent 990a1e2c94
commit 67ab2f4a41
3 changed files with 174 additions and 162 deletions

View File

@ -357,9 +357,9 @@ loc_A139:
loc_A13E:
call _mdrv2_check_board
call sub_CEAD
call game_init
call sub_B945
call sub_CF1B
call game_switch_binary
push 0
push 0
push ds
@ -5746,8 +5746,8 @@ fuuin_07_TEXT segment byte public 'CODE' use16
; Attributes: bp-based frame
; void __interrupt sub_CE87()
sub_CE87 proc far
; void __interrupt _int06_nop()
_int06_nop proc far
push eax
push ebx
push ecx
@ -5770,26 +5770,26 @@ sub_CE87 proc far
pop ebx
pop eax
iret
sub_CE87 endp
_int06_nop endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CEAD proc far
public GAME_INIT
game_init proc far
push bp
mov bp, sp
cmp byte_134B8, 0
jnz short loc_CEFE
mov byte_134B8, 1
cmp _game_initialized, 0
jnz short @@ret
mov _game_initialized, 1
push 6 ; interruptno
call _getvect
pop cx
mov word ptr off_14150+2, dx
mov word ptr off_14150, ax
push seg fuuin_07_TEXT
push offset sub_CF87 ; isr
mov word ptr _int06_old+2, dx
mov word ptr _int06_old, ax
push seg _int06_game_exit
push offset _int06_game_exit ; isr
push 6 ; interruptno
call _setvect
add sp, 6
@ -5801,65 +5801,65 @@ sub_CEAD proc far
call sub_E984
call vram_planes_set
loc_CEFE:
@@ret:
pop bp
retf
sub_CEAD endp
game_init endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CF00 proc far
public GAME_EXIT
game_exit proc far
push bp
mov bp, sp
cmp byte_134B8, 1
jnz short loc_CF19
mov byte_134B8, 0
nopcall sub_CF48
cmp _game_initialized, 1
jnz short @@ret
mov _game_initialized, 0
nopcall game_exit_inner
call respal_free
loc_CF19:
@@ret:
pop bp
retf
sub_CF00 endp
game_exit endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CF1B proc far
public GAME_SWITCH_BINARY
game_switch_binary proc far
push bp
mov bp, sp
cmp byte_134B8, 1
jnz short loc_CF46
nopcall sub_CF48
cmp _game_initialized, 1
jnz short @@ret
nopcall game_exit_inner
call _z_text_25line
push 0
call _z_text_setcursor
pop cx
call _z_text_clear
call _z_text_show
mov byte_134B8, 0
mov _game_initialized, 0
loc_CF46:
@@ret:
pop bp
retf
sub_CF1B endp
game_switch_binary endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CF48 proc far
game_exit_inner proc far
push bp
mov bp, sp
mov byte_134B8, 0
push seg fuuin_07_TEXT
push offset sub_CE87 ; isr
mov _game_initialized, 0
push seg _int06_nop
push offset _int06_nop ; isr
push 6 ; interruptno
call _setvect
call _vsync_exit
@ -5867,21 +5867,21 @@ sub_CF48 proc far
call sub_D4FE
call sub_D094
call egc_start
pushd [off_14150] ; isr
pushd [_int06_old] ; isr
push 6 ; interruptno
call _setvect
add sp, 0Ch
pop bp
retf
sub_CF48 endp
game_exit_inner endp
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn bp-based frame
; void __interrupt sub_CF87()
sub_CF87 proc far
; void __interrupt _int06_game_exit()
_int06_game_exit proc far
push eax
push ebx
push ecx
@ -5894,7 +5894,7 @@ sub_CF87 proc far
mov bp, seg _DATA
mov ds, bp
mov bp, sp
call sub_CF00
call game_exit
push 0 ; status
call _exit
; ---------------------------------------------------------------------------
@ -5909,14 +5909,14 @@ sub_CF87 proc far
pop ebx
pop eax
iret
sub_CF87 endp
_int06_game_exit endp
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn bp-based frame
sub_CFB9 proc far
game_exit_print_error proc far
@@buffer = byte ptr -104h
var_4 = word ptr -4
@ -5935,7 +5935,7 @@ _arglist = byte ptr 0Ah
lea ax, [bp+@@buffer]
push ax ; buffer
call _vsprintf
call sub_CF00
call game_exit
push ss
lea ax, [bp+@@buffer]
push ax
@ -5946,7 +5946,7 @@ _arglist = byte ptr 0Ah
add sp, 12h
leave
retf
sub_CFB9 endp
game_exit_print_error endp
fuuin_07_TEXT ends
@ -10069,7 +10069,8 @@ aC db '%c',0
aCC_5 db '%c%c',0
include th01/hardware/vsync[data].asm
include th01/ztext[data].asm
byte_134B8 db 0
public _game_initialized
_game_initialized db 0
db 0
unk_134BA db 0
dd 0
@ -10326,8 +10327,8 @@ include th01/hardware/vsync[bss].asm
dd ?
dd ?
dd ?
; void (__interrupt far *off_14150)()
off_14150 dd ?
; void (__interrupt far *int06_old)()
_int06_old dd ?
word_14154 dw ?
word_14156 dw ?
db ? ;

View File

@ -886,7 +886,7 @@ sub_A7B5 proc far
add sp, 0Ch
call sub_A79D
call _mdrv2_bgm_fade_out_nonblock
call sub_B757
call game_switch_binary
mov al, _mode
cbw
cmp ax, 2
@ -985,7 +985,7 @@ sub_A8AD proc far
loc_A8E1:
call sub_A79D
call _mdrv2_bgm_fade_out_nonblock
call sub_B757
call game_switch_binary
les bx, _reiidenconfig
assume es:nothing
mov es:[bx+reiidenconfig_t.mode], 0
@ -1921,7 +1921,7 @@ loc_B06F:
loc_B0D6:
call _mdrv2_check_board
call sub_B6E9
call game_init
call sub_A240
mov al, byte ptr word_12320+1
cbw
@ -2078,7 +2078,7 @@ loc_B21A:
call _graph_accesspage_func
pop cx
call sub_BB12
call sub_B73C
call game_exit
call _mdrv2_bgm_stop
push ds
push offset format ; "おつかれさまでした!!\n"
@ -2132,8 +2132,8 @@ op_05_TEXT segment byte public 'CODE' use16
; Attributes: bp-based frame
; void __interrupt sub_B6C3()
sub_B6C3 proc far
; void __interrupt _int06_nop()
_int06_nop proc far
push eax
push ebx
push ecx
@ -2156,26 +2156,26 @@ sub_B6C3 proc far
pop ebx
pop eax
iret
sub_B6C3 endp
_int06_nop endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B6E9 proc far
public GAME_INIT
game_init proc far
push bp
mov bp, sp
cmp byte_12978, 0
jnz short loc_B73A
mov byte_12978, 1
cmp _game_initialized, 0
jnz short @@ret
mov _game_initialized, 1
push 6 ; interruptno
call _getvect
pop cx
mov word_1366A, dx
mov word_13667+1, ax
push seg op_05_TEXT
push offset sub_B7C3 ; isr
mov word ptr _int06_old+2, dx
mov word ptr _int06_old+0, ax
push seg _int06_game_exit
push offset _int06_game_exit ; isr
push 6 ; interruptno
call _setvect
add sp, 6
@ -2187,65 +2187,65 @@ sub_B6E9 proc far
call sub_D1C0
call vram_planes_set
loc_B73A:
@@ret:
pop bp
retf
sub_B6E9 endp
game_init endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B73C proc far
public GAME_EXIT
game_exit proc far
push bp
mov bp, sp
cmp byte_12978, 1
jnz short loc_B755
mov byte_12978, 0
nopcall sub_B784
cmp _game_initialized, 1
jnz short @@ret
mov _game_initialized, 0
nopcall game_exit_inner
call respal_free
loc_B755:
@@ret:
pop bp
retf
sub_B73C endp
game_exit endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B757 proc far
public GAME_SWITCH_BINARY
game_switch_binary proc far
push bp
mov bp, sp
cmp byte_12978, 1
jnz short loc_B782
nopcall sub_B784
cmp _game_initialized, 1
jnz short @@ret
nopcall game_exit_inner
call _z_text_25line
push 0
call _z_text_setcursor
pop cx
call _z_text_clear
call _z_text_show
mov byte_12978, 0
mov _game_initialized, 0
loc_B782:
@@ret:
pop bp
retf
sub_B757 endp
game_switch_binary endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B784 proc far
game_exit_inner proc far
push bp
mov bp, sp
mov byte_12978, 0
push seg op_05_TEXT
push offset sub_B6C3 ; isr
mov _game_initialized, 0
push seg _int06_nop
push offset _int06_nop ; isr
push 6 ; interruptno
call _setvect
call _vsync_exit
@ -2253,21 +2253,21 @@ sub_B784 proc far
call sub_BD3A
call sub_B8D0
call egc_start
pushd [dword ptr word_13667+1] ; isr
pushd [dword ptr _int06_old] ; isr
push 6 ; interruptno
call _setvect
add sp, 0Ch
pop bp
retf
sub_B784 endp
game_exit_inner endp
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn bp-based frame
; void __interrupt sub_B7C3()
sub_B7C3 proc near
; void __interrupt _int06_game_exit()
_int06_game_exit proc near
push eax
push ebx
push ecx
@ -2280,11 +2280,9 @@ sub_B7C3 proc near
mov bp, seg _DATA
mov ds, bp
mov bp, sp
call sub_B73C
call game_exit
push 0 ; status
call _exit
sub_B7C3 endp
; ---------------------------------------------------------------------------
pop cx
pop bp
@ -2297,29 +2295,45 @@ sub_B7C3 endp
pop ebx
pop eax
iret
; ---------------------------------------------------------------------------
_int06_game_exit endp
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn bp-based frame
game_exit_print_error proc near
@@buffer = byte ptr -104h
var_4 = word ptr -4
var_2 = word ptr -2
_format = dword ptr 6
arglist = byte ptr 0Ah
enter 104h, 0
lea ax, [bp+0Ah]
mov word ptr [bp-2], ss
mov [bp-4], ax
push word ptr [bp-2]
push ax
pushd dword ptr [bp+6]
lea ax, [bp+arglist]
mov [bp+var_2], ss
mov [bp+var_4], ax
push [bp+var_2]
push ax ; arglist
pushd [bp+_format] ; format
push ss
lea ax, [bp-104h]
push ax
lea ax, [bp+@@buffer]
push ax ; buffer
call _vsprintf
call sub_B73C
call game_exit
push ss
lea ax, [bp-104h]
lea ax, [bp+@@buffer]
push ax
call _z_text_print
push 1
push 1 ; status
call _exit
; ---------------------------------------------------------------------------
add sp, 12h
leave
retf
game_exit_print_error endp
op_05_TEXT ends
; ---------------------------------------------------------------------------
@ -7714,7 +7728,8 @@ aCon db 'CON',0
format db 'おつかれさまでした!!',0Ah,0
include th01/hardware/vsync[data].asm
include th01/ztext[data].asm
byte_12978 db 0
public _game_initialized
_game_initialized db 0
db 0
unk_1297A db 0
dd 0
@ -7944,9 +7959,8 @@ word_13627 dw ?
dd ?
dd ?
word_13665 dw ?
word_13667 dw ?
db ?
word_1366A dw ?
_int06_old dd ?
word_1366C dw ?
word_1366E dw ?
db ? ;

View File

@ -2993,7 +2993,7 @@ loc_CD70:
jnz short loc_CDA2
les bx, _reiidenconfig
mov es:[bx+reiidenconfig_t.snd_need_init], 0
call sub_E852
call game_switch_binary
les bx, _reiidenconfig
mov es:[bx+reiidenconfig_t.p_value], 0
pushd 0
@ -4039,7 +4039,7 @@ loc_D583:
mov word_34A8A, ax
mov eax, _rand
mov random_seed, eax
call sub_E7E4
call game_init
call key_start
push 3F003Fh
call __control87
@ -4903,7 +4903,7 @@ loc_DE47:
push 78h ; 'x'
call _frame_delay
pop cx
call sub_E852
call game_switch_binary
pushd 0
push ds
push offset aFuuin ; "fuuin"
@ -5005,7 +5005,7 @@ loc_DF52:
les bx, _reiidenconfig
mov al, _bombs
mov es:[bx+reiidenconfig_t.bombs], al
call sub_E852
call game_switch_binary
pushd 0
push ds
push offset aReiiden ; "reiiden"
@ -5270,7 +5270,7 @@ loc_E2A8:
loc_E2CB:
call sub_D487
call sub_D4DD
call sub_E852
call game_switch_binary
call key_end
call @arc_close$qv
pushd 0
@ -5372,8 +5372,8 @@ main_05_TEXT segment byte public 'CODE' use16
; Attributes: bp-based frame
; void __interrupt sub_E7BE()
sub_E7BE proc far
; void __interrupt _int06_nop()
_int06_nop proc far
push eax
push ebx
push ecx
@ -5396,26 +5396,26 @@ sub_E7BE proc far
pop ebx
pop eax
iret
sub_E7BE endp
_int06_nop endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E7E4 proc far
public GAME_INIT
game_init proc far
push bp
mov bp, sp
cmp byte_3508E, 0
cmp _game_initialized, 0
jnz short loc_E835
mov byte_3508E, 1
mov _game_initialized, 1
push 6 ; interruptno
call _getvect
pop cx
mov word ptr off_3891E+2, dx
mov word ptr off_3891E, ax
push seg main_05_TEXT
push offset sub_E8BE ; isr
mov word ptr _int06_old+2, dx
mov word ptr _int06_old, ax
push seg _int06_game_exit
push offset _int06_game_exit ; isr
push 6 ; interruptno
call _setvect
add sp, 6
@ -5430,62 +5430,62 @@ sub_E7E4 proc far
loc_E835:
pop bp
retf
sub_E7E4 endp
game_init endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E837 proc far
public GAME_EXIT
game_exit proc far
push bp
mov bp, sp
cmp byte_3508E, 1
jnz short loc_E850
mov byte_3508E, 0
nopcall sub_E87F
cmp _game_initialized, 1
jnz short @@ret
mov _game_initialized, 0
nopcall game_exit_inner
call respal_free
loc_E850:
@@ret:
pop bp
retf
sub_E837 endp
game_exit endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E852 proc far
public GAME_SWITCH_BINARY
game_switch_binary proc far
push bp
mov bp, sp
cmp byte_3508E, 1
jnz short loc_E87D
nopcall sub_E87F
cmp _game_initialized, 1
jnz short @@ret
nopcall game_exit_inner
call _z_text_25line
push 0
call _z_text_setcursor
pop cx
call _z_text_clear
call _z_text_show
mov byte_3508E, 0
mov _game_initialized, 0
loc_E87D:
@@ret:
pop bp
retf
sub_E852 endp
game_switch_binary endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E87F proc far
game_exit_inner proc far
push bp
mov bp, sp
mov byte_3508E, 0
push seg main_05_TEXT
push offset sub_E7BE ; isr
mov _game_initialized, 0
push seg _int06_nop
push offset _int06_nop ; isr
push 6 ; interruptno
call _setvect
call _vsync_exit
@ -5493,21 +5493,21 @@ sub_E87F proc far
call sub_EE35
call sub_E9CB
call egc_start
pushd [off_3891E] ; isr
pushd [_int06_old] ; isr
push 6 ; interruptno
call _setvect
add sp, 0Ch
pop bp
retf
sub_E87F endp
game_exit_inner endp
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn bp-based frame
; void __interrupt sub_E8BE()
sub_E8BE proc far
; void __interrupt _int06_game_exit()
_int06_game_exit proc far
push eax
push ebx
push ecx
@ -5520,7 +5520,7 @@ sub_E8BE proc far
mov bp, seg _DATA
mov ds, bp
mov bp, sp
call sub_E837
call game_exit
push 0 ; status
call _exit
; ---------------------------------------------------------------------------
@ -5535,14 +5535,14 @@ sub_E8BE proc far
pop ebx
pop eax
iret
sub_E8BE endp
_int06_game_exit endp
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn bp-based frame
sub_E8F0 proc near
game_exit_print_error proc near
@@buffer = byte ptr -104h
var_4 = word ptr -4
@ -5561,18 +5561,14 @@ arglist = byte ptr 0Ah
lea ax, [bp+@@buffer]
push ax ; buffer
call _vsprintf
call sub_E837
call game_exit
push ss
lea ax, [bp+@@buffer]
push ax
call _z_text_print
loc_E91F: ; status
push 1
loc_E921:
push 1 ; status
call _exit
sub_E8F0 endp
game_exit_print_error endp
main_05_TEXT ends
@ -29259,7 +29255,8 @@ aOp db 'op',0
db 0
include th01/hardware/vsync[data].asm
include th01/ztext[data].asm
byte_3508E db 0
public _game_initialized
_game_initialized db 0
db 0
unk_35090 db 0
dd 0
@ -32529,8 +32526,8 @@ include th01/hardware/vsync[bss].asm
dd ?
dd ?
dd ?
; void (__interrupt far *off_3891E)()
off_3891E dd ?
; void (__interrupt far *int06_old)()
_int06_old dd ?
word_38922 dw ?
word_38924 dw ?
db ? ;