?login_element?

Subversion Repositories NedoOS

Rev

Rev 2097 | Details | Compare with Previous | Last modification | View Log | RSS feed

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
2087 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
1956 alone 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
1956 alone 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
2087 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
2088 kulich 436
 
437
       if PRSTDIO
2090 kulich 438
        call printRTCnow        ;᫨  ,    
2088 kulich 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
2090 kulich 1012
        call yieldgetkeyloop_rtc        ; 筮 ७ᥭ  stdio.asm ⮡     ᮢ
841 alone 1013
       else
1014
        YIELDGETKEYLOOP
1015
       endif
2087 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
1956 alone 1147
        ld a,(hl) ;hl=fcb+FCB_EXTENTNUMBERLO
658 alone 1148
        inc hl
1149
        inc hl
1956 alone 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
1476
        call nv_copyscreen1to0
1477
        ld e,-1
1478
        OS_SETGFX ;disable gfx, give focus ;before RUNAPP!!!
841 alone 1479
       endif
755 alone 1480
        ld ix,leftpanel
1481
        call strdelpages
1482
        ld ix,rightpanel
1483
        call strdelpages
1484
        call deletepages
1196 alone 1485
;loadandrun_waitpid_looploadandrun
1486
;loadandrun_waitpid_string=$+1
1487
;       ld hl,0
1488
       pop hl ;hl=cmdbuf  cmdprompt
68 Alone 1489
         ;call setcurpaneldir
8 dimkam 1490
        call loadandrun ;nz=error, e=id
1491
        jp nz,execcmd_error
576 alone 1492
; scratch - ॠ쭮 cmd scratch  ⥪饬 ନ
11 dimkam 1493
        WAITPID
1196 alone 1494
;HL - १,  㫠  
1495
        ld a,h
1496
        or a
1497
        jr nz,loadandrun_waitpid_looploadandrunq
1498
        ld a,l
1499
        cp key_left
1500
        ld a,key_up
1501
        jr z,loadandrun_waitpid_looploadandrun
1502
        ld a,l
1503
        cp key_right
1504
        ld a,key_down
1505
        jr z,loadandrun_waitpid_looploadandrun
1506
        ld a,l
1507
        cp key_up
1508
        jr z,loadandrun_waitpid_looploadandrun
1509
        cp key_down
1510
        ;jr z,loadandrun_waitpid_looploadandrun
1511
        jr nz,loadandrun_waitpid_looploadandrunq
1512
loadandrun_waitpid_looploadandrun
1301 alone 1513
;諨  맢 ணࠬ  ५ -  ९뢠 祣
1196 alone 1514
       ld (keyfromcalledapp),a
1301 alone 1515
        call assignpages
1516
        ld ix,(curpanel)
1517
        call readdir_keepcursor
1518
        jp sortfiles
1519
 
1196 alone 1520
loadandrun_waitpid_looploadandrunq
841 alone 1521
       if PRSTDIO
668 alone 1522
        CLS_ ;scroll what was printed
841 alone 1523
       endif
560 alone 1524
execcmd_error
755 alone 1525
        call assignpages
849 alone 1526
       if PRSTDIO == 0
1527
        ld e,6 ;textmode
1528
        OS_SETGFX ;take focus (can be random after closing cmd)
1529
        call nv_copyscreen0to1
1530
        YIELDGETKEY ;key refresh
1531
       endif
851 alone 1532
        xor a
1533
        ld (cmdbuf),a
1534
        ld (curcmdscroll),a
596 alone 1535
        jp editcmd_reprintall_keepcursor
8 dimkam 1536
 
1537
editcmd_enter_run
1538
        call setpaneldir
1539
        ld hl,fcb_filename+8
1540
        ld a,(hl)
1541
        inc hl
1542
        ld c,(hl)
1543
        inc hl
1544
        ld b,(hl)
1545
        cp '$'
1546
        jp z,editcmd_enter_runfile_hobeta
574 alone 1547
        or 0x20
8 dimkam 1548
        cp 'c'
1549
        jr nz,editcmd_enter_runfile_nocom
1550
        ld a,c
574 alone 1551
        or 0x20
8 dimkam 1552
        cp 'o'
1553
        jr nz,editcmd_enter_runfile_nocom
1554
        ld a,b
574 alone 1555
        or 0x20
8 dimkam 1556
        cp 'm'
1557
        jr nz,editcmd_enter_runfile_nocom
1558
editcmd_enter_runfile_com
1559
        ld hl,cmdbuf
1560
        ld (hl),0
1561
;hl=rest of command line
579 alone 1562
        jp loadandrun_waitpid
8 dimkam 1563
 
1564
editcmd_enter_runfile_nocom
1565
        ld hl,runfile_nocomq
1566
        push hl
1567
        call makeprompt_filename
1568
 
1569
        call runfile_findhandler ;find fcb_filename ext (spoiled) in "nv.ext"
1570
        ret nz ;jp nz,execcmd_error
1108 dimkam 1571
        jp start_from_ext
1572
        ; ld de,cmdbuf
1573
        ; ld hl,fcb_filename
1574
        ; OS_PARSEFNAME ;de->hl
8 dimkam 1575
 
1213 alone 1576
        ; OS_SETSYSDRV ;४ cmd
1108 dimkam 1577
        ; ld hl,cmdprompt
1578
        ; jp loadandrun_waitpid
8 dimkam 1579
 
1580
makeprompt_filename
1581
        call setpaneldir_makeprompt ;keeps ix
1582
        call getfcbundercursor ;->fcb
1583
        ld hl,cmdprompt
1584
        xor a
631 alone 1585
        cpir
574 alone 1586
        dec hl ;hl= ନ
8 dimkam 1587
        ld a,'/'
1588
        dec hl
1589
        cp (hl)
1590
        inc hl
1591
        jr z,$+4
1592
         ld (hl),a
1593
         inc hl
574 alone 1594
        ex de,hl ;de=prompt = "d:/path/"  ନ
8 dimkam 1595
        ld hl,fcb_filename
658 alone 1596
        jp cpmname_to_dotname ;prompt = "d:/path/filename"
8 dimkam 1597
 
1598
runfile_findhandler
1599
;find fcb_filename ext (spoiled) in "nv.ext"
1600
;out: nz=error, cmdbuf=handler
1601
        ld hl,fcb_filename+8
1602
        ld de,ext
1603
        ld b,3
1604
runfile_nocom_recodeext0
1605
        ld a,(hl)
574 alone 1606
        or 0x20
8 dimkam 1607
        ld (de),a
1608
        inc hl
1609
        inc de
631 alone 1610
        djnz runfile_nocom_recodeext0
1213 alone 1611
        OS_SETSYSDRV ;४ nv
878 alone 1612
        ld de,fn_ext
1613
        ;ld hl,ext_filename
1614
        ;ld de,filenametext
1615
        ;push de
1616
        ;call cpmname_to_dotname
1617
        ;pop de
631 alone 1618
        OS_OPENHANDLE
1619
        or a
8 dimkam 1620
        ret nz ;error
631 alone 1621
        ld a,b
1622
        ld (curhandle),a
8 dimkam 1623
        ld iy,file_buf_end
1624
runfile_nocom_extloop
574 alone 1625
        call checkoneext ;c=訡, z= 訡
111 demige 1626
        jr c,runfile_nocom_readerror
8 dimkam 1627
        jr z,runfile_nocom_extok
1628
        call checkcomma
111 demige 1629
        jr c,runfile_nocom_readerror
8 dimkam 1630
        jr z,runfile_nocom_extloop
1631
        call skiptonextline
1632
        jr nz,runfile_nocom_extloop ;no EOF
111 demige 1633
runfile_nocom_readerror
631 alone 1634
        call nv_closehandle
8 dimkam 1635
        xor a
1636
        dec a
1637
        ret ;nz
1509 alone 1638
        ;display "runfile_nocom_extok ",$
8 dimkam 1639
runfile_nocom_extok
574 alone 1640
        call skiptocolon ;ன  ':'
8 dimkam 1641
        ld hl,cmdbuf
1642
        call loadtoendline
631 alone 1643
        call nv_closehandle
8 dimkam 1644
        xor a
1645
        ret ;z
712 alone 1646
 
8 dimkam 1647
runfile_nocomq
1648
        ld hl,cmdbuf
1649
        ld (hl),0
1650
        ld ix,(curpanel)
1651
setpaneldir_makeprompt
1652
        call setpaneldir ;keeps ix
1653
        jp makeprompt ;-> prompt ;keeps ix
1654
 
1655
        macro READBYTE_A
1656
;out: z=EOF
1657
        inc ly
1658
        call m,readbyte_readbuf
1659
        ld a,(iy)
1660
        endm
1661
 
1662
checkoneext
1663
        ld hl,ext
1664
        ld bc,3*256
1665
checkoneext0
1666
        READBYTE_A
1667
        ret z ;EOF
574 alone 1668
        cp 0x0a
8 dimkam 1669
        jr z,checkoneext0 ;skip LF
574 alone 1670
        or 0x20
8 dimkam 1671
        xor (hl)
1672
        inc hl
1673
        or c
1674
        ld c,a
631 alone 1675
        djnz checkoneext0
574 alone 1676
;c=訡, z= 訡
8 dimkam 1677
        ret
1678
 
1679
skiptocolon
1680
        READBYTE_A
1681
        ret z ;EOF
1682
        cp ':'
1683
        jr nz,skiptocolon
1684
        ret
1685
 
1686
checkcomma
1687
        READBYTE_A
1688
        cp ','
574 alone 1689
        ret ;TODO ஢ EOF
712 alone 1690
 
8 dimkam 1691
loadtoendline
1692
;hl=buf
1693
        READBYTE_A
1694
        jr z,loadtoendlineq
574 alone 1695
        cp 0x0d
8 dimkam 1696
        jr z,loadtoendlineq
1697
        ld (hl),a
1698
        inc hl
1699
        jr loadtoendline
1700
loadtoendlineq
1701
        ld (hl),0
1702
        ret
1703
 
1704
skiptonextline
1705
        READBYTE_A
1706
        ret z ;EOF
574 alone 1707
        cp 0x0d
8 dimkam 1708
        jr nz,skiptonextline
1709
        or a
1710
        ret ;nz
1711
 
1712
readbyte_readbuf
1713
;out: z=EOF
1714
        push bc
1715
        push de
1716
        push hl
1717
        push ix
1718
        ld de,file_buf
1719
        push de
631 alone 1720
        ld hl,128
1721
        call readcurhandle
1722
        ld a,h
1723
        or l ;z=no bytes read
8 dimkam 1724
        pop iy
1725
        pop ix
1726
        pop hl
1727
        pop de
1728
        pop bc
1729
        ret
1730
 
1731
editcmd_enter_runfile_hobeta
574 alone 1732
hobetarunner=0x4100
1733
        ld e,6 ;textmode
1734
        OS_SETGFX
712 alone 1735
 
555 alone 1736
        ld a,(user_scr0_low) ;ok
1213 alone 1737
        SETPG8000
712 alone 1738
        inc a ;ld a,#ff-0
1213 alone 1739
        SETPGC000
712 alone 1740
;0x4000 : pgcode4000 ;(pg4    ⥪!!!   ⮫쪮 ⮩ !!!)
1741
;0x8000 : pg1
1742
;0xc000 : pg0
1743
        call loadhobeta
1744
        ret nz ;error
1745
 
1746
        di
1747
        ld a,(user_scr0_low) ;ok
8 dimkam 1748
        sub 4-1 ;ld a,#ff-4 ;pgkillable
1213 alone 1749
        SETPG8000
712 alone 1750
        ld hl,0x4000
1751
        ld de,0x8000
1752
        ld bc,0x4000
1753
        ldir ;copy pgcode4000 -> pg4
1754
 
1755
        ld a,(user_scr0_low) ;ok
1213 alone 1756
        SETPG8000
712 alone 1757
        ;ld a,(user_scr0_low) ;ok
1758
        sub 4-1 ;ld a,#ff-4 ;pgkillable
1213 alone 1759
        SETPG4000
8 dimkam 1760
        ld hl,washobetarunner
1761
        ld de,hobetarunner
1762
        ld bc,hobetarunner_sz
1763
        ldir
712 alone 1764
;0x4000 : pg4 (   ⥪!!!   ⮫쪮 ⮩ !!!)
574 alone 1765
;0x8000 : pg1
1766
;0xc000 : pg0
1767
        ld hl,0x6000
1768
        ld bc,(0x6000-17+11) ;len
8 dimkam 1769
        add hl,bc
1770
        dec hl ;hl=load end
1771
        ex de,hl
574 alone 1772
        ld hl,(0x6000-17+9) ;start
8 dimkam 1773
        ld (hobetarunner_jp),hl
1774
        add hl,bc
1775
        dec hl
1776
        ex de,hl ;de=destination end
1777
        lddr
1778
        jp hobetarunner
1779
 
712 alone 1780
loadhobeta
631 alone 1781
        ld hl,fcb_filename
1782
        ld de,filenametext
1783
        push de
1784
        call cpmname_to_dotname
1785
        pop de
1786
        OS_OPENHANDLE
1787
        or a
8 dimkam 1788
        ret nz ;error
631 alone 1789
        ld a,b
1790
        ld (curhandle),a
574 alone 1791
        ld de,0x6000-17
631 alone 1792
        ld hl,-(0x6000-17)
1793
        OS_READHANDLE
1794
        call nv_closehandle
574 alone 1795
        xor a ;no error
8 dimkam 1796
        ret ;call nv_closefcb
1797
 
1798
loadandrun
1799
;hl=rest of command line
1800
;out: nz=error, e=id
1801
;load file in fcb from system current dir with parameters in tcmd, then set curpaneldir and run
1802
        ld (loadandrun_restcmd),hl
608 alone 1803
        ld hl,fcb_filename
1804
        ld de,filenametext
1805
        push de
1806
        call cpmname_to_dotname
1807
        pop de
1808
        OS_OPENHANDLE
1809
        or a
8 dimkam 1810
        ret nz ;error
608 alone 1811
        ld a,b
1812
        ld (curhandle),a
1813
        ld hl,nv_closehandle
1814
        push hl
8 dimkam 1815
        ;set current drive and dir (will be copied into new app)
1816
        call setcurpaneldir
668 alone 1817
 
8 dimkam 1818
        OS_NEWAPP
1819
        or a
1820
        ret nz ;error
574 alone 1821
;dehl= ࠭  0000,4000,8000,c000  ਫ, b=id, a=error
8 dimkam 1822
        push bc ;b=id
1823
        ld a,d
1213 alone 1824
        SETPGC000
8 dimkam 1825
        push de
1826
        push hl
1827
        ld hl,fcb_filename
574 alone 1828
        ld de,0xc000+COMMANDLINE
1829
        call cpmname_to_dotname ;de 㪠뢠  ନ
11 dimkam 1830
loadandrun_restcmd=$+1
1831
        ld hl,0
1832
         ld a,(hl)
1833
         or a
1834
         jr z,loadandrun_noparams
8 dimkam 1835
        ld a,' '
1836
        ld (de),a
1837
        inc de
11 dimkam 1838
loadandrun_noparams
8 dimkam 1839
        ld bc,COMMANDLINE_sz;-tcmd_sz
574 alone 1840
        ldir ;copy command line ;   0x0100!
8 dimkam 1841
        xor a
574 alone 1842
        ld (0xc000+COMMANDLINE+COMMANDLINE_sz-1),a
8 dimkam 1843
        pop hl
1844
        pop de
1845
 
1846
        call readfile_pages_dehl
1847
 
1848
        pop de
1849
        ld e,d ;e=id
1850
;run "cmd <commandline>"
1851
        push de
1852
        OS_RUNAPP
1853
        pop de
1854
        xor a
1855
        ret ;z
1856
 
1857
editcmd_1
1858
        call ifcmdnonempty_typedigit
650 alone 1859
editcmd_F1
1860
        ld ix,(curpanel)
1861
        ld a,(ix+PANEL.xy)
1862
        add a,10
8 dimkam 1863
        ld (windrv),a ;x
658 alone 1864
        add a,5
574 alone 1865
        ld (windrverr),a
1168 alone 1866
       ;ld hl,editcmd_reprintcurpanel;editcmd_reprintall_onlyreadcurdir
1867
       ;push hl
8 dimkam 1868
 
1869
seldrv_redraw_mainloop
1870
        ld hl,windrv
1871
;hl=window
574 alone 1872
        ld de,_COLOR_DIALOG
1873
        call nv_setcolor
1874
 
8 dimkam 1875
        call prwindow_text ;de=YX of last line
1876
seldrv_mainloop
1877
        ld de,(windrv)
1878
seldrv_cury=$+1
1879
        ld a,0
1880
        add a,d
1881
        add a,2
1882
        ld d,a
1883
        inc e
1884
        inc e
1885
        inc e
1886
        push de
574 alone 1887
        ld hl,_CURSORCOLOR
204 demige 1888
        ld b,22
574 alone 1889
        call drawfilecursor_sizeb_colorhl ;draw cursor
576 alone 1890
seldrv_mainloop_nokey
841 alone 1891
       if PRSTDIO
1892
        call yieldgetkeyloop
1893
       else
1894
        YIELDGETKEYLOOP
1895
       endif
576 alone 1896
         or a
1897
         jr z,seldrv_mainloop_nokey ;TODO handle mouse events
196 demige 1898
        ld a,c
8 dimkam 1899
        pop de
1900
        push af
574 alone 1901
        ld hl,_COLOR_DIALOG
204 demige 1902
        ld b,22
631 alone 1903
        call drawfilecursor_sizeb_colorhl ;remove cursor
8 dimkam 1904
        pop af
1905
        cp key_redraw
1906
        jr z,seldrv_redraw_mainloop
1907
        ld hl,seldrv_cury
116 alone 1908
        cp key_enter
198 demige 1909
        jr z,seldrv_selcursor
116 alone 1910
        cp key_esc
1168 alone 1911
        jp z,editcmd_reprintall_noreaddir ;ret z
196 demige 1912
        cp 'a'
1913
        jr c,seldrv_cursor
712 alone 1914
        cp 'a'+NDRIVES;'p'
658 alone 1915
        jr c,seldrv_selletter
196 demige 1916
seldrv_cursor
8 dimkam 1917
        ld bc,seldrv_mainloop
1918
        push bc
116 alone 1919
        cp key_down
8 dimkam 1920
        jr z,seldrv_down
116 alone 1921
        cp key_up
8 dimkam 1922
        jr z,seldrv_up
1923
        ret
198 demige 1924
seldrv_selletter
1925
        sub 'a'
574 alone 1926
        jr seldrv_ok
198 demige 1927
seldrv_selcursor
574 alone 1928
        ld a,(hl)
1929
seldrv_ok
1930
        ld e,a
1931
        push de
1932
        OS_SETDRV
1933
        pop de
1934
        or a
1168 alone 1935
        jr z,seldrv_ok_ok
574 alone 1936
        ld de,_COLOR_RED
1937
        call nv_setcolor
1938
        ld hl,windrverr
1939
        call prwindow_waitkey
1940
        ld de,_COLOR
1941
        call nv_setcolor
198 demige 1942
        jp seldrv_redraw_mainloop
1168 alone 1943
seldrv_ok_ok
574 alone 1944
        ld a,e
889 alone 1945
        add a,'a'
1946
        call getcurpaneldir_hl
1947
        ;ld ix,(curpanel)
1948
        ld (hl),a
1949
        inc hl
1950
        ld (hl),':'
1951
        inc hl
1952
        ld (hl),'/'
1953
        inc hl
1954
        ld (hl),0
1168 alone 1955
        jp editcmd_reprintcurpanel ;ret
574 alone 1956
 
8 dimkam 1957
seldrv_down
1958
        ld a,(hl)
1959
        inc a
712 alone 1960
        cp NDRIVES;15
1095 alone 1961
        ;ret z
1962
         jr nz,$+3
1963
         xor a
8 dimkam 1964
        ld (hl),a
1965
        ret
1966
seldrv_up
1967
        ld a,(hl)
1968
        or a
1095 alone 1969
        ;ret z
1970
         jr nz,$+4
1971
         ld (hl),NDRIVES
8 dimkam 1972
        dec (hl)
1973
        ret
1974
 
1975
editcmd_4
1976
        call ifcmdnonempty_typedigit
650 alone 1977
editcmd_F4
8 dimkam 1978
        call getfcbundercursor ;->fcb
23 dimkam 1979
        ld a,(fcb+FCB_FATTRIB)
8 dimkam 1980
        and FATTRIB_DIR;#10
1981
        ret nz
1982
 
1983
        ld hl,editcmd_reprintall_noreaddir
1984
        push hl
1985
 
1213 alone 1986
        ld hl,texted_filename
1987
runprog_hl_withcurfile
1988
       push hl
668 alone 1989
 
1213 alone 1990
        call makeprompt_filename ;ᠬ  getfcbundercursor
8 dimkam 1991
 
1213 alone 1992
        OS_SETSYSDRV ;४ texted
712 alone 1993
 
1213 alone 1994
       pop hl;ld hl,texted_filename
8 dimkam 1995
        call copy_to_fcb_filename
668 alone 1996
 
8 dimkam 1997
        ;ld hl,cmdbuf
1998
        ;ld (hl),0
1999
        ld hl,cmdprompt
2000
;load file in fcb from system current dir with parameters in tcmd, then set curpaneldir and run
579 alone 2001
        jp loadandrun_waitpid
712 alone 2002
 
8 dimkam 2003
editcmd_9
2004
        call ifcmdnonempty_typedigit
1213 alone 2005
editcmd_menu
2006
       if PRSTDIO
2007
        ld hl,editcmd_reprintall_noreaddir
2008
        push hl
2009
 
2010
        ld hl,menu_filename
2011
        jr runprog_hl_withcurfile
2012
       else
1509 alone 2013
;  ,   ࠭! FIXME
1213 alone 2014
        ld e,1
2015
        OS_SETSCREEN
2016
        YIELDGETKEYLOOP
2017
        ld e,0
2018
        OS_SETSCREEN
1509 alone 2019
        ret
1213 alone 2020
       endif
8 dimkam 2021
 
18 dimkam 2022
editcmd_reprintall_keepcursor
2023
        call readpanels_reprint_keepcursor
2024
        jp editcmd_readprompt_setendcmdx
2025
 
8 dimkam 2026
editcmd_reprintcurdir
2027
        ld hl,leftpanel+PANEL.dir
2028
        ld de,rightpanel+PANEL.dir
2029
        call strcp
2030
        jr nz,editcmd_reprintcurpanel
2031
editcmd_reprintall
2032
        call readpanels_reprint
2033
        jp editcmd_readprompt_setendcmdx
2034
editcmd_reprintcurpanel
2035
        ld ix,(curpanel)
2036
        call readdir
2037
        call sortfiles
1168 alone 2038
;editcmd_reprintcurpanel_ix_noreaddir
8 dimkam 2039
        call drawpanel_with_files
2040
        jp editcmd_readprompt_setendcmdx
2041
editcmd_reprintall_noreaddir
574 alone 2042
        ;ld e,COLOR
2043
        ;OS_CLS
28 Alone 2044
        call printhint
8 dimkam 2045
        ld ix,leftpanel
2046
        call drawpanel_with_files
2047
        ld ix,rightpanel
2048
        jp drawpanel_with_files
2049
;editcmd_reprintall_onlyreadcurdir
2050
;       ld e,COLOR
2051
;       OS_CLS
28 Alone 2052
;       call printhint
8 dimkam 2053
;       call getanotherpanel_ix
2054
;       call drawpanel_with_files
2055
;       jp editcmd_reprintcurpanel
668 alone 2056
 
8 dimkam 2057
editcmd_invfiles
2058
;ix=curpanel
2059
        ld hl,changemark_hl
2060
        call processfiles
2061
        jp drawpanel_with_files
2062
 
2063
editcmd_6 ;ren
2064
        call ifcmdnonempty_typedigit
650 alone 2065
editcmd_F6
596 alone 2066
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
8 dimkam 2067
        push hl
2068
        call setpaneldir
2069
        call getfcbundercursor
668 alone 2070
 
658 alone 2071
        if 1==1
2072
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 2073
        SETPGC000
658 alone 2074
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
2075
        ld de,filenametext
2076
        push hl
2077
        call strcopy
2078
        pop hl
2079
        ld de,tnewfilename
2080
        call strcopy
2087 kulich 2081
 
658 alone 2082
        ;ld bc,64 ;max filename size+terminator
2083
        ;ldir
2084
        else
8 dimkam 2085
        ld hl,fcb_filename
2086
        ld de,tnewfilename
2087
        push de
2088
        call cpmname_to_dotname
2089
        pop hl
2090
        ld de,filenametext
2091
        ld bc,12
2092
        ldir
658 alone 2093
        endif
2087 kulich 2094
;Kulich 20240622
2095
;  ஢  २.
2096
;        call getcurpaneldir_hl
2097
;        ld a,(hl)
2098
;        push af
2099
;       call getanotherpanel_hl
2100
;        add hl,de
2101
;        pop af
2102
;        ld b,(hl)
2103
;        cp b
2104
;        jp nz, name_error
8 dimkam 2105
 
2087 kulich 2106
        call getanotherpanel_hl
2107
        ld de,PANEL.dir
2108
        inc de;'M'
2109
        inc de;':'
2110
        add hl,de
2111
        ld de,dir2_buf
2112
        call strcopy;nv_strcopy_hltode
2113
        dec de
2114
        dec de
2115
        ld a,(de)
2116
        cp '/'
2117
        inc de
2118
        jp z, editcmd_no_slash
2119
        ld a,'/'
2120
        ld (de),a
2121
        inc de
2122
        xor a
2123
        ld(de),a
2124
editcmd_no_slash
2125
        ld hl,tnewfilename
2126
        call strcopy;nv_strcopy_hltode
2127
        ld hl,dir2_buf
2128
        ld de,tnewfilename
2129
        call strcopy;nv_strcopy_hltode
2130
        ld de,_COLOR_DIALOG
658 alone 2131
        call nv_setcolor
574 alone 2132
 
631 alone 2133
        ld hl,winrename
196 demige 2134
        ld de,tnewfilename
658 alone 2135
        ld c,63;13 ;max filename size
8 dimkam 2136
        call prwindow_edit ;CY=OK
2137
        ret nc ;cancel
2087 kulich 2138
;᫨    ᨬ :   訡
2139
 
8 dimkam 2140
        ld hl,tnewfilename
2141
editcmd_ren_checkname0
2142
        ld a,(hl)
2143
        or a
2144
        jr z,editcmd_ren_checknameq
2145
        inc hl
2146
        cp ':'
2087 kulich 2147
        jp z,name_error ;error
8 dimkam 2148
        jr editcmd_ren_checkname0
2149
editcmd_ren_checknameq
2150
        ld de,filenametext
2151
        ld hl,tnewfilename
2152
        OS_RENAME
2153
        ;todo error
2154
        ret
2087 kulich 2155
name_error
2156
        ld de,_COLOR_RED
2157
        call nv_setcolor
2158
        ld hl,ren_error1
2159
        call prwindow_waitkey
2160
        ret
8 dimkam 2161
 
2162
editcmd_7 ;mkdir
2163
        call ifcmdnonempty_typedigit
650 alone 2164
editcmd_F7
596 alone 2165
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
8 dimkam 2166
        push hl
2167
        call setpaneldir
2168
 
574 alone 2169
        ld de,_COLOR_DIALOG
2170
        call nv_setcolor
196 demige 2171
        xor a
8 dimkam 2172
        ld hl,winmkdir
196 demige 2173
        ld de,tnewfilename
2174
        ld (de),a
668 alone 2175
        ld c,63;13 ;max filename size
8 dimkam 2176
        call prwindow_edit ;CY=OK, de=filename
2177
        ret nc ;cancel
2178
        OS_MKDIR
2179
        ;TODO error
2180
        ret
2181
 
2182
editcmd_8 ;del
2183
        call ifcmdnonempty_typedigit
650 alone 2184
editcmd_F8
1536 alone 2185
         ;ld ix,(curpanel)
8 dimkam 2186
        call getmarkedfiles;countmarkedfiles
2187
        ld a,h
2188
        or l
2189
        jr nz,editcmd_8_0      
2190
        call getfcbaddrundercursor;hl=fcb
2191
        call isthisdotdir_hl
2192
        ret z ;"." or ".."
2193
        call changemark_hl ;ld (hl),1
2194
editcmd_8_0  
574 alone 2195
        ld de,_COLOR_RED
8 dimkam 2196
        call nv_setcolor
2197
        ld hl,windel
2198
        call prwindow_waitkey ;CY=OK
2199
        jp nc,editcmd_reprintall_noreaddir
596 alone 2200
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
8 dimkam 2201
        push hl
190 demige 2202
        ld hl,windel2
2203
        call prwindow_text
8 dimkam 2204
        ld hl,proc_del_file
2205
        ld ix,(curpanel)
2206
        jp processfiles
712 alone 2207
 
8 dimkam 2208
proc_del_file
658 alone 2209
        bit 0,(hl) ;marked?
8 dimkam 2210
        ret z
2211
        call getfcbfromhl
190 demige 2212
 
889 alone 2213
        call getcurpaneldir_hl ;祬- 뫮 १ ix 10.02.2020
190 demige 2214
        ld de,dir_buf
646 alone 2215
        call strcopy;nv_strcopy_hltode
190 demige 2216
 
2217
        ld hl,proc_del_file_batch
2218
        ld (nv_batch_proc),hl
2219
 
2220
proc_del_file_batch
702 alone 2221
; CHDIR, ⮬   뢠  横 ⥭ ४ਨ  nv_batch1!
2222
        ;ld de,dir_buf
2223
        ;OS_CHDIR
190 demige 2224
 
816 alone 2225
       if 1==0
2226
        ld de,filenametext ;wordbuf ;de=drive/path/file
608 alone 2227
        ld hl,fcb_filename
187 demige 2228
        call cpmname_to_dotname
816 alone 2229
       else
2230
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 2231
        SETPGC000
816 alone 2232
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
2233
        ld de,filenametext
2234
        ld bc,63*256+0
2235
        call prdirfile_copyfn
2236
       endif
190 demige 2237
 
816 alone 2238
        ld de,dir3_buf;windel2_file ;dest
2239
        push de
190 demige 2240
        ld bc,filenametext ;add
2241
        ld hl,dir_buf ;src
702 alone 2242
        call nv_makefilepath_hltode ;result :  dest=hl'/'bc (de 㪠뢠 ᫥ ନ)
816 alone 2243
        pop hl
2244
         ld de,windel2_file
1956 alone 2245
        ;ld b,64
2246
        call strcopy_maxb64
2247
 
190 demige 2248
        ld hl,windel2
2249
        call upwindow_text ;update window
2250
 
816 alone 2251
        ld de,dir3_buf;windel2_file ;dest
702 alone 2252
        push de
2253
        ld bc,filenametext ;add
2254
        ld hl,dir_buf ;src
2255
        call nv_makefilepath_hltode ;result :  dest=hl'/'bc (de 㪠뢠 ᫥ ନ)
2256
        pop de
2257
        ;ld de,filenametext
187 demige 2258
        OS_DELETE
190 demige 2259
        or a
574 alone 2260
        ret z ;if success return
190 demige 2261
 
187 demige 2262
        ld a,(fcb_attrib)
190 demige 2263
        and FATTRIB_DIR
2264
        push af
2265
        call nz,nv_copydir_add
2266
        pop af
631 alone 2267
        jp nz,nv_copydir_add ;twice to remove empty dirs
8 dimkam 2268
        ret
2269
 
2270
editcmd_5 ;copy
2271
        call ifcmdnonempty_typedigit
650 alone 2272
editcmd_F5
8 dimkam 2273
        ;ld ix,(curpanel)
574 alone 2274
        call getmarkedfiles ;countmarkedfiles
8 dimkam 2275
        ld a,h
2276
        or l
2277
        jr nz,editcmd_5_0      
574 alone 2278
        call getfcbaddrundercursor ;hl=fcb
8 dimkam 2279
        call isthisdotdir_hl
2280
        ret z ;"." or ".."
2281
        call changemark_hl ;ld (hl),1
190 demige 2282
editcmd_5_0
196 demige 2283
 
889 alone 2284
        call getanotherpanel_hl
194 demige 2285
        ld de,PANEL.dir
889 alone 2286
        add hl,de
194 demige 2287
        ld de,dir2_buf
646 alone 2288
        call strcopy;nv_strcopy_hltode
196 demige 2289
 
889 alone 2290
        call getcurpaneldir_hl
194 demige 2291
        ld de,dir_buf
646 alone 2292
        call strcopy;nv_strcopy_hltode
196 demige 2293
 
574 alone 2294
        ld de,_COLOR_DIALOG
2295
        call nv_setcolor
816 alone 2296
         ld ix,(curpanel)
194 demige 2297
 
8 dimkam 2298
        ld hl,wincopy
196 demige 2299
        ld de,dir2_buf
2095 kulich 2300
        ld c,60 ;c=texteditsize
194 demige 2301
        call prwindow_edit ;CY=OK
8 dimkam 2302
        jp nc,editcmd_reprintall_noreaddir
73 Alone 2303
 
1410 alone 2304
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
574 alone 2305
        push hl ;don't change!
73 Alone 2306
 
8 dimkam 2307
        ld hl,0
2308
        ld (filescopied),hl
712 alone 2309
 
185 demige 2310
;        ld de,PROGRESBARWINXY
2311
;        ld bc,PROGRESBARWINHGTWID
2312
;        call prwin
2098 kulich 2313
 
2314
        ld hl,overwriteflag     ;0-skip all; 1-ask each; 2-over all; 3-⬥
2095 kulich 2315
        ld (hl),1  
2098 kulich 2316
 
2095 kulich 2317
        call printwincopy2
2318
 
8 dimkam 2319
        ld hl,proceditcmd_copy
2320
        ld ix,(curpanel)
2321
        jp processfiles
2322
 
646 alone 2323
strcopy
2324
;hl->de
2325
;out: hl,de after terminator
656 alone 2326
        xor a
646 alone 2327
strcopy0
656 alone 2328
        cp (hl)
646 alone 2329
        ldi
2330
        jp nz,strcopy0
2331
        ret
190 demige 2332
 
889 alone 2333
strcopy_addslash
2334
;hl->de
646 alone 2335
        call strcopy;nv_strcopy_hltode
2336
;assumed that DE is after terminator
190 demige 2337
        dec de
646 alone 2338
        dec de
190 demige 2339
        ld a,(de)
2340
        cp '/'
2341
        jr z,nv_addslash0
2342
        inc de
2343
        ld a,'/'
2344
        ld (de),a
2345
nv_addslash0
2346
        inc de
2347
        xor a
2348
        ld (de),a
889 alone 2349
        ret
2350
 
2351
;TODO change this to strcopy_maxb
2352
nv_makefilepath_hltode ;DE=dest HL=src BC=filename
2353
        push bc
2354
        call strcopy_addslash
2355
        pop hl
646 alone 2356
        jp strcopy;nv_strcopy_hltode
190 demige 2357
 
1956 alone 2358
strcopy_maxb64
2359
        ld b,64
849 alone 2360
strcopy_maxb
2361
;copy hl->de no more than b bytes, add spaces after
2362
strcopy_maxb0
2363
        ld a,(hl)
2364
        or a
2365
        jr z,strcopy_maxb_fill
2366
        ld (de),a
2367
        inc hl
2368
        inc de
2369
        djnz strcopy_maxb0
2370
        ret
2371
strcopy_maxb_fill
2372
        ld a,' '
2373
strcopy_maxb_fill0
2374
        ld (de),a
2375
        inc de
2376
        djnz strcopy_maxb_fill0
2377
        ret
2378
 
1956 alone 2379
batch_find_pg
2380
        ld hl,(dir_batch_pointer)
2381
        add hl,hl
2382
        add hl,hl
2383
        ld c,h ;pointer/64
2384
        ld b,0
2385
        ld hl,tdirpgs
2386
        add hl,bc
2387
        ret
849 alone 2388
 
1956 alone 2389
batch_find_pointer
2390
        ld hl,0x8000
2391
        ld bc,(dir_batch_pointer)
2392
        ld de,256 ;64   ࠭
2393
batch_find_pointer0
2394
        ld a,b
2395
        or c
2396
        ret z
2397
        add hl,de
2398
        dec bc
2399
        jr batch_find_pointer0
2400
 
816 alone 2401
nv_copydir_add;=nv_batch_pushrecord
1956 alone 2402
;TODO ࠭ ⥪騩  䠩  ४ਨ
190 demige 2403
        OS_GETMAINPAGES
2404
        ld a,h
2405
        ld (savepg),a
1956 alone 2406
 
2407
        call batch_find_pg
2408
        ld a,(dir_batch_pointer)
2409
        and 63
2410
        jr nz,nv_batch_pushrecord_nonewpg
2411
        push hl
2412
        OS_NEWPAGE
2413
        pop hl
2414
        ld (hl),e
2415
nv_batch_pushrecord_nonewpg
2416
        ld a,(hl)
1213 alone 2417
        SETPG8000
1956 alone 2418
        call batch_find_pointer ;hl=pointer
190 demige 2419
 
2420
        push hl
2421
;dir 1
2422
        ld de,dir_buf
2423
        ex hl,de
2424
        ld bc,filenametext
2425
        call nv_makefilepath_hltode
2426
        pop hl
763 alone 2427
        ld de,128 ;128 bytes for source, 128 bytes for dest???
190 demige 2428
        add hl,de
2429
;dir2
2430
        ld de,dir2_buf
2431
        ex hl,de
2432
        ld bc,filenametext
2433
        call nv_makefilepath_hltode
2434
 
1956 alone 2435
        ld hl,(dir_batch_pointer)
2436
        inc hl
2437
        ld (dir_batch_pointer),hl
190 demige 2438
        ld a,(savepg)
1213 alone 2439
        SETPG8000
1956 alone 2440
        ret ;TODO jp nv_batch ;  ४ᨢ ࠡ뢠  ४ (ᮤন CHDIR!)
190 demige 2441
 
574 alone 2442
nv_batch_poprecord ;z=empty
190 demige 2443
        OS_GETMAINPAGES
2444
        ld a,h
2445
        ld (savepg),a
1956 alone 2446
 
2447
        ld hl,(dir_batch_pointer)
2448
        ld a,h
2449
        or l
2450
        jr z,nv_batch_poprecordq ;empty :(
2451
 
2452
        ld hl,(dir_batch_pointer)
2453
        dec hl
2454
        ld (dir_batch_pointer),hl
2455
        call batch_find_pg
2456
        ld a,(hl)
2457
       push hl
1213 alone 2458
        SETPG8000
1956 alone 2459
        call batch_find_pointer ;hl=pointer
2460
 
190 demige 2461
        ld de,dir_buf
2462
        ld bc,128
2463
        ldir
2464
        ld de,dir2_buf
668 alone 2465
        ld  c,128
190 demige 2466
        ldir
1956 alone 2467
 
2468
       pop hl
2469
        ld a,(dir_batch_pointer)
2470
        and 63
2471
        jr nz,nv_batch_poprecord_nodelpg
2472
        ld e,(hl)
2473
        OS_DELPAGE
2474
nv_batch_poprecord_nodelpg
2475
        ;ld a,1
2476
        ;or a ;NZ
2477
        xor a
2478
        inc a ;NZ
2479
nv_batch_poprecordq
2480
 
190 demige 2481
        ld a,(savepg)
1213 alone 2482
        SETPG8000
1956 alone 2483
;TODO ᯮ ⥪騩  䠩  ४ਨ
190 demige 2484
        ret
2485
 
2486
nv_batch
2487
        call nv_batch_poprecord
2488
        ret z;empty
2489
nv_label
2490
        or a
2491
        ld hl,(processfiles_proc)
2492
        ld de,proceditcmd_copy
2493
        sbc hl,de
574 alone 2494
        jr nz,nv_batch_nocopydir ;if it's not copy
190 demige 2495
 
2496
        ld de,dir2_buf
2497
        OS_MKDIR
2498
        ld de,dir2_buf
2499
        OS_CHDIR ;de
2500
        or a
574 alone 2501
        jr nz,nv_batch ;can't open dest dir
190 demige 2502
nv_batch_nocopydir
2503
        ld de,dir_buf
2504
        OS_CHDIR ;;
2505
        or a
574 alone 2506
        jr nz,nv_batch ;can't open src dir
190 demige 2507
 
755 alone 2508
        ld de,emptypath
2509
        OS_OPENDIR
2510
        ;ld de,fcb
2511
        ;OS_SETDTA
2512
        ;ld de,fcbmask
2513
        ;OS_FSEARCHFIRST
190 demige 2514
        or a
2515
        jr nz,nv_batch
755 alone 2516
 
2517
        ;ld de,fcb
2518
        ;OS_SETDTA
2519
        ;ld de,fcbmask
2520
        ;OS_FSEARCHNEXT
2521
        ;or a
2522
        ;jr nz,nv_batch ;skip . and ..
878 alone 2523
        call loaddir_filinfo ;out: CY=end dir, or else Z="."
2524
        call loaddir_filinfo ;out: CY=end dir, or else Z="."
190 demige 2525
nv_batch1
755 alone 2526
        ;ld de,fcb
2527
        ;OS_SETDTA
2528
        ;ld de,fcbmask
2529
        ;OS_FSEARCHNEXT
2530
        ;or a
2531
        ;jr nz,nv_batch_nofiles
878 alone 2532
        call loaddir_filinfo ;out: CY=end dir, or else Z="."
755 alone 2533
        jr c,nv_batch_nofiles
2534
        ;jr z,nv_batch1
2535
 
2536
        ld hl,filinfo+FILINFO_LNAME
2537
        ld a,(hl)
2538
        or a
2539
        jr nz,$+5
2540
        ld hl,filinfo+FILINFO_FNAME
2541
        ld (fcb+FCB_EXTENTNUMBERHI),hl
2542
        ;ex de,hl
2543
        ;ld hl,fcb_filename
2544
        ;call dotname_to_cpmname ;de -> hl
2545
 
2546
        ld a,(filinfo+FILINFO_FATTRIB)
2547
        ld (fcb_attrib),a
1956 alone 2548
         ld a,(leftpanel+PANEL.poipg);(dirpg) ;   ,     filinfo
2549
         ld (fcb+FCB_EXTENTNUMBERLO),a
755 alone 2550
 
190 demige 2551
nv_batch_proc=$+1
1956 alone 2552
        call proceditcmd_copy_fcb ; ᮤন CHDIR
190 demige 2553
        jr nv_batch1
712 alone 2554
 
190 demige 2555
nv_batch_nofiles
2556
        or a
2557
        ld hl,(processfiles_proc)
2558
        ld de,proc_del_file
2559
        sbc hl,de
702 alone 2560
        jp nz,nv_batch ;if not del
190 demige 2561
        ld a,'/'
2562
        ld (dir2_buf),a
2563
        xor a
2564
        ld (dir2_buf+1),a
2565
        ld de,dir2_buf
2566
        OS_CHDIR
2567
        ld de,dir_buf
2568
        OS_DELETE
2569
        jp nv_batch
2570
 
2571
skipword_hl
2572
        ld a,(hl)
2573
        or a
2574
        ret z
2575
        cp ' '
2576
        ret z
2577
        inc hl
2578
        jr skipword_hl
2579
 
2580
proceditcmd_copy
8 dimkam 2581
        bit 0,(hl)
2582
        ret z
2583
        call getfcbfromhl
196 demige 2584
 
190 demige 2585
        ld hl,proceditcmd_copy_fcb
2586
        ld (nv_batch_proc),hl
2587
 
2588
proceditcmd_copy_fcb
702 alone 2589
; CHDIR, ⮬   뢠  横 ⥭ ४ਨ  nv_batch1!
2098 kulich 2590
 
2591
        ld hl,overwriteflag     ;0-skip all; 1-ask each; 2-over all; ⬥
2592
        ld a,(hl)
2593
        cp 3                                    ;஢ઠ   ⬥ ᥣ
2594
        ret z
2595
 
185 demige 2596
        ld hl,proceditcmd_copy_q
2597
        push hl
702 alone 2598
        ;ld de,dir_buf
2599
        ;OS_CHDIR
8 dimkam 2600
 
755 alone 2601
       if 1==0
574 alone 2602
        ld de,filenametext ;wordbuf ;de=drive/path/file
187 demige 2603
        ld hl,fcb_filename
2604
        call cpmname_to_dotname
755 alone 2605
       else
2606
        ld a,(fcb+FCB_EXTENTNUMBERLO)
1213 alone 2607
        SETPGC000
755 alone 2608
        ld hl,(fcb+FCB_EXTENTNUMBERHI)
2609
        ld de,filenametext
2610
        ld bc,63*256+0
2611
        call prdirfile_copyfn
2612
       endif
190 demige 2613
 
2614
        ld a,(fcb_attrib)
2615
        and FATTRIB_DIR
2616
        jp nz,nv_copydir_add
2617
 
816 alone 2618
        ld de,dir3_buf;wincopy_dest
2619
        push de
190 demige 2620
        ld bc,filenametext
2621
        ld hl,dir2_buf
2622
        call nv_makefilepath_hltode
816 alone 2623
        pop hl
1877 alone 2624
         ld de,wincopy_dest
1956 alone 2625
        ;ld b,64
2626
        call strcopy_maxb64
190 demige 2627
 
816 alone 2628
        ld de,dir3_buf;wincopy_src ;update copy window
702 alone 2629
        push de
2630
        ld bc,filenametext
2631
        ld hl,dir_buf
2632
        call nv_makefilepath_hltode
816 alone 2633
        pop hl
1877 alone 2634
         ld de,wincopy_src
1956 alone 2635
        ;ld b,64
2636
        call strcopy_maxb64
816 alone 2637
 
2092 kulich 2638
        ;hl=string to test bc=string tester
2639
        ;out: Z if equal
2640
        ld hl,wincopy_src
2641
        ld bc,wincopy_dest
2095 kulich 2642
        call comparestr                 ;Don't try copy file into himself
2643
        ret z
2092 kulich 2644
 
2095 kulich 2645
        ld hl,wincopy2          ; Print filename
2646
        call upwindow_text
1641 alone 2647
 
816 alone 2648
        ld de,dir3_buf
702 alone 2649
        push de
2095 kulich 2650
        OS_OPENHANDLE   ;Test for source file.
702 alone 2651
        pop de
8 dimkam 2652
        or a
2653
        ret nz ;jp nz,cmd_error_wrongfile
2654
        ld a,b
2655
        ld (cmd_copy_close_file1_handle),a
2656
        ld hl,cmd_copy_close_file1
2657
        push hl
2658
 
702 alone 2659
        ;ld de,filenametext
8 dimkam 2660
        OS_GETFILETIME ;ix=date, hl=time
2661
        ld (proceditcmd_copy_time),hl
2662
        ld (proceditcmd_copy_date),ix
816 alone 2663
        ld de,dir3_buf;wincopy_dest ;256 bytes
2095 kulich 2664
        push de
2665
        ld bc,filenametext
2666
        ld hl,dir2_buf
2667
        call nv_makefilepath_hltode
2668
 
2669
        pop de  
2670
        push de      
2671
        OS_OPENHANDLE
8 dimkam 2672
        or a
2095 kulich 2673
        jp  nz,notargetfile                     ;  祭  
2674
        OS_CLOSEHANDLE
2675
 
2676
        ld hl,overwriteflag
2677
        ld a,(hl)
2678
        or a                                    ;஢ઠ   skip all
2679
        jp z, pop_exit
2680
        cp 2
2681
        jp z,notargetfile                       ;஢ઠ  replace all
2682
 
2683
        ld de,_COLOR_RED
2684
        call nv_setcolor
2685
        ld hl,overwritefile
2686
        call prwindow_waitkey_any ;CY=OK;A=KEY  ; ᫨  ࠫ - all, 뢮 
2687
        push af
2688
        ld de,_COLOR_DIALOG
2689
        call nv_setcolor
2690
        call printwincopy2                      ; ⠭  ஢                              
2691
        pop af
2692
        jp c, no_exit
2693
pop_exit
2694
        pop de
2695
        ret
2696
no_exit
2697
        cp 'r'                                   ;   १襬
2698
        jp nz,proceditcmd_nextkey0
2699
 
2700
        ld hl,overwriteflag
2701
        ld (hl),2              
2098 kulich 2702
        jp notargetfile
2095 kulich 2703
proceditcmd_nextkey0
2098 kulich 2704
        cp 's'                                   ;   騥 ய⨬
2095 kulich 2705
        jp nz,proceditcmd_nextkey1
2706
 
2707
        ld hl,overwriteflag
2708
        ld (hl),0
2709
        pop de
2710
        ret
2098 kulich 2711
 
2095 kulich 2712
proceditcmd_nextkey1
2098 kulich 2713
        cp 'c'                                   ;   ⬥
2714
        jp nz,proceditcmd_nextkey2
2715
 
2716
        ld hl,overwriteflag
2717
        ld (hl),3
2718
        pop de
2719
        ret
2720
 
2721
proceditcmd_nextkey2
2095 kulich 2722
        ld hl,overwriteflag                       ;  㤥 訢  䠩
2723
        ld (hl),1
2724
 
2725
notargetfile        
2726
        ;ld de,_COLOR_DIALOG    ; moved to 2686
2727
        ;call nv_setcolor
2728
        pop de
2729
        OS_CREATEHANDLE                           ; ᮧ 䠩 ⥫
2730
        or a
8 dimkam 2731
        ret nz ;jp nz,cmd_error_cant_copy
2732
        ld a,b
2733
        ld (cmd_copy_close_file2_handle),a
2734
        ld hl,cmd_copy_close_file2
2735
        push hl
1641 alone 2736
 
2737
        ld a,(cmd_copy_close_file1_handle)
2738
        ld b,a
2739
        OS_GETFILESIZE ;dehl=file size
8 dimkam 2740
cmd_copy0
1641 alone 2741
;dehl=remaining size
2742
       push de
2743
       push hl
8 dimkam 2744
        ld hl,copybuf_sz
2745
        ld de,copybuf
2746
        ld a,(cmd_copy_close_file1_handle)
2747
        ld b,a
2748
;B = file handle, DE = Buffer address, HL = Number of bytes to read
2749
        OS_READHANDLE
2750
;HL = Number of bytes actually read, A=error
1641 alone 2751
        ld b,h
2752
        ld c,l
2095 kulich 2753
        pop hl
2754
        pop de
1641 alone 2755
        ld a,b
2756
        or c
2757
        ret z ;0 bytes remain
2758
        or a
2759
        sbc hl,bc
2760
        jr nc,$+3
2761
        dec de
2762
        push bc
2763
        push de
2095 kulich 2764
        push hl
2765
        push bc
2766
        push de
1641 alone 2767
        ld de,11*256+32
2768
        call nv_setxy
8 dimkam 2769
        pop de
1641 alone 2770
        call prdword_dehl
2771
        YIELDKEEP
2772
        ld de,copybuf
8 dimkam 2773
        ld a,(cmd_copy_close_file2_handle)
2774
        ld b,a
1641 alone 2775
        pop hl
8 dimkam 2776
;B = file handle, DE = Buffer address, HL = Number of bytes to write
2777
        OS_WRITEHANDLE
2095 kulich 2778
        pop hl
2779
        pop de
2780
        pop bc
8 dimkam 2781
        jr cmd_copy0
712 alone 2782
 
8 dimkam 2783
cmd_copy_close_file1
2784
cmd_copy_close_file1_handle=$+1
2785
        ld b,0
2786
        OS_CLOSEHANDLE
2787
        ret
668 alone 2788
 
8 dimkam 2789
cmd_copy_close_file2
2790
cmd_copy_close_file2_handle=$+1
2791
        ld b,0
2792
        OS_CLOSEHANDLE
2793
proceditcmd_copy_time=$+1
2794
        ld hl,0
2795
proceditcmd_copy_date=$+2
2796
        ld ix,0
816 alone 2797
        ld de,dir3_buf;wincopy_dest;filenametext
8 dimkam 2798
        OS_SETFILETIME
2799
        ret
668 alone 2800
 
8 dimkam 2801
proceditcmd_copy_q
2802
filescopied=$+1
2803
        ld hl,0
260 alone 2804
         if 1==0
8 dimkam 2805
        inc hl
2806
        ld (filescopied),hl
2807
        ;ld bc,32
2808
        ;ex de,hl ;ld de,(percentcopyfile)
2809
        ;call mulbcde_ahl
2810
        add hl,hl
2811
        add hl,hl
2812
        add hl,hl
2813
        add hl,hl
2814
        add hl,hl
2815
        push hl
2816
        ld ix,(curpanel)
2817
;ix = panel
1518 alone 2818
        call getmarkedfiles ;out: dehl = markedfiles
8 dimkam 2819
        ex de,hl ;de=files
2820
        pop hl ;filescopied*32
2821
        call divhlde
2822
        ld a,l
2823
        or a
2824
        ret z
2825
        ld b,a
2826
        ld de,PROGRESBARWINXY+#0102
2827
proceditcmd_copy_q_progress0      
2828
        push de
2829
        push bc
889 alone 2830
        call nv_setxy ;keeps de,hl,ix
574 alone 2831
        ;ld e,#ff
2832
        ;OS_PRATTR
2833
        ld a,'*'
889 alone 2834
        MYPRCHAR
8 dimkam 2835
        pop bc
2836
        pop de
2837
        inc e
631 alone 2838
        djnz proceditcmd_copy_q_progress0
260 alone 2839
         endif
8 dimkam 2840
        ret
667 alone 2841
 
8 dimkam 2842
mulbcde_ahl
574 alone 2843
;bc * de १  ahl
8 dimkam 2844
        xor a
2845
        ld h,a
2846
        ld l,a
2847
        dup 8
631 alone 2848
        rlc b
574 alone 2849
        jr nc,$+5 ; c -  ७, nc -  뫮 ७    
8 dimkam 2850
        add hl,de
2851
        adc a,0
2852
        add hl,hl
2853
        rla
2854
        edup
2855
        dup 7
631 alone 2856
        rlc c
574 alone 2857
        jr nc,$+5 ; c -  ७, nc -  뫮 ७    
8 dimkam 2858
        add hl,de
2859
        adc a,0
2860
        add hl,hl
2861
        rla
2862
        edup
631 alone 2863
        rlc c
8 dimkam 2864
        ret nc
2865
        add hl,de
2866
        adc a,0
2867
        ret
667 alone 2868
 
574 alone 2869
;hl / de १  hl
8 dimkam 2870
divhlde
2871
        ld c,h
2872
        ld a,l
2873
        ld hl,0
2874
        ld b,16
2875
;don't mind carry
2876
_DIV0.
2877
;shift left hlca
2878
        rla
2879
        rl c
2880
        adc hl,hl
2881
;no carry
2882
;try sub
2883
        sbc hl,de
2884
        jr nc,$+3
2885
        add hl,de
2886
;carry = inverted bit of result
631 alone 2887
        djnz _DIV0.
8 dimkam 2888
        rla
2889
        cpl
2890
        ld l,a
2891
        ld a,c
2892
        rla
2893
        cpl
2894
        ld h,a
849 alone 2895
reter
8 dimkam 2896
        ret
712 alone 2897
 
849 alone 2898
       if PRSTDIO == 0
2899
editcmd_showscr
2900
        call nv_copyscreen1to0
2901
        YIELDGETKEYLOOP
2902
        xor a
2903
        ld (leftpanel+PANEL.drawtableunneeded),a
2904
        ld (rightpanel+PANEL.drawtableunneeded),a
2905
        jp editcmd_reprintall_keepcursor
2906
       endif
2907
 
111 demige 2908
editcmd_0
341 alone 2909
        call ifcmdnonempty_typedigit
8 dimkam 2910
editcmd_quit
574 alone 2911
        ld de,_COLOR_RED
8 dimkam 2912
        call nv_setcolor
2913
        ld hl,winquit
2914
        call prwindow_waitkey ;CY=OK
596 alone 2915
        jp nc,editcmd_reprintall_keepcursor;editcmd_reprintall
878 alone 2916
        call makeprompt
2917
        OS_SETSYSDRV
2918
        ld de,fn_path
2919
        OS_CREATEHANDLE
2920
        push bc
2921
        call cmdcalcpromptsz ;hl=strlen
2922
        inc hl ;size
2923
        pop bc
2924
        push bc
2925
        ld de,cmdprompt
2926
        OS_WRITEHANDLE
2927
        pop bc
2928
        OS_CLOSEHANDLE
1670 alone 2929
        ld de,cmdprompt
878 alone 2930
        OS_CHDIR
1671 alone 2931
       if PRSTDIO
2932
        call clearterm
2933
       else
2934
        call nv_copyscreen1to0
2935
       endif
878 alone 2936
        ld hl,0 ;result
8 dimkam 2937
        QUIT
2938
 
2939
ifcmdnonempty_typedigit
2940
;keeps ix
2941
        ld c,a
2942
        ld a,(cmdbuf)
2943
        or a
2944
        ld a,c
2945
        ret z ;cmd is empty
2946
         pop bc ;skip return to editcmdN
2947
        jp editcmd_typein
2948
 
597 alone 2949
editcmd_typeword
2950
        call getfcbundercursor
2951
        ld hl,fcb_filename
2952
        ld de,tnewfilename
2953
        call cpmname_to_dotname ;de 㪠뢠  ନ
2954
        ld hl,cmdbuf
2955
        call strlen ;hl=length
2956
        ld bc,MAXCMDSZ-11
2957
        or a
2958
        sbc hl,bc
2959
        ret nc ;㤠 
2960
        add hl,bc
2961
        ld bc,cmdbuf
2962
        add hl,bc
2963
        ex de,hl ;de=end of cmdbuf
2964
        ld a,(cmdbuf)
2965
        or a
2966
        ld hl,tnewfilename
2967
        jr z,editcmd_typeword_empty
2968
        dec hl ; ஡
2969
editcmd_typeword_empty
646 alone 2970
        call strcopy;nv_strcopy_hltode ;out: hl,de at terminator
597 alone 2971
        ld hl,cmdbuf
2972
        call strlen ;hl=length
2973
        ld a,l
2974
        ld (curcmdx),a
2975
        ret
2976
 
2092 kulich 2977
comparestr:            
2978
;hl=string to test      bc=string tester
2979
;Z if equal
2980
                push de
2981
comparestr2            
2095 kulich 2982
        ld a, (hl)
2983
        ld d, a
2984
        ld a, (bc)
2985
        cp d
2986
        jp nz, notequal
2987
        inc bc
2988
        inc hl
2989
        ld a, (bc)
2990
        cp 0
2991
        jp nz, comparestr2
2992
        pop de
2993
        xor a
2994
        ret
2092 kulich 2995
notequal:
2095 kulich 2996
        pop de
2997
        ld a,1
2998
        or a
2999
        ret
3000
printwincopy2
3001
        ld de,_COLOR_DIALOG
3002
        call nv_setcolor
3003
        ld hl,wincopy2          ; Print filename
3004
        call prwindow_text
3005
        ret
8 dimkam 3006
windrv
161 demige 3007
        dw 0x0003 ;de=yx
712 alone 3008
        dw 256*(3+NDRIVES)+28 ;0x0809 ;bc=hgt,wid
8 dimkam 3009
        db "Drive",0
3010
        db 3 ;next line
194 demige 3011
        db "  A: - 1st Floppy",0,3
3012
        db "  B: - 2nd Floppy",0,3
3013
        db "  C: - 3rd Floppy",0,3
3014
        db "  D: - 4th Floppy",0,3
198 demige 3015
        db "  E: - IDE Master p.1",0,3
3016
        db "  F: - IDE Master p.2",0,3
3017
        db "  G: - IDE Master p.3",0,3
3018
        db "  H: - IDE Master p.4",0,3
3019
        db "  I: - IDE Slave p.1",0,3
3020
        db "  J: - IDE Slave p.2",0,3
3021
        db "  K: - IDE Slave p.3",0,3
3022
        db "  L: - IDE Slave p.4",0,3
194 demige 3023
        db "  M: - SD Z-controller",0,3
198 demige 3024
        db "  N: - SD NeoGS",0,3
194 demige 3025
        db "  O: - USB flash zx-net",0,3
8 dimkam 3026
        db 0 ;end of window
667 alone 3027
 
8 dimkam 3028
winmkdir
668 alone 3029
        dw 0x0a07 ;de=yx
3030
        dw 0x0544 ;bc=hgt,wid
8 dimkam 3031
        db "Create new directory:",0
3032
        db 3 ;next line
3033
        db 2 ;print outer text
3034
        dw tnewfilename
3035
        db 0 ;end of window
3036
 
631 alone 3037
winrename
658 alone 3038
        dw 0x0a07 ;de=yx
3039
        dw 0x0544 ;bc=hgt,wid
8 dimkam 3040
        db "Rename file:",0
3041
        db 3 ;next line
3042
        db 2 ;print outer text
3043
        dw tnewfilename
3044
        db 0 ;end of window
196 demige 3045
 
194 demige 3046
wincopy
668 alone 3047
        dw 0x0a07 ;de=yx
2095 kulich 3048
        dw 0x0543 ;bc=hgt,wid
196 demige 3049
        db "Copy ",0
3050
        db 1
194 demige 3051
        db " file(s)/dir(s) to:",0
3052
        db 3 ;next line
3053
        db 2 ;print outer text
3054
        dw dir2_buf
3055
        db 0 ;end of window
667 alone 3056
 
597 alone 3057
        db ' ' ; typeword - । tnewfilename
8 dimkam 3058
tnewfilename
1509 alone 3059
        ds DIRMAXFILENAME64;64 ;max filename size+terminator
8 dimkam 3060
 
3061
winquit
40 alone 3062
        dw 0x0a1f ;de=yx
3063
        dw 0x0515 ;bc=hgt,wid
8 dimkam 3064
        db 3 ;next line
3065
        db "Quit Nedovigator?",0
3066
        db 0 ;end of window
3067
 
3068
windel
40 alone 3069
        dw 0x0919 ;de=yx
3070
        dw 0x051f ;bc=hgt,wid
8 dimkam 3071
        db 3 ;next line
3072
        db "Delete ",0
3073
        db 1 ;nfiles
3074
        db " file(s)?",0
3075
        db 0 ;end of window
3076
 
185 demige 3077
wincopy2
3078
        dw 0x0706 ;de=yx
668 alone 3079
        db 68,8 ;wid,hgt
185 demige 3080
        db 3 ;next line
190 demige 3081
        db " Copying",0,3
3082
wincopy_src
3083
        db "                                                                ",0,3
3084
        db " to",0,3
3085
wincopy_dest
3086
        db "                                                                ",0
185 demige 3087
        db 0 ;end of window
190 demige 3088
 
188 demige 3089
windel2
3090
        dw 0x0706 ;de=yx
3091
        db 68,6 ;bc=wid,hgt
190 demige 3092
        db " Deleting",0,3
188 demige 3093
        db 3 ;next line
190 demige 3094
windel2_file
3095
        db "                                                                ",0
188 demige 3096
        db 0 ;end of window
574 alone 3097
 
198 demige 3098
windrverr
3099
        dw 0x040f ;de=yx
3100
        dw 0x0510 ;bc=hgt,wid
3101
        db 3 ;next line
3102
        db "Drive error!",0
3103
        db 0 ;end of window
190 demige 3104
 
2087 kulich 3105
ren_error1
3106
        dw 0x0c0f ;de=yx
3107
        dw 0x0534 ;bc=hgt,wid
3108
        db 3 ;next line
3109
        db "file movement is only available within disk!",0
3110
        db 0 ;end of window
3111
 
2095 kulich 3112
overwritefile
3113
        dw 0x0d15 ;de=yx
2098 kulich 3114
        dw 0x0528 ;bc=hgt,wid
3115
        ;db 3 ;next line
2095 kulich 3116
        db "          OVERWRITE FILE?",0,3
2098 kulich 3117
        db "[Y]es/[No]/[S]kip all/[R]eplace All",0,3
3118
        db "             [C]ancel",0  
2095 kulich 3119
        db 0 ;end of window
3120
 
3121
 
3122
 
8 dimkam 3123
tdotdot
3124
        dw "..",0
3125
 
3126
        STRUCT PANEL
3127
xy              WORD
631 alone 3128
catbuf          WORD ;TODO remove
109 demige 3129
poipg           BYTE
631 alone 3130
pointers        WORD ;TODO remove
646 alone 3131
pgadd           BYTE ;0/DIRPAGES
3132
curpgfcbpoi     WORD
3133
curpglnamepoi   WORD
600 alone 3134
drawtableunneeded BYTE
8 dimkam 3135
totalsize       DWORD
3136
files           WORD ;visible files
3137
filesdirs       WORD ;files+dirs (no ".", "..")
3138
markedfiles     WORD
3139
markedsize      DWORD
3140
dirpos          WORD
3141
dirscroll       WORD
3142
dirviewmode     BYTE
3143
dirsortproc     WORD
3144
dirsortmode     BYTE
55 Alone 3145
dir             BLOCK MAXPATH_sz
8 dimkam 3146
        ENDS
109 demige 3147
;PANEL_sz=13+MAXPATH_sz
8 dimkam 3148
 
3149
leftpanel PANEL
3150
rightpanel PANEL
3151
 
40 alone 3152
;<0x4000 for hobeta
8 dimkam 3153
fcb
3154
        ds FCB_sz
23 dimkam 3155
fcb_filename=fcb+FCB_FNAME        
190 demige 3156
fcb_attrib=fcb+FCB_FATTRIB
8 dimkam 3157
 
667 alone 3158
;TODO kill (used in batch)
8 dimkam 3159
fcbmask
3160
        db 0
3161
        db "???????????"
3162
        ds FCB_sz-11-1
23 dimkam 3163
fcbmask_filename=fcbmask+FCB_FNAME        
8 dimkam 3164
 
3165
fcb2
3166
        ds FCB_sz
23 dimkam 3167
fcb2_filename=fcb2+FCB_FNAME        
8 dimkam 3168
 
878 alone 3169
fn_ext
3170
        db "nv.ext",0
3171
fn_path
3172
        db "nv.pth",0
8 dimkam 3173
cmd_filename
3174
        db "cmd     com"
3175
texted_filename
3176
        db "texted  com"
1213 alone 3177
menu_filename
3178
        db "menu    com"
8 dimkam 3179
 
3180
filenametext ;for change dir, rename
1509 alone 3181
        ds DIRMAXFILENAME64;64 ;max filename size+terminator
8 dimkam 3182
 
3183
ext
574 alone 3184
        ds 3 ;TODO ꥤ  filenametext
667 alone 3185
 
574 alone 3186
copybuf=0x4000 ; 0xc000 -  - ४ਨ (  ᯮ  ஢) ;0x8000  ⮫쪮 ᫥ ⠢ ࠭ ⠬
3187
copybuf_sz=0x4000 ;$-copybuf
8 dimkam 3188
 
190 demige 3189
dir_batch_pointer db 0,0
1956 alone 3190
savepg
3191
        db 0
3192
;dirpg db 0,0
3193
ndirpgs
3194
        db 0
3195
tdirpgs
3196
        ds 64
2095 kulich 3197
overwriteflag
3198
        db 0
8 dimkam 3199
washobetarunner
3200
;pgsys=pagexor-10
3201
;pgfatfs=pagexor-9
3202
;pgtrdosfs=pagexor-8
574 alone 3203
;pgkillable=pagexor-4 ; 128K , ..  
8 dimkam 3204
        disp hobetarunner ;in pgkillable
3205
;$c loaded in pages 4,1,0
3206
;only ATM2 ports here!
712 alone 3207
        ;di ;뫮 
574 alone 3208
        ld a,0x7f-5
3209
        ld bc,0xbff7
3210
        out (c),a ;4,5,0
3211
        ld a,0x7f-4
712 alone 3212
        ld b,0xff;f7
574 alone 3213
        out (c),a ;4,5,4
3214
        ld hl,0xc000
3215
        ld de,0x8000
3216
        ld bc,0x4000
8 dimkam 3217
        ldir ;pg4 -> pg5
574 alone 3218
        ld a,0x7f-8;pgtrdosfs ; TOPDOWNMEM!!!
3219
        ld bc,0xfff7
3220
        out (c),a ;4,5,8
3221
        ld hl,0x1c00+0xc000
3222
        ld de,0x1c00+0x8000
3223
        ld bc,0x400
8 dimkam 3224
        ldir ;restore sysvars
574 alone 3225
        ld a,0x7f-2
3226
        ld bc,0xbff7
8 dimkam 3227
        out (c),a
574 alone 3228
        ld a,0x7f-1
712 alone 3229
        ld b,0xff;f7
8 dimkam 3230
        out (c),a
574 alone 3231
        ld hl,0xc000
3232
        ld de,0x8000
3233
        ld bc,0x4000
8 dimkam 3234
        ldir ;pg1 -> pg2
574 alone 3235
        ld a,0x7f-0+0x80
3236
        ld bc,0xfff7
8 dimkam 3237
        out (c),a
712 alone 3238
        xor a;ld a,0x00
574 alone 3239
        ld bc,0x7ffd
8 dimkam 3240
        out (c),a
574 alone 3241
        ld a,0x81 ;128 basic (with 7ffd)
3242
        ld bc,0x3ff7
8 dimkam 3243
        out (c),a
574 alone 3244
        ld a,0x7f-5
712 alone 3245
        ld b,0x7f;f7
8 dimkam 3246
        out (c),a
3247
;128: pages DOS,5,2,0(7ffd)
574 alone 3248
        ld a,0x10
3249
        ld bc,0x7ffd
8 dimkam 3250
        out (c),a
712 alone 3251
;48: pages A,4,4,4
574 alone 3252
        ld a,0x7f-5
3253
        ld bc,0x7ff7
8 dimkam 3254
        out (c),a
574 alone 3255
        ld a,0x7f-2
712 alone 3256
        ld b,0xbf;f7
8 dimkam 3257
        out (c),a
574 alone 3258
        ld a,0x7f-0+0x80
712 alone 3259
        ld b,0xff;f7
8 dimkam 3260
        out (c),a
574 alone 3261
        ld a,0x83 ;48 basic switchable to DOS
712 alone 3262
        ld b,0x3f;f7
8 dimkam 3263
        out (c),a
3264
;48: pages DOS,5,2,0(7ffd)
712 alone 3265
 
574 alone 3266
        LD A,0b10101011 ;6912
3267
        ld bc,0xff77 ;shadow ports off, palette off
8 dimkam 3268
        out (c),a
574 alone 3269
        ld sp,0x6000
712 alone 3270
        ld iy,23610
3271
        ld a,0xc9
3272
        ld (0x5cc2),a
8 dimkam 3273
        ei
3274
hobetarunner_jp=$+1
574 alone 3275
        jp 0x6000
8 dimkam 3276
        ent
3277
hobetarunner_sz=$-washobetarunner
3278
 
1410 alone 3279
       if PRSTDIO
3280
scrhgt
3281
        db 33
3282
nvviewhgt
3283
hexedhgt
3284
        db 33-1 ; ⮬ 㬥 - 
3285
filesperpanel
3286
        db 33-4
3287
       else
3288
scrhgt
3289
        db 25
3290
nvviewhgt
3291
hexedhgt
3292
        db 25-1 ; ⮬ 㬥 - 
3293
filesperpanel
3294
        db 25-4
3295
       endif
3296
 
8 dimkam 3297
wordfiles
658 alone 3298
        db "1234567890 files ";,0
8 dimkam 3299
wordbytes
658 alone 3300
        db "1234567890 bytes ",0
3301
emptypath=$-1
1317 alone 3302
        db 0 ;  ⭮ 稭 ᫥   䠩 tron.ovl.bk    ( 訩   䠩!?!?)
190 demige 3303
 
646 alone 3304
filinfo
3305
        ds FILINFO_sz
712 alone 3306
 
8 dimkam 3307
        include "nvsort.asm"
73 Alone 3308
        include "heapsort.asm"
3309
 
8 dimkam 3310
        include "nvjptbl.asm"
3311
        include "nvunit.asm"
3312
        include "nvview.asm"
3313
        include "nvhexed.asm"
650 alone 3314
        include "nvfind.asm"
8 dimkam 3315
 
1484 alone 3316
        include "../_sdk/textwindow.asm"
3317
        include "../_sdk/texteditln.asm"
3318
 
1509 alone 3319
        include "../_sdk/prdword.asm"
574 alone 3320
        include "cmdpr.asm"
841 alone 3321
       if PRSTDIO
574 alone 3322
        include "../_sdk/stdio.asm"
2095 kulich 3323
        include "nvclock.asm"   ; ᥩ  ॠ ⮫쪮  nv.com ⮬    ᫮.
2090 kulich 3324
 
2087 kulich 3325
yieldgetkeyloop_rtc
2090 kulich 3326
        call printRTC           ; 塞   ᫨  ண .
2087 kulich 3327
        ld c,CMD_YIELD
3328
        call BDOS       ;YIELD
3329
        call getkey
3330
        ret c ;error
3331
 
3332
        jr z,yieldgetkeyloop_rtc ;no event
3333
         scf
3334
         ccf ;no error
3335
        ret
841 alone 3336
       endif
658 alone 3337
 
2095 kulich 3338
       align 256
667 alone 3339
searchbuf
3340
SEARCHBUF_SZ=128 ;2 ⠪
3341
file_buf
3342
dir_buf
3343
        ds 128
3344
file_buf_end=$-1
3345
dir2_buf
3346
        ds 128        
816 alone 3347
dir3_buf
3348
        ds 256 ;max size for no bugs
667 alone 3349
 
3350
        align 256
658 alone 3351
HS_strpg
3352
        ds 256;DIRPAGES*2+2 ; 1   થ "0"
2098 kulich 3353
twinto866
3354
        incbin "../_sdk/codepage/winto866"
658 alone 3355
textpages
2095 kulich 3356
        ds 164;256
8 dimkam 3357
cmd_end
3358
 
1509 alone 3359
        display "nv size ",cmd_end-cmd_begin," bytes"
2087 kulich 3360
       if PRSTDIO
2095 kulich 3361
         display "nv.com free space ",0x4000-cmd_end
3362
        savebin "nv.com",cmd_begin,cmd_end-cmd_begin
841 alone 3363
       else
2095 kulich 3364
        display "nvfast.com free space ",0x4000-cmd_end
3365
        savebin "nvfast.com",cmd_begin,cmd_end-cmd_begin
841 alone 3366
       endif
667 alone 3367
 
1439 alone 3368
        LABELSLIST "../../us/user.l",1