mirror of https://github.com/nmlgc/ReC98.git
[C decompilation] [th02] ZUN_RES.COM
This, hands down, has been the single worst stretch of decompilation so far. Three extremely difficult functions that each still required inline assembly. And no, this didn't even work out with any of the optimization features in Borland C++ that aren't included in Turbo C++.
This commit is contained in:
parent
697407d658
commit
aa56a7cb18
|
@ -43,6 +43,11 @@ bin\th01\fuuin.exe: bin\th01\fuuin.obj th01\fuuin_05.c th01\fuuin_06.c th01\fuui
|
|||
$**
|
||||
|
|
||||
|
||||
bin\th02\zun_res.com: th02\zun_res1.c th02\zun_res2.c
|
||||
$(CC) $(CFLAGS) -mt -lt -Z -nbin\th02\ -eZUN_RES.COM @&&|
|
||||
$**
|
||||
| masters.lib
|
||||
|
||||
bin\th02\op.exe: th02\op_01.c bin\th02\op.obj th02\op_02_1.c th02\op_02_2.c th02\op_03.c th02\op_04.c th02\op_05.c th02\op_06.c
|
||||
$(CC) $(CFLAGS) -ml -Z -DGAME=2 -nbin\th02\ -eOP.EXE @&&|
|
||||
$**
|
||||
|
|
|
@ -14,7 +14,6 @@ if errorlevel 9009 goto no_tasm32
|
|||
%ReC98_ASM% th01_fuuin.asm bin\th01\fuuin.obj
|
||||
|
||||
%ReC98_ASM% th02_zuninit.asm bin\th02\zuninit.obj
|
||||
%ReC98_ASM% th02_zun_res.asm bin\th02\zun_res.obj
|
||||
%ReC98_ASM% th02_op.asm bin\th02\op.obj
|
||||
%ReC98_ASM% th02_main.asm bin\th02\main.obj
|
||||
%ReC98_ASM% th02_maine.asm bin\th02\maine.obj
|
||||
|
|
|
@ -218,13 +218,14 @@ typedef struct {
|
|||
int resident_sgm;
|
||||
char debug;
|
||||
} huuma_cfg_t;
|
||||
#pragma option -a2
|
||||
#pragma option -a.
|
||||
// ------------------
|
||||
|
||||
// Resident structure
|
||||
// ------------------
|
||||
#define RES_ID "MIKOConfig"
|
||||
typedef struct {
|
||||
char id[11]; // = "MIKOConfig"
|
||||
char id[11]; // = RES_ID
|
||||
char stage;
|
||||
char debug;
|
||||
long score;
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
/* ReC98
|
||||
* -----
|
||||
* 1st part of ZUN_RES.COM. Initializes the resident structure and
|
||||
* configuration file required in order to run TH02, and verifies HUUHI.DAT.
|
||||
*/
|
||||
|
||||
#pragma inline
|
||||
|
||||
#include <stddef.h>
|
||||
#include "th02/th02.h"
|
||||
|
||||
#pragma option -a1
|
||||
|
||||
char debug = 0;
|
||||
|
||||
void cfg_write(int mikoconfig_sgm)
|
||||
{
|
||||
static const huuma_options_t opts_default = {
|
||||
RANK_NORMAL, SND_BGM_FM, 3, 2, 0
|
||||
};
|
||||
static const char HUUMA_CFG[] = CFG_FN;
|
||||
|
||||
const char *fn = HUUMA_CFG;
|
||||
huuma_options_t opts = opts_default;
|
||||
int handle = dos_axdx(0x3D02, fn);
|
||||
if(handle > 0) {
|
||||
dos_seek(handle, sizeof(opts), SEEK_SET);
|
||||
} else {
|
||||
handle = dos_create(fn, _A_ARCH);
|
||||
dos_write(handle, &opts, sizeof(opts));
|
||||
}
|
||||
dos_write(handle, &mikoconfig_sgm, sizeof(mikoconfig_sgm));
|
||||
dos_write(handle, &debug, sizeof(debug));
|
||||
dos_close(handle);
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
int pascal score_verify(void);
|
||||
|
||||
static const char MIKOConfig[] = RES_ID;
|
||||
static const char LOGO[] =
|
||||
"\n"
|
||||
"\n"
|
||||
"東方封魔録用 常駐プログラム ZUN_RES.com Version1.01 (c)zun 1997\n";
|
||||
static const char ERROR_HISCORE[] =
|
||||
"ハイスコアファイルがおかしいの、もう一度実行してね。\n";
|
||||
static const char ERROR_NOT_RESIDENT[] =
|
||||
"わたし、まだいませんよぉ\n\n";
|
||||
static const char REMOVED[] =
|
||||
"さよなら、また会えたらいいな\n\n";
|
||||
static const char ERROR_UNKNOWN_OPTION[] =
|
||||
"そんなオプション付けられても、困るんですけど\n\n";
|
||||
static const char ERROR_ALREADY_RESIDENT[] =
|
||||
"わたし、すでにいますよぉ\n\n";
|
||||
static const char ERROR_OUT_OF_MEMORY[] =
|
||||
"作れません、わたしの居場所がないの!\n\n";
|
||||
static const char INITIALIZED[] =
|
||||
"それでは、よろしくお願いします\n\n";
|
||||
|
||||
int sgm;
|
||||
const char *res_id = MIKOConfig;
|
||||
int i;
|
||||
char far *mikoconfig;
|
||||
|
||||
sgm = resdata_exist(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
dos_puts2(LOGO);
|
||||
graph_clear();
|
||||
// No, I tried all permutations of command-line switches,
|
||||
// gotos and returns, and no pure C solution seems to work!
|
||||
if(score_verify() == 1) __asm {
|
||||
push offset ds:ERROR_HISCORE
|
||||
jmp error_puts
|
||||
}
|
||||
if(argc == 2) {
|
||||
#define arg1_is(capital, small) \
|
||||
(argv[1][0] == '-' || argv[1][0] == '/') \
|
||||
&& (argv[1][1] == (capital) || argv[1][1] == (small))
|
||||
if(arg1_is('R', 'r')) {
|
||||
if(!sgm) {
|
||||
dos_puts2(ERROR_NOT_RESIDENT);
|
||||
asm jmp error_ret
|
||||
}
|
||||
dos_free(sgm);
|
||||
dos_puts2(REMOVED);
|
||||
return 0;
|
||||
} else if(arg1_is('D', 'd')) {
|
||||
debug = 1;
|
||||
} else {
|
||||
dos_puts2(ERROR_UNKNOWN_OPTION);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(sgm) {
|
||||
dos_puts2(ERROR_ALREADY_RESIDENT);
|
||||
return 1;
|
||||
}
|
||||
sgm = resdata_create(res_id, RES_ID_STRLEN, RES_PARASIZE);
|
||||
if(!sgm) {
|
||||
asm push offset ds:ERROR_OUT_OF_MEMORY
|
||||
error_puts:
|
||||
asm call near ptr dos_puts2
|
||||
error_ret:
|
||||
return 1;
|
||||
}
|
||||
mikoconfig = MK_FP(sgm, 0);
|
||||
dos_puts2(INITIALIZED);
|
||||
for(i = offsetof(resident_t, stage); i < sizeof(resident_t); i++) {
|
||||
mikoconfig[i] = 0;
|
||||
}
|
||||
cfg_write(sgm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma codestring "\x00"
|
||||
|
||||
#pragma option -O- -k-
|
||||
|
||||
extern char rank;
|
||||
score_file_t hi;
|
||||
|
||||
void pascal score_recreate(void);
|
||||
void pascal near score_load(void);
|
||||
|
||||
unsigned char unused_1 = 0;
|
||||
const char *SCORE_FN = "huuhi.dat";
|
||||
unsigned char g_name_first_sum = 0;
|
||||
unsigned char stage_sum = 0;
|
||||
unsigned char unused_2 = 0;
|
||||
long points_sum = 0;
|
||||
long score_sum = 0;
|
||||
|
||||
int pascal score_verify(void)
|
||||
{
|
||||
if(!file_exist(SCORE_FN)) {
|
||||
score_recreate();
|
||||
} else {
|
||||
for(rank = 0; rank < RANK_COUNT; rank++) {
|
||||
register int unused;
|
||||
register int i;
|
||||
|
||||
score_load();
|
||||
_AL = 0;
|
||||
g_name_first_sum = _AL;
|
||||
stage_sum = _AL;
|
||||
_AX = 0;
|
||||
asm {
|
||||
mov word ptr points_sum + 0, ax
|
||||
mov word ptr points_sum + 2, ax
|
||||
mov word ptr score_sum + 0, ax
|
||||
mov word ptr score_sum + 2, ax
|
||||
}
|
||||
for(i = 0; i < sizeof(hi.score); i++) {
|
||||
score_sum += *((unsigned char*)(&hi.score) + i);
|
||||
}
|
||||
for(i = 0; i < SCORE_PLACES; i++) {
|
||||
points_sum += hi.score.points[i];
|
||||
g_name_first_sum += hi.score.g_name[i][0];
|
||||
stage_sum += hi.score.stage[i];
|
||||
}
|
||||
if(
|
||||
points_sum != hi.score.points_sum
|
||||
|| g_name_first_sum != hi.score.g_name_first_sum
|
||||
|| stage_sum != hi.score.stage_sum
|
||||
|| score_sum != hi.score_sum
|
||||
) {
|
||||
goto delete;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
delete:
|
||||
file_delete(SCORE_FN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma codestring "\x90"
|
|
@ -0,0 +1,75 @@
|
|||
/* ReC98
|
||||
* -----
|
||||
* 2nd part of ZUN_RES.COM. Initializes the high score lists.
|
||||
*/
|
||||
|
||||
#include "th02/th02.h"
|
||||
|
||||
extern score_file_t hi;
|
||||
extern const char *SCORE_FN;
|
||||
|
||||
char rank;
|
||||
|
||||
// Slightly differs from the same function in MAINE.EXE!
|
||||
// And seriously, I wasted half a week trying to figure out how to get these
|
||||
// exact same instructions out of the compiler, and it just didn't work.
|
||||
void pascal score_defaults_set(void)
|
||||
{
|
||||
_SI = 0;
|
||||
_DI = 1000 * SCORE_PLACES;
|
||||
goto place_loop;
|
||||
|
||||
place_set:
|
||||
hi.score.cleared = 0;
|
||||
hi.score.points[_SI] = _DI;
|
||||
_DI -= 1000;
|
||||
hi.score.stage[_SI] = 5 - ((int)_SI >> 1);
|
||||
_BX = _SI;
|
||||
asm {
|
||||
imul bx, bx, 7
|
||||
mov cx, 6
|
||||
|
||||
name_loop:
|
||||
mov byte ptr hi.(score_file_t)score.g_name[bx], gs_BULLET
|
||||
inc bx
|
||||
loop name_loop
|
||||
mov byte ptr hi.(score_file_t)score.g_name[bx], 0
|
||||
}
|
||||
_BX = _SI;
|
||||
_BX <<= 2;
|
||||
asm {
|
||||
mov word ptr hi.(score_file_t)score.date[bx].da_year, 1900
|
||||
mov byte ptr hi.(score_file_t)score.date[bx].da_day, 1
|
||||
mov byte ptr hi.(score_file_t)score.date[bx].da_mon, 1
|
||||
mov byte ptr hi.(score_file_t)score.shottype[si], 1
|
||||
inc si
|
||||
|
||||
place_loop:
|
||||
cmp si, SCORE_PLACES
|
||||
jge end
|
||||
jmp place_set
|
||||
}
|
||||
end:
|
||||
}
|
||||
|
||||
#include "th02/scoreenc.c"
|
||||
|
||||
void pascal score_create(void)
|
||||
{
|
||||
HI_SCORE_ENCODE();
|
||||
file_create(SCORE_FN);
|
||||
file_write(&hi, sizeof(hi));
|
||||
file_write(&hi, sizeof(hi));
|
||||
file_write(&hi, sizeof(hi));
|
||||
file_write(&hi, sizeof(hi));
|
||||
file_write(&hi, sizeof(hi));
|
||||
file_close();
|
||||
}
|
||||
|
||||
void pascal score_recreate(void)
|
||||
{
|
||||
score_defaults_set();
|
||||
score_create();
|
||||
}
|
||||
|
||||
#include "th02\scorelod.c"
|
857
th02_zun_res.asm
857
th02_zun_res.asm
|
@ -1,857 +0,0 @@
|
|||
;
|
||||
; +-------------------------------------------------------------------------+
|
||||
; | This file has been generated by The Interactive Disassembler (IDA) |
|
||||
; | Copyright (c) 2009 by Hex-Rays, <support@hex-rays.com> |
|
||||
; +-------------------------------------------------------------------------+
|
||||
;
|
||||
; Input MD5 : 57FF9283F7BC1A6816D6181BBCEC5975
|
||||
|
||||
; File Name : th02/ZUN.COM:ZUN_RES
|
||||
; Format : MS-DOS COM-file
|
||||
; Base Address: 0h Range: 100h-1C66h Loaded length: 1B66h
|
||||
; OS type : MS DOS
|
||||
; Application type: Executable 16bit
|
||||
|
||||
.286 ; Force the .model directive to create 16-bit default segments...
|
||||
.model tiny
|
||||
__TINY__ equ 1
|
||||
.386 ; ... then switch to what we actually need.
|
||||
; And yes, we can't move this to an include file for some reason.
|
||||
|
||||
include ReC98.inc
|
||||
include th02/th02.asm
|
||||
|
||||
; ===========================================================================
|
||||
|
||||
; Segment type: Pure code
|
||||
_TEXT segment word public 'CODE' use16
|
||||
assume cs:_TEXT
|
||||
org 100h
|
||||
assume es:nothing, ss:nothing, ds:_TEXT, fs:nothing, gs:nothing
|
||||
|
||||
include libs/BorlandC/c0.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_367 proc near
|
||||
|
||||
var_6 = byte ptr -6
|
||||
arg_0 = byte ptr 4
|
||||
|
||||
enter 6, 0
|
||||
push si
|
||||
push di
|
||||
mov di, offset aHuuma_cfg ; "huuma.cfg"
|
||||
lea ax, [bp+var_6]
|
||||
push ss
|
||||
push ax
|
||||
push ds
|
||||
push offset unk_183F
|
||||
mov cx, 5
|
||||
call N_SCOPY@
|
||||
push 3D02h
|
||||
push di
|
||||
call dos_axdx
|
||||
mov si, ax
|
||||
or si, si
|
||||
jle short loc_398
|
||||
push ax
|
||||
push 0
|
||||
push 5
|
||||
push 0
|
||||
call dos_seek
|
||||
jmp short loc_3AB
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_398:
|
||||
push di
|
||||
push 20h
|
||||
call dos_create
|
||||
mov si, ax
|
||||
push ax
|
||||
push ss
|
||||
lea ax, [bp+var_6]
|
||||
push ax
|
||||
push 5
|
||||
call dos_write
|
||||
|
||||
loc_3AB:
|
||||
push si
|
||||
push ss
|
||||
lea ax, [bp+arg_0]
|
||||
push ax
|
||||
push 2
|
||||
call dos_write
|
||||
push si
|
||||
push ds
|
||||
push offset byte_183E
|
||||
push 1
|
||||
call dos_write
|
||||
push si
|
||||
call dos_close
|
||||
pop di
|
||||
pop si
|
||||
leave
|
||||
retn
|
||||
sub_367 endp
|
||||
|
||||
|
||||
; =============== 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)
|
||||
_main proc near
|
||||
|
||||
var_8 = dword ptr -8
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
_argc = word ptr 4
|
||||
_argv = word ptr 6
|
||||
_envp = word ptr 8
|
||||
|
||||
enter 8, 0
|
||||
push si
|
||||
push di
|
||||
mov si, [bp+_argv]
|
||||
mov [bp+var_2], offset aMikoconfig ; "MIKOConfig"
|
||||
push [bp+var_2]
|
||||
push 0Ah
|
||||
push 3
|
||||
call resdata_exist
|
||||
mov di, ax
|
||||
push offset aUmx ; "\n\n東方封魔録用 常駐プログラム ZUN_RE"...
|
||||
call dos_puts2
|
||||
call graph_clear
|
||||
call sub_4BA
|
||||
cmp ax, 1
|
||||
jnz short loc_3F9
|
||||
push offset aGngcgxgrgagtg@ ; "ハイスコアファイルがおかしいの、もう一・...
|
||||
jmp loc_47E
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_3F9:
|
||||
cmp [bp+_argc], 2
|
||||
jnz short loc_45F
|
||||
mov bx, [si+2]
|
||||
cmp byte ptr [bx], 2Dh
|
||||
jz short loc_40C
|
||||
cmp byte ptr [bx], 2Fh
|
||||
jnz short loc_434
|
||||
|
||||
loc_40C:
|
||||
mov bx, [si+2]
|
||||
cmp byte ptr [bx+1], 52h
|
||||
jz short loc_41B
|
||||
cmp byte ptr [bx+1], 72h
|
||||
jnz short loc_434
|
||||
|
||||
loc_41B:
|
||||
or di, di
|
||||
jnz short loc_427
|
||||
push offset aVavVBavVVvvVV ; "わたし、まだいませんよぉ\n\n"
|
||||
call dos_puts2
|
||||
jmp short loc_481
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_427:
|
||||
push di
|
||||
call dos_free
|
||||
push offset aVVcvVcbavVIqvj ; "さよなら、また会えたらいいな\n\n"
|
||||
call dos_puts2
|
||||
jmp loc_4B3
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_434:
|
||||
mov bx, [si+2]
|
||||
cmp byte ptr [bx], 2Dh
|
||||
jz short loc_441
|
||||
cmp byte ptr [bx], 2Fh
|
||||
jnz short loc_457
|
||||
|
||||
loc_441:
|
||||
mov bx, [si+2]
|
||||
cmp byte ptr [bx+1], 44h
|
||||
jz short loc_450
|
||||
cmp byte ptr [bx+1], 64h
|
||||
jnz short loc_457
|
||||
|
||||
loc_450:
|
||||
mov byte_183E, 1
|
||||
jmp short loc_45F
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_457:
|
||||
push offset aVV ; "そんなオプション付けられても、困るんで・...
|
||||
call dos_puts2
|
||||
jmp short loc_481
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_45F:
|
||||
or di, di
|
||||
jz short loc_46B
|
||||
push offset aVavVBavVVVvvVV ; "わたし、すでにいますよぉ\n\n"
|
||||
call dos_puts2
|
||||
jmp short loc_481
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_46B:
|
||||
push [bp+var_2]
|
||||
push 0Ah
|
||||
push 3
|
||||
call resdata_create
|
||||
mov di, ax
|
||||
or di, di
|
||||
jnz short loc_486
|
||||
push offset aNVVVV ; "作れません、わたしの居場所がないの!\n\n"
|
||||
|
||||
loc_47E:
|
||||
call dos_puts2
|
||||
|
||||
loc_481:
|
||||
mov ax, 1
|
||||
jmp short loc_4B5
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_486:
|
||||
mov word ptr [bp+var_8+2], di
|
||||
mov word ptr [bp+var_8], 0
|
||||
push offset aVVVVBavcvivVnv ; "それでは、よろしくお願いします\n\n"
|
||||
call dos_puts2
|
||||
mov [bp+var_4], mikoconfig_t.stage
|
||||
jmp short loc_4A8
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_49B:
|
||||
les bx, [bp+var_8]
|
||||
add bx, [bp+var_4]
|
||||
mov byte ptr es:[bx], 0
|
||||
inc [bp+var_4]
|
||||
|
||||
loc_4A8:
|
||||
cmp [bp+var_4], size mikoconfig_t
|
||||
jl short loc_49B
|
||||
push di
|
||||
call sub_367
|
||||
pop cx
|
||||
|
||||
loc_4B3:
|
||||
xor ax, ax
|
||||
|
||||
loc_4B5:
|
||||
pop di
|
||||
pop si
|
||||
leave
|
||||
retn
|
||||
_main endp
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
db 0
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_4BA proc near
|
||||
push si
|
||||
push di
|
||||
push off_19A8
|
||||
call file_exist
|
||||
or ax, ax
|
||||
jnz short loc_4CD
|
||||
call sub_6C1
|
||||
jmp loc_584
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_4CD:
|
||||
mov byte ptr unk_1D1E, 0
|
||||
jmp loc_57A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_4D5:
|
||||
call sub_6CC
|
||||
mov al, 0
|
||||
mov byte_19AA, al
|
||||
mov byte_19AB, al
|
||||
xor ax, ax
|
||||
mov word_19AD, ax
|
||||
mov word_19AF, ax
|
||||
mov word_19B1, ax
|
||||
mov word_19B3, ax
|
||||
xor si, si
|
||||
jmp short loc_502
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_4F2:
|
||||
mov al, [si+1C68h]
|
||||
mov ah, 0
|
||||
add word_19B1, ax
|
||||
adc word_19B3, 0
|
||||
inc si
|
||||
|
||||
loc_502:
|
||||
cmp si, 0B2h
|
||||
jl short loc_4F2
|
||||
xor si, si
|
||||
jmp short loc_537
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_50C:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov dx, word_1C6C[bx]
|
||||
mov ax, word_1C6A[bx]
|
||||
add word_19AD, ax
|
||||
adc word_19AF, dx
|
||||
mov bx, si
|
||||
imul bx, 7
|
||||
mov al, byte_1C96[bx]
|
||||
add byte_19AA, al
|
||||
mov al, byte_1CDD[si]
|
||||
add byte_19AB, al
|
||||
inc si
|
||||
|
||||
loc_537:
|
||||
cmp si, 0Ah
|
||||
jl short loc_50C
|
||||
mov dx, word_19AF
|
||||
mov ax, word_19AD
|
||||
cmp dx, word ptr unk_1C94
|
||||
jnz short loc_574
|
||||
cmp ax, word ptr unk_1C92
|
||||
jnz short loc_574
|
||||
mov al, byte_19AA
|
||||
cmp al, byte ptr unk_1CDC
|
||||
jnz short loc_574
|
||||
mov al, byte_19AB
|
||||
cmp al, byte ptr unk_1CE7
|
||||
jnz short loc_574
|
||||
mov dx, word_19B3
|
||||
mov ax, word_19B1
|
||||
cmp dx, word ptr unk_1D1C
|
||||
jnz short loc_574
|
||||
cmp ax, word ptr unk_1D1A
|
||||
jz short loc_576
|
||||
|
||||
loc_574:
|
||||
jmp short loc_588
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_576:
|
||||
inc byte ptr unk_1D1E
|
||||
|
||||
loc_57A:
|
||||
cmp byte ptr unk_1D1E, 5
|
||||
jge short loc_584
|
||||
jmp loc_4D5
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_584:
|
||||
xor ax, ax
|
||||
jmp short loc_594
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_588:
|
||||
push off_19A8
|
||||
call file_delete
|
||||
mov ax, 1
|
||||
jmp short $+2
|
||||
|
||||
loc_594:
|
||||
pop di
|
||||
pop si
|
||||
retn
|
||||
sub_4BA endp
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
nop
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_598 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
push di
|
||||
xor si, si
|
||||
mov di, 10000
|
||||
jmp short loc_5F9
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_5A4:
|
||||
mov word ptr bdata@, 0
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov word_1C6C[bx], 0
|
||||
mov word_1C6A[bx], di
|
||||
sub di, 1000
|
||||
mov ax, si
|
||||
sar ax, 1
|
||||
mov dl, 5
|
||||
sub dl, al
|
||||
mov byte_1CDD[si], dl
|
||||
mov bx, si
|
||||
imul bx, 7
|
||||
mov cx, 6
|
||||
|
||||
loc_5D1:
|
||||
mov byte_1C96[bx], 0DAh
|
||||
inc bx
|
||||
loop loc_5D1
|
||||
mov byte_1C96[bx], 0
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov word_1CE8[bx], 1900
|
||||
mov byte_1CEA[bx], 1
|
||||
mov byte_1CEB[bx], 1
|
||||
mov byte_1D10[si], 1
|
||||
inc si
|
||||
|
||||
loc_5F9:
|
||||
cmp si, 0Ah
|
||||
jge short loc_600
|
||||
jmp short loc_5A4
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_600:
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
retn
|
||||
sub_598 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_604 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
mov word ptr unk_1C94, 0
|
||||
mov word ptr unk_1C92, 0
|
||||
mov byte ptr unk_1CDC, 0
|
||||
mov byte ptr unk_1CE7, 0
|
||||
mov word ptr unk_1D1C, 0
|
||||
mov word ptr unk_1D1A, 0
|
||||
xor si, si
|
||||
jmp short loc_659
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_62E:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov dx, word_1C6C[bx]
|
||||
mov ax, word_1C6A[bx]
|
||||
add word ptr unk_1C92, ax
|
||||
adc word ptr unk_1C94, dx
|
||||
mov bx, si
|
||||
imul bx, 7
|
||||
mov al, byte_1C96[bx]
|
||||
add byte ptr unk_1CDC, al
|
||||
mov al, byte_1CDD[si]
|
||||
add byte ptr unk_1CE7, al
|
||||
inc si
|
||||
|
||||
loc_659:
|
||||
cmp si, 0Ah
|
||||
jl short loc_62E
|
||||
xor si, si
|
||||
jmp short loc_67C
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_662:
|
||||
mov al, bdata@[si]
|
||||
mov ah, 0
|
||||
add word ptr unk_1D1A, ax
|
||||
adc word ptr unk_1D1C, 0
|
||||
mov al, bdata@[si]
|
||||
add al, 12h
|
||||
mov bdata@[si], al
|
||||
inc si
|
||||
|
||||
loc_67C:
|
||||
cmp si, 0B2h
|
||||
jl short loc_662
|
||||
push off_19A8
|
||||
call file_create
|
||||
push ds
|
||||
push offset bdata@
|
||||
push 0B6h
|
||||
call file_write
|
||||
push ds
|
||||
push offset bdata@
|
||||
push 0B6h
|
||||
call file_write
|
||||
push ds
|
||||
push offset bdata@
|
||||
push 0B6h
|
||||
call file_write
|
||||
push ds
|
||||
push offset bdata@
|
||||
push 0B6h
|
||||
call file_write
|
||||
push ds
|
||||
push offset bdata@
|
||||
push 0B6h
|
||||
call file_write
|
||||
call file_close
|
||||
pop si
|
||||
pop bp
|
||||
retn
|
||||
sub_604 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_6C1 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call sub_598
|
||||
call sub_604
|
||||
pop bp
|
||||
retn
|
||||
sub_6C1 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_6CC proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
push off_19A8
|
||||
call file_ropen
|
||||
mov al, byte ptr unk_1D1E
|
||||
cbw
|
||||
imul ax, 0B6h
|
||||
push 0
|
||||
push ax
|
||||
push 0
|
||||
call file_seek
|
||||
push ds
|
||||
push offset bdata@
|
||||
push 0B6h
|
||||
call file_read
|
||||
xor si, si
|
||||
jmp short loc_700
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6F5:
|
||||
mov al, bdata@[si]
|
||||
add al, 0EEh
|
||||
mov bdata@[si], al
|
||||
inc si
|
||||
|
||||
loc_700:
|
||||
cmp si, 0B2h
|
||||
jl short loc_6F5
|
||||
call file_close
|
||||
pop si
|
||||
pop bp
|
||||
retn
|
||||
sub_6CC endp
|
||||
|
||||
include libs/master.lib/graph_clear.asm
|
||||
include libs/master.lib/resdata.asm
|
||||
include libs/master.lib/file_read.asm
|
||||
include libs/master.lib/file_close.asm
|
||||
include libs/master.lib/file_exist.asm
|
||||
include libs/master.lib/file_ropen.asm
|
||||
include libs/master.lib/file_write.asm
|
||||
include libs/master.lib/file_create.asm
|
||||
include libs/master.lib/file_delete.asm
|
||||
include libs/master.lib/file_seek.asm
|
||||
include libs/master.lib/dos_free.asm
|
||||
include libs/master.lib/dos_axdx.asm
|
||||
include libs/master.lib/dos_create.asm
|
||||
include libs/master.lib/dos_puts2.asm
|
||||
include libs/master.lib/dos_close.asm
|
||||
include libs/master.lib/dos_ropen.asm
|
||||
include libs/master.lib/dos_write.asm
|
||||
include libs/master.lib/dos_seek.asm
|
||||
include libs/BorlandC/_abort.asm
|
||||
include libs/BorlandC/atexit.asm
|
||||
include libs/BorlandC/errormsg.asm
|
||||
include libs/BorlandC/exit.asm
|
||||
include libs/BorlandC/ioerror.asm
|
||||
include libs/BorlandC/_isatty.asm
|
||||
include libs/BorlandC/lseek.asm
|
||||
include libs/BorlandC/n_scopy.asm
|
||||
include libs/BorlandC/setupio.asm
|
||||
include libs/BorlandC/brk.asm
|
||||
include libs/BorlandC/nearheap.asm
|
||||
include libs/BorlandC/pathops.asm
|
||||
include libs/BorlandC/fflush.asm
|
||||
include libs/BorlandC/flushall.asm
|
||||
include libs/BorlandC/fseek.asm
|
||||
include libs/BorlandC/setvbuf.asm
|
||||
include libs/BorlandC/_strlen.asm
|
||||
include libs/BorlandC/write.asm
|
||||
include libs/BorlandC/writea.asm
|
||||
include libs/BorlandC/xfflush.asm
|
||||
include libs/BorlandC/setargv.asm
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
include libs/BorlandC/c0[data].asm
|
||||
|
||||
byte_183E db 0
|
||||
unk_183F db 1
|
||||
db 1
|
||||
db 3
|
||||
db 2
|
||||
db 0
|
||||
aHuuma_cfg db 'huuma.cfg',0
|
||||
aMikoconfig db 'MIKOConfig',0
|
||||
aUmx db 0Ah
|
||||
db 0Ah
|
||||
db '東方封魔録用 常駐プログラム ZUN_RES.com Version1.01 (c)zun 1997',0Ah,0
|
||||
aGngcgxgrgagtg@ db 'ハイスコアファイルがおかしいの、もう一度実行してね。',0Ah,0
|
||||
aVavVBavVVvvVV db 'わたし、まだいませんよぉ',0Ah
|
||||
db 0Ah,0
|
||||
aVVcvVcbavVIqvj db 'さよなら、また会えたらいいな',0Ah
|
||||
db 0Ah,0
|
||||
aVV db 'そんなオプション付けられても、困るんですけど',0Ah
|
||||
db 0Ah,0
|
||||
aVavVBavVVVvvVV db 'わたし、すでにいますよぉ',0Ah
|
||||
db 0Ah,0
|
||||
aNVVVV db '作れません、わたしの居場所がないの!',0Ah
|
||||
db 0Ah,0
|
||||
aVVVVBavcvivVnv db 'それでは、よろしくお願いします',0Ah
|
||||
db 0Ah,0
|
||||
db 0
|
||||
off_19A8 dw offset aHuuhi_dat
|
||||
; "huuhi.dat"
|
||||
byte_19AA db 0
|
||||
byte_19AB db 0
|
||||
db 0
|
||||
word_19AD dw 0
|
||||
word_19AF dw 0
|
||||
word_19B1 dw 0
|
||||
word_19B3 dw 0
|
||||
aHuuhi_dat db 'huuhi.dat',0
|
||||
db 0
|
||||
include libs/master.lib/version[data].asm
|
||||
include libs/master.lib/grp[data].asm
|
||||
include libs/master.lib/resdata[data].asm
|
||||
include libs/master.lib/fil[data].asm
|
||||
include libs/master.lib/dos_ropen[data].asm
|
||||
include libs/BorlandC/_abort[data].asm
|
||||
include libs/BorlandC/atexit[data].asm
|
||||
include libs/BorlandC/exit[data].asm
|
||||
include libs/BorlandC/files[data].asm
|
||||
__heaplen dw 0
|
||||
include libs/BorlandC/ioerror[data].asm
|
||||
include libs/BorlandC/stklen[data].asm
|
||||
include libs/BorlandC/nearheap[data].asm
|
||||
include libs/BorlandC/pathops[data].asm
|
||||
include libs/BorlandC/setvbuf[data].asm
|
||||
include libs/BorlandC/sysnerr[data].asm
|
||||
include libs/BorlandC/setargv[data].asm
|
||||
|
||||
InitStart label byte
|
||||
include libs/BorlandC/setupio[initdata].asm
|
||||
include libs/BorlandC/pathops[initdata].asm
|
||||
include libs/BorlandC/setargv[initdata].asm
|
||||
InitEnd label byte
|
||||
|
||||
ExitStart label byte
|
||||
ExitEnd label byte
|
||||
|
||||
bdata@ label byte
|
||||
db ?
|
||||
db ? ;
|
||||
word_1C6A dw ?
|
||||
word_1C6C dw ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
unk_1C92 db ? ;
|
||||
db ? ;
|
||||
unk_1C94 db ? ;
|
||||
db ? ;
|
||||
byte_1C96 db ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
unk_1CDC db ? ;
|
||||
byte_1CDD db ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
unk_1CE7 db ? ;
|
||||
word_1CE8 dw ?
|
||||
byte_1CEA db ?
|
||||
byte_1CEB db ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
byte_1D10 db ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
db ? ;
|
||||
unk_1D1A db ? ;
|
||||
db ? ;
|
||||
unk_1D1C db ? ;
|
||||
db ? ;
|
||||
unk_1D1E db ? ;
|
||||
db ? ;
|
||||
include libs/master.lib/fil[bss].asm
|
||||
include libs/BorlandC/atexit[bss].asm
|
||||
edata@ label byte
|
||||
_TEXT ends
|
||||
|
||||
|
||||
end startx
|
Loading…
Reference in New Issue