Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
802 savelij 1
 
2
;LAST UPDATE: 07.08.2017 savelij
3
 
4
                include ../../macros.a80
5
                include ../../bas_trd_vars.a80
6
                include ../../basic_tokens.a80
7
 
8
                ORG 0
9
                di
10
                ld      de,0FFFFh
11
                ld      a,7
12
                jr      loc_9
13
 
14
RST_8           nop
15
loc_9           out     (0FEh), a
16
                ld      a,3Fh
17
                jr      loc_13
18
 
19
                nop
20
RST_10          jp      PRINT_A_
21
 
22
loc_13          ld      i,a
23
                jp      loc_1B
24
 
25
RST_18          jp      PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
26
 
27
loc_1B          nop
28
                nop
29
                nop
30
                jr      loc_24
31
 
32
RST_20          jp      CALL2BASIC
33
 
34
                ret
35
 
36
loc_24          ld      h,d
37
                ld      l,e
38
                jr      loc_2B
39
 
40
RST_28          jp      ADR_OPEN_CHAN
41
 
42
loc_2B          ld      (hl),2
43
                dec     hl
44
                cp      h
45
                jr      nz,loc_2B
46
                jr      loc_3A
47
 
48
                DUPL 0X0038-$,0FFh
49
RST_38          ei
50
                ret
51
 
52
loc_3A          or      a
53
                sbc     hl,de
54
                add     hl,de
55
                inc     hl
56
                jr      nc,loc_47
57
                dec     (hl)
58
                jr      z,loc_47
59
                dec     (hl)
60
                jr      z,loc_3A
61
loc_47          dec     hl
62
loc_48          ld      (P_RAMT),hl
63
                ld      de,3EAFh        ; €„…‘ UDG ‚ ‡“ 48Š
64
                ld      bc,0A8h
65
                ld      a,e
66
                ex      de,hl
67
                ld      sp,6000h
68
                ld      (TRD_5F00),hl
69
                ld      hl,loc_79
70
                push    hl
71
                ld      hl,loc_3D2F
72
                push    hl
73
                ld      hl,0B8EDh       ; LDDR
74
                jr      EXECUTECOM2HL
75
 
76
                jp      MAGIC
77
 
78
EXECUTECOM2HL   ld      (TRD_5F10),hl
79
                push    af
80
                ld      a,0C9h
81
                ld      (TRD_5F12),a
82
                pop     af
83
                ld      hl,(TRD_5F00)
84
                jp      TRD_5F10
85
 
86
loc_79          ex      de,hl
87
                inc     hl
88
                ld      (UDG),hl
89
                dec     hl
90
;===============PATCH
91
;               ld      bc,1E40h
92
                ld      bc,0x40                         ;€„Ž…‹ ’Ž’ ˆ‘Š Ž ‘Ž‘“
93
;===============PATCH
94
                ld      (RASP), bc
95
                ld      (RAMTOP),hl
96
                ld      hl,3C00h        ; €„…‘ Ž‘Ž‚ŽƒŽ ”Ž’€ ‚ 48Š
97
                ld      (CHARS),hl
98
                ld      hl,(RAMTOP)
99
                ld      (hl),3Eh
100
                dec     hl
101
                ld      sp,hl
102
                dec     hl
103
                dec     hl
104
                ld      (ERR_SP),hl
105
                ld      de,1303h
106
                push    de
107
                im      1
108
                ld      iy,ERR_NR
109
                ld      hl,TRD_5CB6     ; „‹Ÿ Ž‚…Šˆ €‹ˆ—ˆŸ INTERFACE1
110
                ld      (CHANS),hl
111
                ld      de,15AFh
112
                ld      bc,15h
113
                ex      de,hl
114
                call    COPY_BAS2VARS
115
                ex      de,hl
116
                dec     hl
117
                ld      (DATADD),hl
118
                inc     hl
119
                ld      (PROG),hl
120
loc_BE          ld      (VARS),hl
121
                ld      (hl),80h
122
                inc     hl
123
                ld      (E_LINE),hl     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
124
                ld      (hl),0Dh
125
                inc     hl
126
                ld      (hl),80h
127
                inc     hl
128
                ld      (WORKSP),hl
129
                ld      (STKBOT),hl
130
                ld      (STKEND),hl
131
                ld      a,38h
132
                ld      (ATTR_P),a
133
                ld      (ATTR_T),a
134
                ld      (BORDCR),a
135
                ld      hl,523h
136
                ld      (REPDEL),hl
137
                dec     (iy-3Ah)
138
                dec     (iy-36h)
139
                ld      hl,15C6h
140
                ld      de,STRMS
141
                ld      bc,0Eh
142
                call    COPY_BAS2VARS
143
                set     1,(iy+1)
144
                ld      hl,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
145
                ld      (hl),0C9h
146
                rst     20h
147
                dw 0EDFh                ; ฎ็จแโช  กใไฅเ  ฏเจญโฅเ 
148
                ld      hl,DF_SZ
149
                ld      (hl),2
150
                ld      hl,128Bh
151
                push    hl
152
                ld      a,0AAh
153
;===============PATCH
154
;               ld      (SWAP),a
155
                ld      (NOT_USED),a
156
;===============PATCH
157
                ei
158
                jp      IN_DOS_15616
159
 
160
COPY_BAS2VARS   ld      (TRD_5F00),hl
161
                ld      hl,loc_3D2F
162
                push    hl
163
                ld      hl,0B0EDh       ; LDIR
164
                ld      (TRD_5F10),hl
165
                ld      hl,(TRD_5F00)
166
                jp      TRD_5F10
167
 
168
WORK4AUTORUN    call    DELETE_BUF      ; ށ€Ž’Š€ ŽŒ…€ ‘’ŽŠˆ €‚’Ž‘’€’€ Žƒ€ŒŒ› € …‰‘ˆŠ…
169
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
170
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
171
                inc     hl
172
                ld      e,(hl)
173
                inc     hl
174
                ld      d,(hl)
175
                ld      a,d
176
                or      e
177
                ex      de,hl
178
                jr      z,loc_140
179
                xor     a
180
                ld      (TRD_5D10),a    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
181
loc_140         push    hl
182
                call    RESTORE_SP      ; ‚Ž‘‘’€Ž‚‹…ˆ… ……•‚€’—ˆŠ€ Ž˜ˆŽŠ
183
                pop     hl
184
                ld      (NEWPPC),hl
185
                xor     a
186
                ld      (NSPPS),a
187
                rst     20h
188
                dw 16B0h                ; ใแโ ญฎขช  ฎกซ แโจ เฅค ชโจเฎข ญจ๏ คฎ ฌจญจฌใฌ 
189
                ld      hl,(PROG)
190
                dec     hl
191
                ld      (DATADD),hl
192
                ld      sp,(ERR_SP)
193
                ld      a,(TRD_5D10)    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
194
                or      a
195
                ld      hl,1B76h
196
                jr      z,loc_166
197
                rst     20h
198
                dw 1BB0h                ; แฎฎก้ฅญจฅ "Ok"
199
loc_166         push    hl
200
                ld      hl,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
201
                push    hl
202
                ret
203
 
204
loc_16C
205
;===============PATCH
206
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
207
                DUPL 3,0
208
;===============PATCH
209
                call    CREATE_BUF      ; ‘އ„€ˆ… “”…€
210
                ld      a,0FFh
211
                ld      (TRD_5D15),a    ; …‘‹ˆ 0,…—€’€’œ ˜€Š“ TR-DOS.ˆ€—… … …—€’€’œ
212
                xor     a
213
                ld      (TRD_5CF7),a
214
                ld      a,0AAh
215
                ld      (TRD_5D17),a    ; ˆ‘Ž‚€ˆ… ‡€‘’€‚Šˆ,…‘‹ˆ #AA
216
                ld      hl,CP_ERROR     ; Ž‚…Š€ € Ž˜ˆŠ“
217
                ld      (TRD_5D1A),hl   ; ‚“’…ˆ‰ €„…‘ ‡€‚…˜…ˆŸ ˆ’……’€’ސ€ ŠŽŒ€„
218
                ld      hl,0
219
                add     hl,sp
220
                ld      (TRD_5D1C),hl   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
221
                dec     hl
222
                dec     hl
223
                ld      sp,hl
224
                call    MARK_SP         ; “‘’€Ž‚Š€ ‘’…Š€ „‹Ÿ ……•‚€’€ Ž˜ˆŽŠ
225
                ld      hl,(RAMTOP)
226
                ld      de,(CH_ADD)
227
                sbc     hl,de
228
                ex      de,hl
229
                jr      nc,loc_1A5
230
                or      a
231
                ld      de,257
232
                sbc     hl,de
233
loc_1A5         ld      (CH_ADD),hl
234
loc_1A8         call    CP_0D_OR_80
235
loc_1AB         jp      z,END_COMAND
236
                cp      0EAh            ; REM
237
                inc     hl
238
                jr      nz,loc_1A8
239
                call    CP_0D_OR_80
240
                jr      z,loc_1AB
241
                cp      ':'
242
                jp      nz,END_COMAND
243
                inc     hl
244
                call    SAE2_HL_
245
                ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
246
                jp      loc_30A
247
 
248
CP_0D_OR_80     ld      a,(hl)
249
                cp      0Dh
250
                ret     z
251
                cp      80h
252
                ret     z
253
                or      a
254
                ret
255
 
256
                call    REWRITE_9SEC
257
; Ž„Žƒ€ŒŒ€ ‡€‚…˜…ˆŸ ŠŽŒ€„ŽƒŽ Ž–…‘‘ސ€
258
END_COMAND      ld      hl,0
259
                ld      (TRD_5CF8),hl   ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
260
                call    DELETE_BUF
261
                call    CLEAR_WORKSPACE
262
                ld      hl,TRD_5D17     ; ˆ‘Ž‚€ˆ… ‡€‘’€‚Šˆ,…‘‹ˆ #AA
263
                ld      (hl),0AAh
264
                ld      hl,TRD_5D1F
265
                ld      a,(hl)
266
                or      a
267
                ld      (hl),0
268
                jr      nz,loc_1F3
269
                call    DEL_5BYTES
270
                call    FIND_ENDSTR     ; Žˆ‘Š ŠŽ–€ ‘’ŽŠˆ
271
loc_1F3         ld      sp,(TRD_5D1C)   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
272
                ld      hl,(TRD_5D1A)   ; ‚“’…ˆ‰ €„…‘ ‡€‚…˜…ˆŸ ˆ’……’€’ސ€ ŠŽŒ€„
273
                ld      bc,(TRD_5D0F)   ; ŽŒ… Ž˜ˆŠˆ TR-DOS
274
                ld      b,0
275
                jp      (hl)
276
 
277
CP_ERROR        call    RESTORE_SP      ; Ž‚…Š€ € Ž˜ˆŠ“
278
                bit     7,(iy+0)
279
                ret     nz
280
                ld      de,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
281
                ld      sp,(ERR_SP)
282
                push    de
283
                ret
284
 
285
; Žˆ‘Š ŠŽ–€ ‘’ŽŠˆ
286
FIND_ENDSTR     call    GET_SYMSTR
287
                cp      0Dh
288
                ret     z
289
                call    GET_NEXT_SYM
290
                jr      FIND_ENDSTR     ; Žˆ‘Š ŠŽ–€ ‘’ŽŠˆ
291
 
292
; “‘’€Ž‚Š€ ‘’…Š€ „‹Ÿ ……•‚€’€ Ž˜ˆŽŠ
293
MARK_SP         ld      hl,(ERR_SP)
294
                ld      (TRD_5D13),hl   ; ŠŽˆŸ ERR_SP
295
                ld      hl,(TRD_5D1C)   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
296
                dec     hl
297
                dec     hl
298
                ld      (ERR_SP),hl
299
                ld      de,loc_3D16
300
                ld      (hl),e
301
                inc     hl
302
                ld      (hl),d
303
                ret
304
 
305
; ‚Ž‘‘’€Ž‚‹…ˆ… ……•‚€’—ˆŠ€ Ž˜ˆŽŠ
306
RESTORE_SP      ld      hl,(TRD_5D13)   ; ŠŽˆŸ ERR_SP
307
loc_235         ld      (ERR_SP),hl
308
                ret
309
 
310
IN_COMMAND_CPU  ld      hl,0            ; ‚•ކ„…ˆ… ‚ ŠŽŒ€„›‰ Ž–…‘‘ސ „Ž‘€
311
                ld      (TRD_5CF7),hl
312
                add     hl,sp
313
                ld      (TRD_5D1C),hl   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
314
                dec     hl
315
                dec     hl
316
                ld      sp,hl
317
                call    MARK_SP         ; “‘’€Ž‚Š€ ‘’…Š€ „‹Ÿ ……•‚€’€ Ž˜ˆŽŠ
318
;===============PATCH
319
;2 ‚›‡Ž‚€ ………‘…› „‹Ÿ “‘’€…ˆŸ Ž€„€ˆŸ Š“‘ސ€
320
;ˆ Ž‚’ސŽŒ ‚•Ž„… ‚ TR-DOS ˆ‡ Œ…ž BASIC 128
321
                call    CLEAR_SCREEN                    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
322
                call    OPEN_CHAN_2                     ; ޒА›’ˆ… Š€€‹€ 2
323
;===============PATCH
324
                ld      hl,TRD_5D17     ; ˆ‘Ž‚€ˆ… ‡€‘’€‚Šˆ,…‘‹ˆ #AA
325
                ld      a,(hl)
326
                cp      0AAh
327
                ld      a,0
328
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
329
                jp      z,COMMAND_CPU
330
                ld      (hl),0AAh
331
;===============PATCH
332
;               call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
333
;               call    OPEN_CHAN_2     ; ޒА›’ˆ… Š€€‹€ 2
334
;===============PATCH
335
                ld      hl,ZASTAVKA     ; FIX
336
                                        ; ’…Š‘’ ‡€‘’€‚Šˆ „Ž‘€
337
                rst     18h
338
                call    OUT_COLOR_LINE  ; ˆ‘Ž‚€ˆ… –‚…’›• ‹ˆˆ‰ ‡€‘’€‚Šˆ „Ž‘€
339
;===============PATCH
340
;               ld      a,(TRD_5CB6)    ; „‹Ÿ Ž‚…Šˆ €‹ˆ—ˆŸ INTERFACE1
341
;               cp      0F4h
342
;               jr      z,loc_271       ; Ž‚…Š€ € #AA
343
;               ld      hl,TXT_INTERFACE1 ; ’…Š‘’ €‹ˆ—ˆŸ INTERFACE1
344
;               rst     18h
345
;loc_271                ld      a,(SWAP)        ; Ž‚…Š€ € #AA
346
                DUPL 0X271-$,0
347
                LD A,(NOT_USED)
348
;===============PATCH
349
                cp      0AAh
350
                jr      nz,COMMAND_CPU  ; …‘‹ˆ … #AA,’Ž ‚•Ž„ ‚ ŠŽŒ€„›‰ Ž–…‘‘ސ
351
;===============PATCH
352
;               call    CP_INTERFACE1   ; ˆ€—… €‚’އ€“‘Š BOOT ‘ „ˆ‘Š€
353
                DUPL 3,0
354
;===============PATCH
355
loc_27B         ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
356
                ld      a,0FEh
357
                ld      (TRD_5D0E),a    ; #FE-€Ž’€…’ BASIC,ˆ€—… TR-DOS
358
                ld      (hl),0F7h
359
                inc     hl
360
                ld      (hl),'"'
361
                inc     hl
362
                ld      (hl),'b'
363
                inc     hl
364
                ld      (hl),'o'
365
                inc     hl
366
                ld      (hl),'o'
367
                inc     hl
368
                ld      (hl),'t'
369
                inc     hl
370
                ld      (hl),'"'
371
                inc     hl
372
                ld      (K_CUR),hl
373
                ld      (hl),0Dh
374
                inc     hl
375
                ld      (hl),80h
376
                inc     hl
377
                ld      (WORKSP),hl
378
                ld      (STKBOT),hl
379
                ld      (STKEND),hl
380
                set     3,(iy+1)
381
                jr      GO2RUNBOOT
382
 
383
; ……Ž‘ 3 €‰’
384
LDI3_HL2DE      ld      b,3
385
loc_2B2         ld      a,(hl)
386
                ld      (de),a
387
                inc     hl
388
                inc     de
389
                djnz    loc_2B2
390
                ret
391
 
392
; FIX
393
; Ž‘’€Ž‚Š€ ŒŽ’ސ€ „ˆ‘ŠŽ‚Ž„€
394
STOP_MOTOR      ld      b,20h
395
loc_2BB         push    bc
396
                xor     8
397
                out     (0FFh),a
398
                push    af
399
                ld      a,5
400
                call    PAUSE_C_A
401
                pop     af
402
                pop     bc
403
                djnz    loc_2BB
404
                ret
405
 
406
COMMAND_CPU     ld      hl,(TRD_5D1C)   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
407
                dec     hl
408
                dec     hl
409
                ld      sp,hl
410
;===============PATCH
411
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
412
;===============PATCH
413
                call    OPEN_CHAN_0     ; ޒА›’ˆ… Š€€‹€ 0
414
                ld      a,(TRD_5D16)    ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
415
                or      3
416
                call    STOP_MOTOR      ; FIX
417
                                        ; Ž‘’€Ž‚Š€ ŒŽ’ސ€ „ˆ‘ŠŽ‚Ž„€
418
                ld      a,(TRD_5D16)    ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
419
                call    STOP_MOTOR      ; FIX
420
                                        ; Ž‘’€Ž‚Š€ ŒŽ’ސ€ „ˆ‘ŠŽ‚Ž„€
421
                xor     a
422
                ld      (TRD_5D15),a    ; …‘‹ˆ 0,…—€’€’œ ˜€Š“ TR-DOS.ˆ€—… … …—€’€’œ
423
                call    GET_COMMAND     ; ˆŸ’ˆ… ˆ ށ€Ž’Š€ ŠŽŒ€„
424
                call    SAE2E_LINE
425
GO2RUNBOOT      call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
426
                ld      hl,COMMAND_CPU
427
                ld      (TRD_5D1A),hl   ; ‚“’…ˆ‰ €„…‘ ‡€‚…˜…ˆŸ ˆ’……’€’ސ€ ŠŽŒ€„
428
                xor     a
429
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
430
;===============PATCH
431
                LD (TRD_5CEF),A
432
;===============PATCH
433
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
434
                push    hl
435
                ld      de,TRD_5D20     ; „‹Ÿ ‘Ž•€…ˆŸ 3 ‘ˆŒ‚ދނ ‚‚…„…Ž‰ ‘’ŽŠˆ
436
                call    LDI3_HL2DE      ; ……Ž‘ 3 €‰’
437
                pop     hl
438
                ld      (TRD_5D11),hl   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
439
loc_30A         ld      a,(hl)
440
                ld      b,a
441
                and     80h
442
                ld      a,b
443
                jr      z,loc_31A
444
                cp      0FEh            ; RETURN
445
                jr      z,loc_31A
446
                push    af
447
                call    ACTIV_DEF_DISK  ; ‚›Ž „ˆ‘ŠŽ‚Ž„€ Ž “ŒŽ‹—€ˆž
448
                pop     af
449
loc_31A         ld      hl,CODE_BYTE_COM ; ’€‹ˆ–€ …‰‘ˆŠ ŠŽŒ€„ „‹Ÿ TR-DOS
450
                                        ; CAT
451
                dec     hl
452
                ld      c,0
453
loc_320         inc     c
454
                ld      d,a
455
                ld      a,15h
456
                cp      c
457
;===============PATCH
458
                jp      c,END_COMAND
459
;               JP C,ENDCOMAND
460
;===============PATCH
461
                ld      a,d
462
                inc     hl
463
                cp      (hl)
464
                jr      nz,loc_320
465
                cp      0FEh            ; RETURN
466
                call    nz,CREATE_BUF   ; ‘އ„€ˆ… “”…€
467
                ld      a,9
468
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
469
                xor     a
470
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
471
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
472
                ld      (TRD_5D10),a    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
473
                ld      hl,FLAGS
474
                res     7,(hl)
475
                ld      b,0
476
                ld      hl,SPIS_ADR_COM ; ’€‹ˆ–€ €„…‘Ž‚ ˆ‘Ž‹…ˆŸ ŠŽŒ€„
477
                dec     c
478
                sla     c
479
                add     hl,bc
480
                ld      e,(hl)
481
                inc     hl
482
                ld      d,(hl)
483
                ex      de,hl
484
LOC_353         push    hl
485
                ld      de,END_COM
486
                push    de
487
                jp      (hl)
488
 
489
END_COM         ld      hl,FLAGS
490
                set     7,(hl)
491
                pop     hl
492
                jp      (hl)
493
 
494
; FIX
495
; ’…Š‘’ ‡€‘’€‚Šˆ „Ž‘€
496
ZASTAVKA        db 16h,1,5,"* TR-DOS Ver 5.03 *",0Dh,0Dh,7Fh
497
                db " 1986 Technology Research Ltd.",16h,5,0Bh
498
                db "(U.K.)",16h,7,5
499
                db "BETA 128",0
500
 
501
END_OUT_DIR     call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
502
                call    PRINT_0D
503
                call    PRINT_0D
504
loc_3B5         ld      bc,(TRD_5E0A)
505
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
506
                ld      hl,TXT_FREE_    ; " Free"
507
                rst     18h
508
GOTO_END        jp      END_COMAND
509
 
510
; …—€’œ ‘ŽŽ™…ˆŸ ށ Ž˜ˆŠ…
511
PRINT_ERROR     push    af
512
                ld      a,(TRD_5D0E)    ; #FE-€Ž’€…’ BASIC,ˆ€—… TR-DOS
513
                cp      0FEh
514
                jr      nz,CP4PRINT_HEAD
515
                pop     af
516
                ret
517
 
518
CP4PRINT_HEAD   pop     af
519
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
520
                ld      a,(TRD_5D15)    ; …‘‹ˆ 0,…—€’€’œ ˜€Š“ TR-DOS.ˆ€—… … …—€’€’œ
521
                or      a
522
                call    z,PRINT_MSG     ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
523
                ret
524
 
525
ERR_NOFILES     ld      hl,TXT_NOFILES_
526
                ld      a,1
527
                jp      PRINT_TXTERR
528
 
529
ERR_OK          ld      hl,TXT_OK_      ; "O.K."
530
                xor     a
531
                jp      PRINT_TXTERR
532
 
533
; —’…ˆ… ‘…Вސ€ 0 Š€’€‹Žƒ€
534
RD_0SEC2BUF     xor     a
535
                ld      (TRD_5CCC),a    ; ’…Š“™ˆ‰ ŽŒ… ‘…Вސ€ ˆ —’…ˆˆ Š€’€‹Žƒ€
536
; —’…ˆ… ‘…Вސ€ Š€’€‹Žƒ€ Ž ŽŒ…“
537
READ_NUM_SEC    ld      de,(TRD_5CCC)   ; ’…Š“™ˆ‰ ŽŒ… ‘…Вސ€ ˆ —’…ˆˆ Š€’€‹Žƒ€
538
                ld      d,0
539
READ_SEC4NEM    call    CREATE_BUF      ; ‘އ„€ˆ… “”…€
540
                ld      hl,TRD_5D25
541
                ld      b,1
542
                jp      COM_05          ; —’…ˆ… ‘…Вސނ
543
 
544
; —’…ˆ… 9 ‘…Вސ€
545
READ_9SEC       call    CREATE_BUF      ; ‘އ„€ˆ… “”…€
546
                ld      de,8
547
                jr      READ_SEC4NEM
548
 
549
; €‘’Ž‰Š€ € „ˆ‘Š…’“
550
COM_18          call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
551
                ld      a,(TRD_5E0C)
552
                cp      10h
553
                jr      z,CP_TYPE_DISK
554
                ld      hl,TXT_DISCERROR_
555
                rst     18h
556
                jr      GOTO_END
557
 
558
CP_TYPE_DISK    call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
559
                res     0,(hl)
560
                res     1,(hl)
561
                ld      a,(TRD_5E08)
562
                bit     0,a
563
                jr      nz,loc_425
564
                set     0,(hl)
565
loc_425         bit     3,a
566
                ret     nz
567
                set     1,(hl)
568
                ret
569
 
570
; Ž‚…Š€ ‘‹…„“ž™…ƒŽ ‘ˆŒ‚Ž‹€
571
CP_SECOND_SYM   ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
572
                inc     hl
573
                ld      a,(hl)
574
                cp      0Dh
575
                ret
576
 
577
CAT             call    CP_SECOND_SYM   ; ‚›Ž‹…ˆ… ŠŽŒ€„› CAT
578
                ld      bc,2
579
                ld      (TRD_5CDB),bc
580
                jr      z,loc_46A
581
                cp      "#"
582
                jr      nz,CODES
583
                ld      (CH_ADD),hl
584
                call    SET_NUM_CHAN
585
                call    GET_SYMSTR
586
                cp      0Dh
587
                jr      z,loc_46A
588
                cp      ","
589
                jp      nz,SINTAX_ERROR
590
                call    GET_NEXT_SYM
591
                call    PUT_NUMDSK_STK
592
                jr      loc_460
593
 
594
CODES           call    SET_AND_PUT
595
loc_460         call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
596
                call    GET_STKBOT_
597
                ex      de,hl
598
                call    SETUP_DISK
599
loc_46A         call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
600
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
601
                ld      (TRD_5CF9),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
602
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
603
                ld      a,(TRD_5CDB)
604
loc_479         cp      2
605
                push    af
606
                call    z,CLEAR_SCREEN  ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
607
                pop     af
608
                cp      11h
609
                jp      nc,SINTAX_ERROR
610
                call    OPENSTREAM
611
                ld      a,0FFh
612
                ld      (TRD_5CF8),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
613
                ld      hl,TXT_TITLE_   ; "Title:"
614
                rst     18h
615
                ld      hl,TRD_5E1A
616
                rst     18h
617
                call    PRINT_0D
618
                ld      a,(TRD_5E09)
619
                ld      hl,TRD_5E19
620
                sub     (hl)
621
                push    hl
622
                call    PRINT_CHISLO_A_
623
                ld      hl,TXT_FILES_   ; " File(s)"
624
                rst     18h
625
                pop     hl
626
                ld      c,(hl)
627
                call    CONV2_2BYTES
628
                ld      hl,TXT_DELFILE_ ; " Del. File"
629
                rst     18h
630
                call    RD_0SEC2BUF     ; —’…ˆ… ‘…Вސ€ 0 Š€’€‹Žƒ€
631
                ld      hl,TRD_5D25
632
loc_4B6         call    CP_END_DIR      ; Ž‚…Š€ ŽŠŽ—€ˆŸ „ˆ…Вސˆˆ
633
                call    PRINT_0D
634
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
635
                add     a,"A"
636
                rst     10h
637
                ld      b,2
638
loc_4C4         call    CP_END_DIR      ; Ž‚…Š€ ŽŠŽ—€ˆŸ „ˆ…Вސˆˆ
639
                push    bc
640
                ld      a,":"
641
                rst     10h
642
                push    hl
643
                call    PRINT_FILENAME  ; …—€’œ ˆŒ…ˆ ”€‰‹€
644
                ld      bc,0Dh
645
                pop     hl
646
                push    hl
647
                add     hl,bc
648
                ld      c,(hl)
649
                push    bc
650
                ld      a,c
651
                ld      b,2
652
                cp      10
653
                jr      c,loc_4DF
654
                dec     b
655
loc_4DF         cp      100
656
                jr      nc,loc_4E8
657
loc_4E3         ld      a," "
658
                rst     10h
659
                djnz    loc_4E3
660
loc_4E8         pop     bc
661
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
662
                pop     hl
663
                pop     bc
664
                ld      de,10h
665
                add     hl,de
666
                djnz    loc_4C4
667
                jr      loc_4B6
668
 
669
; Ž‚…Š€ ŽŠŽ—€ˆŸ „ˆ…Вސˆˆ
670
CP_END_DIR      push    hl
671
                push    bc
672
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
673
                ld      hl,TRD_5CF6     ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
674
                cp      (hl)
675
                call    nz,COM_01       ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
676
                pop     bc
677
                pop     hl
678
                jp      CP_END_CAT
679
 
680
ADD_10          ld      de,10h
681
                add     hl,de
682
                ret
683
 
684
; Ž‚…Š€ € ŠŽ…– “”…€
685
CP_END_BUF      push    hl
686
                push    bc
687
                ld      bc,0A1DBh
688
                add     hl,bc
689
                jr      c,READ_SEC2BUF
690
                pop     bc
691
                pop     hl
692
                ret
693
 
694
READ_SEC2BUF    ld      hl,TRD_5CCC     ; ’…Š“™ˆ‰ ŽŒ… ‘…Вސ€ ˆ —’…ˆˆ Š€’€‹Žƒ€
695
                inc     (hl)
696
                call    READ_NUM_SEC    ; —’…ˆ… ‘…Вސ€ Š€’€‹Žƒ€ Ž ŽŒ…“
697
                pop     bc
698
                pop     hl
699
                ld      hl,TRD_5D25
700
                ret
701
 
702
NUMDSK2BYTE     and     0DFh
703
                sbc     a,"A"
704
                jp      c,SINTAX_ERROR
705
                cp      4
706
                jp      nc,SINTAX_ERROR
707
                ret
708
 
709
CP_ON_STKBOT    call    GET_STKBOT_
710
                ld      a,c
711
;===============PATCH
712
;               cp      b               ; „Ž‹†Ž ›’œ OR B
713
                OR B
714
;===============PATCH
715
                jp      z,SINTAX_ERROR
716
                ret
717
 
718
NEW             call    INP_STR2STKBOT
719
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
720
                call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
721
                call    SET_CP_FILENAME
722
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
723
                ld      (TRD_5CF8),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
724
                jp      nz,ERR_NOFILES
725
                push    bc
726
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
727
                call    SET_CP_FILENAME
728
                push    af
729
                ld      a,(TRD_5CF8)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
730
                ld      hl,TRD_5CF6     ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
731
                cp      (hl)
732
                jp      nz,SINTAX_ERROR
733
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
734
                pop     af
735
                jp      z,FILE_EXISTS
736
                pop     bc
737
loc_569         call    SETHEADFILENAME
738
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
739
                jp      ERR_OK
740
 
741
CP_HIGH_ERR     ld      a,(TRD_5D10)    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
742
                or      a
743
                ret
744
 
745
CP_ERASED_FILES ld      a,(TRD_5D07)    ; ‘—…’—ˆŠ “„€‹…›• ”€‰‹Ž‚
746
                or      a
747
                jp      z,ERR_NOFILES
748
                jp      ERR_OK
749
 
750
; ‡€Ž‘ € “„€‹…ˆ… ”€‰‹€
751
GET_OVERWRITE_  push    bc
752
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
753
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
754
                add     a,"A"
755
                call    PRINT_A_
756
                ld      a,":"
757
                call    PRINT_A_
758
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
759
                call    PRINT_FILENAME  ; …—€’œ ˆŒ…ˆ ”€‰‹€
760
                ld      hl,TXT_FILEEXIST ; "File exists"
761
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
762
                call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
763
                cp      "Y"
764
                push    af
765
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
766
                pop     af
767
                pop     bc
768
                ret     nz
769
                push    bc
770
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
771
                pop     bc
772
                call    ERASE_FILE      ; “„€‹…ˆ… ”€‰‹€
773
                xor     a
774
                ret
775
 
776
CP_EXT_SHARP    ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
777
                cp      "#"
778
                jr      z,FINDFILENAME_0A
779
                xor     a
780
                ret
781
 
782
FINDFILENAME_0A ld      a,0Ah
783
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
784
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
785
                ld      a,9
786
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
787
                ret
788
 
789
COPY_STAR_STAR  ld      a,(TRD_5CDD)    ; ‚›Ž‹…ˆ… ŠŽŒ€„› COPY *,*
790
                cp      "*"
791
                jp      nz,ERR_NOFILES
792
                call    GET_STKBOT_
793
                ex      de,hl
794
                call    SETUP_DISK
795
                ld      a,(hl)
796
                cp      "*"
797
                jp      nz,SINTAX_ERROR
798
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
799
                ld      (TRD_5CF9),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
800
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
801
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
802
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
803
                ld      a,0FFh
804
                ld      (TRD_5D0D),a
805
loc_5F4         ld      a,(TRD_5CF8)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
806
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
807
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
808
                ld      a,(TRD_5D0D)
809
                inc     a
810
                ld      (TRD_5D0D),a
811
                ld      c,a
812
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
813
                ld      a,(TRD_5CDD)    ; ˆŒŸ ”€‰‹€
814
                cp      0
815
                jp      z,ERR_OK
816
                cp      1
817
                jr      z,loc_5F4
818
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
819
                ld      de,TRD_5CED     ; ŽŒ… …‚ŽƒŽ ’…Š€ ”€‰‹€
820
                ld      bc,7
821
                ldir
822
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
823
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
824
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
825
                jr      nz,loc_634
826
                call    CP_EXT_SHARP
827
                jr      nz,loc_634
828
                call    GET_OVERWRITE_  ; ‡€Ž‘ € “„€‹…ˆ… ”€‰‹€
829
                jr      nz,loc_5F4
830
loc_634         call    COPYFILE_ON2DSK ; ŠŽˆŽ‚€ˆ… ”€‰‹Ž‚ € 2 „ˆ‘ŠŽ‚Ž„€•
831
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
832
                jr      loc_5F4
833
 
834
; ŠŽˆŽ‚€ˆ… ”€‰‹Ž‚ € 2 „ˆ‘ŠŽ‚Ž„€•
835
COPYFILE_ON2DSK call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
836
                ld      a,(TRD_5E09)
837
                cp      80h
838
;===============PATCH
839
;               jp      z,loc_1C45      ; „Ž‹†… ›’œ ……•Ž„ € 0X2723
840
                JP Z,ERR_DIRFULL
841
;===============PATCH
842
                ld      hl,TRD_5CED     ; ŽŒ… …‚ŽƒŽ ’…Š€ ”€‰‹€
843
                ld      de,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
844
                ld      bc,7
845
                ldir
846
                ld      de,(TRD_5CEA)   ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
847
                ld      d,0
848
                or      a
849
                ld      hl,(TRD_5E0A)
850
                sbc     hl,de
851
                jp      c,loc_1C45
852
                ld      (TRD_5E0A),hl
853
                ld      hl,(TRD_5E06)
854
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
855
                push    hl
856
                call    COPY_FILE       ; ŠŽˆŽ‚€ˆ… ”€‰‹€ € 2 „ˆ‘ŠŽ‚Ž„€•
857
                pop     hl
858
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
859
                ld      hl,(TRD_5CF4)
860
                ld      (TRD_5E06),hl
861
                ld      hl,TRD_5E09
862
                inc     (hl)
863
                ld      c,(hl)
864
                dec     c
865
                ld      b,0
866
                push    bc
867
                ld      de,9
868
                ld      (TRD_5CF4),de
869
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
870
                pop     bc
871
                call    SETHEADFILENAME
872
                ret
873
 
874
COPY            ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
875
                inc     hl
876
                ld      a,(hl)
877
                and     0DFh
878
                cp      "S"
879
                jp      z,COPY_S
880
                cp      "B"
881
                jp      z,COPY_B
882
                call    INP_STR2STKBOT
883
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
884
                call    RESERVED_RAM
885
                call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
886
                call    SET_CP_FILENAME
887
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
888
                ld      (TRD_5CF8),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
889
                jp      nz,COPY_STAR_STAR ; ‚›Ž‹…ˆ…  ŠŽŒ€„› COPY *,*
890
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
891
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
892
                ld      de,TRD_5CED     ; ŽŒ… …‚ŽƒŽ ’…Š€ ”€‰‹€
893
                ld      bc,7
894
                ldir
895
                call    SET_CP_FILENAME
896
                push    af
897
                push    bc
898
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
899
                ld      (TRD_5CF9),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
900
                ld      a,(TRD_5CF8)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
901
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
902
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
903
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
904
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
905
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
906
                pop     bc
907
                pop     af
908
                jr      nz,loc_6F3
909
                call    CP_EXT_SHARP
910
                jr      nz,loc_6F3
911
                call    GET_OVERWRITE_  ; ‡€Ž‘ € “„€‹…ˆ… ”€‰‹€
912
                jp      nz,ERR_OK
913
loc_6F3         call    COPYFILE_ON2DSK ; ŠŽˆŽ‚€ˆ… ”€‰‹Ž‚ € 2 „ˆ‘ŠŽ‚Ž„€•
914
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
915
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
916
                cp      "#"
917
                jp      nz,ERR_OK
918
                ld      a,10
919
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
920
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
921
                inc     (hl)
922
                ld      a,(TRD_5CF8)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
923
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
924
                call    CP_EXT_SHARP
925
                jp      nz,ERR_OK
926
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
927
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
928
                ld      de,TRD_5CED     ; ŽŒ… …‚ŽƒŽ ’…Š€ ”€‰‹€
929
                ld      bc,7
930
                ldir
931
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
932
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
933
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
934
                jr      loc_6F3
935
 
936
; ŠŽˆŽ‚€ˆ… ”€‰‹€ € 2 „ˆ‘ŠŽ‚Ž„€•
937
COPY_FILE       ld      a,(TRD_5CF1)
938
                or      a
939
                ret     z
940
                push    hl
941
                ld      hl,TRD_5D23
942
                sub     (hl)
943
                pop     hl
944
                jr      nc,loc_775
945
                ld      a,(TRD_5CF1)
946
                ld      b,a
947
                xor     a
948
                ld      (TRD_5CF1),a
949
loc_744         push    bc
950
                ld      a,(TRD_5CF8)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
951
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
952
                pop     bc
953
                push    bc
954
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
955
                push    hl
956
                ld      de,(TRD_5CF2)
957
                call    COM_05          ; —’…ˆ… ‘…Вސނ
958
                ld      hl,(TRD_5CF4)
959
                ld      (TRD_5CF2),hl
960
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
961
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
962
                pop     hl
963
                pop     bc
964
                ld      de,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
965
                call    COM_06          ; ‡€ˆ‘œ ‘…Вސނ
966
                ld      hl,(TRD_5CF4)
967
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
968
                jr      COPY_FILE       ; ŠŽˆŽ‚€ˆ… ”€‰‹€ € 2 „ˆ‘ŠŽ‚Ž„€•
969
 
970
loc_775         ld      (TRD_5CF1),a
971
                push    hl
972
                ld      hl,TRD_5D23
973
                ld      b,(hl)
974
                pop     hl
975
                xor     a
976
                jr      loc_744
977
 
978
; “„€‹…ˆ… ”€‰‹€
979
ERASE_FILE      xor     a
980
                ld      (TRD_5D07),a    ; ‘—…’—ˆŠ “„€‹…›• ”€‰‹Ž‚
981
                jr      ERASE_FILES     ; “„€‹…ˆ… ”€‰‹€ € „ˆ‘Š…
982
 
983
ERASE           call    SET_AND_PUT
984
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
985
                call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
986
                xor     a
987
                ld      (TRD_5D07),a    ; ‘—…’—ˆŠ “„€‹…›• ”€‰‹Ž‚
988
                call    FIND_FILE       ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ
989
                call    ERASE_FILES     ; “„€‹…ˆ… ”€‰‹€ € „ˆ‘Š…
990
                jp      nz,CP_ERASED_FILES
991
                jp      ERR_OK
992
 
993
ERASE_FILES     ld      a,(TRD_5CDD)    ; “„€‹…ˆ… ”€‰‹€ € „ˆ‘Š…
994
                ld      (TRD_5D08),a    ; …‚›‰ ‘ˆŒ‚Ž‹ ˆŒ…ˆ ”€‰‹€
995
                ret     nz
996
                ld      hl,TRD_5D07     ; ‘—…’—ˆŠ “„€‹…›• ”€‰‹Ž‚
997
                inc     (hl)
998
                push    bc
999
                call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
1000
                ld      a,(TRD_5E09)
1001
                pop     bc
1002
                inc     c
1003
                cp      c
1004
                jr      nz,loc_7BC
1005
                dec     a
1006
                ld      (TRD_5E09),a
1007
                xor     a
1008
loc_7BC         push    af
1009
                jr      z,loc_7C3
1010
                ld      hl,TRD_5E19
1011
                inc     (hl)
1012
loc_7C3         push    bc
1013
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1014
                pop     bc
1015
                dec     c
1016
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1017
                pop     af
1018
                jp      z,loc_7D2
1019
                ld      a,1
1020
loc_7D2         ld      (TRD_5CDD),a    ; ˆŒŸ ”€‰‹€
1021
                push    af
1022
                call    WRHEAD_FILENAME ; ‘Ž•€…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1023
                ld      a,(TRD_5D08)    ; …‚›‰ ‘ˆŒ‚Ž‹ ˆŒ…ˆ ”€‰‹€
1024
                ld      (TRD_5CDD),a    ; ˆŒŸ ”€‰‹€
1025
                pop     af
1026
                jr      z,WR_NEW_FREE_SEC
1027
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
1028
                jr      ERASE_FILES     ; “„€‹…ˆ… ”€‰‹€ € „ˆ‘Š…
1029
 
1030
WR_NEW_FREE_SEC call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
1031
                ld      hl,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1032
                ld      (TRD_5E06),hl
1033
                ld      de,(TRD_5CEA)   ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1034
                ld      hl,(TRD_5E0A)
1035
                ld      d,0
1036
                add     hl,de
1037
                ld      (TRD_5E0A),hl
1038
                jp      REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1039
 
1040
;===============PATCH
1041
;               DUPL 0X1000-$,0FFh
1042
; ’…Š‘’ €‹ˆ—ˆŸ INTERFACE1
1043
;TXT_INTERFACE1 db 16h,9,5,"Interface one fitted",0
1044
                DUPL 0X1018-$,0XFF
1045
;===============PATCH
1046
 
1047
COM_STAR        call    SET_AND_PUT
1048
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1049
                call    CP_ON_STKBOT
1050
                ld      a,(de)
1051
                call    NUMDSK2BYTE
1052
                ld      (TRD_5D19),a    ; „ˆ‘ŠŽ‚Ž„ Ž “ŒŽ‹—€ˆž
1053
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
1054
                jp      ERR_OK
1055
 
1056
; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
1057
INP_EXTFILENAME ld      b,"C"
1058
                ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
1059
                or      a
1060
                jr      nz,loc_104D
1061
                call    GET_SYMSTR
1062
                cp      0AFh            ; CODE
1063
                ld      b,"C"
1064
                jr      z,loc_104D
1065
                cp      0E4h            ; DATA
1066
                ld      b,"D"
1067
                jr      z,loc_104D
1068
                cp      "#"
1069
                ld      b,"#"
1070
                jr      z,loc_104D
1071
                ld      b,"B"
1072
loc_104D        ld      hl,TRD_5CE5     ; €‘˜ˆ…ˆ… ”€‰‹€
1073
                ld      (hl),b
1074
                ret
1075
 
1076
; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1077
GET_KEYS        di
1078
                push    hl
1079
                push    bc
1080
                push    de
1081
loc_1056        rst     20h
1082
                dw 28Eh                 ; แช ญจเฎข ญจฅ ชซ ขจ โใเ๋
1083
                ld      c,0
1084
                jr      nz,loc_1056
1085
                rst     20h
1086
                dw 31Eh                 ; ฏเฎขฅเช  งญ ็ฅญจ๏ ญ ฆ โฎฉ ชซ ขจ่จ
1087
                jr      nc,loc_1056
1088
                dec     d
1089
                ld      e,a
1090
                rst     20h
1091
                dw 333h                 ; คฅชฎคจเฎข ญจฅ ชซ ขจ โใเ๋
1092
                pop     de
1093
                pop     bc
1094
                pop     hl
1095
                and     0DFh
1096
                ei
1097
                ret
1098
 
1099
; ˆ‘Ž‚€ˆ… –‚…’›• ‹ˆˆ‰ ‡€‘’€‚Šˆ „Ž‘€
1100
OUT_COLOR_LINE  ld      hl,58E5h
1101
                ld      b,0Ah
1102
loc_1073        ld      (hl),7
1103
                inc     hl
1104
                djnz    loc_1073
1105
                ld      (hl),2
1106
                inc     hl
1107
                ld      (hl),16h
1108
                inc     hl
1109
                ld      (hl),34h
1110
                inc     hl
1111
                ld      (hl),25h
1112
                inc     hl
1113
                ld      (hl),28h
1114
                inc     hl
1115
                ld      (hl),7
1116
                ld      hl,40EEh
1117
                ld      b,8
1118
                xor     a
1119
loc_108F        push    bc
1120
                scf
1121
                rla
1122
                push    hl
1123
                push    af
1124
                ld      b,5
1125
loc_1096        inc     hl
1126
                ld      (hl),a
1127
                djnz    loc_1096
1128
                pop     af
1129
                pop     hl
1130
                pop     bc
1131
                ld      de,100h
1132
                add     hl,de
1133
                djnz    loc_108F
1134
                ret
1135
 
1136
                ret
1137
 
1138
TXT_DELFILES    DB " Del."
1139
TXT_FILE_S_     DB " File(s)",0
1140
TXT_TITLE       DC "Title: "
1141
TXT_DISKDRIVE   db 17h,11h," Disk Drive: ",0
1142
TXT_1SPACE      db 17h,10h,20h,0
1143
TXT_40TRK_SS    db 17h,10h," 40 Track S. Side",0
1144
TXT_80TRK_SS    db 17h,10h," 80 Track S. Side",0
1145
TXT_40TRK_DS    db 17h,10h," 40 Track D. Side",0
1146
TXT_80TRK_DS    db 17h,10h," 80 Track D. Side",0
1147
TXT_FREESECS    db 17h,10h," Free Sector ",0
1148
TXT_FILENAME    db 0Dh,0Dh,"  File Name    Start Length Line",0
1149
 
1150
; ‘އ„€ˆ… “”…€ € 0X222 €‰’€
1151
CREATE_222BYTES ld      hl,(WORKSP)
1152
                ld      (TRD_5CCF),hl   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1153
                ld      bc,222h ; €‡Œ… ‘އ„€‚€…ŒŽƒŽ “”…€
1154
                jp      CREATE_FREERAM
1155
 
1156
PRINT_HL_CHISLO xor     a
1157
                ld      de,10000
1158
loc_1161        sbc     hl,de
1159
                jr      c,loc_1168
1160
                inc     a
1161
                jr      loc_1161
1162
 
1163
loc_1168        add     a,"0"
1164
                call    PRINT_A_CHISLO
1165
                add     hl,de
1166
                xor     a
1167
                ld      de,1000
1168
loc_1172        sbc     hl,de
1169
                jr      c,loc_1179
1170
                inc     a
1171
                jr      loc_1172
1172
 
1173
loc_1179        add     a,"0"
1174
                call    PRINT_A_CHISLO
1175
                add     hl,de
1176
                xor     a
1177
                ld      de,100
1178
loc_1183        sbc     hl,de
1179
                jr      c,loc_118A
1180
                inc     a
1181
                jr      loc_1183
1182
 
1183
loc_118A        add     a,"0"
1184
                call    PRINT_A_CHISLO
1185
                add     hl,de
1186
                xor     a
1187
                ld      de,10
1188
loc_1194        sbc     hl,de
1189
                jr      c,loc_119B
1190
                inc     a
1191
                jr      loc_1194
1192
 
1193
loc_119B        add     a,"0"
1194
                call    PRINT_A_CHISLO
1195
                add     hl,de
1196
                ld      a,l
1197
                add     a,"0"
1198
                call    PRINT_A_CHISLO
1199
                ret
1200
 
1201
PRINT_A_CHISLO  push    hl
1202
                push    de
1203
                call    PRINT_A_
1204
                pop     de
1205
                pop     hl
1206
                ret
1207
 
1208
FIND_END_BUFDIR push    hl
1209
                push    bc
1210
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
1211
                ld      hl,TRD_5CF6     ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
1212
                cp      (hl)
1213
                call    nz,COM_01       ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
1214
                pop     bc
1215
                pop     hl
1216
                call    CP_END_BUF      ; Ž‚…Š€ € ŠŽ…– “”…€
1217
                ld      a,(hl)
1218
                or      a
1219
                jp      z,END_COMAND
1220
                cp      1
1221
                call    z,ADD_10
1222
                ret     nz
1223
                jr      FIND_END_BUFDIR
1224
 
1225
LIST            call    CP_SECOND_SYM   ; Ž‚…Š€ ‘‹…„“ž™…ƒŽ ‘ˆŒ‚Ž‹€
1226
                ld      bc,2
1227
                ld      (TRD_5CDB),bc
1228
                jr      z,loc_1205
1229
                cp      "#"
1230
                jr      nz,LIST4CODES
1231
                ld      (CH_ADD),hl
1232
                call    SET_NUM_CHAN
1233
                call    GET_SYMSTR
1234
                cp      0Dh
1235
                jr      z,loc_1205
1236
                cp      ","
1237
                jp      nz,SINTAX_ERROR
1238
                call    GET_NEXT_SYM
1239
                call    PUT_NUMDSK_STK
1240
                jr      loc_11FB
1241
 
1242
LIST4CODES      call    SET_AND_PUT
1243
loc_11FB        call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1244
                call    GET_STKBOT_
1245
                ex      de,hl
1246
                call    SETUP_DISK
1247
loc_1205        call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1248
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
1249
                ld      (TRD_5CF9),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
1250
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1251
                ld      a,(TRD_5CDB)
1252
                cp      2
1253
                push    af
1254
                call    z,CLEAR_SCREEN  ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
1255
                pop     af
1256
                cp      11h
1257
                jp      nc,SINTAX_ERROR
1258
                call    OPENSTREAM
1259
                ld      a,0FFh
1260
                ld      (TRD_5CF8),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
1261
                call    CREATE_222BYTES ; ‘އ„€ˆ… “”…€ € 0X222 €‰’€
1262
                ld      hl,TRD_5E06
1263
                ld      de,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1264
                ld      bc,20h
1265
                ldir
1266
                call    RD_0SEC2BUF     ; —’…ˆ… ‘…Вސ€ 0 Š€’€‹Žƒ€
1267
                ld      hl,TRD_5D25
1268
                push    hl
1269
loc_123E        ld      hl,TXT_TITLE    ; "Title:"
1270
                push    bc
1271
                rst     18h
1272
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1273
                ld      bc,14h
1274
                add     hl,bc
1275
                rst     18h
1276
                ld      hl,TXT_DISKDRIVE
1277
                rst     18h
1278
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
1279
                add     a,"A"
1280
                call    PRINT_A_
1281
                call    PRINT_0D
1282
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1283
                ld      bc,3
1284
                add     hl,bc
1285
                ld      a,(hl)
1286
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1287
                ld      bc,13h
1288
                add     hl,bc
1289
                sub     (hl)
1290
                push    hl
1291
                call    PRINT_CHISLO_A_
1292
                ld      hl,TXT_FILE_S_  ; " File(s)"
1293
                rst     18h
1294
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1295
                ld      bc,2
1296
                add     hl,bc
1297
                ld      a,(hl)
1298
                ld      hl,TXT_40TRK_SS
1299
                cp      19h
1300
                jr      z,loc_1292
1301
                ld      hl,TXT_80TRK_SS
1302
                cp      18h
1303
                jr      z,loc_1292
1304
                ld      hl,TXT_40TRK_DS
1305
                cp      17h
1306
                jr      z,loc_1292
1307
                ld      hl,TXT_80TRK_DS
1308
loc_1292        rst     18h
1309
                pop     hl
1310
                ld      c,(hl)
1311
                call    CONV2_2BYTES
1312
                ld      hl,TXT_DELFILES ; " Del."
1313
                rst     18h
1314
                ld      hl,TXT_FREESECS
1315
                rst     18h
1316
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1317
                ld      bc,4
1318
                add     hl,bc
1319
                ld      c,(hl)
1320
                inc     hl
1321
                ld      b,(hl)
1322
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
1323
                ld      hl,TXT_FILENAME
1324
                rst     18h
1325
                pop     bc
1326
                pop     hl
1327
                ld      b,10h
1328
loc_12B5        call    FIND_END_BUFDIR
1329
                call    PRINT_0D
1330
                push    bc
1331
                push    hl
1332
                call    PRINT_FILENAME  ; …—€’œ ˆŒ…ˆ ”€‰‹€
1333
                ld      bc,0Dh
1334
                pop     hl
1335
                push    hl
1336
                add     hl,bc
1337
                ld      c,(hl)
1338
                push    bc
1339
                ld      a,c
1340
                ld      b,2
1341
                cp      10
1342
                jr      c,loc_12D0
1343
                dec     b
1344
loc_12D0        cp      100
1345
                jr      nc,loc_12D9
1346
loc_12D4        ld      a," "
1347
                rst     10h
1348
                djnz    loc_12D4
1349
loc_12D9        pop     bc
1350
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
1351
                ld      hl,TXT_1SPACE
1352
                rst     18h
1353
                pop     hl
1354
                push    hl
1355
                ld      bc,9
1356
                add     hl,bc
1357
                ld      e,(hl)
1358
                inc     hl
1359
                ld      d,(hl)
1360
                push    hl
1361
                ex      de,hl
1362
                call    PRINT_HL_CHISLO
1363
                ld      a," "
1364
                call    PRINT_A_
1365
                pop     hl
1366
                inc     hl
1367
                ld      e,(hl)
1368
                inc     hl
1369
                ld      d,(hl)
1370
                ex      de,hl
1371
                call    PRINT_HL_CHISLO
1372
                pop     hl
1373
                push    hl
1374
                ld      bc,8
1375
                add     hl,bc
1376
                ld      a,(hl)
1377
                cp      "B"
1378
                call    z,PRN_ADR_ASTART
1379
                pop     hl
1380
                pop     bc
1381
                ld      de,10h
1382
                add     hl,de
1383
                djnz    loc_12B5
1384
                push    hl
1385
                call    PRINT_0D
1386
                call    PRINT_0D
1387
                jp      loc_123E
1388
 
1389
PRN_ADR_ASTART  ld      bc,5
1390
                add     hl,bc
1391
                ld      b,(hl)
1392
                inc     hl
1393
                ld      e,(hl)
1394
                inc     hl
1395
                ld      d,(hl)
1396
                dec     b
1397
                jr      z,loc_1335
1398
                dec     b
1399
                jr      z,loc_1335
1400
                ld      a,10h
1401
loc_132C        inc     e
1402
                cp      e
1403
                jr      nz,loc_1333
1404
                ld      e,0
1405
                inc     d
1406
loc_1333        djnz    loc_132C
1407
loc_1335        ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1408
                ld      bc,21h
1409
                add     hl,bc
1410
                ld      b,2
1411
                push    hl
1412
                call    COM_05          ; —’…ˆ… ‘…Вސނ
1413
                ld      a,80h
1414
                pop     hl
1415
                ld      bc,200h
1416
                cpir
1417
                ld      a,(hl)
1418
                cp      0AAh
1419
                ret     nz
1420
                inc     hl
1421
                ld      c,(hl)
1422
                inc     hl
1423
                ld      b,(hl)
1424
                ld      a,b
1425
                or      c
1426
                ret     z
1427
                push    bc
1428
                ld      a," "
1429
                call    PRINT_A_
1430
                pop     bc
1431
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
1432
                ret
1433
 
1434
COPY_S          call    SET_CH_ADD      ; “‘’€Ž‚Š€ CH_ADD
1435
                call    GET_NEXT_SYM
1436
                call    PUT_NUMDSK_STK
1437
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1438
                call    RESERVED_RAM
1439
                ld      hl,TXT_INS_SRC  ; "Insert Source disk then press Y"
1440
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1441
loc_1375        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1442
                cp      "Y"
1443
                jr      nz,loc_1375
1444
                call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
1445
                call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
1446
                call    SET_CP_FILENAME
1447
                jp      nz,ERR_NOFILES
1448
                call    COPY_ON1DISK
1449
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
1450
                cp      "#"
1451
                jp      nz,ERR_OK
1452
loc_1393        ld      a,10
1453
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
1454
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
1455
                inc     (hl)
1456
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
1457
                ld      hl,TXT_INS_SRC  ; "Insert Source disk then press Y"
1458
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1459
loc_13A5        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1460
                cp      "Y"
1461
                jr      nz,loc_13A5
1462
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
1463
                jp      nz,ERR_OK
1464
                call    COPY_ON1DISK
1465
                jr      loc_1393
1466
 
1467
COPY_ON1DISK    call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1468
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
1469
                ld      de,TRD_5CED     ; ŽŒ… …‚ŽƒŽ ’…Š€ ”€‰‹€
1470
                ld      bc,7
1471
                ldir
1472
                ld      a,(TRD_5CF1)
1473
                ld      (TRD_5D10),a    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
1474
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1475
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
1476
                ld      (TRD_5CD9),a    ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1477
                ld      a,0FFh
1478
                ld      (TRD_5D21),a
1479
                call    COPY_ON1DISK_
1480
                ld      hl,(TRD_5D1F)
1481
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1482
                ld      hl,(TRD_5CF4)
1483
                ld      (TRD_5E06),hl
1484
                ld      hl,TRD_5E09
1485
                inc     (hl)
1486
                ld      c,(hl)
1487
                dec     c
1488
                ld      b,0
1489
                push    bc
1490
                ld      de,9
1491
                ld      (TRD_5CF4),de
1492
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1493
                pop     bc
1494
                call    SETHEADFILENAME
1495
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1496
                ret
1497
 
1498
CP_FREESEC      xor     a
1499
                ld      (TRD_5D21),a
1500
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1501
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
1502
                ld      (TRD_5CDA),a
1503
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
1504
                jp      z,FILE_EXISTS
1505
                call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
1506
                ld      a,(TRD_5E09)
1507
                cp      80h
1508
                jp      z,ERR_DIRFULL
1509
                ld      hl,TRD_5CED     ; ŽŒ… …‚ŽƒŽ ’…Š€ ”€‰‹€
1510
                ld      de,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
1511
                ld      bc,7
1512
                ldir
1513
                call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
1514
                ld      a,(TRD_5D10)    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
1515
                ld      (TRD_5CEA),a    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1516
                ld      de,(TRD_5CEA)   ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1517
                ld      d,0
1518
                or      a
1519
                ld      hl,(TRD_5E0A)
1520
                sbc     hl,de
1521
                jp      c,loc_1C45
1522
                ld      (TRD_5E0A),hl
1523
                ld      hl,(TRD_5E06)
1524
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1525
                ld      (TRD_5D1F),hl
1526
                ret
1527
 
1528
COPY_ON1DISK_   ld      a,(TRD_5CF1)
1529
                or      a
1530
                ret     z
1531
                ld      a,(TRD_5D21)
1532
                or      a
1533
                jr      nz,loc_146F
1534
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
1535
                ld      hl,TXT_INS_SRC  ; "Insert Source disk then press Y"
1536
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1537
loc_1465        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1538
                cp      "Y"
1539
                jr      nz,loc_1465
1540
                call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
1541
loc_146F        ld      a,(TRD_5CF1)
1542
                or      a
1543
                ret     z
1544
                push    hl
1545
                ld      hl,TRD_5D23
1546
                sub     (hl)
1547
                pop     hl
1548
                jr      nc,loc_14CB
1549
                ld      a,(TRD_5CF1)
1550
                ld      b,a
1551
                xor     a
1552
                ld      (TRD_5CF1),a
1553
loc_1484        push    bc
1554
                ld      (TRD_5CCE),a    ; #00-—’…ˆ… ‘…Вސ€,#FF-‡€ˆ‘œ ‘…Вސ€
1555
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1556
                push    hl
1557
                ld      de,(TRD_5CF2)
1558
                call    SET_DISK_SOURCE
1559
                call    COM_05          ; —’…ˆ… ‘…Вސނ
1560
                ld      hl,(TRD_5CF4)
1561
                ld      (TRD_5CF2),hl
1562
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
1563
                ld      hl,TXT_INS_DEST ; "Insert Destination disk"
1564
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1565
loc_14A5        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1566
                cp      "Y"
1567
                jr      nz,loc_14A5
1568
                call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
1569
                ld      a,(TRD_5D21)
1570
                or      a
1571
                call    nz,CP_FREESEC
1572
                pop     hl
1573
                pop     bc
1574
                ld      de,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1575
                call    SETUP_DISK_DEST
1576
                call    COM_06          ; ‡€ˆ‘œ ‘…Вސނ
1577
                ld      hl,(TRD_5CF4)
1578
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1579
                jp      COPY_ON1DISK_
1580
 
1581
loc_14CB        ld      (TRD_5CF1),a
1582
                push    hl
1583
                ld      hl,TRD_5D23
1584
                ld      b,(hl)
1585
                pop     hl
1586
                xor     a
1587
                jp      loc_1484
1588
 
1589
SET_DISK_SOURCE push    hl
1590
                push    de
1591
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
1592
                ld      a,(TRD_5CD9)    ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1593
                ld      (hl),a
1594
                pop     de
1595
                pop     hl
1596
                ret
1597
 
1598
SETUP_DISK_DEST push    hl
1599
                push    de
1600
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
1601
                ld      a,(TRD_5CDA)
1602
                ld      (hl),a
1603
                pop     de
1604
                pop     hl
1605
                ret
1606
 
1607
CP_FREE_DEST    xor     a
1608
                ld      (TRD_5D21),a
1609
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1610
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
1611
                ld      (TRD_5CDA),a
1612
                ld      a,(TRD_5E08)
1613
                ld      (TRD_5CE6+1),a  ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
1614
                ld      hl,640
1615
                cp      19h             ; 40 „ސކ…Š 1 ‘’ŽŽ€
1616
                jr      z,SAVE_SECS_DEST
1617
                ld      hl,1280
1618
                cp      18h             ; 80 „ސކ…Š 1 ‘’ŽŽ€
1619
                jr      z,SAVE_SECS_DEST
1620
                cp      17h             ; 40 „ސކ…Š 2 ‘’ŽŽ›
1621
                jr      z,SAVE_SECS_DEST
1622
                ld      hl,2560
1623
                cp      16h             ; 80 „ސކ…Š 2 ‘’ŽŽ›
1624
                jr      z,SAVE_SECS_DEST
1625
                jp      SINTAX_ERROR
1626
 
1627
SAVE_SECS_DEST  ld      (TRD_5CDD),hl   ; ˆŒŸ ”€‰‹€
1628
                ld      bc,(TRD_5CDF)
1629
                sbc     hl,bc
1630
                jp      c,loc_1C45
1631
                ret
1632
 
1633
COPY_B          call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1634
                call    RESERVED_RAM
1635
                ld      hl,TXT_BACKUPDISK ; "BACKUP DISK"
1636
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1637
                ld      hl,TXT_INS_SRC  ; "Insert Source disk then press Y"
1638
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1639
loc_153E        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1640
                cp      "Y"
1641
                jr      nz,loc_153E
1642
                call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
1643
                ld      a,0FFh
1644
                ld      (TRD_5D21),a
1645
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1646
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
1647
                ld      (TRD_5CD9),a    ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1648
                ld      a,(TRD_5E08)
1649
                cp      19h             ; 40 „ސކ…Š 1 ‘’ŽŽ€
1650
                ld      hl,640
1651
                jr      z,loc_1575
1652
                ld      hl,1280
1653
                cp      18h             ; 80 „ސކ…Š 1 ‘’ŽŽ€
1654
                jr      z,loc_1575
1655
                cp      17h             ; 40 „ސކ…Š 2 ‘’ŽŽ›
1656
                jr      z,loc_1575
1657
                ld      hl,2560
1658
                cp      16h             ; 80 „ސކ…Š 2 ‘’ŽŽ›
1659
                jr      z,loc_1575
1660
                jp      SINTAX_ERROR
1661
 
1662
loc_1575        ld      bc,(TRD_5E0A)
1663
                sbc     hl,bc
1664
                ld      (TRD_5CE5),hl   ; €‘˜ˆ…ˆ… ”€‰‹€
1665
                ld      (TRD_5CDF),hl
1666
                ld      hl,0
1667
                ld      (TRD_5CE1),hl
1668
                ld      (TRD_5CE3),hl
1669
                call    COPY_SECTORS
1670
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1671
                ld      a,(TRD_5CE6+1)  ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
1672
                ld      (TRD_5E08),a
1673
                ld      hl,(TRD_5CDD)   ; ˆŒŸ ”€‰‹€
1674
                ld      bc,(TRD_5CDF)
1675
                sbc     hl,bc
1676
                ld      (TRD_5E0A),hl
1677
                call    SETUP_DISK_DEST
1678
                ld      de,9
1679
                ld      (TRD_5CF4),de
1680
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1681
                jp      ERR_OK
1682
 
1683
CP_COPY_SECS    ld      hl,(TRD_5CE5)   ; €‘˜ˆ…ˆ… ”€‰‹€
1684
                ld      a,h
1685
                or      l
1686
                ret
1687
 
1688
COPY_SECTORS    call    CP_COPY_SECS
1689
                ret     z
1690
                ld      a,(TRD_5D21)
1691
                or      a
1692
                jr      nz,loc_15DB
1693
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
1694
                ld      hl,TXT_BACKUPDISK ; "BACKUP DISK"
1695
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1696
                ld      hl,TXT_INS_SRC  ; "Insert Source disk then press Y"
1697
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1698
loc_15D1        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1699
                cp      "Y"
1700
                jr      nz,loc_15D1
1701
                call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
1702
loc_15DB        call    CP_COPY_SECS
1703
                ret     z
1704
                push    bc
1705
                push    hl
1706
                ld      hl,TRD_5D23
1707
                ld      c,(hl)
1708
                ld      b,0
1709
                pop     hl
1710
                sbc     hl,bc
1711
                pop     bc
1712
                jp      nc,loc_1644
1713
                ld      bc,(TRD_5CE5)   ; €‘˜ˆ…ˆ… ”€‰‹€
1714
                ld      hl,0
1715
                ld      (TRD_5CE5),hl   ; €‘˜ˆ…ˆ… ”€‰‹€
1716
loc_15F8        push    bc
1717
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1718
                push    hl
1719
                call    SET_DISK_SOURCE
1720
                ld      de,(TRD_5CE1)
1721
                ld      b,c
1722
                call    COM_05          ; —’…ˆ… ‘…Вސނ
1723
                ld      hl,(TRD_5CF4)
1724
                ld      (TRD_5CE1),hl
1725
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
1726
                ld      hl,TXT_BACKUPDISK ; "BACKUP DISK"
1727
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1728
                ld      hl,TXT_INS_DEST ; "Insert Destination disk"
1729
                call    PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
1730
loc_161D        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
1731
                cp      "Y"
1732
                jr      nz,loc_161D
1733
                call    CLEAR_DOWN_SCR  ; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
1734
                ld      a,(TRD_5D21)
1735
                or      a
1736
                call    nz,CP_FREE_DEST
1737
                pop     hl
1738
                pop     bc
1739
                ld      de,(TRD_5CE3)
1740
                ld      b,c
1741
                call    SETUP_DISK_DEST
1742
                call    COM_06          ; ‡€ˆ‘œ ‘…Вސނ
1743
                ld      hl,(TRD_5CF4)
1744
                ld      (TRD_5CE3),hl
1745
                jp      COPY_SECTORS
1746
 
1747
loc_1644        ld      (TRD_5CE5),hl   ; €‘˜ˆ…ˆ… ”€‰‹€
1748
                push    hl
1749
                ld      hl,TRD_5D23
1750
                ld      c,(hl)
1751
                ld      b,0
1752
                pop     hl
1753
                xor     a
1754
                jp      loc_15F8
1755
 
1756
CP_ERASED_FILE  call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1757
                ld      a,(TRD_5CDD)    ; ˆŒŸ ”€‰‹€
1758
                cp      1
1759
                ret
1760
 
1761
COM_08          ld      c,a             ; ‘—ˆ’›‚€ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€ ‚ “”… #5CDD
1762
; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1763
RDHEAD_FILENAME xor     a
1764
loc_165E        push    bc
1765
                call    RD_HEAD_COPY
1766
                pop     bc
1767
                ret
1768
 
1769
COM_09          ld      c,a             ; ‡€ˆ‘œ Žˆ‘€’…‹Ÿ ”€‰‹€ € „ˆ‘Š
1770
                call    SETHEADFILENAME
1771
                jp      REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1772
 
1773
SETHEADFILENAME ld      a,0FFh
1774
                jr      loc_165E
1775
 
1776
RESERVED_RAM    ld      a,0FFh
1777
                ld      (TRD_5D0E),a    ; #FE-€Ž’€…’ BASIC,ˆ€—… TR-DOS
1778
                call    CP_FREE_SECS
1779
                ld      hl,(WORKSP)
1780
                ld      (TRD_5CCF),hl   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1781
                jp      CREATE_FREERAM
1782
 
1783
CP_FREE_SECS    rst     20h
1784
                dw 1F1Ah                ; ฏเฎขฅเช  เ งฌฅเ  แขฎกฎคญฎฉ ฏ ฌ๏โจ
1785
                ld      hl,0FFFFh
1786
                sbc     hl,bc
1787
                ld      a,h
1788
                cp      10h
1789
                jr      nc,loc_168F
1790
                ld      a,11h
1791
loc_168F        dec     a
1792
                ld      (TRD_5D23),a
1793
                ld      b,a
1794
                ld      c,0
1795
                ret
1796
 
1797
ADD_FILESIZE    ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
1798
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
1799
                ld      (TRD_5CDB),hl
1800
                ld      de,(TRD_5CEA)   ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1801
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1802
                ld      d,0
1803
                add     hl,de
1804
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1805
                ret
1806
 
1807
MOVE            call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1808
                call    RESERVED_RAM
1809
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
1810
                ld      a,(TRD_5E19)
1811
                or      a
1812
                jp      z,ERR_OK
1813
                ld      hl,0
1814
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1815
                ld      c,0FFh
1816
loc_16C3        inc     c
1817
                call    CP_ERASED_FILE
1818
                jr      nz,loc_16C3
1819
                ld      a,c
1820
                ld      (TRD_5CD4),a
1821
                ld      hl,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1822
                ld      (TRD_5CD5),hl
1823
                call    ADD_FILESIZE
1824
loc_16D6        inc     c
1825
                call    CP_ERASED_FILE
1826
                jr      z,loc_16D6
1827
                cp      0
1828
                jp      nz,loc_1710
1829
                ld      a,(TRD_5CD4)
1830
                ld      c,a
1831
loc_16E5        inc     c
1832
                call    CP_ERASED_FILE
1833
                cp      0
1834
                jr      z,REINIT_9SEC
1835
                xor     a
1836
                ld      (TRD_5CDD),a    ; ˆŒŸ ”€‰‹€
1837
                call    WRHEAD_FILENAME ; ‘Ž•€…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1838
                call    ADD_FILESIZE
1839
                jr      loc_16E5
1840
 
1841
                DUPL 0X1710-$,0FFh
1842
loc_1710        ld      a,(TRD_5CEA)    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1843
                ld      (TRD_5CD3),a
1844
                ld      (TRD_5CD1),a
1845
                ld      hl,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1846
                ld      (TRD_5CD5),hl
1847
                push    bc
1848
                call    MOVE_FILE
1849
                pop     bc
1850
                ld      hl,(TRD_5CF4)
1851
                ld      (TRD_5CD5),hl
1852
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1853
                xor     a
1854
                ld      (TRD_5CEA),a    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1855
                ld      a,(TRD_5CDD)    ; ˆŒŸ ”€‰‹€
1856
                push    af
1857
                ld      a,1
1858
                ld      (TRD_5CDD),a    ; ˆŒŸ ”€‰‹€
1859
                call    WRHEAD_FILENAME ; ‘Ž•€…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1860
                pop     af
1861
                ld      (TRD_5CDD),a    ; ˆŒŸ ”€‰‹€
1862
                ld      a,(TRD_5CD4)
1863
                ld      c,a
1864
                ld      hl,(TRD_5CDB)
1865
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1866
                ld      a,(TRD_5CD1)
1867
                ld      (TRD_5CEA),a    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
1868
                call    WRHEAD_FILENAME ; ‘Ž•€…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1869
                ld      a,(TRD_5CD4)
1870
                inc     a
1871
                ld      c,a
1872
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1873
                ld      hl,(TRD_5CD5)
1874
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
1875
                call    WRHEAD_FILENAME ; ‘Ž•€…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1876
                ld      a,(TRD_5CD4)
1877
                ld      c,a
1878
                jp      loc_16C3
1879
 
1880
REINIT_9SEC     ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1881
                ld      bc,1000h
1882
                call    DEL_WORKRAM
1883
                call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
1884
                ld      hl,(TRD_5E0A)
1885
                ld      de,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
1886
                add     hl,de
1887
                ld      (TRD_5E0A),hl
1888
                ld      a,(TRD_5E09)
1889
                ld      hl,TRD_5E19
1890
                sub     (hl)
1891
                ld      (TRD_5E09),a
1892
                ld      (hl),0
1893
                ld      hl,(TRD_5CD5)
1894
                ld      (TRD_5E06),hl
1895
                push    af
1896
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
1897
                pop     af
1898
                ld      c,a
1899
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
1900
                xor     a
1901
                ld      (TRD_5CDD),a    ; ˆŒŸ ”€‰‹€
1902
                jp      loc_569
1903
 
1904
MOVE_FILE       ld      a,(TRD_5CD3)
1905
                or      a
1906
                ret     z
1907
                push    hl
1908
                ld      hl,TRD_5D23
1909
                sub     (hl)
1910
                pop     hl
1911
                jr      nc,loc_17DD
1912
                ld      a,(TRD_5CD3)
1913
                ld      b,a
1914
                xor     a
1915
                ld      (TRD_5CD3),a
1916
loc_17BA        push    bc
1917
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
1918
                push    hl
1919
                ld      de,(TRD_5CD5)
1920
                call    COM_05          ; —’…ˆ… ‘…Вސނ
1921
                ld      hl,(TRD_5CF4)
1922
                ld      (TRD_5CD5),hl
1923
                pop     hl
1924
                pop     bc
1925
                ld      de,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
1926
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
1927
                call    COM_06          ; ‡€ˆ‘œ ‘…Вސނ
1928
                ld      hl,(TRD_5CF4)
1929
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
1930
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
1931
                jr      MOVE_FILE
1932
 
1933
loc_17DD        ld      (TRD_5CD3),a
1934
                push    hl
1935
                ld      hl,TRD_5D23
1936
                ld      b,(hl)
1937
                pop     hl
1938
                xor     a
1939
                jr      loc_17BA
1940
 
1941
RD_HEAD_COPY    push    af
1942
                ld      hl,TRD_5CCC     ; ’…Š“™ˆ‰ ŽŒ… ‘…Вސ€ ˆ —’…ˆˆ Š€’€‹Žƒ€
1943
                ld      (hl),0
1944
                ld      a,c
1945
loc_17F0        sub     10h
1946
                jr      c,loc_17F7
1947
                inc     (hl)
1948
                jr      loc_17F0
1949
 
1950
loc_17F7        add     a,10h
1951
                ld      c,a
1952
                push    bc
1953
                call    READ_NUM_SEC    ; —’…ˆ… ‘…Вސ€ Š€’€‹Žƒ€ Ž ŽŒ…“
1954
                pop     bc
1955
                pop     af
1956
                call    FIND_HEAD_BUF
1957
                ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
1958
                ld      bc,10h
1959
                or      a
1960
                jr      z,loc_180D      ; FIX
1961
                ex      de,hl
1962
loc_180D        ldir                    ; FIX
1963
                ret
1964
 
1965
VERIFY          ld      a,0FFh
1966
                ld      (TRD_5CF9),a    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
1967
LOAD            call    ZERO2HIGH_ERR
1968
loc_1818        call    LOAD_FILE
1969
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1970
                ld      a,0FFh
1971
                ld      (TRD_5D10),a    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
1972
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
1973
                cp      0FFh
1974
                jp      z,ERR_OK
1975
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
1976
                cp      "B"
1977
                jp      z,WORK4AUTORUN  ; ށ€Ž’Š€ ŽŒ…€ ‘’ŽŠˆ €‚’Ž‘’€’€ Žƒ€ŒŒ› € …‰‘ˆŠ…
1978
                jp      ERR_OK
1979
 
1980
LOAD_FILE       call    GET_PARAMS
1981
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
1982
                call    CP_PARAMS       ; €‘’Ž‰Š€ €€Œ…’Ž‚ ‡€ƒ“‡Šˆ ”€‰‹€
1983
                jp      RD_FILE
1984
 
1985
; Ž‹“—…ˆ… €„…‘€ ‡€ƒ“‡Šˆ ŠŽ„€,…‘‹ˆ “Š€‡€
1986
GET_LOAD_CODE   ld      hl,(CH_ADD)
1987
                inc     hl
1988
                ld      a,(hl)
1989
                cp      0Dh             ; ‘‹…„“ž™ˆ‰ ‘ˆŒ‚Ž‹ ‚ ‘’ŽŠ… "ENTER"?
1990
                ret     z               ; …‘‹ˆ „€,’Ž ‚›•Ž„-€€Œ…’ …  ‡€„€
1991
                ld      a,1
1992
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
1993
                call    INPUT_PARAMS    ; Ž‹“—…ˆ… €„…‘€ Š“„€ ƒ“‡ˆ’œ
1994
ZERO2HIGH_ERR   xor     a
1995
                ld      (TRD_5D10),a    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
1996
                ret
1997
 
1998
sub_1857        call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
1999
                ld      a,"B"
2000
                cp      b
2001
                jr      nz,loc_1866
2002
                ld      hl,(CH_ADD)
2003
                dec     hl
2004
                ld      (CH_ADD),hl
2005
loc_1866        call    INPUT_PARAMS
2006
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2007
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2008
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2009
                ld      hl,(TRD_5CDB)
2010
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2011
                xor     a
2012
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2013
                ret
2014
 
2015
GET_PARAMS      call    CP_SECOND_SYM   ; Ž‚…Š€ ‘‹…„“ž™…ƒŽ ‘ˆŒ‚Ž‹€
2016
                jp      z,loc_27B
2017
                call    SET_AND_PUT
2018
                call    CP_HIGH_ERR
2019
                call    nz,sub_1857
2020
                call    GET_SYMSTR
2021
                cp      0AFh            ; CODE
2022
                call    z,GET_LOAD_CODE ; Ž‹“—…ˆ… €„…‘€ ‡€ƒ“‡Šˆ ŠŽ„€,…‘‹ˆ   “Š€‡€
2023
                cp      0E4h            ; DATA
2024
                push    af
2025
                call    CP_HIGH_ERR
2026
                call    z,INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
2027
                pop     af
2028
                call    z,READ_MASSIV
2029
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2030
                call    FIND_FILE       ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ
2031
FIND_RD_HEAD    jp      nz,ERR_NOFILES
2032
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
2033
                ret
2034
 
2035
; €‘’Ž‰Š€ €€Œ…’Ž‚ ‡€ƒ“‡Šˆ ”€‰‹€
2036
CP_PARAMS       ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2037
                or      a
2038
                ld      hl,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2039
                jr      z,loc_18B7
2040
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2041
loc_18B7
2042
;===============PATCH
2043
;               ld      de,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
2044
                CALL ADR_START_COM
2045
                NOP
2046
;===============                
2047
                cp      3
2048
                ld      a,(TRD_5CEA)    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
2049
                push    de
2050
                ld      de,(TRD_5CE8)   ; „‹ˆ€ Žƒ€ŒŒ›
2051
                jr      nz,loc_18CB
2052
                ld      de,(TRD_5CDB)
2053
loc_18CB        ld      b,a
2054
                ld      (TRD_5CDB),de
2055
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
2056
                cp      "C"
2057
                ld      a,b
2058
                jr      nz,loc_18FD
2059
                ld      a,b
2060
                cp      d
2061
                jr      z,loc_18F6
2062
                dec     a
2063
                cp      d
2064
                ld      a,b
2065
                jr      z,loc_18F6
2066
                ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2067
                cp      3
2068
                ld      a,b
2069
                jr      z,loc_18F6
2070
                xor     a
2071
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2072
                ld      d,b
2073
                ld      e,0
2074
                ld      (TRD_5CDB),de
2075
                jr      loc_18F9
2076
 
2077
loc_18F6        call    LOAD_FULLFILE
2078
loc_18F9        ld      a,b
2079
                call    KOLWO_SECS
2080
loc_18FD        ld      b,a
2081
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
2082
                cp      "C"
2083
                pop     de
2084
                ret     z
2085
                push    de
2086
                cp      "B"
2087
                push    af
2088
                call    z,LOAD4BASIC
2089
                pop     af
2090
                cp      "D"
2091
                call    z,LOAD4DATA
2092
                call    LOAD_FULLFILE
2093
                ld      a,(TRD_5CDC)
2094
                ld      b,a
2095
                pop     de
2096
                ret
2097
 
2098
LOAD_FULLFILE   ld      a,3
2099
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2100
                ret
2101
 
2102
RD_FILE         call    CP_HIGH_ERR
2103
                jr      z,loc_192D
2104
                push    af
2105
                call    NUM_SEC_FILE
2106
                pop     af
2107
                cp      0FFh
2108
loc_192D        push    af
2109
                call    z,RD_SECTORS
2110
                pop     af
2111
                jr      z,loc_1937
2112
                jp      COM_06          ; ‡€ˆ‘œ ‘…Вސނ
2113
 
2114
loc_1937        ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2115
                cp      3
2116
                call    z,RD_OR_VERIFY
2117
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
2118
                dec     hl
2119
                ld      (hl),80h
2120
                ret
2121
 
2122
RD_OR_VERIFY    ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
2123
                cp      0FFh
2124
                jp      nz,LOAD_END_FILE
2125
                ld      a,(TRD_5CDB)
2126
                or      a
2127
                ret     z
2128
                ld      c,a
2129
                ld      b,1
2130
                ld      de,(TRD_5CF4)
2131
                jr      loc_196A
2132
 
2133
RD_SECTORS      ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
2134
                cp      0FFh
2135
                jp      nz,COM_05       ; —’…ˆ… ‘…Вސނ
2136
                ld      (TRD_5CF4),de
2137
                ld      c,0
2138
loc_196A        ld      a,b
2139
                or      a
2140
                ret     z
2141
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2142
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2143
                ld      (TRD_5CD9),de   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2144
loc_1974        push    bc
2145
                ld      b,1
2146
                ld      de,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2147
                ld      hl,TRD_5D25
2148
                call    COM_05          ; —’…ˆ… ‘…Вސނ
2149
                ld      hl,(TRD_5CF4)
2150
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2151
                pop     bc
2152
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2153
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2154
                ld      de,TRD_5D25
2155
loc_198E        ld      a,(de)
2156
                cp      (hl)
2157
                jr      nz,loc_199D
2158
                inc     hl
2159
                inc     de
2160
                dec     c
2161
                jr      nz,loc_198E
2162
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2163
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2164
                djnz    loc_1974
2165
                ret
2166
 
2167
loc_199D        ld      hl,TXT_VERIFYERR ; "Verify Error."
2168
                ld      a,0Dh
2169
                jp      PRINT_TXTERR
2170
 
2171
PEEK            ld      a,0FFh
2172
                jr      loc_19AB
2173
 
2174
POKE            ld      a,0EEh
2175
loc_19AB        ld      (TRD_5D10),a    ; ‘’€˜ˆ‰ €‰’ Ž˜ˆŠˆ
2176
                jp      loc_1818
2177
 
2178
MERGE           ld      a,0FFh
2179
                ld      (TRD_5D1F),a
2180
                call    GET_PARAMS
2181
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2182
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
2183
                cp      "B"
2184
                jp      nz,SINTAX_ERROR
2185
                ld      bc,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2186
                ld      (TRD_5CDB),bc
2187
                push    bc
2188
                inc     bc
2189
                rst     20h
2190
                dw 30h                  ; แฎงค ญจฅ แขฎกฎคญฎฃฎ ฌฅแโ 
2191
                ld      (hl),80h
2192
                ex      de,hl
2193
                pop     de
2194
                push    hl
2195
                ld      de,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
2196
                call    LOAD_FULLFILE
2197
                ld      a,(TRD_5CDC)
2198
                ld      b,a
2199
                call    ZERO2HIGH_ERR
2200
                call    RD_FILE
2201
                pop     hl
2202
                ld      de,(PROG)
2203
                rst     20h
2204
                dw 8D2h                 ; เ กฎโ  แฎ แโเฎช ฌจ ฏเฎฃเ ฌฌ๋ ญ  ฅฉแจชฅ
2205
                jp      ERR_OK
2206
 
2207
CP_FREE4PROG    ex      de,hl
2208
                scf
2209
                sbc     hl,de
2210
                ret     c
2211
                ld      de,0Ah
2212
                add     hl,de
2213
                ld      b,h
2214
                ld      c,l
2215
CP_FREE_RAM     rst     20h
2216
                dw 1F05h                ; ฏเฎขฅเช  แขฎกฎคญฎฉ ฏ ฌ๏โจ
2217
                ret
2218
 
2219
LOAD4BASIC      ld      de,(PROG)
2220
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
2221
                dec     hl
2222
                push    hl
2223
                push    de
2224
                sbc     hl,de
2225
                ld      de,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2226
                push    de
2227
                push    hl
2228
                ld      hl,0
2229
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
2230
                cp      0FFh
2231
                jr      z,loc_1A20
2232
                ld      hl,5
2233
loc_1A20        add     hl,de
2234
                ld      (TRD_5CDB),hl
2235
                pop     hl
2236
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
2237
                cp      0FFh
2238
                jr      nz,loc_1A31
2239
                pop     de
2240
                pop     de
2241
                pop     hl
2242
                jr      loc_1A48
2243
 
2244
loc_1A31        call    CP_FREE4PROG
2245
                pop     bc
2246
                pop     de
2247
                pop     hl
2248
                push    bc
2249
                rst     20h
2250
                dw 19E5h                ; ขฎแแโ ญฎขซฅญจฅ
2251
                pop     bc
2252
                call    RESERV_RAM
2253
                inc     hl
2254
                ld      bc,(TRD_5CE8)   ; „‹ˆ€ Žƒ€ŒŒ›
2255
                add     hl,bc
2256
                ld      (VARS),hl
2257
loc_1A48        ld      hl,(PROG)
2258
                ret
2259
 
2260
LOAD4DATA       ld      de,(TRD_5CE8)   ; „‹ˆ€ Žƒ€ŒŒ›
2261
                ld      (TRD_5CDB),de
2262
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2263
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2264
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
2265
                cp      0FFh
2266
                ret     z
2267
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2268
                push    hl
2269
                call    CP_FREE4PROG
2270
                pop     hl
2271
                ld      a,h
2272
                or      l
2273
                jr      z,loc_1A79
2274
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2275
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2276
                dec     hl
2277
                dec     hl
2278
                dec     hl
2279
                ld      bc,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2280
                inc     bc
2281
                inc     bc
2282
                inc     bc
2283
                call    DEL_WORKRAM
2284
loc_1A79        ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
2285
                dec     hl
2286
                ld      bc,(TRD_5CE8)   ; „‹ˆ€ Žƒ€ŒŒ›
2287
                push    bc
2288
                inc     bc
2289
                inc     bc
2290
                inc     bc
2291
                call    RESERV_RAM
2292
                inc     hl
2293
                ld      a,(TRD_5CD2)
2294
                ld      (hl),a
2295
                inc     hl
2296
                pop     de
2297
                ld      (hl),e
2298
                inc     hl
2299
                ld      (hl),d
2300
                inc     hl
2301
                ret
2302
 
2303
NUM_SEC_FILE    ld      a,(TRD_5CD9)    ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2304
                ld      c,b
2305
                ld      b,a
2306
                ld      a,c
2307
                cp      b
2308
                jr      c,loc_1AB6
2309
                ld      a,b
2310
                or      a
2311
                jp      z,SINTAX_ERROR
2312
                dec     b
2313
                jr      z,loc_1AB0
2314
                ld      a,10h
2315
loc_1AA7        inc     e
2316
                cp      e
2317
                jr      nz,loc_1AAE
2318
                ld      e,0
2319
                inc     d
2320
loc_1AAE        djnz    loc_1AA7
2321
loc_1AB0        ld      b,1
2322
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2323
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2324
                ret
2325
 
2326
loc_1AB6        ld      hl,TXT_R_O
2327
                ld      a,5
2328
                jp      PRINT_TXTERR
2329
 
2330
CP_FILE_FREE    call    FIND_FILE       ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ
2331
                jp      z,FILE_EXISTS
2332
CP_FREE_ON_DISK call    READ_9SEC       ; Ž‚…Š€ ‘‚ށބŽƒŽ Œ…‘’€ € „ˆ‘Š…
2333
                ld      a,(TRD_5E09)
2334
                cp      80h
2335
                jp      z,ERR_DIRFULL
2336
                ret
2337
 
2338
SAVE            call    ZERO2HIGH_ERR
2339
                ld      hl,0
2340
                ld      (TRD_5CD1),hl
2341
                call    SET_AND_PUT
2342
                call    GET_SYMSTR
2343
                cp      0AFh            ; CODE
2344
                jr      z,loc_1B39
2345
                cp      0CAh            ; LINE
2346
                jr      nz,loc_1AF8     ; SCREEN$
2347
                call    SET_NUM_CHAN
2348
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2349
                ld      hl,(TRD_5CDB)
2350
                ld      (TRD_5CD1),hl
2351
                ld      hl,TRD_5CE5     ; €‘˜ˆ…ˆ… ”€‰‹€
2352
                jr      loc_1B1F
2353
 
2354
loc_1AF8        cp      0AAh            ; SCREEN$
2355
                jr      nz,loc_1B0D
2356
                ld      hl,4000h
2357
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2358
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2359
                ld      hl,1B00h
2360
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2361
                ld      (TRD_5CDB),hl
2362
                jr      loc_1B48
2363
 
2364
loc_1B0D        call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2365
                call    GET_SYMSTR
2366
                ld      hl,TRD_5CE5     ; €‘˜ˆ…ˆ… ”€‰‹€
2367
                cp      0E4h            ; DATA
2368
                jr      z,loc_1B2C
2369
                cp      0Dh
2370
                jp      nz,SINTAX_ERROR
2371
loc_1B1F        ld      (hl),"B"
2372
                call    CP_FILE_FREE
2373
                call    DEL_5BYTES
2374
loc_1B27        call    SET_START_SIZE
2375
                jr      loc_1B53
2376
 
2377
loc_1B2C        ld      (hl),"D"
2378
                call    CP_FILE_FREE
2379
                call    CP_MASSIV
2380
                jr      nc,loc_1B53
2381
                jp      c,SINTAX_ERROR
2382
loc_1B39        call    GET_START_SIZE
2383
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2384
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2385
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2386
                ld      hl,(TRD_5CDB)
2387
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2388
loc_1B48        call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2389
                ld      a,"C"
2390
                ld      (TRD_5CE5),a    ; €‘˜ˆ…ˆ… ”€‰‹€
2391
                call    CP_FILE_FREE
2392
loc_1B53        call    SAVE_FILE
2393
                jp      loc_569
2394
 
2395
SAVE_FILE       ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2396
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2397
                ld      (TRD_5CE6),hl   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2398
                ex      de,hl
2399
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2400
                ld      a,l
2401
                or      h
2402
                jp      z,SINTAX_ERROR
2403
                ld      a,l
2404
                or      a
2405
                jr      z,loc_1B6D
2406
                inc     h
2407
loc_1B6D        ld      a,h
2408
                ld      (TRD_5CEA),a    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
2409
                ld      e,a
2410
                ld      d,0
2411
                ld      hl,(TRD_5E0A)
2412
                sbc     hl,de
2413
                jp      c,loc_1C45
2414
                push    hl
2415
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
2416
                ld      (hl),0AAh       ; SCREEN$
2417
                inc     hl
2418
                ld      de,(TRD_5CD1)
2419
                ld      (hl),e
2420
                inc     hl
2421
                ld      (hl),d
2422
                ld      hl,(TRD_5CDB)
2423
                ld      (TRD_5CE8),hl   ; „‹ˆ€ Žƒ€ŒŒ›
2424
                ld      hl,(TRD_5E06)
2425
                ld      (TRD_5CEB),hl   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
2426
                ex      de,hl
2427
                ld      hl,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2428
                ld      a,(TRD_5CEA)    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
2429
                ld      b,a
2430
                call    COM_06          ; ‡€ˆ‘œ ‘…Вސނ
2431
                ld      hl,(TRD_5CF4)
2432
                push    hl
2433
                call    READ_9SEC       ; —’…ˆ… 9 ‘…Вސ€
2434
                pop     hl
2435
                ld      (TRD_5E06),hl
2436
                pop     hl
2437
                ld      (TRD_5E0A),hl
2438
                ld      hl,TRD_5E09
2439
                ld      a,(hl)
2440
                ld      (TRD_5D1E),a
2441
                inc     (hl)
2442
                push    hl
2443
                call    REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
2444
                pop     hl
2445
                ld      c,(hl)
2446
                dec     c
2447
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
2448
                cp      "B"
2449
                call    z,SET_HEAD_STSZ
2450
                ret
2451
 
2452
SET_HEAD_STSZ   ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
2453
                ld      de,(PROG)
2454
                scf
2455
                sbc     hl,de
2456
                ld      (TRD_5CE6),hl   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2457
                ld      hl,(VARS)
2458
                sbc     hl,de
2459
                ld      (TRD_5CE8),hl   ; „‹ˆ€ Žƒ€ŒŒ›
2460
                ret
2461
 
2462
SET_START_SIZE  ld      hl,(VARS)
2463
                ld      de,(PROG)
2464
                sbc     hl,de
2465
                ld      (TRD_5CDB),hl
2466
                ld      hl,(PROG)
2467
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2468
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2469
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
2470
                inc     hl
2471
                inc     hl
2472
                inc     hl
2473
                sbc     hl,de
2474
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2475
                ret
2476
 
2477
READ_MASSIV     call    FIND_MASSIV
2478
                ret     nc
2479
                ld      hl,0
2480
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2481
                ld      a,(TRD_5CF9)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
2482
                cp      0FFh
2483
                ret     nz
2484
                jp      loc_1C13
2485
 
2486
CP_MASSIV       call    FIND_MASSIV
2487
                ret     nc
2488
loc_1C13        ld      a,0Eh
2489
                ld      hl,TXT_ARRAYNOT ; "Array not found"
2490
                jp      PRINT_TXTERR
2491
 
2492
FIND_MASSIV     call    GET_NEXT_SYM
2493
                call    LOOK_VARS
2494
                set     7,c
2495
                ld      a,c
2496
                ld      (TRD_5CD2),a
2497
                jr      nc,loc_1C2B
2498
loc_1C29        scf
2499
                ret
2500
 
2501
loc_1C2B        jr      nz,loc_1C29
2502
                inc     hl
2503
                ld      e,(hl)
2504
                inc     hl
2505
                ld      d,(hl)
2506
                inc     hl
2507
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2508
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2509
                ld      (TRD_5CDB),de
2510
                ld      (TRD_5CD9),de   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2511
                call    GET_NEXT_SYM
2512
                cp      ")"
2513
                jr      nz,loc_1C2B
2514
                ret
2515
 
2516
loc_1C45        ld      hl,TXT_NOSPACE_
2517
                ld      a,3
2518
PRINT_TXTERR    call    PRINT_ERROR     ; …—€’œ ‘ŽŽ™…ˆŸ ށ Ž˜ˆŠ…
2519
                jp      END_COMAND
2520
 
2521
FILE_EXISTS     ld      hl,TXT_FILEEXISTS_
2522
                ld      a,2
2523
                jr      PRINT_TXTERR
2524
 
2525
; ……Ž‘ ‡€„€ŽƒŽ ˆŒ…ˆ ”€‰‹€ ‚ “”… #5CDD
2526
SET_FILENAME    ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
2527
                ld      b,8
2528
loc_1C5C        ld      (hl)," "
2529
                inc     hl
2530
                djnz    loc_1C5C
2531
                call    CP_ON_STKBOT
2532
                ex      de,hl
2533
                call    SETUP_DISK
2534
                ld      a,c
2535
                or      a
2536
                jp      z,SINTAX_ERROR
2537
                cp      9
2538
                jr      c,loc_1C73
2539
                ld      c,8
2540
loc_1C73        ld      a,(hl)
2541
                cp      " "
2542
                jp      c,SINTAX_ERROR
2543
                ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
2544
                push    bc
2545
                ldir
2546
                pop     bc
2547
                ret
2548
 
2549
SETUP_DISK      inc     hl
2550
                ld      a,(hl)
2551
                cp      ":"
2552
                jr      nz,loc_1C98
2553
                dec     hl
2554
                ld      a,(hl)
2555
                call    NUMDSK2BYTE
2556
                push    bc
2557
                push    hl
2558
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
2559
                pop     hl
2560
                pop     bc
2561
                dec     bc
2562
                dec     bc
2563
                inc     hl
2564
                inc     hl
2565
                ret
2566
 
2567
loc_1C98        dec     hl
2568
                ld      a,(TRD_5D19)    ; „ˆ‘ŠŽ‚Ž„ Ž “ŒŽ‹—€ˆž
2569
                push    bc
2570
                push    hl
2571
                call    COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
2572
                pop     hl
2573
                pop     bc
2574
                ret
2575
 
2576
FIND_HEAD_BUF   ld      l,c
2577
                ld      h,0
2578
                add     hl,hl
2579
                add     hl,hl
2580
                add     hl,hl
2581
                add     hl,hl
2582
                ld      bc,TRD_5D25
2583
                add     hl,bc
2584
                ret
2585
 
2586
SET_CP_FILENAME call    SET_FILENAME    ; ……Ž‘ ‡€„€ŽƒŽ ˆŒ…ˆ ”€‰‹€ ‚ “”… #5CDD
2587
; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
2588
FIND_FILENAME   call    RD_0SEC2BUF     ; —’…ˆ… ‘…Вސ€ 0 Š€’€‹Žƒ€
2589
                ld      b,80h
2590
                ld      c,0
2591
loc_1CBA        push    bc
2592
                call    FIND_HEAD_BUF
2593
                call    CP_END_BUF      ; Ž‚…Š€ € ŠŽ…– “”…€
2594
                pop     bc
2595
                push    bc
2596
                ld      a,c
2597
                cp      10h
2598
                jr      nz,loc_1CCD
2599
                pop     bc
2600
                ld      c,0
2601
                jr      loc_1CBA
2602
 
2603
loc_1CCD        ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
2604
                ld      a,(TRD_5D06)    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
2605
                ld      b,a
2606
                xor     a
2607
                cp      (hl)
2608
                jr      nz,loc_1CDB
2609
                pop     bc
2610
                jr      loc_1CE4
2611
 
2612
loc_1CDB        call    COMPARE_B_SYM
2613
                pop     bc
2614
                jr      z,loc_1CE7
2615
                inc     c
2616
                djnz    loc_1CBA
2617
loc_1CE4        or      0FFh
2618
                ret
2619
 
2620
loc_1CE7        ld      a,80h
2621
                sub     b
2622
                ld      c,a
2623
                ld      (TRD_5D1E),a
2624
                xor     a
2625
                ret     z
2626
COM_0A          call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ˆ €‘˜ˆ…ˆž
2627
                ld      hl,TRD_5D0F     ; ŽŒ… Ž˜ˆŠˆ TR-DOS
2628
                ld      (hl),c
2629
                ret     z
2630
                ld      (hl),0FFh
2631
                ret
2632
 
2633
RETURN          call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2634
;===============PATCH
2635
;               call    DELETE_BUF
2636
                CALL DELETE_BUFFER
2637
;===============PATCH
2638
                res     3,(iy+1)
2639
                call    RESTORE_SP      ; ‚Ž‘‘’€Ž‚‹…ˆ… ……•‚€’—ˆŠ€ Ž˜ˆŽŠ
2640
                ld      sp,(TRD_5D1C)   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
2641
                exx
2642
                ld      hl,2758h
2643
                exx
2644
                dec     hl
2645
                ld      a,12h
2646
                cp      (hl)
2647
                ret     nz
2648
                dec     hl
2649
                jp      loc_235
2650
 
2651
SINTAX_ERROR    bit     7,(iy+0)
2652
                jr      z,loc_1D25
2653
                ld      a,0Bh
2654
                ld      (ERR_NR),a
2655
loc_1D25        inc     a
2656
                ld      hl,TXT_ERROR_
2657
PRT_TEXT_ERROR  call    PRINT_ERROR     ; …—€’œ ‘ŽŽ™…ˆŸ ށ Ž˜ˆŠ…
2658
                jp      END_COMAND
2659
 
2660
loc_1D2F        ld      a,(ERR_NR)
2661
                ld      hl,TXT_BREAK    ; "*BREAK*"
2662
                cp      14h
2663
                jr      z,PRT_TEXT_ERROR
2664
                cp      0Ch
2665
                jr      z,PRT_TEXT_ERROR
2666
                ld      hl,TXT_OUTRAM   ; "Out of RAM"
2667
                cp      3
2668
                jr      z,PRT_TEXT_ERROR
2669
                ld      hl,TXT_ARRAYNOT ; "Array not found"
2670
                cp      1
2671
                jr      z,PRT_TEXT_ERROR
2672
                jr      SINTAX_ERROR
2673
 
2674
RUN             call    ZERO2HIGH_ERR
2675
                call    LOAD_FILE
2676
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2677
                ld      hl,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
2678
                ld      a,(TRD_5CE5)    ; €‘˜ˆ…ˆ… ”€‰‹€
2679
                cp      "B"
2680
;===============PATCH
2681
;               jp      z,WORK4AUTORUN  ; ށ€Ž’Š€ ŽŒ…€ ‘’ŽŠˆ €‚’Ž‘’€’€ Žƒ€ŒŒ› € …‰‘ˆŠ…
2682
                JP RUN_FILE
2683
;===============PATCH
2684
                push    hl
2685
                ret
2686
 
2687
CLEAR_WORKSPACE ld      hl,TRD_5D0E     ; #FE-€Ž’€…’ BASIC,ˆ€—… TR-DOS
2688
                ld      a,(hl)
2689
loc_1D67        cp      0FFh
2690
                ld      (hl),0
2691
                ret     nz
2692
                rst     20h
2693
                dw 16BFh                ; ฎ็จแโช  เ กฎ็ฅฉ ฎกซ แโจ จ แโฅช  ช ซ์ชใซ๏โฎเ 
2694
                ret
2695
 
2696
CP_SINTAX       bit     7,(iy+1)
2697
                ret
2698
 
2699
; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2700
EXIT_IF_SINTAX  call    CP_SINTAX
2701
                ret     nz
2702
                pop     hl
2703
                ret
2704
 
2705
; ‡€…‘…ˆ… —ˆ‘‹€ € ‘’…РЀ‹œŠ“‹Ÿ’ސ€
2706
CHISLO2STKBOT   call    GET_NEXT_SYM
2707
                call    BC2STKBOT
2708
                jr      CP_SINTAX
2709
 
2710
; ޒА›’ˆ… Š€€‹€ 0
2711
OPEN_CHAN_0     xor     a
2712
OPENSTREAM      rst     20h
2713
                dw 1601h                ; ฎโชเ๋โจฅ ช ญ ซ 
2714
                ret
2715
 
2716
; ޒА›’ˆ… Š€€‹€ 2
2717
OPEN_CHAN_2     ld      a,2
2718
                jr      OPENSTREAM
2719
 
2720
GET_SYMSTR      rst     20h
2721
                dw 18h                  ; ข๋กฎเช  แจฌขฎซ  จง (CH_ADD)
2722
                ret
2723
 
2724
CALL2BASEDIT    call    OPEN_CHAN_0     ; ޒА›’ˆ… Š€€‹€ 0
2725
                rst     20h
2726
                dw 0F2Ch                ; เฅค ชโฎเ ชฎฌ ญคญฎฉ แโเฎชจ
2727
                ret
2728
 
2729
; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
2730
CLEAR_SCREEN    rst     20h
2731
                dw 0D6Bh                ; ฎ็จแโช  ํชเ ญ 
2732
                ret
2733
 
2734
LOOK_VARS       rst     20h
2735
                dw 28B2h                ; Look-Vars. ไจฃ งญ ฅโ ็ฅ คฅซ ฅโ
2736
                ret
2737
 
2738
; Ž—ˆ‘’Š€ ˆ†…‰ —€‘’ˆ Š€€
2739
CLEAR_DOWN_SCR  rst     20h
2740
                dw 0D6Eh                ; ฎ็จแโช  ญจฆญฅฉ ็ แโจ ํชเ ญ 
2741
                ret
2742
 
2743
PRINT_CHISLO_A_ ld      c,a
2744
CONV2_2BYTES    ld      b,0
2745
                jp      PRINT_CHISLO
2746
 
2747
PRINT_CHISLO    push    bc              ; …—€’œ —ˆ‘‹€
2748
;===============PATCH
2749
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
2750
                DUPL 3,0
2751
;===============PATCH
2752
                pop     bc
2753
                rst     20h
2754
                dw 1A1Bh                ; ฏฅ็ โ์ แฎฎก้ฅญจฉ จ ญฎฌฅเฎข แโเฎช
2755
;===============PATCH
2756
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
2757
                DUPL 3,0
2758
;===============PATCH
2759
                ret
2760
 
2761
GET_STKBOT_     rst     20h
2762
                dw 2BF1h                ; ็โฅญจฅ คญ  แโฅช  ช ซ์ชใซ๏โฎเ 
2763
                ret
2764
 
2765
FIND_LAST       rst     20h
2766
                dw 1E99h                ; ฏฎจแช ฏฎแซฅคญฅฃฎ ๆฅซฎฃฎ ็จแซ 
2767
                ret
2768
 
2769
PUT_NUMDSK_STK  rst     20h
2770
                dw 1C8Ch
2771
                ret
2772
 
2773
BC2STKBOT       rst     20h
2774
                dw 1C82h
2775
                ret
2776
 
2777
; “‘’€Ž‚Š€ CH_ADD
2778
SET_CH_ADD      ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
2779
                inc     hl
2780
                ld      (CH_ADD),hl
2781
                ret
2782
 
2783
INP_STR2STKBOT  call    SET_AND_PUT
2784
loc_1DD0        call    GET_SYMSTR
2785
                cp      ","
2786
                jp      nz,SINTAX_ERROR
2787
                call    GET_NEXT_SYM
2788
                call    PUT_NUMDSK_STK
2789
                ret
2790
 
2791
SET_AND_PUT     call    SET_CH_ADD      ; “‘’€Ž‚Š€ CH_ADD
2792
                jp      PUT_NUMDSK_STK
2793
 
2794
GET_START_SIZE  call    GET_SYMSTR
2795
                cp      0AFh            ; CODE
2796
                ret     nz
2797
 
2798
INPUT_PARAMS    call    CHISLO2STKBOT   ; ‡€…‘…ˆ… —ˆ‘‹€ € ‘’…РЀ‹œŠ“‹Ÿ’ސ€
2799
                jr      z,loc_1DFB
2800
                call    FIND_LAST
2801
                ld      (TRD_5CD9),bc   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2802
                ld      (TRD_5CDB),bc
2803
loc_1DFB        call    GET_SYMSTR
2804
                cp      ","
2805
                jr      z,SET_NUM_CHAN
2806
                cp      0Dh
2807
                jp      nz,SINTAX_ERROR
2808
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2809
                ret
2810
 
2811
SET_NUM_CHAN    call    CHISLO2STKBOT   ; ‡€…‘…ˆ… —ˆ‘‹€ € ‘’…РЀ‹œŠ“‹Ÿ’ސ€
2812
                ret     z
2813
                call    FIND_LAST
2814
                ld      (TRD_5CDB),bc
2815
                ld      a,3
2816
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2817
                ret
2818
 
2819
DEL_5BYTES      ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
2820
                rst     20h
2821
                dw 11A7h                ; ใค ซฅญจฅ จง ชฎฌ ญคญฎฉ แโpฎชจ ฏ๏โจก ฉโญ๋ๅ ็จแฅซ
2822
                ret
2823
 
2824
CREATE_FREERAM  ld      hl,(WORKSP)
2825
                rst     20h
2826
                dw 30h                  ; แฎงค ญจฅ แขฎกฎคญฎฃฎ ฌฅแโ 
2827
                ret
2828
 
2829
GET_NEXT_SYM    rst     20h
2830
                dw 20h                  ; Ž‹“—…ˆ… ‘‹…„“ž™…ƒŽ ‘ˆŒ‚Ž‹€ ‚‚…„…Ž‰ ‘’ŽŠˆ
2831
                ret
2832
 
2833
DEL_WORKRAM     rst     20h
2834
                dw 19E8h                ; “ค ซฅญจฅ ฎกซ แโจ ฏ ฌ๏โจ
2835
                ret
2836
 
2837
RESERV_RAM      rst     20h
2838
                dw 1655h
2839
                ret
2840
 
2841
WR_NUM_TRACK    call    GET_NUM_TRACK
2842
                ld      a,h
2843
                out     (3Fh),a
2844
                ret
2845
 
2846
; —’…ˆ… ‘…Вސނ
2847
COM_05          xor     a
2848
                jr      loc_1E64
2849
 
2850
WRHEAD_FILENAME call    SETHEADFILENAME ; ‘Ž•€…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
2851
REWRITE_9SEC    ld      de,(TRD_5CF4)   ; ……‡€ˆ‘œ 9 ‘…Вސ€
2852
                dec     de
2853
                ld      b,1
2854
                ld      hl,TRD_5D25
2855
COM_06          push    hl              ; ‡€ˆ‘œ ‘…Вސނ
2856
                push    de
2857
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
2858
                bit     7,(hl)
2859
                jr      z,loc_1E60
2860
                bit     0,(hl)
2861
                jr      nz,loc_1E60
2862
                ld      hl,READ_ONLY
2863
                jp      PRT_TEXT_ERROR
2864
 
2865
loc_1E60        pop     de
2866
                pop     hl
2867
SAVE_SECTORS    ld      a,0FFh
2868
loc_1E64        ld      (TRD_5CCE),a    ; #00-—’…ˆ… ‘…Вސ€,#FF-‡€ˆ‘œ ‘…Вސ€
2869
loc_1E67        ld      (TRD_5CF4),de
2870
                push    bc
2871
                push    hl
2872
                call    WR_NUM_TRACK
2873
                pop     hl
2874
                pop     bc
2875
                xor     a
2876
                or      b
2877
                ret     z
2878
loc_1E75        push    bc
2879
                push    hl
2880
                call    COM_04          ; “‘’€Ž‚Š€ €„…‘€ “”…€
2881
                ld      a,(TRD_5CF4)
2882
                call    COM_03          ; “‘’€Ž‚Š€ ŽŒ…€ ‘…Вސ€
2883
                ld      a,(TRD_5CF5)
2884
                call    COM_02          ; “‘’€Ž‚Š€ ƒŽ‹Ž‚Šˆ € „ސކГ
2885
                ld      a,(TRD_5CCE)    ; #00-—’…ˆ… ‘…Вސ€,#FF-‡€ˆ‘œ ‘…Вސ€
2886
                or      a
2887
                push    af
2888
                call    z,LOAD_SECTOR
2889
                pop     af
2890
                call    nz,SAVE_SECTOR
2891
                pop     hl
2892
                ld      de,100h
2893
                add     hl,de
2894
                push    hl
2895
                ld      a,10h
2896
                ld      hl,TRD_5CF4
2897
                inc     (hl)
2898
                cp      (hl)
2899
                jr      nz,loc_1EA7
2900
                ld      (hl),0
2901
                ld      hl,TRD_5CF5
2902
                inc     (hl)
2903
loc_1EA7        pop     hl
2904
                pop     bc
2905
                djnz    loc_1E75
2906
                ret
2907
 
2908
KOLWO_SECS      push    hl
2909
                ld      h,a
2910
                ld      l,0
2911
                push    hl
2912
                sbc     hl,de
2913
                call    c,LOAD_FILLFILE
2914
                pop     hl
2915
                ld      a,h
2916
                pop     hl
2917
                ret     c
2918
                ld      a,d
2919
                ret
2920
 
2921
LOAD_FILLFILE   xor     a
2922
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
2923
                scf
2924
                ret
2925
 
2926
FORMAT          ld      hl,0FFFFh
2927
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2928
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2929
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
2930
                ld      (TRD_5CD1),hl
2931
                call    CP_SECOND_SYM   ; Ž‚…Š€ ‘‹…„“ž™…ƒŽ ‘ˆŒ‚Ž‹€
2932
                jp      z,SINTAX_ERROR
2933
                call    SET_AND_PUT
2934
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
2935
                call    SET_FILENAME    ; ……Ž‘ ‡€„€ŽƒŽ ˆŒ…ˆ ”€‰‹€ ‚ “”… #5CDD
2936
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
2937
                and     80h
2938
                ld      a,40            ; 40 „ސކ…Š
2939
                jr      z,loc_1EE8
2940
                ld      a,80            ; 80 „ސކ…Š
2941
loc_1EE8        ld      (TRD_5CD7),a    ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2942
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2943
                call    COM_00          ; ‚Ž‘‘’€Ž‚‹…ˆ… ‚ƒ93
2944
                call    COM_17          ; “‘’€Ž‚Š€ 1 ‘’ŽŽ› „ˆ‘Š€
2945
                call    PAUSE_3_C_A
2946
                ld      e,1
2947
                call    FORMAT_TREK     ; ”ސŒ€’ˆŽ‚€ˆ… „ŽŽ†Šˆ
2948
                call    COM_16          ; “‘’€Ž‚Š€ 0 ‘’ŽŽ› „ˆ‘Š€
2949
                ld      e,0
2950
                call    FORMAT_TREK     ; ”ސŒ€’ˆŽ‚€ˆ… „ŽŽ†Šˆ
2951
                ld      a,(TRD_5CDD)    ; ˆŒŸ ”€‰‹€
2952
                cp      "$"
2953
                jr      z,loc_1F1B
2954
                call    COM_17          ; “‘’€Ž‚Š€ 1 ‘’ŽŽ› „ˆ‘Š€
2955
                call    PAUSE_3_C_A
2956
                call    loc_3EB5
2957
                ld      a,h
2958
                cp      1
2959
                jr      nz,loc_1F1B
2960
                ld      a,80h
2961
                ld      (TRD_5CDA),a
2962
loc_1F1B        call    FORMAT_DISK
2963
                ld      hl,TRD_5D25
2964
                ld      (hl),0
2965
                ld      de,TRD_5D26
2966
                ld      bc,0FFh
2967
                ldir
2968
                ld      bc,TRD_5CD7     ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
2969
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
2970
                ld      de,TRD_5CDA
2971
                ld      a,(bc)
2972
                cp      50h
2973
                jr      z,loc_1F49
2974
                ld      a,(de)
2975
                cp      80h
2976
                jr      z,loc_1F42      ; 80 „ސކ…Š 1 ‘’ŽŽ€
2977
                ld      a,19h           ; 40 „ސކ…Š 1 ‘’ŽŽ€
2978
                ld      hl,624          ; ‘…Вސނ
2979
                jr      loc_1F55
2980
 
2981
loc_1F42        ld      a,17h           ; 80 „ސކ…Š 1 ‘’ŽŽ€
2982
loc_1F44        ld      hl,1264 ; ‘…Вސނ
2983
                jr      loc_1F55
2984
 
2985
loc_1F49        ld      a,(de)
2986
                cp      80h
2987
                ld      a,18h           ; 40 „ސކ…Š 2 ‘’ŽŽ›
2988
                jr      nz,loc_1F44     ; ‘…Вސނ
2989
                ld      a,16h           ; 80 „ސކ…Š 2 ‘’ŽŽ›
2990
                ld      hl,2544 ; ‘…Вސނ
2991
loc_1F55        ld      (TRD_5E08),a
2992
                ld      (TRD_5E0A),hl
2993
                ld      a,1
2994
                ld      (TRD_5E07),a
2995
                ld      a,10h
2996
                ld      (TRD_5E0C),a
2997
                ld      hl,TRD_5E0F
2998
                ld      de,TRD_5E10
2999
                ld      bc,8
3000
                ld      (hl)," "
3001
                ldir
3002
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3003
                ld      de,TRD_5E1A
3004
                ld      bc,8
3005
                ldir
3006
                call    COM_16          ; “‘’€Ž‚Š€ 0 ‘’ŽŽ› „ˆ‘Š€
3007
                ld      b,1
3008
                ld      de,8
3009
                ld      hl,TRD_5D25
3010
                call    SAVE_SECTORS
3011
                ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
3012
                push    af
3013
                xor     a
3014
                ld      (TRD_5CE5),a    ; €‘˜ˆ…ˆ… ”€‰‹€
3015
                ld      hl,(TRD_5E0A)
3016
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3017
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3018
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3019
                rst     18h
3020
                ld      a,0Dh
3021
                rst     10h
3022
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3023
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3024
                pop     af
3025
                push    hl
3026
                ld      d,0
3027
                ld      e,a
3028
                sbc     hl,de
3029
                ld      b,h
3030
                ld      c,l
3031
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
3032
                ld      a,"/"
3033
                rst     10h
3034
                pop     bc
3035
                call    PRINT_CHISLO    ; …—€’œ —ˆ‘‹€
3036
                jp      END_COMAND
3037
 
3038
TABL_SECTORS    db 1,9,2,0Ah,3,0Bh,4,0Ch,5,0Dh,6,0Eh,7,0Fh,8,10h,1
3039
 
3040
CP_DISK_TRACK   call    GET_TIME_HEAD   ; Ž‹“—…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
3041
                or      11h
3042
                ld      b,a
3043
                ld      a,32h
3044
                call    HEAD_POSITION
3045
                ld      a,2
3046
                call    HEAD_POSITION
3047
                call    PAUSE725779T
3048
                in      a,(1Fh)
3049
                and     4
3050
                ld      a,80            ; 80 „ސކ…Š
3051
                jr      z,loc_1FE7
3052
                ld      a,40            ; 40 „ސކ…Š
3053
loc_1FE7        ld      (TRD_5CD7),a    ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3054
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3055
                ret
3056
 
3057
; “‘’€Ž‚Š€ 0 ‘’ŽŽ› „ˆ‘Š€
3058
COM_16          ld      a,(TRD_5D16)    ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
3059
                or      3Ch
3060
SET_REG_FF      ld      (TRD_5D16),a    ; “‘’€Ž‚Š€ …ƒˆ‘’€ #FF
3061
                out     (0FFh),a
3062
                ret
3063
 
3064
; “‘’€Ž‚Š€ 1 ‘’ŽŽ› „ˆ‘Š€
3065
COM_17          ld      a,(TRD_5D16)    ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
3066
                and     6Fh
3067
                jr      SET_REG_FF      ; “‘’€Ž‚Š€ …ƒˆ‘’€ #FF
3068
 
3069
; ”ސŒ€’ˆŽ‚€ˆ… „ŽŽ†Šˆ
3070
FORMAT_TREK     di
3071
                ld      a,0F4h
3072
                out     (1Fh),a
3073
                ld      hl,TABL_SECTORS
3074
                ld      c,7Fh
3075
loc_2007        ld      b,0Ah
3076
                ld      d,4Eh
3077
                call    WRITE_C_D_B
3078
                ld      b,0Ch
3079
                ld      d,0
3080
                call    WRITE_C_D_B
3081
                ld      b,3
3082
                ld      d,0F5h
3083
                call    WRITE_C_D_B
3084
                ld      d,0FEh
3085
                call    WRITE_C_D_1
3086
                ld      d,e
3087
                call    WRITE_C_D_1
3088
                ld      d,0
3089
                call    WRITE_C_D_1
3090
                ld      d,(hl)
3091
                call    WRITE_C_D_1
3092
                ld      d,1
3093
                call    WRITE_C_D_1
3094
                ld      d,0F7h
3095
                call    WRITE_C_D_1
3096
                ld      b,16h
3097
                ld      d,4Eh
3098
                call    WRITE_C_D_B
3099
                ld      b,0Ch
3100
                ld      d,0
3101
                call    WRITE_C_D_B
3102
                ld      b,3
3103
                ld      d,0F5h
3104
                call    WRITE_C_D_B
3105
                ld      d,0FBh
3106
                call    WRITE_C_D_1
3107
                ld      b,0
3108
                ld      d,0
3109
                call    WRITE_C_D_B
3110
                ld      d,0F7h
3111
                call    WRITE_C_D_1
3112
                ld      b,3Ch
3113
                ld      d,4Eh
3114
                call    WRITE_C_D_B
3115
                ld      a,(hl)
3116
                inc     hl
3117
                cp      10h
3118
                jr      nz,loc_2007
3119
                ld      b,0
3120
                call    WRITE_C_D_B
3121
                jp      m,loc_2076
3122
                call    WRITE_C_D_B
3123
loc_2076        in      a,(1Fh)
3124
                and     40h
3125
                jp      nz,loc_3F39     ; Read Only
3126
CP_NUM_TRACK    ld      a,(TRD_5CD7+1)  ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3127
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3128
                or      a
3129
                ret     nz
3130
                ld      c,7Fh
3131
                ld      a,e
3132
                out     (3Fh),a
3133
                ld      hl, TABL_SECTORS+1
3134
loc_208A        ld      b,3
3135
                ld      a,(hl)
3136
                out     (5Fh),a
3137
                push    hl
3138
loc_2090        di
3139
                ld      a,80h
3140
                out     (1Fh),a
3141
                push    bc
3142
                call    RD_DATAPORT
3143
                in      a,(1Fh)
3144
                and     7Fh
3145
                pop     bc
3146
                jr      z,loc_20A6
3147
                djnz    loc_2090
3148
                ld      hl,TRD_5CD6     ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
3149
                inc     (hl)
3150
loc_20A6        pop     hl
3151
                ld      a,(hl)
3152
                inc     hl
3153
                cp      1
3154
                jr      nz,loc_208A
3155
                ei
3156
                ret
3157
 
3158
WRITE_C_D_1     ld      b,1
3159
WRITE_C_D_B     in      a,(0FFh)
3160
                and     0C0h
3161
                jr      z,WRITE_C_D_B
3162
                ret     m
3163
                out     (c),d
3164
                djnz    WRITE_C_D_B
3165
                ret
3166
 
3167
FORMAT_DISK     ld      hl,TRD_5CD7     ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3168
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3169
                ld      b,(hl)
3170
                xor     a
3171
                inc     hl
3172
                ld      (hl),a
3173
                ld      e,0FFh
3174
loc_20C6        push    bc
3175
                inc     e
3176
                ld      a,e
3177
;===============PATCH
3178
;               ld      b,1Bh
3179
                LD B,0X18
3180
;===============PATCH
3181
                call    HEAD_POSITION
3182
                call    COM_16          ; “‘’€Ž‚Š€ 0 ‘’ŽŽ› „ˆ‘Š€
3183
;===============PATCH
3184
;               call    FORMAT_TREK     ; ”ސŒ€’ˆŽ‚€ˆ… „ŽŽ†Šˆ
3185
                CALL FORMAT_TREK_A0
3186
;===============PATCH
3187
                ld      a,(TRD_5CDA)
3188
                cp      80h
3189
                jr      nz,loc_20E1
3190
                call    COM_17          ; “‘’€Ž‚Š€ 1 ‘’ŽŽ› „ˆ‘Š€
3191
;===============PATCH
3192
;               call    FORMAT_TREK     ; ”ސŒ€’ˆŽ‚€ˆ… „ŽŽ†Šˆ
3193
                CALL FORMAT_TREK_A1
3194
;===============PATCH
3195
loc_20E1        pop     bc
3196
                djnz    loc_20C6
3197
                ret
3198
 
3199
DELETE_BUF      push    af
3200
                ld      a,(TRD_5CF8)    ; „ˆ‘ŠŽ‚Ž„ ˆ Ž…€–ˆˆ ‘ 2 ”€‰‹€Œˆ
3201
                cp      0FFh
3202
                jr      z,loc_211C
3203
                pop     af
3204
;===============PATCH
3205
;               call    DEL_BUF         ; “„€‹…ˆ… “”…€,…‘‹ˆ  Ž …‘’œ
3206
                JP DEL_BUF
3207
;===============PATCH
3208
; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
3209
CP_INTERFACE1   push    af
3210
                ld      a,(TRD_5CB6)    ; „‹Ÿ Ž‚…Šˆ €‹ˆ—ˆŸ INTERFACE1
3211
                cp      0F4h
3212
                jr      z,loc_211C
3213
                xor     a
3214
                ld      hl,TRD_5D18
3215
                or      (hl)
3216
                ld      (hl),0FFh
3217
                jr      z,loc_211C
3218
                ld      a,(TRD_5D0C)
3219
                or      a
3220
                ld      hl,TRD_5CC3
3221
                ld      de,TRD_5D33
3222
                jr      nz,loc_2111
3223
                ld      de,TRD_5E34
3224
loc_2111        ld      b,2Dh
3225
loc_2113        ld      c,(hl)
3226
                ld      a,(de)
3227
                ld      (hl),a
3228
                ld      a,c
3229
                ld      (de),a
3230
                inc     hl
3231
                inc     de
3232
                djnz    loc_2113
3233
loc_211C        pop     af
3234
                ret
3235
 
3236
CLRBUF_EDITOR
3237
;===============PATCH
3238
;               ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
3239
                CALL CLRBUF_EDITOR2
3240
;===============PATCH
3241
                ld      (hl),0Dh
3242
                ld      (K_CUR),hl
3243
                inc     hl
3244
                ld      (hl),80h
3245
                ret
3246
 
3247
RESTORE_COMSTR  ld      de,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
3248
                ld      hl,TRD_5D20     ; „‹Ÿ ‘Ž•€…ˆŸ 3 ‘ˆŒ‚ދނ ‚‚…„…Ž‰ ‘’ŽŠˆ
3249
                call    LDI3_HL2DE      ; ……Ž‘ 3 €‰’
3250
                ret
3251
 
3252
; ˆŸ’ˆ… ˆ ށ€Ž’Š€ ŠŽŒ€„
3253
GET_COMMAND     ld      a,(TRD_5D0F)    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
3254
                or      a
3255
                push    af
3256
                call    nz,RESTORE_COMSTR
3257
                pop     af
3258
                call    z,CLRBUF_EDITOR
3259
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
3260
                call    PRINT_0D
3261
                ld      a,(TRD_5D19)    ; „ˆ‘ŠŽ‚Ž„ Ž “ŒŽ‹—€ˆž
3262
                add     a,"A"
3263
                rst     10h
3264
                ld      a,">"
3265
                rst     10h
3266
                ld      hl,ERR_NR
3267
                ld      (hl),0FFh
3268
                jp      CALL2BASEDIT
3269
 
3270
sub_2158        call    GET_NEXT_SYM
3271
                call    GET_SYMSTR
3272
                cp      ","
3273
                jp      nz,SINTAX_ERROR
3274
                ld      hl,(TRD_5CDB)
3275
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3276
                call    SET_NUM_CHAN
3277
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
3278
                ld      hl,(TRD_5CDB)
3279
                ld      a,h
3280
                or      a
3281
                jp      nz,SINTAX_ERROR
3282
                inc     hl
3283
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3284
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3285
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3286
                ld      (TRD_5CDB),hl
3287
                ret
3288
 
3289
OPEN            ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
3290
                ld      (CH_ADD),hl
3291
                call    SET_NUM_CHAN
3292
                call    loc_1DD0
3293
loc_218E        call    GET_SYMSTR
3294
                cp      "A"
3295
                jr      nc,loc_219A
3296
                call    GET_NEXT_SYM
3297
                jr      loc_218E
3298
 
3299
loc_219A        cp      0A5h
3300
                push    af
3301
                call    z,sub_2158
3302
                pop     af
3303
                jr      z,loc_21AE
3304
                and     0DFh
3305
                cp      "R"
3306
                jr      z,loc_21AE
3307
                cp      "W"
3308
                jp      nz,SINTAX_ERROR
3309
loc_21AE        ld      (TRD_5D09),a
3310
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
3311
                ld      a,"#"
3312
                ld      (TRD_5CE5),a    ; €‘˜ˆ…ˆ… ”€‰‹€
3313
                ld      a,0
3314
                ld      (TRD_5CE6),a    ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
3315
                call    FIND_ENDFILE
3316
                push    af
3317
                call    CP_STREAMS
3318
                pop     af
3319
                push    af
3320
                call    nz,CREATE_BLOCK0
3321
                pop     af
3322
                call    OPEN_STREAM
3323
                ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
3324
                ld      bc,124h
3325
                add     hl,bc
3326
                ld      (TRD_5D11),hl   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
3327
                jp      END_COMAND
3328
 
3329
FIND_ENDFILE    ld      a,0Ah
3330
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
3331
                call    SET_CP_FILENAME
3332
                push    af
3333
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
3334
                pop     af
3335
                jr      nz,loc_2206
3336
                ld      a,(TRD_5D09)
3337
                cp      "R"
3338
                jr      z,loc_2201
3339
loc_21F1        ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
3340
                inc     (hl)
3341
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
3342
                jr      z,loc_21F1
3343
                ld      hl,TRD_5CE6     ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
3344
                dec     (hl)
3345
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
3346
loc_2201        call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
3347
                xor     a
3348
                ret
3349
 
3350
loc_2206        ld      a,(TRD_5D09)
3351
                cp      "R"
3352
                ret     nz
3353
                jp      ERR_NOFILES
3354
 
3355
CP_STREAMS      ld      a,(TRD_5CDB)
3356
                rst     20h
3357
                dw 1727h
3358
                ld      a,b
3359
                or      c
3360
                jp      nz,loc_221B
3361
                ret
3362
 
3363
loc_221B        ld      a,19h
3364
                ld      (ERR_NR),a
3365
                ld      hl,TXT_STREAMOPEN ; "Stream opened"
3366
                ld      a,0Ah
3367
loc_2225        jp      PRINT_TXTERR
3368
 
3369
loc_2228        ld      a,0Bh
3370
                ld      hl,TXT_NODISKFILE ; "Not disk file"
3371
                jr      loc_2225
3372
 
3373
INITFREEACCESS  push    hl
3374
                ld      c,20h
3375
                rst     28h
3376
                ld      a,(TRD_5CD7)    ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3377
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3378
                ld      (hl),a
3379
                inc     hl
3380
                xor     a
3381
                ld      (hl),a
3382
                inc     hl
3383
                ld      (hl),a
3384
                inc     hl
3385
                ld      (hl),a
3386
                ld      a,7Fh
3387
                pop     hl
3388
                ret
3389
 
3390
OPEN_STREAM     push    af
3391
                call    CP_STREAMS
3392
                ex      de,hl
3393
                ld      hl,(PROG)
3394
                ld      bc,(CHANS)
3395
                sbc     hl,bc
3396
                ex      de,hl
3397
                ld      (hl),e
3398
                inc     hl
3399
                ld      (hl),d
3400
                call    CREATE_HEADCHAN
3401
                ld      a,(TRD_5D09)
3402
                cp      0A5h
3403
                call    z,INITFREEACCESS
3404
                jr      z,loc_226B
3405
                ld      a,(TRD_5D09)
3406
                cp      "R"
3407
                ld      a,0FFh
3408
                jr      nz,loc_226B
3409
                xor     a
3410
loc_226B        ld      (hl),a
3411
                pop     af
3412
                jp      loc_2270
3413
loc_2270        push    af
3414
                ld      bc,14h
3415
                add     hl,bc
3416
                push    hl
3417
                call    GET_TEKSECFILE
3418
                pop     hl
3419
                inc     hl
3420
                ld      b,1
3421
                pop     af
3422
                or      a
3423
                push    af
3424
                call    nz,COM_06       ; ‡€ˆ‘œ ‘…Вސނ
3425
                pop     af
3426
                call    z,COM_05        ; —’…ˆ… ‘…Вސނ
3427
                ret
3428
 
3429
CREATE_BLOCK0   ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3430
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3431
                push    hl
3432
                ld      hl,2000h
3433
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3434
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3435
                call    CREATE_BLOCK
3436
                pop     hl
3437
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3438
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3439
                ret
3440
 
3441
CREATE_BLOCK    ld      hl,1000h
3442
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3443
                call    CP_FREE_ON_DISK ; Ž‚…Š€ ‘‚ށބŽƒŽ Œ…‘’€ € „ˆ‘Š…
3444
                call    SAVE_FILE
3445
                ld      hl,0
3446
                ld      (TRD_5CE8),hl   ; „‹ˆ€ Žƒ€ŒŒ›
3447
                call    SETHEADFILENAME
3448
                jp      REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
3449
 
3450
CREATE_HEADCHAN ld      hl,(PROG)
3451
                dec     hl
3452
                ld      (CURCHL),hl
3453
                push    hl
3454
                ld      bc,124h
3455
                call    RESERV_RAM
3456
                ld      a,0
3457
                ld      b,0
3458
loc_22C4        ld      (de),a
3459
                dec     de
3460
                djnz    loc_22C4
3461
                pop     hl
3462
                push    hl
3463
                ld      de,loc_3D0E
3464
                ld      (hl),e
3465
                inc     hl
3466
                ld      (hl),d
3467
                inc     hl
3468
                ld      de,loc_3D06
3469
                ld      (hl),e
3470
                inc     hl
3471
                ld      (hl),d
3472
                inc     hl
3473
                ld      (hl),"D"
3474
                inc     hl
3475
                inc     hl
3476
                inc     hl
3477
                inc     hl
3478
                inc     hl
3479
                ld      (hl),"$"
3480
                inc     hl
3481
                ld      (hl),1
3482
                inc     hl
3483
                ld      a,(TRD_5CF6)    ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
3484
                ld      (hl),a
3485
                inc     hl
3486
                ld      a,(TRD_5D1E)
3487
                ld      (hl),a
3488
                inc     hl
3489
                ld      a,(TRD_5D09)
3490
                cp      "R"
3491
                ld      (hl),0
3492
                jr      z,loc_22FC
3493
                ld      a,(TRD_5CE8)    ; „‹ˆ€ Žƒ€ŒŒ›
3494
                ld      (hl),a
3495
loc_22FC        inc     hl
3496
                ld      (hl),b
3497
                jr      z,loc_2304
3498
                ld      a,(TRD_5CE8+1)  ; „‹ˆ€ Žƒ€ŒŒ›
3499
                ld      (hl),a
3500
loc_2304        inc     hl
3501
                ex      de,hl
3502
                pop     hl
3503
                push    de
3504
                ld      de,10h
3505
                add     hl,de
3506
                ex      de,hl
3507
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3508
                ld      bc,10h
3509
                ldir
3510
                pop     hl
3511
                ret
3512
 
3513
GET_ADRTEKSYM   ld      c,0Dh
3514
                rst     28h
3515
                ld      c,(hl)
3516
                rst     28h
3517
                ld      bc,24h
3518
                add     hl,bc
3519
                ret
3520
 
3521
GET_ADRTEKFRG   ld      c,24h
3522
ADR_OPEN_CHAN   ld      b,0
3523
                ld      hl,(CURCHL)
3524
                add     hl,bc
3525
                ret
3526
 
3527
CP_ENDOFSECTOR  ld      c,0Dh
3528
                rst     28h
3529
                inc     (hl)
3530
                ret     nz
3531
                push    hl
3532
                call    SET_DISK
3533
                call    SAVE_1_SECTOR   ; ‡€ˆ‘œ ’…Š“™…ƒŽ ‘…Вސ€
3534
                pop     hl
3535
                inc     hl
3536
                inc     (hl)
3537
                push    hl
3538
                call    LOAD_1_SECTOR
3539
                pop     hl
3540
                ld      a,10h
3541
                cp      (hl)
3542
                ret     nz
3543
                push    hl
3544
                ld      c,0Fh
3545
                rst     28h
3546
                ld      a,(hl)
3547
                cp      7Fh
3548
                pop     hl
3549
                jr      z,loc_2358
3550
                ld      hl,(CURCHL)
3551
                call    SAVE_HEAD_BLK
3552
                ld      c,0Eh
3553
                rst     28h
3554
                jp      loc_2379
3555
 
3556
loc_2358        call    FIND_NEXT_BLK
3557
                push    af
3558
                call    z,LOAD_1_SECTOR
3559
                ld      c,0Eh
3560
                rst     28h
3561
                pop     af
3562
                call    nz,CREATE_NEWBLOCK
3563
                ret
3564
 
3565
sub_2367        ld      (hl),0
3566
                ld      c,19h
3567
                rst     28h
3568
                ld      d,20h
3569
                ld      e,(hl)
3570
                ret
3571
 
3572
CREATE_NEWBLOCK call    sub_2367
3573
                ld      (TRD_5CD7),de   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3574
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3575
                jr      CREATE_BLK
3576
 
3577
loc_2379        call    sub_2367
3578
                inc     e
3579
                ld      (TRD_5CD7),de   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3580
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3581
CREATE_BLK      call    CREATE_BLOCK
3582
                call    DEL_BUF         ; “„€‹…ˆ… “”…€,…‘‹ˆ  Ž …‘’œ
3583
                ld      c,10h
3584
                rst     28h
3585
                ex      de,hl
3586
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3587
                ld      bc,10h
3588
                ldir
3589
                ld      c,0Ch
3590
                rst     28h
3591
                ld      a,(TRD_5D1E)
3592
                ld      (hl),a
3593
                ret
3594
 
3595
FIND_END_SEC    ld      c,0Dh
3596
                rst     28h
3597
                inc     (hl)
3598
                ret     nz
3599
                inc     hl
3600
                inc     (hl)
3601
                push    hl
3602
                call    SET_DISK
3603
                ld      c,23h
3604
                rst     28h
3605
                ld      a,(hl)
3606
                or      a
3607
                jr      z,loc_23B6
3608
                pop     hl
3609
                push    hl
3610
                dec     (hl)
3611
                call    SAVE_1_SECTOR   ; ‡€ˆ‘œ ’…Š“™…ƒŽ ‘…Вސ€
3612
                pop     hl
3613
                push    hl
3614
                inc     (hl)
3615
loc_23B6        call    LOAD_1_SECTOR
3616
                pop     hl
3617
                ld      a,10h
3618
                cp      (hl)
3619
                call    z,OPEN_NEXT_BLK
3620
                ret
3621
 
3622
OPEN_NEXT_BLK   call    FIND_NEXT_BLK
3623
                push    af
3624
                call    DEL_BUF         ; “„€‹…ˆ… “”…€,…‘‹ˆ  Ž …‘’œ
3625
                pop     af
3626
                jp      nz,ERR_ENDOFFILE
3627
                jp      LOAD_1_SECTOR
3628
 
3629
FIND_NEXT_BLK   ld      (hl),0
3630
                ld      c,19h
3631
                rst     28h
3632
                inc     (hl)
3633
                ld      c,10h
3634
                rst     28h
3635
                ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3636
                ld      bc,10h
3637
                ldir
3638
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
3639
                ret     nz
3640
OPEN_BLK        call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
3641
                ld      c,10h
3642
                rst     28h
3643
                ex      de,hl
3644
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3645
                ld      bc,10h
3646
                ldir
3647
                ld      c,0Ch
3648
                rst     28h
3649
                ld      a,(TRD_5D1E)
3650
                ld      (hl),a
3651
                xor     a
3652
                ret
3653
 
3654
; ‡€ˆ‘œ ’…Š“™…ƒŽ ‘…Вސ€
3655
SAVE_1_SECTOR   call    GET_TEKSECFILE
3656
                call    GET_ADRTEKFRG
3657
                ld      b,1
3658
                call    COM_06          ; ‡€ˆ‘œ ‘…Вސނ
3659
                ld      c,0Fh
3660
                rst     28h
3661
                ld      a,(hl)
3662
                cp      7Fh
3663
                ret     z
3664
                call    GET_ADRTEKFRG
3665
                xor     a
3666
                ld      b,a
3667
loc_2413        ld      (hl),a
3668
                inc     hl
3669
                djnz    loc_2413
3670
                ret
3671
 
3672
LOAD_1_SECTOR   call    GET_TEKSECFILE
3673
                call    GET_ADRTEKFRG
3674
                ld      b,1
3675
                jp      COM_05          ; —’…ˆ… ‘…Вސނ
3676
 
3677
GET_TEKSECFILE  ld      hl,(CURCHL)
3678
                ld      bc,1Eh
3679
                add     hl,bc
3680
                ld      e,(hl)
3681
                inc     hl
3682
                ld      d,(hl)
3683
                ld      c,0Eh
3684
                rst     28h
3685
                ld      b,(hl)
3686
                dec     b
3687
                inc     b
3688
                push    af
3689
                ld      a,10h
3690
                jr      z,loc_2441
3691
loc_2438        inc     e
3692
                cp      e
3693
                jr      nz,loc_243F
3694
                ld      e,0
3695
                inc     d
3696
loc_243F        djnz    loc_2438
3697
loc_2441        pop     af
3698
                ret
3699
 
3700
SET_DISK        ld      c,0Bh
3701
                rst     28h
3702
                ld      a,(hl)
3703
                jp      COM_01          ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
3704
 
3705
OUT_SYM2FILE    ld      hl,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
3706
                push    hl
3707
;===============PATCH
3708
;               ld      hl,CP_INTERFACE1 ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
3709
;               push    hl
3710
                DUPL 4,0
3711
;===============PATCH
3712
                push    af
3713
;===============PATCH
3714
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
3715
                DUPL 3,0
3716
;===============PATCH
3717
                ld      a,0Ah
3718
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
3719
                pop     af
3720
                call    WORK4FREEACCESS
3721
                push    af
3722
                call    CP_FILE_OPENED
3723
                jp      z,ERR_INVALID_IO
3724
                pop     af
3725
                call    GET_ADRTEKSYM
3726
                ld      (hl),a
3727
                jp      CP_ENDOFSECTOR
3728
 
3729
CP_END_BLK      ld      c,0Dh
3730
                rst     28h
3731
                ld      a,(hl)
3732
                ld      bc,0Eh
3733
                add     hl,bc
3734
                cp      (hl)
3735
                ret     nz
3736
                ld      c,0Eh
3737
                rst     28h
3738
                ld      a,(hl)
3739
                ld      bc,0Eh
3740
                add     hl,bc
3741
                cp      (hl)
3742
                ret     nz
3743
                ld      hl,TRD_5CB6     ; „‹Ÿ Ž‚…Šˆ €‹ˆ—ˆŸ INTERFACE1
3744
                ld      a,(hl)
3745
                cp      0F4h
3746
                jr      z,ERR_ENDOFFILE
3747
                bit     4,(hl)
3748
                jr      z,ERR_ENDOFFILE
3749
                or      1
3750
                pop     hl
3751
                ret
3752
 
3753
ERR_ENDOFFILE   ld      a,7
3754
loc_2494        ld      (ERR_NR),a
3755
                call    DELETE_BUF
3756
                rst     20h
3757
                dw 58h
3758
                ret
3759
 
3760
ERR_INVALID_IO  ld      a,17h
3761
                jr      loc_2494
3762
 
3763
WORK4FREEACCESS ld      d,a
3764
                ld      c,0Fh
3765
                rst     28h
3766
                ld      a,(hl)
3767
                cp      7Fh
3768
                ld      a,d
3769
                ret     nz
3770
                ld      bc,13h
3771
                add     hl,bc
3772
                ld      a,(hl)
3773
                or      a
3774
                ld      a,d
3775
                jr      nz,loc_24D5
3776
                dec     hl
3777
                ld      a,(hl)
3778
                or      a
3779
                jr      nz,loc_24C2
3780
                push    bc
3781
                push    hl
3782
                push    de
3783
                call    W16B2WORKSP
3784
                pop     de
3785
                pop     hl
3786
                pop     bc
3787
loc_24C2        ld      c,(hl)
3788
                ld      a,d
3789
                ex      de,hl
3790
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
3791
                add     hl,bc
3792
                cp      6
3793
                ld      (hl),a
3794
                call    z,WORK_NUMSAVE
3795
                ld      c,21h
3796
                rst     28h
3797
                inc     (hl)
3798
                pop     hl
3799
                ret
3800
 
3801
loc_24D5        dec     hl
3802
                ld      a,(hl)
3803
                dec     hl
3804
                inc     a
3805
                cp      (hl)
3806
                inc     hl
3807
                inc     (hl)
3808
                push    hl
3809
                push    af
3810
                ld      c,23h
3811
                rst     28h
3812
                ld      (hl),0FFh
3813
                pop     af
3814
                pop     hl
3815
                jr      c,loc_24EE
3816
                ld      a,d
3817
                cp      0Dh
3818
                jr      z,loc_24F2
3819
                pop     bc
3820
                ret
3821
 
3822
loc_24EE        ld      a,d
3823
                cp      0Dh
3824
                ret     nz
3825
loc_24F2        xor     a
3826
                ld      (hl),a
3827
                inc     hl
3828
                ld      (hl),a
3829
                ld      a,d
3830
                ret
3831
 
3832
W16B2WORKSP     ld      hl,(WORKSP)
3833
                ld      (TRD_5CCF),hl   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
3834
                ld      bc,10h
3835
                jp      CREATE_FREERAM
3836
 
3837
WORK_NUMSAVE    ld      (hl),0Dh
3838
                ld      hl,(CH_ADD)
3839
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3840
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3841
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
3842
                ld      (CH_ADD),hl
3843
                ld      hl,FLAGS
3844
                res     7,(hl)
3845
                call    BC2STKBOT
3846
                ld      hl,FLAGS
3847
                set     7,(hl)
3848
                ld      hl,(TRD_5CCF)   ; ‚…Œ…Ž… ‘Ž•€…ˆ… WORK_SP
3849
                ld      (CH_ADD),hl
3850
                call    BC2STKBOT
3851
                call    FIND_LAST
3852
                push    bc
3853
                pop     de
3854
                ld      c,20h
3855
                rst     28h
3856
                ld      b,(hl)
3857
                xor     a
3858
                ld      hl,0
3859
                ld      (TRD_5CDB),hl
3860
loc_2538        add     hl,de
3861
                jr      nc,loc_2544
3862
                push    hl
3863
                ld      hl,(TRD_5CDB)
3864
                inc     hl
3865
                ld      (TRD_5CDB),hl
3866
                pop     hl
3867
loc_2544        djnz    loc_2538
3868
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3869
                ld      a,(TRD_5CDB)
3870
                ld      hl,TRD_5CDA
3871
                rrd
3872
                and     0Fh
3873
                ld      (TRD_5CDB),a
3874
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3875
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3876
                ld      (CH_ADD),hl
3877
                call    OPEN_SAVED
3878
                ld      c,21h
3879
                rst     28h
3880
                ld      a,0FFh
3881
                ld      (hl),a
3882
                inc     hl
3883
                ld      (hl),a
3884
                ret
3885
 
3886
OPEN_SAVED      ld      c,19h
3887
                rst     28h
3888
                ld      a,(TRD_5CDA)
3889
                cp      (hl)
3890
                jp      nz,loc_2584
3891
                ld      c,0Eh
3892
                rst     28h
3893
                ld      a,(TRD_5CDB)
3894
                cp      (hl)
3895
                jp      nz,loc_25A7
3896
loc_257C        ld      c,0Dh
3897
                rst     28h
3898
                ld      a,(TRD_5CD9)    ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3899
                ld      (hl),a
3900
                ret
3901
 
3902
loc_2584        call    CPANDZERO23
3903
                call    nz,SAVE_TEK_SEC
3904
                ld      a,(TRD_5CDA)
3905
                ld      c,19h
3906
                rst     28h
3907
                ld      (hl),a
3908
                ld      c,10h
3909
                rst     28h
3910
                ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
3911
                ld      bc,10h
3912
                ldir
3913
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
3914
                jp      nz,loc_25D2
3915
                call    OPEN_BLK
3916
                jr      loc_25AD
3917
 
3918
loc_25A7        call    CPANDZERO23
3919
                call    nz,SAVE_TEK_SEC
3920
loc_25AD        ld      a,(TRD_5CDB)
3921
                ld      c,0Eh
3922
                rst     28h
3923
                ld      (hl),a
3924
                push    hl
3925
                call    SET_DISK
3926
                call    LOAD_1_SECTOR
3927
                pop     hl
3928
                dec     hl
3929
                ld      a,(TRD_5CD9)    ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3930
                ld      (hl),a
3931
                jr      loc_257C
3932
 
3933
SAVE_TEK_SEC    call    SET_DISK
3934
                call    SAVE_1_SECTOR   ; ‡€ˆ‘œ ’…Š“™…ƒŽ ‘…Вސ€
3935
                ret
3936
 
3937
CPANDZERO23     ld      c,23h
3938
                rst     28h
3939
                ld      a,(hl)
3940
                or      a
3941
                ld      (hl),0
3942
                ret
3943
 
3944
loc_25D2        ld      hl,(TRD_5CDA)
3945
                ld      h,20h
3946
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
3947
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
3948
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3949
                push    hl
3950
                ld      hl,(TRD_5CDB)
3951
                push    hl
3952
                call    CREATE_BLK
3953
                pop     hl
3954
                ld      (TRD_5CDB),hl
3955
                pop     hl
3956
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
3957
                jr      loc_25AD
3958
 
3959
INPUTDATAFILE
3960
;===============PATCH
3961
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
3962
                DUPL 3,0
3963
;===============PATCH
3964
                ld      hl,TV_FLAG
3965
                res     3,(hl)
3966
                ld      hl,(ERR_SP)
3967
                ld      e,(hl)
3968
                inc     hl
3969
                ld      d,(hl)
3970
                or      a
3971
                ld      hl,107Fh
3972
                sbc     hl,de
3973
                jr      nz,loc_2626
3974
                ld      sp,(ERR_SP)
3975
                pop     de
3976
                pop     de
3977
                ld      (ERR_SP),de
3978
loc_260F        call    INPUT_SYM_FILE
3979
                jr      c,loc_261D
3980
loc_2614        ld      hl,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
3981
                push    hl
3982
                ld      hl,DELETE_BUF
3983
                push    hl
3984
                ret
3985
 
3986
loc_261D        cp      0Dh
3987
                jr      z,loc_2614
3988
                rst     20h
3989
                dw 0F85h
3990
                jr      loc_260F
3991
 
3992
loc_2626        call    INPUT_SYM_FILE
3993
                jr      loc_2614
3994
 
3995
INPUT_SYM_FILE  ld      a,0Ah
3996
                ld      (TRD_5D06),a    ; ŠŽ‹ˆ—…‘’‚Ž ‘ˆŒ‚ދނ ˆŒ…ˆ ”€‰‹€ ˆ Žˆ‘Š…
3997
                call    CP_FILE_OPENED
3998
                jr      z,loc_2642
3999
                cp      7Fh
4000
                jp      nz,ERR_INVALID_IO
4001
                ld      bc,13h
4002
                add     hl,bc
4003
                ld      (hl),0
4004
                jr      loc_2645
4005
 
4006
loc_2642        call    CP_END_BLK
4007
loc_2645        call    GET_ADRTEKSYM
4008
                ld      a,(hl)
4009
                push    af
4010
                call    FIND_END_SEC
4011
                pop     af
4012
                scf
4013
                ret
4014
 
4015
CP_FILE_OPENED  ld      c,0Fh
4016
                rst     28h
4017
                ld      a,(hl)
4018
                or      a
4019
                ret
4020
 
4021
CLOSE           ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
4022
                ld      (CH_ADD),hl
4023
                call    SET_NUM_CHAN
4024
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
4025
                ld      a,(TRD_5CDB)
4026
                rst     20h
4027
                dw 1727h
4028
                ld      a,b
4029
                or      c
4030
                jp      z,END_COMAND
4031
                push    hl
4032
                ld      hl,(CHANS)
4033
                add     hl,bc
4034
                ld      a,(hl)
4035
                ld      hl,loc_3D0E
4036
                cp      h
4037
                pop     hl
4038
                jp      nz,loc_2228
4039
                ld      (hl),0
4040
                inc     hl
4041
                ld      (hl),0
4042
                ld      (TRD_5CD9),bc   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
4043
                ld      hl,(CHANS)
4044
                add     hl,bc
4045
                dec     hl
4046
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
4047
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
4048
                call    sub_26CE
4049
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
4050
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
4051
                ld      bc,124h
4052
                call    DEL_WORKRAM
4053
                ld      hl,STRMS
4054
                ld      b,10h
4055
loc_269D        push    bc
4056
                ld      bc,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
4057
                ld      e,(hl)
4058
                inc     hl
4059
                ld      d,(hl)
4060
                ex      de,hl
4061
                sbc     hl,bc
4062
                ex      de,hl
4063
                jr      c,loc_26BC
4064
                ld      d,(hl)
4065
                dec     hl
4066
                ld      e,(hl)
4067
                inc     hl
4068
                push    hl
4069
                ex      de,hl
4070
                ld      bc,124h
4071
                sbc     hl,bc
4072
                ex      de,hl
4073
                pop     hl
4074
                ld      (hl),d
4075
                dec     hl
4076
                ld      (hl),e
4077
                inc     hl
4078
loc_26BC        inc     hl
4079
                pop     bc
4080
                djnz    loc_269D
4081
                ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
4082
                ld      bc,124h
4083
                sbc     hl,bc
4084
                ld      (TRD_5D11),hl   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
4085
                jp      END_COMAND
4086
 
4087
sub_26CE        ld      bc,0Fh
4088
                add     hl,bc
4089
                ld      a,(hl)
4090
                or      a
4091
                ret     z
4092
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
4093
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
4094
                ld      (CURCHL),hl
4095
                call    SAVE_HEAD_BLK
4096
                jp      SAVE_1_SECTOR   ; ‡€ˆ‘œ ’…Š“™…ƒŽ ‘…Вސ€
4097
 
4098
SAVE_HEAD_BLK   ld      bc,0Dh
4099
                add     hl,bc
4100
                ld      e,(hl)
4101
                inc     hl
4102
                ld      d,(hl)
4103
                ld      bc,0Dh
4104
                add     hl,bc
4105
                ld      (hl),e
4106
                inc     hl
4107
                ld      (hl),d
4108
                ld      c,10h
4109
                rst     28h
4110
                ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
4111
                ld      bc,10h
4112
                ldir
4113
                call    SET_DISK
4114
                ld      c,0Ch
4115
                rst     28h
4116
                ld      c,(hl)
4117
                call    SETHEADFILENAME
4118
                jp      REWRITE_9SEC    ; ……‡€ˆ‘œ 9 ‘…Вސ€
4119
 
4120
; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
4121
PRINT_MSG       ld      a,(hl)
4122
                or      a
4123
                ret     z
4124
                and     7Fh
4125
                rst     10h
4126
                bit     7,(hl)
4127
                ret     nz
4128
                inc     hl
4129
                jr      PRINT_MSG       ; …—€’œ ’…Š‘’Ž‚ŽƒŽ ‘ŽŽ™…ˆŸ
4130
 
4131
COMPARE_B_SYM   ld      a,(de)
4132
                cp      (hl)
4133
                ret     nz
4134
                inc     de
4135
                inc     hl
4136
                djnz    COMPARE_B_SYM
4137
                ret
4138
 
4139
loc_271B        ld      hl,TXT_NODISK_  ; "No disk"
4140
                ld      a,6
4141
                jp      PRINT_TXTERR
4142
 
4143
ERR_DIRFULL     ld      hl,TXT_DIRFULL  ; "Directory full"
4144
                ld      a,4
4145
                jp      PRINT_TXTERR
4146
 
4147
SET_TAPELDERR   ld      a,1Ah
4148
                jr      SET_NUM_ERR
4149
 
4150
                ld      a,12h
4151
SET_NUM_ERR     ld      (ERR_NR),a
4152
                ret
4153
 
4154
                ld      a,3
4155
                jr      SET_NUM_ERR
4156
 
4157
COM_15          xor     a               ; Ž‚…Š€ „ŽŽ†Šˆ
4158
                ld      (TRD_5CD7+1),a  ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
4159
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
4160
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
4161
                in      a,(1Fh)
4162
                ld      (TRD_5CCD),a    ; #80-ƒŽ’Ž‚Ž‘’œ „ˆ‘ŠŽ‚Ž„€
4163
                ld      e,d
4164
                push    de
4165
                ld      a,e
4166
                out     (7Fh),a
4167
;===============PATCH
4168
;               ld      a,1Bh
4169
                LD A,0X18
4170
;===============PATCH
4171
                call    COM2VG_WAIT
4172
                ld      a,(TRD_5CCD)    ; #80-ƒŽ’Ž‚Ž‘’œ „ˆ‘ŠŽ‚Ž„€
4173
                and     80h
4174
                call    nz,PAUSE_3_C_A
4175
                pop     de
4176
                call    CP_NUM_TRACK
4177
                ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
4178
                or      a
4179
                ret     z
4180
                ld      a,7
4181
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
4182
                ret
4183
 
4184
TXT_OK_         DB "O.K.",0
4185
TXT_VERIFYERR   DB "Verify Error.",8Dh
4186
TXT_BACKUPDISK  DB "BACKUP DISK",8Dh
4187
TXT_INS_DEST    DB "Insert Destination disk",0Dh,"then press Y",0
4188
TXT_INS_SRC     DB "Insert Source disk then press Y",0
4189
TXT_BREAK       DB "*BREAK*",8Dh
4190
TXT_OUTRAM      DB "Out of RAM",8Dh
4191
TXT_ARRAYNOT    DB "Array not found",8Dh
4192
TXT_DIRFULL     DB "Directory full",8Dh
4193
TXT_NODISK_     DB "No disk",8Dh
4194
TXT_STREAMOPEN  DB "Stream opened",8Dh
4195
TXT_NODISKFILE  DB "Not disk file",8Dh
4196
TXT_FILEEXIST   DB "File exists",0Dh
4197
                DC "Over write?(Y/N)"
4198
 
4199
CALL_3D13       push    af
4200
                push    bc
4201
                ld      (TRD_5D04),de
4202
                ld      (TRD_5D02),hl
4203
;===============PATCH
4204
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
4205
                DUPL 3,0
4206
;===============PATCH
4207
                ld      a,0FFh
4208
                ld      (TRD_5D15),a    ; …‘‹ˆ 0,…—€’€’œ ˜€Š“ TR-DOS.ˆ€—… … …—€’€’œ
4209
                ld      (TRD_5D1F),a
4210
                pop     bc
4211
                pop     af
4212
                ld      hl,CP_ERROR     ;  คเฅแ ง ขฅเ่ฅญจ๏ จญโฅเฏเฅโ โฎเ 
4213
                ld      (TRD_5D1A),hl   ; ‚“’…ˆ‰ €„…‘ ‡€‚…˜…ˆŸ ˆ’……’€’ސ€ ŠŽŒ€„
4214
                ld      hl,0
4215
                add     hl,sp
4216
                ld      (TRD_5D1C),hl   ; แฎๅเ ญฅญจฅ โฅชใ้ฅฃฎ แโฅช 
4217
                dec     hl
4218
                dec     hl
4219
                ld      sp,hl
4220
                push    af
4221
                call    MARK_SP         ; “‘’€Ž‚Š€ ‘’…Š€ „‹Ÿ ……•‚€’€ Ž˜ˆŽŠ
4222
                ld      hl,COMAND_TBL
4223
loc_2869        ld      a,(hl)
4224
                cp      c
4225
                jr      nz,loc_287F
4226
                pop     af
4227
                inc     hl
4228
                ld      e,(hl)
4229
                inc     hl
4230
                ld      d,(hl)
4231
                ld      hl,END_COMAND
4232
                push    hl
4233
                push    de
4234
                ld      hl,(TRD_5D02)
4235
                ld      de,(TRD_5D04)
4236
                ret
4237
 
4238
loc_287F        cp      0FFh
4239
                jr      nz,loc_2887
4240
                pop     af
4241
                jp      END_COMAND
4242
 
4243
loc_2887        inc     hl
4244
                inc     hl
4245
                inc     hl
4246
                jr      loc_2869
4247
 
4248
COMAND_TBL      db 0
4249
                dw COM_00               ; ‚Ž‘‘’€Ž‚‹…ˆ… ‚ƒ93
4250
                db 1
4251
                dw COM_01               ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
4252
                db 2
4253
                dw COM_02               ; “‘’€Ž‚Š€ ƒŽ‹Ž‚Šˆ € „ސކГ
4254
                db 3
4255
                dw COM_03               ; “‘’€Ž‚Š€ ŽŒ…€ ‘…Вސ€
4256
                db 4
4257
                dw COM_04               ; “‘’€Ž‚Š€ €„…‘€ “”…€
4258
                db 5
4259
                dw COM_05               ; —’…ˆ… ‘…Вސނ
4260
                db 6
4261
                dw COM_06               ; ‡€ˆ‘œ ‘…Вސނ
4262
                db 7
4263
                dw COM_07               ; ‚›‚Ž„ Š€’€‹Žƒ€ ‚ Š€€‹
4264
                db 8
4265
                DW COM_08               ;‘—ˆ’›‚€ˆ… Žˆ‘€’…‹Ÿ ‚ “”… 0X5CDD
4266
                db 9
4267
                dw COM_09               ; ‡€ˆ‘œ Žˆ‘€’…‹Ÿ ”€‰‹€ € „ˆ‘Š
4268
                db 0Ah
4269
                dw COM_0A               ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ˆ €‘˜ˆ…ˆž
4270
                db 0Bh
4271
                DW COM_0B               ;‡€ˆ‘œ ‹ŽŠ€ ŠŽ„Ž‚ € „ˆ‘Š
4272
                db 0Ch
4273
                dw COM_0C               ; ‡€ˆ‘œ …‰‘ˆŠ Žƒ€ŒŒ› € „ˆ‘Š
4274
                db 0Dh
4275
                dw END_COMAND
4276
                db 0Eh
4277
                dw COM_0E               ; ‡€ƒ“‡Š€ ˆ‹ˆ Ž‚…Š€ ”€‰‹€
4278
                db 0Fh
4279
                dw END_COMAND
4280
                db 10h
4281
                dw END_COMAND
4282
                db 11h
4283
                dw END_COMAND
4284
                db 12h
4285
                dw COM_12               ; “„€‹…ˆ… ”€‰‹€
4286
                db 13h
4287
                DW COM_13               ;……Ž‘ Žˆ‘€’…‹Ÿ ”€‰‹€ ‚ “”… 0X5CDD
4288
                db 14h
4289
                DW COM_14               ;……Ž‘ Žˆ‘€’…‹Ÿ ”€‰‹€ ˆ‡ “”…€ 0X5CDD
4290
                db 15h
4291
                dw COM_15               ; Ž‚…Š€ „ŽŽ†Šˆ
4292
                db 16h
4293
                DW COM_16               ;“‘’€Ž‚Š€ ‘’ŽŽ› 0 „ˆ‘Š€
4294
                db 17h
4295
                DW COM_17               ;“‘’€Ž‚Š€ ‘’ŽŽ› 1 „ˆ‘Š€
4296
                db 18h
4297
                dw COM_18               ; €‘’Ž‰Š€ € „ˆ‘Š…’“
4298
                db 0FFh
4299
 
4300
COM_07          push    af              ; ‚›‚Ž„ Š€’€‹Žƒ€ ‚ Š€€‹
4301
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
4302
                pop     af
4303
                jp      loc_479
4304
 
4305
COM_13          xor     a               ; ……Ž‘ Žˆ‘€’…‹Ÿ ”€‰‹€ ‚ “”… #5CDD
4306
                jr      loc_28E5
4307
 
4308
COM_14          ld      a,0FFh          ; ……Ž‘ Žˆ‘€’…‹Ÿ ”€‰‹€ ˆ‡ “”…€ #5CDD
4309
loc_28E5        ld      de,TRD_5CDD     ; ˆŒŸ ”€‰‹€
4310
                ld      bc,10h
4311
                or      a
4312
                jr      z,loc_28EF      ; FIX
4313
                ex      de,hl
4314
loc_28EF        ldir                    ; FIX
4315
                ret
4316
 
4317
COM_0C          call    COM_18          ; ‡€ˆ‘œ …‰‘ˆŠ Žƒ€ŒŒ› € „ˆ‘Š
4318
                call    CP_FREE_ON_DISK ; Ž‚…Š€ ‘‚ށބŽƒŽ Œ…‘’€ € „ˆ‘Š…
4319
                jp      loc_1B27
4320
 
4321
COM_0B          ld      (TRD_5CD7),hl   ; ‡€ˆ‘œ ŠŽ„Ž‚ŽƒŽ ”€‰‹€ € „ˆ‘Š
4322
                ld      (TRD_5CD9),de   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
4323
                ld      (TRD_5CDB),de
4324
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
4325
                call    CP_FREE_ON_DISK ; Ž‚…Š€ ‘‚ށބŽƒŽ Œ…‘’€ € „ˆ‘Š…
4326
                jp      loc_1B53
4327
 
4328
COM_0E          or      a               ; ‡€ƒ“‡Š€ ˆ‹ˆ Ž‚…Š€ ”€‰‹€
4329
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
4330
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
4331
                ld      (TRD_5CDB),de
4332
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4333
                call    FIND_RD_HEAD
4334
                call    CP_PARAMS       ; €‘’Ž‰Š€ €€Œ…’Ž‚ ‡€ƒ“‡Šˆ ”€‰‹€
4335
                jp      RD_FILE
4336
 
4337
COM_12          call    COM_18          ; “„€‹…ˆ… ”€‰‹€
4338
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4339
                jp      ERASE_FILES     ; “„€‹…ˆ… ”€‰‹€ € „ˆ‘Š…
4340
 
4341
; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ
4342
FIND_FILE       call    SET_FILENAME    ; ……Ž‘ ‡€„€ŽƒŽ ˆŒ…ˆ ”€‰‹€ ‚ “”… #5CDD
4343
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
4344
                jp      FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4345
 
4346
; …—€’œ ˆŒ…ˆ ”€‰‹€
4347
PRINT_FILENAME  push    bc
4348
                ld      b,8
4349
loc_293B        ld      a,(hl)
4350
                rst     10h
4351
                inc     hl
4352
                djnz    loc_293B
4353
                ld      a,"<"
4354
                rst     10h
4355
                ld      a,(hl)
4356
                rst     10h
4357
                ld      a,">"
4358
                rst     10h
4359
                pop     bc
4360
                ret
4361
 
4362
; ‘އ„€ˆ… “”…€
4363
CREATE_BUF      push    hl
4364
                push    de
4365
                push    bc
4366
                push    af
4367
                ld      hl,TRD_5D0C
4368
                ld      a,(hl)
4369
                or      a
4370
                jr      z,loc_2992
4371
                push    hl
4372
                ld      bc,257          ; €‡Œ… “”…€ ‘…Вސ€
4373
                push    bc
4374
                call    CP_FREE_RAM
4375
                pop     bc
4376
                pop     hl
4377
                ld      (hl),0
4378
                ld      hl,TRD_5D25
4379
                call    RESERV_RAM
4380
                ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
4381
                ld      bc,257          ; €‡Œ… “”…€ ‘…Вސ€
4382
                add     hl,bc
4383
                jr      loc_298F
4384
 
4385
; “„€‹…ˆ… “”…€,…‘‹ˆ  Ž …‘’œ
4386
DEL_BUF         push    hl
4387
                push    de
4388
                push    bc
4389
                push    af
4390
                ld      hl,TRD_5D0C
4391
                ld      a,(hl)
4392
                or      a
4393
                jr      nz,loc_2992
4394
                ld      (hl),0FFh
4395
                ld      hl,TRD_5D25
4396
                ld      bc,257          ; €‡Œ… “”…€ ‘…Вސ€
4397
                call    DEL_WORKRAM
4398
                or      a
4399
                ld      bc,257          ; €‡Œ… “”…€ ‘…Вސ€
4400
                ld      hl,(TRD_5D11)   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
4401
                sbc     hl,bc
4402
loc_298F        ld      (TRD_5D11),hl   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
4403
loc_2992        pop     af
4404
                pop     bc
4405
                pop     de
4406
                pop     hl
4407
                ret
4408
 
4409
COM_40          xor     a
4410
loc_2998        ld      (TRD_5CD7),a    ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
4411
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
4412
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
4413
                call    CP_SECOND_SYM   ; Ž‚…Š€ ‘‹…„“ž™…ƒŽ ‘ˆŒ‚Ž‹€
4414
                jp      z,SINTAX_ERROR
4415
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
4416
                ld      a,(TRD_5CD7)    ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
4417
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
4418
                ld      (hl),a
4419
                jp      ERR_OK
4420
 
4421
COM_80          ld      a,80h
4422
                jr      loc_2998
4423
 
4424
TXT_ERROR_      db 0Dh,"*ERROR*",8Dh
4425
TXT_NOSPACE_    db 0Dh,"No space",8Dh
4426
TXT_FILEEXISTS_ db 0Dh,"File exists",8Dh
4427
TXT_FREE_       DB " Free",8Dh
4428
READ_ONLY       db 0Dh
4429
                DC "Read Only"
4430
TXT_DISCERROR_  db 0Dh
4431
                DC "Disc Error"
4432
TXT_R_O         db 0Dh
4433
                DC "Rec.  O/F"
4434
TXT_TITLE_      DC "Title: "
4435
TXT_RIA_        db 0Dh,"Retry,Abort,Ignore?",0
4436
TXT_TRK_        db 0Dh
4437
                DC "Trk "
4438
TXT_SEC_        DC " sec "
4439
TXT_DELFILE_    DB " Del. File",8Dh
4440
TXT_NOFILES_    db 0Dh
4441
TXT_NOFILES     DB "No"
4442
TXT_FILES_      DB " File(s)",8Dh,0
4443
 
4444
sub_2A35        ld      hl,loc_2A41
4445
                ld      de,4080h
4446
                ld      bc,20h
4447
                ldir                    ; FIX
4448
                ret
4449
 
4450
loc_2A41        ld      a,(loc_3B5)
4451
                cp      0F3h
4452
                ld      a,10h
4453
                jr      z,loc_2A4B
4454
                xor     a
4455
loc_2A4B        ld      (KSTATE1),a
4456
                ld      bc,7FFDh
4457
                ld      a,10h
4458
                out     (c),a
4459
                ret
4460
 
4461
MAGIC           push    af
4462
                push    bc
4463
                push    de
4464
                push    hl
4465
                push    ix
4466
                push    iy
4467
                exx
4468
                push    bc
4469
                push    de
4470
                push    hl
4471
                ex      af,af'
4472
                push    af
4473
                ld      a,i
4474
                push    af
4475
                ld      a,r
4476
                push    af
4477
                ld      hl,0
4478
                add     hl,sp
4479
                push    hl
4480
                ld      a,3Ch
4481
                out     (0FFh),a
4482
                ld      a,3Fh
4483
                ld      i,a
4484
                in      a,(1Fh)
4485
                and     80h
4486
                rrca
4487
                rrca
4488
                rrca
4489
                ld      (KSTATE1),a
4490
                call    sub_2F65
4491
                call    PAUSE_3_C_A
4492
                call    PAUSE_3_C_A
4493
                ld      de,0Ah
4494
                ld      hl,4000h
4495
                push    hl
4496
                call    sub_2D73
4497
                ld      hl,4100h
4498
                ld      de,0Bh
4499
                call    sub_2D73
4500
                pop     hl
4501
                push    hl
4502
                ld      de,8
4503
                call    sub_2F1B
4504
                ld      hl,40E3h
4505
                ld      a,(hl)
4506
                ld      (KSTATE0),a
4507
                inc     hl
4508
                ld      a,(hl)
4509
                inc     (hl)
4510
                inc     hl
4511
                ld      e,(hl)
4512
                inc     hl
4513
                ld      d,(hl)
4514
                or      a
4515
                ex      de,hl
4516
                ld      de,0C0h
4517
                sbc     hl,de
4518
                ld      (40E5h),hl
4519
                ld      hl,4000h
4520
                ld      de,8
4521
                call    sub_2D73
4522
                pop     hl
4523
                ld      de,(40E1h)
4524
                push    de
4525
                ld      de,0Ah
4526
                call    sub_2F1B
4527
                pop     de
4528
                call    sub_2D4C
4529
                push    de
4530
                ld      a,3Ch
4531
                out     (0FFh),a
4532
                call    sub_2F65
4533
                ld      hl,4000h
4534
                ld      de,8
4535
                ld      b,1
4536
                call    sub_2F1B
4537
                pop     de
4538
                ld      hl,(40E1h)
4539
                ld      (40E1h),de
4540
                push    hl
4541
                ld      hl,4000h
4542
                ld      de,8
4543
                ld      b,1
4544
                call    sub_2D73
4545
                ld      a,(40E4h)
4546
                dec     a
4547
                call    sub_2CE5
4548
                ld      (hl),"@"
4549
                inc     hl
4550
                ld      b,7
4551
loc_2B09        ld      (hl)," "
4552
                inc     hl
4553
                djnz    loc_2B09
4554
                ld      (hl),"C"
4555
                pop     de
4556
                pop     bc
4557
                inc     hl
4558
                ld      (hl),c
4559
                inc     hl
4560
                ld      (hl),b
4561
                inc     hl
4562
                inc     hl
4563
                inc     hl
4564
                ld      (hl),0C0h
4565
                inc     hl
4566
                ld      (hl),e
4567
                inc     hl
4568
                ld      (hl),d
4569
                ld      hl,4000h
4570
                ld      de,0
4571
                in      a,(5Fh)
4572
                dec     a
4573
                ld      e,a
4574
                ld      b,1
4575
                call    sub_2D73
4576
                ld      hl,0
4577
                add     hl,sp
4578
                ld      (4140h),hl
4579
                ld      sp,41FFh
4580
                call    sub_2A35
4581
                ld      hl,0C000h
4582
                xor     a
4583
loc_2B3F        add     a,(hl)
4584
                inc     hl
4585
                ld      b,a
4586
                ld      a,h
4587
                or      a
4588
                ld      a,b
4589
                jr      nz,loc_2B3F
4590
                ld      hl,4100h
4591
                ld      (hl),a
4592
                push    hl
4593
                ld      hl,loc_2B58
4594
                push    hl
4595
                ld      hl,loc_3D2F
4596
                push    hl
4597
                di
4598
                jp      4080h
4599
 
4600
loc_2B58        pop     hl
4601
                ld      bc,7FFDh
4602
                ld      a,0AAh
4603
                ld      (4130h),a
4604
                ld      d,5
4605
                ld      a,(KSTATE1)
4606
                or      d
4607
                ld      d,a
4608
                out     (c),d
4609
                ld      a,(0C130h)
4610
                cp      0AAh
4611
                jp      nz,loc_2C1B
4612
                ld      a,d
4613
                and     0F8h
4614
                ld      d,a
4615
                inc     hl
4616
                ld      b,8
4617
loc_2B79        ld      (hl),d
4618
                out     (c),d
4619
                xor     a
4620
                ld      hl,0C000h
4621
loc_2B80        add     a,(hl)
4622
                inc     hl
4623
                ld      e,a
4624
                ld      a,h
4625
                or      a
4626
                ld      a,e
4627
                jr      nz,loc_2B80
4628
                ld      hl,4100h
4629
                cp      (hl)
4630
                inc     hl
4631
                jr      z,loc_2B93
4632
                inc     d
4633
                djnz    loc_2B79
4634
                dec     d
4635
loc_2B93        ld      b,8
4636
loc_2B95        push    bc
4637
                call    sub_2C37
4638
                pop     bc
4639
                djnz    loc_2B95
4640
                ld      c,0
4641
                call    sub_2F3A
4642
                call    sub_2D2A
4643
                ld      a,(40E4h)
4644
                ld      (4102h),a
4645
                inc     a
4646
                ld      (40E4h),a
4647
                ld      hl,(40E5h)
4648
                ld      de,1
4649
                sbc     hl,de
4650
                ld      (40E5h),hl
4651
                ret     c
4652
                ld      hl,(40E1h)
4653
                ld      (411Eh),hl
4654
                call    sub_2D1E
4655
                ld      a,38h
4656
                ld      (4111h),a
4657
                ld      a,1
4658
                ld      (411Dh),a
4659
                ld      hl,4100h
4660
                ld      (4119h),hl
4661
                ld      hl,100h
4662
                ld      (411Bh),hl
4663
                ld      de,(40E1h)
4664
                call    sub_2F65
4665
                ld      c,d
4666
                call    sub_2F3A
4667
                ld      hl,4100h
4668
                ld      b,1
4669
                call    loc_2D58
4670
                ld      (40E1h),de
4671
                ld      c,0
4672
                call    sub_2F3A
4673
                call    sub_2D34
4674
                ld      a,(4102h)
4675
                call    sub_2CE5
4676
                ld      de,4110h
4677
                ld      bc,10h
4678
                ex      de,hl
4679
                ldir
4680
                in      a,(5Fh)
4681
                dec     a
4682
                ld      e,a
4683
                ld      d,0
4684
                ld      hl,4000h
4685
                call    sub_2D73
4686
                ld      bc,7FFDh
4687
                ld      a,(4101h)
4688
                out     (c),a
4689
loc_2C1B        ld      hl,(4140h)
4690
                ld      sp,hl
4691
                ld      hl,4000h
4692
                ld      de,0Ah
4693
                call    sub_2F1B
4694
                ld      hl,4100h
4695
                ld      de,0Bh
4696
                call    sub_2F1B
4697
                ld      a,3Ch
4698
                push    af
4699
                jp      loc_2EBC
4700
 
4701
sub_2C37        ld      a,b
4702
                dec     a
4703
                ld      (4103h),a
4704
                ld      b,a
4705
                ld      a,(4101h)
4706
                and     7
4707
                cp      b
4708
                ret     z
4709
                ld      a,2
4710
                cp      b
4711
                ret     z
4712
                ld      a,(4101h)
4713
                and     8
4714
                jr      z,loc_2C55
4715
                ld      a,b
4716
                cp      7
4717
                ret     z
4718
                jr      loc_2C59
4719
 
4720
loc_2C55        ld      a,b
4721
                cp      5
4722
                ret     z
4723
loc_2C59        call    sub_2C5D
4724
                ret
4725
 
4726
sub_2C5D        ld      hl,4101h
4727
                ld      a,(hl)
4728
                and     0F8h
4729
                ld      c,a
4730
                ld      a,b
4731
                or      c
4732
                push    bc
4733
                ld      bc,7FFDh
4734
                out     (c),a
4735
                pop     bc
4736
                ld      hl,0C000h
4737
loc_2C70        ld      a,(hl)
4738
                or      a
4739
                jr      nz,loc_2C7A
4740
                inc     hl
4741
                ld      a,h
4742
                or      a
4743
                jr      nz,loc_2C70
4744
                ret
4745
 
4746
loc_2C7A        call    sub_2C7E
4747
                ret
4748
 
4749
sub_2C7E        ld      c,0
4750
                call    sub_2F3A
4751
                call    sub_2D2A
4752
                ld      a,(40E4h)
4753
                ld      (4102h),a
4754
                inc     a
4755
                ld      (40E4h),a
4756
                ld      hl,(40E5h)
4757
                ld      de,40h
4758
                sbc     hl,de
4759
                ld      (40E5h),hl
4760
                ret     c
4761
                ld      hl,(40E1h)
4762
                ld      (411Eh),hl
4763
                call    sub_2D1E
4764
                ld      a,40h
4765
                ld      (411Dh),a
4766
                ld      hl,0C000h
4767
                ld      (4119h),hl
4768
                ld      hl,4000h
4769
                ld      (411Bh),hl
4770
                ld      de,(40E1h)
4771
                call    sub_2D3E
4772
                ld      (40E1h),de
4773
                ld      c,0
4774
                call    sub_2F3A
4775
                call    sub_2D34
4776
                ld      a,(4102h)
4777
                call    sub_2CE5
4778
                ld      de,4110h
4779
                ld      bc,10h
4780
                ex      de,hl
4781
                ldir
4782
                in      a,(5Fh)
4783
                dec     a
4784
                ld      e,a
4785
                ld      d,0
4786
                ld      hl,4000h
4787
                call    sub_2D73
4788
                ret
4789
 
4790
sub_2CE5        ld      c,a
4791
                and     0F0h
4792
                rrca
4793
                rrca
4794
                rrca
4795
                rrca
4796
                ld      b,a
4797
                push    bc
4798
                ld      e,b
4799
                ld      d,0
4800
                ld      hl,4000h
4801
                push    de
4802
                call    sub_2F1B
4803
                pop     de
4804
                pop     bc
4805
                ld      b,0
4806
                ld      a,c
4807
                and     0Fh
4808
                rlca
4809
                rlca
4810
                rlca
4811
                rlca
4812
                ld      hl,4000h
4813
                add     a,l
4814
                ld      l,a
4815
                ret
4816
 
4817
sub_2D09        ld      hl,4110h
4818
                ld      b,9
4819
loc_2D0E        ld      (hl)," "
4820
                inc     hl
4821
                djnz    loc_2D0E
4822
                ld      a,"@"
4823
                ld      (4110h),a
4824
                ld      a,"C"
4825
                ld      (4118h),a
4826
                ret
4827
 
4828
sub_2D1E        call    sub_2D09
4829
                ld      a,(4103h)
4830
                add     a,"0"
4831
                ld      (4111h),a
4832
                ret
4833
 
4834
sub_2D2A        ld      hl,4000h
4835
                ld      de,8
4836
                call    sub_2F1B
4837
                ret
4838
 
4839
sub_2D34        ld      hl,4000h
4840
                ld      de,8
4841
                call    sub_2D73
4842
                ret
4843
 
4844
sub_2D3E        call    sub_2F65
4845
                ld      c,d
4846
                call    sub_2F3A
4847
                ld      hl,0C000h
4848
                ld      b,40h
4849
                jr      loc_2D58
4850
 
4851
sub_2D4C        call    sub_2F65
4852
                ld      c,d
4853
                call    sub_2F3A
4854
                ld      hl,4000h
4855
                ld      b,0C0h
4856
loc_2D58        push    bc
4857
                push    de
4858
                call    sub_2D73
4859
                ld      de,100h
4860
                add     hl,de
4861
                pop     de
4862
                inc     e
4863
                ld      a,e
4864
                cp      10h
4865
                jr      nz,loc_2D6F
4866
                ld      e,0
4867
                inc     d
4868
                ld      c,d
4869
                call    sub_2F3A
4870
loc_2D6F        pop     bc
4871
                djnz    loc_2D58
4872
                ret
4873
 
4874
sub_2D73        ld      a,e
4875
                inc     a
4876
                out     (5Fh),a
4877
                push    hl
4878
                ld      d,14h
4879
                push    de
4880
loc_2D7B        di
4881
                ld      c,7Fh
4882
                ld      a,0A0h
4883
                out     (1Fh),a
4884
                call    WR_DATAPORT
4885
                pop     de
4886
                pop     hl
4887
                in      a,(1Fh)
4888
                and     7Fh
4889
                ret     z
4890
                dec     d
4891
                push    hl
4892
                push    de
4893
                jr      nz,loc_2D7B
4894
                halt
4895
loc_2D92        ld      hl,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
4896
                ld      de,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
4897
                ld      a,(TRD_5CEA)    ; „‹ˆ€ ”€‰‹€ ‚ ‘…Вސ€•
4898
                ld      b,a
4899
                call    COM_05          ; —’…ˆ… ‘…Вސނ
4900
                ret
4901
 
4902
GOTO            call    SET_AND_PUT
4903
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
4904
                call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
4905
                call    SET_FILENAME    ; ……Ž‘ ‡€„€ŽƒŽ ˆŒ…ˆ ”€‰‹€ ‚ “”… #5CDD
4906
                ld      (4020h),bc
4907
                ld      a,c
4908
                cp      8
4909
                jr      nc,loc_2DD2
4910
                call    COM_18          ; €‘’Ž‰Š€ € „ˆ‘Š…’“
4911
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4912
                jp      nz,ERR_NOFILES
4913
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
4914
                ld      bc,(4020h)
4915
                add     hl,bc
4916
                ld      (hl),"8"
4917
                push    hl
4918
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4919
                pop     hl
4920
                jr      z,loc_2DD8
4921
                ld      (hl)," "
4922
loc_2DD2        call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4923
                jp      loc_2E33
4924
 
4925
loc_2DD8        call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
4926
                call    loc_2D92
4927
                ld      sp,40FFh
4928
                ld      b,8
4929
loc_2DE3        push    bc
4930
                ld      a,b
4931
                ld      bc,7FFDh
4932
                dec     a
4933
                push    af
4934
                or      10h
4935
                out     (c),a
4936
                pop     af
4937
                add     a,30h
4938
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
4939
                ld      bc,(4020h)
4940
                add     hl,bc
4941
                ld      (hl),a
4942
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4943
                jr      nz,loc_2E05
4944
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
4945
                call    loc_2D92
4946
loc_2E05        pop     bc
4947
                djnz    loc_2DE3
4948
                ld      a,20h
4949
                ld      hl,TRD_5CDD     ; ˆŒŸ ”€‰‹€
4950
                ld      bc,(4020h)
4951
                add     hl,bc
4952
                ld      (hl),a
4953
                call    FIND_FILENAME   ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ ”€‰‹€
4954
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
4955
                push    bc
4956
                push    af
4957
                ld      bc,7FFDh
4958
                ld      a,(4101h)
4959
                out     (c),a
4960
                pop     af
4961
                pop     bc
4962
                jr      loc_2E39
4963
 
4964
                call    SET_AND_PUT
4965
                call    EXIT_IF_SINTAX  ; ‚އ‚€’ ‚ …„›„“™ˆ‰ ‚›‡Ž‚,…‘‹ˆ Ž‚…Š€ ‘ˆ’€Š‘ˆ‘€
4966
                call    INP_EXTFILENAME ; ˆ…Œ €‘˜ˆ…ˆŸ ”€‰‹€
4967
                call    FIND_FILE       ; Žˆ‘Š ”€‰‹€ Ž ˆŒ…ˆ
4968
loc_2E33        jp      nz,ERR_NOFILES
4969
                call    RDHEAD_FILENAME ; —’…ˆ… Žˆ‘€’…‹Ÿ ”€‰‹€
4970
loc_2E39        ld      a,(TRD_5CDD)    ; ˆŒŸ ”€‰‹€
4971
                cp      "$"
4972
                di
4973
                jr      nz,loc_2E43
4974
                im      2
4975
loc_2E43        ld      sp,40F0h
4976
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
4977
                ld      (4010h),a
4978
                ld      a,(TRD_5D16)    ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
4979
                ld      (4011h),a
4980
                ld      hl,(TRD_5CE6)   ; „‹Ÿ <C>-‘’€’Ž‚›‰ €„…‘,„‹Ÿ <B>-„‹ˆ€ Žƒ€ŒŒ›
4981
                push    hl
4982
                ld      de,(TRD_5CEB)   ; ŽŒ… …‚ŽƒŽ ‘…Вސ€ ”€‰‹€
4983
                push    de
4984
                inc     e
4985
                ld      a,e
4986
                cp      10h
4987
                jr      nz,loc_2E64
4988
                ld      e,0
4989
                inc     d
4990
loc_2E64        ld      c,d
4991
                call    sub_2F07
4992
                ld      a,(4010h)
4993
                and     2
4994
                call    nz,sub_2F0F
4995
                ld      a,c
4996
                call    loc_2F50
4997
                ld      hl,4100h
4998
                ld      b,0BFh
4999
loc_2E79        push    bc
5000
                push    de
5001
                call    sub_2F1B
5002
                ld      de,100h
5003
                add     hl,de
5004
                pop     de
5005
                inc     e
5006
                ld      a,e
5007
                cp      10h
5008
                jr      nz,loc_2E9C
5009
                ld      e,0
5010
                inc     d
5011
                ld      c,d
5012
                call    sub_2F07
5013
                ld      a,(4010h)
5014
                and     2
5015
                call    nz,sub_2F0F
5016
                ld      a,c
5017
                call    loc_2F50
5018
loc_2E9C        pop     bc
5019
                djnz    loc_2E79
5020
                pop     de
5021
                pop     hl
5022
                ld      sp,hl
5023
                ld      a,(4011h)
5024
                push    af
5025
                ld      c,d
5026
                call    sub_2F07
5027
                ld      a,(4010h)
5028
                and     2
5029
                call    nz,sub_2F0F
5030
                ld      a,c
5031
                call    loc_2F50
5032
                ld      hl,4000h
5033
                call    sub_2F1B
5034
loc_2EBC        pop     af
5035
                ex      af,af'
5036
                pop     af
5037
                ld      r,a
5038
                pop     af
5039
                ld      i,a
5040
                di
5041
                ld      a,0FFh
5042
                jp      po,loc_2ECC
5043
                ld      a,0
5044
loc_2ECC        ld      (KSTATE0),a
5045
                pop     af
5046
                pop     hl
5047
                pop     de
5048
                pop     bc
5049
                exx
5050
                ex      af,af'
5051
                pop     iy
5052
                pop     ix
5053
                pop     hl
5054
                pop     de
5055
                pop     bc
5056
                ld      a,(BORDCR)
5057
                and     38h
5058
                rrca
5059
                rrca
5060
                rrca
5061
                out     (0FEh),a
5062
                ld      a,(SWAP_8)
5063
                cp      0EEh
5064
                jr      nz,loc_2EF7
5065
                push    bc
5066
                ld      bc,7FFDh
5067
                ld      a,(BANKM)
5068
                out     (c),a
5069
                pop     bc
5070
loc_2EF7        ld      a,(KSTATE0)
5071
                or      a
5072
                ld      a,0C9h
5073
                ld      (KSTATE0),a
5074
                jr      nz,loc_2F03
5075
                ei
5076
loc_2F03        pop     af
5077
                jp      KSTATE0
5078
 
5079
sub_2F07        ld      a,(4011h)
5080
                or      3Ch
5081
loc_2F0C        out     (0FFh),a
5082
                ret
5083
 
5084
sub_2F0F        ld      a,c
5085
                or      a
5086
                rra
5087
                ld      c,a
5088
                ret     nc
5089
                ld      a,(4011h)
5090
                and     6Fh
5091
                jr      loc_2F0C
5092
 
5093
sub_2F1B        ld      a,e
5094
                inc     a
5095
                out     (5Fh),a
5096
                push    hl
5097
                ld      d,14h
5098
                push    de
5099
loc_2F23        di
5100
                ld      c,7Fh
5101
                ld      a,80h
5102
                out     (1Fh),a
5103
                call    RD_DATAPORT
5104
                pop     de
5105
                pop     hl
5106
                in      a,(1Fh)
5107
                and     7Fh
5108
                ret     z
5109
                dec     d
5110
                push    hl
5111
                push    de
5112
                jr      nz,loc_2F23
5113
                halt
5114
 
5115
sub_2F3A        ld      a,3Ch
5116
                out     (0FFh),a
5117
                ld      a,(KSTATE0)
5118
                and     8
5119
                jr      nz,loc_2F4F
5120
                ld      a,c
5121
                or      a
5122
                rra
5123
                ld      c,a
5124
                jr      nc,loc_2F4F
5125
                ld      a,2Ch
5126
                out     (0FFh),a
5127
loc_2F4F        ld      a,c
5128
loc_2F50        out     (7Fh),a
5129
;===============PATCH
5130
;               call    PAUSE725779T
5131
;               ld      a,1Bh
5132
                CALL loc_3D2F
5133
                LD A,0X18
5134
;===============PATCH
5135
loc_2F57        out     (1Fh),a
5136
loc_2F59        in      a,(0FFh)
5137
                and     80h
5138
                jr      z,loc_2F59
5139
                push    bc
5140
                call    PAUSE725779T
5141
                pop     bc
5142
                ret
5143
 
5144
sub_2F65
5145
;===============PATCH
5146
;               ld      a,0Bh
5147
                LD A,8
5148
;===============PATCH
5149
                jr      loc_2F57
5150
 
5151
WORK4ERROR      ld      hl,(TRD_5D1C)   ; ‘Ž•€…ˆ… …ƒˆ‘’€ SP
5152
                dec     hl
5153
                dec     hl
5154
                ld      sp,hl
5155
                jp      loc_1D2F
5156
 
5157
CALL2BASIC      ld      (TRD_5D02),hl
5158
                ld      (TRD_5D04),de
5159
                pop     hl
5160
                ld      e,(hl)
5161
                inc     hl
5162
                ld      d,(hl)
5163
                inc     hl
5164
                push    hl
5165
                ld      hl,loc_3D2F
5166
                push    hl
5167
                push    de
5168
                ld      hl,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
5169
                push    hl
5170
                ld      hl,(TRD_5D02)
5171
                ld      de,(TRD_5D04)
5172
                ret
5173
 
5174
SET_VARS        ld      hl,0FFFFh
5175
                ld      (TRD_5CFA),hl   ; ‚…ŒŸ ……Œ…™…ˆŸ „ˆ‘ŠŽ‚Ž„€ A
5176
                ld      (TRD_5CFC),hl   ; ‚…ŒŸ ……Œ…™…ˆŸ „ˆ‘ŠŽ‚Ž„€ C
5177
                ld      (TRD_5CC8),hl   ; …†ˆŒ €Ž’€ „ˆ‘ŠŽ‚Ž„€ A
5178
                ld      (TRD_5CCA),hl   ; …†ˆŒ €Ž’€ „ˆ‘ŠŽ‚Ž„€ C
5179
                xor     a
5180
                ld      (TRD_5D17),a    ; ˆ‘Ž‚€ˆ… ‡€‘’€‚Šˆ,…‘‹ˆ #AA
5181
                ld      (TRD_5D19),a    ; „ˆ‘ŠŽ‚Ž„ Ž “ŒŽ‹—€ˆž
5182
                ld      (TRD_5D18),a
5183
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
5184
                ld      (TRD_5D1F),a
5185
                ld      a,0FFh
5186
                out     (0FFh),a
5187
                ld      (ERR_NR),a
5188
                ld      (TRD_5D16),a    ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
5189
                ld      (TRD_5D0C),a
5190
                ld      a,0C9h
5191
                ld      (TRD_5CC2),a    ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
5192
                ld      a,0D0h
5193
                out     (1Fh),a
5194
                ret
5195
 
5196
CP_END_CAT      call    CP_END_BUF      ; Ž‚…Š€ € ŠŽ…– “”…€
5197
                ld      a,(hl)
5198
                or      a
5199
                jp      z,END_OUT_DIR
5200
                cp      1
5201
                call    z,ADD_10
5202
                ret     nz
5203
                jr      CP_END_CAT
5204
 
5205
LOAD_SEC2BUF    ld      b,1
5206
                ld      hl,TRD_5D25
5207
                jp      loc_1E67
5208
 
5209
LOAD_END_FILE   push    hl
5210
                ld      de,(TRD_5CF4)
5211
                call    LOAD_SEC2BUF
5212
                ld      a,(TRD_5CDB)
5213
                pop     de
5214
                or      a
5215
                ret     z
5216
                ld      c,a
5217
                ld      hl,TRD_5D25
5218
                ldir                    ; FIX
5219
                ret
5220
 
5221
; ’€‹ˆ–€ …‰‘ˆŠ ŠŽŒ€„ „‹Ÿ TR-DOS
5222
CODE_BYTE_COM   db 0CFh                 ; CAT
5223
                db "*"
5224
                db 0D0h                 ; FORMAT
5225
                db 0D1h                 ; MOVE
5226
                db 0E6h                 ; NEW
5227
                db 0D2h                 ; ERASE
5228
                db 0EFh                 ; LOAD
5229
                db 0F8h                 ; SAVE
5230
                db 0FEh                 ; RETURN
5231
                db 0BEh                 ; PEEK
5232
                db 0F4h                 ; POKE
5233
                db 0D5h                 ; MERGE
5234
                db 0F7h                 ; RUN
5235
                db 0D3h                 ; OPEN
5236
                db 0D4h                 ; CLOSE
5237
                db 0FFh                 ; COPY
5238
                db "4"                  ; 40
5239
                db 0ECh                 ; GOTO
5240
                db "8"                  ; 80
5241
                db 0F0h                 ; LIST
5242
                db 0D6h                 ; VERIFY
5243
 
5244
; ’€‹ˆ–€ €„…‘Ž‚ ˆ‘Ž‹…ˆŸ ŠŽŒ€„
5245
SPIS_ADR_COM    dw CAT
5246
                dw COM_STAR
5247
                dw FORMAT
5248
                dw MOVE
5249
                dw NEW
5250
                dw ERASE
5251
                dw LOAD
5252
                dw SAVE
5253
                dw RETURN
5254
                dw PEEK
5255
                dw POKE
5256
                dw MERGE
5257
                dw RUN
5258
                dw OPEN
5259
                dw CLOSE
5260
                dw COPY
5261
                dw COM_40
5262
                dw GOTO
5263
                dw COM_80
5264
                dw LIST
5265
                dw VERIFY
5266
 
5267
SAE2E_LINE      ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
5268
                ld      (TRD_5D11),hl   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
5269
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5270
                ld      a,0FFh
5271
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
5272
                ld      hl,TRD_5CDB
5273
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
5274
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
5275
                jr      loc_3057
5276
 
5277
SAE2_HL_        ld      (TRD_5D11),hl   ; €„…‘ ‘’ŽŠˆ ŠŽŒ€„› TR_DOS
5278
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5279
                call    CP_ADR_STR
5280
                ret     nz
5281
                inc     hl
5282
                inc     hl
5283
                ld      (TRD_5CD7),hl   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
5284
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
5285
loc_3057        call    FIND_KEYWORD
5286
                jr      nz,loc_3087
5287
                ex      de,hl
5288
                inc     de
5289
                ld      b,0
5290
                ld      hl,BYTES_COM    ; SAVE
5291
                add     hl,bc
5292
                ld      a,(hl)
5293
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5294
                ld      (hl),a
5295
                inc     hl
5296
                ex      de,hl
5297
                rst     20h
5298
                dw 19DDh
5299
                push    bc
5300
                rst     20h
5301
                dw 19E8h
5302
                pop     bc
5303
                ld      a,(TRD_5CD6)    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
5304
                or      a
5305
                jr      nz,loc_3087
5306
                ld      hl,(TRD_5CD7)   ; ŽŒ…†“’Ž—›‰ ‘’€’ ”€‰‹€ ˆ‹ˆ ŠŽ‹-‚Ž ’…ŠŽ‚
5307
                                        ; Ž‘‹… Ž‚…Šˆ ’ˆ€ „ˆ‘ŠŽ‚Ž„€
5308
                ld      e,(hl)
5309
                inc     hl
5310
                ld      d,(hl)
5311
                ex      de,hl
5312
                or      a
5313
                sbc     hl,bc
5314
                ex      de,hl
5315
                ld      (hl),d
5316
                dec     hl
5317
                ld      (hl),e
5318
loc_3087        ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5319
                ld      a,(hl)
5320
                cp      0Dh
5321
                ret     z
5322
                inc     hl
5323
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5324
                ld      a,(hl)
5325
                cp      0Dh
5326
                ret     z
5327
                cp      22h
5328
                jr      nz,loc_3057
5329
loc_309A        inc     hl
5330
                ld      a,(hl)
5331
                cp      0Dh
5332
                ret     z
5333
                cp      22h
5334
                jr      nz,loc_309A
5335
                inc     hl
5336
                ld      (TRD_5CD9),hl   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5337
                jr      loc_3057
5338
 
5339
FIND_KEYWORD    ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5340
                ld      de,TBL_KEYWORD  ; "SAVE"
5341
                ld      c,0
5342
loc_30B1        ld      a,(hl)
5343
                and     0DFh
5344
                ld      b,a
5345
                or      a
5346
                jr      nz,loc_30BB
5347
                inc     hl
5348
                jr      loc_30B1
5349
 
5350
loc_30BB        ld      a,(de)
5351
                and     80h
5352
                jr      nz,loc_30C8
5353
                ld      a,(de)
5354
                cp      b
5355
                jr      nz,loc_30D9
5356
                inc     hl
5357
                inc     de
5358
                jr      loc_30B1
5359
 
5360
loc_30C8        ld      a,(de)
5361
                and     7Fh
5362
                cp      b
5363
                ret     z
5364
loc_30CD        inc     c
5365
                ld      hl,(TRD_5CD9)   ; ŽŒ…†“’Ž—€Ÿ „‹ˆ€ „‹Ÿ <B> ˆ <C>
5366
                inc     de
5367
                ld      a,(de)
5368
                cp      0FFh
5369
                jr      nz,loc_30B1
5370
                or      a
5371
                ret
5372
 
5373
loc_30D9        inc     de
5374
                ld      a,(de)
5375
                and     80h
5376
                jr      z,loc_30D9
5377
                jr      loc_30CD
5378
 
5379
CP_ADR_STR      ld      hl,(PPC)
5380
                inc     hl
5381
                inc     hl
5382
                ld      a,h
5383
                or      l
5384
                jr      z,loc_30F4
5385
                xor     a
5386
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
5387
                dec     hl
5388
                dec     hl
5389
                rst     20h
5390
                dw 196Eh
5391
                ret
5392
 
5393
loc_30F4        ld      a,0FFh
5394
                ld      (TRD_5CD6),a    ; #FF-ŠŽŒ€„€ ˆŸ’€ ‘ˆ’€Š‘ˆ—…‘ŠˆŒ €€‹ˆ‡€’ŽŽŒ
5395
                ld      hl,(E_LINE)     ; €„…‘ €—€‹€ …„€Š’ˆ“…ŒŽ‰ ‘’ŽŠˆ
5396
                ret
5397
 
5398
TBL_KEYWORD     DB "SAVE",80h
5399
                DC "SAVE"
5400
                DB "LOAD",80h
5401
                DC "LOAD"
5402
                DB "RUN",80h
5403
                DC "RUN"
5404
                DB "CAT",80h
5405
                DC "CAT"
5406
                DB "ERASE",80h
5407
                DC "ERASE"
5408
                DB "NEW",80h
5409
                DC "NEW"
5410
                DB "MOVE",80h
5411
                DC "MOVE"
5412
                DB "MERGE",80h
5413
                DC "MERGE"
5414
                DB "PEEK",80h
5415
                DC "PEEK"
5416
                DB "POKE",80h
5417
                DC "POKE"
5418
                DB "OPEN",83h
5419
                DB "CLOSE",83h
5420
                DB "CODE",80h
5421
                DC "CODE"
5422
                DB "RND",80h
5423
                DC "RND"
5424
                DB "DATA",80h
5425
                DC "DATA"
5426
                DB "SCREEN",4,84h
5427
                DB "SCREEN",84h
5428
                DB "COPY",80h
5429
                DC "COPY"
5430
                DB "FORMAT",80h
5431
                DC "FORMAT"
5432
                DB "GOTO",80h
5433
                DC "GOTO"
5434
                DB "LIST",80h
5435
                DC "LIST"
5436
                DB "LINE",80h
5437
                DC "LINE"
5438
                DB "VERIFY",80h
5439
                DC "VERIFY"
5440
                db 0FFh,0FFh
5441
 
5442
BYTES_COM       dw 0F8F8h               ; SAVE
5443
                dw 0EFEFh               ; LOAD
5444
                dw 0F7F7h               ; RUN
5445
                dw 0CFCFh               ; CAT
5446
                dw 0D2D2h               ; ERASE
5447
                dw 0E6E6h               ; NEW
5448
                dw 0D1D1h               ; MOVE
5449
                dw 0D5D5h               ; MERGE
5450
                dw 0BEBEh               ; PEEK
5451
                dw 0F4F4h               ; POKE
5452
                dw 0D4D3h               ; OPEN CLOSE
5453
                dw 0AFAFh               ; CODE
5454
                dw 0A5A5h               ; RND
5455
                dw 0E4E4h               ; DATA
5456
                dw 0AAAAh               ; SCREEN
5457
                dw 0FFFFh               ; COPY
5458
                dw 0D0D0h               ; FORMAT
5459
                dw 0ECECh               ; GOTO
5460
                dw 0F0F0h               ; LIST
5461
                dw 0CACAh               ; LINE
5462
                dw 0D6D6h               ; VERIFY
5463
                db 0
5464
 
5465
; Ž‚…Š€ €‹ˆ—ˆŸ TR-DOS ……Œ…›•
5466
CP_VARSTRDOS    ld      hl,(CHANS)
5467
                or      a
5468
                ld      bc,TRD_5D25
5469
                sbc     hl,bc
5470
                ret
5471
 
5472
                include patch.a80
5473
 
5474
                DUPL 0X3C01-$,0FFh
5475
                jr      loc_3C06
5476
 
5477
                db 0FFh
5478
                jr      loc_3C09
5479
 
5480
loc_3C06        jp      loc_3D00
5481
 
5482
loc_3C09        jp      loc_3D03
5483
 
5484
;===============PATCH
5485
                DUPL 0X3C30-$,0XFF
5486
                IN A,(0X1F)
5487
                RET
5488
;===============PATCH
5489
 
5490
                DUPL 0X3CFA-$,0FFh
5491
FOR_INTERFACE1
5492
;===============PATCH
5493
;               jp      CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
5494
                NOP
5495
                JR loc_3D2F
5496
;===============PATCH
5497
 
5498
loc_3CFD        jp      CALL_3D13
5499
 
5500
loc_3D00        nop
5501
                jr      IN_DOS_15616
5502
 
5503
loc_3D03        nop
5504
                jr      IN_DOS_15619
5505
 
5506
loc_3D06        nop
5507
                jp      INPUTDATAFILE
5508
 
5509
loc_3D0A        jp      OUT_SYM2FILE
5510
 
5511
                nop
5512
loc_3D0E        jr      loc_3D0A
5513
 
5514
                nop
5515
                jr      FOR_INTERFACE1
5516
 
5517
                nop
5518
                jr      loc_3CFD
5519
 
5520
loc_3D16        nop
5521
                jp      WORK4ERROR
5522
 
5523
IN_DOS_15619    call    CREATE_VARS_TRD
5524
                push    hl
5525
                jp      loc_16C
5526
 
5527
CREATE_VARS_TRD call    CP_VARSTRDOS    ; Ž‚…Š€ €‹ˆ—ˆŸ TR-DOS ……Œ…›•
5528
                nop
5529
                nop
5530
                call    c,JMP_CREATE_VARS
5531
                ld      hl,TRD_5CC2     ; ‘Ž„…†ˆ’ #C9.„‹Ÿ ……•Ž„€ ˆ‡ TR-DOS ‚ BASIC
5532
                ret
5533
 
5534
                nop
5535
                nop
5536
loc_3D2F        nop
5537
                ret
5538
 
5539
IN_DOS_15616    call    CREATE_VARS_TRD
5540
                push    hl
5541
                jp      IN_COMMAND_CPU  ; ‚•ކ„…ˆ… ‚ ŠŽŒ€„›‰ Ž–…‘‘ސ „Ž‘€
5542
 
5543
INI_INTERFACE1  xor     a
5544
;===============PATCH
5545
;               out     (0F7h),a
5546
                DUPL 2,0
5547
;===============PATCH
5548
                in      a,(0F7h)
5549
                cp      1Eh
5550
                jr      z,loc_3D44
5551
                cp      1Fh
5552
                ret     nz
5553
loc_3D44        rst     8
5554
                db 31h
5555
                ld      a,1
5556
                ld      (TRD_5CEF),a    ; ‘Ž„…†ˆ’ 1 …‘‹ˆ …‘’œ INTERFACE1
5557
                ret
5558
 
5559
JMP_CREATE_VARS xor     a
5560
                out     (0FFh),a
5561
                in      a,(0F6h)
5562
                ld      hl,INI_INTERFACE1
5563
                ld      de,MEMBOT
5564
                ld      bc,14h
5565
                ldir
5566
                ld      hl,CREATE_VARS
5567
                push    hl
5568
                ld      hl,loc_3D2F
5569
                push    hl
5570
                jp      MEMBOT
5571
 
5572
CREATE_VARS     ld      hl,SET_VARS
5573
                push    hl
5574
                ld      hl,loc_3D2F
5575
                push    hl
5576
                ld      hl,1655h
5577
                push    hl
5578
                ld      hl,TSTACK_END
5579
                push    hl
5580
                ld      (hl),0C9h
5581
                ld      hl, P_RAMT+1
5582
                ld      bc,70h
5583
                ret
5584
 
5585
PRINT_0D        ld      a,0Dh
5586
PRINT_A_        push    hl
5587
                push    bc
5588
                push    de
5589
                push    af
5590
;===============PATCH
5591
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
5592
                DUPL 3,0
5593
;===============PATCH
5594
                pop     af
5595
                call    PRINT_SYM
5596
;===============PATCH
5597
;               call    CP_INTERFACE1   ; Ž‚…Š€ €‹ˆ—ˆŸ INTERFACE1
5598
                DUPL 3,0
5599
;===============PATCH
5600
                pop     de
5601
                pop     bc
5602
                pop     hl
5603
                ret
5604
 
5605
PRINT_SYM       rst     20h
5606
                dw 10h
5607
                ret
5608
 
5609
; ‚Ž‘‘’€Ž‚‹…ˆ… ‚ƒ93
5610
COM_00
5611
;===============PATCH
5612
;               ld      a,0Bh
5613
                LD A,8
5614
;===============PATCH
5615
COM2VG_WAIT     out     (1Fh),a
5616
COM2VGWAIT1     push    hl
5617
                rst     20h
5618
                dw 1F54h                ; Ž‚…Š€ BREAK
5619
                jr      c,COM2VGWAIT2
5620
                rst     20h
5621
                dw 1B7Bh                ; ‚›‚Ž„ ‘ŽŽ™…ˆŸ ށ Ž˜ˆŠ…,…‘‹ˆ €†€’  BREAK
5622
COM2VGWAIT2     pop     hl
5623
                in      a,(0FFh)
5624
                and     80h
5625
                jr      z,COM2VGWAIT1
5626
                ret
5627
 
5628
; Ž‚…Š€ €‹ˆ—ˆŸ „ˆ‘Š€
5629
CP_PRESENT_DISK
5630
;===============PATCH
5631
;               ld      a,0Bh
5632
                LD A,8
5633
;===============PATCH
5634
                call    COM2VG_WAIT
5635
                ld      de,0
5636
                in      a,(1Fh)
5637
                and     2
5638
                ld      b,a
5639
CPPRESENTDSK1   in      a,(1Fh)
5640
                and     2
5641
                cp      b
5642
                ret     nz
5643
                inc     de
5644
                ld      a,e
5645
                or      d
5646
                jr      nz,CPPRESENTDSK1
5647
                jp      DISK_NOT_FOUND
5648
 
5649
; ‚›Ž „ˆ‘ŠŽ‚Ž„€ Ž “ŒŽ‹—€ˆž
5650
ACTIV_DEF_DISK  ld      a,(TRD_5D19)    ; „ˆ‘ŠŽ‚Ž„ Ž “ŒŽ‹—€ˆž
5651
COM_01          ld      (TRD_5CF6),a    ; €‘’Ž‰Š€ € „ˆ‘ŠŽ‚Ž„
5652
                ld      hl,TRD_5D16     ; ŠŽˆŸ ‘ˆ‘’…ŒŽƒŽ …ƒˆ‘’€ (Ž’ #FF)
5653
                ld      c,a
5654
                ld      a,3Ch
5655
                or      c
5656
                out     (0FFh),a
5657
                ld      (hl),a
5658
                call    GET_TIME_HEAD   ; Ž‹“—…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5659
                and     80h
5660
                jr      z,loc_3DFA
5661
                call    CP_PRESENT_DISK ; Ž‚…Š€ €‹ˆ—ˆŸ „ˆ‘Š€
5662
                call    CP_TIME_GOHEAD  ; Ž…„…‹…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5663
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
5664
                cp      0FFh
5665
                jr      nz,loc_3DFA
5666
                push    hl
5667
                call    CP_DISK_TRACK
5668
                pop     hl
5669
                cp      80              ; Ž‚…Š€ € 80 „ސކ…Š
5670
                ld      a,0
5671
                jr      nz,loc_3DF9
5672
                ld      a,80h
5673
loc_3DF9        ld      (hl),a
5674
loc_3DFA        call    WR_NUM_TRACK
5675
PAUSE725779T    ld      a,50h
5676
PAUSE_C_A       ld      c,0FFh
5677
loc_3E01        dec     c
5678
                jr      nz,loc_3E01
5679
                dec     a
5680
                jr      nz,PAUSE_C_A
5681
                ret
5682
 
5683
; Ž‹“—…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5684
GET_TIME_HEAD   ld      de,TRD_5CFA     ; ‚…ŒŸ ……Œ…™…ˆŸ „ˆ‘ŠŽ‚Ž„€ A
5685
loc_3E0B        ld      hl,(TRD_5CF6)   ; „ˆ‘ŠŽ‚Ž„ „‹Ÿ ‚…Œ…Ž‰ Ž…€–ˆˆ
5686
                add     hl,de
5687
                ld      a,(hl)
5688
                ret
5689
 
5690
; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
5691
GET_TYPE_DISK   ld      de,TRD_5CC8     ; …†ˆŒ €Ž’€ „ˆ‘ŠŽ‚Ž„€ A
5692
                jr      loc_3E0B
5693
 
5694
; Ž…„…‹…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5695
CP_TIME_GOHEAD  call    GET_TIME_HEAD   ; Ž‹“—…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5696
                ld      b,8
5697
                ld      c,4
5698
loc_3E1D        ld      (hl),b
5699
                ld      a,0Bh
5700
                call    COM2VG_WAIT
5701
                ld      a,20h
5702
                ld      b,0Bh
5703
                call    HEAD_POSITION
5704
                ld      b,(hl)
5705
                ld      a,1
5706
                call    HEAD_POSITION
5707
                in      a,(1Fh)
5708
                and     4
5709
                jr      nz,loc_3E3F
5710
                xor     a
5711
                call    HEAD_POSITION
5712
                in      a,(1Fh)
5713
                and     4
5714
                ret     nz
5715
loc_3E3F        inc     b
5716
                dec     c
5717
                ret     z
5718
                jr      loc_3E1D
5719
 
5720
HEAD_POSITION   out     (7Fh),a
5721
                ld      a,b
5722
                or      18h
5723
                jp      COM2VG_WAIT
5724
 
5725
POSITIONIREN    out     (7Fh),a
5726
                push    bc
5727
                ld      b,a
5728
                in      a,(3Fh)
5729
                cp      b
5730
                pop     bc
5731
                push    af
5732
                ld      a,b
5733
                or      18h
5734
                call    COM2VG_WAIT
5735
                pop     af
5736
                ret     z
5737
                push    bc
5738
                call    PAUSE725779T
5739
                pop     bc
5740
                ret
5741
 
5742
; “‘’€Ž‚Š€ ƒŽ‹Ž‚Šˆ € „ސކГ
5743
COM_02          ld      c,a
5744
                call    COM_16          ; “‘’€Ž‚Š€ 0 ‘’ŽŽ› „ˆ‘Š€
5745
                call    GET_TYPE_DISK   ; Ž‹“—…ˆ… ŠŽ„€ …†ˆŒ€ €Ž’› „ˆ‘ŠŽ‚Ž„€
5746
                and     2
5747
                call    nz,SET_SIDE_DISK
5748
                push    bc
5749
                bit     7,(hl)
5750
                jr      z,loc_3E83
5751
                bit     0,(hl)
5752
                jr      nz,loc_3E83
5753
                in      a,(3Fh)
5754
                cp      c
5755
                jr      z,loc_3E82
5756
                rlca
5757
                out     (3Fh),a
5758
                ld      a,c
5759
                rlca
5760
loc_3E82        ld      c,a
5761
loc_3E83        call    GET_TIME_HEAD   ; Ž‹“—…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5762
                ld      b,a
5763
                in      a,(3Fh)
5764
                cp      c
5765
                push    bc
5766
                call    nz,PAUSE725779T
5767
                pop     bc
5768
                ld      a,c
5769
                call    POSITIONIREN
5770
                pop     bc
5771
                ld      a,c
5772
                out     (3Fh),a
5773
                ld      a,(TRD_5CCD)    ; #80-ƒŽ’Ž‚Ž‘’œ „ˆ‘ŠŽ‚Ž„€
5774
                or      a
5775
                ret     z
5776
                xor     a
5777
                ld      (TRD_5CCD),a    ; #80-ƒŽ’Ž‚Ž‘’œ „ˆ‘ŠŽ‚Ž„€
5778
PAUSE_3_C_A     ld      b,3
5779
loc_3EA2        ld      a,0FFh
5780
                call    PAUSE_C_A
5781
                djnz    loc_3EA2
5782
                ret
5783
 
5784
SET_SIDE_DISK   ld      a,c
5785
                or      a
5786
                rra
5787
                ld      c,a
5788
                ret     nc
5789
                jp      COM_17          ; “‘’€Ž‚Š€ 1 ‘’ŽŽ› „ˆ‘Š€
5790
 
5791
GET_NUM_TRACK   call    COM_16          ; “‘’€Ž‚Š€ 0 ‘’ŽŽ› „ˆ‘Š€
5792
loc_3EB5        in      a,(1Fh)
5793
                and     80h
5794
                ld      (TRD_5CCD),a    ; #80-ƒŽ’Ž‚Ž‘’œ „ˆ‘ŠŽ‚Ž„€
5795
                in      a,(3Fh)
5796
                ld      h,a
5797
;===============PATCH
5798
;               call    HEAD_POSITION
5799
                CALL BUGFIX_3EBF
5800
;===============PATCH
5801
                ld      c,7Fh
5802
                ld      d,1
5803
                di
5804
                ld      a,0C0h
5805
                out     (1Fh),a
5806
                push    bc
5807
                ld      b,3
5808
loc_3ECE        in      a,(0FFh)
5809
                and     0C0h
5810
                jr      nz,loc_3EF2
5811
                inc     de
5812
                ld      a,e
5813
                or      d
5814
                jr      nz,loc_3ECE
5815
                djnz    loc_3ECE
5816
                pop     bc
5817
                ei
5818
                ld      a,0D0h
5819
                out     (1Fh),a
5820
;===============PATCH
5821
;               ld      a,(TRD_5CD1)
5822
                LD A,(TRD_5D17)
5823
;===============PATCH
5824
                cp      0FFh
5825
                ret     z
5826
DISK_NOT_FOUND  call    SET_TAPELDERR
5827
                ld      a,0FFh
5828
                ld      (TRD_5D17),a    ; ˆ‘Ž‚€ˆ… ‡€‘’€‚Šˆ,…‘‹ˆ #AA
5829
                jp      loc_271B
5830
 
5831
loc_3EF2        pop     bc
5832
                in      h,(c)
5833
loc_3EF5        in      a,(0FFh)
5834
                and     0C0h
5835
                jr      z,loc_3EF5
5836
                ei
5837
                ret     m
5838
                di
5839
                in      a,(7Fh)
5840
                jr      loc_3EF5
5841
 
5842
; “‘’€Ž‚Š€ ŽŒ…€ ‘…Вސ€
5843
COM_03          ld      (TRD_5CFF),a
5844
                ret
5845
 
5846
; “‘’€Ž‚Š€ €„…‘€ “”…€
5847
COM_04          ld      (TRD_5D00),hl
5848
                ret
5849
 
5850
SAVE_SECTOR     ld      a,0A0h
5851
                jr      loc_3F10
5852
 
5853
LOAD_SECTOR     ld      a,80h
5854
loc_3F10        ld      (TRD_5CFE),a
5855
RD_OR_WR_SEC    ld      d,0Ah
5856
loc_3F15        push    de
5857
                di
5858
                ld      a,(TRD_5CFF)
5859
                inc     a
5860
                out     (5Fh),a
5861
                ld      hl,(TRD_5D00)
5862
                ld      c,7Fh
5863
                ld      a,(TRD_5CFE)
5864
                out     (1Fh),a
5865
                cp      0A0h
5866
                push    af
5867
                call    z,WRITE_SEC     ; ކˆ„€ˆ… ƒŽ’Ž‚Ž‘’ˆ ˆ ‡€ˆ‘œ ‘…Вސ€
5868
                pop     af
5869
                call    nz,READ_SEC
5870
                pop     de
5871
                ei
5872
                in      a,(1Fh)
5873
                ld      b,a
5874
                and     7Fh
5875
                ret     z
5876
loc_3F39        ld      hl,READ_ONLY    ; Read Only
5877
                and     40h
5878
                jr      nz,loc_3F4B
5879
                ld      a,b
5880
                and     4
5881
                jr      z,loc_3FA0
5882
                dec     d
5883
                jr      nz,loc_3F15
5884
loc_3F48        ld      hl,TXT_DISCERROR_
5885
loc_3F4B        ld      a,0D0h
5886
                out     (1Fh),a
5887
                ld      a,b
5888
                and     1
5889
                jp      nz,DISK_NOT_FOUND
5890
                in      a,(3Fh)
5891
                or      a
5892
                jr      nz,loc_3F5F
5893
                in      a,(5Fh)
5894
                cp      0Ah
5895
                ret     z
5896
loc_3F5F        push    hl
5897
                call    CLEAR_SCREEN    ; Ž—ˆ‘’Š€ Ž‘Ž‚ŽƒŽ Š€€
5898
                pop     hl
5899
                rst     18h
5900
                ld      hl,TXT_TRK_
5901
                rst     18h
5902
                in      a,(3Fh)
5903
                call    PRINT_CHISLO_A_
5904
                ld      hl,TXT_SEC_     ; " sec"
5905
                rst     18h
5906
                in      a,(5Fh)
5907
                call    PRINT_CHISLO_A_
5908
                ld      hl,TXT_RIA_
5909
                rst     18h
5910
loc_3F7B        call    GET_KEYS        ; ކˆ„€ˆ… €†€’ˆŸ Š‹€‚ˆ˜ˆ
5911
                cp      "I"             ; Ignore-RET ข  คเฅแ #1E8E
5912
                ret     z
5913
                cp      "R"             ; Retry
5914
                jr      z,PRESSED_RETRY
5915
                cp      "A"             ; Abort
5916
                jr      nz,loc_3F7B
5917
                call    SET_TAPELDERR   ; Press Abort
5918
                ld      a,7
5919
                ld      (TRD_5D0F),a    ; ŽŒ… Ž˜ˆŠˆ TR-DOS
5920
                jp      END_COMAND
5921
 
5922
PRESSED_RETRY   ld      a,(TRD_5CF5)
5923
                call    COM_02          ; “‘’€Ž‚Š€ ƒŽ‹Ž‚Šˆ € „ސކГ
5924
                call    PAUSE_3_C_A
5925
                jp      RD_OR_WR_SEC
5926
 
5927
loc_3FA0        dec     d
5928
                jp      z,loc_3F48
5929
                push    de
5930
                call    GET_TIME_HEAD   ; Ž‹“—…ˆ… ‚…Œ…ˆ ……Œ…™…ˆŸ ƒŽ‹Ž‚Šˆ
5931
                and     2
5932
                jr      nz,loc_3FAD
5933
                inc     (hl)
5934
loc_3FAD        call    COM_00          ; ‚Ž‘‘’€Ž‚‹…ˆ… ‚ƒ93
5935
                ld      a,(TRD_5CF5)
5936
                call    COM_02          ; “‘’€Ž‚Š€ ƒŽ‹Ž‚Šˆ € „ސކГ
5937
                pop     de
5938
                jp      loc_3F15
5939
 
5940
; ކˆ„€ˆ… ƒŽ’Ž‚Ž‘’ˆ ˆ ‡€ˆ‘œ ‘…Вސ€
5941
WRITE_SEC       ld      b,4
5942
WAIT4WRITE      in      a,(0FFh)
5943
                and     0C0h
5944
                jr      nz,WR_DATAPORT1
5945
                inc     de
5946
                ld      a,e
5947
                or      d
5948
                jr      nz,WAIT4WRITE
5949
                djnz    WAIT4WRITE
5950
                ret
5951
 
5952
WR_DATAPORT     in      a,(0FFh)
5953
                and     0C0h
5954
                jr      z,WR_DATAPORT
5955
                ret     m
5956
WR_DATAPORT1    outi
5957
                jr      WR_DATAPORT
5958
 
5959
READ_SEC        ld      b,4
5960
WAIT4READ       in      a,(0FFh)
5961
                and     0C0h
5962
                jr      nz,RD_DATAPORT1
5963
                inc     de
5964
                ld      a,e
5965
                or      d
5966
                jr      nz,WAIT4READ
5967
                djnz    WAIT4READ
5968
                ret
5969
 
5970
RD_DATAPORT     in      a,(0FFh)
5971
                and     0C0h
5972
                jr      z,RD_DATAPORT
5973
                ret     m
5974
RD_DATAPORT1    ini
5975
                jr      RD_DATAPORT
5976
 
5977
                DUPL 0X3FF0-$,0FFh
5978
                OUT (C),A
5979
                RET
5980
 
5981
                IN A,(C)
5982
                RET
5983
 
5984
                DUPL 0X3FF8-$,0XFF
5985
                DB "TRD503"
5986
                DW DATA_VERS