Rev 1410 | Details | Compare with Previous | Last modification | View Log
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 651 | alone | 1 | MAXSEARCHFILENAME=64 |
| 2 | MAXSEARCHTEXT=64 |
||
| 3 | |||
| 654 | alone | 4 | FOUNDFILESFNSZ=80 |
| 1410 | alone | 5 | FOUNDFILESMAX=20;TODO txtscrhgt-5 |
| 654 | alone | 6 | FOUNDFILESTABLE=0x8000 |
| 7 | FOUNDFILESTABLE_END=0x8000+(FOUNDFILESMAX*FOUNDFILESFNSZ) |
||
| 8 | |||
| 650 | alone | 9 | editcmd_2 |
| 10 | call ifcmdnonempty_typedigit |
||
| 11 | editcmd_F2 |
||
| 651 | alone | 12 | call setdrawtablesneeded |
| 654 | alone | 13 | OS_NEWPAGE |
| 14 | ld a,e |
||
| 15 | ld (findpg),a |
||
| 889 | alone | 16 | ld hl,nvfind_freepg |
| 17 | push hl |
||
| 18 | ld hl,editcmd_reprintall_noreaddir |
||
| 19 | push hl |
||
| 20 | |||
| 651 | alone | 21 | nvfind_redrawloop |
| 654 | alone | 22 | ld a,(findpg) |
| 23 | ld e,a |
||
| 1410 | alone | 24 | SETPG8000 |
| 651 | alone | 25 | call nvfind_reprintmenu |
| 654 | alone | 26 | |
| 651 | alone | 27 | nvfind_mainloop |
| 1167 | alone | 28 | call nvfind_getx |
| 29 | ld e,a |
||
| 30 | ld a,(nvfind_curtab) |
||
| 31 | add a,a |
||
| 32 | inc a |
||
| 33 | ld d,a |
||
| 34 | call nv_setxy ;keeps de,hl,ix |
||
| 35 | if 0 |
||
| 651 | alone | 36 | ld a,2 |
| 37 | nvfind_yieldkeep |
||
| 751 | alone | 38 | ld (nvfind_wasnokey),a |
| 651 | alone | 39 | YIELDKEEP |
| 40 | ld a,55+128 ;"or a" |
||
| 751 | alone | 41 | ld (nvfind_wasyield),a |
| 1167 | alone | 42 | endif |
| 651 | alone | 43 | nvfind_mainloop_nokey |
| 1167 | alone | 44 | if 0 |
| 45 | else |
||
| 46 | YIELD |
||
| 47 | endif |
||
| 841 | alone | 48 | if PRSTDIO |
| 49 | GETKEY_ |
||
| 1167 | alone | 50 | jr nz,nvfind_mainloop_keyq |
| 1168 | alone | 51 | ;GETKEY_ |
| 52 | ;jr nz,nvfind_mainloop_keyq |
||
| 53 | ;GETKEY_ |
||
| 54 | ;jr nz,nvfind_mainloop_keyq ;event 뢠 3-ᨬ |
||
| 55 | ;ld a,(stdindatacount) |
||
| 56 | ;or a |
||
| 57 | ;jr nz,nvfind_mainloop |
||
| 841 | alone | 58 | else |
| 59 | GET_KEY |
||
| 60 | ld a,c ;keynolang |
||
| 61 | ;cp NOKEY |
||
| 62 | or a |
||
| 1167 | alone | 63 | jr nz,nvfind_mainloop_keyq |
| 841 | alone | 64 | endif |
| 1167 | alone | 65 | if 0 |
| 653 | alone | 66 | ; ࠧ ᮡ, YIELD, YIELDKEEP |
| 651 | alone | 67 | nvfind_wasnokey=$+1 |
| 68 | ld a,1 |
||
| 69 | dec a |
||
| 70 | jr nz,nvfind_yieldkeep |
||
| 653 | alone | 71 | ;ᮢ ⮫쪮 ⢨ ᮡ YIELD |
| 651 | alone | 72 | nvfind_wasyield=$ |
| 73 | scf |
||
| 74 | call c,nvfind_panel |
||
| 75 | YIELD |
||
| 76 | ld a,55 ;"scf" |
||
| 77 | ld (nvfind_wasyield),a |
||
| 1167 | alone | 78 | else |
| 79 | call nvfind_panel |
||
| 80 | endif |
||
| 81 | jr nvfind_mainloop;_nokey |
||
| 651 | alone | 82 | nvfind_mainloop_keyq |
| 83 | cp key_redraw |
||
| 84 | jr z,nvfind_redrawloop |
||
| 85 | cp key_esc |
||
| 86 | ret z |
||
| 654 | alone | 87 | cp key_F3 |
| 88 | jp z,nvfind_view |
||
| 651 | alone | 89 | ld hl,nvfind_mainloop |
| 90 | push hl |
||
| 91 | cp key_enter |
||
| 92 | jp z,nvfind_enter |
||
| 93 | cp key_tab |
||
| 94 | jp z,nvfind_tab |
||
| 654 | alone | 95 | cp key_up |
| 96 | jp z,nvfind_up |
||
| 97 | cp key_down |
||
| 98 | jp z,nvfind_down |
||
| 99 | cp key_left |
||
| 100 | jp z,nvfind_left |
||
| 101 | cp key_right |
||
| 102 | jp z,nvfind_right |
||
| 651 | alone | 103 | cp key_backspace |
| 104 | jp z,nvfind_backspace |
||
| 650 | alone | 105 | |
| 651 | alone | 106 | cp 0x20 |
| 653 | alone | 107 | ret c ;稥 ⥬ 㦭 |
| 651 | alone | 108 | nvfind_typein |
| 109 | ;keeps ix |
||
| 110 | ld e,a |
||
| 111 | ld a,(nvfind_curtab) |
||
| 112 | or a |
||
| 113 | jr nz,nvfind_typein_cursearchtext |
||
| 654 | alone | 114 | |
| 651 | alone | 115 | nvfind_typein_cursearchfilename |
| 654 | alone | 116 | call nvfind_gettext |
| 651 | alone | 117 | call strlen ;hl=length |
| 118 | ld bc,MAXSEARCHFILENAME |
||
| 119 | or a |
||
| 120 | sbc hl,bc |
||
| 653 | alone | 121 | ret nc ;㤠 |
| 651 | alone | 122 | call nvfind_calctextaddr ;hl=addr, a=curx |
| 123 | inc a |
||
| 654 | alone | 124 | call nvfind_setx |
| 651 | alone | 125 | jp strinsch |
| 650 | alone | 126 | |
| 651 | alone | 127 | nvfind_typein_cursearchtext |
| 654 | alone | 128 | call nvfind_gettext |
| 651 | alone | 129 | call strlen ;hl=length |
| 130 | ld bc,MAXSEARCHTEXT |
||
| 131 | or a |
||
| 132 | sbc hl,bc |
||
| 653 | alone | 133 | ret nc ;㤠 |
| 651 | alone | 134 | call nvfind_calctextaddr ;hl=addr, a=curx |
| 135 | inc a |
||
| 654 | alone | 136 | call nvfind_setx |
| 651 | alone | 137 | jp strinsch |
| 138 | |||
| 654 | alone | 139 | nvfind_gettext |
| 140 | ld a,(nvfind_curtab) |
||
| 141 | or a |
||
| 142 | ld hl,cursearchtext |
||
| 2018 | alone | 143 | ret nz;jr nz,nvfind_gettext_cursearchtext |
| 654 | alone | 144 | ld hl,cursearchfilename |
| 145 | nvfind_gettext_cursearchtext |
||
| 146 | ret |
||
| 147 | |||
| 148 | nvfind_getx |
||
| 149 | ld a,(nvfind_curtab) |
||
| 150 | or a |
||
| 151 | ld a,(nvfind_curtextx) |
||
| 2018 | alone | 152 | ret nz;jr nz,nvfind_getx_cursearchtext |
| 654 | alone | 153 | ld a,(nvfind_curx) |
| 154 | nvfind_getx_cursearchtext |
||
| 155 | ret |
||
| 156 | |||
| 157 | nvfind_setx |
||
| 158 | ld c,a |
||
| 159 | ld a,(nvfind_curtab) |
||
| 160 | or a |
||
| 161 | ld a,c |
||
| 162 | jr nz,nvfind_setx_cursearchtext |
||
| 163 | ld (nvfind_curx),a |
||
| 164 | ret |
||
| 165 | nvfind_setx_cursearchtext |
||
| 166 | ld (nvfind_curtextx),a |
||
| 167 | ret |
||
| 168 | |||
| 169 | nvfind_view |
||
| 170 | ld a,(nvfind_curfoundfiles) |
||
| 171 | or a |
||
| 172 | ret z |
||
| 173 | call nvfind_findselectedname |
||
| 889 | alone | 174 | ld de,filenametext |
| 175 | call strcopy |
||
| 654 | alone | 176 | call nvview |
| 177 | jp nvfind_redrawloop |
||
| 178 | |||
| 179 | nvfind_left |
||
| 180 | call nvfind_getx |
||
| 181 | or a |
||
| 182 | ret z |
||
| 183 | dec a |
||
| 184 | jp nvfind_setx |
||
| 185 | |||
| 186 | nvfind_right |
||
| 187 | call nvfind_gettext |
||
| 188 | call strlen ;hl=length |
||
| 189 | call nvfind_getx |
||
| 190 | cp l |
||
| 191 | ret z |
||
| 192 | inc a |
||
| 193 | jp nvfind_setx |
||
| 194 | |||
| 195 | nvfind_up |
||
| 196 | ld de,_COLOR |
||
| 197 | call nvfind_printbigcursor |
||
| 198 | ld a,(nvfind_curfoundfile) |
||
| 199 | or a |
||
| 200 | ret z |
||
| 201 | dec a |
||
| 202 | ld (nvfind_curfoundfile),a |
||
| 203 | ret |
||
| 204 | |||
| 205 | nvfind_down |
||
| 206 | ld de,_COLOR |
||
| 207 | call nvfind_printbigcursor |
||
| 208 | ld a,(nvfind_curfoundfile) |
||
| 209 | ld hl,nvfind_curfoundfiles |
||
| 210 | inc a |
||
| 211 | cp (hl) |
||
| 212 | ret z |
||
| 213 | ld (nvfind_curfoundfile),a |
||
| 214 | ret |
||
| 215 | |||
| 651 | alone | 216 | nvfind_tab |
| 217 | ld hl,nvfind_curtab |
||
| 218 | ld a,(hl) |
||
| 219 | xor 1 |
||
| 220 | ld (hl),a |
||
| 650 | alone | 221 | ret |
| 222 | |||
| 651 | alone | 223 | nvfind_backspace |
| 224 | call nvfind_calctextaddr ;hl=addr, a=curx |
||
| 225 | or a |
||
| 226 | ret z |
||
| 653 | alone | 227 | ld a,(nvfind_curtab) |
| 228 | or a |
||
| 229 | jr nz,nvfind_backspace_cursearchtext |
||
| 230 | ld de,nvfind_curx |
||
| 231 | ld a,(de) |
||
| 651 | alone | 232 | dec a |
| 653 | alone | 233 | ld (de),a |
| 651 | alone | 234 | jp strdelch |
| 653 | alone | 235 | nvfind_backspace_cursearchtext |
| 236 | ld de,nvfind_curtextx |
||
| 237 | ld a,(de) |
||
| 238 | dec a |
||
| 239 | ld (de),a |
||
| 240 | jp strdelch |
||
| 651 | alone | 241 | |
| 889 | alone | 242 | nvfind_enter_select |
| 243 | ;TODO select from list y=(nvfind_curfoundfile) |
||
| 244 | call nvfind_findselectedname |
||
| 245 | push hl |
||
| 246 | call findlastslash. ;de = after last slash |
||
| 247 | dec de |
||
| 248 | xor a |
||
| 249 | ld (de),a ;drop filename after path |
||
| 250 | pop de |
||
| 251 | OS_CHDIR |
||
| 252 | ld hl,(curpanel) |
||
| 253 | call editcmd_setpaneldirfromcurdir_panelhl |
||
| 254 | pop af ;loop return |
||
| 255 | pop af ;reprint return |
||
| 256 | jp editcmd_reprintall |
||
| 257 | |||
| 651 | alone | 258 | nvfind_enter |
| 2018 | alone | 259 | ld a,(nvfind_curtab) |
| 260 | or a |
||
| 261 | jr z,nvfind_enter_research ;Enter on filename - new search |
||
| 889 | alone | 262 | ld a,(nvfind_curfoundfiles) |
| 263 | or a |
||
| 2018 | alone | 264 | jr nz,nvfind_enter_select ;Enter on search text - go to result |
| 265 | nvfind_enter_research |
||
| 653 | alone | 266 | ld (nvfind_sp),sp |
| 654 | alone | 267 | |
| 268 | xor a |
||
| 269 | ld (nvfind_curfoundfiles),a |
||
| 270 | ld (nvfind_curfoundfile),a |
||
| 271 | ld hl,FOUNDFILESTABLE |
||
| 272 | ld (nvfind_curfoundnameaddr),hl |
||
| 651 | alone | 273 | |
| 2018 | alone | 274 | call nvfind_reprintmenu |
| 275 | |||
| 654 | alone | 276 | ld de,0x0400 |
| 889 | alone | 277 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 278 | |
| 889 | alone | 279 | ;ld hl,emptypath |
| 280 | call getcurpaneldir_hl |
||
| 656 | alone | 281 | ld de,nvfind_curpath |
| 889 | alone | 282 | call strcopy_addslash |
| 656 | alone | 283 | |
| 284 | call nvfind_loaddir |
||
| 285 | nvfind_break |
||
| 286 | nvfind_sp=$+1 |
||
| 287 | ld sp,0 |
||
| 288 | ret |
||
| 289 | |||
| 290 | macro STRPUSH |
||
| 291 | ;hl=string addr |
||
| 292 | xor a |
||
| 293 | push af |
||
| 294 | ld a,(hl) |
||
| 295 | inc hl |
||
| 296 | or a |
||
| 297 | push af |
||
| 298 | jr nz,$-4 |
||
| 299 | pop af |
||
| 300 | ; ⥪ \0, ⥪ ( ନ) |
||
| 301 | endm |
||
| 302 | |||
| 303 | macro STRPOP |
||
| 304 | ;hl=string addr |
||
| 305 | ld d,h |
||
| 306 | ld e,l |
||
| 307 | pop af |
||
| 308 | ld (hl),a |
||
| 309 | inc hl |
||
| 310 | or a |
||
| 311 | jr nz,$-4 |
||
| 312 | ex de,hl |
||
| 313 | call strmirror |
||
| 314 | endm |
||
| 315 | |||
| 316 | strmirror |
||
| 317 | ;hl=string addr |
||
| 318 | ld d,h |
||
| 319 | ld e,l |
||
| 320 | call strlen |
||
| 321 | ld b,h |
||
| 322 | ld c,l |
||
| 323 | ld a,b |
||
| 324 | or c |
||
| 325 | ret z |
||
| 326 | ;de=砫, bc=hl= |
||
| 327 | add hl,de ;hl=+1 |
||
| 328 | srl b |
||
| 329 | rr c ;bc=wid/2 |
||
| 330 | mirrorbytes0 |
||
| 331 | dec hl |
||
| 332 | ld a,(de) |
||
| 333 | ldi |
||
| 334 | dec hl |
||
| 335 | ld (hl),a |
||
| 336 | jp pe,mirrorbytes0 |
||
| 337 | ret |
||
| 338 | |||
| 339 | nvfind_loaddir |
||
| 2018 | alone | 340 | ld de,nvfind_curpath |
| 341 | OS_CHDIR |
||
| 656 | alone | 342 | ld de,emptypath;nvfind_curpath |
| 2018 | alone | 343 | OS_OPENDIR ; !!! |
| 651 | alone | 344 | |
| 653 | alone | 345 | ld bc,0 ;file# |
| 651 | alone | 346 | nvfind_loaddir0 |
| 2018 | alone | 347 | ;push bc |
| 651 | alone | 348 | call loaddir_filinfo |
| 2018 | alone | 349 | ;pop bc |
| 656 | alone | 350 | inc bc |
| 651 | alone | 351 | jp c,nvfind_loaddirq |
| 352 | jr z,nvfind_loaddir0 |
||
| 656 | alone | 353 | ld hl,filinfo+FILINFO_FATTRIB |
| 354 | ld a,(hl) |
||
| 355 | and FATTRIB_DIR |
||
| 356 | jr z,nvfind_loaddir_ndir |
||
| 357 | ld hl,filinfo+FILINFO_FNAME |
||
| 358 | ld a,'.' |
||
| 359 | cp (hl) |
||
| 360 | jr nz,nvfind_loaddir_subdir |
||
| 361 | inc hl |
||
| 362 | cp (hl) |
||
| 363 | jr z,nvfind_loaddir0 |
||
| 364 | nvfind_loaddir_subdir |
||
| 365 | push bc |
||
| 366 | ;open subdir |
||
| 367 | ld hl,nvfind_curpath |
||
| 368 | STRPUSH |
||
| 369 | ld hl,nvfind_curpath |
||
| 370 | call strfindeol |
||
| 371 | ex de,hl |
||
| 372 | ld hl,filinfo+FILINFO_FNAME |
||
| 373 | call strcopy ;out: hl,de after terminator |
||
| 374 | ex de,hl |
||
| 375 | dec hl |
||
| 376 | ld (hl),'/' |
||
| 377 | inc hl ;curpath = oldcurpath+dir+'/' |
||
| 378 | ld (hl),0 |
||
| 379 | ;ld de,nvfind_curpath |
||
| 380 | ;OS_OPENDIR |
||
| 381 | ;jr $ |
||
| 651 | alone | 382 | |
| 656 | alone | 383 | ld de,filinfo+FILINFO_FNAME |
| 384 | OS_CHDIR |
||
| 385 | |||
| 386 | call nvfind_loaddir |
||
| 387 | |||
| 388 | ld de,tdotdot |
||
| 389 | OS_CHDIR |
||
| 390 | |||
| 391 | ;reopen dir |
||
| 392 | ld hl,nvfind_curpath |
||
| 393 | STRPOP |
||
| 394 | ld de,nvfind_curpath |
||
| 2018 | alone | 395 | OS_CHDIR |
| 396 | ld de,emptypath;nvfind_curpath |
||
| 397 | OS_OPENDIR ; !!! |
||
| 656 | alone | 398 | pop bc |
| 653 | alone | 399 | push bc |
| 656 | alone | 400 | nvfind_loaddir_recreread0 |
| 2018 | alone | 401 | ;push bc |
| 656 | alone | 402 | call loaddir_filinfo |
| 2018 | alone | 403 | ;pop bc |
| 656 | alone | 404 | dec bc |
| 405 | ld a,b |
||
| 406 | or c |
||
| 407 | jr nz,nvfind_loaddir_recreread0 |
||
| 408 | pop bc |
||
| 409 | jr nvfind_loaddir0 |
||
| 410 | nvfind_loaddir_ndir |
||
| 411 | push bc |
||
| 651 | alone | 412 | ld de,cursearchfilename |
| 413 | ld hl,filinfo+FILINFO_FNAME |
||
| 414 | call nvfind_compare |
||
| 415 | jr z,nvfind_loaddir_ok |
||
| 416 | ld de,cursearchfilename |
||
| 417 | ld hl,filinfo+FILINFO_LNAME |
||
| 418 | call nvfind_compare |
||
| 419 | jr nz,nvfind_loaddir_fail |
||
| 420 | nvfind_loaddir_ok |
||
| 656 | alone | 421 | call nvfind_found |
| 422 | |||
| 423 | nvfind_loaddir_fail |
||
| 424 | pop bc ;file# |
||
| 425 | jp nvfind_loaddir0 |
||
| 426 | nvfind_loaddirq |
||
| 427 | ret |
||
| 428 | |||
| 429 | |||
| 430 | nvfind_found |
||
| 431 | ;TODO generate curpath/hlname |
||
| 432 | push hl |
||
| 433 | ld hl,nvfind_curpath |
||
| 434 | call strfindeol |
||
| 435 | pop de |
||
| 436 | push hl |
||
| 437 | ;ld (hl),'/' |
||
| 438 | ;inc hl |
||
| 439 | ex de,hl |
||
| 440 | call strcopy |
||
| 441 | ld hl,nvfind_curpath |
||
| 654 | alone | 442 | ld (nvfind_curfilename),hl |
| 653 | alone | 443 | ld a,(cursearchtext) |
| 444 | or a |
||
| 656 | alone | 445 | jr z,nvfind_foundnosearchinfile |
| 653 | alone | 446 | |
| 447 | ;open file with name=HL |
||
| 448 | ex de,hl |
||
| 449 | OS_OPENHANDLE |
||
| 450 | ld a,b |
||
| 451 | ld (nvfind_curhandle),a |
||
| 452 | |||
| 453 | call nvfind_searchinfile |
||
| 454 | push af |
||
| 455 | nvfind_curhandle=$+1 |
||
| 456 | ld b,0 |
||
| 457 | OS_CLOSEHANDLE |
||
| 458 | pop af |
||
| 656 | alone | 459 | jr nz,nvfind_found_q |
| 653 | alone | 460 | |
| 656 | alone | 461 | nvfind_foundnosearchinfile |
| 654 | alone | 462 | nvfind_curfoundnameaddr=$+1 |
| 463 | ld de,0 |
||
| 464 | ld hl,FOUNDFILESTABLE_END |
||
| 465 | or a |
||
| 466 | sbc hl,de |
||
| 656 | alone | 467 | jp z,nvfind_break |
| 654 | alone | 468 | ld hl,(nvfind_curfilename) |
| 469 | ld bc,FOUNDFILESFNSZ |
||
| 470 | ldir |
||
| 471 | ld (nvfind_curfoundnameaddr),de |
||
| 472 | ld hl,nvfind_curfoundfiles |
||
| 473 | inc (hl) |
||
| 474 | |||
| 475 | call prcrlf |
||
| 653 | alone | 476 | nvfind_curfilename=$+1 |
| 477 | ld hl,0 |
||
| 651 | alone | 478 | ld c,0 ;x |
| 479 | call prtext |
||
| 654 | alone | 480 | call clearrestofline |
| 651 | alone | 481 | |
| 841 | alone | 482 | if PRSTDIO |
| 653 | alone | 483 | GETKEY_ |
| 841 | alone | 484 | else |
| 485 | GET_KEY |
||
| 486 | endif |
||
| 653 | alone | 487 | cp key_esc |
| 488 | jp z,nvfind_break |
||
| 656 | alone | 489 | nvfind_found_q |
| 490 | pop hl |
||
| 491 | ld (hl),0 |
||
| 651 | alone | 492 | ret |
| 493 | |||
| 653 | alone | 494 | nvfind_searchinfile |
| 495 | ;out: NZ=not found, Z=found, hl=place after |
||
| 496 | ;᭠砫 cursearchbuf=searchbuf, 㧨 㤠 ᥣ |
||
| 497 | call nvfind_loadsegment |
||
| 498 | nvfind_searchinfile0 |
||
| 499 | call nvfind_loadsegment ;᭮ ᥣ । |
||
| 500 | call nvfind_searchinsegment |
||
| 501 | jr c,nvfind_searchinfileq |
||
| 502 | jr nz,nvfind_searchinfile0 |
||
| 503 | nvfind_searchinfileq |
||
| 504 | ret |
||
| 505 | |||
| 506 | nvfind_searchinsegment |
||
| 507 | ;out: CY=end of file(NZ); else NZ=not found, Z=found, hl=place after |
||
| 508 | cursearchbuf=$+1 |
||
| 509 | ld hl,searchbuf |
||
| 510 | nvfind_cursize=$+1 |
||
| 511 | ld bc,128 |
||
| 655 | alone | 512 | nvfind_searchinsegment_retry |
| 653 | alone | 513 | ld a,b |
| 514 | or c |
||
| 515 | jr z,nvfind_searchinsegment_eof |
||
| 516 | ld de,cursearchtext |
||
| 517 | ld a,(de) |
||
| 518 | cpir |
||
| 519 | scf |
||
| 520 | ccf |
||
| 521 | ret nz ;NZ,NC |
||
| 655 | alone | 522 | ld (nvfind_searchinsegment_tempaddr),hl |
| 653 | alone | 523 | dec hl ;for use inc l later |
| 524 | nvfind_searchinsegment0 |
||
| 525 | inc l |
||
| 526 | inc de |
||
| 527 | ld a,(de) |
||
| 528 | or a |
||
| 529 | ret z ;Z,NC |
||
| 530 | xor (hl) |
||
| 531 | jr z,nvfind_searchinsegment0 |
||
| 655 | alone | 532 | nvfind_searchinsegment_tempaddr=$+1 |
| 533 | ld hl,0 |
||
| 534 | jr nvfind_searchinsegment_retry |
||
| 535 | ;ret ;NZ,NC |
||
| 653 | alone | 536 | nvfind_searchinsegment_eof |
| 537 | sub 1 |
||
| 538 | ret ;CY,NZ |
||
| 539 | |||
| 540 | nvfind_loadsegment |
||
| 541 | nvfind_nextsize=$+1 |
||
| 542 | ld hl,0 |
||
| 543 | ld (nvfind_cursize),hl |
||
| 544 | ld a,(nvfind_curhandle) |
||
| 545 | ld b,a |
||
| 546 | ld hl,SEARCHBUF_SZ |
||
| 547 | ld de,(cursearchbuf) |
||
| 548 | OS_READHANDLE |
||
| 549 | ;hl=true size |
||
| 550 | ld (nvfind_nextsize),hl |
||
| 551 | ld hl,cursearchbuf |
||
| 552 | ld a,(hl) |
||
| 553 | xor 128 |
||
| 554 | ld (hl),a |
||
| 555 | ret |
||
| 556 | |||
| 651 | alone | 557 | nvfind_compare |
| 558 | ;de=search string |
||
| 559 | ;hl=test string |
||
| 560 | ;out: Z=ok, NZ=fail |
||
| 561 | push hl |
||
| 562 | call nvfind_compare0 |
||
| 563 | pop hl |
||
| 564 | ret |
||
| 565 | nvfind_compare0 |
||
| 566 | ld a,(de) |
||
| 567 | cp '*' |
||
| 568 | ret z |
||
| 569 | cp '?' |
||
| 570 | jr z,nvfind_compare_skip |
||
| 571 | or 0x20 |
||
| 572 | xor (hl) |
||
| 573 | jr z,nvfind_compare_skip |
||
| 574 | cp 0x20 |
||
| 575 | ret nz |
||
| 576 | ld a,(de) |
||
| 577 | or a |
||
| 578 | ret z |
||
| 579 | nvfind_compare_skip |
||
| 580 | inc hl |
||
| 581 | inc de |
||
| 582 | jr nvfind_compare0 |
||
| 583 | |||
| 584 | nvfind_calctextaddr |
||
| 585 | ld a,(nvfind_curtab) |
||
| 586 | or a |
||
| 587 | jr z,nvfind_calctextaddr_cursearchfilename |
||
| 588 | ld hl,cursearchtext |
||
| 589 | nvfind_curtextx=$+1 |
||
| 590 | ld a,0 |
||
| 591 | jp cmdcalctextaddr_hlbase_ax ;hl=addr, a=x |
||
| 592 | |||
| 593 | nvfind_calctextaddr_cursearchfilename |
||
| 594 | ld hl,cursearchfilename |
||
| 595 | nvfind_curx=$+1 |
||
| 596 | ld a,0 |
||
| 597 | jp cmdcalctextaddr_hlbase_ax ;hl=addr, a=x |
||
| 598 | |||
| 654 | alone | 599 | nvfind_findselectedname |
| 600 | ld hl,FOUNDFILESTABLE |
||
| 601 | ld de,FOUNDFILESFNSZ |
||
| 602 | nvfind_curfoundfile=$+1 |
||
| 603 | ld b,0 |
||
| 604 | inc b |
||
| 605 | dec b |
||
| 606 | ret z ;hl=name |
||
| 607 | add hl,de |
||
| 608 | djnz $-1 |
||
| 609 | ;hl=name |
||
| 610 | ret |
||
| 611 | |||
| 612 | nvfind_printbigcursor |
||
| 613 | ;de=color |
||
| 614 | nvfind_curfoundfiles=$+1 |
||
| 615 | ld a,0 |
||
| 616 | or a |
||
| 617 | ret z |
||
| 618 | call nv_setcolor |
||
| 619 | ld a,(nvfind_curfoundfile) |
||
| 620 | add a,5 |
||
| 621 | ld d,a |
||
| 622 | ld e,0 |
||
| 889 | alone | 623 | call nv_setxy ;keeps de,hl,ix |
| 654 | alone | 624 | call nvfind_findselectedname |
| 625 | ld c,0 ;x |
||
| 626 | call prtext |
||
| 627 | ld de,_COLOR |
||
| 628 | jp nv_setcolor |
||
| 629 | |||
| 651 | alone | 630 | nvfind_panel |
| 654 | alone | 631 | ld de,_CURSORCOLOR |
| 632 | call nvfind_printbigcursor |
||
| 651 | alone | 633 | nvfind_curtab=$+1 |
| 634 | ld a,0 |
||
| 635 | or a |
||
| 1167 | alone | 636 | ;jp z,nvfind_prcursearchfilename |
| 637 | jr nz,nvfind_prcursearchtext |
||
| 651 | alone | 638 | nvfind_prcursearchfilename |
| 639 | ld de,0x0100 |
||
| 1167 | alone | 640 | ;push de |
| 889 | alone | 641 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 642 | ld c,0 ;x |
| 643 | ld hl,cursearchfilename |
||
| 644 | call prtext |
||
| 1167 | alone | 645 | jp clearrestofline |
| 646 | ;call nvfind_getx |
||
| 647 | ;pop de |
||
| 648 | ;ld e,a |
||
| 649 | ;call nv_setxy ;keeps de,hl,ix |
||
| 650 | ;ret |
||
| 651 | alone | 651 | nvfind_prcursearchtext |
| 652 | ld de,0x0300 |
||
| 1167 | alone | 653 | ;push de |
| 889 | alone | 654 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 655 | ld c,0 ;x |
| 656 | ld hl,cursearchtext |
||
| 657 | call prtext |
||
| 1167 | alone | 658 | jp clearrestofline |
| 651 | alone | 659 | |
| 660 | nvfind_reprintmenu |
||
| 841 | alone | 661 | if PRSTDIO |
| 651 | alone | 662 | ld de,0 |
| 889 | alone | 663 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 664 | CLS_ |
| 841 | alone | 665 | else |
| 666 | ld de,_COLOR |
||
| 667 | OS_CLS |
||
| 668 | endif |
||
| 651 | alone | 669 | |
| 670 | ld de,0x0000 |
||
| 889 | alone | 671 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 672 | ld c,0 ;x |
| 673 | ld hl,tsearchfilename |
||
| 674 | call prtext |
||
| 675 | call nvfind_prcursearchfilename |
||
| 676 | |||
| 677 | ld de,0x0200 |
||
| 889 | alone | 678 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 679 | ld c,0 ;x |
| 680 | ld hl,tsearchtext |
||
| 681 | call prtext |
||
| 682 | call nvfind_prcursearchtext |
||
| 683 | |||
| 684 | ld de,0x0400 |
||
| 889 | alone | 685 | call nv_setxy ;keeps de,hl,ix |
| 651 | alone | 686 | ld c,0 ;x |
| 687 | ld hl,tresults |
||
| 688 | call prtext |
||
| 654 | alone | 689 | |
| 690 | ld hl,FOUNDFILESTABLE |
||
| 691 | ld a,(nvfind_curfoundfiles) |
||
| 692 | nvfind_reprintmenu_files0 |
||
| 693 | or a |
||
| 694 | ret z |
||
| 695 | push af |
||
| 696 | push hl |
||
| 697 | call prcrlf |
||
| 698 | pop hl |
||
| 699 | push hl |
||
| 700 | ld c,0 ;x |
||
| 701 | call prtext |
||
| 702 | pop hl |
||
| 703 | ld bc,FOUNDFILESFNSZ |
||
| 704 | add hl,bc |
||
| 705 | pop af |
||
| 706 | dec a |
||
| 707 | jr nvfind_reprintmenu_files0 |
||
| 708 | |||
| 709 | nvfind_freepg |
||
| 710 | findpg=$+1 |
||
| 711 | ld e,0 |
||
| 712 | OS_DELPAGE |
||
| 651 | alone | 713 | ret |
| 714 | |||
| 656 | alone | 715 | strfindeol |
| 716 | xor a |
||
| 717 | ld b,a |
||
| 718 | ld c,a |
||
| 719 | cpir |
||
| 720 | dec hl |
||
| 721 | ret |
||
| 722 | |||
| 651 | alone | 723 | tsearchfilename |
| 724 | db "Search filename:",0 |
||
| 725 | |||
| 726 | cursearchfilename |
||
| 727 | ds MAXSEARCHFILENAME+1 |
||
| 728 | |||
| 729 | tsearchtext |
||
| 730 | db "Search text:",0 |
||
| 731 | |||
| 732 | tresults |
||
| 733 | db "Results:",0 |
||
| 734 | |||
| 735 | cursearchtext |
||
| 736 | ds MAXSEARCHTEXT+1 |
||
| 737 | |||
| 656 | alone | 738 | nvfind_curpath |
| 739 | ds MAXPATH_sz |
||
| 653 | alone | 740 |