diff options
Diffstat (limited to 'v2.0/source/COPY.ASM')
| -rw-r--r-- | v2.0/source/COPY.ASM | 579 |
1 files changed, 579 insertions, 0 deletions
diff --git a/v2.0/source/COPY.ASM b/v2.0/source/COPY.ASM new file mode 100644 index 0000000..0456a4f --- /dev/null +++ b/v2.0/source/COPY.ASM | |||
| @@ -0,0 +1,579 @@ | |||
| 1 | TITLE COMMAND COPY routines. | ||
| 2 | |||
| 3 | INCLUDE COMSW.ASM | ||
| 4 | |||
| 5 | .xlist | ||
| 6 | .xcref | ||
| 7 | INCLUDE DOSSYM.ASM | ||
| 8 | INCLUDE DEVSYM.ASM | ||
| 9 | INCLUDE COMSEG.ASM | ||
| 10 | .list | ||
| 11 | .cref | ||
| 12 | |||
| 13 | INCLUDE COMEQU.ASM | ||
| 14 | |||
| 15 | DATARES SEGMENT PUBLIC | ||
| 16 | EXTRN VERVAL:WORD | ||
| 17 | DATARES ENDS | ||
| 18 | |||
| 19 | TRANDATA SEGMENT PUBLIC | ||
| 20 | EXTRN BADARGS:BYTE,BADCD:BYTE,BADSWT:BYTE,COPIED_PRE:BYTE | ||
| 21 | EXTRN COPIED_POST:BYTE | ||
| 22 | EXTRN INBDEV:BYTE,OVERWR:BYTE,FULDIR:BYTE,LOSTERR:BYTE | ||
| 23 | EXTRN NOSPACE:BYTE,DEVWMES:BYTE,NOTFND:BYTE | ||
| 24 | TRANDATA ENDS | ||
| 25 | |||
| 26 | TRANSPACE SEGMENT PUBLIC | ||
| 27 | EXTRN MELCOPY:BYTE,SRCPT:WORD,MELSTART:WORD,SCANBUF:BYTE | ||
| 28 | EXTRN DESTFCB2:BYTE,SDIRBUF:BYTE,SRCTAIL:WORD,CFLAG:BYTE | ||
| 29 | EXTRN NXTADD:WORD,DESTCLOSED:BYTE,ALLSWITCH:WORD,ARGC:BYTE | ||
| 30 | EXTRN PLUS:BYTE,BINARY:BYTE,ASCII:BYTE,FILECNT:WORD | ||
| 31 | EXTRN WRITTEN:BYTE,CONCAT:BYTE,DESTBUF:BYTE,SRCBUF:BYTE | ||
| 32 | EXTRN SDIRBUF:BYTE,DIRBUF:BYTE,DESTFCB:BYTE,FRSTSRCH:BYTE | ||
| 33 | EXTRN FIRSTDEST:BYTE,DESTISDIR:BYTE,DESTSWITCH:WORD,STARTEL:WORD | ||
| 34 | EXTRN DESTTAIL:WORD,DESTSIZ:BYTE,DESTINFO:BYTE,INEXACT:BYTE | ||
| 35 | EXTRN CURDRV:BYTE,DESTVARS:BYTE,RESSEG:WORD,SRCSIZ:BYTE | ||
| 36 | EXTRN SRCINFO:BYTE,SRCVARS:BYTE,USERDIR1:BYTE,NOWRITE:BYTE | ||
| 37 | EXTRN RDEOF:BYTE,SRCHAND:WORD,CPDATE:WORD,CPTIME:WORD | ||
| 38 | EXTRN SRCISDEV:BYTE,BYTCNT:WORD,TPA:WORD,TERMREAD:BYTE | ||
| 39 | EXTRN DESTHAND:WORD,DESTISDEV:BYTE,DIRCHAR:BYTE | ||
| 40 | TRANSPACE ENDS | ||
| 41 | |||
| 42 | |||
| 43 | ; ************************************************** | ||
| 44 | ; COPY CODE | ||
| 45 | ; | ||
| 46 | |||
| 47 | TRANCODE SEGMENT PUBLIC BYTE | ||
| 48 | |||
| 49 | EXTRN RESTUDIR:NEAR,CERROR:NEAR,SWITCH:NEAR,DISP32BITS:NEAR | ||
| 50 | EXTRN PRINT:NEAR,TCOMMAND:NEAR,ZPRINT:NEAR,ONESPC:NEAR | ||
| 51 | EXTRN RESTUDIR1:NEAR,FCB_TO_ASCZ:NEAR,CRLF2:NEAR,SAVUDIR1:NEAR | ||
| 52 | EXTRN SETREST1:NEAR,BADCDERR:NEAR,STRCOMP:NEAR,DELIM:NEAR | ||
| 53 | EXTRN UPCONV:NEAR,PATHCHRCMP:NEAR,SCANOFF:NEAR | ||
| 54 | |||
| 55 | EXTRN CPARSE:NEAR | ||
| 56 | |||
| 57 | EXTRN SEARCH:NEAR,SEARCHNEXT:NEAR,DOCOPY:NEAR,CLOSEDEST:NEAR | ||
| 58 | EXTRN FLSHFIL:NEAR,SETASC:NEAR,BUILDNAME:NEAR,COPERR:NEAR | ||
| 59 | |||
| 60 | PUBLIC COPY,BUILDPATH,COMPNAME,ENDCOPY | ||
| 61 | |||
| 62 | |||
| 63 | ASSUME CS:TRANGROUP,DS:TRANGROUP,ES:TRANGROUP,SS:NOTHING | ||
| 64 | |||
| 65 | DOMELCOPY: | ||
| 66 | cmp [MELCOPY],0FFH | ||
| 67 | jz CONTMEL | ||
| 68 | mov SI,[SRCPT] | ||
| 69 | mov [MELSTART],si | ||
| 70 | mov [MELCOPY],0FFH | ||
| 71 | CONTMEL: | ||
| 72 | xor BP,BP | ||
| 73 | mov si,[SRCPT] | ||
| 74 | mov bl,'+' | ||
| 75 | SCANSRC2: | ||
| 76 | mov di,OFFSET TRANGROUP:SCANBUF | ||
| 77 | call CPARSE | ||
| 78 | test bh,80H | ||
| 79 | jz NEXTMEL ; Go back to start | ||
| 80 | test bh,1 ; Switch ? | ||
| 81 | jnz SCANSRC2 ; Yes | ||
| 82 | call SOURCEPROC | ||
| 83 | call RESTUDIR1 | ||
| 84 | mov di,OFFSET TRANGROUP:DESTFCB2 | ||
| 85 | mov ax,PARSE_FILE_DESCRIPTOR SHL 8 | ||
| 86 | INT int_command | ||
| 87 | mov bx,OFFSET TRANGROUP:SDIRBUF + 1 | ||
| 88 | mov si,OFFSET TRANGROUP:DESTFCB2 + 1 | ||
| 89 | mov di,[SRCTAIL] | ||
| 90 | call BUILDNAME | ||
| 91 | jmp MELDO | ||
| 92 | |||
| 93 | |||
| 94 | NEXTMEL: | ||
| 95 | call CLOSEDEST | ||
| 96 | xor ax,ax | ||
| 97 | mov [CFLAG],al | ||
| 98 | mov [NXTADD],ax | ||
| 99 | mov [DESTCLOSED],al | ||
| 100 | mov si,[MELSTART] | ||
| 101 | mov [SRCPT],si | ||
| 102 | call SEARCHNEXT | ||
| 103 | jz SETNMELJ | ||
| 104 | jmp ENDCOPY2 | ||
| 105 | SETNMELJ: | ||
| 106 | jmp SETNMEL | ||
| 107 | |||
| 108 | COPY: | ||
| 109 | ; First order of buisness is to find out about the destination | ||
| 110 | ASSUME DS:TRANGROUP,ES:TRANGROUP | ||
| 111 | xor ax,ax | ||
| 112 | mov [ALLSWITCH],AX ; no switches | ||
| 113 | mov [ARGC],al ; no arguments | ||
| 114 | mov [PLUS],al ; no concatination | ||
| 115 | mov [BINARY],al ; Binary not specifically specified | ||
| 116 | mov [ASCII],al ; ASCII not specifically specified | ||
| 117 | mov [FILECNT],ax ; No files yet | ||
| 118 | mov [WRITTEN],al ; Nothing written yet | ||
| 119 | mov [CONCAT],al ; No concatination | ||
| 120 | mov [MELCOPY],al ; Not a Mel Hallerman copy | ||
| 121 | mov word ptr [SCANBUF],ax ; Init buffer | ||
| 122 | mov word ptr [DESTBUF],ax ; Init buffer | ||
| 123 | mov word ptr [SRCBUF],ax ; Init buffer | ||
| 124 | mov word ptr [SDIRBUF],ax ; Init buffer | ||
| 125 | mov word ptr [DIRBUF],ax ; Init buffer | ||
| 126 | mov word ptr [DESTFCB],ax ; Init buffer | ||
| 127 | dec ax | ||
| 128 | mov [FRSTSRCH],al ; First search call | ||
| 129 | mov [FIRSTDEST],al ; First time | ||
| 130 | mov [DESTISDIR],al ; Don't know about dest | ||
| 131 | mov si,81H | ||
| 132 | mov bl,'+' ; include '+' as a delimiter | ||
| 133 | DESTSCAN: | ||
| 134 | xor bp,bp ; no switches | ||
| 135 | mov di,offset trangroup:SCANBUF | ||
| 136 | call CPARSE | ||
| 137 | PUSHF ; save flags | ||
| 138 | test bh,80H ; A '+' argument? | ||
| 139 | jz NOPLUS ; no | ||
| 140 | mov [PLUS],1 ; yes | ||
| 141 | NOPLUS: | ||
| 142 | POPF ; get flags back | ||
| 143 | jc CHECKDONE ; Hit CR? | ||
| 144 | test bh,1 ; Switch? | ||
| 145 | jz TESTP2 ; no | ||
| 146 | or [DESTSWITCH],BP ; Yes, assume destination | ||
| 147 | or [ALLSWITCH],BP ; keep tabs on all switches | ||
| 148 | jmp short DESTSCAN | ||
| 149 | |||
| 150 | TESTP2: | ||
| 151 | test bh,80H ; Plus? | ||
| 152 | jnz GOTPLUS ; Yes, not a separate arg | ||
| 153 | inc [ARGC] ; found a real arg | ||
| 154 | GOTPLUS: | ||
| 155 | push SI | ||
| 156 | mov ax,[STARTEL] | ||
| 157 | mov SI,offset trangroup:SCANBUF ; Adjust to copy | ||
| 158 | sub ax,SI | ||
| 159 | mov DI,offset trangroup:DESTBUF | ||
| 160 | add ax,DI | ||
| 161 | mov [DESTTAIL],AX | ||
| 162 | mov [DESTSIZ],cl ; Save its size | ||
| 163 | inc cx ; Include the NUL | ||
| 164 | rep movsb ; Save potential destination | ||
| 165 | mov [DESTINFO],bh ; Save info about it | ||
| 166 | mov [DESTSWITCH],0 ; reset switches | ||
| 167 | pop SI | ||
| 168 | jmp short DESTSCAN ; keep going | ||
| 169 | |||
| 170 | CHECKDONE: | ||
| 171 | mov al,[PLUS] | ||
| 172 | mov [CONCAT],al ; PLUS -> Concatination | ||
| 173 | shl al,1 | ||
| 174 | shl al,1 | ||
| 175 | mov [INEXACT],al ; CONCAT -> inexact copy | ||
| 176 | mov dx,offset trangroup:BADARGS | ||
| 177 | mov al,[ARGC] | ||
| 178 | or al,al ; Good number of args? | ||
| 179 | jz CERROR4J ; no, not enough | ||
| 180 | cmp al,2 | ||
| 181 | jbe ACOUNTOK | ||
| 182 | CERROR4J: | ||
| 183 | jmp CERROR ; no, too many | ||
| 184 | ACOUNTOK: | ||
| 185 | mov bp,offset trangroup:DESTVARS | ||
| 186 | cmp al,1 | ||
| 187 | jnz GOT2ARGS | ||
| 188 | mov al,[CURDRV] ; Dest is default drive:*.* | ||
| 189 | add al,'A' | ||
| 190 | mov ah,':' | ||
| 191 | mov [bp.SIZ],2 | ||
| 192 | mov di,offset trangroup:DESTBUF | ||
| 193 | stosw | ||
| 194 | mov [DESTSWITCH],0 ; no switches on dest | ||
| 195 | mov [bp.INFO],2 ; Flag dest is ambig | ||
| 196 | mov [bp.ISDIR],0 ; Know destination specs file | ||
| 197 | call SETSTARS | ||
| 198 | GOT2ARGS: | ||
| 199 | cmp [bp.SIZ],2 | ||
| 200 | jnz NOTSHORTDEST | ||
| 201 | cmp [DESTBUF+1],':' | ||
| 202 | jnz NOTSHORTDEST ; Two char file name | ||
| 203 | or [bp.INFO],2 ; Know dest is d: | ||
| 204 | mov di,offset trangroup:DESTBUF + 2 | ||
| 205 | mov [bp.ISDIR],0 ; Know destination specs file | ||
| 206 | call SETSTARS | ||
| 207 | NOTSHORTDEST: | ||
| 208 | mov di,[bp.TTAIL] | ||
| 209 | cmp byte ptr [DI],0 | ||
| 210 | jnz CHKSWTCHES | ||
| 211 | mov dx,offset trangroup:BADCD | ||
| 212 | cmp byte ptr [DI-2],':' | ||
| 213 | jnz CERROR4J ; Trailing '/' error | ||
| 214 | mov [bp.ISDIR],2 ; Know destination is d:/ | ||
| 215 | or [bp.INFO],6 | ||
| 216 | call SETSTARS | ||
| 217 | CHKSWTCHES: | ||
| 218 | mov dx,offset trangroup:BADSWT | ||
| 219 | mov ax,[ALLSWITCH] | ||
| 220 | cmp ax,GOTSWITCH | ||
| 221 | jz CERROR4J ; Switch specified which is not known | ||
| 222 | |||
| 223 | ; Now know most of the information needed about the destination | ||
| 224 | |||
| 225 | TEST AX,VSWITCH ; Verify requested? | ||
| 226 | JZ NOVERIF ; No | ||
| 227 | MOV AH,GET_VERIFY_ON_WRITE | ||
| 228 | INT int_command ; Get current setting | ||
| 229 | PUSH DS | ||
| 230 | MOV DS,[RESSEG] | ||
| 231 | ASSUME DS:RESGROUP | ||
| 232 | XOR AH,AH | ||
| 233 | MOV [VERVAL],AX ; Save current setting | ||
| 234 | POP DS | ||
| 235 | ASSUME DS:TRANGROUP | ||
| 236 | MOV AX,(SET_VERIFY_ON_WRITE SHL 8) OR 1 ; Set verify | ||
| 237 | INT int_command | ||
| 238 | NOVERIF: | ||
| 239 | xor bp,bp ; no switches | ||
| 240 | mov si,81H | ||
| 241 | mov bl,'+' ; include '+' as a delimiter | ||
| 242 | SCANFSRC: | ||
| 243 | mov di,offset trangroup:SCANBUF | ||
| 244 | call CPARSE ; Parse first source name | ||
| 245 | test bh,1 ; Switch? | ||
| 246 | jnz SCANFSRC ; Yes, try again | ||
| 247 | or [DESTSWITCH],bp ; Include copy wide switches on DEST | ||
| 248 | test bp,BSWITCH | ||
| 249 | jnz NOSETCASC ; Binary explicit | ||
| 250 | cmp [CONCAT],0 | ||
| 251 | JZ NOSETCASC ; Not Concat | ||
| 252 | mov [ASCII],ASWITCH ; Concat -> ASCII copy if no B switch | ||
| 253 | NOSETCASC: | ||
| 254 | push SI | ||
| 255 | mov ax,[STARTEL] | ||
| 256 | mov SI,offset trangroup:SCANBUF ; Adjust to copy | ||
| 257 | sub ax,SI | ||
| 258 | mov DI,offset trangroup:SRCBUF | ||
| 259 | add ax,DI | ||
| 260 | mov [SRCTAIL],AX | ||
| 261 | mov [SRCSIZ],cl ; Save its size | ||
| 262 | inc cx ; Include the NUL | ||
| 263 | rep movsb ; Save this source | ||
| 264 | mov [SRCINFO],bh ; Save info about it | ||
| 265 | pop SI | ||
| 266 | mov ax,bp ; Switches so far | ||
| 267 | call SETASC ; Set A,B switches accordingly | ||
| 268 | call SWITCH ; Get any more switches on this arg | ||
| 269 | call SETASC ; Set | ||
| 270 | call FRSTSRC | ||
| 271 | jmp FIRSTENT | ||
| 272 | |||
| 273 | ENDCOPY: | ||
| 274 | CALL CLOSEDEST | ||
| 275 | ENDCOPY2: | ||
| 276 | MOV DX,OFFSET TRANGROUP:COPIED_PRE | ||
| 277 | CALL PRINT | ||
| 278 | MOV SI,[FILECNT] | ||
| 279 | XOR DI,DI | ||
| 280 | CALL DISP32BITS | ||
| 281 | MOV DX,OFFSET TRANGROUP:COPIED_POST | ||
| 282 | CALL PRINT | ||
| 283 | JMP TCOMMAND ; Stack could be messed up | ||
| 284 | |||
| 285 | SRCNONEXIST: | ||
| 286 | cmp [CONCAT],0 | ||
| 287 | jnz NEXTSRC ; If in concat mode, ignore error | ||
| 288 | mov dx,offset trangroup:SRCBUF | ||
| 289 | call zprint | ||
| 290 | CALL ONESPC | ||
| 291 | mov dx,offset trangroup:NOTFND | ||
| 292 | jmp COPERR | ||
| 293 | |||
| 294 | SOURCEPROC: | ||
| 295 | push SI | ||
| 296 | mov ax,[STARTEL] | ||
| 297 | mov SI,offset trangroup:SCANBUF ; Adjust to copy | ||
| 298 | sub ax,SI | ||
| 299 | mov DI,offset trangroup:SRCBUF | ||
| 300 | add ax,DI | ||
| 301 | mov [SRCTAIL],AX | ||
| 302 | mov [SRCSIZ],cl ; Save its size | ||
| 303 | inc cx ; Include the NUL | ||
| 304 | rep movsb ; Save this sorce | ||
| 305 | mov [SRCINFO],bh ; Save info about it | ||
| 306 | pop SI | ||
| 307 | mov ax,bp ; Switches so far | ||
| 308 | call SETASC ; Set A,B switches accordingly | ||
| 309 | call SWITCH ; Get any more switches on this arg | ||
| 310 | call SETASC ; Set | ||
| 311 | cmp [CONCAT],0 | ||
| 312 | jnz LEAVECFLAG ; Leave CFLAG if concatination | ||
| 313 | FRSTSRC: | ||
| 314 | xor ax,ax | ||
| 315 | mov [CFLAG],al ; Flag destination not created | ||
| 316 | mov [NXTADD],ax ; Zero out buffer | ||
| 317 | mov [DESTCLOSED],al ; Not created -> not closed | ||
| 318 | LEAVECFLAG: | ||
| 319 | mov [SRCPT],SI ; remember where we are | ||
| 320 | mov di,offset trangroup:USERDIR1 | ||
| 321 | mov bp,offset trangroup:SRCVARS | ||
| 322 | call BUILDPATH ; Figure out everything about the source | ||
| 323 | mov si,[SRCTAIL] ; Create the search FCB | ||
| 324 | return | ||
| 325 | |||
| 326 | NEXTSRC: | ||
| 327 | cmp [PLUS],0 | ||
| 328 | jnz MORECP | ||
| 329 | ENDCOPYJ2: | ||
| 330 | jmp ENDCOPY ; Done | ||
| 331 | MORECP: | ||
| 332 | xor bp,bp ; no switches | ||
| 333 | mov si,[SRCPT] | ||
| 334 | mov bl,'+' ; include '+' as a delimiter | ||
| 335 | SCANSRC: | ||
| 336 | mov di,offset trangroup:SCANBUF | ||
| 337 | call CPARSE ; Parse first source name | ||
| 338 | JC EndCopyJ2 ; if error, then end (trailing + case) | ||
| 339 | test bh,80H | ||
| 340 | jz ENDCOPYJ2 ; If no '+' we're done | ||
| 341 | test bh,1 ; Switch? | ||
| 342 | jnz SCANSRC ; Yes, try again | ||
| 343 | call SOURCEPROC | ||
| 344 | FIRSTENT: | ||
| 345 | mov di,FCB | ||
| 346 | mov ax,PARSE_FILE_DESCRIPTOR SHL 8 | ||
| 347 | INT int_command | ||
| 348 | mov ax,word ptr [SRCBUF] ; Get drive | ||
| 349 | cmp ah,':' | ||
| 350 | jz DRVSPEC1 | ||
| 351 | mov al,'@' | ||
| 352 | DRVSPEC1: | ||
| 353 | sub al,'@' | ||
| 354 | mov ds:[FCB],al | ||
| 355 | mov ah,DIR_SEARCH_FIRST | ||
| 356 | call SEARCH | ||
| 357 | pushf ; Save result of search | ||
| 358 | call RESTUDIR1 ; Restore users dir | ||
| 359 | popf | ||
| 360 | jz NEXTAMBIG0 | ||
| 361 | jmp SRCNONEXIST ; Failed | ||
| 362 | NEXTAMBIG0: | ||
| 363 | xor al,al | ||
| 364 | xchg al,[FRSTSRCH] | ||
| 365 | or al,al | ||
| 366 | jz NEXTAMBIG | ||
| 367 | SETNMEL: | ||
| 368 | mov cx,12 | ||
| 369 | mov di,OFFSET TRANGROUP:SDIRBUF | ||
| 370 | mov si,OFFSET TRANGROUP:DIRBUF | ||
| 371 | rep movsb ; Save very first source name | ||
| 372 | NEXTAMBIG: | ||
| 373 | xor al,al | ||
| 374 | mov [NOWRITE],al ; Turn off NOWRITE | ||
| 375 | mov di,[SRCTAIL] | ||
| 376 | mov si,offset trangroup:DIRBUF + 1 | ||
| 377 | call FCB_TO_ASCZ ; SRCBUF has complete name | ||
| 378 | MELDO: | ||
| 379 | cmp [CONCAT],0 | ||
| 380 | jnz SHOWCPNAM ; Show name if concat | ||
| 381 | test [SRCINFO],2 ; Show name if multi | ||
| 382 | jz DOREAD | ||
| 383 | SHOWCPNAM: | ||
| 384 | mov dx,offset trangroup:SRCBUF | ||
| 385 | call ZPRINT | ||
| 386 | call CRLF2 | ||
| 387 | DOREAD: | ||
| 388 | call DOCOPY | ||
| 389 | cmp [CONCAT],0 | ||
| 390 | jnz NODCLOSE ; If concat, do not close | ||
| 391 | call CLOSEDEST ; else close current destination | ||
| 392 | jc NODCLOSE ; Concat flag got set, close didn't really happen | ||
| 393 | mov [CFLAG],0 ; Flag destination not created | ||
| 394 | NODCLOSE: | ||
| 395 | cmp [CONCAT],0 ; Check CONCAT again | ||
| 396 | jz NOFLUSH | ||
| 397 | CALL FLSHFIL ; Flush output between source files on CONCAT | ||
| 398 | ; so LOSTERR stuff works correctly | ||
| 399 | TEST [MELCOPY],0FFH | ||
| 400 | jz NOFLUSH | ||
| 401 | jmp DOMELCOPY | ||
| 402 | |||
| 403 | NOFLUSH: | ||
| 404 | call SEARCHNEXT ; Try next match | ||
| 405 | jnz NEXTSRCJ ; Finished with this source spec | ||
| 406 | mov [DESTCLOSED],0 ; Not created or concat -> not closed | ||
| 407 | jmp NEXTAMBIG ; Do next ambig | ||
| 408 | |||
| 409 | NEXTSRCJ: | ||
| 410 | jmp NEXTSRC | ||
| 411 | |||
| 412 | |||
| 413 | |||
| 414 | BUILDPATH: | ||
| 415 | test [BP.INFO],2 | ||
| 416 | jnz NOTPFILE ; If ambig don't bother with open | ||
| 417 | mov dx,bp | ||
| 418 | add dx,BUF ; Set DX to spec | ||
| 419 | mov ax,OPEN SHL 8 | ||
| 420 | INT int_command | ||
| 421 | jc NOTPFILE | ||
| 422 | mov bx,ax ; Is pure file | ||
| 423 | mov ax,IOCTL SHL 8 | ||
| 424 | INT int_command | ||
| 425 | mov ah,CLOSE | ||
| 426 | INT int_command | ||
| 427 | test dl,devid_ISDEV | ||
| 428 | jnz ISADEV ; If device, done | ||
| 429 | test [BP.INFO],4 | ||
| 430 | jz ISSIMPFILE ; If no path seps, done | ||
| 431 | NOTPFILE: | ||
| 432 | mov dx,word ptr [BP.BUF] | ||
| 433 | cmp dh,':' | ||
| 434 | jz DRVSPEC5 | ||
| 435 | mov dl,'@' | ||
| 436 | DRVSPEC5: | ||
| 437 | sub dl,'@' ; A = 1 | ||
| 438 | call SAVUDIR1 | ||
| 439 | mov dx,bp | ||
| 440 | add dx,BUF ; Set DX for upcomming CHDIRs | ||
| 441 | mov bh,[BP.INFO] | ||
| 442 | and bh,6 | ||
| 443 | cmp bh,6 ; Ambig and path ? | ||
| 444 | jnz CHECKAMB ; jmp if no | ||
| 445 | mov si,[BP.TTAIL] | ||
| 446 | cmp byte ptr [si-2],':' | ||
| 447 | jnz KNOWNOTSPEC | ||
| 448 | mov [BP.ISDIR],2 ; Know is d:/file | ||
| 449 | jmp short DOPCDJ | ||
| 450 | |||
| 451 | KNOWNOTSPEC: | ||
| 452 | mov [BP.ISDIR],1 ; Know is path/file | ||
| 453 | dec si ; Point to the / | ||
| 454 | DOPCDJ: | ||
| 455 | jmp short DOPCD | ||
| 456 | |||
| 457 | CHECKAMB: | ||
| 458 | cmp bh,2 | ||
| 459 | jnz CHECKCD | ||
| 460 | ISSIMPFILE: | ||
| 461 | ISADEV: | ||
| 462 | mov [BP.ISDIR],0 ; Know is file since ambig but no path | ||
| 463 | return | ||
| 464 | |||
| 465 | CHECKCD: | ||
| 466 | call SETREST1 | ||
| 467 | mov ah,CHDIR | ||
| 468 | INT int_command | ||
| 469 | jc NOTPDIR | ||
| 470 | mov di,dx | ||
| 471 | xor ax,ax | ||
| 472 | mov cx,ax | ||
| 473 | dec cx | ||
| 474 | repne scasb | ||
| 475 | dec di | ||
| 476 | mov al,[DIRCHAR] | ||
| 477 | mov [bp.ISDIR],2 ; assume d:/file | ||
| 478 | cmp al,[di-1] | ||
| 479 | jz GOTSRCSLSH | ||
| 480 | stosb | ||
| 481 | mov [bp.ISDIR],1 ; know path/file | ||
| 482 | GOTSRCSLSH: | ||
| 483 | or [bp.INFO],6 | ||
| 484 | call SETSTARS | ||
| 485 | return | ||
| 486 | |||
| 487 | |||
| 488 | NOTPDIR: | ||
| 489 | mov [bp.ISDIR],0 ; assume pure file | ||
| 490 | mov bh,[bp.INFO] | ||
| 491 | test bh,4 | ||
| 492 | retz ; Know pure file, no path seps | ||
| 493 | mov [bp.ISDIR],2 ; assume d:/file | ||
| 494 | mov si,[bp.TTAIL] | ||
| 495 | cmp byte ptr [si],0 | ||
| 496 | jz BADCDERRJ2 ; Trailing '/' | ||
| 497 | cmp byte ptr [si],'.' | ||
| 498 | jz BADCDERRJ2 ; If . or .. pure cd should have worked | ||
| 499 | cmp byte ptr [si-2],':' | ||
| 500 | jz DOPCD ; Know d:/file | ||
| 501 | mov [bp.ISDIR],1 ; Know path/file | ||
| 502 | dec si ; Point at last '/' | ||
| 503 | DOPCD: | ||
| 504 | xor bl,bl | ||
| 505 | xchg bl,[SI] ; Stick in a NUL | ||
| 506 | call SETREST1 | ||
| 507 | mov ah,CHDIR | ||
| 508 | INT int_command | ||
| 509 | xchg bl,[SI] | ||
| 510 | retnc | ||
| 511 | BADCDERRJ2: | ||
| 512 | JMP BADCDERR | ||
| 513 | |||
| 514 | SETSTARS: | ||
| 515 | mov [bp.TTAIL],DI | ||
| 516 | add [bp.SIZ],12 | ||
| 517 | mov ax,('.' SHL 8) OR '?' | ||
| 518 | mov cx,8 | ||
| 519 | rep stosb | ||
| 520 | xchg al,ah | ||
| 521 | stosb | ||
| 522 | xchg al,ah | ||
| 523 | mov cl,3 | ||
| 524 | rep stosb | ||
| 525 | xor al,al | ||
| 526 | stosb | ||
| 527 | return | ||
| 528 | |||
| 529 | |||
| 530 | COMPNAME: | ||
| 531 | PUSH CX | ||
| 532 | PUSH AX | ||
| 533 | MOV si,offset trangroup:SRCBUF | ||
| 534 | MOV di,offset trangroup:DESTBUF | ||
| 535 | MOV CL,[CURDRV] | ||
| 536 | MOV CH,CL | ||
| 537 | CMP BYTE PTR [SI+1],':' | ||
| 538 | JNZ NOSRCDRV | ||
| 539 | LODSW | ||
| 540 | SUB AL,'A' | ||
| 541 | MOV CL,AL | ||
| 542 | NOSRCDRV: | ||
| 543 | CMP BYTE PTR [DI+1],':' | ||
| 544 | JNZ NODSTDRV | ||
| 545 | MOV AL,[DI] | ||
| 546 | INC DI | ||
| 547 | INC DI | ||
| 548 | SUB AL,'A' | ||
| 549 | MOV CH,AL | ||
| 550 | NODSTDRV: | ||
| 551 | CMP CH,CL | ||
| 552 | jnz RET81P | ||
| 553 | call STRCOMP | ||
| 554 | jz RET81P | ||
| 555 | mov ax,[si-1] | ||
| 556 | mov cx,[di-1] | ||
| 557 | push ax | ||
| 558 | and al,cl | ||
| 559 | pop ax | ||
| 560 | jnz RET81P ; Niether of the mismatch chars was a NUL | ||
| 561 | ; Know one of the mismatch chars is a NUL | ||
| 562 | ; Check for ".NUL" compared with NUL | ||
| 563 | cmp al,'.' | ||
| 564 | jnz CHECKCL | ||
| 565 | or ah,ah | ||
| 566 | jmp short RET81P ; If NUL return match, else no match | ||
| 567 | CHECKCL: | ||
| 568 | cmp cl,'.' | ||
| 569 | jnz RET81P ; Mismatch | ||
| 570 | or ch,ch ; If NUL return match, else no match | ||
| 571 | RET81P: | ||
| 572 | POP AX | ||
| 573 | POP CX | ||
| 574 | return | ||
| 575 | |||
| 576 | TRANCODE ENDS | ||
| 577 | |||
| 578 | END | ||
| 579 | |||