diff options
Diffstat (limited to 'v4.0/src/MAPPER/CHDIR.ASM')
| -rw-r--r-- | v4.0/src/MAPPER/CHDIR.ASM | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/CHDIR.ASM b/v4.0/src/MAPPER/CHDIR.ASM new file mode 100644 index 0000000..5143b26 --- /dev/null +++ b/v4.0/src/MAPPER/CHDIR.ASM | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosChDir mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosChDir | ||
| 12 | ; * | ||
| 13 | ; * FUNCTION: change directory name | ||
| 14 | ; * | ||
| 15 | ; * FUNCTION: This module will change the current directory for the | ||
| 16 | ; * requesting process. | ||
| 17 | ; * | ||
| 18 | ; * | ||
| 19 | ; * CALLING SEQUENCE: | ||
| 20 | ; * | ||
| 21 | ; * PUSH@ ASCIIZ Dirname ; Directory path name | ||
| 22 | ; * PUSH DWORD 0 ; Reserved (must be zero) took out @ | ||
| 23 | ; * ; 5/28 to match 3/25 spec | ||
| 24 | ; * CALL DosChDir | ||
| 25 | ; * | ||
| 26 | ; * | ||
| 27 | ; * RETURN SEQUENCE: | ||
| 28 | ; * | ||
| 29 | ; * IF ERROR (AX NOT = 0) | ||
| 30 | ; * | ||
| 31 | ; * AX = Error Code: | ||
| 32 | ; * | ||
| 33 | ; * o Invalid directory path | ||
| 34 | ; * | ||
| 35 | ; * MODULES CALLED: | ||
| 36 | ; * DOS int 21h function 3Bh ; Change current directory | ||
| 37 | ; * | ||
| 38 | ; ************************************************************************* | ||
| 39 | |||
| 40 | public DosChDir | ||
| 41 | .sall | ||
| 42 | .xlist | ||
| 43 | include macros.inc | ||
| 44 | .list | ||
| 45 | |||
| 46 | str struc | ||
| 47 | old_bp dw ? | ||
| 48 | return dd ? | ||
| 49 | dtrm006 dd 0h ;reserved (must be zero) | ||
| 50 | dnam006 dd ? ;address of directory path name | ||
| 51 | str ends | ||
| 52 | |||
| 53 | DosChDir proc far | ||
| 54 | Enter DosChDir ; push registers | ||
| 55 | |||
| 56 | mov dx, word ptr [bp].dnam006 ;load directory name offset | ||
| 57 | mov ax, word ptr [bp].dnam006+2 ;load directory name segment | ||
| 58 | |||
| 59 | push ax ; set segment in DS | ||
| 60 | pop ds | ||
| 61 | |||
| 62 | mov ax,03b00h ; load chdir op code | ||
| 63 | int 21h ; call dos to change the directory | ||
| 64 | jc exit ; jump if error | ||
| 65 | |||
| 66 | xor ax,ax ; else, good return code | ||
| 67 | exit: mexit ; pop registers | ||
| 68 | ret size str - 6 ; return | ||
| 69 | |||
| 70 | DosChDir endp | ||
| 71 | |||
| 72 | dosxxx ends | ||
| 73 | |||
| 74 | end | ||