ReC98/th05_zuninit.asm

364 lines
8.2 KiB
NASM
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2009 by Hex-Rays, <support@hex-rays.com> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : E22366913B7288F2EC82E280B386C86D
; File Name : th04/ZUN.COM:ZUNINIT (-I)
; Format : MS-DOS COM-file
; Base Address: 0h Range: 100h-4F1h Loaded length: 3F1h
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 tiny
.code
org 100h
; =============== S U B R O U T I N E =======================================
; Attributes: noreturn thunk
public start
start proc near
jmp start_0
start endp
even
; =============== S U B R O U T I N E =======================================
sub_104 proc far
cmp cs:byte_2EB, 0
jnz short locret_115
mov cs:byte_2EB, 1
call sub_128
locret_115:
iret
sub_104 endp
; =============== S U B R O U T I N E =======================================
sub_116 proc far
cmp cs:byte_2EB, 0
jnz short locret_127
mov cs:byte_2EB, 2
call sub_128
locret_127:
iret
sub_116 endp
; =============== S U B R O U T I N E =======================================
sub_128 proc near
pushf
pusha
push ds
push es
mov ah, 41h
int 18h
mov di, offset aVVtvVVrvsvnvog ; "むやみにSTOPキー押したりしない$"
cmp cs:byte_2EB, 1
jz short loc_13E
mov di, offset aVV ; "なんでCOPYキー押したりしてるの$"
loc_13E:
mov ax, 650h
call sub_1AE
add di, offset asc_219 - offset aVVtvVVrvsvnvog ; "方がいいと思うの。(ゲーム中はね)$"
mov ax, 6F0h
call sub_1AE
add di, offset aBivrvsvnvoglbV - offset asc_219 ; "(STOPキーで戻れるよ、ねっ) $"
mov ax, 790h
call sub_1AE
mov bl, cs:byte_2EB
loc_15B:
call sub_192
jnz short loc_15B
loc_160:
call sub_192
jz short loc_160
loc_165:
call sub_192
jnz short loc_165
mov ah, 40h
int 18h
mov di, offset aB@b@b@b@b@b@b@ ; "                 $"
mov ax, 650h
call sub_1AE
mov ax, 6F0h
call sub_1AE
mov ax, 790h
call sub_1AE
mov ah, 6
int 18h
pop es
pop ds
popa
popf
mov cs:byte_2EB, 0
retn
sub_128 endp
; =============== S U B R O U T I N E =======================================
sub_192 proc near
mov ah, 4
mov al, 0Ch
int 18h
test ah, bl
retn
sub_192 endp
even
; =============== S U B R O U T I N E =======================================
sub_19C proc near
shl ah, 1
cmp al, 9Fh
jnb short loc_1A7
cmp al, 80h
adc ax, 0FEDFh
loc_1A7:
sbb ax, 0DFFEh
and ax, 7F7Fh
retn
sub_19C endp
; =============== S U B R O U T I N E =======================================
sub_1AE proc near
push di
mov bx, di
mov dx, 0A000h
mov es, dx
assume es:nothing
mov di, ax
mov dx, ax
xor ax, ax
xor cx, cx
loc_1BE:
mov ax, cs:[bx]
cmp al, 24h
jz short loc_1DB
xchg ah, al
call sub_19C
xchg ah, al
sub al, 20h
stosw
or ah, 80h
stosw
add bx, 2
add cl, 2
jmp short loc_1BE
; ---------------------------------------------------------------------------
loc_1DB:
mov ax, 0A200h
mov es, ax
assume es:nothing
mov di, dx
mov ax, 41h
loc_1E5:
stosw
loop loc_1E5
pop di
retn
sub_1AE endp
; ---------------------------------------------------------------------------
ZUNP dw 'ZU', 'NP'
dword_1EE dd 0
dword_1F2 dd 0
aVVtvVVrvsvnvog db 'むやみにSTOPキー押したりしない$'
asc_219 db '方がいいと思うの。(ゲーム中はね)$'
aBivrvsvnvoglbV db '(STOPキーで戻れるよ、ねっ) $'
aVV db 'なんでCOPYキー押したりしてるの$'
aVivBBbvVVmbBbb db 'かな~。ふしぎ~。  (もう一度、$'
aVbvnvovxglbIqv db 'COPYキー押せば戻れるよ、ねっ)$'
aB@b@b@b@b@b@b@ db '                 $'
byte_2EB db 0
; =============== S U B R O U T I N E =======================================
sub_2EC proc near
mov dx, offset aIntvectorSetPr ; "\r\nINTvector set program zuninit.com "...
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov ax, 3506h
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
xor ax, ax
cmp es:ZUNP+0, 'ZU'
jnz short locret_30D
cmp es:ZUNP+2, 'NP'
jnz short locret_30D
inc ax
locret_30D:
retn
sub_2EC endp
; =============== S U B R O U T I N E =======================================
start_0 proc near
mov si, 81h
loc_311:
lodsb
cmp al, 0Dh
jz short loc_322
cmp al, '/'
jz short loc_32C
cmp al, '-'
jz short loc_32C
cmp al, ' '
jbe short loc_311
loc_322:
call sub_2EC
test ax, ax
jz short loc_344
jmp loc_3B0
; ---------------------------------------------------------------------------
loc_32C:
lodsb
cmp al, ' '
jbe loc_3BA
and al, 0DFh
cmp al, 'R'
jnz loc_3BA
call sub_2EC
test ax, ax
jnz short loc_381
jmp short loc_3B5
; ---------------------------------------------------------------------------
loc_344:
mov ax, 3506h
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
mov word ptr dword_1F2, bx
mov word ptr dword_1F2+2, es
mov dx, offset sub_104
mov ax, 2506h
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
mov ax, 3505h
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
mov word ptr dword_1EE, bx
mov word ptr dword_1EE+2, es
mov dx, offset sub_116
mov ax, 2505h
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
mov dx, offset aVVxvVVVixfiovi ; "ちょこっとお部屋かりるね☆\r\n\r\n$"
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov dx, offset sub_2EC
shr dx, 4
inc dx
mov ax, 3100h
int 21h ; DOS - DOS 2+ - TERMINATE BUT STAY RESIDENT
; AL = exit code, DX = program size, in paragraphs
; ---------------------------------------------------------------------------
loc_381:
push ds
lds dx, es:dword_1F2
mov ax, 2506h
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
lds dx, es:dword_1EE
mov ax, 2505h
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
pop ds
push es
mov es, word ptr es:2Ch
assume es:nothing
mov ah, 49h
int 21h ; DOS - 2+ - FREE MEMORY
; ES = segment address of area to be freed
pop es
mov ah, 49h
int 21h ; DOS - 2+ - FREE MEMORY
; ES = segment address of area to be freed
mov dx, offset aOVsvVVixfiov ; "借りてたお部屋をお返ししますね。それで?"...
jnb short loc_3BD
mov dx, offset aGbgvgki ; "メモリ解放エラーです\r\n$"
jmp short loc_3BD
; ---------------------------------------------------------------------------
loc_3B0:
mov dx, offset aVVVPatuvVVVB ; "すでに常駐してます~\r\n\r\n$"
jmp short loc_3BD
; ---------------------------------------------------------------------------
loc_3B5:
mov dx, offset aVVBapatuvVVVvv ; "まだ、常駐してないです\r\n\r\n$"
jmp short loc_3BD
; ---------------------------------------------------------------------------
loc_3BA:
mov dx, offset aICbxscVGigvgvg ; "意味不明なオプションよぉ(オプションは "...
loc_3BD:
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov ax, 4C00h
int 21h ; DOS - 2+ - QUIT WITH EXIT CODE (EXIT)
start_0 endp ; AL = exit code
; ---------------------------------------------------------------------------
aIntvectorSetPr db 0Dh,0Ah
db 'INTvector set program zuninit.com Version1.02 (c)zun 1998',0Dh,0Ah,'$'
aVVxvVVVixfiovi db 'ちょこっとお部屋かりるね☆',0Dh,0Ah
db 0Dh,0Ah,'$'
aVVVPatuvVVVB db 'すでに常駐してます~',0Dh,0Ah
db 0Dh,0Ah,'$'
aOVsvVVixfiov db '借りてたお部屋をお返ししますね。それではまた☆',0Dh,0Ah
db 0Dh,0Ah,'$'
aVVBapatuvVVVvv db 'まだ、常駐してないです',0Dh,0Ah
db 0Dh,0Ah,'$'
aICbxscVGigvgvg db '意味不明なオプションよぉ(オプションは -R : 解放 のみ)',0Dh,0Ah,'$'
aGbgvgki db 'メモリ解放エラーです',0Dh,0Ah,'$'
end start