ReC98/th01_zunsoft.asm

832 lines
16 KiB
NASM
Raw Normal View History

;
; +-------------------------------------------------------------------------+
; | 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
; ===========================================================================
; 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
2014-08-27 04:03:08 +00:00
call graph_clear
mov dx, 0A6h
mov al, 0
out dx, al
2014-08-27 04:03:08 +00:00
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
2014-08-27 23:16:54 +00:00
call graph_start
2014-08-23 12:01:53 +00:00
call key_beep_off
call text_systemline_hide
call text_cursor_hide
call egc_start
call sub_367
2014-08-20 14:45:24 +00:00
call text_clear
mov byte ptr ds:2870h, 0
mov byte ptr ds:2871h, 1
push 60h
push 64h
push 21Fh
push 12Bh
2014-08-31 06:36:33 +00:00
call grc_setclip
2014-08-27 23:05:11 +00:00
call graph_hide
push 21CEh
call super_entry_bfnt
2014-08-23 14:11:16 +00:00
call palette_show
2014-08-23 13:47:05 +00:00
mov PaletteTone, 0
2014-08-23 14:11:16 +00:00
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
2014-08-20 14:45:24 +00:00
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, [bx+2368h]
push dx
cwd
pop cx
pop bx
call N_LXMUL@
mov cl, 8
call near ptr 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, [bx+22E8h]
push dx
cwd
pop cx
pop bx
call N_LXMUL@
mov cl, 8
call near ptr N_LXRSH@
mov [di], ax
pop di
pop si
pop bp
retn 8
sub_3E4 endp ; sp-analysis failed
; =============== 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 word ptr ds:2878h, 80h
mov word ptr ds:2952h, 0FFF8h
mov word ptr ds:287Ah, 140h
mov word ptr ds:295Ah, 8
mov word ptr ds:287Ch, 100h
mov word ptr ds:2954h, 0FFF8h
mov word ptr ds:287Eh, 0F0h
mov word ptr ds:295Ch, 8
mov word ptr ds:2880h, 180h
mov word ptr ds:2956h, 0FFF8h
mov word ptr ds:2882h, 0A0h
mov word ptr ds:295Eh, 8
mov word ptr ds:2884h, 200h
mov word ptr ds:2958h, 0FFF8h
mov word ptr ds:2886h, 50h
mov word ptr ds:2960h, 8
mov word ptr ds:2950h, 0
mov byte ptr ds:2872h, 0
mov byte ptr ds:2873h, 0
mov byte ptr ds:2874h, 17h
mov byte ptr ds:2875h, 0
mov byte ptr ds:2876h, 0
xor si, si
jmp short loc_4F5
; ---------------------------------------------------------------------------
loc_4C0:
2014-08-30 10:13:04 +00:00
call IRand
mov bx, 280h
cwd
idiv bx
mov bx, si
shl bx, 2
mov [bx+2888h], dx
2014-08-30 10:13:04 +00:00
call IRand
mov bx, 190h
cwd
idiv bx
mov bx, si
shl bx, 2
mov [bx+288Ah], dx
2014-08-30 10:13:04 +00:00
call IRand
mov bx, 20h
cwd
idiv bx
add dl, 6
mov [si+2963h], dl
inc si
loc_4F5:
cmp si, 32h
jl short loc_4C0
mov byte ptr ds:2962h, 40h
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, 3
jmp loc_5A6
; ---------------------------------------------------------------------------
loc_50C:
push 0C0h
mov al, [si+21D9h]
cbw
push ax
call grcg_setcolor
mov bx, si
shl bx, 2
push word ptr [bx+2878h]
mov bx, si
shl bx, 2
push word ptr [bx+287Ah]
push 60h
2014-08-28 04:02:11 +00:00
call grcg_circlefill
mov bx, si
add bx, bx
mov ax, [bx+2952h]
mov bx, si
shl bx, 2
add [bx+2878h], ax
mov bx, si
add bx, bx
mov ax, [bx+295Ah]
mov bx, si
shl bx, 2
add [bx+287Ah], ax
mov bx, si
shl bx, 2
cmp word ptr [bx+2878h], 20h
jle short loc_56A
mov bx, si
shl bx, 2
cmp word ptr [bx+2878h], 25Fh
jle short loc_57B
loc_56A:
mov bx, si
add bx, bx
mov dx, 0FFFFh
mov ax, [bx+2952h]
imul dx
mov [bx+2952h], ax
loc_57B:
mov bx, si
shl bx, 2
cmp word ptr [bx+287Ah], 20h
jle short loc_594
mov bx, si
shl bx, 2
cmp word ptr [bx+287Ah], 16Fh
jle short loc_5A5
loc_594:
mov bx, si
add bx, bx
mov dx, 0FFFFh
mov ax, [bx+295Ah]
imul dx
mov [bx+295Ah], ax
loc_5A5:
dec si
loc_5A6:
or si, si
jl short loc_5AD
jmp loc_50C
; ---------------------------------------------------------------------------
loc_5AD:
mov dx, 7Ch
mov al, 0
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
push 0C0h
push 5
call grcg_setcolor
xor si, si
jmp loc_66E
; ---------------------------------------------------------------------------
loc_5C8:
mov bx, si
shl bx, 2
push word ptr [bx+2888h]
mov bx, si
shl bx, 2
push word ptr [bx+288Ah]
2014-08-28 03:48:32 +00:00
call grcg_pset
lea ax, [bp+var_2]
push ax
lea ax, [bp+var_4]
push ax
push word ptr ds:2962h
mov al, [si+2963h]
mov ah, 0
push ax
call sub_3E4
mov bx, si
shl bx, 2
mov ax, [bp+var_2]
add [bx+2888h], ax
mov bx, si
shl bx, 2
mov ax, [bp+var_4]
add [bx+288Ah], ax
mov bx, si
shl bx, 2
cmp word ptr [bx+2888h], 0
jge short loc_624
mov bx, si
shl bx, 2
add word ptr [bx+2888h], 280h
jmp short loc_63C
; ---------------------------------------------------------------------------
loc_624:
mov bx, si
shl bx, 2
cmp word ptr [bx+2888h], 280h
jl short loc_63C
mov bx, si
shl bx, 2
sub word ptr [bx+2888h], 280h
loc_63C:
mov bx, si
shl bx, 2
cmp word ptr [bx+288Ah], 0
jge short loc_655
mov bx, si
shl bx, 2
add word ptr [bx+288Ah], 190h
jmp short loc_66D
; ---------------------------------------------------------------------------
loc_655:
mov bx, si
shl bx, 2
cmp word ptr [bx+288Ah], 190h
jl short loc_66D
mov bx, si
shl bx, 2
sub word ptr [bx+288Ah], 190h
loc_66D:
inc si
loc_66E:
cmp si, 32h
jge short loc_676
jmp loc_5C8
; ---------------------------------------------------------------------------
loc_676:
inc byte ptr ds:2962h
mov dx, 7Ch
mov al, 0
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 word ptr ds:2950h, 32h
jge short loc_6A5
jmp loc_7CB
; ---------------------------------------------------------------------------
loc_6A5:
cmp word ptr ds:2950h, 5Ah
jge short loc_6CD
cmp word ptr ds:2950h, 37h
jnz short loc_6B6
jmp loc_7A6
; ---------------------------------------------------------------------------
loc_6B6:
cmp word ptr ds:2950h, 3Ch
jnz short loc_6C0
jmp loc_7A6
; ---------------------------------------------------------------------------
loc_6C0:
cmp word ptr ds:2950h, 41h
jz short loc_6CA
jmp loc_7AE
; ---------------------------------------------------------------------------
loc_6CA:
jmp loc_7A6
; ---------------------------------------------------------------------------
loc_6CD:
cmp word ptr ds:2950h, 6Eh
jge short loc_720
push 100h
push 0C0h
mov al, ds:2873h
cbw
push ax
mov al, ds:2874h
cbw
push ax
push word ptr ds:2876h
mov al, ds:2875h
cbw
push ax
2014-09-06 23:56:57 +00:00
call super_wave_put
push 140h
push 0C0h
mov al, ds:2873h
cbw
inc ax
push ax
mov al, ds:2874h
cbw
push ax
push word ptr ds:2876h
mov al, ds:2875h
cbw
push ax
2014-09-06 23:56:57 +00:00
call super_wave_put
dec byte ptr ds:2874h
loc_711:
mov al, ds:2875h
add al, 4
mov ds:2875h, al
mov al, ds:2876h
add al, 4
jmp short loc_781
; ---------------------------------------------------------------------------
loc_720:
cmp word ptr ds:2950h, 82h
jge short loc_786
cmp word ptr ds:2950h, 6Eh
jnz short loc_737
mov al, ds:2873h
add al, 2
mov ds:2873h, al
loc_737:
push 100h
push 0C0h
mov al, ds:2873h
cbw
push ax
mov al, ds:2874h
cbw
push ax
push word ptr ds:2876h
mov al, ds:2875h
cbw
push ax
2014-09-06 23:56:57 +00:00
call super_wave_put
push 140h
push 0C0h
mov al, ds:2873h
cbw
inc ax
push ax
mov al, ds:2874h
cbw
push ax
push word ptr ds:2876h
mov al, ds:2875h
cbw
push ax
2014-09-06 23:56:57 +00:00
call super_wave_put
inc byte ptr ds:2874h
mov al, ds:2875h
add al, 4
mov ds:2875h, al
mov al, ds:2876h
add al, 0FCh
loc_781:
mov ds:2876h, al
pop bp
retn
; ---------------------------------------------------------------------------
loc_786:
cmp word ptr ds:2950h, 0AAh
jge short loc_7CB
cmp word ptr ds:2950h, 9Bh
jz short loc_7A6
cmp word ptr ds:2950h, 0A0h
jz short loc_7A6
cmp word ptr ds:2950h, 0A5h
jnz short loc_7AE
loc_7A6:
mov al, ds:2873h
add al, 2
mov ds:2873h, al
loc_7AE:
push 100h
push 0C0h
mov al, ds:2873h
cbw
push ax
2014-08-28 04:31:32 +00:00
call super_put_8
push 140h
push 0C0h
mov al, ds:2873h
cbw
inc ax
push ax
2014-08-28 04:31:32 +00:00
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 word ptr ds:2950h, 0B4h
jle short loc_80C
cmp byte ptr ds:2872h, 0
jle short loc_873
mov al, ds:2872h
add al, 0FEh
jmp short loc_818
; ---------------------------------------------------------------------------
loc_80C:
cmp byte ptr ds:2872h, 64h
jge short loc_822
mov al, ds:2872h
add al, 2
loc_818:
mov ds:2872h, al
cbw
2014-08-23 13:47:05 +00:00
mov PaletteTone, ax
2014-08-23 14:11:16 +00:00
call palette_show
loc_822:
push 0C0h
push 0
call grcg_setcolor
push 0Ch
push 64h
push 43h
push 12Bh
2014-08-27 21:20:37 +00:00
call grcg_byteboxfill_x
call sub_5B6
call sub_502
call sub_698
call sub_683
call sub_683
mov al, ds:2870h
mov ds:2871h, al
out 0A4h, al
xor byte ptr ds:2870h, 1
mov al, ds:2870h
out 0A6h, al
xor di, di
xor si, si
jmp short loc_864
; ---------------------------------------------------------------------------
loc_85D:
push si
2014-08-30 07:56:49 +00:00
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 word ptr ds:2950h
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
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 23:05:11 +00:00
include libs/master.lib/graph_hide.asm
include libs/master.lib/graph_show.asm
2014-08-27 23:16:54 +00:00
include libs/master.lib/graph_start.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-08-23 12:01:53 +00:00
include libs/master.lib/keybeep.asm
2014-08-30 07:56:49 +00:00
include libs/master.lib/key_sense.asm
2014-08-23 10:08:48 +00:00
include libs/master.lib/bfnt_header_read.asm
include libs/master.lib/bfnt_entry_pat.asm
include libs/master.lib/bfnt_header_analysis.asm
2014-08-23 14:56:01 +00:00
include libs/master.lib/bfnt_palette_set.asm
2014-08-22 22:46:33 +00:00
include libs/master.lib/dos_close.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/super_entry_bfnt.asm
2014-08-22 21:33:18 +00:00
include libs/master.lib/super_cancel_pat.asm
include libs/master.lib/super_entry_pat.asm
2014-08-28 04:31:32 +00:00
include libs/master.lib/super_put_8.asm
include libs/master.lib/super_free.asm
2014-08-22 21:56:33 +00:00
include libs/master.lib/super_entry_at.asm
2014-09-06 23:56:57 +00:00
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
2014-08-31 06:36:33 +00:00
include libs/master.lib/grc_setclip.asm
2014-08-27 22:17:57 +00:00
include libs/master.lib/grcg_hline.asm
include libs/master.lib/grcg_setcolor.asm
2014-08-28 03:48:32 +00:00
include libs/master.lib/grcg_pset.asm
include libs/master.lib/egc.asm
2014-08-28 04:02:11 +00:00
include libs/master.lib/grcg_circlefill.asm
2014-08-27 21:20:37 +00:00
include libs/master.lib/grcg_byteboxfill_x.asm
2014-08-30 10:13:04 +00:00
include libs/master.lib/random.asm
include libs/BorlandC/_abort.asm
include libs/BorlandC/atexit.asm
2014-08-20 18:38:08 +00:00
include libs/BorlandC/errormsg.asm
2014-08-20 15:53:02 +00:00
include libs/BorlandC/exit.asm
2014-08-14 17:49:23 +00:00
include libs/BorlandC/H_LRSH.ASM
include libs/BorlandC/ioerror.asm
2014-08-14 14:50:20 +00:00
include libs/BorlandC/_isatty.asm
include libs/BorlandC/lseek.asm
2014-08-14 17:35:29 +00:00
include libs/BorlandC/N_LXMUL.ASM
include libs/BorlandC/setupio.asm
include libs/BorlandC/brk.asm
include libs/BorlandC/nearheap.asm
2014-08-20 17:46:47 +00:00
include libs/BorlandC/fflush.asm
2014-09-02 19:26:48 +00:00
include libs/BorlandC/flushall.asm
2014-09-02 18:41:48 +00:00
include libs/BorlandC/fseek.asm
2014-09-03 12:02:14 +00:00
include libs/BorlandC/setvbuf.asm
include libs/BorlandC/_strlen.asm
include libs/BorlandC/write.asm
include libs/BorlandC/writea.asm
2014-08-28 19:54:04 +00:00
include libs/BorlandC/xfflush.asm
; ---------------------------------------------------------------------------
db 0
db 0
db 0
include libs/BorlandC/c0[data].asm
aTouhou_dat db 'touhou.dat',0
db 4, 3, 2, 1, 0
include libs/master.lib/version[data].asm
include libs/master.lib/grp[data].asm
2014-08-23 13:47:05 +00:00
include libs/master.lib/pal[data].asm
2014-08-23 10:08:48 +00:00
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
2014-08-27 22:05:06 +00:00
include libs/master.lib/edges[data].asm
include libs/master.lib/sin8[data].asm
include libs/master.lib/sin7[data].asm
2014-08-30 10:13:04 +00:00
include libs/master.lib/rand[data].asm
include libs/BorlandC/_abort[data].asm
include libs/BorlandC/atexit[data].asm
2014-08-20 15:53:02 +00:00
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
2014-09-03 12:02:14 +00:00
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...
2014-08-23 13:47:05 +00:00
db 126h dup(?)
include libs/master.lib/pal[bss].asm
include libs/master.lib/superpa[bss].asm
2014-09-06 23:56:57 +00:00
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