-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path19C1.asm
423 lines (408 loc) · 10.4 KB
/
19C1.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
409
410
411
412
413
414
415
416
417
418
419
420
421
*Title Disassembling CGEN.COM Hi-Tech C v3.09
*Heading Checking recreated code with original
; File - 19C1.asm Created 09.03.2019 Last Modified 31.01.2021
;=========================================================
; sub_19C1 OK++
;=========================================================
global _sub_19C1 ; global _sub_19C1
global ncsv,cret,indir ; global ncsv, cret, indir
global _sub_1754 ; global _sub_1754
global _sub_306 ; global _sub_306
global _allocmem ; global _allocmem
global _atoi ; global _atoi
global _sub_627 ; global _sub_627
global _sub_600E ; global _sub_600E
global _sub_4192 ; global _sub_4192
global _faterror ; global _faterror
global _sub_475C ; global _sub_475C
global _sub_1C8E ; global _sub_1C8E
global _movmem ; global _movmem
global _sub_1CEF ; global _sub_1CEF
psect text
; Disassembled version ; After compiling C source code
_sub_19C1:
call ncsv ; call ncsv
defw 0FDF2h ; defw -526
ld l,(ix+6) ; ld l,(ix+6)
ld h,(ix+7) ; ld h,(ix+7)
push hl ; push hl
call _sub_306 ; call _sub_306
push hl ; push hl
call _sub_1754 ; call _sub_1754
pop bc ; pop bc
pop bc ; pop bc
ld (ix+-4),l ; ld (ix+-4),l
ld (ix+-3),h ; ld (ix+-3),h
push ix ; push ix
pop de ; pop de
ld hl,0FDF2h ; ld hl,-526
add hl,de ; add hl,de
ld (ix+-6),l ; ld (ix+-6),l
ld (ix+-5),h ; ld (ix+-5),h
ld de,0 ; ld de,0
ld (hl),e ; ld (hl),e
inc hl ; inc hl
ld (hl),d ; ld (hl),d
loc_19EF: ;l12:
call _sub_306 ; call _sub_306
ld (ix+-10),l ; ld (ix+-10),l
ld (ix+-9),h ; ld (ix+-9),h
ld a,(hl) ; ld a,(hl)
cp 5Dh ; cp 93
jp z,loc_1AAE ; jp z,l13
ld hl,16h ; ld hl,22
push hl ; push hl
call _allocmem ; call _allocmem
pop bc ; pop bc
push hl ; push hl
pop iy ; pop iy
ld (iy+2),16h ; ld (iy+2),22
ld l,(ix+-10) ; ld l,(ix+-10)
ld h,(ix+-9) ; ld h,(ix+-9)
ld a,(hl) ; ld a,(hl)
cp 3Ah ; cp 58
jr nz,loc_1A2E ; jp nz,l16
inc hl ; inc hl
push hl ; push hl
call _atoi ; call _atoi
pop bc ; pop bc
ld (iy+5),l ; ld (iy+5),l
set 4,(iy+3) ; set 4,(iy+3)
call _sub_306 ; call _sub_306
ld (ix+-10),l ; ld (ix+-10),l
ld (ix+-9),h ; ld (ix+-9),h
loc_1A2E: ;l16:
push iy ; push iy
pop de ; pop de
ld hl,0Dh ; ld hl,13
add hl,de ; add hl,de
push hl ; push hl
ld l,(ix+-10) ; ld l,(ix+-10)
ld h,(ix+-9) ; ld h,(ix+-9)
push hl ; push hl
call _sub_627 ; call _sub_627
pop bc ; pop bc
pop bc ; pop bc
ld (iy+0Fh),l ; ld (iy+15),l
ld (iy+10h),h ; ld (iy+16),h
call _sub_4192 ; call _sub_4192
push hl ; push hl
call _sub_600E ; call _sub_600E
pop bc ; pop bc
ld (ix+-8),l ; ld (ix+-8),l
ld (ix+-7),h ; ld (ix+-7),h
ld a,(hl) ; ld a,(hl)
cp 43h ; cp 67
jr z,loc_1A63 ; jp z,l17
ld hl,19f ; ld hl,19f
push hl ; push hl
call _faterror ; call _faterror
pop bc ; pop bc
loc_1A63: ;l17:
ld e,(ix+-8) ; ld e,(ix+-8)
ld d,(ix+-7) ; ld d,(ix+-7)
ld hl,19h ; ld hl,25
add hl, de ; add hl,de
ld c,(hl) ; ld c,(hl)
inc hl ; inc hl
ld b,(hl) ; ld b,(hl)
ld (iy+0Bh),c ; ld (iy+11),c
ld (iy+0Ch),b ; ld (iy+12),b
ld l,e ; ld l,e
ld h,d ; ld h,d
push hl ; push hl
call _sub_475C ; call _sub_475C
pop bc ; pop bc
push iy ; push iy
call _sub_1C8E ; call _sub_1C8E
pop bc ; pop bc
ld (iy+9),l ; ld (iy+9),l
ld (iy+0Ah),h ; ld (iy+10),h
ld e,(ix+-6) ; ld e,(ix+-6)
ld d,(ix+-5) ; ld d,(ix+-5)
ex de,hl ; ex de,hl
ld e,(hl) ; ld e,(hl)
inc hl ; inc hl
ld d,(hl) ; ld d,(hl)
ex de,hl ; ex de,hl
inc hl ; inc hl
ex de,hl ; ex de,hl
ld (hl),d ; ld (hl),d
dec hl ; dec hl
ld (hl),e ; ld (hl),e
ex de,hl ; ex de,hl
dec hl ; dec hl
add hl,hl ; add hl,hl
ld e,(ix+-6) ; ld e,(ix+-6)
ld d,(ix+-5) ; ld d,(ix+-5)
add hl,de ; add hl,de
inc hl ; inc hl
inc hl ; inc hl
push iy ; push iy
pop de ; pop de
ld (hl),e ; ld (hl),e
inc hl ; inc hl
ld (hl),d ; ld (hl),d
jp loc_19EF ; jp l12
loc_1AAE: ;l13:
ld l,(ix+-6) ; ld l,(ix+-6)
ld h,(ix+-5) ; ld h,(ix+-5)
ld c,(hl) ; ld c,(hl)
inc hl ; inc hl
ld b,(hl) ; ld b,(hl)
ld hl,0FFFFh ; ld hl,-1
add hl,bc ; add hl,bc
add hl,hl ; add hl,hl
inc hl ; inc hl
inc hl ; inc hl
inc hl ; inc hl
inc hl ; inc hl
ld (ix+-2),l ; ld (ix+-2),l
ld (ix+-1),h ; ld (ix+-1),h
push hl ; push hl
call _allocmem ; call _allocmem
ld (ix+-6),l ; ld (ix+-6),l
ld (ix+-5),h ; ld (ix+-5),h
ld l,(ix+-2) ; ld l,(ix+-2)
ld h,(ix+-1) ; ld h,(ix+-1)
ex (sp),hl ; ex (sp),hl
ld l,(ix+-6) ; ld l,(ix+-6)
ld h,(ix+-5) ; ld h,(ix+-5)
push hl ; push hl
push ix ; push ix
pop de ; pop de
ld hl,0FDF2h ; ld hl,-526
add hl,de ; add hl,de
push hl ; push hl
call _movmem ; call _movmem
pop bc ; pop bc
pop bc ; pop bc
pop bc ; pop bc
ld e,(ix+-4) ; ld e,(ix+-4)
ld d,(ix+-3) ; ld d,(ix+-3)
ld hl,13h ; ld hl,19
add hl,de ; add hl,de
ld e,(ix+-6) ; ld e,(ix+-6)
ld d,(ix+-5) ; ld d,(ix+-5)
ld (hl),e ; ld (hl),e
inc hl ; inc hl
ld (hl),d ; ld (hl),d
ld l,(ix+-4) ; ld l,(ix+-4)
ld h,(ix+-3) ; ld h,(ix+-3)
push hl ; push hl
call _sub_1CEF ; call _sub_1CEF
jp cret ; jp cret
; End of function sub_19C1 OK++
;=========================================================
; sub_17E0 OK+
;
; Warning
; In file CGEN.COM stack recovery failed when returning
; from function sub_76F
;=========================================================
global _sub_1B0C ; global _sub_1B0C
global _sub_15FB ; global _sub_15FB
global _sub_76F ; global _sub_76F
global arelop ; global arelop
global arelop ; global arelop
; Disassembled version ; After compiling C source code
_sub_1B0C:
call ncsv ; call ncsv
defw 0FDF2h ; defw -526
ld (ix+-6),0 ; ld (ix+-6),0
ld (ix+-5),80h ; ld (ix+-5),128
ld (ix+-8),0FFh ; ld (ix+-8),255
ld (ix+-7),7Fh ; ld (ix+-7),127
ld hl, 34h ; ld hl,52
push hl ; push hl
call _sub_306 ; call _sub_306
push hl ; push hl
call _sub_1754 ; call _sub_1754
pop bc ; pop bc
pop bc ; pop bc
push hl ; push hl
pop iy ; pop iy
push ix ; push ix
pop de ; pop de
ld hl,0FDF2h ; ld hl,-526
add hl,de ; add hl,de
ld (ix+-4),l ; ld (ix+-4),l
ld (ix+-3),h ; ld (ix+-3),h
ld de,0 ; ld de,0
ld (hl),e ; ld (hl),e
inc hl ; inc hl
ld (hl),d ; ld (hl),d
loc_1B44: ;l19:
call _sub_4192 ; call _sub_4192
ld (ix+-2),l ; ld (ix+-2),l
ld (ix+-1),h ; ld (ix+-1),h
ld a,(hl) ; ld a,(hl)
cp 17h ; cp 23
push hl ; push hl
jp nz,loc_1BBE ; jp nz,L1
call _sub_475C ; call _sub_475C
pop bc ; pop bc
ld l,(ix+-4) ; ld l,(ix+-4)
ld h,(ix+-3) ; ld h,(ix+-3)
ld a,(hl) ; ld a,(hl)
inc hl ; inc hl
ld h,(hl) ; ld h,(hl)
ld l,a ; ld l,a
dec hl ; dec hl
add hl,hl ; add hl,hl
inc hl ; inc hl
inc hl ; inc hl
inc hl ; inc hl
inc hl ; inc hl
ld (ix+-10),l ; ld (ix+-10),l
ld (ix+-9),h ; ld (ix+-9),h
push hl ; push hl
call _allocmem ; call _allocmem
ld (ix+-4),l ; ld (ix+-4),l
ld (ix+-3),h ; ld (ix+-3),h
ld l,(ix+-10) ; ld l,(ix+-10)
ld h,(ix+-9) ; ld h,(ix+-9)
ex (sp),hl ; ex (sp),hl
ld l,(ix+-4) ; ld l,(ix+-4)
ld h,(ix+-3) ; ld h,(ix+-3)
push hl ; push hl
push ix ; push ix
pop de ; pop de
ld hl,0FDF2h ; ld hl,-526
add hl,de ; add hl,de
push hl ; push hl
call _movmem ; call _movmem
pop bc ; pop bc
pop bc ; pop bc
ld l,(ix+-4) ; ld l,(ix+-4)
ld h,(ix+-3) ; ld h,(ix+-3)
ld (iy+13h),l ; ld (iy+19),l
ld (iy+14h),h ; ld (iy+20),h
ld l,(ix+-6) ; ld l,(ix+-6)
ld h,(ix+-5) ; ld h,(ix+-5)
ex (sp),hl ; ex (sp),hl
ld l,(ix+-8) ; ld l,(ix+-8)
ld h,(ix+-7) ; ld h,(ix+-7)
push hl ; push hl
push iy ; push iy
call _sub_15FB ; call _sub_15FB ; 1BAF CALL 15FB ; 1B91 CALL 15CA
pop bc ; pop bc ; 1BB2 POP BC ; 1B94 POP BC
pop bc ; pop bc ; 1BB3 POP BC ; 1B95 POP BC
ld hl,5Dh ; ld hl,93 ; 1BB4 LD HL,005D ; 1B96 LD HL,005D
ex (sp),hl ; ex (sp),hl ; 1BB7 EX SP,HL ; 1B99 EX SP,HL
call _sub_76F ; call _sub_76F ; 1BB8 CALL 076F ; 1B9A CALL 0745
; missing pop bc ; pop bc ; ; 1B9D POP BC
jp cret ; jp cret ; 1BBB JP 8024 ; 1B9E JP 8DE0
loc_1BBE: ;L1: ; ;
call _sub_600E ; call _sub_600E ; 1BBE CALL 600E ; 1BA1 CALL 5F7D
pop bc ; pop bc ; 1BC1 POP BC ; 1BA4 POP BC
ld (ix+-2),l ; ld (ix+-2),l
ld (ix+-1),h ; ld (ix+-1),h
ex de,hl ; ex de,hl
ld hl,19h ; ld hl,25
add hl,de ; add hl,de
ld c,(hl) ; ld c,(hl)
inc hl ; inc hl
ld b,(hl) ; ld b,(hl)
ld e,(ix+-4) ; ld e,(ix+-4)
ld d,(ix+-3) ; ld d,(ix+-3)
ex de,hl ; ex de,hl
ld e,(hl) ; ld e,(hl)
inc hl ; inc hl
ld d,(hl) ; ld d,(hl)
ex de,hl ; ex de,hl
inc hl ; inc hl
ex de,hl ; ex de,hl
ld (hl),d ; ld (hl),d
dec hl ; dec hl
ld (hl),e ; ld (hl),e
ex de,hl ; ex de,hl
dec hl ; dec hl
add hl,hl ; add hl,hl
ld e,(ix+-4) ; ld e,(ix+-4)
ld d,(ix+-3) ; ld d,(ix+-3)
add hl,de ; add hl,de
inc hl ; inc hl
inc hl ; inc hl
ld (hl),c ; ld (hl),c
inc hl ; inc hl
ld (hl),b ; ld (hl),b
ld e,(ix+-2) ; ld e,(ix+-2)
ld d,(ix+-1) ; ld d,(ix+-1)
ld hl,19h ; ld hl,25
add hl,de ; add hl,de
ld e,(hl) ; ld e,(hl)
inc hl ; inc hl
ld d,(hl) ; ld d,(hl)
inc hl ; inc hl
ld a,(hl) ; ld a,(hl)
inc hl ; inc hl
ld h,(hl) ; ld h,(hl)
ld l,a ; ld l,a
push hl ; push hl
push de ; push de
ld e,(ix+-6) ; ld e,(ix+-6)
ld d,(ix+-5) ; ld d,(ix+-5)
ld a,d ; ld a,d
rla ; rla
sbc a,a ; sbc a,a
ld l,a ; ld l,a
ld h,a ; ld h,a
call arelop ; call arelop
jp p,loc_1C27 ; jp p,l23
ld e,(ix+-2) ; ld e,(ix+-2)
ld d,(ix+-1) ; ld d,(ix+-1)
ld hl,19h ; ld hl,25
add hl,de ; add hl,de
ld c,(hl) ; ld c,(hl)
inc hl ; inc hl
ld b,(hl) ; ld b,(hl)
ld (ix+-6),c ; ld (ix+-6),c
ld (ix+-5),b ; ld (ix+-5),b
loc_1C27: ;l23:
ld e,(ix+-8) ; ld e,(ix+-8)
ld d,(ix+-7) ; ld d,(ix+-7)
ld a,d ; ld a,d
rla ; rla
sbc a,a ; sbc a,a
ld l,a ; ld l,a
ld h,a ; ld h,a
push hl ; push hl
push de ; push de
ld e,(ix+-2) ; ld e,(ix+-2)
ld d,(ix+-1) ; ld d,(ix+-1)
ld hl,19h ; ld hl,25
add hl,de ; add hl,de
ld e,(hl) ; ld e,(hl)
inc hl ; inc hl
ld d,(hl) ; ld d,(hl)
inc hl ; inc hl
ld a,(hl) ; ld a,(hl)
inc hl ; inc hl
ld h,(hl) ; ld h,(hl)
ld l,a ; ld l,a
call arelop ; call arelop
jp p,loc_1C5F ; jp p,l24
ld e,(ix+-2) ; ld e,(ix+-2)
ld d,(ix+-1) ; ld d,(ix+-1)
ld hl,19h ; ld hl,25
add hl,de ; add hl,de
ld c,(hl) ; ld c,(hl)
inc hl ; inc hl
ld b,(hl) ; ld b,(hl)
ld (ix+-8),c ; ld (ix+-8),c
ld (ix+-7),b ; ld (ix+-7),b
loc_1C5F: ;l24:
ld l,(ix+-2) ; ld l,(ix+-2)
ld h,(ix+-1) ; ld h,(ix+-1)
push hl ; push hl
call _sub_475C ; call _sub_475C
pop bc ; pop bc
jp loc_1B44 ; jp l19
; End of function sub_1B0C OK+
psect data
p_19c1_A934:
19: defb 83,116,114,117,99,100,101,99,108,32,45,32,98,97,100,9
defb 110,101,108,101,109,0
psect text
; End of file - 19C1.asm