2014-08-06 03:21:22 +00:00
|
|
|
;
|
|
|
|
; +-------------------------------------------------------------------------+
|
|
|
|
; | This file has been generated by The Interactive Disassembler (IDA) |
|
|
|
|
; | Copyright (c) 2009 by Hex-Rays, <support@hex-rays.com> |
|
|
|
|
; +-------------------------------------------------------------------------+
|
|
|
|
;
|
|
|
|
; Input MD5 : 2CAAD6F798E32B912A08DA327A97DDB4
|
|
|
|
|
|
|
|
; File Name : th01/FUUIN.EXE
|
|
|
|
; Format : MS-DOS executable (EXE)
|
|
|
|
; Base Address: 0h Range: 0h-147E0h Loaded length: 13ED8h
|
|
|
|
; Entry Point : 0:0
|
|
|
|
; OS type : MS DOS
|
|
|
|
; Application type: Executable 16bit
|
|
|
|
|
2021-03-29 17:16:49 +00:00
|
|
|
.386
|
|
|
|
.model use16 large _TEXT
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2020-03-12 21:14:23 +00:00
|
|
|
BINARY = 'E'
|
|
|
|
|
2014-08-22 15:06:33 +00:00
|
|
|
include ReC98.inc
|
2019-09-20 19:02:20 +00:00
|
|
|
include th01/th01.inc
|
Include RULES.ASI from every executable's dump file.
Having thought this over for a while, I've decided to stay with the "include
slice" model for now, due to various bugs and other reasons.
We need to compile for the 386 CPU, but this causes TASM to automatically
default every segment to 32-bit mode, which of course is not what we want (and
no, .MODEL USE16 sadly does not help either). Appending USE16 to every segment
declaration in all included files seems to work, but for some reason, this
messes up certain jump instructions. WTF? And even if it did work, we would
still have to do this for every single file we include.
The alternative would be to build proper libraries and let the linker merge
all the code. This would add a lot of unwarranted complexity to the build
process. Not to mention all the EXTERN statements we'd have to maintain.
Ultimately, all of the C runtime ASM code is going to vanish anyway once we've
completed the reduction step. Once we're there, we can simply link to the
original version of the library. These initial dumps are not pretty, and I see
no point in wasting time on making intermediary stages of development look
pretty.
Since including RULES.ASI from every slice seems a bit inefficient (and even
potentiall harmful, considering the age of the development tools we have to
work with), we'll only include it once at the top of every main dump file.
[Binary change] Relocations in TH01's REIIDEN.EXE, again.
2014-08-14 06:01:36 +00:00
|
|
|
|
2015-02-19 06:46:36 +00:00
|
|
|
extern SCOPY@:proc
|
|
|
|
extern __setargv__:proc ; main() needs both to be set
|
|
|
|
extern __setenvp__:proc
|
|
|
|
extern _execl:proc
|
|
|
|
|
2020-05-24 18:47:51 +00:00
|
|
|
fuuin_01 group fuuin_01_TEXT, fuuin_01__TEXT
|
|
|
|
|
2014-08-06 03:21:22 +00:00
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2015-02-18 11:07:37 +00:00
|
|
|
_TEXT segment word public 'CODE' use16
|
|
|
|
assume cs:_TEXT
|
2015-02-19 06:46:36 +00:00
|
|
|
assume es:nothing, ds:_DATA, fs:nothing, gs:nothing
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2014-08-27 22:58:40 +00:00
|
|
|
include libs/master.lib/graph_400line.asm
|
2014-08-27 04:03:08 +00:00
|
|
|
include libs/master.lib/graph_clear.asm
|
2014-08-27 03:18:17 +00:00
|
|
|
include libs/master.lib/graph_show.asm
|
2014-08-27 23:16:54 +00:00
|
|
|
include libs/master.lib/graph_start.asm
|
2014-08-31 04:43:32 +00:00
|
|
|
include libs/master.lib/graph_scrollup.asm
|
2014-08-23 14:11:16 +00:00
|
|
|
include libs/master.lib/palette_show.asm
|
2014-08-23 14:18:30 +00:00
|
|
|
include libs/master.lib/palette_init.asm
|
2014-09-03 13:23:51 +00:00
|
|
|
include libs/master.lib/respal_exist.asm
|
2014-09-03 13:41:25 +00:00
|
|
|
include libs/master.lib/respal_free.asm
|
2014-09-07 13:47:50 +00:00
|
|
|
include libs/master.lib/resdata.asm
|
2014-08-30 07:00:31 +00:00
|
|
|
include libs/master.lib/file_read.asm
|
2014-08-30 06:15:42 +00:00
|
|
|
include libs/master.lib/file_close.asm
|
2014-08-30 07:12:17 +00:00
|
|
|
include libs/master.lib/file_ropen.asm
|
2014-08-30 07:21:44 +00:00
|
|
|
include libs/master.lib/file_seek.asm
|
2014-08-30 07:56:49 +00:00
|
|
|
include libs/master.lib/key_sense.asm
|
2014-08-21 20:07:58 +00:00
|
|
|
include libs/master.lib/dos_ropen.asm
|
2014-08-20 20:24:05 +00:00
|
|
|
include libs/master.lib/egc.asm
|
2014-08-30 12:15:00 +00:00
|
|
|
include libs/master.lib/gdc_outpw.asm
|
2014-08-06 03:21:22 +00:00
|
|
|
db 0
|
2014-08-30 10:13:04 +00:00
|
|
|
include libs/master.lib/random.asm
|
2015-02-18 11:07:37 +00:00
|
|
|
_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2015-02-21 11:47:24 +00:00
|
|
|
fuuin_01_TEXT segment byte public 'CODE' use16
|
2020-05-24 18:47:51 +00:00
|
|
|
fuuin_01_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2020-05-24 18:47:51 +00:00
|
|
|
fuuin_01__TEXT segment byte public 'CODE' use16
|
|
|
|
assume cs:fuuin_01
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2020-05-24 18:47:51 +00:00
|
|
|
extern _end_init:proc
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; =============== S U B R O U T I N E =======================================
|
|
|
|
|
|
|
|
; Attributes: bp-based frame
|
|
|
|
|
|
|
|
; int __cdecl main(int argc, const char **argv, const char **envp)
|
2015-02-19 06:46:36 +00:00
|
|
|
public _main
|
2014-08-10 01:44:54 +00:00
|
|
|
_main proc far
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
_argc = word ptr 6
|
|
|
|
_argv = dword ptr 8
|
|
|
|
_envp = dword ptr 0Ch
|
|
|
|
|
|
|
|
push bp
|
|
|
|
mov bp, sp
|
2019-11-04 03:11:06 +00:00
|
|
|
call _mdrv2_resident
|
2014-08-06 03:21:22 +00:00
|
|
|
or ax, ax
|
|
|
|
jnz short loc_A105
|
|
|
|
pop bp
|
|
|
|
retf
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
2014-08-10 01:44:54 +00:00
|
|
|
loc_A105:
|
2014-08-06 03:21:22 +00:00
|
|
|
les bx, [bp+_argv]
|
|
|
|
les bx, es:[bx+4]
|
|
|
|
mov al, es:[bx]
|
|
|
|
cbw
|
|
|
|
cmp ax, 74h ; 't'
|
|
|
|
jz short loc_A121
|
2020-05-24 18:47:51 +00:00
|
|
|
call _end_init
|
2014-08-06 03:21:22 +00:00
|
|
|
or ax, ax
|
|
|
|
jnz short loc_A11F
|
|
|
|
pop bp
|
|
|
|
retf
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
2014-08-10 01:44:54 +00:00
|
|
|
loc_A11F:
|
2014-08-06 03:21:22 +00:00
|
|
|
jmp short loc_A13E
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
2014-08-10 01:44:54 +00:00
|
|
|
loc_A121:
|
2014-08-06 03:21:22 +00:00
|
|
|
les bx, [bp+_argv]
|
|
|
|
les bx, es:[bx+4]
|
|
|
|
mov al, es:[bx+1]
|
|
|
|
cbw
|
|
|
|
cmp ax, 31h ; '1'
|
|
|
|
jnz short loc_A139
|
2020-05-24 18:47:51 +00:00
|
|
|
mov _end_flag, 1
|
2014-08-06 03:21:22 +00:00
|
|
|
jmp short loc_A13E
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
2014-08-10 01:44:54 +00:00
|
|
|
loc_A139:
|
2020-05-24 18:47:51 +00:00
|
|
|
mov _end_flag, 2
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2014-08-10 01:44:54 +00:00
|
|
|
loc_A13E:
|
2015-02-21 19:45:02 +00:00
|
|
|
call _mdrv2_check_board
|
2022-08-08 23:38:13 +00:00
|
|
|
call @game_init$qv
|
2022-08-06 16:00:12 +00:00
|
|
|
call @end_and_verdict_and_regist_anima$qv
|
2022-08-08 23:38:13 +00:00
|
|
|
call @game_switch_binary$qv
|
2014-08-06 03:21:22 +00:00
|
|
|
push 0
|
|
|
|
push 0
|
|
|
|
push ds
|
|
|
|
push offset arg0 ; "op"
|
|
|
|
push ds
|
|
|
|
push offset path ; "op"
|
|
|
|
call _execl
|
|
|
|
add sp, 0Ch
|
|
|
|
pop bp
|
|
|
|
retf
|
|
|
|
_main endp
|
|
|
|
|
2020-05-24 18:47:51 +00:00
|
|
|
fuuin_01__TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
2015-02-21 11:47:24 +00:00
|
|
|
fuuin_02_TEXT segment byte public 'CODE' use16
|
2020-03-20 18:31:31 +00:00
|
|
|
fuuin_02_TEXT ends
|
|
|
|
|
2014-08-06 03:21:22 +00:00
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2015-02-21 11:47:24 +00:00
|
|
|
fuuin_03_TEXT segment byte public 'CODE' use16
|
2022-08-06 16:00:12 +00:00
|
|
|
extern @end_and_verdict_and_regist_anima$qv:proc
|
2015-02-21 11:47:24 +00:00
|
|
|
fuuin_03_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2015-02-21 11:47:24 +00:00
|
|
|
fuuin_04_TEXT segment byte public 'CODE' use16
|
|
|
|
fuuin_04_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2020-11-04 13:47:52 +00:00
|
|
|
vsync_TEXT segment byte public 'CODE' use16
|
|
|
|
vsync_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
2020-11-04 13:47:52 +00:00
|
|
|
ztext_TEXT segment byte public 'CODE' use16
|
|
|
|
ztext_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2020-11-04 13:47:52 +00:00
|
|
|
initexit_TEXT segment byte public 'CODE' use16
|
2022-08-08 23:38:13 +00:00
|
|
|
extern @game_init$qv:proc
|
|
|
|
extern @game_switch_binary$qv:proc
|
2020-11-04 13:47:52 +00:00
|
|
|
initexit_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2020-11-04 13:47:52 +00:00
|
|
|
graph_TEXT segment byte public 'CODE' use16
|
|
|
|
graph_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
2020-11-04 13:47:52 +00:00
|
|
|
grppffx_TEXT segment byte public 'CODE' use16
|
|
|
|
grppffx_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
2021-01-22 11:56:24 +00:00
|
|
|
PTN_GRP_GRZ segment byte public 'CODE' use16
|
|
|
|
PTN_GRP_GRZ ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
2021-04-12 14:15:58 +00:00
|
|
|
SHARED segment byte public 'CODE' use16
|
|
|
|
SHARED ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2022-05-22 13:53:25 +00:00
|
|
|
GRAPH_EX_TEXT segment byte public 'CODE' use16
|
|
|
|
GRAPH_EX_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
|
|
|
; ===========================================================================
|
|
|
|
|
|
|
|
; Segment type: Pure code
|
2020-11-04 13:47:52 +00:00
|
|
|
mdrv2_TEXT segment byte public 'CODE' use16
|
2019-11-04 03:11:06 +00:00
|
|
|
extern _mdrv2_resident:proc
|
2015-02-21 19:45:02 +00:00
|
|
|
extern _mdrv2_check_board:proc
|
2020-11-04 13:47:52 +00:00
|
|
|
mdrv2_TEXT ends
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2015-02-18 11:07:37 +00:00
|
|
|
.data
|
2014-08-19 20:33:43 +00:00
|
|
|
|
2020-05-24 18:47:51 +00:00
|
|
|
public _score, _score_highest
|
|
|
|
public _RES_ID_0, _RES_ID_1, _ERROR_END_FLAG, _ERROR_NO_RESDATA
|
2015-03-06 22:04:25 +00:00
|
|
|
_score dd 100000
|
|
|
|
_score_highest dd 100000
|
2020-05-24 18:47:51 +00:00
|
|
|
_RES_ID_0 db 'ReiidenConfig',0
|
|
|
|
_ERROR_END_FLAG db 'ERROR : end_flag is not ture !!',0
|
|
|
|
_ERROR_NO_RESDATA db 'ERROR : cfg_id is not alloc!!',0
|
|
|
|
_RES_ID_1 db 'ReiidenConfig',0
|
2014-08-06 03:21:22 +00:00
|
|
|
; char path[]
|
2014-08-10 01:44:54 +00:00
|
|
|
path db 'op',0
|
2014-08-06 03:21:22 +00:00
|
|
|
; char arg0[3]
|
2014-08-10 01:44:54 +00:00
|
|
|
arg0 db 'op',0
|
|
|
|
db 0
|
2020-05-11 18:04:14 +00:00
|
|
|
include th01/hardware/input_main_end[data].asm
|
2014-08-06 03:21:22 +00:00
|
|
|
dd 0
|
2022-05-30 01:49:51 +00:00
|
|
|
|
2022-05-29 20:40:18 +00:00
|
|
|
; th01/hardware/palette[data].asm
|
|
|
|
extern _z_Palettes:rgb_t:COLOR_COUNT
|
|
|
|
|
|
|
|
; libs/master.lib/grp[data].asm
|
|
|
|
extern graph_VramSeg:word
|
|
|
|
extern graph_VramWords:word
|
|
|
|
extern graph_VramLines:word
|
|
|
|
extern graph_VramZoom:word
|
|
|
|
|
|
|
|
; libs/master.lib/pal[data].asm
|
|
|
|
extern PaletteTone:word
|
|
|
|
extern PalettesInit:rgb_t:COLOR_COUNT
|
|
|
|
extern PaletteNote:word
|
|
|
|
extern ResPalSeg:word
|
|
|
|
|
|
|
|
; libs/master.lib/respal_exist[data].asm
|
|
|
|
IDLEN EQU 10
|
|
|
|
extern ResPalID:byte:IDLEN
|
|
|
|
|
|
|
|
; libs/master.lib/fil[data].asm
|
|
|
|
extern file_BufferSize:word
|
|
|
|
extern file_Handle:word
|
|
|
|
|
|
|
|
; libs/master.lib/dos_ropen[data].asm
|
|
|
|
extern file_sharingmode:word
|
|
|
|
|
|
|
|
; libs/master.lib/clip[data].asm
|
|
|
|
extern ClipXL:word
|
|
|
|
extern ClipXW:word
|
|
|
|
extern ClipXR:word
|
|
|
|
extern ClipYT:word
|
|
|
|
extern ClipYH:word
|
|
|
|
extern ClipYB:word
|
|
|
|
extern ClipYT_seg:word
|
|
|
|
extern ClipYB_adr:word
|
|
|
|
|
|
|
|
; libs/master.lib/rand[data].asm
|
|
|
|
extern random_seed:dword
|
2014-08-17 21:55:59 +00:00
|
|
|
|
2015-02-18 11:07:37 +00:00
|
|
|
.data?
|
|
|
|
|
2020-05-24 18:47:51 +00:00
|
|
|
public _continues_total, _continues_per_scene
|
2015-03-06 22:04:25 +00:00
|
|
|
_continues_total dd ?
|
2020-05-24 18:47:51 +00:00
|
|
|
_continues_per_scene dd SCENE_COUNT dup(?)
|
2020-03-21 15:21:33 +00:00
|
|
|
db 308 dup(?)
|
2020-05-24 18:47:51 +00:00
|
|
|
public _start_lives_extra, _end_flag, _rank
|
|
|
|
_start_lives_extra db ?
|
|
|
|
_end_flag db ? ; ZUN symbol [Strings]
|
2019-03-01 15:16:54 +00:00
|
|
|
_rank db ?
|
2014-08-06 03:21:22 +00:00
|
|
|
db ?
|
2020-03-20 17:40:56 +00:00
|
|
|
include th01/hiscore/hiscore[bss].asm
|
2014-08-06 03:21:22 +00:00
|
|
|
db ? ;
|
2020-05-11 18:04:14 +00:00
|
|
|
public _input_prev
|
|
|
|
_input_prev db 10 dup(?)
|
|
|
|
evendata
|
2015-09-05 20:06:46 +00:00
|
|
|
include th01/hardware/vsync[bss].asm
|
2020-03-21 15:21:33 +00:00
|
|
|
db 256 dup(?)
|
2020-03-02 19:22:10 +00:00
|
|
|
include th01/core/initexit[bss].asm
|
2020-01-06 13:40:42 +00:00
|
|
|
include th01/hardware/graph[bss].asm
|
2020-03-21 15:21:33 +00:00
|
|
|
db 80 dup(?)
|
2020-03-10 22:10:36 +00:00
|
|
|
include th01/formats/grp_palette[bss].asm
|
2020-03-21 15:21:33 +00:00
|
|
|
db 1136 dup(?)
|
2020-03-12 23:54:35 +00:00
|
|
|
include th01/formats/grp_buf[bss].asm
|
[Reverse-engineering] 32-bit VRAM plane pointers
I've looked at every openly available piece of PC-98 documentation, and there
don't seem to be any official names for the individual planes. The closest
thing I could find was the description at
http://island.geocities.jp/cklouch/column/pc98bas/pc98disphw2.htm
explaining that they represent the blue, red, green, and brightness component
when using the default PC-98 palette. However, these planes correspond to
nothing else but the 4 individual bits of the final index into the color
palette, and you can assign any color to every single palette slot. Therefore,
it's merely a convention that your own palettes don't have to follow (and in
Touhou, they don't).
Nevertheless, there doesn't seem to be an alternative, and the Neko Project II
source code uses the same B/R/G/E convention, so I'll go with that as well.
2015-02-10 22:43:34 +00:00
|
|
|
include th01/hardware/vram_planes[bss].asm
|
2022-07-24 17:04:52 +00:00
|
|
|
|
|
|
|
; libs/master.lib/pal[bss].asm
|
|
|
|
extern Palettes:rgb_t:COLOR_COUNT
|
|
|
|
|
|
|
|
; libs/master.lib/fil[bss].asm
|
|
|
|
extern file_Buffer:dword
|
|
|
|
extern file_BufferPos:dword
|
|
|
|
extern file_BufPtr:word
|
|
|
|
extern file_InReadBuf:word
|
|
|
|
extern file_Eof:word
|
|
|
|
extern file_ErrorStat:word
|
2014-08-06 03:21:22 +00:00
|
|
|
|
2015-02-19 06:46:36 +00:00
|
|
|
end
|