-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathth04_zuninit.asm
408 lines (349 loc) · 9.45 KB
/
th04_zuninit.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2009 by Hex-Rays, <[email protected]> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : F233A9AA186A9CC15E9B9109979AF52B
; File Name : th04/ZUN.COM:ZUNINIT (-I)
; Format : MS-DOS COM-file
; Base Address: 0h Range: 100h-575h Loaded length: 475h
; OS type : MS DOS
; Application type: Executable 16bit
.8086
.model 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
; =============== S U B R O U T I N E =======================================
sub_103 proc far
cmp cs:byte_216, 0
jnz short locret_114
mov cs:byte_216, 1
call sub_127
locret_114:
iret
sub_103 endp
; =============== S U B R O U T I N E =======================================
sub_115 proc far
cmp cs:byte_216, 0
jnz short locret_126
mov cs:byte_216, 2
call sub_127
locret_126:
iret
sub_115 endp
; =============== S U B R O U T I N E =======================================
sub_127 proc near
pushf
push ax
push bx
push cx
push dx
push ds
push di
push es
mov ah, 41h
int 18h
cmp cs:byte_216, 2
jz short loc_15A
mov ax, 650h
mov dx, offset aVVtvVVrvsvnvog ; "むやみにSTOPキー押したりしない$"
call sub_1CF
mov ax, 6F0h
mov dx, offset asc_23A ; "方がいいと思うの。(ゲーム中はね)$"
call sub_1CF
mov ax, 790h
mov dx, offset aBivrvsvnvoglbV ; "(STOPキーで戻れるよ、ねっ) $"
call sub_1CF
mov bl, 1
jmp short loc_177
; ---------------------------------------------------------------------------
loc_15A:
mov ax, 650h
mov dx, offset aVV ; "なんでCOPYキー押したりしてるの$"
call sub_1CF
mov ax, 6F0h
mov dx, offset aVivBBbvVVmbBbb ; "かな~。ふしぎ~。 (もう一度、$"
call sub_1CF
mov ax, 790h
mov dx, offset aVbvnvovxglbIqv ; "COPYキー押せば戻れるよ、ねっ)$"
call sub_1CF
mov bl, 2
loc_177:
mov ah, 4
mov al, 0Ch
int 18h
test ah, bl
jnz short loc_177
loc_181:
mov ah, 4
mov al, 0Ch
int 18h
test ah, bl
jz short loc_181
mov ah, 40h
int 18h
mov ax, 650h
mov dx, offset aB@b@b@b@b@b@b@ ; " $"
call sub_1CF
mov ax, 6F0h
mov dx, offset aB@b@b@b@b@b@b@ ; " $"
call sub_1CF
mov ax, 790h
mov dx, offset aB@b@b@b@b@b@b@ ; " $"
call sub_1CF
mov ah, 6
int 18h
pop es
pop di
pop ds
pop dx
pop cx
pop bx
pop ax
popf
mov cs:byte_216, 0
retn
sub_127 endp
; =============== S U B R O U T I N E =======================================
sub_1BD proc near
shl ah, 1
cmp al, 9Fh
jnb short loc_1C8
cmp al, 80h
adc ax, 0FEDFh
loc_1C8:
sbb ax, 0DFFEh
and ax, 7F7Fh
retn
sub_1BD endp
; =============== S U B R O U T I N E =======================================
sub_1CF proc near
mov bx, dx
mov di, 0A000h
mov es, di
assume es:nothing
mov di, ax
mov dx, ax
xor ax, ax
xor cx, cx
loc_1DE:
mov ax, cs:[bx]
cmp al, 24h
jz short loc_1F9
xchg ah, al
call sub_1BD
xchg ah, al
sub al, 20h
stosw
or ah, 80h
stosw
inc bx
inc bx
inc cx
inc cx
jmp short loc_1DE
; ---------------------------------------------------------------------------
loc_1F9:
mov di, 0A200h
mov es, di
assume es:nothing
mov di, dx
mov ax, 41h
loc_203:
dec cx
stosw
jz short locret_209
jmp short loc_203
; ---------------------------------------------------------------------------
locret_209:
retn
sub_1CF endp
; ---------------------------------------------------------------------------
ZUNP dw 'ZU', 'NP'
dword_20E dd 0
dword_212 dd 0
byte_216 db 0
aVVtvVVrvsvnvog db 'むやみにSTOPキー押したりしない$'
asc_23A db '方がいいと思うの。(ゲーム中はね)$'
aBivrvsvnvoglbV db '(STOPキーで戻れるよ、ねっ) $'
aB@b@b@b@b@b@b@ db ' $'
aVV db 'なんでCOPYキー押したりしてるの$'
aVivBBbvVVmbBbb db 'かな~。ふしぎ~。 (もう一度、$'
aVbvnvovxglbIqv db 'COPYキー押せば戻れるよ、ねっ)$'
; =============== S U B R O U T I N E =======================================
sub_30C proc near
mov dx, offset aIntvectorSetPr ; "\r\n\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
cmp es:ZUNP+0, 'ZU'
jnz short loc_32F
cmp es:ZUNP+2, 'NP'
jnz short loc_32F
mov ax, 1
jmp short locret_332
; ---------------------------------------------------------------------------
loc_32F:
mov ax, 0
locret_332:
retn
sub_30C endp
; =============== S U B R O U T I N E =======================================
start_0 proc near
mov si, 81h
loc_336:
lodsb
cmp al, 0Dh
jz short loc_347
cmp al, '/'
jz short loc_351
cmp al, '-'
jz short loc_351
cmp al, ' '
jbe short loc_336
loc_347:
call sub_30C
test ax, ax
jz short loc_36C
jmp loc_3ED
; ---------------------------------------------------------------------------
loc_351:
lodsb
cmp al, ' '
ja short loc_359
jmp loc_3FF
; ---------------------------------------------------------------------------
loc_359:
and al, 0DFh
cmp al, 'R'
jz short loc_362
jmp loc_3FF
; ---------------------------------------------------------------------------
loc_362:
call sub_30C
test ax, ax
jnz short loc_3B0
jmp loc_3F6
; ---------------------------------------------------------------------------
loc_36C:
mov ah, 35h
mov al, 6
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
mov word ptr cs:dword_212+0, bx
mov word ptr cs:dword_212+2, es
mov dx, offset sub_103
mov ax, 2506h
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
mov ah, 35h
mov al, 5
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
mov word ptr cs:dword_20E+0, bx
mov word ptr cs:dword_20E+2, es
mov dx, offset sub_115
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 aVVxvVVGbgvgkvi ; "ちょこっとメモリかりるね\r\n\r\n$"
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov dx, offset sub_30C
mov cl, 4
shr dx, cl
inc dx
mov ax, 3100h
int 21h ; DOS - DOS 2+ - TERMINATE BUT STAY RESIDENT
; AL = exit code, DX = program size, in paragraphs
; ---------------------------------------------------------------------------
loc_3B0:
push ds
mov dx, word ptr es:dword_212+0
mov ds, word ptr es:dword_212+2
mov ax, 2506h
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
mov dx, word ptr es:dword_20E+0
mov ds, word ptr es:dword_20E+2
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 aGbgvgkvivcpVjv ; "メモリから消えてなくなっちゃったけど、?"...
jnb short loc_3E7
mov dx, offset aGbgvgki ; "メモリ解放エラーです。 : zuninit.com\r\n$"...
loc_3E7:
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
jmp short loc_408
; ---------------------------------------------------------------------------
loc_3ED:
mov dx, offset aVVVPatuvVVsv ; "すでに常駐してるの\r\n\r\n$"
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
jmp short loc_408
; ---------------------------------------------------------------------------
loc_3F6:
mov dx, offset aVVBapatuvVVVvv ; "まだ、常駐してないわぁ\r\n\r\n$"
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
jmp short loc_408
; ---------------------------------------------------------------------------
loc_3FF:
mov dx, offset aICbxscVGigvgvg ; "意味不明なオプションよぉ(オプションは "...
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
jmp short $+2
loc_408:
mov ax, 4C00h
int 21h ; DOS - 2+ - QUIT WITH EXIT CODE (EXIT)
start_0 endp ; AL = exit code
; ---------------------------------------------------------------------------
aIntvectorSetPr db 0Dh,0Ah
db 0Dh,0Ah
db 'INTvector set program zuninit.com Version1.01 (c)zun 1998',0Dh,0Ah,'$'
aVVxvVVGbgvgkvi db 'ちょこっとメモリかりるね',0Dh,0Ah
db 0Dh,0Ah,'$'
aVVVPatuvVVsv db 'すでに常駐してるの',0Dh,0Ah
db 0Dh,0Ah,'$'
aGbgvgkvivcpVjv db 'メモリから消えてなくなっちゃったけど、きっとまたあえるよ、ねっ',0Dh,0Ah
db 0Dh,0Ah,'$'
aVVBapatuvVVVvv db 'まだ、常駐してないわぁ',0Dh,0Ah
db 0Dh,0Ah,'$'
aICbxscVGigvgvg db '意味不明なオプションよぉ(オプションは -Rのみ)',0Dh,0Ah,'$'
aGbgvgki db 'メモリ解放エラーです。 : zuninit.com',0Dh,0Ah
db '$メインメモリは560K以上空けといて下さいね',0Dh,0Ah,'$'
end start