Subversion Repositories NedoOS

Rev

Rev 2295 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 2295 Rev 2319
Line 211... Line 211...
211
        call editcmd_readprompt_setendcmdx
211
        call editcmd_readprompt_setendcmdx
212
        call controlloop
212
        call controlloop
213
        jp mainloop
213
        jp mainloop
214
 
214
 
215
assignpages
215
assignpages
216
        OS_NEWPAGE ; for dircopy batch
216
        ;OS_NEWPAGE ; for dircopy batch
217
        ld hl,dirpg
217
        ;ld hl,dirpg
218
        ld (hl),e
218
        ;ld (hl),e
219
 
219
 
220
        OS_NEWPAGE ;выделяем по одной страничке для каталогов
220
        OS_NEWPAGE ;выделяем по одной страничке для каталогов
221
        ld hl,HS_strpg
221
        ld hl,HS_strpg
222
        ld (hl),e
222
        ld (hl),e
223
        inc hl
223
        inc hl
Line 255... Line 255...
255
        ld a,e
255
        ld a,e
256
        SETPG4000 ;copybuf
256
        SETPG4000 ;copybuf
257
        ret
257
        ret
258
 
258
 
259
deletepages
259
deletepages
260
        ld a,(dirpg)
260
        ;ld a,(dirpg)
261
        call delpage_a ;for dircopy batch
261
        ;call delpage_a ;for dircopy batch
262
        ld a,(HS_strpg)
262
        ld a,(HS_strpg)
263
        call delpage_a ;по одной страничке для каталогов
263
        call delpage_a ;по одной страничке для каталогов
264
        ld a,(HS_strpg+DIRPAGES+1)
264
        ld a,(HS_strpg+DIRPAGES+1)
265
        call delpage_a ;по одной страничке для длинных имён
265
        call delpage_a ;по одной страничке для длинных имён
266
        ld a,(HS_strpg+FIRSTDIRPAGEFORRIGHTPANEL)
266
        ld a,(HS_strpg+FIRSTDIRPAGEFORRIGHTPANEL)
Line 431... Line 431...
431
        ret c
431
        ret c
432
        ret z
432
        ret z
433
        ld de,tdoublehoriz
433
        ld de,tdoublehoriz
434
        push ix
434
        push ix
435
        call sendchars
435
        call sendchars
-
 
436
 
-
 
437
       if PRSTDIO
-
 
438
        call printRTCnow        ;Если обновили панель, то обновим и часы
-
 
439
       endif
-
 
440
 
436
        pop ix
441
        pop ix
437
        ret
442
        ret
438
 
443
 
439
drawpanel_with_files
444
drawpanel_with_files
440
;ix=panel
445
;ix=panel
Line 448... Line 453...
448
        ld de,_COLOR
453
        ld de,_COLOR
449
        call nv_setcolor
454
        call nv_setcolor
450
 
455
 
451
        call drawpanel_head
456
        call drawpanel_head
452
        call drawpanelfilesandsize
457
        call drawpanelfilesandsize
453
 
-
 
454
drawpanel_files
458
drawpanel_files
455
;ix=panel
459
;ix=panel
456
        call setpanelcolor
460
        call setpanelcolor
457
        ld l,(ix+PANEL.files)
461
        ld l,(ix+PANEL.files)
458
        ld h,(ix+PANEL.files+1)
462
        ld h,(ix+PANEL.files+1)
Line 988... Line 992...
988
        jr nz,$+3
992
        jr nz,$+3
989
        xor a
993
        xor a
990
        ld (keyfromcalledapp),a
994
        ld (keyfromcalledapp),a
991
        jr controlloop_nokeyq
995
        jr controlloop_nokeyq
992
controlloop_nokey
996
controlloop_nokey
993
       
-
 
994
        ld ix,(curpanel)
997
        ld ix,(curpanel)
995
        ld a,(ix+PANEL.files)
998
        ld a,(ix+PANEL.files)
996
        or (ix+PANEL.files+1)
999
        or (ix+PANEL.files+1)
997
       push af
1000
       push af
998
        call z,nv_setdirpos_zero ;can't move cursor if 0 files
1001
        call z,nv_setdirpos_zero ;can't move cursor if 0 files
Line 1004... Line 1007...
1004
        call cmdcalccurxy
1007
        call cmdcalccurxy
1005
        call nv_setxy ;keeps de,hl,ix
1008
        call nv_setxy ;keeps de,hl,ix
1006
        ;SETX_ ;force reprint cursor
1009
        ;SETX_ ;force reprint cursor
1007
 
1010
 
1008
       if PRSTDIO
1011
       if PRSTDIO
1009
        call yieldgetkeyloop
1012
        call yieldgetkeyloop_rtc        ; Частично перенесена из stdio.asm чтобы вклинить в нее обновление часов
1010
       else
1013
       else
1011
        YIELDGETKEYLOOP
1014
        YIELDGETKEYLOOP
1012
       endif
1015
       endif
-
 
1016
 
1013
         or a
1017
         or a
1014
         jr z,controlloop_nokey ;TODO handle mouse events
1018
         jr z,controlloop_nokey ;TODO handle mouse events
1015
        push af
1019
        push af
1016
;controlloop_nokeyq
1020
;controlloop_nokeyq
1017
        ld ix,(curpanel)
1021
        ld ix,(curpanel)
Line 1029... Line 1033...
1029
        ;OS_PRATTR ;remove cursor
1033
        ;OS_PRATTR ;remove cursor
1030
         ld de,_COLOR
1034
         ld de,_COLOR
1031
         call nv_setcolor ;even if we didn't reprint command line, draw windows with its color
1035
         call nv_setcolor ;even if we didn't reprint command line, draw windows with its color
1032
controlloop_nokeyq
1036
controlloop_nokeyq
1033
        pop af
1037
        pop af
1034
 
-
 
1035
        ld hl,tnvcmds
1038
        ld hl,tnvcmds
1036
        ld bc,nnvcmds
1039
        ld bc,nnvcmds
1037
        cpir
1040
        cpir
1038
        jp nz,editcmd_keyfail
1041
        jp nz,editcmd_keyfail
1039
;bc=nnvcmds-(#команды+1) = 0..(nnvcmds-1)
1042
;bc=nnvcmds-(#команды+1) = 0..(nnvcmds-1)
Line 1139... Line 1142...
1139
        push bc
1142
        push bc
1140
        push hl
1143
        push hl
1141
        call getfcbaddrunderhl
1144
        call getfcbaddrunderhl
1142
        ld de,FCB_EXTENTNUMBERLO
1145
        ld de,FCB_EXTENTNUMBERLO
1143
        add hl,de
1146
        add hl,de
1144
        ld a,(hl)
1147
        ld a,(hl) ;hl=fcb+FCB_EXTENTNUMBERLO
1145
        inc hl
1148
        inc hl
1146
        inc hl
1149
        inc hl
1147
        ld e,(hl)
1150
        ld e,(hl) ;hl=fcb+FCB_EXTENTNUMBERHI
1148
        inc hl
1151
        inc hl
1149
        ld d,(hl)
1152
        ld d,(hl)
1150
        SETPGC000
1153
        SETPGC000
1151
        ld hl,filenametext
1154
        ld hl,filenametext
1152
        call strcp
1155
        call strcp
Line 2073... Line 2076...
2073
        push hl
2076
        push hl
2074
        call strcopy
2077
        call strcopy
2075
        pop hl
2078
        pop hl
2076
        ld de,tnewfilename
2079
        ld de,tnewfilename
2077
        call strcopy
2080
        call strcopy
-
 
2081
     
2078
        ;ld bc,64 ;max filename size+terminator
2082
        ;ld bc,64 ;max filename size+terminator
2079
        ;ldir
2083
        ;ldir
2080
        else
2084
        else
2081
        ld hl,fcb_filename
2085
        ld hl,fcb_filename
2082
        ld de,tnewfilename
2086
        ld de,tnewfilename
Line 2085... Line 2089...
2085
        pop hl
2089
        pop hl
2086
        ld de,filenametext
2090
        ld de,filenametext
2087
        ld bc,12
2091
        ld bc,12
2088
        ldir
2092
        ldir
2089
        endif
2093
        endif
-
 
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
2090
 
2105
 
-
 
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
2091
        ld de,_COLOR_DIALOG
2130
        ld de,_COLOR_DIALOG
2092
        call nv_setcolor
2131
        call nv_setcolor
2093
 
2132
 
2094
        ld hl,winrename
2133
        ld hl,winrename
2095
        ld de,tnewfilename
2134
        ld de,tnewfilename
2096
        ld c,63;13 ;max filename size
2135
        ld c,63;13 ;max filename size
2097
        call prwindow_edit ;CY=OK
2136
        call prwindow_edit ;CY=OK
2098
        ret nc ;cancel
2137
        ret nc ;cancel
2099
;если в имени есть символы :,/,\, то выйти с ошибкой
2138
;если в имени есть символ :то выйти с ошибкой
-
 
2139
 
2100
        ld hl,tnewfilename
2140
        ld hl,tnewfilename
2101
editcmd_ren_checkname0
2141
editcmd_ren_checkname0
2102
        ld a,(hl)
2142
        ld a,(hl)
2103
        or a
2143
        or a
2104
        jr z,editcmd_ren_checknameq
2144
        jr z,editcmd_ren_checknameq
2105
        inc hl
2145
        inc hl
2106
        cp ':'
2146
        cp ':'
2107
        ret z ;error
-
 
2108
        cp '/'
-
 
2109
        ret z ;error
-
 
2110
        cp 0x5c;'\\'
-
 
2111
        ret z ;error
2147
        jp z,name_error ;error
2112
        jr editcmd_ren_checkname0
2148
        jr editcmd_ren_checkname0
2113
editcmd_ren_checknameq
2149
editcmd_ren_checknameq
2114
        ld de,filenametext
2150
        ld de,filenametext
2115
        ld hl,tnewfilename
2151
        ld hl,tnewfilename
2116
        OS_RENAME
2152
        OS_RENAME
2117
        ;todo error
2153
        ;todo error
2118
        ret
2154
        ret
-
 
2155
name_error
-
 
2156
        ld de,_COLOR_RED
-
 
2157
        call nv_setcolor
-
 
2158
        ld hl,ren_error1
-
 
2159
        call prwindow_waitkey
-
 
2160
        ret
2119
 
2161
 
2120
editcmd_7 ;mkdir
2162
editcmd_7 ;mkdir
2121
        call ifcmdnonempty_typedigit
2163
        call ifcmdnonempty_typedigit
2122
editcmd_F7
2164
editcmd_F7
2123
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
2165
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
Line 2197... Line 2239...
2197
        push de
2239
        push de
2198
        ld bc,filenametext ;add
2240
        ld bc,filenametext ;add
2199
        ld hl,dir_buf ;src
2241
        ld hl,dir_buf ;src
2200
        call nv_makefilepath_hltode ;result :  dest=hl'/'bc (de указывает после терминатора)
2242
        call nv_makefilepath_hltode ;result :  dest=hl'/'bc (de указывает после терминатора)
2201
        pop hl
2243
        pop hl
2202
         ;ld hl,dir3_buf
-
 
2203
         ld de,windel2_file
2244
         ld de,windel2_file
2204
         push de
-
 
2205
         ld bc,64
2245
        ;ld b,64
2206
         ldir
-
 
2207
         pop hl
2246
        call strcopy_maxb64
2208
        ;ld hl,windel2_file
-
 
2209
        call nv_fillpathspaces_hl ;fill to 64bytes spaces
-
 
-
 
2247
 
2210
        ld hl,windel2
2248
        ld hl,windel2
2211
        call upwindow_text ;update window
2249
        call upwindow_text ;update window
2212
 
2250
 
2213
        ld de,dir3_buf;windel2_file ;dest
2251
        ld de,dir3_buf;windel2_file ;dest
2214
        push de
2252
        push de
Line 2257... Line 2295...
2257
        call nv_setcolor
2295
        call nv_setcolor
2258
         ld ix,(curpanel)
2296
         ld ix,(curpanel)
2259
 
2297
 
2260
        ld hl,wincopy
2298
        ld hl,wincopy
2261
        ld de,dir2_buf
2299
        ld de,dir2_buf
2262
        ld c,60
2300
        ld c,60 ;c=texteditsize
2263
        call prwindow_edit ;CY=OK
2301
        call prwindow_edit ;CY=OK
2264
        jp nc,editcmd_reprintall_noreaddir
2302
        jp nc,editcmd_reprintall_noreaddir
2265
 
2303
 
2266
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
2304
        ld hl,editcmd_reprintall_keepcursor;editcmd_reprintall
2267
        push hl ;don't change!
2305
        push hl ;don't change!
Line 2270... Line 2308...
2270
        ld (filescopied),hl
2308
        ld (filescopied),hl
2271
 
2309
 
2272
;        ld de,PROGRESBARWINXY
2310
;        ld de,PROGRESBARWINXY
2273
;        ld bc,PROGRESBARWINHGTWID
2311
;        ld bc,PROGRESBARWINHGTWID
2274
;        call prwin
2312
;        call prwin
-
 
2313
       
-
 
2314
        ld hl,overwriteflag     ;0-skip all; 1-ask each; 2-over all; 3-отмена
2275
        ld hl,wincopy2
2315
        ld (hl),1  
-
 
2316
 
2276
        call prwindow_text
2317
        call printwincopy2
-
 
2318
       
2277
        ld hl,proceditcmd_copy
2319
        ld hl,proceditcmd_copy
2278
        ld ix,(curpanel)
2320
        ld ix,(curpanel)
2279
        jp processfiles
2321
        jp processfiles
2280
 
2322
 
2281
strcopy
2323
strcopy
Line 2311... Line 2353...
2311
        push bc
2353
        push bc
2312
        call strcopy_addslash
2354
        call strcopy_addslash
2313
        pop hl
2355
        pop hl
2314
        jp strcopy;nv_strcopy_hltode
2356
        jp strcopy;nv_strcopy_hltode
2315
 
2357
 
2316
;TODO remove this
-
 
2317
nv_fillpathspaces_hl
-
 
2318
        ld b,0
-
 
2319
nv_fillpathspaces_hl0
-
 
2320
         ;ld a,b
-
 
2321
         ;cp 64
2358
strcopy_maxb64
2322
         ;ret z
-
 
2323
         bit 6,b
2359
        ld b,64
2324
         ret nz
-
 
2325
        ld a,(hl)
-
 
2326
        inc b
-
 
2327
        inc hl
-
 
2328
        or a
-
 
2329
        jr nz,nv_fillpathspaces_hl0
-
 
2330
        dec hl
-
 
2331
        dec b
-
 
2332
        ld c,' '
-
 
2333
        ld a,b
-
 
2334
nv_fillpathspaces_hl1
-
 
2335
        ld (hl),c
-
 
2336
        inc hl
-
 
2337
        inc a
-
 
2338
        cp 64
-
 
2339
        jr c,nv_fillpathspaces_hl1
-
 
2340
        ret
-
 
2341
 
-
 
2342
strcopy_maxb
2360
strcopy_maxb
2343
;copy hl->de no more than b bytes, add spaces after
2361
;copy hl->de no more than b bytes, add spaces after
2344
strcopy_maxb0
2362
strcopy_maxb0
2345
        ld a,(hl)
2363
        ld a,(hl)
2346
        or a
2364
        or a
Line 2356... Line 2374...
2356
        ld (de),a
2374
        ld (de),a
2357
        inc de
2375
        inc de
2358
        djnz strcopy_maxb_fill0
2376
        djnz strcopy_maxb_fill0
2359
        ret
2377
        ret
2360
 
2378
 
-
 
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
2361
 
2388
 
2362
nv_copydir_add;=nv_batch_pushrecord
-
 
2363
;       jp nv_batch_pushrecord
-
 
2364
;nv_batch_pushrecord
2389
batch_find_pointer
2365
        OS_GETMAINPAGES
-
 
2366
        ld a,h
-
 
2367
        ld (savepg),a
-
 
2368
        ld a,(dirpg)
-
 
2369
        SETPG8000
-
 
2370
 
-
 
2371
        ld hl,0x8000
2390
        ld hl,0x8000
2372
        ld bc,(dir_batch_pointer)
2391
        ld bc,(dir_batch_pointer)
2373
        ld de,256
2392
        ld de,256 ;64 записи в странице
2374
nv_batch_pushsrecord
2393
batch_find_pointer0
2375
        ld a,b
2394
        ld a,b
2376
        or c
2395
        or c
2377
        jr z,nv_batch_pushsrecordend
2396
        ret z
2378
        add hl,de
2397
        add hl,de
2379
        dec bc
2398
        dec bc
-
 
2399
        jr batch_find_pointer0
-
 
2400
 
2380
        jr nv_batch_pushsrecord
2401
nv_copydir_add;=nv_batch_pushrecord
-
 
2402
;TODO сохранить текущий номер файла в директории
-
 
2403
        OS_GETMAINPAGES
-
 
2404
        ld a,h
-
 
2405
        ld (savepg),a
-
 
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
2381
nv_batch_pushsrecordend
2415
nv_batch_pushrecord_nonewpg
-
 
2416
        ld a,(hl)
-
 
2417
        SETPG8000
-
 
2418
        call batch_find_pointer ;hl=pointer
-
 
2419
 
2382
        push hl
2420
        push hl
2383
;dir 1
2421
;dir 1
2384
        ld de,dir_buf
2422
        ld de,dir_buf
2385
        ex hl,de
2423
        ex hl,de
2386
        ld bc,filenametext
2424
        ld bc,filenametext
Line 2392... Line 2430...
2392
        ld de,dir2_buf
2430
        ld de,dir2_buf
2393
        ex hl,de
2431
        ex hl,de
2394
        ld bc,filenametext
2432
        ld bc,filenametext
2395
        call nv_makefilepath_hltode
2433
        call nv_makefilepath_hltode
2396
 
2434
 
2397
        ld bc,(dir_batch_pointer)
2435
        ld hl,(dir_batch_pointer)
2398
        inc bc
2436
        inc hl
2399
        ld (dir_batch_pointer),bc
2437
        ld (dir_batch_pointer),hl
2400
        ld a,(savepg)
2438
        ld a,(savepg)
2401
        SETPG8000
2439
        SETPG8000
2402
        ret
-
 
-
 
2440
        ret ;TODO jp nv_batch ;здесь же рекурсивно обрабатывать добавленную директорию (содержит CHDIR!)
2403
 
2441
 
2404
nv_batch_poprecord ;z=empty
2442
nv_batch_poprecord ;z=empty
2405
        OS_GETMAINPAGES
2443
        OS_GETMAINPAGES
2406
        ld a,h
2444
        ld a,h
2407
        ld (savepg),a
2445
        ld (savepg),a
-
 
2446
 
-
 
2447
        ld hl,(dir_batch_pointer)
-
 
2448
        ld a,h
-
 
2449
        or l
-
 
2450
        jr z,nv_batch_poprecordq ;empty :(
-
 
2451
 
2408
        ld a,(dirpg)
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
2409
        SETPG8000
2458
        SETPG8000
-
 
2459
        call batch_find_pointer ;hl=pointer
2410
 
2460
       
2411
        ld hl,0x8000
-
 
2412
        ld bc,(dir_batch_pointer)
-
 
2413
        ld a,b
-
 
2414
        or c
-
 
2415
        jr z,nv_batch_popsrecordq ;empty :(
-
 
2416
        dec bc
-
 
2417
        ld de,256
-
 
2418
nv_batch_popsrecord
-
 
2419
        ld a,b
-
 
2420
        or c
-
 
2421
        jr z,nv_batch_popsrecordend
-
 
2422
        add hl,de
-
 
2423
        dec bc
-
 
2424
        jr nv_batch_popsrecord
-
 
2425
nv_batch_popsrecordend
-
 
2426
        ld de,dir_buf
2461
        ld de,dir_buf
2427
        ld bc,128
2462
        ld bc,128
2428
        ldir
2463
        ldir
2429
        ld de,dir2_buf
2464
        ld de,dir2_buf
2430
        ld  c,128
2465
        ld  c,128
2431
        ldir
2466
        ldir
-
 
2467
 
-
 
2468
       pop hl
2432
        ld bc,(dir_batch_pointer)
2469
        ld a,(dir_batch_pointer)
2433
        dec bc
2470
        and 63
-
 
2471
        jr nz,nv_batch_poprecord_nodelpg
-
 
2472
        ld e,(hl)
-
 
2473
        OS_DELPAGE
2434
        ld (dir_batch_pointer),bc
2474
nv_batch_poprecord_nodelpg
2435
        ld a,1
2475
        ;ld a,1
2436
        or a ;NZ
2476
        ;or a ;NZ
-
 
2477
        xor a
-
 
2478
        inc a ;NZ
2437
nv_batch_popsrecordq
2479
nv_batch_poprecordq
-
 
2480
 
2438
        ld a,(savepg)
2481
        ld a,(savepg)
2439
        SETPG8000
2482
        SETPG8000
-
 
2483
;TODO вспомнить текущий номер файла в директории
2440
        ret
2484
        ret
2441
 
2485
 
2442
nv_batch
2486
nv_batch
2443
        call nv_batch_poprecord
2487
        call nv_batch_poprecord
2444
        ret z;empty
2488
        ret z;empty
Line 2499... Line 2543...
2499
        ;ld hl,fcb_filename
2543
        ;ld hl,fcb_filename
2500
        ;call dotname_to_cpmname ;de -> hl
2544
        ;call dotname_to_cpmname ;de -> hl
2501
 
2545
 
2502
        ld a,(filinfo+FILINFO_FATTRIB)
2546
        ld a,(filinfo+FILINFO_FATTRIB)
2503
        ld (fcb_attrib),a
2547
        ld (fcb_attrib),a
2504
         ld a,(dirpg)
2548
         ld a,(leftpanel+PANEL.poipg);(dirpg) ;по сути не важно, данные будут браться из filinfo
2505
         ld (fcb+FCB_EXTENTNUMBERLO),a ;NU
2549
         ld (fcb+FCB_EXTENTNUMBERLO),a
2506
 
2550
 
2507
nv_batch_proc=$+1
2551
nv_batch_proc=$+1
2508
        call proceditcmd_copy_fcb
2552
        call proceditcmd_copy_fcb ;не содержит CHDIR
2509
        jr nv_batch1
2553
        jr nv_batch1
2510
 
2554
 
2511
nv_batch_nofiles
2555
nv_batch_nofiles
2512
        or a
2556
        or a
2513
        ld hl,(processfiles_proc)
2557
        ld hl,(processfiles_proc)
Line 2541... Line 2585...
2541
        ld hl,proceditcmd_copy_fcb
2585
        ld hl,proceditcmd_copy_fcb
2542
        ld (nv_batch_proc),hl
2586
        ld (nv_batch_proc),hl
2543
 
2587
 
2544
proceditcmd_copy_fcb
2588
proceditcmd_copy_fcb
2545
;нельзя CHDIR, потому что это вызывается в цикле чтения директории в nv_batch1!
2589
;нельзя CHDIR, потому что это вызывается в цикле чтения директории в nv_batch1!
-
 
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
 
2546
        ld hl,proceditcmd_copy_q
2596
        ld hl,proceditcmd_copy_q
2547
        push hl
2597
        push hl
2548
        ;ld de,dir_buf
2598
        ;ld de,dir_buf
2549
        ;OS_CHDIR
2599
        ;OS_CHDIR
2550
 
2600
 
Line 2570... Line 2620...
2570
        ld bc,filenametext
2620
        ld bc,filenametext
2571
        ld hl,dir2_buf
2621
        ld hl,dir2_buf
2572
        call nv_makefilepath_hltode
2622
        call nv_makefilepath_hltode
2573
        pop hl
2623
        pop hl
2574
         ld de,wincopy_dest
2624
         ld de,wincopy_dest
2575
       if 1
-
 
2576
        ld b,64
2625
        ;ld b,64
2577
        call strcopy_maxb
2626
        call strcopy_maxb64
2578
       else
-
 
2579
         ;ld hl,dir3_buf
-
 
2580
         push de
-
 
2581
         ld bc,64
-
 
2582
         ldir
-
 
2583
         pop hl
-
 
2584
        ;ld hl,wincopy_dest
-
 
2585
        call nv_fillpathspaces_hl
-
 
2586
       endif
-
 
2587
 
2627
 
2588
        ld de,dir3_buf;wincopy_src ;update copy window
2628
        ld de,dir3_buf;wincopy_src ;update copy window
2589
        push de
2629
        push de
2590
        ld bc,filenametext
2630
        ld bc,filenametext
2591
        ld hl,dir_buf
2631
        ld hl,dir_buf
2592
        call nv_makefilepath_hltode
2632
        call nv_makefilepath_hltode
2593
        pop hl
2633
        pop hl
2594
         ld de,wincopy_src
2634
         ld de,wincopy_src
2595
       if 1
-
 
2596
        ld b,64
2635
        ;ld b,64
2597
        call strcopy_maxb
2636
        call strcopy_maxb64
2598
       else
-
 
2599
         ;ld hl,dir3_buf
-
 
2600
         push de
-
 
2601
         ld bc,64
-
 
2602
         ldir
-
 
2603
         pop hl
-
 
2604
        ;ld hl,wincopy_src
-
 
2605
        call nv_fillpathspaces_hl
-
 
2606
       endif
-
 
2607
 
2637
 
-
 
2638
        ;hl=string to test bc=string tester
-
 
2639
        ;out: Z if equal
2608
        ld hl,wincopy2
2640
        ld hl,wincopy_src
-
 
2641
        ld bc,wincopy_dest
-
 
2642
        call comparestr                 ;Don't try copy file into himself
-
 
2643
        ret z
-
 
2644
 
-
 
2645
        ld hl,wincopy2          ; Print filename
2609
        call upwindow_text
2646
        call upwindow_text
2610
 
2647
 
2611
        ld de,dir3_buf
2648
        ld de,dir3_buf
2612
        ;push de
-
 
2613
        ;ld bc,filenametext
-
 
2614
        ;ld hl,dir_buf
-
 
2615
        ;call nv_makefilepath_hltode
-
 
2616
        ;pop de
-
 
2617
        push de
2649
        push de
2618
        OS_OPENHANDLE
2650
        OS_OPENHANDLE   ;Test for source file.
2619
        pop de
2651
        pop de
2620
        or a
2652
        or a
2621
        ret nz ;jp nz,cmd_error_wrongfile
2653
        ret nz ;jp nz,cmd_error_wrongfile
2622
        ld a,b
2654
        ld a,b
2623
        ld (cmd_copy_close_file1_handle),a
2655
        ld (cmd_copy_close_file1_handle),a
Line 2626... Line 2658...
2626
 
2658
 
2627
        ;ld de,filenametext
2659
        ;ld de,filenametext
2628
        OS_GETFILETIME ;ix=date, hl=time
2660
        OS_GETFILETIME ;ix=date, hl=time
2629
        ld (proceditcmd_copy_time),hl
2661
        ld (proceditcmd_copy_time),hl
2630
        ld (proceditcmd_copy_date),ix
2662
        ld (proceditcmd_copy_date),ix
2631
 
-
 
2632
        ;ld de,dir2_buf
-
 
2633
        ;OS_CHDIR
-
 
2634
        ld de,dir3_buf;wincopy_dest ;256 bytes
2663
        ld de,dir3_buf;wincopy_dest ;256 bytes
2635
         push de
2664
        push de
2636
         ld bc,filenametext
2665
        ld bc,filenametext
2637
         ld hl,dir2_buf
2666
        ld hl,dir2_buf
2638
         call nv_makefilepath_hltode
2667
        call nv_makefilepath_hltode
-
 
2668
       
2639
         pop de
2669
        pop de  
-
 
2670
        push de      
-
 
2671
        OS_OPENHANDLE
-
 
2672
        or a
2640
        ;ld de,filenametext;swordbuf2 ;de=drive/path/file
2673
        jp  nz,notargetfile                     ; Файл назначения не существует
2641
        OS_CREATEHANDLE
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              
-
 
2702
        jp notargetfile
-
 
2703
proceditcmd_nextkey0
-
 
2704
        cp 's'                                   ; Давай все существующие пропустим
-
 
2705
        jp nz,proceditcmd_nextkey1
-
 
2706
       
-
 
2707
        ld hl,overwriteflag
-
 
2708
        ld (hl),0
-
 
2709
        pop de
-
 
2710
        ret
-
 
2711
 
-
 
2712
proceditcmd_nextkey1
-
 
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
-
 
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                           ; создаем файл получатель
2642
        or a
2730
        or a
2643
        ret nz ;jp nz,cmd_error_cant_copy
2731
        ret nz ;jp nz,cmd_error_cant_copy
2644
        ld a,b
2732
        ld a,b
2645
        ld (cmd_copy_close_file2_handle),a
2733
        ld (cmd_copy_close_file2_handle),a
2646
        ld hl,cmd_copy_close_file2
2734
        ld hl,cmd_copy_close_file2
Line 2884... Line 2972...
2884
        call strlen ;hl=length
2972
        call strlen ;hl=length
2885
        ld a,l
2973
        ld a,l
2886
        ld (curcmdx),a
2974
        ld (curcmdx),a
2887
        ret
2975
        ret
2888
 
2976
 
-
 
2977
comparestr:            
-
 
2978
;hl=string to test      bc=string tester
-
 
2979
;Z if equal
-
 
2980
                push de
-
 
2981
comparestr2            
-
 
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
-
 
2995
notequal:
-
 
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
2889
windrv
3006
windrv
2890
        dw 0x0003 ;de=yx
3007
        dw 0x0003 ;de=yx
2891
        dw 256*(3+NDRIVES)+28 ;0x0809 ;bc=hgt,wid
3008
        dw 256*(3+NDRIVES)+28 ;0x0809 ;bc=hgt,wid
2892
        db "Drive",0
3009
        db "Drive",0
2893
        db 3 ;next line
3010
        db 3 ;next line
Line 2926... Line 3043...
2926
        dw tnewfilename
3043
        dw tnewfilename
2927
        db 0 ;end of window
3044
        db 0 ;end of window
2928
 
3045
 
2929
wincopy
3046
wincopy
2930
        dw 0x0a07 ;de=yx
3047
        dw 0x0a07 ;de=yx
2931
        dw 0x0544 ;bc=hgt,wid
3048
        dw 0x0543 ;bc=hgt,wid
2932
        db "Copy ",0
3049
        db "Copy ",0
2933
        db 1
3050
        db 1
2934
        db " file(s)/dir(s) to:",0
3051
        db " file(s)/dir(s) to:",0
2935
        db 3 ;next line
3052
        db 3 ;next line
2936
        db 2 ;print outer text
3053
        db 2 ;print outer text
Line 2983... Line 3100...
2983
        dw 0x0510 ;bc=hgt,wid
3100
        dw 0x0510 ;bc=hgt,wid
2984
        db 3 ;next line
3101
        db 3 ;next line
2985
        db "Drive error!",0
3102
        db "Drive error!",0
2986
        db 0 ;end of window
3103
        db 0 ;end of window
2987
 
3104
 
-
 
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
 
-
 
3112
overwritefile
-
 
3113
        dw 0x0d15 ;de=yx
-
 
3114
        dw 0x0528 ;bc=hgt,wid
-
 
3115
        ;db 3 ;next line
-
 
3116
        db "          OVERWRITE FILE?",0,3
-
 
3117
        db "[Y]es/[No]/[S]kip all/[R]eplace All",0,3
-
 
3118
        db "             [C]ancel",0  
-
 
3119
        db 0 ;end of window
-
 
3120
 
-
 
3121
 
-
 
3122
 
2988
tdotdot
3123
tdotdot
2989
        dw "..",0
3124
        dw "..",0
2990
 
3125
 
2991
        STRUCT PANEL
3126
        STRUCT PANEL
2992
xy              WORD
3127
xy              WORD
Line 3050... Line 3185...
3050
 
3185
 
3051
copybuf=0x4000 ;нельзя 0xc000 - поверх какой-нибудь директории (а она используется при копировании) ;0x8000 можно только после выставления страницы там
3186
copybuf=0x4000 ;нельзя 0xc000 - поверх какой-нибудь директории (а она используется при копировании) ;0x8000 можно только после выставления страницы там
3052
copybuf_sz=0x4000 ;$-copybuf
3187
copybuf_sz=0x4000 ;$-copybuf
3053
 
3188
 
3054
dir_batch_pointer db 0,0
3189
dir_batch_pointer db 0,0
3055
savepg db 0,0
3190
savepg
-
 
3191
        db 0
3056
dirpg db 0,0
3192
;dirpg db 0,0
-
 
3193
ndirpgs
-
 
3194
        db 0
3057
 
3195
tdirpgs
-
 
3196
        ds 64
-
 
3197
overwriteflag
-
 
3198
        db 0
3058
washobetarunner
3199
washobetarunner
3059
;pgsys=pagexor-10
3200
;pgsys=pagexor-10
3060
;pgfatfs=pagexor-9
3201
;pgfatfs=pagexor-9
3061
;pgtrdosfs=pagexor-8
3202
;pgtrdosfs=pagexor-8
3062
;pgkillable=pagexor-4 ;в 128K памяти, т.к. можно портить
3203
;pgkillable=pagexor-4 ;в 128K памяти, т.к. можно портить
Line 3177... Line 3318...
3177
 
3318
 
3178
        include "../_sdk/prdword.asm"
3319
        include "../_sdk/prdword.asm"
3179
        include "cmdpr.asm"
3320
        include "cmdpr.asm"
3180
       if PRSTDIO
3321
       if PRSTDIO
3181
        include "../_sdk/stdio.asm"
3322
        include "../_sdk/stdio.asm"
-
 
3323
        include "nvclock.asm"   ; сейчас часы реализованы только в nv.com поэтому весь код под условием.
-
 
3324
 
-
 
3325
yieldgetkeyloop_rtc
-
 
3326
        call printRTC           ; Обновляем часы даже если не трогаем клавиатуру.
-
 
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
3182
       endif
3336
       endif
3183
 
3337
 
3184
        align 256
3338
       align 256
3185
searchbuf
3339
searchbuf
3186
SEARCHBUF_SZ=128 ;2 таких
3340
SEARCHBUF_SZ=128 ;2 таких
Line 3194... Line 3348...
3194
        ds 256 ;max size for no bugs
3348
        ds 256 ;max size for no bugs
3195
 
3349
 
3196
        align 256
3350
        align 256
3197
HS_strpg
3351
HS_strpg
3198
        ds 256;DIRPAGES*2+2 ;по 1 байту на маркеры "0"
3352
        ds 256;DIRPAGES*2+2 ;по 1 байту на маркеры "0"
3199
        align 256
-
 
3200
textpages
-
 
3201
        ds 256
-
 
3202
twinto866
3353
twinto866
3203
        incbin "../_sdk/codepage/winto866"
3354
        incbin "../_sdk/codepage/winto866"
-
 
3355
textpages
-
 
3356
        ds 256;256
3204
cmd_end
3357
cmd_end
3205
 
3358
 
3206
        display "nv size ",cmd_end-cmd_begin," bytes"
3359
        display "nv size ",cmd_end-cmd_begin," bytes"
3207
 
-
 
3208
       if PRSTDIO
3360
       if PRSTDIO
-
 
3361
         display "nv.com free space ",0x4000-cmd_end
3209
        savebin "nv.com",cmd_begin,cmd_end-cmd_begin
3362
        savebin "nv.com",cmd_begin,cmd_end-cmd_begin
3210
       else
3363
       else
-
 
3364
        display "nvfast.com free space ",0x4000-cmd_end
3211
        savebin "nvfast.com",cmd_begin,cmd_end-cmd_begin
3365
        savebin "nvfast.com",cmd_begin,cmd_end-cmd_begin
3212
       endif
3366
       endif
3213
 
3367
 
3214
        LABELSLIST "../../us/user.l",1
3368
        LABELSLIST "../../us/user.l",1