Subversion Repositories NedoOS

Rev

Rev 2350 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
68 Alone 1
        DEVICE ZXSPECTRUM128
8 dimkam 2
        include "../_sdk/sys_h.asm"
3
 
109 demige 4
HEAPSORT_LH=1 ;byte order in poiters: LSB,HSB
658 alone 5
 
8 dimkam 6
MAXCMDSZ=COMMANDLINE_sz-1-4 ;not counting terminator (-4 for "cmd ")
7
 
849 alone 8
TSPACES_FILENAME_SZ=43
9
 
841 alone 10
        if PRSTDIO
574 alone 11
_COLOR=0x0007;0x07
12
_PANELCOLOR=0x040f;0x4f
13
_PANELDIRCOLOR=0x040f;0x4f
14
_PANELEXECOLOR=0x040a;0x4c
15
_PANELFILECOLOR=0x0407;0b00001111;0xf
16
_PANELSELECTCOLOR=0x040b;0x4e
17
_CURSORCOLOR=0x0600;0x28
18
_FILECURSORCOLOR=0x0600;0x28
19
_COLOR_RED=0x0107;0x17
597 alone 20
_COLOR_DIALOG=0x0300;0700   ;0x38
574 alone 21
_HINTCOLOR1=0x0007;7
22
_HINTCOLOR0=0x0600;5*8
841 alone 23
        else
24
_COLOR=0x07
25
_PANELCOLOR=0x4f
26
_PANELDIRCOLOR=0x4f
27
_PANELEXECOLOR=0x4c
28
_PANELFILECOLOR=0x0f
29
_PANELSELECTCOLOR=0x4e
30
_CURSORCOLOR=0x28
31
_FILECURSORCOLOR=0x28
32
_COLOR_RED=0x17
33
_COLOR_DIALOG=0x30
34
_HINTCOLOR1=7
35
_HINTCOLOR0=5*8
36
        endif
8 dimkam 37
 
109 demige 38
;8192fcbs*32bytes*2panels = 32 pages
39
DIRPAGES=16
646 alone 40
FIRSTDIRPAGEFORRIGHTPANEL=128
109 demige 41
 
712 alone 42
NDRIVES=15
43
 
109 demige 44
catbuf_left=0xc000
45
catbuf_right=0xc000
46
FILES_POINTERS_left=0xc000;0x3700
47
FILES_POINTERS_right=0xc000;0x3b00
667 alone 48
 
1410 alone 49
;txtscrhgt=25
667 alone 50
txtscrwid=80
1410 alone 51
;CMDLINEY=txtscrhgt-2
52
;CONST_HGT_TABLE=txtscrhgt-4 ;᫮  䠩  
667 alone 53
PANELDIRCHARS37=37
40 alone 54
left_panel_xy=0x0000
55
right_panel_xy=0x0028
1410 alone 56
;firstfiley=left_panel_xy/256 + 1
667 alone 57
PROGRESBARWINXY=0x0f16 ;0x0919 + 051f ;de=yx
58
PROGRESBARWINHGTWID=0x0324 ;0x051f ;bc=hgt,wid
8 dimkam 59
 
889 alone 60
        macro MYPRCHAR
61
       if PRSTDIO
62
        PRCHAR_
63
       else
64
        PRCHAR
65
       endif
66
        endm
2319 kulich 67
 
889 alone 68
        macro MYSETXY
69
       if PRSTDIO
70
        SETXY_
71
       else
72
        OS_SETXY
73
       endif
74
        endm
75
 
109 demige 76
        macro PGW2elpg0
77
        ;LD A,(HS_elpg)
78
        ld a,(ix+PANEL.poipg)
1213 alone 79
        SETPG8000
109 demige 80
        endm
81
 
82
        macro PGW2elpg
83
                ;LD      A,H
84
                ;RLCA 
85
                ;RLCA 
86
                ;AND     1
87
        ;LD A,(HS_elpg)
88
        ;jr z,$+5
89
        ;LD A,(HS_elpg+1)
90
        ld a,(ix+PANEL.poipg)
1213 alone 91
        SETPG8000
109 demige 92
        endm
93
 
94
        macro PGW2strpg
95
        ld ($+4),a
96
        LD A,(HS_strpg)
1213 alone 97
        SETPG8000
109 demige 98
        endm
99
 
100
        macro PGW3elpg
101
                ;LD      A,H
102
                ;RLCA 
103
                ;RLCA 
104
                ;AND     1
105
        ;LD A,(HS_elpg)
106
        ;jr z,$+5
107
        ;LD A,(HS_elpg+1)
108
        ld a,(ix+PANEL.poipg)
1213 alone 109
        SETPGC000
109 demige 110
        endm
111
 
112
        macro PGW3strpg
113
        ld ($+4),a
114
        LD A,(HS_strpg)
1213 alone 115
        SETPGC000
109 demige 116
        endm
117
 
8 dimkam 118
        org PROGSTART
119
cmd_begin
40 alone 120
        ld sp,0x4000
841 alone 121
       if PRSTDIO
574 alone 122
        call initstdio
1410 alone 123
        ld a,(stdiohgt)
124
        ld (scrhgt),a
125
        dec a
126
        ld (nvviewhgt),a ; ⮬ 㬥 - 
127
        ;ld (hexedhgt),a
128
        sub 3
129
        ld (filesperpanel),a
130
        call clearterm ;print <stdiohgt> lines of spaces except one space, set cursor to 0,0
841 alone 131
       else
132
        ld e,6 ;textmode
133
        OS_SETGFX
134
        call nv_copyscreen0to1
135
        GET_KEY ;ꥤ key_redraw
136
       endif
78 Alone 137
 
194 demige 138
;        ld de,nvpal
139
;        OS_SETPAL
78 Alone 140
 
8 dimkam 141
        OS_GETMAINPAGES
574 alone 142
;dehl= ࠭  0000,4000(copybuf),8000,c000*(dirbuf)
755 alone 143
        push de
8 dimkam 144
        push hl
145
        ld e,h
146
        OS_DELPAGE
147
        pop hl
148
        ld e,l
149
        OS_DELPAGE
755 alone 150
        pop de ;e
151
        OS_DELPAGE
8 dimkam 152
 
755 alone 153
        call assignpages
190 demige 154
 
8 dimkam 155
        ld hl,left_panel_xy
156
        ld (leftpanel+PANEL.xy),hl
755 alone 157
 
158
        ld hl,right_panel_xy
159
        ld (rightpanel+PANEL.xy),hl
160
 
8 dimkam 161
        ld hl,FILES_POINTERS_left
162
        ld (leftpanel+PANEL.pointers),hl
109 demige 163
        ld hl,catbuf_left
164
        ld (leftpanel+PANEL.catbuf),hl
165
        xor a
166
        ld (leftpanel+PANEL.pgadd),a
8 dimkam 167
 
168
        ld hl,FILES_POINTERS_right
169
        ld (rightpanel+PANEL.pointers),hl
109 demige 170
        ld hl,catbuf_right
171
        ld (rightpanel+PANEL.catbuf),hl
646 alone 172
        ld a,FIRSTDIRPAGEFORRIGHTPANEL;DIRPAGES+1
109 demige 173
        ld (leftpanel+PANEL.pgadd),a
8 dimkam 174
 
175
        ld hl,compareext
176
        ld (leftpanel+PANEL.dirsortproc),hl
177
        ld (rightpanel+PANEL.dirsortproc),hl
178
 
109 demige 179
        ;ld a,0xc3
180
        ;ld (leftpanel+PANEL.sorterjp),a
181
        ;ld (rightpanel+PANEL.sorterjp),a
182
        ;ld hl,sorter1
183
        ;ld (leftpanel+PANEL.sorter),hl
184
        ;ld hl,sorter2
185
        ;ld (rightpanel+PANEL.sorter),hl
878 alone 186
 
889 alone 187
        ld hl,rightpanel
188
        call editcmd_setpaneldirfromcurdir_panelhl
189
 
878 alone 190
        ld de,fn_path
191
        OS_OPENHANDLE
192
        or a
193
        jr nz,init_nochdir
194
        ld de,cmdprompt
195
        push de
196
        ld hl,MAXPATH_sz
197
        push bc
198
        OS_READHANDLE
199
        pop bc
200
        OS_CLOSEHANDLE
201
        pop de ;ld de,cmdprompt
202
        OS_CHDIR
203
init_nochdir
204
 
8 dimkam 205
        ld hl,leftpanel
206
        call editcmd_setpaneldirfromcurdir_panelhl
207
 
208
        call readpanels_reprint
667 alone 209
 
8 dimkam 210
mainloop
211
        call editcmd_readprompt_setendcmdx
212
        call controlloop
213
        jp mainloop
214
 
755 alone 215
assignpages
2319 kulich 216
        ;OS_NEWPAGE ; for dircopy batch
217
        ;ld hl,dirpg
218
        ;ld (hl),e
755 alone 219
 
220
        OS_NEWPAGE ;뤥塞   ࠭窥  ⠫
221
        ld hl,HS_strpg
222
        ld (hl),e
223
        inc hl
224
        ld (hl),0 ;થ  ᯨ᪠ ࠭
225
        OS_NEWPAGE ;뤥塞   ࠭窥   
226
        ld hl,HS_strpg+DIRPAGES+1
227
        ld (hl),e
228
        inc hl
229
        ld (hl),0 ;થ  ᯨ᪠ ࠭        
230
 
231
        OS_NEWPAGE
232
        ld hl,HS_strpg+FIRSTDIRPAGEFORRIGHTPANEL;DIRPAGES+1
233
        ld (hl),e
234
        inc hl
235
        ld (hl),0 ;થ  ᯨ᪠ ࠭
236
        OS_NEWPAGE ;뤥塞   ࠭窥   
237
        ld hl,HS_strpg+FIRSTDIRPAGEFORRIGHTPANEL+DIRPAGES+1
238
        ld (hl),e
239
        inc hl
240
        ld (hl),0 ;થ  ᯨ᪠ ࠭        
241
 
242
        ld hl,left_panel_xy
243
        ld (leftpanel+PANEL.xy),hl
244
        OS_NEWPAGE
245
        ld a,e
246
        ld (leftpanel+PANEL.poipg),a
247
 
248
        ld hl,right_panel_xy
249
        ld (rightpanel+PANEL.xy),hl
250
        OS_NEWPAGE
251
        ld a,e
252
        ld (rightpanel+PANEL.poipg),a
253
 
254
        OS_NEWPAGE
255
        ld a,e
1317 alone 256
        SETPG4000 ;copybuf
755 alone 257
        ret
258
 
259
deletepages
2319 kulich 260
        ;ld a,(dirpg)
261
        ;call delpage_a ;for dircopy batch
755 alone 262
        ld a,(HS_strpg)
263
        call delpage_a ;  ࠭窥  ⠫
264
        ld a,(HS_strpg+DIRPAGES+1)
265
        call delpage_a ;  ࠭窥   
266
        ld a,(HS_strpg+FIRSTDIRPAGEFORRIGHTPANEL)
267
        call delpage_a ;  ࠭窥  ⠫
268
        ld a,(HS_strpg+FIRSTDIRPAGEFORRIGHTPANEL+DIRPAGES+1)
269
        call delpage_a ;  ࠭窥          
270
        ld a,(leftpanel+PANEL.poipg)
271
        call delpage_a
272
        ld a,(rightpanel+PANEL.poipg)
273
        call delpage_a
274
        OS_GETMAINPAGES
275
;dehl= ࠭  0000,4000(copybuf),8000,c000*(dirbuf)
276
        ld a,e
277
delpage_a
278
        ld e,a
279
        OS_DELPAGE
280
        ret
281
 
574 alone 282
strdelpages ;㤠塞 str ࠭. IX - .  ࠭  㤠塞
1450 alone 283
        ld hl,HS_strpg
1317 alone 284
        ld e,(ix+PANEL.pgadd)
649 alone 285
        ld d,0; (ix+PANEL.pgadd+1)
646 alone 286
        add hl,de
287
        ld (ix+PANEL.curpgfcbpoi),l
288
        ld (ix+PANEL.curpgfcbpoi+1),h
289
        call strdelpages_next
290
strdelpages_lname
1317 alone 291
        ld hl,HS_strpg+DIRPAGES+1 ;HS_lnamepg
292
        ld e,(ix+PANEL.pgadd)
649 alone 293
        ld d,0; (ix+PANEL.pgadd+1)
646 alone 294
        add hl,de
295
        ld (ix+PANEL.curpglnamepoi),l
296
        ld (ix+PANEL.curpglnamepoi+1),h
297
        ;jp strdelpages_next
298
 
121 demige 299
strdelpages_next
300
        inc hl
1317 alone 301
        ld a,(hl)
121 demige 302
        or a
303
        ret z
1317 alone 304
        ld e,a
121 demige 305
        push hl
646 alone 306
        push ix
121 demige 307
        OS_DELPAGE
646 alone 308
        pop ix
121 demige 309
        pop hl
310
        xor a
1317 alone 311
        ld (hl),a
121 demige 312
        jr strdelpages_next
313
 
646 alone 314
lnamenewpage ;뤥塞  ࠭ IX - , [E  ࠭窨  HS_strpg]
121 demige 315
        push hl
316
        push de
646 alone 317
        push ix
318
        OS_NEWPAGE
319
        pop ix
320
        ld l,(ix+PANEL.curpglnamepoi)
321
        ld h,(ix+PANEL.curpglnamepoi+1)
1450 alone 322
       inc hl
646 alone 323
        ld (hl),e
1450 alone 324
        ld (ix+PANEL.curpglnamepoi),l
325
        ld (ix+PANEL.curpglnamepoi+1),h
646 alone 326
        inc hl
327
        ld (hl),0 ; થ  ᯨ᪠
328
        pop de
329
        pop hl
330
        ret
331
 
332
strnewpage ;뤥塞  ࠭ IX - , [E  ࠭窨  HS_strpg]
333
        push hl
121 demige 334
        push de
646 alone 335
        push ix
121 demige 336
        OS_NEWPAGE
646 alone 337
        pop ix
338
        ld l,(ix+PANEL.curpgfcbpoi)
339
        ld h,(ix+PANEL.curpgfcbpoi+1)
1450 alone 340
       inc hl
646 alone 341
        ld (hl),e
1450 alone 342
        ld (ix+PANEL.curpgfcbpoi),l
343
        ld (ix+PANEL.curpgfcbpoi+1),h
121 demige 344
        inc hl
646 alone 345
        ld (hl),0 ; થ  ᯨ᪠
121 demige 346
        pop de
347
        pop hl
348
        ret
349
 
28 Alone 350
printhint
1410 alone 351
        ;ld de,+(txtscrhgt-1)*256
352
        ld de,(scrhgt-1) ;d
353
        dec d
354
        ld e,0
889 alone 355
        call nv_setxy ;keeps de,hl,ix
28 Alone 356
        ld hl,thint
357
prhint0
358
        ld a,(hl)
359
        inc hl
360
        or a
361
        ret z
362
        cp '{'
363
        jr z,prhint_color0
364
        cp '}'
365
        jr z,prhint_color1
366
        push hl
889 alone 367
        MYPRCHAR
28 Alone 368
        pop hl
369
        jr prhint0
370
prhint_color0
574 alone 371
        ld de,_HINTCOLOR1;7
28 Alone 372
        jr prhint_color
373
prhint_color1
574 alone 374
        ld de,_HINTCOLOR0;5*8
28 Alone 375
prhint_color
376
        call nv_setcolor
377
        jr prhint0
378
thint
1213 alone 379
        db "{1}Drive { 2}Find  { 3}View  { 4}Edit  { 5}Copy  { 6}Rename{ 7}MkDir { 8}Delete{ 9}Menu  { 0}Quit  ",0
668 alone 380
 
8 dimkam 381
readpanels_reprint
28 Alone 382
        call printhint
8 dimkam 383
        ld ix,leftpanel
384
        call readsortdrawpanel
385
        ld ix,rightpanel
386
readsortdrawpanel
387
        call readdir
388
        call sortfiles
389
        jp drawpanel_with_files
390
 
18 dimkam 391
readpanels_reprint_keepcursor
28 Alone 392
        call printhint
18 dimkam 393
        ld ix,leftpanel
394
        call readsortdrawpanel_keepcursor
395
        ld ix,rightpanel
396
readsortdrawpanel_keepcursor
397
        call readdir_keepcursor
398
        call sortfiles
399
        jp drawpanel_with_files
400
 
701 alone 401
drawpanel_head ;ix=panel (keep!!!)
196 demige 402
        call nv_getpanelxy_de
403
        inc e
404
        inc e
889 alone 405
        call nv_setxy ;keeps de,hl,ix
196 demige 406
        push ix
701 alone 407
        pop hl
408
        ld de,(curpanel)
196 demige 409
        or a
410
        sbc hl,de
701 alone 411
        add hl,de
196 demige 412
        jr nz,drawpanel_dir
2319 kulich 413
        ld de,_FILECURSORCOLOR
196 demige 414
        jr drawpanel_dir0
415
drawpanel_dir
574 alone 416
        ld de,_PANELCOLOR
196 demige 417
drawpanel_dir0
418
        call nv_setcolor
419
        ld de,PANEL.dir
420
        add hl,de
609 alone 421
        push hl
196 demige 422
        ld c,0
609 alone 423
        call panelprtext
424
        call setpanelcolor
425
        pop hl
426
        call strlen ;hl=len
427
        ex de,hl
428
        ld hl,PANELDIRCHARS37
429
        or a
430
        sbc hl,de
431
        ret c
432
        ret z
433
        ld de,tdoublehoriz
701 alone 434
        push ix
435
        call sendchars
2319 kulich 436
 
437
       if PRSTDIO
438
        call printRTCnow        ;᫨  ,    
439
       endif
440
 
701 alone 441
        pop ix
442
        ret
667 alone 443
 
8 dimkam 444
drawpanel_with_files
445
;ix=panel
446
        call setpanelcolor
447
        call nv_getpanelxy_de
600 alone 448
        bit 0,(ix+PANEL.drawtableunneeded)
449
        set 0,(ix+PANEL.drawtableunneeded)
450
        call z,prtable ;keeps ix
196 demige 451
 
8 dimkam 452
        call setpaneldir_makeprompt ;keeps ix
574 alone 453
        ld de,_COLOR
8 dimkam 454
        call nv_setcolor
196 demige 455
 
456
        call drawpanel_head
198 demige 457
        call drawpanelfilesandsize
8 dimkam 458
drawpanel_files
459
;ix=panel
460
        call setpanelcolor
461
        ld l,(ix+PANEL.files)
462
        ld h,(ix+PANEL.files+1)
463
        call nv_getdirscroll_bc
464
        push bc ;dirscroll
465
        or a
466
        sbc hl,bc ;hl=number of files in panel - scroll in panel
1410 alone 467
        ;ld bc,CONST_HGT_TABLE
468
        ld bc,(filesperpanel) ;c
469
        ld b,0
8 dimkam 470
        call minhl_bc_tobc ;bc = min(CONST_HGT_TABLE, number of files in panel - scroll in panel)
471
        pop de ;dirscroll
667 alone 472
        call gotofilepointer_numberde ;hl=file pointer
8 dimkam 473
        call nv_getpanelxy_de
474
        inc d
475
        inc e
476
        ld b,c ;files to show
477
        ld a,b
478
        or a
600 alone 479
        jr z,premptyfiles
480
prNfiles0
658 alone 481
        push bc
8 dimkam 482
        push de
701 alone 483
        call nv_setxy ;keeps de,hl,ix
73 Alone 484
        ;ld e,(hl)
485
        ;inc hl
486
        ;ld d,(hl)
487
        ;inc hl
658 alone 488
        call getfilepointer_de_fromhl ;uses ix
8 dimkam 489
        push hl
490
        ex de,hl
73 Alone 491
        push ix
8 dimkam 492
        call prdirfile
73 Alone 493
        pop ix
8 dimkam 494
        pop hl
658 alone 495
        pop de
8 dimkam 496
        pop bc
497
        inc d
631 alone 498
        djnz prNfiles0
600 alone 499
premptyfiles
500
;c=files to show
1410 alone 501
        ;ld a,CONST_HGT_TABLE
502
        ld a,(filesperpanel)
600 alone 503
        sub c
504
        ret z
658 alone 505
        push ix
600 alone 506
        ld b,a
507
premptyfiles0
658 alone 508
        push bc
600 alone 509
        push de
889 alone 510
        call nv_setxy ;keeps de,hl,ix
600 alone 511
        ;ld e,(hl)
512
        ;inc hl
513
        ;ld d,(hl)
514
        ;inc hl
515
        ;call getfilepointer_de_fromhl
516
        ;push hl
517
        ;ex de,hl
658 alone 518
        ;push ix
600 alone 519
        ld de,emptyfilelinebuf
520
        ld hl,emptyfilelinebuf_sz
521
        call sendchars
658 alone 522
        ;pop ix
600 alone 523
        ;pop hl
658 alone 524
        pop de
600 alone 525
        pop bc
526
        inc d
631 alone 527
        djnz premptyfiles0
658 alone 528
        pop ix
529
        ret
8 dimkam 530
 
658 alone 531
fileiscom ;fcb ;output: z=com
532
        ld a,(fcb+9);(ix+9)
260 alone 533
         or 0x20
534
         cp 'c'
658 alone 535
        jr nz,fileiscom_ix_nocom_a
536
        ld a,(fcb+10);(ix+10)
260 alone 537
         or 0x20
538
         cp 'o'
196 demige 539
        jr nz,fileiscom_ix_nocom
658 alone 540
        ld a,(fcb+11);(ix+11)
260 alone 541
         or 0x20
542
         cp 'm'
658 alone 543
        ret z
196 demige 544
fileiscom_ix_nocom
658 alone 545
        ld a,(fcb+9);(ix+9)
546
fileiscom_ix_nocom_a
196 demige 547
        cp '$'
658 alone 548
        ret nz ;jr nz,fileiscom_ix_nohobeta
549
        ld a,(fcb+10);(ix+10)
550
         or 0x20
551
         cp 'c'
196 demige 552
        ret
553
 
574 alone 554
colorfile
555
;out: de=color
658 alone 556
        ld a,(fcb);(ix) ;mark
557
        rra
558
        ld de,_PANELSELECTCOLOR
559
        ret c
560
        ld a,(fcb+FCB_FATTRIB);(ix+FCB_FATTRIB)
194 demige 561
        and FATTRIB_DIR
574 alone 562
        ld de,_PANELDIRCOLOR
658 alone 563
        ret nz
564
        call fileiscom
574 alone 565
        ld de,_PANELEXECOLOR
658 alone 566
        ret z
567
        ld de,_PANELFILECOLOR
574 alone 568
        ret
569
 
755 alone 570
prdirfile_copyfn
571
;pgc000=(fcb+FCB_EXTENTNUMBERLO)
572
;hl=(fcb+FCB_EXTENTNUMBERHI)
573
;de=filelinebuf
574
;b=maxlen
575
;c=pad char
576
prdirfile_fn0
577
        ld a,(hl)
578
        or a
579
        jr z,prdirfile_fn0q
580
        ld (de),a
581
        inc hl
582
        inc de
583
        djnz prdirfile_fn0
1317 alone 584
        ret;jr prdirfile_fn0qq
755 alone 585
prdirfile_fn0q
586
        ld a,c;' '
587
prdirfile_fn1
588
        ld (de),a
589
        inc de
590
        djnz prdirfile_fn1        
1317 alone 591
;prdirfile_fn0qq
755 alone 592
        ret
593
 
584 alone 594
prdirfile
1301 alone 595
       ld a,(keyfromcalledapp)
596
       or a
597
       ret nz ;᫥ 맮  室  ५ -  ⠥
584 alone 598
;hl=fcb
1410 alone 599
        call getfcbfromhl ;copy to fcb buffer
584 alone 600
        call colorfile ;de=color
658 alone 601
prdirfile_ix_decolor
584 alone 602
        call nv_setcolor
667 alone 603
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 604
        SETPGC000
658 alone 605
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
646 alone 606
        ld de,filelinebuf
755 alone 607
        ld bc,25*256+' '
608
        call prdirfile_copyfn
1509 alone 609
       xor a ; 뢮 ࠧ 䠩 (  ᮤন   騬 ﬨ)
1518 alone 610
       ld (prnumdwordcmd_zero_ldbca),a
658 alone 611
        ld hl,(fcb+FCB_FSIZE)
1518 alone 612
        ld de,(fcb+FCB_FSIZE+2)
667 alone 613
        ld a,(fcb+FCB_FATTRIB)
658 alone 614
        and FATTRIB_DIR
1518 alone 615
        ld bc,filelinebuf_15
616
        call z,prdword_dehl_tobc
617
       ld a,0x02 ;"ld (bc),a":  뢮 files, size
618
       ld (prnumdwordcmd_zero_ldbca),a
841 alone 619
         ld de,filelinebuf_28 ;skip "cursor right" over | (which has different color)
658 alone 620
        ld hl,(fcb+FCB_FDATE)
8 dimkam 621
        push hl
622
        ld a,l
647 alone 623
        and 0x1f
624
        call prNNcmd ;day
625
        pop hl
626
        push hl
8 dimkam 627
        add hl,hl
628
        add hl,hl
629
        add hl,hl
630
        ld a,h
345 alone 631
        and 0x0f
647 alone 632
        add a,a
633
        ld l,a
634
        ld h,0
653 alone 635
        ld bc,tmonth-2
1509 alone 636
        add hl,bc ;CY=0
653 alone 637
        ldi
638
        ldi
647 alone 639
        pop hl
640
        ld a,h
1509 alone 641
        rra ;srl a
647 alone 642
        sub 20
643
        jr nc,$+4
644
        add a,100 ;XX century
645
        call prNNcmd ;year        
574 alone 646
         inc de
658 alone 647
        ld hl,(fcb+FCB_FTIME)
8 dimkam 648
        push hl
649
        ld a,h
650
        rra
651
        rra
652
        rra
345 alone 653
        and 0x1f
8 dimkam 654
        call prNNcmd ;hour
658 alone 655
         inc de ;skip ':'
8 dimkam 656
        pop hl
657
        add hl,hl
658
        add hl,hl
659
        add hl,hl
660
        ld a,h
345 alone 661
        and 0x3f
574 alone 662
        call prNNcmd ;minute
663
        ld de,filelinebuf
664
        ld hl,filelinebuf_sz
701 alone 665
        jp sendchars ;kills ix!!!
574 alone 666
prNNcmd
667
;a=NN
668
;de=buf
669
        ld bc,10+(256*('0'-1))
670
        sub c
671
        inc b
672
        jr nc,$-2
673
         ex de,hl
674
         ld (hl),b
675
         ex de,hl
676
         inc de
677
        add a,'0'+10
678
         ld (de),a
679
         inc de
680
        ret
8 dimkam 681
 
841 alone 682
        macro DATEDELIMITER
683
       if PRSTDIO
684
        db 0x1b,"[C"
685
       else
686
        db 0xb3;''
687
       endif
688
        endm
689
 
574 alone 690
filelinebuf
841 alone 691
        db "filename.ext   "
692
filelinebuf_15
693
        db "1234567890"
694
        DATEDELIMITER
695
filelinebuf_28
696
        db "DDmmYY hh:mm"
574 alone 697
filelinebuf_sz=$-filelinebuf
600 alone 698
emptyfilelinebuf
841 alone 699
        db "                         "
700
        DATEDELIMITER
701
        db "            "
600 alone 702
emptyfilelinebuf_sz=$-emptyfilelinebuf
671 alone 703
tmonth ;month=0 is at tmonth-2 (spaces)
653 alone 704
        ;db "jan"
705
        ;db "feb"
706
        ;db "mar"
707
        ;db "apr"
708
        ;db "may"
709
        ;db "jun"
710
        ;db "jul"
711
        ;db "aug"
712
        ;db "sep"
713
        ;db "oct"
714
        ;db "nov"
715
        ;db "dec"
716
        db "ja","fe","mr","ap","my","jn","jl","au","se","oc","no","de"
647 alone 717
 
8 dimkam 718
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
719
 
720
readdir
721
;ix=panel
18 dimkam 722
        call readdir_keepcursor
723
nv_setcursor_zero
724
        ld bc,0
725
        call nv_setdirscroll_bc
726
        jp nv_setdirpos_zero
727
 
658 alone 728
nv_setcursor_hl
729
        call nv_setdirpos_hl
1410 alone 730
        ;ld bc,CONST_HGT_TABLE*2/3;CONST_HGT_TABLE-1
731
        ld a,(filesperpanel)
732
        srl a
733
        ld c,a
734
        ld b,0
658 alone 735
        xor a
736
        sbc hl,bc
737
        jr nc,$+4
738
         ld h,a
739
         ld l,a
740
        ld b,h
741
        ld c,l
742
        jp nv_setdirscroll_bc
743
 
18 dimkam 744
readdir_keepcursor
745
;ix=panel
8 dimkam 746
        xor a
747
        ld (ix+PANEL.totalsize),a
748
        ld (ix+PANEL.totalsize+1),a
749
        ld (ix+PANEL.totalsize+2),a
750
        ld (ix+PANEL.totalsize+3),a
751
        ld (ix+PANEL.markedsize),a
752
        ld (ix+PANEL.markedsize+1),a
753
        ld (ix+PANEL.markedsize+2),a
754
        ld (ix+PANEL.markedsize+3),a
755
        ld (ix+PANEL.markedfiles),a
756
        ld (ix+PANEL.markedfiles+1),a
757
 
758
        push ix
652 dimkam 759
        ;call setpaneldir
121 demige 760
        call strdelpages
646 alone 761
        ;ld de,fcb
762
        ;OS_SETDTA ;set disk transfer address = de
8 dimkam 763
        ;call makeemptymask
646 alone 764
        ;ld de,fcbmask
765
        ;OS_FSEARCHFIRST
658 alone 766
        pop hl ;get IX
652 dimkam 767
        push hl
768
        ld de,PANEL.dir
769
        add hl,de
770
        ex de,hl ;de=path
668 alone 771
        OS_CHDIR
772
        ld de,emptypath
652 dimkam 773
        OS_OPENDIR
8 dimkam 774
        pop ix
775
        or a
73 Alone 776
 
646 alone 777
        ld hl,0xc000
778
        ld (loaddir_curlnameaddr),hl
779
 
121 demige 780
        ld e,(ix+PANEL.catbuf)     ;00
781
        ld d,(ix+PANEL.catbuf+1)   ;c0
574 alone 782
        ld l,(ix+PANEL.pointers)   ;00   ࠭
783
        ld h,(ix+PANEL.pointers+1) ;c0   䠩
8 dimkam 784
        ld bc,0 ;nfiles
135 dimkam 785
        jp nz,loaddir_error
646 alone 786
                ;ld a,(fcb+1)
787
                ;cp '.'
788
                ;jp z,loaddir_onedot
8 dimkam 789
loaddir0
878 alone 790
        call loaddir_filinfo ;keep ix!!! ;out: CY=end dir, or else Z="."
651 alone 791
        jp c,loaddirq
792
        jr z,loaddir0
646 alone 793
 
794
        push bc
795
 
796
        push de
797
        push hl
798
 
799
        ;ld l,(ix+PANEL.curpgfcbpoi)
800
        ;ld h,(ix+PANEL.curpgfcbpoi+1)
801
        ;ld a,(hl)
1213 alone 802
        ;SETPGC000
109 demige 803
        ld a,e
804
        and 31
805
        add a,(ix+PANEL.pgadd)
806
        PGW3strpg
807
        ld a,e
574 alone 808
        and 0xe0 ;뢠   (<32)  ஬ ࠭, ⠥ ⮫쪮  䠩
109 demige 809
        ld e,a
8 dimkam 810
        xor a
811
        ld (de),a ;mark
812
        inc de
646 alone 813
        ;ld hl,fcb+1
814
        ;ld bc,31;FCB_sz 
815
        ;ldir ; 㥬 fcb  catbuf
816
        ld hl,filinfo+FILINFO_FNAME
878 alone 817
       ld a,'.'
818
       cp (hl)
819
       inc hl
820
       jr nz,loaddir_nodotdot
821
       cp (hl)
822
       jr nz,loaddir_nodotdot
823
       inc hl
824
       ld a,(hl)
825
       dec hl
826
       or a
827
       jr nz,loaddir_nodotdot
828
       ld a,FATTRIB_DIR|0x80
829
       ld (filinfo+FILINFO_FATTRIB),a
830
loaddir_nodotdot
831
       dec hl
646 alone 832
        ;ld bc,8
833
        ;ldir
834
        ;inc hl
835
        ;ld c,3
836
        ;ldir
837
        ex de,hl
838
        push hl
839
        call dotname_to_cpmname ;de -> hl
840
        pop hl
841
        ld bc,11
842
        add hl,bc
843
        ex de,hl
844
        ld (loaddir_fcb_lnamepgpoi),de
845
        inc de ;extent number - NU
846
        ld hl,filinfo+FILINFO_FATTRIB
847
        ldi
848
        ld (loaddir_fcb_lnameaddrpoi),de
849
        inc de ;record count - NU
850
        inc de ;extent number hi - NU
851
        ld hl,filinfo+FILINFO_FSIZE
852
        ;TODO १ 楤
853
        push hl
854
        ld a,(hl)
855
        add a,(ix+PANEL.totalsize)
856
        ld (ix+PANEL.totalsize),a
857
        inc hl
858
        ld a,(hl)
859
        adc a,(ix+PANEL.totalsize+1)
860
        ld (ix+PANEL.totalsize+1),a
861
        inc hl
862
        ld a,(hl)
863
        adc a,(ix+PANEL.totalsize+2)
864
        ld (ix+PANEL.totalsize+2),a
865
        inc hl
866
        ld a,(hl)
867
        adc a,(ix+PANEL.totalsize+3)
868
        ld (ix+PANEL.totalsize+3),a
109 demige 869
        pop hl
701 alone 870
        ld  c,4
646 alone 871
        ldir
872
        ld hl,filinfo+FILINFO_FTIME
873
        ld c,2
874
        ldir
875
        ex de,hl
876
        ld c,8
877
        add hl,bc
878
        ex de,hl
879
        ld hl,filinfo+FILINFO_FDATE
878 alone 880
        ldi
881
        ldi
646 alone 882
 
883
loaddir_curlnameaddr=$+1
884
        ld de,0
885
;᫨       ⥪饩 ࠭,    ᤢ 㪠⥫
886
        ld a,d
887
        inc a
888
        jr nz,loaddirlname_nonewpg
889
        ld a,e
890
        cp -DIRMAXFILENAME64
891
        jr c,loaddirlname_nonewpg
892
        call lnamenewpage
893
        ld de,0xc000        
894
loaddirlname_nonewpg
895
; ⥪騩 㪠⥫     fcb
896
;    㪠⥫
897
        ld l,(ix+PANEL.curpglnamepoi)
898
        ld h,(ix+PANEL.curpglnamepoi+1)
899
        ld a,(hl)
900
loaddir_fcb_lnamepgpoi=$+1
901
        ld (0),a
902
loaddir_fcb_lnameaddrpoi=$+2
903
        ld (0),de
1213 alone 904
        SETPGC000
646 alone 905
        ld hl,filinfo+FILINFO_LNAME
906
        ld a,(hl)
907
        or a
908
        jr nz,$+5
909
        ld hl,filinfo+FILINFO_FNAME
910
        call strcopy ;out: hl,de after terminator
911
        ld (loaddir_curlnameaddr),de
912
 
913
        pop hl
109 demige 914
        pop de
574 alone 915
        call putfilepointer_de_tohl ; 頥  孥  ࠭ poipg   pointers  de
109 demige 916
        ex de,hl
917
        ld bc,32
918
        add hl,bc
574 alone 919
        ex hl,de ; 㢥稫  32 catbuf
646 alone 920
        jr nc,nonewpg ;   㬥頥  ࠭
121 demige 921
        inc de ;next page de
922
        call strnewpage
646 alone 923
        set 7,d
924
        set 6,d
121 demige 925
nonewpg:
8 dimkam 926
 
927
        pop bc
928
        inc bc ;nfiles
1317 alone 929
        bit 5,b;1,b ;࠭窠 pgtemp 稫? max 8192 䠩  32 
651 alone 930
        jp z,loaddir0
8 dimkam 931
loaddir_error
932
loaddirq
933
;bc=nfiles
934
        ld (ix+PANEL.files),c
935
        ld (ix+PANEL.files+1),b
936
 
937
        call countfiles
938
        ld (ix+PANEL.filesdirs),l
939
        ld (ix+PANEL.filesdirs+1),h
18 dimkam 940
 
941
        ex de,hl
942
        call nv_getdirpos_hl
943
        or a
944
        sbc hl,de ;dirpos<files?
945
        ret c ;OK
946
        jp nv_setcursor_zero
8 dimkam 947
 
651 alone 948
loaddir_filinfo
712 alone 949
;keep ix!!!
878 alone 950
;out: CY=end dir, or else Z="."
651 alone 951
        push bc
952
        push de
712 alone 953
        push hl
954
        push ix
651 alone 955
        ld de,filinfo
956
        OS_READDIR
712 alone 957
        pop ix
651 alone 958
        pop hl
959
        pop de
960
        pop bc
961
        or a
962
         scf
963
        ret nz ;CY
964
        ld a,(filinfo+FILINFO_FNAME)
965
        or a
966
         scf
967
        ret z ;CY
968
        ld a,(filinfo+FILINFO_FNAME+1)
969
        or a
970
        ret nz ;not one dot ;NC
971
        ld a,(filinfo+FILINFO_FNAME)
972
        cp '.'
973
        ret z ;Z,NC ;one dot
974
        or a ;NZ,NC
975
        ret
976
 
8 dimkam 977
controlloop
1301 alone 978
       ld a,(keyfromcalledapp)
979
       or a
980
        call z,fixscroll_prcmd
11 dimkam 981
controlloop_noprline
8 dimkam 982
        ld hl,controlloop
983
        push hl
1301 alone 984
 
985
keyfromcalledapp=$+1
986
       ld a,0 ;᫥ 맮  室  ५  ५, ⮬ key_enter, ⮬ 0
987
       or a
988
       jr z,controlloop_nokey
989
       push af
990
        cp key_enter
991
        ld a,key_enter
992
        jr nz,$+3
993
        xor a
994
        ld (keyfromcalledapp),a
995
        jr controlloop_nokeyq
996
controlloop_nokey
8 dimkam 997
        ld ix,(curpanel)
998
        ld a,(ix+PANEL.files)
999
        or (ix+PANEL.files+1)
721 alone 1000
       push af
631 alone 1001
        call z,nv_setdirpos_zero ;can't move cursor if 0 files
721 alone 1002
       pop af
574 alone 1003
        ;ld e,CURSORCOLOR;#38
1004
        ;OS_PRATTR ;draw cursor
1005
        ld hl,_FILECURSORCOLOR
721 alone 1006
        call nz,prfilecursor_reprintfile ;more than 0 files
8 dimkam 1007
        call cmdcalccurxy
889 alone 1008
        call nv_setxy ;keeps de,hl,ix
660 alone 1009
        ;SETX_ ;force reprint cursor
1301 alone 1010
 
841 alone 1011
       if PRSTDIO
2319 kulich 1012
        call yieldgetkeyloop_rtc        ; 筮 ७ᥭ  stdio.asm ⮡     ᮢ
841 alone 1013
       else
1014
        YIELDGETKEYLOOP
1015
       endif
2319 kulich 1016
 
576 alone 1017
         or a
1018
         jr z,controlloop_nokey ;TODO handle mouse events
8 dimkam 1019
        push af
1301 alone 1020
;controlloop_nokeyq
574 alone 1021
        ld ix,(curpanel)
1022
        call getfcbaddrundercursor
721 alone 1023
        ;push hl
1024
        ;pop ix
574 alone 1025
        call colorfile
1026
        ex de,hl ;hl=color
721 alone 1027
        ld a,(ix+PANEL.files)
1028
        or (ix+PANEL.files+1)
1029
        call nz,prfilecursor_reprintfile ;remove file cursor if more than 0 files
574 alone 1030
        ;call cmdcalccurxy
1031
        ;call nv_setxy
1032
        ;ld e,COLOR;7
631 alone 1033
        ;OS_PRATTR ;remove cursor
574 alone 1034
         ld de,_COLOR
11 dimkam 1035
         call nv_setcolor ;even if we didn't reprint command line, draw windows with its color
1301 alone 1036
controlloop_nokeyq
8 dimkam 1037
        pop af
1038
        ld hl,tnvcmds
1039
        ld bc,nnvcmds
631 alone 1040
        cpir
8 dimkam 1041
        jp nz,editcmd_keyfail
574 alone 1042
;bc=nnvcmds-(#+1) = 0..(nnvcmds-1)
8 dimkam 1043
        add hl,bc
1044
;hl=tnvcmds+nnvcmds
1045
        add hl,bc
1046
        add hl,bc
574 alone 1047
;hl=tnvcmds+nnvcmds+ 2*(nnvcmds-(#+1))
8 dimkam 1048
        ld c,(hl)
1049
        inc hl
1050
        ld h,(hl)
1051
        ld l,c
1052
        push hl ;jump addr
1053
        ld hl,cmdbuf
1054
        ld ix,(curpanel)
1055
        ret
1056
editcmd_keyfail
116 alone 1057
        cp 0x20
574 alone 1058
        ret c ;稥 ⥬   㦭
8 dimkam 1059
editcmd_typein
1060
;keeps ix
1061
        ld e,a
1062
        ld hl,cmdbuf
1063
        call strlen ;hl=length
1064
        ld bc,MAXCMDSZ
1065
        or a
1066
        sbc hl,bc
574 alone 1067
        ret nc ;㤠 
8 dimkam 1068
        call cmdcalctextaddr ;hl=addr, a=curcmdx
1069
        inc a
1070
        ld (curcmdx),a
1071
        jp strinsch
1072
 
1073
editcmd_space
1074
        ld a,(cmdbuf)
1075
        or a
1076
        ld a,' '
1077
        jr nz,editcmd_typein
1078
        call getfcbaddrundercursor;hl=addr fcb ;ix=curpanel
1079
        call isthisdotdir_hl
1080
        call nz,changemark_hl
1081
        push hl
1082
        call setfilecursorxy
1083
        pop hl
1084
        call prdirfile
1085
        ld ix,(curpanel)
1086
        call drawpanelfilesandsize
1087
        jp editcmd_down
1088
 
1089
editcmd_backspace
1090
        call cmdcalctextaddr ;hl=addr, a=curcmdx
1091
        or a
574 alone 1092
        jr z,editcmddirback;editcmdok ;祣 㤠
8 dimkam 1093
        dec a
1094
        ld (curcmdx),a
1095
        jp strdelch
606 dimkam 1096
editcmd_del
1097
        call cmdcalctextaddr ;hl=addr, a=curcmdx
1098
        or a
1099
        ret z ;祣 㤠 ࠢ
1100
        inc hl
1101
        jp strdelch
667 alone 1102
 
658 alone 1103
;hl = poi to filename in string
1104
;out: de = after last slash
1105
findlastslash.
1106
nfopenfnslash.
1107
        ld d,h
1108
        ld e,l ;de = after last slash
1109
nfopenfnslash0.
1110
        ld a,[hl]
1111
        inc hl
1112
        or a
1113
        ret z
1114
        cp '/'
1115
        jr nz,nfopenfnslash0.
1116
        jr nfopenfnslash.
8 dimkam 1117
 
1118
editcmddirback
659 alone 1119
editcmddirback_go
8 dimkam 1120
        call setpaneldir
1121
        ld de,tdotdot
1122
        OS_CHDIR
658 alone 1123
;  ४ਨ  ᫥  paneldir
889 alone 1124
        call getcurpaneldir_hl
658 alone 1125
        call findlastslash. ;out: de = after last slash
1126
        ex de,hl
1127
        ld de,filenametext
1128
        call strcopy
889 alone 1129
        ld hl,(curpanel)
659 alone 1130
        push hl
658 alone 1131
        call editcmd_setpaneldirfromcurdir_panelhl
659 alone 1132
        pop ix ;ld ix,(curpanel)
658 alone 1133
        call readdir
1134
        call sortfiles
1135
;  ४ਨ
659 alone 1136
        ;ld ix,(curpanel)
658 alone 1137
        call getfiles
1138
        ld b,h
1139
        ld c,l
1140
        ld hl,0
1141
editcmddirbackfind0
1142
        push bc
1143
        push hl
1144
        call getfcbaddrunderhl
1145
        ld de,FCB_EXTENTNUMBERLO
1146
        add hl,de
2319 kulich 1147
        ld a,(hl) ;hl=fcb+FCB_EXTENTNUMBERLO
658 alone 1148
        inc hl
1149
        inc hl
2319 kulich 1150
        ld e,(hl) ;hl=fcb+FCB_EXTENTNUMBERHI
658 alone 1151
        inc hl
1152
        ld d,(hl)
1213 alone 1153
        SETPGC000
658 alone 1154
        ld hl,filenametext
1155
        call strcp
1156
        pop hl
1157
        pop bc
1158
        jr z,editcmddirback_ok
1159
        cpi
1160
        jp pe,editcmddirbackfind0
1161
        ld h,b
1162
        ld l,c ;error!!! not found!!!
1163
editcmddirback_ok
1164
;hl=  ४ਨ
1165
        call nv_setcursor_hl ;⠭   
712 alone 1166
 
658 alone 1167
        call drawpanel_with_files
1168
        jp editcmd_readprompt_setendcmdx
8 dimkam 1169
 
1170
editcmd_left
1171
        ld a,(curcmdx)
1172
        or a
1095 alone 1173
        jp z,editcmd_pageUp ;ret z ;㤠 
8 dimkam 1174
        dec a
1175
        ld (curcmdx),a
1176
        ret
712 alone 1177
 
8 dimkam 1178
editcmd_right
1179
        call cmdcalctextaddr ;hl=addr, a=curcmdx
1180
        inc (hl)
1181
        dec (hl)
1095 alone 1182
        jp z,editcmd_pageDown ;ret z ;㤠 ࠢ, ⮨  ନ
8 dimkam 1183
        inc a
1184
        ld (curcmdx),a
1185
        ret
712 alone 1186
 
8 dimkam 1187
editcmd_pageDown
1188
        call nv_getdirpos_hl
1410 alone 1189
        ;ld bc,CONST_HGT_TABLE-1 ;⮡       pageUp
1190
        ld bc,(filesperpanel) ;c
1191
        dec c
1192
        ld b,0
8 dimkam 1193
        add hl,bc
1410 alone 1194
        ;call count_filecursor_logy
1195
        ;cp c;CONST_HGT_TABLE-1
1196
        ;jr c,editcmd_pageDown_nolastvisible ;not last visible file
8 dimkam 1197
editcmd_pageDown_end_q        
1198
        call cpfiles_setdirpos ;hl=dirpos
1410 alone 1199
        ;ld bc,CONST_HGT_TABLE-1
1200
        ld bc,(filesperpanel) ;c
1201
        dec c
1202
        ld b,0
8 dimkam 1203
        xor a
1204
        sbc hl,bc
1205
        jr nc,$+4
1206
        ld h,a
1207
        ld l,a;0
1208
        jr editcmd_pageUpq
1410 alone 1209
;editcmd_pageDown_nolastvisible
1210
        ;call cpfiles_setdirpos
1211
        ;call nv_getdirscroll_bc
1212
        ;ld hl,CONST_HGT_TABLE-1
1213
        ;add hl,bc ;last visible file
1214
        ;call cpfiles_setdirpos
1215
        ;jr editcmd_clearkbddrawpanel ;jp drawpanel_files      
8 dimkam 1216
 
1217
editcmd_pageUp
1410 alone 1218
        ;call count_filecursor_logy
1219
        ;or a;cp firstfiley
1220
        ;jr nz,editcmd_pageDown_nofirstvisible ;not first visible file
8 dimkam 1221
        call nv_getdirpos_hl
1410 alone 1222
        ;ld bc,CONST_HGT_TABLE-1
1223
        ld bc,(filesperpanel) ;c
1224
        dec c
1225
        ld b,0
31 Alone 1226
        xor a
1227
        sbc hl,bc
1228
        jr nc,$+4
8 dimkam 1229
        ld h,a
1230
        ld l,a;0
1231
        call nv_setdirpos_hl
1232
editcmd_pageUpq
1233
        ld b,h
1234
        ld c,l
1235
        call nv_setdirscroll_bc
1410 alone 1236
;editcmd_clearkbddrawpanel
1237
        call drawpanel_files
1238
        call editcmd_updownq
1239
        jp clear_keyboardbuffer ;TODO 祬  ࠡ⠥?
1240
;editcmd_pageDown_nofirstvisible
1241
        ;call nv_getdirscroll_bc
1242
        ;ld h,b
1243
        ;ld l,c
1244
        ;call nv_setdirpos_hl
1245
        ;jr editcmd_clearkbddrawpanel ;jp drawpanel_files      
8 dimkam 1246
 
1247
editcmd_End
1248
        ld hl,-1 ;>=files
1249
        jp editcmd_pageDown_end_q
1250
 
1251
editcmd_Home
1252
        xor a
1253
        ld h,a
1254
        ld l,a;0
1255
        call nv_setdirpos_hl
600 alone 1256
        jr editcmd_pageUpq
8 dimkam 1257
 
1258
editcmd_up
11 dimkam 1259
         ld hl,controlloop_noprline
1260
         ex (sp),hl
8 dimkam 1261
        call nv_getdirpos_hl
1262
        ld a,h
1263
        or l
1264
        ret z ;first file
1265
        dec hl
1266
        call nv_setdirpos_hl
1410 alone 1267
        call count_filecursor_logy
1268
        inc a ;firstfiley-2;or a
1269
        jr nz,editcmd_updownq;ret nz ;not above first visible file
8 dimkam 1270
        call nv_getdirscroll_bc
1271
        dec bc
1272
        call nv_setdirscroll_bc
1410 alone 1273
         ;push bc
8 dimkam 1274
        call nv_getpanelxy_de
1275
        inc d
1410 alone 1276
        ;push de
1277
        ;ld hl,CONST_HGT_TABLE*256 + 40
1278
        ld hl,(filesperpanel-1) ;h
1279
        ld l,40
1440 alone 1280
       ld a,(keyfromcalledapp)
1281
       or a ;nz = ᫥ 맮  室  ५ -  ⠥
841 alone 1282
       if PRSTDIO
1440 alone 1283
        call z,scrolldown
841 alone 1284
       else
1440 alone 1285
        jr nz,scrolldownskip
841 alone 1286
        OS_SCROLLDOWN
1440 alone 1287
scrolldownskip
841 alone 1288
       endif
1410 alone 1289
        ;pop de
1290
editcmd_updownq
1291
        ;inc e
1292
        ;call nv_setxy ;keeps de,hl,ix
1293
         ;pop hl ;file number
1294
        call setfilecursorxy
1295
        call nv_getdirpos_hl
1296
       ;push hl
8 dimkam 1297
        call getfcbaddrunderhl
1410 alone 1298
        call prdirfile
1299
       ;pop hl
1300
       ret
1301
;TODO ⮬᪨   䠩  ப:
1302
        ;call getfcbaddrunderhl
1303
        ;call getfcbfromhl ;copy to fcb buffer
1304
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1305
        SETPGC000
1306
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
1307
        ld de,cmdbuf
1308
;TODO   ,   ᫥ ᫮ ( ᨬ  䫠)
1309
        ;call strcopy
1310
        ld bc,MAXCMDSZ
1311
        ldir
1312
        jp fixscroll_prcmd
8 dimkam 1313
 
1314
editcmd_down
11 dimkam 1315
         ld hl,controlloop_noprline
1316
         ex (sp),hl
8 dimkam 1317
        call nv_getdirpos_hl
1318
        call nv_getpanelfiles_bc
1319
        inc hl
1320
        or a
1321
        sbc hl,bc
1322
        add hl,bc
1323
        ret z ;last file
1324
        call nv_setdirpos_hl
1410 alone 1325
        call count_filecursor_logy
1326
        ;cp CONST_HGT_TABLE;-1+firstfiley
1327
        ld hl,(filesperpanel) ;l
1328
        cp l
1329
        ;ret c ;not last visible file
1330
       jr c,editcmd_updownq;editcmd_down_noscroll
8 dimkam 1331
        call nv_getdirscroll_bc
1332
        inc bc
1333
        call nv_setdirscroll_bc
1410 alone 1334
        ;ld hl,CONST_HGT_TABLE-1
1335
        ;ld hl,(filesperpanel) ;l
1336
        ;ld h,0
1337
        ;add hl,bc
1338
         ;push hl
8 dimkam 1339
        call nv_getpanelxy_de
1340
        inc d
1410 alone 1341
        ;push de
1342
        ;ld hl,CONST_HGT_TABLE*256 + 40
1343
        ld hl,(filesperpanel-1) ;h
1344
        ld l,40
1440 alone 1345
       ld a,(keyfromcalledapp)
1346
       or a ;nz = ᫥ 맮  室  ५ -  ⠥
841 alone 1347
       if PRSTDIO
1440 alone 1348
        call z,scrollup
841 alone 1349
       else
1440 alone 1350
        jr nz,scrollupskip
841 alone 1351
        OS_SCROLLUP
1440 alone 1352
scrollupskip
841 alone 1353
       endif
1410 alone 1354
        ;pop de
1355
        ;ld a,CONST_HGT_TABLE-1
1356
        ;ld a,(filesperpanel)
1357
        ;dec a
1358
        ;add a,d
1359
        ;ld d,a
1360
        jr editcmd_updownq
1361
;editcmd_down_noscroll
1362
        ;call setfilecursorxy
1363
        ;jr editcmd_updownqq
8 dimkam 1364
 
1365
editcmd_ss1
1366
        ld hl,comparefilename
1367
        jr editcmd_setsortmodehl
1368
editcmd_ss2
1369
        ld hl,compareext
1370
        jr editcmd_setsortmodehl
1371
editcmd_ss3
1372
        ld hl,comparesize
1373
        jr editcmd_setsortmodehl
1374
editcmd_ss4
1375
        ld hl,comparedate
1376
        jr editcmd_setsortmodehl
1377
editcmd_ss5
1378
        ld hl,compareempty
1379
editcmd_setsortmodehl
1380
        call ifcmdnonempty_typedigit
1381
        ld c,(ix+PANEL.dirsortproc)
1382
        ld b,(ix+PANEL.dirsortproc+1)
1383
        xor a
1384
        sbc hl,bc
1385
        add hl,bc
1386
        jr nz,editcmd_setsortmodehl_noold
1387
        ld a,(ix+PANEL.dirsortmode)
1388
        cpl
1389
editcmd_setsortmodehl_noold
1390
        ld (ix+PANEL.dirsortmode),a
1391
        ld (ix+PANEL.dirsortproc),l
1392
        ld (ix+PANEL.dirsortproc+1),h
1393
        jp editcmd_reprintcurpanel
1394
 
1395
editcmd_tab
196 demige 1396
        push ix
8 dimkam 1397
        call getanotherpanel_ix
1398
        ld (curpanel),ix
196 demige 1399
        call drawpanel_head
1400
        pop ix
1401
        call drawpanel_head ;inactive panel
8 dimkam 1402
        jp editcmd_readprompt_setendcmdx
1403
 
1404
editcmd_enter
1405
        ld a,(cmdbuf)
1406
        or a
1407
        jr nz,editcmd_enter_runcmd
1408
        call getfcbundercursor ;->fcb
23 dimkam 1409
        ld a,(fcb+FCB_FATTRIB)
8 dimkam 1410
        and FATTRIB_DIR;#10
1411
        jp z,editcmd_enter_run
659 alone 1412
         ld hl,fcb+FCB_FNAME
1413
         ld a,(hl)
1414
         cp '.'
1415
         jr nz,editcmd_enter_nodotdot
1416
         inc hl
1417
         ld a,(hl)
1418
         cp '.'
1419
         jp z,editcmddirback_go
1420
editcmd_enter_nodotdot
8 dimkam 1421
        call changedir_fromfcb
658 alone 1422
;editcmd_setpaneldirfromcurdir
8 dimkam 1423
        ld hl,editcmd_reprintcurpanel
1424
        push hl
1425
        ld hl,(curpanel)
1426
editcmd_setpaneldirfromcurdir_panelhl
1427
        ld de,PANEL.dir
1428
        add hl,de
55 Alone 1429
        ex de,hl ;de=pointer to 64 byte (MAXPATH_sz!) buf
8 dimkam 1430
        OS_GETPATH
600 alone 1431
         jp clear_keyboardbuffer
8 dimkam 1432
 
1108 dimkam 1433
start_from_ext
1434
        ld hl,cmdbuf - 1
1435
        xor a
1436
start_from_ext_l1
1437
        inc hl
1438
        cp (hl)
1439
        jr nz,start_from_ext_l1
1440
        ld a,' '
1441
        ld (hl),a
1442
        ld de,cmdprompt
1443
start_from_ext_l2
1444
        inc hl
1445
        ld a,(de)
1446
        ld (hl),a
1447
        inc de
1448
        or a
1449
        jr nz,start_from_ext_l2
1450
 
8 dimkam 1451
editcmd_enter_runcmd
1452
;run "cmd <command to run>"
1213 alone 1453
        OS_SETSYSDRV ;४ cmd
8 dimkam 1454
        ld hl,cmd_filename
1455
        call copy_to_fcb_filename
712 alone 1456
 
579 alone 1457
        ld hl,cmdbuf
1458
loadandrun_waitpid
1459
;hl=cmdbuf  cmdprompt ( loadandrun_restcmd)
1196 alone 1460
       ;ld (loadandrun_waitpid_string),hl
1461
       push hl
600 alone 1462
        call setdrawtablesneeded
841 alone 1463
       if PRSTDIO
574 alone 1464
        ld de,0
889 alone 1465
        call nv_setxy ;keeps de,hl,ix
574 alone 1466
        ld de,_COLOR
1467
        SETCOLOR_
1410 alone 1468
        ;CLS_
1469
        ;ld de,0
1837 alone 1470
        ld de,(scrhgt-1) ;d
1471
        dec d
1472
        ld e,0
1473
        call nv_setxy ;keeps de,hl,ix
1474
        call clearrestofline
849 alone 1475
       else
2351 alone 1476
        ;call nv_copyscreen1to0
1477
        ;ld e,-1
1478
        ;OS_SETGFX ;disable gfx, give focus ;before RUNAPP!!! (᫨ ,    室   view/play)
841 alone 1479
       endif
2351 alone 1480
       if PRSTDIO ;1==1
755 alone 1481
        ld ix,leftpanel
1482
        call strdelpages
1483
        ld ix,rightpanel
1484
        call strdelpages
1485
        call deletepages
2351 alone 1486
       endif
1196 alone 1487
;loadandrun_waitpid_looploadandrun
1488
;loadandrun_waitpid_string=$+1
1489
;       ld hl,0
1490
       pop hl ;hl=cmdbuf  cmdprompt
68 Alone 1491
         ;call setcurpaneldir
8 dimkam 1492
        call loadandrun ;nz=error, e=id
2351 alone 1493
     if PRSTDIO ;1==1
8 dimkam 1494
        jp nz,execcmd_error
576 alone 1495
; scratch - ॠ쭮 cmd scratch  ⥪饬 ନ
11 dimkam 1496
        WAITPID
1196 alone 1497
;HL - १,  㫠  
1498
        ld a,h
1499
        or a
1500
        jr nz,loadandrun_waitpid_looploadandrunq
1501
        ld a,l
1502
        cp key_left
1503
        ld a,key_up
1504
        jr z,loadandrun_waitpid_looploadandrun
1505
        ld a,l
1506
        cp key_right
1507
        ld a,key_down
1508
        jr z,loadandrun_waitpid_looploadandrun
1509
        ld a,l
1510
        cp key_up
1511
        jr z,loadandrun_waitpid_looploadandrun
1512
        cp key_down
1513
        ;jr z,loadandrun_waitpid_looploadandrun
1514
        jr nz,loadandrun_waitpid_looploadandrunq
1515
loadandrun_waitpid_looploadandrun
1301 alone 1516
;諨  맢 ணࠬ  ५ -  ९뢠 祣
1196 alone 1517
       ld (keyfromcalledapp),a
1301 alone 1518
        call assignpages
1519
        ld ix,(curpanel)
1520
        call readdir_keepcursor
1521
        jp sortfiles
1522
 
1196 alone 1523
loadandrun_waitpid_looploadandrunq
841 alone 1524
       if PRSTDIO
668 alone 1525
        CLS_ ;scroll what was printed
841 alone 1526
       endif
560 alone 1527
execcmd_error
755 alone 1528
        call assignpages
2351 alone 1529
     endif
849 alone 1530
       if PRSTDIO == 0
2351 alone 1531
        ;ld e,6 ;textmode
1532
        ;OS_SETGFX ;take focus (can be random after closing cmd)
1533
        ;call nv_copyscreen0to1
1534
        ;YIELDGETKEY ;key refresh
849 alone 1535
       endif
851 alone 1536
        xor a
1537
        ld (cmdbuf),a
1538
        ld (curcmdscroll),a
596 alone 1539
        jp editcmd_reprintall_keepcursor
8 dimkam 1540
 
1541
editcmd_enter_run
1542
        call setpaneldir
1543
        ld hl,fcb_filename+8
1544
        ld a,(hl)
1545
        inc hl
1546
        ld c,(hl)
1547
        inc hl
1548
        ld b,(hl)
1549
        cp '$'
1550
        jp z,editcmd_enter_runfile_hobeta
574 alone 1551
        or 0x20
8 dimkam 1552
        cp 'c'
1553
        jr nz,editcmd_enter_runfile_nocom
1554
        ld a,c
574 alone 1555
        or 0x20
8 dimkam 1556
        cp 'o'
1557
        jr nz,editcmd_enter_runfile_nocom
1558
        ld a,b
574 alone 1559
        or 0x20
8 dimkam 1560
        cp 'm'
1561
        jr nz,editcmd_enter_runfile_nocom
1562
editcmd_enter_runfile_com
1563
        ld hl,cmdbuf
1564
        ld (hl),0
1565
;hl=rest of command line
579 alone 1566
        jp loadandrun_waitpid
8 dimkam 1567
 
1568
editcmd_enter_runfile_nocom
1569
        ld hl,runfile_nocomq
1570
        push hl
1571
        call makeprompt_filename
1572
 
1573
        call runfile_findhandler ;find fcb_filename ext (spoiled) in "nv.ext"
1574
        ret nz ;jp nz,execcmd_error
1108 dimkam 1575
        jp start_from_ext
1576
        ; ld de,cmdbuf
1577
        ; ld hl,fcb_filename
1578
        ; OS_PARSEFNAME ;de->hl
8 dimkam 1579
 
1213 alone 1580
        ; OS_SETSYSDRV ;४ cmd
1108 dimkam 1581
        ; ld hl,cmdprompt
1582
        ; jp loadandrun_waitpid
8 dimkam 1583
 
1584
makeprompt_filename
1585
        call setpaneldir_makeprompt ;keeps ix
1586
        call getfcbundercursor ;->fcb
1587
        ld hl,cmdprompt
1588
        xor a
631 alone 1589
        cpir
574 alone 1590
        dec hl ;hl= ନ
8 dimkam 1591
        ld a,'/'
1592
        dec hl
1593
        cp (hl)
1594
        inc hl
1595
        jr z,$+4
1596
         ld (hl),a
1597
         inc hl
574 alone 1598
        ex de,hl ;de=prompt = "d:/path/"  ନ
8 dimkam 1599
        ld hl,fcb_filename
658 alone 1600
        jp cpmname_to_dotname ;prompt = "d:/path/filename"
8 dimkam 1601
 
1602
runfile_findhandler
1603
;find fcb_filename ext (spoiled) in "nv.ext"
1604
;out: nz=error, cmdbuf=handler
1605
        ld hl,fcb_filename+8
1606
        ld de,ext
1607
        ld b,3
1608
runfile_nocom_recodeext0
1609
        ld a,(hl)
574 alone 1610
        or 0x20
8 dimkam 1611
        ld (de),a
1612
        inc hl
1613
        inc de
631 alone 1614
        djnz runfile_nocom_recodeext0
1213 alone 1615
        OS_SETSYSDRV ;४ nv
878 alone 1616
        ld de,fn_ext
1617
        ;ld hl,ext_filename
1618
        ;ld de,filenametext
1619
        ;push de
1620
        ;call cpmname_to_dotname
1621
        ;pop de
631 alone 1622
        OS_OPENHANDLE
1623
        or a
8 dimkam 1624
        ret nz ;error
631 alone 1625
        ld a,b
1626
        ld (curhandle),a
8 dimkam 1627
        ld iy,file_buf_end
1628
runfile_nocom_extloop
574 alone 1629
        call checkoneext ;c=訡, z= 訡
111 demige 1630
        jr c,runfile_nocom_readerror
8 dimkam 1631
        jr z,runfile_nocom_extok
1632
        call checkcomma
111 demige 1633
        jr c,runfile_nocom_readerror
8 dimkam 1634
        jr z,runfile_nocom_extloop
1635
        call skiptonextline
1636
        jr nz,runfile_nocom_extloop ;no EOF
111 demige 1637
runfile_nocom_readerror
631 alone 1638
        call nv_closehandle
8 dimkam 1639
        xor a
1640
        dec a
1641
        ret ;nz
1509 alone 1642
        ;display "runfile_nocom_extok ",$
8 dimkam 1643
runfile_nocom_extok
574 alone 1644
        call skiptocolon ;ன  ':'
8 dimkam 1645
        ld hl,cmdbuf
1646
        call loadtoendline
631 alone 1647
        call nv_closehandle
8 dimkam 1648
        xor a
1649
        ret ;z
712 alone 1650
 
8 dimkam 1651
runfile_nocomq
1652
        ld hl,cmdbuf
1653
        ld (hl),0
1654
        ld ix,(curpanel)
1655
setpaneldir_makeprompt
1656
        call setpaneldir ;keeps ix
1657
        jp makeprompt ;-> prompt ;keeps ix
1658
 
1659
        macro READBYTE_A
1660
;out: z=EOF
1661
        inc ly
1662
        call m,readbyte_readbuf
1663
        ld a,(iy)
1664
        endm
1665
 
1666
checkoneext
1667
        ld hl,ext
1668
        ld bc,3*256
1669
checkoneext0
1670
        READBYTE_A
1671
        ret z ;EOF
574 alone 1672
        cp 0x0a
8 dimkam 1673
        jr z,checkoneext0 ;skip LF
574 alone 1674
        or 0x20
8 dimkam 1675
        xor (hl)
1676
        inc hl
1677
        or c
1678
        ld c,a
631 alone 1679
        djnz checkoneext0
574 alone 1680
;c=訡, z= 訡
8 dimkam 1681
        ret
1682
 
1683
skiptocolon
1684
        READBYTE_A
1685
        ret z ;EOF
1686
        cp ':'
1687
        jr nz,skiptocolon
1688
        ret
1689
 
1690
checkcomma
1691
        READBYTE_A
1692
        cp ','
574 alone 1693
        ret ;TODO ஢ EOF
712 alone 1694
 
8 dimkam 1695
loadtoendline
1696
;hl=buf
1697
        READBYTE_A
1698
        jr z,loadtoendlineq
574 alone 1699
        cp 0x0d
8 dimkam 1700
        jr z,loadtoendlineq
1701
        ld (hl),a
1702
        inc hl
1703
        jr loadtoendline
1704
loadtoendlineq
1705
        ld (hl),0
1706
        ret
1707
 
1708
skiptonextline
1709
        READBYTE_A
1710
        ret z ;EOF
574 alone 1711
        cp 0x0d
8 dimkam 1712
        jr nz,skiptonextline
1713
        or a
1714
        ret ;nz
1715
 
1716
readbyte_readbuf
1717
;out: z=EOF
1718
        push bc
1719
        push de
1720
        push hl
1721
        push ix
1722
        ld de,file_buf
1723
        push de
631 alone 1724
        ld hl,128
1725
        call readcurhandle
1726
        ld a,h
1727
        or l ;z=no bytes read
8 dimkam 1728
        pop iy
1729
        pop ix
1730
        pop hl
1731
        pop de
1732
        pop bc
1733
        ret
1734
 
1735
editcmd_enter_runfile_hobeta
574 alone 1736
hobetarunner=0x4100
1737
        ld e,6 ;textmode
1738
        OS_SETGFX
712 alone 1739
 
555 alone 1740
        ld a,(user_scr0_low) ;ok
1213 alone 1741
        SETPG8000
712 alone 1742
        inc a ;ld a,#ff-0
1213 alone 1743
        SETPGC000
712 alone 1744
;0x4000 : pgcode4000 ;(pg4    ⥪!!!   ⮫쪮 ⮩ !!!)
1745
;0x8000 : pg1
1746
;0xc000 : pg0
1747
        call loadhobeta
1748
        ret nz ;error
1749
 
1750
        di
1751
        ld a,(user_scr0_low) ;ok
8 dimkam 1752
        sub 4-1 ;ld a,#ff-4 ;pgkillable
1213 alone 1753
        SETPG8000
712 alone 1754
        ld hl,0x4000
1755
        ld de,0x8000
1756
        ld bc,0x4000
1757
        ldir ;copy pgcode4000 -> pg4
1758
 
1759
        ld a,(user_scr0_low) ;ok
1213 alone 1760
        SETPG8000
712 alone 1761
        ;ld a,(user_scr0_low) ;ok
1762
        sub 4-1 ;ld a,#ff-4 ;pgkillable
1213 alone 1763
        SETPG4000
8 dimkam 1764
        ld hl,washobetarunner
1765
        ld de,hobetarunner
1766
        ld bc,hobetarunner_sz
1767
        ldir
712 alone 1768
;0x4000 : pg4 (   ⥪!!!   ⮫쪮 ⮩ !!!)
574 alone 1769
;0x8000 : pg1
1770
;0xc000 : pg0
1771
        ld hl,0x6000
1772
        ld bc,(0x6000-17+11) ;len
8 dimkam 1773
        add hl,bc
1774
        dec hl ;hl=load end
1775
        ex de,hl
574 alone 1776
        ld hl,(0x6000-17+9) ;start
8 dimkam 1777
        ld (hobetarunner_jp),hl
1778
        add hl,bc
1779
        dec hl
1780
        ex de,hl ;de=destination end
1781
        lddr
1782
        jp hobetarunner
1783
 
712 alone 1784
loadhobeta
631 alone 1785
        ld hl,fcb_filename
1786
        ld de,filenametext
1787
        push de
1788
        call cpmname_to_dotname
1789
        pop de
1790
        OS_OPENHANDLE
1791
        or a
8 dimkam 1792
        ret nz ;error
631 alone 1793
        ld a,b
1794
        ld (curhandle),a
574 alone 1795
        ld de,0x6000-17
631 alone 1796
        ld hl,-(0x6000-17)
1797
        OS_READHANDLE
1798
        call nv_closehandle
574 alone 1799
        xor a ;no error
8 dimkam 1800
        ret ;call nv_closefcb
1801
 
1802
loadandrun
1803
;hl=rest of command line
1804
;out: nz=error, e=id
1805
;load file in fcb from system current dir with parameters in tcmd, then set curpaneldir and run
1806
        ld (loadandrun_restcmd),hl
608 alone 1807
        ld hl,fcb_filename
1808
        ld de,filenametext
1809
        push de
1810
        call cpmname_to_dotname
1811
        pop de
1812
        OS_OPENHANDLE
1813
        or a
8 dimkam 1814
        ret nz ;error
608 alone 1815
        ld a,b
1816
        ld (curhandle),a
1817
        ld hl,nv_closehandle
1818
        push hl
8 dimkam 1819
        ;set current drive and dir (will be copied into new app)
1820
        call setcurpaneldir
668 alone 1821
 
8 dimkam 1822
        OS_NEWAPP
1823
        or a
1824
        ret nz ;error
574 alone 1825
;dehl= ࠭  0000,4000,8000,c000  ਫ, b=id, a=error
8 dimkam 1826
        push bc ;b=id
1827
        ld a,d
1213 alone 1828
        SETPGC000
8 dimkam 1829
        push de
1830
        push hl
1831
        ld hl,fcb_filename
574 alone 1832
        ld de,0xc000+COMMANDLINE
1833
        call cpmname_to_dotname ;de 㪠뢠  ନ
11 dimkam 1834
loadandrun_restcmd=$+1
1835
        ld hl,0
1836
         ld a,(hl)
1837
         or a
1838
         jr z,loadandrun_noparams
8 dimkam 1839
        ld a,' '
1840
        ld (de),a
1841
        inc de
11 dimkam 1842
loadandrun_noparams
8 dimkam 1843
        ld bc,COMMANDLINE_sz;-tcmd_sz
574 alone 1844
        ldir ;copy command line ;   0x0100!
8 dimkam 1845
        xor a
574 alone 1846
        ld (0xc000+COMMANDLINE+COMMANDLINE_sz-1),a
8 dimkam 1847
        pop hl
1848
        pop de
1849
 
1850
        call readfile_pages_dehl
1851
 
1852
        pop de
1853
        ld e,d ;e=id
1854
;run "cmd <commandline>"
1855
        push de
1856
        OS_RUNAPP
1857
        pop de
1858
        xor a
1859
        ret ;z
1860
 
1861
editcmd_1
1862
        call ifcmdnonempty_typedigit
650 alone 1863
editcmd_F1
1864
        ld ix,(curpanel)
1865
        ld a,(ix+PANEL.xy)
1866
        add a,10
8 dimkam 1867
        ld (windrv),a ;x
658 alone 1868
        add a,5
574 alone 1869
        ld (windrverr),a
1168 alone 1870
       ;ld hl,editcmd_reprintcurpanel;editcmd_reprintall_onlyreadcurdir
1871
       ;push hl
8 dimkam 1872
 
1873
seldrv_redraw_mainloop
1874
        ld hl,windrv
1875
;hl=window
574 alone 1876
        ld de,_COLOR_DIALOG
1877
        call nv_setcolor
1878
 
8 dimkam 1879
        call prwindow_text ;de=YX of last line
1880
seldrv_mainloop
1881
        ld de,(windrv)
1882
seldrv_cury=$+1
1883
        ld a,0
1884
        add a,d
1885
        add a,2
1886
        ld d,a
1887
        inc e
1888
        inc e
1889
        inc e
1890
        push de
574 alone 1891
        ld hl,_CURSORCOLOR
204 demige 1892
        ld b,22
574 alone 1893
        call drawfilecursor_sizeb_colorhl ;draw cursor
576 alone 1894
seldrv_mainloop_nokey
841 alone 1895
       if PRSTDIO
1896
        call yieldgetkeyloop
1897
       else
1898
        YIELDGETKEYLOOP
1899
       endif
576 alone 1900
         or a
1901
         jr z,seldrv_mainloop_nokey ;TODO handle mouse events
196 demige 1902
        ld a,c
8 dimkam 1903
        pop de
1904
        push af
574 alone 1905
        ld hl,_COLOR_DIALOG
204 demige 1906
        ld b,22
631 alone 1907
        call drawfilecursor_sizeb_colorhl ;remove cursor
8 dimkam 1908
        pop af
1909
        cp key_redraw
2350 alone 1910
        jr z,seldrv_redraw_mainloop ;TODO redraw panels (nvfast)
8 dimkam 1911
        ld hl,seldrv_cury
116 alone 1912
        cp key_enter
198 demige 1913
        jr z,seldrv_selcursor
116 alone 1914
        cp key_esc
1168 alone 1915
        jp z,editcmd_reprintall_noreaddir ;ret z
196 demige 1916
        cp 'a'
1917
        jr c,seldrv_cursor
712 alone 1918
        cp 'a'+NDRIVES;'p'
658 alone 1919
        jr c,seldrv_selletter
196 demige 1920
seldrv_cursor
8 dimkam 1921
        ld bc,seldrv_mainloop
1922
        push bc
116 alone 1923
        cp key_down
8 dimkam 1924
        jr z,seldrv_down
116 alone 1925
        cp key_up
8 dimkam 1926
        jr z,seldrv_up
1927
        ret
198 demige 1928
seldrv_selletter
1929
        sub 'a'
574 alone 1930
        jr seldrv_ok
198 demige 1931
seldrv_selcursor
574 alone 1932
        ld a,(hl)
1933
seldrv_ok
1934
        ld e,a
1935
        push de
1936
        OS_SETDRV
1937
        pop de
1938
        or a
1168 alone 1939
        jr z,seldrv_ok_ok
574 alone 1940
        ld de,_COLOR_RED
1941
        call nv_setcolor
1942
        ld hl,windrverr
1943
        call prwindow_waitkey
1944
        ld de,_COLOR
1945
        call nv_setcolor
198 demige 1946
        jp seldrv_redraw_mainloop
1168 alone 1947
seldrv_ok_ok
574 alone 1948
        ld a,e
889 alone 1949
        add a,'a'
1950
        call getcurpaneldir_hl
1951
        ;ld ix,(curpanel)
1952
        ld (hl),a
1953
        inc hl
1954
        ld (hl),':'
1955
        inc hl
1956
        ld (hl),'/'
1957
        inc hl
1958
        ld (hl),0
1168 alone 1959
        jp editcmd_reprintcurpanel ;ret
574 alone 1960
 
8 dimkam 1961
seldrv_down
1962
        ld a,(hl)
1963
        inc a
712 alone 1964
        cp NDRIVES;15
1095 alone 1965
        ;ret z
1966
         jr nz,$+3
1967
         xor a
8 dimkam 1968
        ld (hl),a
1969
        ret
1970
seldrv_up
1971
        ld a,(hl)
1972
        or a
1095 alone 1973
        ;ret z
1974
         jr nz,$+4
1975
         ld (hl),NDRIVES
8 dimkam 1976
        dec (hl)
1977
        ret
1978
 
1979
editcmd_4
1980
        call ifcmdnonempty_typedigit
650 alone 1981
editcmd_F4
8 dimkam 1982
        call getfcbundercursor ;->fcb
23 dimkam 1983
        ld a,(fcb+FCB_FATTRIB)
8 dimkam 1984
        and FATTRIB_DIR;#10
1985
        ret nz
1986
 
1987
        ld hl,editcmd_reprintall_noreaddir
1988
        push hl
1989
 
1213 alone 1990
        ld hl,texted_filename
1991
runprog_hl_withcurfile
1992
       push hl
668 alone 1993
 
1213 alone 1994
        call makeprompt_filename ;ᠬ  getfcbundercursor
8 dimkam 1995
 
1213 alone 1996
        OS_SETSYSDRV ;४ texted
712 alone 1997
 
1213 alone 1998
       pop hl;ld hl,texted_filename
8 dimkam 1999
        call copy_to_fcb_filename
668 alone 2000
 
8 dimkam 2001
        ;ld hl,cmdbuf
2002
        ;ld (hl),0
2003
        ld hl,cmdprompt
2004
;load file in fcb from system current dir with parameters in tcmd, then set curpaneldir and run
579 alone 2005
        jp loadandrun_waitpid
712 alone 2006
 
8 dimkam 2007
editcmd_9
2008
        call ifcmdnonempty_typedigit
1213 alone 2009
editcmd_menu
2010
       if PRSTDIO
2011
        ld hl,editcmd_reprintall_noreaddir
2012
        push hl
2013
 
2014
        ld hl,menu_filename
2015
        jr runprog_hl_withcurfile
2016
       else
1509 alone 2017
;  ,   ࠭! FIXME
1213 alone 2018
        ld e,1
2019
        OS_SETSCREEN
2020
        YIELDGETKEYLOOP
2021
        ld e,0
2022
        OS_SETSCREEN
1509 alone 2023
        ret
1213 alone 2024
       endif
8 dimkam 2025
 
18 dimkam 2026
editcmd_reprintall_keepcursor
2350 alone 2027
        xor a
2028
        ld (leftpanel+PANEL.drawtableunneeded),a
2029
        ld (rightpanel+PANEL.drawtableunneeded),a
18 dimkam 2030
        call readpanels_reprint_keepcursor
2031
        jp editcmd_readprompt_setendcmdx
2032
 
8 dimkam 2033
editcmd_reprintcurdir
2034
        ld hl,leftpanel+PANEL.dir
2035
        ld de,rightpanel+PANEL.dir
2036
        call strcp
2037
        jr nz,editcmd_reprintcurpanel
2038
editcmd_reprintall
2039
        call readpanels_reprint
2040
        jp editcmd_readprompt_setendcmdx
2041
editcmd_reprintcurpanel
2042
        ld ix,(curpanel)
2043
        call readdir
2044
        call sortfiles
1168 alone 2045
;editcmd_reprintcurpanel_ix_noreaddir
8 dimkam 2046
        call drawpanel_with_files
2047
        jp editcmd_readprompt_setendcmdx
2048
editcmd_reprintall_noreaddir
574 alone 2049
        ;ld e,COLOR
2050
        ;OS_CLS
28 Alone 2051
        call printhint
8 dimkam 2052
        ld ix,leftpanel
2053
        call drawpanel_with_files
2054
        ld ix,rightpanel
2055
        jp drawpanel_with_files
2056
;editcmd_reprintall_onlyreadcurdir
2057
;       ld e,COLOR
2058
;       OS_CLS
28 Alone 2059
;       call printhint
8 dimkam 2060
;       call getanotherpanel_ix
2061
;       call drawpanel_with_files
2062
;       jp editcmd_reprintcurpanel
668 alone 2063
 
8 dimkam 2064
editcmd_invfiles
2065
;ix=curpanel
2066
        ld hl,changemark_hl
2067
        call processfiles
2068
        jp drawpanel_with_files
2069
 
2070
editcmd_6 ;ren
2071
        call ifcmdnonempty_typedigit
650 alone 2072
editcmd_F6
596 alone 2073
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
8 dimkam 2074
        push hl
2075
        call setpaneldir
2076
        call getfcbundercursor
668 alone 2077
 
658 alone 2078
        if 1==1
2079
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 2080
        SETPGC000
658 alone 2081
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
2082
        ld de,filenametext
2083
        push hl
2084
        call strcopy
2085
        pop hl
2086
        ld de,tnewfilename
2087
        call strcopy
2319 kulich 2088
 
658 alone 2089
        ;ld bc,64 ;max filename size+terminator
2090
        ;ldir
2091
        else
8 dimkam 2092
        ld hl,fcb_filename
2093
        ld de,tnewfilename
2094
        push de
2095
        call cpmname_to_dotname
2096
        pop hl
2097
        ld de,filenametext
2098
        ld bc,12
2099
        ldir
658 alone 2100
        endif
2319 kulich 2101
;Kulich 20240622
2102
;  ஢  २.
2103
;        call getcurpaneldir_hl
2104
;        ld a,(hl)
2105
;        push af
2106
;       call getanotherpanel_hl
2107
;        add hl,de
2108
;        pop af
2109
;        ld b,(hl)
2110
;        cp b
2111
;        jp nz, name_error
8 dimkam 2112
 
2319 kulich 2113
        call getanotherpanel_hl
2114
        ld de,PANEL.dir
2115
        inc de;'M'
2116
        inc de;':'
2117
        add hl,de
2118
        ld de,dir2_buf
2119
        call strcopy;nv_strcopy_hltode
2120
        dec de
2121
        dec de
2122
        ld a,(de)
2123
        cp '/'
2124
        inc de
2125
        jp z, editcmd_no_slash
2126
        ld a,'/'
2127
        ld (de),a
2128
        inc de
2129
        xor a
2130
        ld(de),a
2131
editcmd_no_slash
2132
        ld hl,tnewfilename
2133
        call strcopy;nv_strcopy_hltode
2134
        ld hl,dir2_buf
2135
        ld de,tnewfilename
2136
        call strcopy;nv_strcopy_hltode
2137
        ld de,_COLOR_DIALOG
658 alone 2138
        call nv_setcolor
574 alone 2139
 
631 alone 2140
        ld hl,winrename
196 demige 2141
        ld de,tnewfilename
658 alone 2142
        ld c,63;13 ;max filename size
8 dimkam 2143
        call prwindow_edit ;CY=OK
2144
        ret nc ;cancel
2319 kulich 2145
;᫨    ᨬ :   訡
2146
 
8 dimkam 2147
        ld hl,tnewfilename
2148
editcmd_ren_checkname0
2149
        ld a,(hl)
2150
        or a
2151
        jr z,editcmd_ren_checknameq
2152
        inc hl
2153
        cp ':'
2319 kulich 2154
        jp z,name_error ;error
8 dimkam 2155
        jr editcmd_ren_checkname0
2156
editcmd_ren_checknameq
2157
        ld de,filenametext
2158
        ld hl,tnewfilename
2159
        OS_RENAME
2160
        ;todo error
2161
        ret
2319 kulich 2162
name_error
2163
        ld de,_COLOR_RED
2164
        call nv_setcolor
2165
        ld hl,ren_error1
2166
        call prwindow_waitkey
2167
        ret
8 dimkam 2168
 
2169
editcmd_7 ;mkdir
2170
        call ifcmdnonempty_typedigit
650 alone 2171
editcmd_F7
596 alone 2172
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
8 dimkam 2173
        push hl
2174
        call setpaneldir
2175
 
574 alone 2176
        ld de,_COLOR_DIALOG
2177
        call nv_setcolor
196 demige 2178
        xor a
8 dimkam 2179
        ld hl,winmkdir
196 demige 2180
        ld de,tnewfilename
2181
        ld (de),a
668 alone 2182
        ld c,63;13 ;max filename size
8 dimkam 2183
        call prwindow_edit ;CY=OK, de=filename
2184
        ret nc ;cancel
2185
        OS_MKDIR
2186
        ;TODO error
2187
        ret
2188
 
2189
editcmd_8 ;del
2190
        call ifcmdnonempty_typedigit
650 alone 2191
editcmd_F8
1536 alone 2192
         ;ld ix,(curpanel)
8 dimkam 2193
        call getmarkedfiles;countmarkedfiles
2194
        ld a,h
2195
        or l
2196
        jr nz,editcmd_8_0      
2197
        call getfcbaddrundercursor;hl=fcb
2198
        call isthisdotdir_hl
2199
        ret z ;"." or ".."
2200
        call changemark_hl ;ld (hl),1
2201
editcmd_8_0  
574 alone 2202
        ld de,_COLOR_RED
8 dimkam 2203
        call nv_setcolor
2204
        ld hl,windel
2205
        call prwindow_waitkey ;CY=OK
2206
        jp nc,editcmd_reprintall_noreaddir
596 alone 2207
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
8 dimkam 2208
        push hl
190 demige 2209
        ld hl,windel2
2210
        call prwindow_text
8 dimkam 2211
        ld hl,proc_del_file
2212
        ld ix,(curpanel)
2213
        jp processfiles
712 alone 2214
 
8 dimkam 2215
proc_del_file
658 alone 2216
        bit 0,(hl) ;marked?
8 dimkam 2217
        ret z
2218
        call getfcbfromhl
190 demige 2219
 
889 alone 2220
        call getcurpaneldir_hl ;祬- 뫮 १ ix 10.02.2020
190 demige 2221
        ld de,dir_buf
646 alone 2222
        call strcopy;nv_strcopy_hltode
190 demige 2223
 
2224
        ld hl,proc_del_file_batch
2225
        ld (nv_batch_proc),hl
2226
 
2227
proc_del_file_batch
702 alone 2228
; CHDIR, ⮬   뢠  横 ⥭ ४ਨ  nv_batch1!
2229
        ;ld de,dir_buf
2230
        ;OS_CHDIR
190 demige 2231
 
816 alone 2232
       if 1==0
2233
        ld de,filenametext ;wordbuf ;de=drive/path/file
608 alone 2234
        ld hl,fcb_filename
187 demige 2235
        call cpmname_to_dotname
816 alone 2236
       else
2237
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 2238
        SETPGC000
816 alone 2239
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
2240
        ld de,filenametext
2241
        ld bc,63*256+0
2242
        call prdirfile_copyfn
2243
       endif
190 demige 2244
 
816 alone 2245
        ld de,dir3_buf;windel2_file ;dest
2246
        push de
190 demige 2247
        ld bc,filenametext ;add
2248
        ld hl,dir_buf ;src
702 alone 2249
        call nv_makefilepath_hltode ;result :  dest=hl'/'bc (de 㪠뢠 ᫥ ନ)
816 alone 2250
        pop hl
2251
         ld de,windel2_file
2319 kulich 2252
        ;ld b,64
2253
        call strcopy_maxb64
2254
 
190 demige 2255
        ld hl,windel2
2256
        call upwindow_text ;update window
2257
 
816 alone 2258
        ld de,dir3_buf;windel2_file ;dest
702 alone 2259
        push de
2260
        ld bc,filenametext ;add
2261
        ld hl,dir_buf ;src
2262
        call nv_makefilepath_hltode ;result :  dest=hl'/'bc (de 㪠뢠 ᫥ ନ)
2263
        pop de
2264
        ;ld de,filenametext
187 demige 2265
        OS_DELETE
190 demige 2266
        or a
574 alone 2267
        ret z ;if success return
190 demige 2268
 
187 demige 2269
        ld a,(fcb_attrib)
190 demige 2270
        and FATTRIB_DIR
2271
        push af
2272
        call nz,nv_copydir_add
2273
        pop af
631 alone 2274
        jp nz,nv_copydir_add ;twice to remove empty dirs
8 dimkam 2275
        ret
2276
 
2277
editcmd_5 ;copy
2278
        call ifcmdnonempty_typedigit
650 alone 2279
editcmd_F5
8 dimkam 2280
        ;ld ix,(curpanel)
574 alone 2281
        call getmarkedfiles ;countmarkedfiles
8 dimkam 2282
        ld a,h
2283
        or l
2284
        jr nz,editcmd_5_0      
574 alone 2285
        call getfcbaddrundercursor ;hl=fcb
8 dimkam 2286
        call isthisdotdir_hl
2287
        ret z ;"." or ".."
2288
        call changemark_hl ;ld (hl),1
190 demige 2289
editcmd_5_0
196 demige 2290
 
889 alone 2291
        call getanotherpanel_hl
194 demige 2292
        ld de,PANEL.dir
889 alone 2293
        add hl,de
194 demige 2294
        ld de,dir2_buf
646 alone 2295
        call strcopy;nv_strcopy_hltode
196 demige 2296
 
889 alone 2297
        call getcurpaneldir_hl
194 demige 2298
        ld de,dir_buf
646 alone 2299
        call strcopy;nv_strcopy_hltode
196 demige 2300
 
574 alone 2301
        ld de,_COLOR_DIALOG
2302
        call nv_setcolor
816 alone 2303
         ld ix,(curpanel)
194 demige 2304
 
8 dimkam 2305
        ld hl,wincopy
196 demige 2306
        ld de,dir2_buf
2319 kulich 2307
        ld c,60 ;c=texteditsize
194 demige 2308
        call prwindow_edit ;CY=OK
8 dimkam 2309
        jp nc,editcmd_reprintall_noreaddir
73 Alone 2310
 
1410 alone 2311
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
574 alone 2312
        push hl ;don't change!
73 Alone 2313
 
8 dimkam 2314
        ld hl,0
2315
        ld (filescopied),hl
712 alone 2316
 
185 demige 2317
;        ld de,PROGRESBARWINXY
2318
;        ld bc,PROGRESBARWINHGTWID
2319
;        call prwin
2319 kulich 2320
 
2321
        ld hl,overwriteflag     ;0-skip all; 1-ask each; 2-over all; 3-⬥
2322
        ld (hl),1  
2323
 
2324
        call printwincopy2
2325
 
8 dimkam 2326
        ld hl,proceditcmd_copy
2327
        ld ix,(curpanel)
2328
        jp processfiles
2329
 
646 alone 2330
strcopy
2331
;hl->de
2332
;out: hl,de after terminator
656 alone 2333
        xor a
646 alone 2334
strcopy0
656 alone 2335
        cp (hl)
646 alone 2336
        ldi
2337
        jp nz,strcopy0
2338
        ret
190 demige 2339
 
889 alone 2340
strcopy_addslash
2341
;hl->de
646 alone 2342
        call strcopy;nv_strcopy_hltode
2343
;assumed that DE is after terminator
190 demige 2344
        dec de
646 alone 2345
        dec de
190 demige 2346
        ld a,(de)
2347
        cp '/'
2348
        jr z,nv_addslash0
2349
        inc de
2350
        ld a,'/'
2351
        ld (de),a
2352
nv_addslash0
2353
        inc de
2354
        xor a
2355
        ld (de),a
889 alone 2356
        ret
2357
 
2358
;TODO change this to strcopy_maxb
2359
nv_makefilepath_hltode ;DE=dest HL=src BC=filename
2360
        push bc
2361
        call strcopy_addslash
2362
        pop hl
646 alone 2363
        jp strcopy;nv_strcopy_hltode
190 demige 2364
 
2319 kulich 2365
strcopy_maxb64
2366
        ld b,64
849 alone 2367
strcopy_maxb
2368
;copy hl->de no more than b bytes, add spaces after
2369
strcopy_maxb0
2370
        ld a,(hl)
2371
        or a
2372
        jr z,strcopy_maxb_fill
2373
        ld (de),a
2374
        inc hl
2375
        inc de
2376
        djnz strcopy_maxb0
2377
        ret
2378
strcopy_maxb_fill
2379
        ld a,' '
2380
strcopy_maxb_fill0
2381
        ld (de),a
2382
        inc de
2383
        djnz strcopy_maxb_fill0
2384
        ret
2385
 
2319 kulich 2386
batch_find_pg
2387
        ld hl,(dir_batch_pointer)
2388
        add hl,hl
2389
        add hl,hl
2390
        ld c,h ;pointer/64
2391
        ld b,0
2392
        ld hl,tdirpgs
2393
        add hl,bc
2394
        ret
849 alone 2395
 
2319 kulich 2396
batch_find_pointer
2397
        ld hl,0x8000
2398
        ld bc,(dir_batch_pointer)
2399
        ld de,256 ;64   ࠭
2400
batch_find_pointer0
2401
        ld a,b
2402
        or c
2403
        ret z
2404
        add hl,de
2405
        dec bc
2406
        jr batch_find_pointer0
2407
 
2295 kulich 2408
nv_copydir_add;=nv_batch_pushrecord
2319 kulich 2409
;TODO ࠭ ⥪騩  䠩  ४ਨ
2295 kulich 2410
        OS_GETMAINPAGES
2411
        ld a,h
2412
        ld (savepg),a
2319 kulich 2413
 
2414
        call batch_find_pg
2415
        ld a,(dir_batch_pointer)
2416
        and 63
2417
        jr nz,nv_batch_pushrecord_nonewpg
2418
        push hl
2419
        OS_NEWPAGE
2420
        pop hl
2421
        ld (hl),e
2422
nv_batch_pushrecord_nonewpg
2423
        ld a,(hl)
2295 kulich 2424
        SETPG8000
2319 kulich 2425
        call batch_find_pointer ;hl=pointer
2295 kulich 2426
 
190 demige 2427
        push hl
2428
;dir 1
2429
        ld de,dir_buf
2430
        ex hl,de
2431
        ld bc,filenametext
2432
        call nv_makefilepath_hltode
2433
        pop hl
763 alone 2434
        ld de,128 ;128 bytes for source, 128 bytes for dest???
190 demige 2435
        add hl,de
2436
;dir2
2437
        ld de,dir2_buf
2438
        ex hl,de
2439
        ld bc,filenametext
2440
        call nv_makefilepath_hltode
2441
 
2319 kulich 2442
        ld hl,(dir_batch_pointer)
2443
        inc hl
2444
        ld (dir_batch_pointer),hl
190 demige 2445
        ld a,(savepg)
1213 alone 2446
        SETPG8000
2319 kulich 2447
        ret ;TODO jp nv_batch ;  ४ᨢ ࠡ뢠  ४ (ᮤন CHDIR!)
190 demige 2448
 
574 alone 2449
nv_batch_poprecord ;z=empty
190 demige 2450
        OS_GETMAINPAGES
2451
        ld a,h
2452
        ld (savepg),a
2319 kulich 2453
 
2454
        ld hl,(dir_batch_pointer)
2455
        ld a,h
2456
        or l
2457
        jr z,nv_batch_poprecordq ;empty :(
2458
 
2459
        ld hl,(dir_batch_pointer)
2460
        dec hl
2461
        ld (dir_batch_pointer),hl
2462
        call batch_find_pg
2463
        ld a,(hl)
2464
       push hl
2295 kulich 2465
        SETPG8000
2319 kulich 2466
        call batch_find_pointer ;hl=pointer
2467
 
190 demige 2468
        ld de,dir_buf
2469
        ld bc,128
2470
        ldir
2471
        ld de,dir2_buf
668 alone 2472
        ld  c,128
190 demige 2473
        ldir
2319 kulich 2474
 
2475
       pop hl
2476
        ld a,(dir_batch_pointer)
2477
        and 63
2478
        jr nz,nv_batch_poprecord_nodelpg
2479
        ld e,(hl)
2480
        OS_DELPAGE
2481
nv_batch_poprecord_nodelpg
2482
        ;ld a,1
2483
        ;or a ;NZ
2484
        xor a
2485
        inc a ;NZ
2486
nv_batch_poprecordq
2487
 
190 demige 2488
        ld a,(savepg)
1213 alone 2489
        SETPG8000
2319 kulich 2490
;TODO ᯮ ⥪騩  䠩  ४ਨ
190 demige 2491
        ret
2492
 
2493
nv_batch
2494
        call nv_batch_poprecord
2495
        ret z;empty
2496
nv_label
2497
        or a
2498
        ld hl,(processfiles_proc)
2499
        ld de,proceditcmd_copy
2500
        sbc hl,de
574 alone 2501
        jr nz,nv_batch_nocopydir ;if it's not copy
190 demige 2502
 
2503
        ld de,dir2_buf
2504
        OS_MKDIR
2505
        ld de,dir2_buf
2506
        OS_CHDIR ;de
2507
        or a
574 alone 2508
        jr nz,nv_batch ;can't open dest dir
190 demige 2509
nv_batch_nocopydir
2510
        ld de,dir_buf
2511
        OS_CHDIR ;;
2512
        or a
574 alone 2513
        jr nz,nv_batch ;can't open src dir
190 demige 2514
 
755 alone 2515
        ld de,emptypath
2516
        OS_OPENDIR
2517
        ;ld de,fcb
2518
        ;OS_SETDTA
2519
        ;ld de,fcbmask
2520
        ;OS_FSEARCHFIRST
190 demige 2521
        or a
2522
        jr nz,nv_batch
755 alone 2523
 
2524
        ;ld de,fcb
2525
        ;OS_SETDTA
2526
        ;ld de,fcbmask
2527
        ;OS_FSEARCHNEXT
2528
        ;or a
2529
        ;jr nz,nv_batch ;skip . and ..
878 alone 2530
        call loaddir_filinfo ;out: CY=end dir, or else Z="."
2531
        call loaddir_filinfo ;out: CY=end dir, or else Z="."
190 demige 2532
nv_batch1
755 alone 2533
        ;ld de,fcb
2534
        ;OS_SETDTA
2535
        ;ld de,fcbmask
2536
        ;OS_FSEARCHNEXT
2537
        ;or a
2538
        ;jr nz,nv_batch_nofiles
878 alone 2539
        call loaddir_filinfo ;out: CY=end dir, or else Z="."
755 alone 2540
        jr c,nv_batch_nofiles
2541
        ;jr z,nv_batch1
2542
 
2543
        ld hl,filinfo+FILINFO_LNAME
2544
        ld a,(hl)
2545
        or a
2546
        jr nz,$+5
2547
        ld hl,filinfo+FILINFO_FNAME
2548
        ld (fcb+FCB_EXTENTNUMBERHI),hl
2549
        ;ex de,hl
2550
        ;ld hl,fcb_filename
2551
        ;call dotname_to_cpmname ;de -> hl
2552
 
2553
        ld a,(filinfo+FILINFO_FATTRIB)
2554
        ld (fcb_attrib),a
2319 kulich 2555
         ld a,(leftpanel+PANEL.poipg);(dirpg) ;   ,     filinfo
2556
         ld (fcb+FCB_EXTENTNUMBERLO),a
755 alone 2557
 
190 demige 2558
nv_batch_proc=$+1
2319 kulich 2559
        call proceditcmd_copy_fcb ; ᮤন CHDIR
190 demige 2560
        jr nv_batch1
712 alone 2561
 
190 demige 2562
nv_batch_nofiles
2563
        or a
2564
        ld hl,(processfiles_proc)
2565
        ld de,proc_del_file
2566
        sbc hl,de
702 alone 2567
        jp nz,nv_batch ;if not del
190 demige 2568
        ld a,'/'
2569
        ld (dir2_buf),a
2570
        xor a
2571
        ld (dir2_buf+1),a
2572
        ld de,dir2_buf
2573
        OS_CHDIR
2574
        ld de,dir_buf
2575
        OS_DELETE
2576
        jp nv_batch
2577
 
2578
skipword_hl
2579
        ld a,(hl)
2580
        or a
2581
        ret z
2582
        cp ' '
2583
        ret z
2584
        inc hl
2585
        jr skipword_hl
2586
 
2587
proceditcmd_copy
8 dimkam 2588
        bit 0,(hl)
2589
        ret z
2590
        call getfcbfromhl
196 demige 2591
 
190 demige 2592
        ld hl,proceditcmd_copy_fcb
2593
        ld (nv_batch_proc),hl
2594
 
2595
proceditcmd_copy_fcb
702 alone 2596
; CHDIR, ⮬   뢠  横 ⥭ ४ਨ  nv_batch1!
2319 kulich 2597
 
2598
        ld hl,overwriteflag     ;0-skip all; 1-ask each; 2-over all; ⬥
2599
        ld a,(hl)
2600
        cp 3                                    ;஢ઠ   ⬥ ᥣ
2601
        ret z
2602
 
185 demige 2603
        ld hl,proceditcmd_copy_q
2604
        push hl
702 alone 2605
        ;ld de,dir_buf
2606
        ;OS_CHDIR
8 dimkam 2607
 
755 alone 2608
       if 1==0
574 alone 2609
        ld de,filenametext ;wordbuf ;de=drive/path/file
187 demige 2610
        ld hl,fcb_filename
2611
        call cpmname_to_dotname
755 alone 2612
       else
2613
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 2614
        SETPGC000
755 alone 2615
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
2616
        ld de,filenametext
2617
        ld bc,63*256+0
2618
        call prdirfile_copyfn
2619
       endif
190 demige 2620
 
2621
        ld a,(fcb_attrib)
2622
        and FATTRIB_DIR
2623
        jp nz,nv_copydir_add
2624
 
816 alone 2625
        ld de,dir3_buf;wincopy_dest
2626
        push de
190 demige 2627
        ld bc,filenametext
2628
        ld hl,dir2_buf
2629
        call nv_makefilepath_hltode
816 alone 2630
        pop hl
1877 alone 2631
         ld de,wincopy_dest
2319 kulich 2632
        ;ld b,64
2633
        call strcopy_maxb64
190 demige 2634
 
816 alone 2635
        ld de,dir3_buf;wincopy_src ;update copy window
702 alone 2636
        push de
2637
        ld bc,filenametext
2638
        ld hl,dir_buf
2639
        call nv_makefilepath_hltode
816 alone 2640
        pop hl
1877 alone 2641
         ld de,wincopy_src
2319 kulich 2642
        ;ld b,64
2643
        call strcopy_maxb64
816 alone 2644
 
2319 kulich 2645
        ;hl=string to test bc=string tester
2646
        ;out: Z if equal
2647
        ld hl,wincopy_src
2648
        ld bc,wincopy_dest
2649
        call comparestr                 ;Don't try copy file into himself
2650
        ret z
2092 kulich 2651
 
2319 kulich 2652
        ld hl,wincopy2          ; Print filename
2653
        call upwindow_text
2654
 
816 alone 2655
        ld de,dir3_buf
702 alone 2656
        push de
2319 kulich 2657
        OS_OPENHANDLE   ;Test for source file.
702 alone 2658
        pop de
8 dimkam 2659
        or a
2660
        ret nz ;jp nz,cmd_error_wrongfile
2661
        ld a,b
2662
        ld (cmd_copy_close_file1_handle),a
2663
        ld hl,cmd_copy_close_file1
2664
        push hl
2665
 
702 alone 2666
        ;ld de,filenametext
8 dimkam 2667
        OS_GETFILETIME ;ix=date, hl=time
2668
        ld (proceditcmd_copy_time),hl
2669
        ld (proceditcmd_copy_date),ix
816 alone 2670
        ld de,dir3_buf;wincopy_dest ;256 bytes
2319 kulich 2671
        push de
2672
        ld bc,filenametext
2673
        ld hl,dir2_buf
2674
        call nv_makefilepath_hltode
2675
 
2676
        pop de  
2677
        push de      
2678
        OS_OPENHANDLE
8 dimkam 2679
        or a
2319 kulich 2680
        jp  nz,notargetfile                     ;  祭  
2681
        OS_CLOSEHANDLE
2682
 
2683
        ld hl,overwriteflag
2684
        ld a,(hl)
2685
        or a                                    ;஢ઠ   skip all
2686
        jp z, pop_exit
2687
        cp 2
2688
        jp z,notargetfile                       ;஢ઠ  replace all
2689
 
2690
        ld de,_COLOR_RED
2691
        call nv_setcolor
2692
        ld hl,overwritefile
2693
        call prwindow_waitkey_any ;CY=OK;A=KEY  ; ᫨  ࠫ - all, 뢮 
2694
        push af
2695
        ld de,_COLOR_DIALOG
2696
        call nv_setcolor
2697
        call printwincopy2                      ; ⠭  ஢                              
2698
        pop af
2699
        jp c, no_exit
2700
pop_exit
2701
        pop de
2702
        ret
2703
no_exit
2704
        cp 'r'                                   ;   १襬
2705
        jp nz,proceditcmd_nextkey0
2706
 
2707
        ld hl,overwriteflag
2708
        ld (hl),2              
2709
        jp notargetfile
2710
proceditcmd_nextkey0
2711
        cp 's'                                   ;   騥 ய⨬
2712
        jp nz,proceditcmd_nextkey1
2713
 
2714
        ld hl,overwriteflag
2715
        ld (hl),0
2716
        pop de
2717
        ret
2718
 
2719
proceditcmd_nextkey1
2720
        cp 'c'                                   ;   ⬥
2721
        jp nz,proceditcmd_nextkey2
2722
 
2723
        ld hl,overwriteflag
2724
        ld (hl),3
2725
        pop de
2726
        ret
2727
 
2728
proceditcmd_nextkey2
2729
        ld hl,overwriteflag                       ;  㤥 訢  䠩
2730
        ld (hl),1
2731
 
2732
notargetfile        
2733
        ;ld de,_COLOR_DIALOG    ; moved to 2686
2734
        ;call nv_setcolor
2735
        pop de
2736
        OS_CREATEHANDLE                           ; ᮧ 䠩 ⥫
2737
        or a
8 dimkam 2738
        ret nz ;jp nz,cmd_error_cant_copy
2739
        ld a,b
2740
        ld (cmd_copy_close_file2_handle),a
2741
        ld hl,cmd_copy_close_file2
2742
        push hl
1641 alone 2743
 
2744
        ld a,(cmd_copy_close_file1_handle)
2745
        ld b,a
2746
        OS_GETFILESIZE ;dehl=file size
8 dimkam 2747
cmd_copy0
1641 alone 2748
;dehl=remaining size
2749
       push de
2750
       push hl
8 dimkam 2751
        ld hl,copybuf_sz
2752
        ld de,copybuf
2753
        ld a,(cmd_copy_close_file1_handle)
2754
        ld b,a
2755
;B = file handle, DE = Buffer address, HL = Number of bytes to read
2756
        OS_READHANDLE
2757
;HL = Number of bytes actually read, A=error
1641 alone 2758
        ld b,h
2759
        ld c,l
2319 kulich 2760
        pop hl
2761
        pop de
1641 alone 2762
        ld a,b
2763
        or c
2764
        ret z ;0 bytes remain
2765
        or a
2766
        sbc hl,bc
2767
        jr nc,$+3
2768
        dec de
2769
        push bc
2770
        push de
2319 kulich 2771
        push hl
2772
        push bc
2773
        push de
1641 alone 2774
        ld de,11*256+32
2775
        call nv_setxy
8 dimkam 2776
        pop de
1641 alone 2777
        call prdword_dehl
2778
        YIELDKEEP
2779
        ld de,copybuf
8 dimkam 2780
        ld a,(cmd_copy_close_file2_handle)
2781
        ld b,a
1641 alone 2782
        pop hl
8 dimkam 2783
;B = file handle, DE = Buffer address, HL = Number of bytes to write
2784
        OS_WRITEHANDLE
2319 kulich 2785
        pop hl
2786
        pop de
2787
        pop bc
8 dimkam 2788
        jr cmd_copy0
712 alone 2789
 
8 dimkam 2790
cmd_copy_close_file1
2791
cmd_copy_close_file1_handle=$+1
2792
        ld b,0
2793
        OS_CLOSEHANDLE
2794
        ret
668 alone 2795
 
8 dimkam 2796
cmd_copy_close_file2
2797
cmd_copy_close_file2_handle=$+1
2798
        ld b,0
2799
        OS_CLOSEHANDLE
2800
proceditcmd_copy_time=$+1
2801
        ld hl,0
2802
proceditcmd_copy_date=$+2
2803
        ld ix,0
816 alone 2804
        ld de,dir3_buf;wincopy_dest;filenametext
8 dimkam 2805
        OS_SETFILETIME
2806
        ret
668 alone 2807
 
8 dimkam 2808
proceditcmd_copy_q
2809
filescopied=$+1
2810
        ld hl,0
260 alone 2811
         if 1==0
8 dimkam 2812
        inc hl
2813
        ld (filescopied),hl
2814
        ;ld bc,32
2815
        ;ex de,hl ;ld de,(percentcopyfile)
2816
        ;call mulbcde_ahl
2817
        add hl,hl
2818
        add hl,hl
2819
        add hl,hl
2820
        add hl,hl
2821
        add hl,hl
2822
        push hl
2823
        ld ix,(curpanel)
2824
;ix = panel
1518 alone 2825
        call getmarkedfiles ;out: dehl = markedfiles
8 dimkam 2826
        ex de,hl ;de=files
2827
        pop hl ;filescopied*32
2828
        call divhlde
2829
        ld a,l
2830
        or a
2831
        ret z
2832
        ld b,a
2833
        ld de,PROGRESBARWINXY+#0102
2834
proceditcmd_copy_q_progress0      
2835
        push de
2836
        push bc
889 alone 2837
        call nv_setxy ;keeps de,hl,ix
574 alone 2838
        ;ld e,#ff
2839
        ;OS_PRATTR
2840
        ld a,'*'
889 alone 2841
        MYPRCHAR
8 dimkam 2842
        pop bc
2843
        pop de
2844
        inc e
631 alone 2845
        djnz proceditcmd_copy_q_progress0
260 alone 2846
         endif
8 dimkam 2847
        ret
667 alone 2848
 
8 dimkam 2849
mulbcde_ahl
574 alone 2850
;bc * de १  ahl
8 dimkam 2851
        xor a
2852
        ld h,a
2853
        ld l,a
2854
        dup 8
631 alone 2855
        rlc b
574 alone 2856
        jr nc,$+5 ; c -  ७, nc -  뫮 ७    
8 dimkam 2857
        add hl,de
2858
        adc a,0
2859
        add hl,hl
2860
        rla
2861
        edup
2862
        dup 7
631 alone 2863
        rlc c
574 alone 2864
        jr nc,$+5 ; c -  ७, nc -  뫮 ७    
8 dimkam 2865
        add hl,de
2866
        adc a,0
2867
        add hl,hl
2868
        rla
2869
        edup
631 alone 2870
        rlc c
8 dimkam 2871
        ret nc
2872
        add hl,de
2873
        adc a,0
2874
        ret
667 alone 2875
 
574 alone 2876
;hl / de १  hl
8 dimkam 2877
divhlde
2878
        ld c,h
2879
        ld a,l
2880
        ld hl,0
2881
        ld b,16
2882
;don't mind carry
2883
_DIV0.
2884
;shift left hlca
2885
        rla
2886
        rl c
2887
        adc hl,hl
2888
;no carry
2889
;try sub
2890
        sbc hl,de
2891
        jr nc,$+3
2892
        add hl,de
2893
;carry = inverted bit of result
631 alone 2894
        djnz _DIV0.
8 dimkam 2895
        rla
2896
        cpl
2897
        ld l,a
2898
        ld a,c
2899
        rla
2900
        cpl
2901
        ld h,a
849 alone 2902
reter
8 dimkam 2903
        ret
712 alone 2904
 
849 alone 2905
       if PRSTDIO == 0
2906
editcmd_showscr
2907
        call nv_copyscreen1to0
2908
        YIELDGETKEYLOOP
2909
        jp editcmd_reprintall_keepcursor
2910
       endif
2911
 
111 demige 2912
editcmd_0
341 alone 2913
        call ifcmdnonempty_typedigit
8 dimkam 2914
editcmd_quit
574 alone 2915
        ld de,_COLOR_RED
8 dimkam 2916
        call nv_setcolor
2917
        ld hl,winquit
2918
        call prwindow_waitkey ;CY=OK
596 alone 2919
        jp nc,editcmd_reprintall_keepcursor;editcmd_reprintall
878 alone 2920
        call makeprompt
2921
        OS_SETSYSDRV
2922
        ld de,fn_path
2923
        OS_CREATEHANDLE
2924
        push bc
2925
        call cmdcalcpromptsz ;hl=strlen
2926
        inc hl ;size
2927
        pop bc
2928
        push bc
2929
        ld de,cmdprompt
2930
        OS_WRITEHANDLE
2931
        pop bc
2932
        OS_CLOSEHANDLE
1670 alone 2933
        ld de,cmdprompt
878 alone 2934
        OS_CHDIR
1671 alone 2935
       if PRSTDIO
2936
        call clearterm
2937
       else
2938
        call nv_copyscreen1to0
2939
       endif
878 alone 2940
        ld hl,0 ;result
8 dimkam 2941
        QUIT
2942
 
2943
ifcmdnonempty_typedigit
2944
;keeps ix
2945
        ld c,a
2946
        ld a,(cmdbuf)
2947
        or a
2948
        ld a,c
2949
        ret z ;cmd is empty
2950
         pop bc ;skip return to editcmdN
2951
        jp editcmd_typein
2952
 
597 alone 2953
editcmd_typeword
2954
        call getfcbundercursor
2955
        ld hl,fcb_filename
2956
        ld de,tnewfilename
2957
        call cpmname_to_dotname ;de 㪠뢠  ନ
2958
        ld hl,cmdbuf
2959
        call strlen ;hl=length
2960
        ld bc,MAXCMDSZ-11
2961
        or a
2962
        sbc hl,bc
2963
        ret nc ;㤠 
2964
        add hl,bc
2965
        ld bc,cmdbuf
2966
        add hl,bc
2967
        ex de,hl ;de=end of cmdbuf
2968
        ld a,(cmdbuf)
2969
        or a
2970
        ld hl,tnewfilename
2971
        jr z,editcmd_typeword_empty
2972
        dec hl ; ஡
2973
editcmd_typeword_empty
646 alone 2974
        call strcopy;nv_strcopy_hltode ;out: hl,de at terminator
597 alone 2975
        ld hl,cmdbuf
2976
        call strlen ;hl=length
2977
        ld a,l
2978
        ld (curcmdx),a
2979
        ret
2980
 
2319 kulich 2981
comparestr:            
2982
;hl=string to test      bc=string tester
2983
;Z if equal
2984
                push de
2985
comparestr2            
2986
        ld a, (hl)
2987
        ld d, a
2988
        ld a, (bc)
2989
        cp d
2990
        jp nz, notequal
2991
        inc bc
2992
        inc hl
2993
        ld a, (bc)
2994
        cp 0
2995
        jp nz, comparestr2
2996
        pop de
2997
        xor a
2998
        ret
2999
notequal:
3000
        pop de
3001
        ld a,1
3002
        or a
3003
        ret
3004
printwincopy2
3005
        ld de,_COLOR_DIALOG
3006
        call nv_setcolor
3007
        ld hl,wincopy2          ; Print filename
3008
        call prwindow_text
3009
        ret
8 dimkam 3010
windrv
161 demige 3011
        dw 0x0003 ;de=yx
712 alone 3012
        dw 256*(3+NDRIVES)+28 ;0x0809 ;bc=hgt,wid
8 dimkam 3013
        db "Drive",0
3014
        db 3 ;next line
194 demige 3015
        db "  A: - 1st Floppy",0,3
3016
        db "  B: - 2nd Floppy",0,3
3017
        db "  C: - 3rd Floppy",0,3
3018
        db "  D: - 4th Floppy",0,3
198 demige 3019
        db "  E: - IDE Master p.1",0,3
3020
        db "  F: - IDE Master p.2",0,3
3021
        db "  G: - IDE Master p.3",0,3
3022
        db "  H: - IDE Master p.4",0,3
3023
        db "  I: - IDE Slave p.1",0,3
3024
        db "  J: - IDE Slave p.2",0,3
3025
        db "  K: - IDE Slave p.3",0,3
3026
        db "  L: - IDE Slave p.4",0,3
194 demige 3027
        db "  M: - SD Z-controller",0,3
198 demige 3028
        db "  N: - SD NeoGS",0,3
194 demige 3029
        db "  O: - USB flash zx-net",0,3
8 dimkam 3030
        db 0 ;end of window
667 alone 3031
 
8 dimkam 3032
winmkdir
668 alone 3033
        dw 0x0a07 ;de=yx
3034
        dw 0x0544 ;bc=hgt,wid
8 dimkam 3035
        db "Create new directory:",0
3036
        db 3 ;next line
3037
        db 2 ;print outer text
3038
        dw tnewfilename
3039
        db 0 ;end of window
3040
 
631 alone 3041
winrename
658 alone 3042
        dw 0x0a07 ;de=yx
3043
        dw 0x0544 ;bc=hgt,wid
8 dimkam 3044
        db "Rename file:",0
3045
        db 3 ;next line
3046
        db 2 ;print outer text
3047
        dw tnewfilename
3048
        db 0 ;end of window
196 demige 3049
 
194 demige 3050
wincopy
668 alone 3051
        dw 0x0a07 ;de=yx
2319 kulich 3052
        dw 0x0543 ;bc=hgt,wid
196 demige 3053
        db "Copy ",0
3054
        db 1
194 demige 3055
        db " file(s)/dir(s) to:",0
3056
        db 3 ;next line
3057
        db 2 ;print outer text
3058
        dw dir2_buf
3059
        db 0 ;end of window
667 alone 3060
 
597 alone 3061
        db ' ' ; typeword - । tnewfilename
8 dimkam 3062
tnewfilename
1509 alone 3063
        ds DIRMAXFILENAME64;64 ;max filename size+terminator
8 dimkam 3064
 
3065
winquit
40 alone 3066
        dw 0x0a1f ;de=yx
3067
        dw 0x0515 ;bc=hgt,wid
8 dimkam 3068
        db 3 ;next line
3069
        db "Quit Nedovigator?",0
3070
        db 0 ;end of window
3071
 
3072
windel
40 alone 3073
        dw 0x0919 ;de=yx
3074
        dw 0x051f ;bc=hgt,wid
8 dimkam 3075
        db 3 ;next line
3076
        db "Delete ",0
3077
        db 1 ;nfiles
3078
        db " file(s)?",0
3079
        db 0 ;end of window
3080
 
185 demige 3081
wincopy2
3082
        dw 0x0706 ;de=yx
668 alone 3083
        db 68,8 ;wid,hgt
185 demige 3084
        db 3 ;next line
190 demige 3085
        db " Copying",0,3
3086
wincopy_src
3087
        db "                                                                ",0,3
3088
        db " to",0,3
3089
wincopy_dest
3090
        db "                                                                ",0
185 demige 3091
        db 0 ;end of window
190 demige 3092
 
188 demige 3093
windel2
3094
        dw 0x0706 ;de=yx
3095
        db 68,6 ;bc=wid,hgt
190 demige 3096
        db " Deleting",0,3
188 demige 3097
        db 3 ;next line
190 demige 3098
windel2_file
3099
        db "                                                                ",0
188 demige 3100
        db 0 ;end of window
574 alone 3101
 
198 demige 3102
windrverr
3103
        dw 0x040f ;de=yx
3104
        dw 0x0510 ;bc=hgt,wid
3105
        db 3 ;next line
3106
        db "Drive error!",0
3107
        db 0 ;end of window
190 demige 3108
 
2319 kulich 3109
ren_error1
3110
        dw 0x0c0f ;de=yx
3111
        dw 0x0534 ;bc=hgt,wid
3112
        db 3 ;next line
3113
        db "file movement is only available within disk!",0
3114
        db 0 ;end of window
3115
 
3116
overwritefile
3117
        dw 0x0d15 ;de=yx
3118
        dw 0x0528 ;bc=hgt,wid
3119
        ;db 3 ;next line
3120
        db "          OVERWRITE FILE?",0,3
3121
        db "[Y]es/[No]/[S]kip all/[R]eplace All",0,3
3122
        db "             [C]ancel",0  
3123
        db 0 ;end of window
3124
 
3125
 
3126
 
8 dimkam 3127
tdotdot
3128
        dw "..",0
3129
 
3130
        STRUCT PANEL
3131
xy              WORD
631 alone 3132
catbuf          WORD ;TODO remove
109 demige 3133
poipg           BYTE
631 alone 3134
pointers        WORD ;TODO remove
646 alone 3135
pgadd           BYTE ;0/DIRPAGES
3136
curpgfcbpoi     WORD
3137
curpglnamepoi   WORD
600 alone 3138
drawtableunneeded BYTE
8 dimkam 3139
totalsize       DWORD
3140
files           WORD ;visible files
3141
filesdirs       WORD ;files+dirs (no ".", "..")
3142
markedfiles     WORD
3143
markedsize      DWORD
3144
dirpos          WORD
3145
dirscroll       WORD
3146
dirviewmode     BYTE
3147
dirsortproc     WORD
3148
dirsortmode     BYTE
55 Alone 3149
dir             BLOCK MAXPATH_sz
8 dimkam 3150
        ENDS
109 demige 3151
;PANEL_sz=13+MAXPATH_sz
8 dimkam 3152
 
3153
leftpanel PANEL
3154
rightpanel PANEL
3155
 
40 alone 3156
;<0x4000 for hobeta
8 dimkam 3157
fcb
3158
        ds FCB_sz
23 dimkam 3159
fcb_filename=fcb+FCB_FNAME        
190 demige 3160
fcb_attrib=fcb+FCB_FATTRIB
8 dimkam 3161
 
667 alone 3162
;TODO kill (used in batch)
8 dimkam 3163
fcbmask
3164
        db 0
3165
        db "???????????"
3166
        ds FCB_sz-11-1
23 dimkam 3167
fcbmask_filename=fcbmask+FCB_FNAME        
8 dimkam 3168
 
3169
fcb2
3170
        ds FCB_sz
23 dimkam 3171
fcb2_filename=fcb2+FCB_FNAME        
8 dimkam 3172
 
878 alone 3173
fn_ext
3174
        db "nv.ext",0
3175
fn_path
3176
        db "nv.pth",0
8 dimkam 3177
cmd_filename
3178
        db "cmd     com"
3179
texted_filename
3180
        db "texted  com"
1213 alone 3181
menu_filename
3182
        db "menu    com"
8 dimkam 3183
 
3184
filenametext ;for change dir, rename
1509 alone 3185
        ds DIRMAXFILENAME64;64 ;max filename size+terminator
8 dimkam 3186
 
3187
ext
574 alone 3188
        ds 3 ;TODO ꥤ  filenametext
667 alone 3189
 
574 alone 3190
copybuf=0x4000 ; 0xc000 -  - ४ਨ (  ᯮ  ஢) ;0x8000  ⮫쪮 ᫥ ⠢ ࠭ ⠬
3191
copybuf_sz=0x4000 ;$-copybuf
8 dimkam 3192
 
190 demige 3193
dir_batch_pointer db 0,0
2319 kulich 3194
savepg
3195
        db 0
3196
;dirpg db 0,0
3197
ndirpgs
3198
        db 0
3199
tdirpgs
3200
        ds 64
3201
overwriteflag
3202
        db 0
8 dimkam 3203
washobetarunner
3204
;pgsys=pagexor-10
3205
;pgfatfs=pagexor-9
3206
;pgtrdosfs=pagexor-8
574 alone 3207
;pgkillable=pagexor-4 ; 128K , ..  
8 dimkam 3208
        disp hobetarunner ;in pgkillable
3209
;$c loaded in pages 4,1,0
3210
;only ATM2 ports here!
712 alone 3211
        ;di ;뫮 
574 alone 3212
        ld a,0x7f-5
3213
        ld bc,0xbff7
3214
        out (c),a ;4,5,0
3215
        ld a,0x7f-4
712 alone 3216
        ld b,0xff;f7
574 alone 3217
        out (c),a ;4,5,4
3218
        ld hl,0xc000
3219
        ld de,0x8000
3220
        ld bc,0x4000
8 dimkam 3221
        ldir ;pg4 -> pg5
574 alone 3222
        ld a,0x7f-8;pgtrdosfs ; TOPDOWNMEM!!!
3223
        ld bc,0xfff7
3224
        out (c),a ;4,5,8
3225
        ld hl,0x1c00+0xc000
3226
        ld de,0x1c00+0x8000
3227
        ld bc,0x400
8 dimkam 3228
        ldir ;restore sysvars
574 alone 3229
        ld a,0x7f-2
3230
        ld bc,0xbff7
8 dimkam 3231
        out (c),a
574 alone 3232
        ld a,0x7f-1
712 alone 3233
        ld b,0xff;f7
8 dimkam 3234
        out (c),a
574 alone 3235
        ld hl,0xc000
3236
        ld de,0x8000
3237
        ld bc,0x4000
8 dimkam 3238
        ldir ;pg1 -> pg2
574 alone 3239
        ld a,0x7f-0+0x80
3240
        ld bc,0xfff7
8 dimkam 3241
        out (c),a
712 alone 3242
        xor a;ld a,0x00
574 alone 3243
        ld bc,0x7ffd
8 dimkam 3244
        out (c),a
574 alone 3245
        ld a,0x81 ;128 basic (with 7ffd)
3246
        ld bc,0x3ff7
8 dimkam 3247
        out (c),a
574 alone 3248
        ld a,0x7f-5
712 alone 3249
        ld b,0x7f;f7
8 dimkam 3250
        out (c),a
3251
;128: pages DOS,5,2,0(7ffd)
574 alone 3252
        ld a,0x10
3253
        ld bc,0x7ffd
8 dimkam 3254
        out (c),a
712 alone 3255
;48: pages A,4,4,4
574 alone 3256
        ld a,0x7f-5
3257
        ld bc,0x7ff7
8 dimkam 3258
        out (c),a
574 alone 3259
        ld a,0x7f-2
712 alone 3260
        ld b,0xbf;f7
8 dimkam 3261
        out (c),a
574 alone 3262
        ld a,0x7f-0+0x80
712 alone 3263
        ld b,0xff;f7
8 dimkam 3264
        out (c),a
574 alone 3265
        ld a,0x83 ;48 basic switchable to DOS
712 alone 3266
        ld b,0x3f;f7
8 dimkam 3267
        out (c),a
3268
;48: pages DOS,5,2,0(7ffd)
712 alone 3269
 
574 alone 3270
        LD A,0b10101011 ;6912
3271
        ld bc,0xff77 ;shadow ports off, palette off
8 dimkam 3272
        out (c),a
574 alone 3273
        ld sp,0x6000
712 alone 3274
        ld iy,23610
3275
        ld a,0xc9
3276
        ld (0x5cc2),a
8 dimkam 3277
        ei
3278
hobetarunner_jp=$+1
574 alone 3279
        jp 0x6000
8 dimkam 3280
        ent
3281
hobetarunner_sz=$-washobetarunner
3282
 
1410 alone 3283
       if PRSTDIO
3284
scrhgt
3285
        db 33
3286
nvviewhgt
3287
hexedhgt
3288
        db 33-1 ; ⮬ 㬥 - 
3289
filesperpanel
3290
        db 33-4
3291
       else
3292
scrhgt
3293
        db 25
3294
nvviewhgt
3295
hexedhgt
3296
        db 25-1 ; ⮬ 㬥 - 
3297
filesperpanel
3298
        db 25-4
3299
       endif
3300
 
8 dimkam 3301
wordfiles
658 alone 3302
        db "1234567890 files ";,0
8 dimkam 3303
wordbytes
658 alone 3304
        db "1234567890 bytes ",0
3305
emptypath=$-1
1317 alone 3306
        db 0 ;  ⭮ 稭 ᫥   䠩 tron.ovl.bk    ( 訩   䠩!?!?)
190 demige 3307
 
646 alone 3308
filinfo
3309
        ds FILINFO_sz
712 alone 3310
 
8 dimkam 3311
        include "nvsort.asm"
73 Alone 3312
        include "heapsort.asm"
3313
 
8 dimkam 3314
        include "nvjptbl.asm"
3315
        include "nvunit.asm"
3316
        include "nvview.asm"
3317
        include "nvhexed.asm"
650 alone 3318
        include "nvfind.asm"
8 dimkam 3319
 
1484 alone 3320
        include "../_sdk/textwindow.asm"
3321
        include "../_sdk/texteditln.asm"
3322
 
1509 alone 3323
        include "../_sdk/prdword.asm"
574 alone 3324
        include "cmdpr.asm"
841 alone 3325
       if PRSTDIO
574 alone 3326
        include "../_sdk/stdio.asm"
2319 kulich 3327
        include "nvclock.asm"   ; ᥩ  ॠ ⮫쪮  nv.com ⮬    ᫮.
3328
 
3329
yieldgetkeyloop_rtc
3330
        call printRTC           ; 塞   ᫨  ண .
3331
        ld c,CMD_YIELD
3332
        call BDOS       ;YIELD
3333
        call getkey
3334
        ret c ;error
3335
 
3336
        jr z,yieldgetkeyloop_rtc ;no event
3337
         scf
3338
         ccf ;no error
3339
        ret
841 alone 3340
       endif
658 alone 3341
 
2319 kulich 3342
       align 256
667 alone 3343
searchbuf
3344
SEARCHBUF_SZ=128 ;2 ⠪
3345
file_buf
3346
dir_buf
3347
        ds 128
3348
file_buf_end=$-1
3349
dir2_buf
3350
        ds 128        
816 alone 3351
dir3_buf
3352
        ds 256 ;max size for no bugs
667 alone 3353
 
3354
        align 256
658 alone 3355
HS_strpg
3356
        ds 256;DIRPAGES*2+2 ; 1   થ "0"
2098 kulich 3357
twinto866
3358
        incbin "../_sdk/codepage/winto866"
2319 kulich 3359
textpages
3360
        ds 256;256
8 dimkam 3361
cmd_end
3362
 
1509 alone 3363
        display "nv size ",cmd_end-cmd_begin," bytes"
2319 kulich 3364
       if PRSTDIO
3365
         display "nv.com free space ",0x4000-cmd_end
3366
        savebin "nv.com",cmd_begin,cmd_end-cmd_begin
841 alone 3367
       else
2319 kulich 3368
        display "nvfast.com free space ",0x4000-cmd_end
3369
        savebin "nvfast.com",cmd_begin,cmd_end-cmd_begin
841 alone 3370
       endif
667 alone 3371
 
1439 alone 3372
        LABELSLIST "../../us/user.l",1