mirror of https://github.com/nmlgc/ReC98.git
[C decompilation] ZUNSOFT.COM, all of it
And, of course, it recompiles into the exact binary ZUN shipped in 1997. Success! This project is so going to happen now.
This commit is contained in:
parent
cc219ff2b4
commit
f861b0a5c3
14
build16b.bat
14
build16b.bat
|
@ -4,13 +4,20 @@ echo If this fails or shows other weird behavior, run BUILD16B separately in DOS
|
|||
REM (Yes, we don't use %0%, as it actually has to be %0 on DOS. Just spelling
|
||||
REM out the name saves us that trouble.)
|
||||
|
||||
set ReC98_CFLAGS=-Ilibs\master.lib\
|
||||
set ReC98_LFLAGS=-Lbin\
|
||||
set ReC98_LINK=tlink
|
||||
|
||||
%ReC98_LINK% 1>NUL 2>NUL
|
||||
if errorlevel 9009 goto no_tlink
|
||||
if errorlevel 216 goto 64_bit
|
||||
|
||||
%ReC98_LINK% /t bin\th01\zunsoft.obj
|
||||
tcc 1>NUL 2>NUL
|
||||
if errorlevel 9009 goto no_tcc
|
||||
if errorlevel 216 goto 64_bit
|
||||
|
||||
tcc -lt -mt %ReC98_CFLAGS% %ReC98_LFLAGS% -O -a2 -nbin\th01\ th01\zunsoft.c masters.lib
|
||||
|
||||
%ReC98_LINK% bin\th01\op.obj
|
||||
%ReC98_LINK% bin\th01\reiiden.obj
|
||||
%ReC98_LINK% bin\th01\fuuin.obj
|
||||
|
@ -39,8 +46,13 @@ goto eof
|
|||
echo You're running a 64-bit OS. Run BUILD16B.BAT separately in DOSBox instead.
|
||||
goto eof
|
||||
|
||||
:no_tcc
|
||||
echo Could not find TCC.
|
||||
goto tc4j_bin
|
||||
:no_tlink
|
||||
echo Could not find TLINK.
|
||||
goto tc4j_bin
|
||||
:tc4j_bin
|
||||
echo Please make sure that the BIN directory of Turbo C++ 4.0J is in your PATH.
|
||||
goto eof
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ for /L %%i in (1,1,5) do mkdir bin\th0%%i 2>NUL
|
|||
%ReC98_ASM% 1>NUL 2>NUL
|
||||
if errorlevel 9009 goto no_tasm32
|
||||
|
||||
%ReC98_ASM% th01_zunsoft.asm bin\th01\zunsoft.obj
|
||||
%ReC98_ASM% th01_op.asm bin\th01\op.obj
|
||||
%ReC98_ASM% th01_reiiden.asm bin\th01\reiiden.obj
|
||||
%ReC98_ASM% th01_fuuin.asm bin\th01\fuuin.obj
|
||||
|
|
|
@ -0,0 +1,254 @@
|
|||
/* ReC98
|
||||
* -----
|
||||
* ZUN Soft logo used in TH01, TH02 and TH03
|
||||
*/
|
||||
|
||||
#include <master.h>
|
||||
|
||||
#define CIRCLE_COUNT 4
|
||||
#define STAR_COUNT 50
|
||||
|
||||
const char LOGO_FILENAME[] = "touhou.dat";
|
||||
static char CIRCLE_COLORS[] = {4, 3, 2, 1};
|
||||
|
||||
char page_write;
|
||||
char page_show;
|
||||
char tone;
|
||||
char logo_num;
|
||||
char wave_len;
|
||||
char wave_phase;
|
||||
char wave_amp;
|
||||
Point circle_pos[CIRCLE_COUNT];
|
||||
Point star_pos[STAR_COUNT];
|
||||
int frame;
|
||||
int circle_speed_x[CIRCLE_COUNT];
|
||||
int circle_speed_y[CIRCLE_COUNT];
|
||||
char star_angle;
|
||||
unsigned char star_speed[STAR_COUNT];
|
||||
|
||||
void graph_clear_both(void)
|
||||
{
|
||||
graph_accesspage(1);
|
||||
graph_clear();
|
||||
graph_accesspage(0);
|
||||
graph_clear();
|
||||
graph_showpage(0);
|
||||
}
|
||||
|
||||
void zunsoft_init(void)
|
||||
{
|
||||
mem_assign_all();
|
||||
graph_start();
|
||||
key_beep_off();
|
||||
text_systemline_hide();
|
||||
text_cursor_hide();
|
||||
egc_start();
|
||||
graph_clear_both();
|
||||
text_clear();
|
||||
page_write = 0;
|
||||
page_show = 1;
|
||||
grc_setclip(96, 100, 543, 299);
|
||||
graph_hide();
|
||||
super_entry_bfnt(LOGO_FILENAME);
|
||||
palette_show();
|
||||
palette_black();
|
||||
graph_show();
|
||||
}
|
||||
|
||||
void zunsoft_exit(void)
|
||||
{
|
||||
super_free();
|
||||
graph_clear_both();
|
||||
mem_unassign();
|
||||
text_clear();
|
||||
egc_start();
|
||||
}
|
||||
|
||||
void pascal cossin_times(int *cos, int *sin, unsigned char angle, int x)
|
||||
{
|
||||
*cos = (x * (long)Cos8(angle)) >> 8;
|
||||
*sin = (x * (long)Sin8(angle)) >> 8;
|
||||
}
|
||||
|
||||
void objects_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
circle_pos[0].x = 128; circle_speed_x[0] = -8;
|
||||
circle_pos[0].y = 320; circle_speed_y[0] = 8;
|
||||
|
||||
circle_pos[1].x = 256; circle_speed_x[1] = -8;
|
||||
circle_pos[1].y = 240; circle_speed_y[1] = 8;
|
||||
|
||||
circle_pos[2].x = 384; circle_speed_x[2] = -8;
|
||||
circle_pos[2].y = 160; circle_speed_y[2] = 8;
|
||||
|
||||
circle_pos[3].x = 512; circle_speed_x[3] = -8;
|
||||
circle_pos[3].y = 80; circle_speed_y[3] = 8;
|
||||
|
||||
frame = 0;
|
||||
tone = 0;
|
||||
logo_num = 0;
|
||||
wave_len = 23;
|
||||
wave_phase = 0;
|
||||
wave_amp = 0;
|
||||
|
||||
for(i = 0; i < STAR_COUNT; i++) {
|
||||
star_pos[i].x = rand() % 640;
|
||||
star_pos[i].y = rand() % 400;
|
||||
star_speed[i] = (rand() % 32) + 6;
|
||||
}
|
||||
star_angle = 64;
|
||||
}
|
||||
|
||||
void circles_render_and_update(void)
|
||||
{
|
||||
int i = CIRCLE_COUNT - 1;
|
||||
while(i >= 0) {
|
||||
grcg_setcolor(GC_RMW, CIRCLE_COLORS[i]);
|
||||
grcg_circlefill(circle_pos[i].x, circle_pos[i].y, 96);
|
||||
|
||||
circle_pos[i].x += circle_speed_x[i];
|
||||
circle_pos[i].y += circle_speed_y[i];
|
||||
if(circle_pos[i].x <= 32 || circle_pos[i].x > 607) {
|
||||
circle_speed_x[i] *= -1;
|
||||
}
|
||||
if(circle_pos[i].y <= 32 || circle_pos[i].y > 367) {
|
||||
circle_speed_y[i] *= -1;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
grcg_off();
|
||||
}
|
||||
|
||||
void stars_render_and_update(void)
|
||||
{
|
||||
int i;
|
||||
grcg_setcolor(GC_RMW, 5);
|
||||
for(i = 0; i < STAR_COUNT; i++) {
|
||||
int cos, sin;
|
||||
|
||||
grcg_pset(star_pos[i].x, star_pos[i].y);
|
||||
|
||||
cossin_times(&cos, &sin, star_angle, star_speed[i]);
|
||||
star_pos[i].x += cos;
|
||||
star_pos[i].y += sin;
|
||||
if(star_pos[i].x < 0) {
|
||||
star_pos[i].x += 640;
|
||||
} else if(star_pos[i].x >= 640) {
|
||||
star_pos[i].x -= 640;
|
||||
}
|
||||
if(star_pos[i].y < 0) {
|
||||
star_pos[i].y += 400;
|
||||
} else if(star_pos[i].y >= 400) {
|
||||
star_pos[i].y -= 400;
|
||||
}
|
||||
}
|
||||
star_angle++;
|
||||
grcg_off();
|
||||
}
|
||||
|
||||
void wait(void)
|
||||
{
|
||||
do {
|
||||
__asm out 0x5F, al
|
||||
__asm in al, 0xA0
|
||||
} while((_AL & 0x20) != 0);
|
||||
do {
|
||||
__asm out 0x5F, al
|
||||
__asm in al, 0xA0
|
||||
} while((_AL & 0x20) == 0);
|
||||
}
|
||||
|
||||
void logo_render_and_update(void)
|
||||
{
|
||||
if(frame < 50) {
|
||||
return;
|
||||
}
|
||||
if(frame < 90) {
|
||||
if(frame == 55 || frame == 60 || frame == 65) {
|
||||
logo_num += 2;
|
||||
}
|
||||
super_put_8(256, 192, logo_num+0);
|
||||
super_put_8(320, 192, logo_num+1);
|
||||
} else if(frame < 110) {
|
||||
super_wave_put(256, 192, logo_num+0, wave_len, wave_amp, wave_phase);
|
||||
super_wave_put(320, 192, logo_num+1, wave_len, wave_amp, wave_phase);
|
||||
wave_len--;
|
||||
wave_phase += 4;
|
||||
wave_amp += 4;
|
||||
} else if(frame < 130) {
|
||||
if(frame == 110) {
|
||||
logo_num += 2;
|
||||
}
|
||||
super_wave_put(256, 192, logo_num+0, wave_len, wave_amp, wave_phase);
|
||||
super_wave_put(320, 192, logo_num+1, wave_len, wave_amp, wave_phase);
|
||||
wave_len++;
|
||||
wave_phase += 4;
|
||||
wave_amp -= 4;
|
||||
} else if(frame < 170) {
|
||||
if(frame == 155 || frame == 160 || frame == 165) {
|
||||
logo_num += 2;
|
||||
}
|
||||
super_put_8(256, 192, logo_num+0);
|
||||
super_put_8(320, 192, logo_num+1);
|
||||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int keygroup, quit;
|
||||
// Do some setup if we are running on a PC-9821
|
||||
__asm {
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
test byte ptr es:0x45C, 0x40
|
||||
jz hw_setup_done
|
||||
mov al, 0x7
|
||||
out 0x6a, al
|
||||
mov al, 0x20
|
||||
out 0x6a, al
|
||||
mov al, 0x6
|
||||
out 0x6a, al
|
||||
// Activate all graphics hardware in 16-color mode
|
||||
and byte ptr es:0x54d, 0x7f
|
||||
hw_setup_done:
|
||||
}
|
||||
zunsoft_init();
|
||||
objects_setup();
|
||||
while(1) {
|
||||
if(frame > 180) {
|
||||
if(tone <= 0) {
|
||||
break;
|
||||
}
|
||||
palette_settone(tone -= 2);
|
||||
} else if(tone < 100) {
|
||||
palette_settone(tone += 2);
|
||||
}
|
||||
|
||||
grcg_setcolor(GC_RMW, 0);
|
||||
grcg_byteboxfill_x(12, 100, 67, 299);
|
||||
stars_render_and_update();
|
||||
circles_render_and_update();
|
||||
logo_render_and_update();
|
||||
wait();
|
||||
wait();
|
||||
__asm {
|
||||
mov al, page_write
|
||||
mov page_show, al
|
||||
out 0xa4, al
|
||||
xor page_write, 1
|
||||
mov al, page_write
|
||||
out 0xa6, al
|
||||
}
|
||||
quit = 0;
|
||||
for(keygroup = 0; keygroup < 8; keygroup++) {
|
||||
quit |= key_sense(keygroup);
|
||||
}
|
||||
if(quit) {
|
||||
break;
|
||||
}
|
||||
frame++;
|
||||
};
|
||||
zunsoft_exit();
|
||||
}
|
835
th01_zunsoft.asm
835
th01_zunsoft.asm
|
@ -1,835 +0,0 @@
|
|||
;
|
||||
; +-------------------------------------------------------------------------+
|
||||
; | This file has been generated by The Interactive Disassembler (IDA) |
|
||||
; | Copyright (c) 2009 by Hex-Rays, <support@hex-rays.com> |
|
||||
; +-------------------------------------------------------------------------+
|
||||
;
|
||||
; Input MD5 : DE5454973591EBD937B11452A8B4882D
|
||||
|
||||
; File Name : th01/ZUNSOFT.COM
|
||||
; Format : MS-DOS COM-file
|
||||
; Base Address: 0h Range: 100h-2870h Loaded length: 2770h
|
||||
; 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 th01/th01.asm
|
||||
|
||||
CIRCLE_COUNT = 4
|
||||
STAR_COUNT = 50
|
||||
|
||||
; ===========================================================================
|
||||
|
||||
; Segment type: Pure code
|
||||
_TEXT segment word public 'CODE' use16
|
||||
assume cs:_TEXT
|
||||
org 100h
|
||||
assume es:nothing, ss:_TEXT, 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
|
||||
push bp
|
||||
mov bp, sp
|
||||
mov dx, 0A6h
|
||||
mov al, 1
|
||||
out dx, al
|
||||
call graph_clear
|
||||
mov dx, 0A6h
|
||||
mov al, 0
|
||||
out dx, al
|
||||
call graph_clear
|
||||
mov dx, 0A4h
|
||||
mov al, 0
|
||||
out dx, al
|
||||
pop bp
|
||||
retn
|
||||
sub_367 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_384 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call mem_assign_all
|
||||
call graph_start
|
||||
call key_beep_off
|
||||
call text_systemline_hide
|
||||
call text_cursor_hide
|
||||
call egc_start
|
||||
call sub_367
|
||||
call text_clear
|
||||
mov page_write, 0
|
||||
mov page_show, 1
|
||||
call grc_setclip pascal, 96, 100, 543, 299
|
||||
call graph_hide
|
||||
call super_entry_bfnt pascal, offset aTouhou_dat
|
||||
call palette_show
|
||||
mov PaletteTone, 0
|
||||
call palette_show
|
||||
call graph_show
|
||||
pop bp
|
||||
retn
|
||||
sub_384 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_3D0 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call super_free
|
||||
call sub_367
|
||||
call mem_unassign
|
||||
call text_clear
|
||||
call egc_start
|
||||
pop bp
|
||||
retn
|
||||
sub_3D0 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_3E4 proc near
|
||||
|
||||
arg_0 = word ptr 4
|
||||
arg_2 = byte ptr 6
|
||||
arg_4 = word ptr 8
|
||||
arg_6 = word ptr 0Ah
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
push di
|
||||
mov si, [bp+arg_6]
|
||||
mov di, [bp+arg_4]
|
||||
mov ax, [bp+arg_0]
|
||||
cwd
|
||||
mov bl, [bp+arg_2]
|
||||
mov bh, 0
|
||||
and bx, 0FFh
|
||||
add bx, bx
|
||||
push ax
|
||||
mov ax, _CosTable8[bx]
|
||||
push dx
|
||||
cwd
|
||||
pop cx
|
||||
pop bx
|
||||
call N_LXMUL@
|
||||
mov cl, 8
|
||||
call N_LXRSH@
|
||||
mov [si], ax
|
||||
mov ax, [bp+arg_0]
|
||||
cwd
|
||||
mov bl, [bp+arg_2]
|
||||
mov bh, 0
|
||||
and bx, 0FFh
|
||||
add bx, bx
|
||||
push ax
|
||||
mov ax, _SinTable8[bx]
|
||||
push dx
|
||||
cwd
|
||||
pop cx
|
||||
pop bx
|
||||
call N_LXMUL@
|
||||
mov cl, 8
|
||||
call N_LXRSH@
|
||||
mov [di], ax
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
retn 8
|
||||
sub_3E4 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_439 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
mov (circle_pos[0 * size Point]).x, 128
|
||||
mov circle_speed_x[0*2], -8
|
||||
mov (circle_pos[0 * size Point]).y, 320
|
||||
mov circle_speed_y[0*2], 8
|
||||
mov (circle_pos[1 * size Point]).x, 256
|
||||
mov circle_speed_x[1*2], -8
|
||||
mov (circle_pos[1 * size Point]).y, 240
|
||||
mov circle_speed_y[1*2], 8
|
||||
mov (circle_pos[2 * size Point]).x, 384
|
||||
mov circle_speed_x[2*2], -8
|
||||
mov (circle_pos[2 * size Point]).y, 160
|
||||
mov circle_speed_y[2*2], 8
|
||||
mov (circle_pos[3 * size Point]).x, 512
|
||||
mov circle_speed_x[3*2], -8
|
||||
mov (circle_pos[3 * size Point]).y, 80
|
||||
mov circle_speed_y[3*2], 8
|
||||
mov frame, 0
|
||||
mov tone, 0
|
||||
mov logo_num, 0
|
||||
mov wave_len, 23
|
||||
mov wave_phase, 0
|
||||
mov byte ptr wave_amp, 0
|
||||
xor si, si
|
||||
jmp short loc_4F5
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_4C0:
|
||||
call IRand
|
||||
mov bx, 640
|
||||
cwd
|
||||
idiv bx
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov star_pos[bx].x, dx
|
||||
call IRand
|
||||
mov bx, 400
|
||||
cwd
|
||||
idiv bx
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov star_pos[bx].y, dx
|
||||
call IRand
|
||||
mov bx, 32
|
||||
cwd
|
||||
idiv bx
|
||||
add dl, 6
|
||||
mov star_speed[si], dl
|
||||
inc si
|
||||
|
||||
loc_4F5:
|
||||
cmp si, STAR_COUNT
|
||||
jl short loc_4C0
|
||||
mov star_angle, 64
|
||||
pop si
|
||||
|
||||
loc_500:
|
||||
pop bp
|
||||
retn
|
||||
sub_439 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_502 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
mov si, CIRCLE_COUNT - 1
|
||||
jmp loc_5A6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_50C:
|
||||
push GC_RMW
|
||||
mov al, CIRCLE_COLORS[si]
|
||||
cbw
|
||||
push ax
|
||||
call grcg_setcolor
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
push circle_pos[bx].x
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
push circle_pos[bx].y
|
||||
push 96
|
||||
call grcg_circlefill
|
||||
mov bx, si
|
||||
add bx, bx
|
||||
mov ax, circle_speed_x[bx]
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
add circle_pos[bx].x, ax
|
||||
mov bx, si
|
||||
add bx, bx
|
||||
mov ax, circle_speed_y[bx]
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
add circle_pos[bx].y, ax
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp circle_pos[bx].x, 32
|
||||
jle short loc_56A
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp circle_pos[bx].x, 607
|
||||
jle short loc_57B
|
||||
|
||||
loc_56A:
|
||||
mov bx, si
|
||||
add bx, bx
|
||||
mov dx, -1
|
||||
mov ax, circle_speed_x[bx]
|
||||
imul dx
|
||||
mov circle_speed_x[bx], ax
|
||||
|
||||
loc_57B:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp circle_pos[bx].y, 32
|
||||
jle short loc_594
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp circle_pos[bx].y, 367
|
||||
jle short loc_5A5
|
||||
|
||||
loc_594:
|
||||
mov bx, si
|
||||
add bx, bx
|
||||
mov dx, -1
|
||||
mov ax, circle_speed_y[bx]
|
||||
imul dx
|
||||
mov circle_speed_y[bx], ax
|
||||
|
||||
loc_5A5:
|
||||
dec si
|
||||
|
||||
loc_5A6:
|
||||
or si, si
|
||||
jl short loc_5AD
|
||||
jmp loc_50C
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_5AD:
|
||||
mov dx, 7Ch
|
||||
mov al, GC_OFF
|
||||
out dx, al
|
||||
pop si
|
||||
pop bp
|
||||
retn
|
||||
sub_502 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_5B6 proc near
|
||||
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
|
||||
enter 4, 0
|
||||
push si
|
||||
call grcg_setcolor pascal, GC_RMW, 5
|
||||
xor si, si
|
||||
jmp loc_66E
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_5C8:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
push star_pos[bx].x
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
push star_pos[bx].y
|
||||
call grcg_pset
|
||||
lea ax, [bp+var_2]
|
||||
push ax
|
||||
lea ax, [bp+var_4]
|
||||
push ax
|
||||
push word ptr star_angle
|
||||
mov al, star_speed[si]
|
||||
mov ah, 0
|
||||
push ax
|
||||
call sub_3E4
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov ax, [bp+var_2]
|
||||
add star_pos[bx].x, ax
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
mov ax, [bp+var_4]
|
||||
add star_pos[bx].y, ax
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp star_pos[bx].x, 0
|
||||
jge short loc_624
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
add star_pos[bx].x, 640
|
||||
jmp short loc_63C
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_624:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp star_pos[bx].x, 640
|
||||
jl short loc_63C
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
sub star_pos[bx].x, 640
|
||||
|
||||
loc_63C:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp star_pos[bx].y, 0
|
||||
jge short loc_655
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
add star_pos[bx].y, 400
|
||||
jmp short loc_66D
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_655:
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
cmp star_pos[bx].y, 400
|
||||
jl short loc_66D
|
||||
mov bx, si
|
||||
shl bx, 2
|
||||
sub star_pos[bx].y, 400
|
||||
|
||||
loc_66D:
|
||||
inc si
|
||||
|
||||
loc_66E:
|
||||
cmp si, STAR_COUNT
|
||||
jge short loc_676
|
||||
jmp loc_5C8
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_676:
|
||||
inc star_angle
|
||||
mov dx, 7Ch
|
||||
mov al, GC_OFF
|
||||
out dx, al
|
||||
pop si
|
||||
leave
|
||||
retn
|
||||
sub_5B6 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_683 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
loc_686:
|
||||
out 5Fh, al
|
||||
in al, 0A0h ; PIC 2 same as 0020 for PIC 1
|
||||
test al, 20h
|
||||
jnz short loc_686
|
||||
|
||||
loc_68E:
|
||||
out 5Fh, al
|
||||
in al, 0A0h ; PIC 2 same as 0020 for PIC 1
|
||||
test al, 20h
|
||||
jz short loc_68E
|
||||
pop bp
|
||||
retn
|
||||
sub_683 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_698 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
cmp frame, 50
|
||||
jge short loc_6A5
|
||||
jmp loc_7CB
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6A5:
|
||||
cmp frame, 90
|
||||
jge short loc_6CD
|
||||
cmp frame, 55
|
||||
jnz short loc_6B6
|
||||
jmp loc_7A6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6B6:
|
||||
cmp frame, 60
|
||||
jnz short loc_6C0
|
||||
jmp loc_7A6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6C0:
|
||||
cmp frame, 65
|
||||
jz short loc_6CA
|
||||
jmp loc_7AE
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6CA:
|
||||
jmp loc_7A6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_6CD:
|
||||
cmp frame, 110
|
||||
jge short loc_720
|
||||
push 256
|
||||
push 192
|
||||
mov al, logo_num
|
||||
cbw
|
||||
push ax
|
||||
mov al, wave_len
|
||||
cbw
|
||||
push ax
|
||||
push wave_amp
|
||||
mov al, wave_phase
|
||||
cbw
|
||||
push ax
|
||||
call super_wave_put
|
||||
push 320
|
||||
push 192
|
||||
mov al, logo_num
|
||||
cbw
|
||||
inc ax
|
||||
push ax
|
||||
mov al, wave_len
|
||||
cbw
|
||||
push ax
|
||||
push wave_amp
|
||||
mov al, wave_phase
|
||||
cbw
|
||||
push ax
|
||||
call super_wave_put
|
||||
dec wave_len
|
||||
|
||||
loc_711:
|
||||
mov al, wave_phase
|
||||
add al, 4
|
||||
mov wave_phase, al
|
||||
mov al, byte ptr wave_amp
|
||||
add al, 4
|
||||
jmp short loc_781
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_720:
|
||||
cmp frame, 130
|
||||
jge short loc_786
|
||||
cmp frame, 110
|
||||
jnz short loc_737
|
||||
mov al, logo_num
|
||||
add al, 2
|
||||
mov logo_num, al
|
||||
|
||||
loc_737:
|
||||
push 256
|
||||
push 192
|
||||
mov al, logo_num
|
||||
cbw
|
||||
push ax
|
||||
mov al, wave_len
|
||||
cbw
|
||||
push ax
|
||||
push wave_amp
|
||||
mov al, wave_phase
|
||||
cbw
|
||||
push ax
|
||||
call super_wave_put
|
||||
push 320
|
||||
push 192
|
||||
mov al, logo_num
|
||||
cbw
|
||||
inc ax
|
||||
push ax
|
||||
mov al, wave_len
|
||||
cbw
|
||||
push ax
|
||||
push wave_amp
|
||||
mov al, wave_phase
|
||||
cbw
|
||||
push ax
|
||||
call super_wave_put
|
||||
inc wave_len
|
||||
mov al, wave_phase
|
||||
add al, 4
|
||||
mov wave_phase, al
|
||||
mov al, byte ptr wave_amp
|
||||
add al, -4
|
||||
|
||||
loc_781:
|
||||
mov byte ptr wave_amp, al
|
||||
pop bp
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_786:
|
||||
cmp frame, 170
|
||||
jge short loc_7CB
|
||||
cmp frame, 155
|
||||
jz short loc_7A6
|
||||
cmp frame, 160
|
||||
jz short loc_7A6
|
||||
cmp frame, 165
|
||||
jnz short loc_7AE
|
||||
|
||||
loc_7A6:
|
||||
mov al, logo_num
|
||||
add al, 2
|
||||
mov logo_num, al
|
||||
|
||||
loc_7AE:
|
||||
push 256
|
||||
push 192
|
||||
mov al, logo_num
|
||||
cbw
|
||||
push ax
|
||||
call super_put_8
|
||||
push 320
|
||||
push 192
|
||||
mov al, logo_num
|
||||
cbw
|
||||
inc ax
|
||||
push ax
|
||||
call super_put_8
|
||||
|
||||
loc_7CB:
|
||||
pop bp
|
||||
retn
|
||||
sub_698 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
|
||||
|
||||
_argc = word ptr 4
|
||||
_argv = word ptr 6
|
||||
_envp = word ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
push di
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
test byte ptr es:[045Ch], 40h
|
||||
jz short loc_7F0
|
||||
mov al, 7
|
||||
out 6Ah, al ; PC-98 GDC (6a):
|
||||
;
|
||||
mov al, 20h
|
||||
out 6Ah, al ; PC-98 GDC (6a):
|
||||
;
|
||||
mov al, 6
|
||||
out 6Ah, al ; PC-98 GDC (6a):
|
||||
;
|
||||
and byte ptr es:[54Dh], 7Fh
|
||||
|
||||
loc_7F0:
|
||||
call sub_384
|
||||
call sub_439
|
||||
|
||||
loc_7F6:
|
||||
cmp frame, 180
|
||||
jle short loc_80C
|
||||
cmp tone, 0
|
||||
jle short loc_873
|
||||
mov al, tone
|
||||
add al, -2
|
||||
jmp short loc_818
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_80C:
|
||||
cmp tone, 100
|
||||
jge short loc_822
|
||||
mov al, tone
|
||||
add al, 2
|
||||
|
||||
loc_818:
|
||||
mov tone, al
|
||||
cbw
|
||||
mov PaletteTone, ax
|
||||
call palette_show
|
||||
|
||||
loc_822:
|
||||
call grcg_setcolor pascal, GC_RMW, 0
|
||||
call grcg_byteboxfill_x pascal, 12, 100, 67, 299
|
||||
call sub_5B6
|
||||
call sub_502
|
||||
call sub_698
|
||||
call sub_683
|
||||
call sub_683
|
||||
mov al, page_write
|
||||
mov page_show, al
|
||||
out 0A4h, al
|
||||
xor page_write, 1
|
||||
mov al, page_write
|
||||
out 0A6h, al
|
||||
xor di, di
|
||||
xor si, si
|
||||
jmp short loc_864
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_85D:
|
||||
push si
|
||||
call key_sense
|
||||
or di, ax
|
||||
inc si
|
||||
|
||||
loc_864:
|
||||
cmp si, 8
|
||||
jl short loc_85D
|
||||
or di, di
|
||||
jnz short loc_873
|
||||
inc frame
|
||||
jmp short loc_7F6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_873:
|
||||
call sub_3D0
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
retn
|
||||
_main endp
|
||||
|
||||
include libs/master.lib/text_clear.asm
|
||||
include libs/master.lib/txesc.asm
|
||||
include libs/master.lib/graph_400line.asm
|
||||
include libs/master.lib/graph_clear.asm
|
||||
include libs/master.lib/graph_hide.asm
|
||||
include libs/master.lib/graph_show.asm
|
||||
include libs/master.lib/graph_start.asm
|
||||
include libs/master.lib/palette_show.asm
|
||||
include libs/master.lib/palette_init.asm
|
||||
include libs/master.lib/keybeep.asm
|
||||
include libs/master.lib/key_sense.asm
|
||||
include libs/master.lib/bfnt_header_read.asm
|
||||
include libs/master.lib/bfnt_entry_pat.asm
|
||||
include libs/master.lib/bfnt_header_analysis.asm
|
||||
include libs/master.lib/bfnt_palette_set.asm
|
||||
include libs/master.lib/dos_close.asm
|
||||
include libs/master.lib/dos_ropen.asm
|
||||
include libs/master.lib/super_entry_bfnt.asm
|
||||
include libs/master.lib/super_cancel_pat.asm
|
||||
include libs/master.lib/super_entry_pat.asm
|
||||
include libs/master.lib/super_put_8.asm
|
||||
include libs/master.lib/super_free.asm
|
||||
include libs/master.lib/super_entry_at.asm
|
||||
include libs/master.lib/super_wave_put.asm
|
||||
include libs/master.lib/smem_wget.asm
|
||||
include libs/master.lib/smem_release.asm
|
||||
include libs/master.lib/memheap.asm
|
||||
include libs/master.lib/mem_assign.asm
|
||||
include libs/master.lib/mem_unassign.asm
|
||||
include libs/master.lib/grc_setclip.asm
|
||||
include libs/master.lib/grcg_hline.asm
|
||||
include libs/master.lib/grcg_setcolor.asm
|
||||
include libs/master.lib/grcg_pset.asm
|
||||
include libs/master.lib/egc.asm
|
||||
include libs/master.lib/grcg_circlefill.asm
|
||||
include libs/master.lib/grcg_byteboxfill_x.asm
|
||||
include libs/master.lib/random.asm
|
||||
include libs/BorlandC/_abort.asm
|
||||
include libs/BorlandC/atexit.asm
|
||||
include libs/BorlandC/errormsg.asm
|
||||
include libs/BorlandC/exit.asm
|
||||
include libs/BorlandC/H_LRSH.ASM
|
||||
include libs/BorlandC/ioerror.asm
|
||||
include libs/BorlandC/_isatty.asm
|
||||
include libs/BorlandC/lseek.asm
|
||||
include libs/BorlandC/N_LXMUL.ASM
|
||||
include libs/BorlandC/setupio.asm
|
||||
include libs/BorlandC/brk.asm
|
||||
include libs/BorlandC/nearheap.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
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
db 0
|
||||
db 0
|
||||
db 0
|
||||
include libs/BorlandC/c0[data].asm
|
||||
aTOUHOU_DAT db 'touhou.dat',0
|
||||
CIRCLE_COLORS db 4, 3, 2, 1, 0
|
||||
include libs/master.lib/version[data].asm
|
||||
include libs/master.lib/grp[data].asm
|
||||
include libs/master.lib/pal[data].asm
|
||||
include libs/master.lib/bfnt_id[data].asm
|
||||
include libs/master.lib/dos_ropen[data].asm
|
||||
include libs/master.lib/super_entry_bfnt[data].asm
|
||||
include libs/master.lib/superpa[data].asm
|
||||
include libs/master.lib/mem[data].asm
|
||||
include libs/master.lib/clip[data].asm
|
||||
include libs/master.lib/edges[data].asm
|
||||
include libs/master.lib/sin8[data].asm
|
||||
include libs/master.lib/sin7[data].asm
|
||||
include libs/master.lib/rand[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/setvbuf[data].asm
|
||||
include libs/BorlandC/sysnerr[data].asm
|
||||
|
||||
InitStart label byte
|
||||
include libs/BorlandC/setupio[initdata].asm
|
||||
InitEnd label byte
|
||||
|
||||
ExitStart label byte
|
||||
ExitEnd label byte
|
||||
|
||||
bdata@ label byte
|
||||
; TODO: Missing clip[bss].asm (8 bytes) somewhere in there...
|
||||
page_write db ?
|
||||
page_show db ?
|
||||
tone db ?
|
||||
logo_num db ?
|
||||
wave_len db ?
|
||||
wave_phase db ?
|
||||
wave_amp dw ?
|
||||
circle_pos Point CIRCLE_COUNT dup(<?>)
|
||||
star_pos Point STAR_COUNT dup(<?>)
|
||||
frame dw ?
|
||||
circle_speed_x dw CIRCLE_COUNT dup(?)
|
||||
circle_speed_y dw CIRCLE_COUNT dup(?)
|
||||
star_angle db ?
|
||||
star_speed db STAR_COUNT dup(?)
|
||||
db ? ;
|
||||
include libs/master.lib/pal[bss].asm
|
||||
include libs/master.lib/superpa[bss].asm
|
||||
include libs/master.lib/super_wave_put[bss].asm
|
||||
include libs/master.lib/mem[bss].asm
|
||||
dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
include libs/BorlandC/atexit[bss].asm
|
||||
edata@ label byte
|
||||
|
||||
_TEXT ends
|
||||
|
||||
|
||||
end startx
|
Loading…
Reference in New Issue