diff options
| author | 2024-04-25 21:24:10 +0100 | |
|---|---|---|
| committer | 2024-04-25 22:32:27 +0000 | |
| commit | 2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch) | |
| tree | 80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/MAPPER/QCURDIR.ASM | |
| parent | Merge pull request #430 from jpbaltazar/typoptbr (diff) | |
| download | ms-dos-main.tar.gz ms-dos-main.tar.xz ms-dos-main.zip | |
Diffstat (limited to 'v4.0/src/MAPPER/QCURDIR.ASM')
| -rw-r--r-- | v4.0/src/MAPPER/QCURDIR.ASM | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/QCURDIR.ASM b/v4.0/src/MAPPER/QCURDIR.ASM new file mode 100644 index 0000000..9853d89 --- /dev/null +++ b/v4.0/src/MAPPER/QCURDIR.ASM | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosQCurDir mapper | ||
| 5 | |||
| 6 | buffer segment word public 'buffer' | ||
| 7 | CurrentDirectoryBuffer db 128 dup(?) | ||
| 8 | buffer ends | ||
| 9 | |||
| 10 | dosxxx segment byte public 'dos' | ||
| 11 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 12 | |||
| 13 | ;********************************************************************** | ||
| 14 | ;* | ||
| 15 | ;* MODULE: dosqcurdir | ||
| 16 | ;* | ||
| 17 | ;* FILE NAME: dos036.asm | ||
| 18 | ;* | ||
| 19 | ;* CALLING SEQUENCE: | ||
| 20 | ;* | ||
| 21 | ;* push word drive number (0=default, 1=a, etc.) | ||
| 22 | ;* push@ other dirpath | ||
| 23 | ;* push@ other dirpathlen | ||
| 24 | ;* | ||
| 25 | ;* call doqcurdir | ||
| 26 | ;* | ||
| 27 | ;* MODULES CALLED: PC-DOS Int 21h, ah=47h, get current directory | ||
| 28 | ;* | ||
| 29 | ;********************************************************************* | ||
| 30 | |||
| 31 | public dosqcurdir | ||
| 32 | .sall | ||
| 33 | include macros.inc | ||
| 34 | |||
| 35 | str struc | ||
| 36 | old_bp dw ? | ||
| 37 | return dd ? | ||
| 38 | BufferLengthPtr dd ? ; directory path buffer length pointer | ||
| 39 | BufferPtr dd ? ; directory path buffer pointer | ||
| 40 | Drive dw ? ; driver number | ||
| 41 | str ends | ||
| 42 | |||
| 43 | |||
| 44 | dosqcurdir proc far | ||
| 45 | |||
| 46 | Enter Dosqcurdir ; push registers | ||
| 47 | |||
| 48 | mov ax,seg buffer ; set temporary buffer to receive | ||
| 49 | mov ds,ax ; dircetory path information | ||
| 50 | assume ds:buffer | ||
| 51 | mov si,offset buffer:CurrentDirectoryBuffer | ||
| 52 | mov dx,[bp].drive ; set driver number | ||
| 53 | |||
| 54 | mov ah,47h | ||
| 55 | int 21h ; get directory path information | ||
| 56 | jc ErrorExit ; check for error | ||
| 57 | |||
| 58 | mov di,ds | ||
| 59 | mov es,di | ||
| 60 | assume es:buffer | ||
| 61 | |||
| 62 | ; next calculate the size of the path name just received | ||
| 63 | |||
| 64 | mov di,offset buffer:CurrentDirectoryBuffer | ||
| 65 | mov cx,128 | ||
| 66 | mov al,0 ; look for the non-ascii chara | ||
| 67 | cld ; in the buffer indciates the | ||
| 68 | repne scasb ; end of the path. | ||
| 69 | |||
| 70 | mov dx,128 | ||
| 71 | sub dx,cx ; calculate actual path length | ||
| 72 | |||
| 73 | les di,[bp].BufferLengthPtr ; set path buffer lenght pointer | ||
| 74 | assume es:nothing | ||
| 75 | mov cx,es:[di] ; check for directory path | ||
| 76 | ; buffe size | ||
| 77 | cmp cx,dx ; compare with needed length | ||
| 78 | jnc HaveThePathLength ; branch if length is ok | ||
| 79 | |||
| 80 | mov ax,8 ; else, set error code | ||
| 81 | jmp ErrorExit ; return | ||
| 82 | |||
| 83 | HaveThePathLength: | ||
| 84 | mov cx,dx | ||
| 85 | mov es:[di],dx ; return path length | ||
| 86 | |||
| 87 | les di,[bp].BufferPtr ; prepare to move directory path name | ||
| 88 | ; into return buffer | ||
| 89 | mov si,offset buffer:CurrentDirectoryBuffer | ||
| 90 | |||
| 91 | rep movsb ; copy dir path to return buffer | ||
| 92 | |||
| 93 | sub ax,ax ; set good return | ||
| 94 | |||
| 95 | ErrorExit: | ||
| 96 | mexit ; pop registers | ||
| 97 | ret size str - 6 ; return | ||
| 98 | |||
| 99 | dosqcurdir endp | ||
| 100 | |||
| 101 | dosxxx ends | ||
| 102 | |||
| 103 | end | ||
| 104 | |||