8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 1 DOS 3.30 (038-N) 8086/87/88/186 MACRO ASSEMBLER V2.1 ASSEMBLY OF MODULE DOS_LIB OBJECT MODULE PLACED IN DOS_LIB.OBJ ASSEMBLER INVOKED BY: C:\SCA^\PLM86\ASM86.EXE DOS_LIB.ASM LOC OBJ LINE SOURCE 1 2 ; -------------------------PROGRAM IDENTIFIER--------------------------- 3 ; 4 ; Project : PLM86 5 ; 6 ; Program : DOS_LIB.ASM 7 ; 8 ; Purpose : DOS Interface Module 9 ; 10 ; Author : Mr S.C.Agate 11 ; 12 ; 13 ; Date Modification Details 14 ; ---- -------------------- 15 ; 16 ; 18-Sep-90 : Creation 17 ; 18 ; ---------------------------------------------------------------------- 19 ---- 20 date_and_time STRUC 0000 21 year DW ? ; 1980-2099 0002 22 month DB ? ; 1-12 0003 23 day DB ? ; 1-31 0004 24 dow DB ? ; 0=Su, 1=Mo, etc... 0005 25 hour DB ? ; 0-23 0006 26 minute DB ? ; 0-59 0007 27 second DB ? ; 0-59 0008 28 csecond DB ? ; 0-99 ---- 29 date_and_time ENDS 30 31 NAME dos_lib 32 0000 33 gchr EQU 00H 000E 34 pchr EQU 0EH 002C 35 gtime EQU 2CH 002A 36 gdate EQU 2AH 37 38 PUBLIC asm_get_chr 39 PUBLIC asm_put_chr 40 PUBLIC asm_get_date 41 PUBLIC asm_get_time 42 43 PUBLIC asm_openf 44 PUBLIC asm_rd_chrs 45 PUBLIC asm_wr_chrs 46 PUBLIC asm_set_loc 47 PUBLIC asm_closef 48 49 PUBLIC asm_dfile 50 PUBLIC asm_rfile 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 2 LOC OBJ LINE SOURCE 51 PUBLIC asm_cfile 52 53 PUBLIC asm_get_attrib ;Untested 54 PUBLIC asm_set_attrib ;Untested 55 56 PUBLIC asm_mkdir ;Untested 57 PUBLIC asm_rmdir ;Untested 58 PUBLIC asm_get_dir ;Untested 59 PUBLIC asm_set_dir ;Untested 60 61 62 63 ---- 64 code SEGMENT BYTE PUBLIC 'code' 65 ASSUME CS:code, SS:stack 66 0000 67 asm_get_chr PROC NEAR ;Return keyboard char in AX 0000 B400 68 MOV AH,gchr 0002 CD16 69 INT 16H 0004 C3 70 RET 71 asm_get_chr ENDP 72 0005 73 asm_put_chr PROC NEAR ;Print to screen param 0005 55 74 PUSH BP 0006 8BEC 75 MOV BP,SP 0008 8A4604 76 MOV AL,BYTE PTR [BP+4] 000B B40E 77 MOV AH,pchr 000D CD10 78 INT 10H 000F 5D 79 POP BP 0010 C20200 80 RET 2H 81 asm_put_chr ENDP 82 0013 83 asm_get_time PROC NEAR ;Fill struc with time 0013 55 84 PUSH BP 0014 8BEC 85 MOV BP,SP 0016 B42C 86 MOV AH,gtime 0018 CD21 87 INT 21H 001A 8B6E04 88 MOV BP,WORD PTR [BP+4] 001D 3E885608 89 MOV DS:csecond[BP],DL 0021 3E887607 90 MOV DS:second[BP],DH 0025 3E884E06 91 MOV DS:minute[BP],CL 0029 3E886E05 92 MOV DS:hour[BP],CH 002D 5D 93 POP BP 002E C20200 94 RET 2H 95 asm_get_time ENDP 96 0031 97 asm_get_date PROC NEAR ;Fill struc with date 0031 55 98 PUSH BP 0032 8BEC 99 MOV BP,SP 0034 B42A 100 MOV AH,gdate 0036 CD21 101 INT 21H 0038 8B6E04 102 MOV BP,WORD PTR [BP+4] 003B 3E884604 103 MOV DS:dow[BP],AL 003F 3E885603 104 MOV DS:day[BP],DL 0043 3E887602 105 MOV DS:month[BP],DH 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 3 LOC OBJ LINE SOURCE 0047 3E894E00 106 MOV DS:year[BP],CX 004B 5D 107 POP BP 004C C20200 108 RET 2H 109 asm_get_date ENDP 110 004F 111 asm_openf PROC NEAR 112 ;Open file (handle) 113 ; 114 ;Enter: AH = 3DH 115 ; AL = Access code 116 ; 00 - Read 117 ; 01 - Write 118 ; 02 - R&W 119 ; DS:DX = ASCIIZ pointer to filename 120 ; 121 ;Exit: C Clear - AX = File handle 122 ; C Set - AX = Error code 123 ; 1 - invalid function 124 ; 2 - file not found 125 ; 3 - path not found 126 ; 4 - no handles available 127 ; 5 - access denied 128 ; C - invalid access code 129 ; 130 ;Usage: Can open file in any directory or drive. 131 ; 004F 55 132 PUSH BP 0050 8BEC 133 MOV BP,SP 0052 B43D 134 MOV AH,3DH 0054 8A4606 135 MOV AL,BYTE PTR [BP+6] ;Access code 0057 8B5608 136 MOV DX,WORD PTR [BP+8] ;Pointer to ASCIIZ 005A CD21 137 INT 21H ;AX=Handle or Error code 005C 8B6E04 138 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 005F 3EC746000000 139 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 0065 7304 140 JNC asm_openf_ok 0067 3E894600 141 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 006B 5D 142 asm_openf_ok: POP BP 006C C20600 143 RET 6H 144 asm_openf ENDP 145 006F 146 asm_rd_chrs PROC NEAR 147 ;Read from file (handle) 148 ;File pointer is moved to next byte 149 ; 150 ;Enter: AH = 3FH 151 ; BX = File handle 152 ; CX = Number of bytes 153 ; DS:DX = Pointer to buffer 154 ; 155 ;Exit: C Clear - AX = Number of bytes read (past EOF?) 156 ; C Set - AX = Error code 157 ; 0 - EOF 158 ; 5 - access denied 159 ; 6 - invalid handle 006F 55 160 PUSH BP 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 4 LOC OBJ LINE SOURCE 0070 8BEC 161 MOV BP,SP 0072 B43F 162 MOV AH,3FH 0074 8B5E0A 163 MOV BX,WORD PTR [BP+10] ;File handle 0077 8B4E06 164 MOV CX,WORD PTR [BP+6] ;Number of bytes 007A 8B5608 165 MOV DX,WORD PTR [BP+8] ;Pointer 007D CD21 166 INT 21H ;AX=Length or Error code 007F 8B6E04 167 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 0082 3EC746000000 168 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 0088 7304 169 JNC asm_rd_chrs_ok 008A 3E894600 170 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 008E 5D 171 asm_rd_chrs_ok: POP BP 008F C20800 172 RET 8H 173 asm_rd_chrs ENDP 174 0092 175 asm_wr_chrs PROC NEAR 176 ;Write to file (handle) 177 ;File pointer is moved to next byte 178 ; 179 ;Enter: AH = 40H 180 ; BX = File handle 181 ; CX = Number of bytes 182 ; DS:DX = Pointer to buffer 183 ; 184 ;Exit: C Clear - AX = Number of bytes written (disc full?) 185 ; C Set - AX = Error code 186 ; 5 - access denied 187 ; 6 - invalid handle 188 ; 189 ;Usage: If CX is zero, file size is set to the current locn. 190 ; 0092 55 191 PUSH BP 0093 8BEC 192 MOV BP,SP 0095 B440 193 MOV AH,40H 0097 8B5E0A 194 MOV BX,WORD PTR [BP+10] ;File handle 009A 8B4E06 195 MOV CX,WORD PTR [BP+6] ;Number of bytes 009D 8B5608 196 MOV DX,WORD PTR [BP+8] ;Pointer 00A0 CD21 197 INT 21H ;AX=Length or Error code 00A2 8B6E04 198 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 00A5 3EC746000000 199 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 00AB 7304 200 JNC asm_wr_chrs_ok 00AD 3E894600 201 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 00B1 5D 202 asm_wr_chrs_ok: POP BP 00B2 C20800 203 RET 8H 204 asm_wr_chrs ENDP 205 00B5 206 asm_set_loc PROC NEAR 207 ;Set pointer into file (handle) 208 ; 209 ;Enter: AH = 42H 210 ; AL = Access mode 211 ; 00 - Offset from Beginning 212 ; 01 - Offset from Current Loc 213 ; 02 - Offset from End 214 ; BX = Handle 215 ; CX:DX = Offset 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 5 LOC OBJ LINE SOURCE 216 ; 217 ;Exit: C Clear - DX:AX = New location in file 218 ; C Set - AX = Error code 219 ; 1 - invalid function 220 ; 6 - invalid handle 221 ; 222 ;Usage: Set Offset=0 and CX:DX to zero to return LOF in bytes. 223 ; Next write will then be to past existing EOF 224 ; 00B5 55 225 PUSH BP 00B6 8BEC 226 MOV BP,SP 00B8 B442 227 MOV AH,42H 00BA 8A460A 228 MOV AL,BYTE PTR [BP+10] ;File access mode 00BD 8B5E0C 229 MOV BX,WORD PTR [BP+12] ;Handle 00C0 8B4E08 230 MOV CX,WORD PTR [BP+8] ;Offset High 00C3 8B5606 231 MOV DX,WORD PTR [BP+6] ;Offset Low 00C6 CD21 232 INT 21H ;AX=Length or Error code 00C8 8B6E04 233 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 00CB 3EC746000000 234 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 00D1 7304 235 JNC asm_set_loc_ok 00D3 3E894600 236 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 00D7 5D 237 asm_set_loc_ok: POP BP 00D8 C20A00 238 RET 0AH 239 asm_set_loc ENDP 240 00DB 241 asm_closef PROC NEAR 242 ;Close file (handle) 243 ; 244 ;Enter: AH = 3EH 245 ; BX = File handle 246 ; 247 ;Exit: C Clear - File closed OK 248 ; C Set - AX = Error code 249 ; 6 - invalid handle 00DB 55 250 PUSH BP 00DC 8BEC 251 MOV BP,SP 00DE B43E 252 MOV AH,3EH 00E0 8B5E06 253 MOV BX,WORD PTR [BP+6] ;Handle 00E3 CD21 254 INT 21H ;AX=Error code 00E5 8B6E04 255 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 00E8 3EC746000000 256 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 00EE 7304 257 JNC asm_closef_ok 00F0 3E894600 258 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 00F4 5D 259 asm_closef_ok: POP BP 00F5 C20400 260 RET 4H 261 asm_closef ENDP 262 00F8 263 asm_dfile PROC NEAR 264 ;Delete file 265 ; 266 ;Enter: AH = 41H 267 ; DS:DX = Pointer to ASCIIZ 268 ; 269 ;Exit: C Clear - File deleted OK 270 ; C Set - AX = Error code 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 6 LOC OBJ LINE SOURCE 271 ; 2 - File not found 272 ; 5 - Access denied 273 ; 274 ;Usage: No wild cards, but can access other dirs and drives. 275 ; Access denied if R/O file. 276 ; 00F8 55 277 PUSH BP 00F9 8BEC 278 MOV BP,SP 00FB B441 279 MOV AH,41H 00FD 8B5606 280 MOV DX,WORD PTR [BP+6] ;Pointer to ASCIIZ 0100 CD21 281 INT 21H ;AX=Error code 0102 8B6E04 282 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 0105 3EC746000000 283 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 010B 7304 284 JNC asm_dfile_ok 010D 3E894600 285 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 0111 5D 286 asm_dfile_ok: POP BP 0112 C20400 287 RET 4H 288 asm_dfile ENDP 289 0115 290 asm_rfile PROC NEAR 291 ;Rename file 292 ; 293 ;Enter: AH = 56H 294 ; DS:DX = Pointer to present ASCIIZ filename 295 ; ES:DI = Pointer to new ASCIIZ filename 296 ; 297 ;Exit: C Clear - File renamed OK 298 ; C Set - AX = Error code 299 ; 02H - file not found 300 ; 03H - path not found 301 ; 05H - access denied 302 ; 11H - not same device 303 ; 304 ;Usage: No wild cards allowed. 305 ; Can move file between directories, but not drives. 306 ; 0115 55 307 PUSH BP 0116 8BEC 308 MOV BP,SP 0118 8CD8 309 MOV AX,DS 011A 8EC0 310 MOV ES,AX 011C B456 311 MOV AH,56H 011E 8B5608 312 MOV DX,WORD PTR [BP+8] ;Pointer to ASCIIZ old name 0121 8B7E06 313 MOV DI,WORD PTR [BP+6] ;Pointer to ASCIIZ new name 0124 CD21 314 INT 21H ;AX=Error code 0126 8B6E04 315 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 0129 3EC746000000 316 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 012F 7304 317 JNC asm_rfile_ok 0131 3E894600 318 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 0135 5D 319 asm_rfile_ok: POP BP 0136 C20600 320 RET 6H 321 asm_rfile ENDP 322 0139 323 asm_cfile PROC NEAR 324 ;Create file, or truncate to zero (handle) 325 ; 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 7 LOC OBJ LINE SOURCE 326 ;Enter: AH = 3CH 327 ; CX = File attribute required 328 ; Bit 1 - Set if hidden reqd 329 ; Bit 2 - Set is system reqd 330 ; All other bits zero 331 ; DS:DX = ASCIIZ pointer to filename 332 ; 333 ;Exit: C Clear - AX = File handle 334 ; C Set - AX = Error code 335 ; 3 - path not found 336 ; 4 - no handles available 337 ; 5 - access denied 338 ; 339 ;Usage: Can make file in any directory or drive. 340 ; 0139 55 341 PUSH BP 013A 8BEC 342 MOV BP,SP 013C B43C 343 MOV AH,3CH 013E 8A4E06 344 MOV CL,BYTE PTR [BP+6] ;Access code 0141 B500 345 MOV CH,0H 0143 8B5608 346 MOV DX,WORD PTR [BP+8] ;Pointer to ASCIIZ 0146 CD21 347 INT 21H ;AX=Handle or Error code 0148 8B6E04 348 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 014B 3EC746000000 349 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 0151 7304 350 JNC asm_cfile_ok 0153 3E894600 351 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 0157 5D 352 asm_cfile_ok: POP BP 0158 C20600 353 RET 6H 354 asm_cfile ENDP 355 015B 356 asm_get_attrib PROC NEAR 357 ;Get attributes for a file (handle) 358 ; 359 ;Enter: AH = 43H 360 ; AL = 00H 361 ; DS:DX = ASCIIZ pointer to filename 362 ; 363 ;Exit: C Clear - AX = Attribute byte 364 ; Bit 0 = R/O 365 ; 1 = Hidden 366 ; 2 = System 367 ; 3 = Volume label 368 ; 4 = Directory 369 ; 5 = Archive 370 ; C Set - AX = Error code 371 ; 01 - invalid function 372 ; 02 - file not found 373 ; 03 - path not found 374 ; 05 - access denied 375 ; 376 ;Usage: volume label & subdirectories ??? 377 ; 015B 55 378 PUSH BP 015C 8BEC 379 MOV BP,SP 015E B443 380 MOV AH,43H 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 8 LOC OBJ LINE SOURCE 0160 B000 381 MOV AL,00H 0162 8B5606 382 MOV DX,WORD PTR [BP+6] ;Pointer to ASCIIZ 0165 CD21 383 INT 21H ;AX=Handle or Error code 0167 8B6E04 384 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 016A 3EC746000000 385 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 0170 7304 386 JNC asm_get_a_ok 0172 3E894600 387 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 0176 5D 388 asm_get_a_ok: POP BP 0177 C20400 389 RET 4H 390 asm_get_attrib ENDP 391 017A 392 asm_set_attrib PROC NEAR 393 ;Set attributes for a file (handle) 394 ; 395 ;Enter: AH = 43H 396 ; AL = 01H 397 ; CX = Attribute byte (only these 4 allowed) 398 ; Bit 0 = R/O 399 ; 1 = Hidden 400 ; 2 = System 401 ; 5 = Arch 402 ; DS:DX = ASCIIZ pointer to filename 403 ; 404 ;Exit: C Clear - CX = Attribute byte 405 ; Bit 0 = R/O 406 ; 1 = Hidden 407 ; 2 = System 408 ; 3 = Volume label 409 ; 4 = Directory 410 ; 5 = Archive 411 ; C Set - AX = Error code 412 ; 01 - invalid function 413 ; 02 - file not found 414 ; 03 - path not found 415 ; 05 - access denied 416 ; 417 ;Usage: volume label & subdirectories ??? 418 ; 017A 55 419 PUSH BP 017B 8BEC 420 MOV BP,SP 017D B443 421 MOV AH,43H 017F B000 422 MOV AL,00H 0181 8B5608 423 MOV DX,WORD PTR [BP+8] ;Pointer to ASCIIZ 0184 8A4E06 424 MOV CL,BYTE PTR [BP+6] ;???????????????? word OR byte 0187 B90000 425 MOV CX,0 ;???????????????? DITTO GET A 018A CD21 426 INT 21H ;AX=Handle or Error code 018C 8B6E04 427 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 018F 3EC746000000 428 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 0195 7304 429 JNC asm_set_a_ok 0197 3E894600 430 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 019B 5D 431 asm_set_a_ok: POP BP 019C C20600 432 RET 6H 433 asm_set_attrib ENDP 434 019F 435 asm_get_fdt PROC NEAR ;Files date and time 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 9 LOC OBJ LINE SOURCE 436 ;ah=57h 437 ;al=00 438 ;bx=handle 439 ; 440 ;carry clear - ok 441 ; cx=time 442 ; dx=date 443 ;carry set - ax = error code 444 ; 01 - invalid function 445 ; 06 - invalid handle 446 ; 447 ;time: bits 0-4 seconds/2 448 ; 5-a minutes 449 ; b-f hours 450 ;date: bits 0-4 day 451 ; 5-8 month 452 ; 8-f year (from 1980) 453 asm_get_fdt ENDP 454 019F 455 asm_set_fdt PROC NEAR 456 ;ah=57h 457 ;al=00 458 ;bx=handle 459 ; 460 ;carry clear - ok 461 ; cx=time 462 ; dx=date 463 ;carry set - ax = error code 464 ; 01 - invalid function 465 ; 06 - invalid handle 466 ; 467 ;for strucure see asm_set_fdt 468 asm_set_fdt ENDP 469 019F 470 asm_mkdir PROC NEAR 471 ;Make directory 472 ; 473 ;Enter: AH = 39H 474 ; DS:DX = Pointer to ASCIIZ 475 ; 476 ;Exit: C Clear - Directroy created OK 477 ; C Set - AX = Error code 478 ; 3 - Path not found 479 ; 5 - Access denied 480 ; 481 ;Usage: Can be used to create directories on other drives? 482 ; Access denied if directory exists or path not found. 483 ; 019F 55 484 PUSH BP 01A0 8BEC 485 MOV BP,SP 01A2 B439 486 MOV AH,39H 01A4 8B5606 487 MOV DX,WORD PTR [BP+6] ;Pointer to ASCIIZ 01A7 CD21 488 INT 21H ;AX=Error code 01A9 8B6E04 489 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 01AC 3EC746000000 490 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 10 LOC OBJ LINE SOURCE 01B2 7304 491 JNC asm_mkdir_ok 01B4 3E894600 492 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 01B8 5D 493 asm_mkdir_ok: POP BP 01B9 C20400 494 RET 4H 495 asm_mkdir ENDP 496 01BC 497 asm_rmdir PROC NEAR 498 ;Remove directory 499 ; 500 ;Enter: AH = 3AH 501 ; DS:DX = Pointer to ASCIIZ 502 ; 503 ;Exit: C Clear - Directroy removed OK 504 ; C Set - AX = Error code 505 ; 03H - Path not found 506 ; 05H - Access denied 507 ; 10H - Current Dir 508 ; 509 ;Usage: Can be used to remove directories on other drives? 510 ; Access denied if specified directory is current or 511 ; if it does not exist. 512 ; 01BC 55 513 PUSH BP 01BD 8BEC 514 MOV BP,SP 01BF B43A 515 MOV AH,3AH 01C1 8B5606 516 MOV DX,WORD PTR [BP+6] ;Pointer to ASCIIZ 01C4 CD21 517 INT 21H ;AX=Error code 01C6 8B6E04 518 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 01C9 3EC746000000 519 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 01CF 7304 520 JNC asm_rmdir_ok 01D1 3E894600 521 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 01D5 5D 522 asm_rmdir_ok: POP BP 01D6 C20400 523 RET 4H 524 asm_rmdir ENDP 525 01D9 526 asm_get_dir PROC NEAR 527 ;Get directory 528 ; 529 ;Enter: AH = 47H 530 ; DL = Drive (0=Default, 1=A, 2=B, etc) 531 ; DS:SI = Pointer to buffet to fill (65 chars max) 532 ; 533 ;Exit: C Clear - Buffer filled with ASCIIZ 534 ; C Set - AX = Error code 535 ; 0FH - Invalid drive 536 ; 537 ;Usage: Can be used to get current dir for other drives 538 ; 01D9 55 539 PUSH BP 01DA 8BEC 540 MOV BP,SP 01DC B447 541 MOV AH,47H 01DE 8A5606 542 MOV DL,BYTE PTR [BP+6] ;Pointer to drive code 01E1 8B7608 543 MOV SI,WORD PTR [BP+8] ;Pointer to buffer 01E4 CD21 544 INT 21H ;AX=Error code 01E6 8B6E04 545 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 11 LOC OBJ LINE SOURCE 01E9 3EC746000000 546 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 01EF 7304 547 JNC asm_get_dir_ok 01F1 3E894600 548 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 01F5 5D 549 asm_get_dir_ok: POP BP 01F6 C20600 550 RET 6H 551 asm_get_dir ENDP 552 01F9 553 asm_set_dir PROC NEAR 554 ;Set directory 555 ; 556 ;Enter: AH = 3BH 557 ; DS:DX = Pointer to ASCIIZ 558 ; 559 ;Exit: C Clear - Directory set OK 560 ; C Set - AX = Error code 561 ; 03H - Path not found 562 ; 563 ;Usage: Cannot be used to set other drives dirs? 564 ; 01F9 55 565 PUSH BP 01FA 8BEC 566 MOV BP,SP 01FC B447 567 MOV AH,47H 01FE 8B5606 568 MOV DX,WORD PTR [BP+6] ;Pointer to ASCIIZ 0201 CD21 569 INT 21H ;AX=Error code 0203 8B6E04 570 MOV BP,WORD PTR [BP+4] ;Pointer to ERROR CODE 0206 3EC746000000 571 MOV WORD PTR DS:[BP],0 ;Clear ERROR CODE 020C 7304 572 JNC asm_set_dir_ok 020E 3E894600 573 MOV WORD PTR DS:[BP],AX ;Set ERROR CODE 0212 5D 574 asm_set_dir_ok: POP BP 0213 C20400 575 RET 4H 576 asm_set_dir ENDP 577 0216 578 asm_get_dir_spc PROC NEAR 579 ;ah=36h 580 ;dl=drive (0=def, 1=a etc) 581 ; 582 ;ax=sectors per cluster (or ffffh if drive invalid) 583 ;bx=no of avail clusters 584 ;cx=bytes per sector 585 ;dx=tot num of clusters 586 ; 587 ;free space=bx*ax*cx 588 ;capacity =dx*ax*cx 589 asm_get_dir_spc ENDP 590 0216 591 asm_get_drive PROC NEAR 592 ;ah=19h 593 ; 594 ;al=current drive (a=0 etc) 595 asm_get_drive ENDP 596 0216 597 asm_set_drive PROC NEAR 598 ;ah=0eh 599 ;al=drive number (a=0 etc) 600 ; 8086/87/88/186 MACRO ASSEMBLER DOS_LIB 09:53:30 09/19/90 PAGE 12 LOC OBJ LINE SOURCE 601 ;al=last drive number (a=1 etc) 602 asm_set_drive ENDP 603 0216 604 asm_get_dta PROC NEAR 605 ;ah=2fh 606 ; 607 ;es:bx points to DTA 608 asm_get_dta ENDP 609 0216 610 asm_set_dta PROC NEAR 611 ;ah=1ah 612 ;ds:dx=new DTA 613 asm_set_dta ENDP 614 0216 615 asm_sff PROC NEAR 616 ;ah=4eh 617 ;cx=search attrib 618 ; 00h - normal 619 ; 02h - normal & hidden 620 ; 04h - normal & system 621 ; 06h - normal, hidden & system 622 ; 08h - volume labels 623 ; 10h - directories 624 ;ds:dx=pointer to asciiz 625 ; 626 ;carry clear if sucessfull 627 ;carry set if error : ax = error code 628 ; 02h - file not found 629 ; 03h - invalid path 630 ; 12h - no more files 631 ; 632 ;DTA gets filled 633 ; Bytes 0-14h : reserved for dos use 634 ; Byte at offset 15h : attribute of matched file 635 ; word at offset 16h : time (see asm_get_fdt) 636 ; word at offset 18h : date ( ditto ) 637 ; dword at offset 1ah: file size 638 ; 13 bytes from offset 1eh : asciiz of filename. 639 asm_sff ENDP 640 0216 641 asm_sfn PROC NEAR 642 ;ah=4fh 643 ; 644 ;carry clear if success 645 ;carry set if error - AX=error code 646 ; 12h - no more files 647 asm_sfn ENDP 648 ---- 649 code ENDS 650 ---- 651 stack SEGMENT PUBLIC 'stack' ---- 652 stack ENDS 653 654 END ASSEMBLY COMPLETE, NO ERRORS FOUND