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 | |
| 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')
66 files changed, 7187 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/ALLOCSEG.ASM b/v4.0/src/MAPPER/ALLOCSEG.ASM new file mode 100644 index 0000000..36de869 --- /dev/null +++ b/v4.0/src/MAPPER/ALLOCSEG.ASM | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosAllocSeg mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosAllocSeg | ||
| 12 | ; * | ||
| 13 | ; * FUNCTION: This module allocates a segment of memory to the | ||
| 14 | ; * requesting process | ||
| 15 | ; * | ||
| 16 | ; * CALLING SEQUENCE: | ||
| 17 | ; * | ||
| 18 | ; * push size ; number of bytes requested | ||
| 19 | ; * push@ selector ; selector allocated (returned) | ||
| 20 | ; * push shareind ; whether segment will be shared | ||
| 21 | ; * call dosallocseg | ||
| 22 | ; * | ||
| 23 | ; * RETURN SEQUENCE: | ||
| 24 | ; * | ||
| 25 | ; * AX = error , 0 = no error | ||
| 26 | ; * | ||
| 27 | ; * MODULES CALLED: DOS int 21h | ||
| 28 | ; * | ||
| 29 | ; ************************************************************************* | ||
| 30 | ; | ||
| 31 | public dosallocseg | ||
| 32 | .sall | ||
| 33 | .xlist | ||
| 34 | include macros.inc | ||
| 35 | .list | ||
| 36 | ; | ||
| 37 | str struc | ||
| 38 | old_bp dw ? | ||
| 39 | return dd ? | ||
| 40 | ShareIndicator dw ? ; whether segment will be shared | ||
| 41 | SelectorPtr dd ? ; selector allocated | ||
| 42 | SegmentSize dw ? ; number of bytes requested | ||
| 43 | str ends | ||
| 44 | |||
| 45 | dosallocseg proc far | ||
| 46 | Enter dosallocseg ; push registers | ||
| 47 | |||
| 48 | mov bx,[bp].SegmentSize ; Get segment size | ||
| 49 | |||
| 50 | test bx,0000fh ; check segment size | ||
| 51 | jz NoRoundRequired | ||
| 52 | |||
| 53 | and bx,not 0000fh | ||
| 54 | add bx,00010h | ||
| 55 | |||
| 56 | NoRoundRequired: | ||
| 57 | cmp bx,0 ; check for 0 (full seg) | ||
| 58 | je AllocateMax ; jmp to full seg | ||
| 59 | |||
| 60 | shr bx,1 ; convert segment in bytes to | ||
| 61 | shr bx,1 ; paragraph | ||
| 62 | shr bx,1 | ||
| 63 | shr bx,1 | ||
| 64 | jmp HaveSize | ||
| 65 | |||
| 66 | AllocateMax: | ||
| 67 | mov bx,4096 ; setup default paragraph size | ||
| 68 | |||
| 69 | HaveSize: | ||
| 70 | mov ah,48h ; set up for dos allocate call | ||
| 71 | int 21h ; allocate segment | ||
| 72 | jc ErrorExit ; jump if error | ||
| 73 | |||
| 74 | lds si,[bp].SelectorPtr ; get selector address | ||
| 75 | mov ds:[si],ax ; save allocated memory block | ||
| 76 | |||
| 77 | AllocDone: | ||
| 78 | sub ax,ax ; set good return code | ||
| 79 | ErrorExit: | ||
| 80 | mexit ; pop registers | ||
| 81 | ret size str - 6 ; return | ||
| 82 | |||
| 83 | dosallocseg endp | ||
| 84 | |||
| 85 | dosxxx ends | ||
| 86 | |||
| 87 | end | ||
diff --git a/v4.0/src/MAPPER/BEEP.ASM b/v4.0/src/MAPPER/BEEP.ASM new file mode 100644 index 0000000..27f8893 --- /dev/null +++ b/v4.0/src/MAPPER/BEEP.ASM | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosBeep mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | |||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosbeep | ||
| 11 | ;* | ||
| 12 | ;* FUNCTION: generate a tone with desired frequency and duration | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push word frequency | ||
| 17 | ;* push word duration (in milliseconds) | ||
| 18 | ;* call dosbeep | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: none | ||
| 21 | ;* | ||
| 22 | ;********************************************************************* | ||
| 23 | |||
| 24 | public dosbeep | ||
| 25 | .sall | ||
| 26 | include macros.inc | ||
| 27 | |||
| 28 | inv_parm equ 0002h ;invalid parameter return code | ||
| 29 | |||
| 30 | str struc | ||
| 31 | old_bp dw ? | ||
| 32 | return dd ? | ||
| 33 | duratn dw ? ; duration | ||
| 34 | frqncy dw ? ; frequency | ||
| 35 | str ends | ||
| 36 | |||
| 37 | dosbeep proc far | ||
| 38 | Enter DosBeep | ||
| 39 | |||
| 40 | mov al,10110110b ; Set 8253 chip channel 2 | ||
| 41 | out 43h,al ; to proper mode for tone | ||
| 42 | |||
| 43 | ; Channel 2 is now set up as a frequency divider. The sixteen bit | ||
| 44 | ; value sent to that port (in low-high format) is divided into | ||
| 45 | ; 1.19 MHz, the clock speed. In order to send the proper value | ||
| 46 | ; to the register, then, the frequency requested must be divided | ||
| 47 | ; into 1,190,000. | ||
| 48 | |||
| 49 | mov dx,012h ; MSB of 1.19M | ||
| 50 | mov ax,2970h ; LSB of 1.19M | ||
| 51 | mov cx,[bp].frqncy ; divisor | ||
| 52 | mov bx,025h ; check frequency range | ||
| 53 | cmp cx,bx ; frequency ok ?? | ||
| 54 | jl error ; branch if error | ||
| 55 | |||
| 56 | mov bx,7fffh | ||
| 57 | cmp cx,bx | ||
| 58 | jg error | ||
| 59 | div cx ; then divide | ||
| 60 | |||
| 61 | out 42h,al ; and output | ||
| 62 | mov al,ah ; directly to | ||
| 63 | out 42h,al ; the 8253 port. | ||
| 64 | |||
| 65 | ; Turn on speaker | ||
| 66 | |||
| 67 | in al,61h ; Save original value | ||
| 68 | mov ah,al ; in ah | ||
| 69 | or al,3 ; Turn on control bit | ||
| 70 | out 61h,al ; in 8255 chip | ||
| 71 | |||
| 72 | ; Now loop for DURATN milliseconds | ||
| 73 | |||
| 74 | mov cx,[bp].duratn ; load value | ||
| 75 | delay: mov bx,196 ; inner loop count | ||
| 76 | del2: dec bx ; a millisecond | ||
| 77 | jne del2 ; for each | ||
| 78 | loop delay ; iteration | ||
| 79 | |||
| 80 | ; Turn speaker off | ||
| 81 | |||
| 82 | mov al,ah ; replace | ||
| 83 | out 61h,al ; original value | ||
| 84 | |||
| 85 | sub ax,ax ; set no error code | ||
| 86 | jmp exit ; return | ||
| 87 | |||
| 88 | error: mov ax,inv_parm | ||
| 89 | |||
| 90 | exit: MExit ; pop registers | ||
| 91 | ret size str - 6 ; return | ||
| 92 | |||
| 93 | dosbeep endp | ||
| 94 | |||
| 95 | dosxxx ends | ||
| 96 | |||
| 97 | end | ||
diff --git a/v4.0/src/MAPPER/CASEMAP.ASM b/v4.0/src/MAPPER/CASEMAP.ASM new file mode 100644 index 0000000..900ad4f --- /dev/null +++ b/v4.0/src/MAPPER/CASEMAP.ASM | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | |||
| 2 | ; | ||
| 3 | page 80,132 | ||
| 4 | ; | ||
| 5 | title CP/DOS DosCaseMap | ||
| 6 | ; | ||
| 7 | dosxxx segment byte public 'dos' | ||
| 8 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 9 | |||
| 10 | ;********************************************************************** | ||
| 11 | ;* | ||
| 12 | ;* MODULE: doscasemap | ||
| 13 | ;* | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* PUSH WORD Length | ||
| 18 | ;* PUSH@ DWORD CountryCode | ||
| 19 | ;* PUSH@ DWORD BinaryString | ||
| 20 | ;* DosCaseMap | ||
| 21 | ;* | ||
| 22 | ;* MODULES CALLED: none | ||
| 23 | ;* | ||
| 24 | ;********************************************************************* | ||
| 25 | |||
| 26 | public doscasemap | ||
| 27 | .sall | ||
| 28 | include macros.inc | ||
| 29 | |||
| 30 | str struc | ||
| 31 | old_bp dw ? | ||
| 32 | return dd ? | ||
| 33 | StringPtr dd ? ; binary string pointer | ||
| 34 | CountryCodePtr dd ? ; country code pointer | ||
| 35 | StringLength dw ? ; lenght of the string | ||
| 36 | str ends | ||
| 37 | |||
| 38 | DosCaseMap proc far | ||
| 39 | |||
| 40 | Enter DosCaseMap ; save registers | ||
| 41 | |||
| 42 | ; Get the country, so we can then get the country case map stuff | ||
| 43 | |||
| 44 | lds si,[bp].CountryCodePtr | ||
| 45 | mov ax,ds:[si] | ||
| 46 | |||
| 47 | ; Note: do the country selection later (maybe never) | ||
| 48 | |||
| 49 | lds si,[bp].StringPtr | ||
| 50 | mov cx,[bp].StringLength | ||
| 51 | |||
| 52 | MapLoop: ; convert characters to upper case | ||
| 53 | lodsb | ||
| 54 | cmp al,'a' | ||
| 55 | jc ThisCharDone | ||
| 56 | |||
| 57 | cmp al,'z'+1 | ||
| 58 | jnc ThisCharDone | ||
| 59 | |||
| 60 | add al,'A' - 'a' | ||
| 61 | mov ds:[si-1],al | ||
| 62 | |||
| 63 | ThisCharDone: | ||
| 64 | loop MapLoop ; loop until string is complete | ||
| 65 | |||
| 66 | MExit ; pop registers | ||
| 67 | ret size str - 6 ; return | ||
| 68 | ; | ||
| 69 | DosCaseMap endp | ||
| 70 | |||
| 71 | dosxxx ends | ||
| 72 | |||
| 73 | end | ||
diff --git a/v4.0/src/MAPPER/CHARIN.ASM b/v4.0/src/MAPPER/CHARIN.ASM new file mode 100644 index 0000000..384d05f --- /dev/null +++ b/v4.0/src/MAPPER/CHARIN.ASM | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | |||
| 2 | ; | ||
| 3 | page 80,132 | ||
| 4 | ;0 | ||
| 5 | title CP/DOS KbdCharIn mapper | ||
| 6 | ; | ||
| 7 | kbdxxx segment byte public 'kbd' | ||
| 8 | assume cs:kbdxxx,ds:nothing,es:nothing,ss:nothing | ||
| 9 | ; | ||
| 10 | ; ************************************************************************* * | ||
| 11 | ; * | ||
| 12 | ; * MODULE: kbdcharin | ||
| 13 | ; * | ||
| 14 | ; * FILE NAME: charin.asm | ||
| 15 | ; * | ||
| 16 | ; * CALLING SEQUENCE: | ||
| 17 | ; * | ||
| 18 | ; * push@ dword chardata ; buffer for data | ||
| 19 | ; * push word iowait ; Indicate if wait | ||
| 20 | ; * push word kbdhandle ; Keyboard Handle | ||
| 21 | ; * | ||
| 22 | ; * call kbdcharin | ||
| 23 | ; * | ||
| 24 | ; * | ||
| 25 | ; * MODULES CALLED: BIOS int 16h | ||
| 26 | ; * PC-DOS Int 21h, ah=2ch, get time | ||
| 27 | ; * | ||
| 28 | ; ************************************************************************* | ||
| 29 | |||
| 30 | public kbdcharin | ||
| 31 | .sall | ||
| 32 | .xlist | ||
| 33 | include kbd.inc | ||
| 34 | .list | ||
| 35 | extrn savedkbdinput:word | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | error_kbd_parameter equ 0002h | ||
| 40 | |||
| 41 | str struc | ||
| 42 | old_bp dw ? | ||
| 43 | return dd ? | ||
| 44 | handle dw ? ; keyboard handle | ||
| 45 | iowait dw ? ; indicate if wait for io | ||
| 46 | data dd ? ; data buffer pointer | ||
| 47 | str ends | ||
| 48 | |||
| 49 | |||
| 50 | kbdcharin proc far | ||
| 51 | |||
| 52 | Enter KbdCharIn ; save registers | ||
| 53 | lds si,[bp].data ; set up return data area | ||
| 54 | loopx: | ||
| 55 | mov ax,savedkbdinput | ||
| 56 | cmp ah,0 | ||
| 57 | je nosavedchar | ||
| 58 | |||
| 59 | mov savedkbdinput,0 | ||
| 60 | jmp avail | ||
| 61 | |||
| 62 | nosavedchar: | ||
| 63 | mov ah,0bh ; Check for ^C | ||
| 64 | int 021h | ||
| 65 | |||
| 66 | mov ah,06 | ||
| 67 | mov dl,-1 | ||
| 68 | int 021h | ||
| 69 | jnz avail | ||
| 70 | |||
| 71 | mov ax,[bp].iowait ; else, see if wait is desired | ||
| 72 | cmp ax,0 ; if so, | ||
| 73 | jz loopx ; keep trying | ||
| 74 | ; else... | ||
| 75 | mov ds:[si].Char_Code,0 ; | zero out scan and char codes | ||
| 76 | mov ds:[si].Scan_Code,0 ; | zero out scan and char codes | ||
| 77 | mov ds:[si].Status,0 ; | 0 for status | ||
| 78 | jmp short shift ; | go to get shift status | ||
| 79 | ; end of block | ||
| 80 | |||
| 81 | avail: | ||
| 82 | cmp al,0 | ||
| 83 | je loopx | ||
| 84 | mov ds:[si].Scan_Code,0 ; | | ||
| 85 | mov ds:[si].Char_Code,al ; | move char&scan code into structure | ||
| 86 | mov ds:[si].Status,1 ; | 1 for status | ||
| 87 | ; | ||
| 88 | shift: mov ah,02h ; Start of shift check block | ||
| 89 | int 16h ; | BIOS call to get shift state | ||
| 90 | |||
| 91 | sub ah,ah ; | | ||
| 92 | mov ds:[si].Shift_State,ax ; | put shift status into structure | ||
| 93 | |||
| 94 | mov ah,2ch ; start time stamping | ||
| 95 | int 21h ; | get current time of day | ||
| 96 | |||
| 97 | mov byte ptr ds:[si].Time+0,ch ; | put hours into structure | ||
| 98 | mov byte ptr ds:[si].Time+1,cl ; | put minutes into structure | ||
| 99 | mov byte ptr ds:[si].Time+2,dh ; | put seconds into structure | ||
| 100 | mov byte ptr cs:[si].Time+3,dl ; | put hundreds into structure | ||
| 101 | |||
| 102 | |||
| 103 | sub ax,ax ; set good return code | ||
| 104 | Mexit ; pop registers | ||
| 105 | |||
| 106 | ret size str - 6 ; return | ||
| 107 | |||
| 108 | kbdcharin endp | ||
| 109 | |||
| 110 | kbdxxx ends | ||
| 111 | |||
| 112 | end | ||
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 | ||
diff --git a/v4.0/src/MAPPER/CLOSE.ASM b/v4.0/src/MAPPER/CLOSE.ASM new file mode 100644 index 0000000..ee7aa4c --- /dev/null +++ b/v4.0/src/MAPPER/CLOSE.ASM | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | |||
| 4 | title CP/DOS DosClose mapper * * * | ||
| 5 | |||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosClose | ||
| 12 | ; * | ||
| 13 | ; * FUNCTION: This module will close a file or a device. | ||
| 14 | ; * | ||
| 15 | ; * CALLING SEQUENCE: | ||
| 16 | ; * | ||
| 17 | ; * PUSH WORD FileHandle ; File Handle or device handle | ||
| 18 | ; * CALL DosClose | ||
| 19 | ; * | ||
| 20 | ; * RETURN SEQUENCE: | ||
| 21 | ; * | ||
| 22 | ; * IF ERROR (AX not = 0) | ||
| 23 | ; * | ||
| 24 | ; * AX = Error Code: | ||
| 25 | ; * | ||
| 26 | ; * o Invalid file handle | ||
| 27 | ; * | ||
| 28 | ; * | ||
| 29 | ; * MODULES CALLED: DOS int 21H function 3EH | ||
| 30 | ; * | ||
| 31 | ; * | ||
| 32 | ; ************************************************************************* | ||
| 33 | |||
| 34 | public DosClose | ||
| 35 | .sall | ||
| 36 | .xlist | ||
| 37 | include macros.inc | ||
| 38 | .list | ||
| 39 | |||
| 40 | str struc | ||
| 41 | old_bp dw ? | ||
| 42 | return dd ? | ||
| 43 | FileHandle dw ? ; file or device handle | ||
| 44 | str ends | ||
| 45 | |||
| 46 | |||
| 47 | DosClose proc far | ||
| 48 | Enter DosClose ; push registers | ||
| 49 | |||
| 50 | ; Only files are closed. Devices are not closed, since OPEN creates | ||
| 51 | ; a dummy device handle without actually openning the device. | ||
| 52 | |||
| 53 | mov bx,[bp].FileHandle ; load the handle | ||
| 54 | mov ax,bx ; check for device handle | ||
| 55 | neg ax ; if device handle, return | ||
| 56 | jns GoodExit ; do not close the device | ||
| 57 | |||
| 58 | FileCloseRequest: | ||
| 59 | mov ax,03e00h ; load opcode | ||
| 60 | int 21h ; close the file | ||
| 61 | jc ErrorExit ; return if error | ||
| 62 | |||
| 63 | GoodExit: | ||
| 64 | sub ax,ax ; else, set good return code | ||
| 65 | |||
| 66 | ErrorExit: | ||
| 67 | mexit ; pop registers | ||
| 68 | ret size str - 6 ; return | ||
| 69 | |||
| 70 | DosClose endp | ||
| 71 | |||
| 72 | dosxxx ends | ||
| 73 | |||
| 74 | end | ||
diff --git a/v4.0/src/MAPPER/CWAIT.ASM b/v4.0/src/MAPPER/CWAIT.ASM new file mode 100644 index 0000000..ed4a444 --- /dev/null +++ b/v4.0/src/MAPPER/CWAIT.ASM | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DOSCWait mapper | ||
| 5 | |||
| 6 | ; ************************************************************************* * | ||
| 7 | ; * | ||
| 8 | ; * MODULE: DosCWait | ||
| 9 | ; * | ||
| 10 | ; * ACTION: Wait for a child termination | ||
| 11 | ; * | ||
| 12 | ; * CALLING SEQUENCE: | ||
| 13 | ; * | ||
| 14 | ; * push actioncode ; execution options | ||
| 15 | ; * push waitoption ; wait options | ||
| 16 | ; * push@ resultcode ; address to put result code | ||
| 17 | ; * push@ processidword ; address to put process id | ||
| 18 | ; * push processid ; process id of process to wait for | ||
| 19 | ; * call doscwait | ||
| 20 | ; * | ||
| 21 | ; * RETURN SEQUENCE: | ||
| 22 | ; * | ||
| 23 | ; * | ||
| 24 | ; * | ||
| 25 | ; * MODULES CALLED: None | ||
| 26 | ; * | ||
| 27 | ; * | ||
| 28 | ; * | ||
| 29 | ; ************************************************************************* | ||
| 30 | |||
| 31 | buffer segment word public 'buffer' | ||
| 32 | |||
| 33 | extrn DosExecPgmCalled:word | ||
| 34 | extrn DosExecPgmReturnCode:word | ||
| 35 | |||
| 36 | buffer ends | ||
| 37 | |||
| 38 | dosxxx segment byte public 'dos' | ||
| 39 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 40 | |||
| 41 | public doscwait | ||
| 42 | .sall | ||
| 43 | .xlist | ||
| 44 | include macros.inc | ||
| 45 | .list | ||
| 46 | ; | ||
| 47 | str struc | ||
| 48 | old_bp dw ? | ||
| 49 | return dd ? | ||
| 50 | Qprocessid dw ? ; Child process ID | ||
| 51 | Aprocessid dd ? ; process id pointer | ||
| 52 | resultcode dd ? ; result code pointer | ||
| 53 | waitoption dw ? ; wait option | ||
| 54 | actioncode dw ? ; action code | ||
| 55 | str ends | ||
| 56 | |||
| 57 | doscwait proc far | ||
| 58 | Enter doscwait ; push registers | ||
| 59 | |||
| 60 | mov ax,seg buffer | ||
| 61 | mov ds,ax ; set temporary buffer | ||
| 62 | assume ds:buffer | ||
| 63 | |||
| 64 | cmp DosExecPgmCalled,0 ; ?????? | ||
| 65 | jz WeHaveExeced | ||
| 66 | |||
| 67 | mov ax,31 | ||
| 68 | jmp ErrorExit ; error exit | ||
| 69 | |||
| 70 | WeHaveExeced: | ||
| 71 | mov ax,DosExecPgmReturnCode | ||
| 72 | lds si,[bp].ResultCode | ||
| 73 | assume ds:nothing | ||
| 74 | mov ds:[si],ax ; return termination code | ||
| 75 | |||
| 76 | mov ax,[bp].Qprocessid ; return child process id | ||
| 77 | lds si,[bp].Aprocessid | ||
| 78 | mov ds:[si],ax | ||
| 79 | |||
| 80 | xor ax,ax ; set good return code | ||
| 81 | |||
| 82 | ErrorExit: | ||
| 83 | Mexit ; pop registers | ||
| 84 | ret size str - 6 ; return | ||
| 85 | |||
| 86 | doscwait endp | ||
| 87 | |||
| 88 | dosxxx ends | ||
| 89 | |||
| 90 | end | ||
diff --git a/v4.0/src/MAPPER/DBCS.ASM b/v4.0/src/MAPPER/DBCS.ASM new file mode 100644 index 0000000..a856a09 --- /dev/null +++ b/v4.0/src/MAPPER/DBCS.ASM | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosGetDBCSEv | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: DosGetDBCSEv | ||
| 12 | ;* | ||
| 13 | ;* CALLING SEQUENCE: | ||
| 14 | ;* | ||
| 15 | ;* PUSH WORD Length | ||
| 16 | ;* PUSH@ DWORD Countrycode | ||
| 17 | ;* PUSH@ DWORD Memorybuffer | ||
| 18 | ;* | ||
| 19 | ;* MODULES CALLED: none | ||
| 20 | ;* | ||
| 21 | ;********************************************************************* | ||
| 22 | ; | ||
| 23 | public DosGetDBCSEv | ||
| 24 | .sall | ||
| 25 | include macros.inc | ||
| 26 | |||
| 27 | str struc | ||
| 28 | old_bp dw ? | ||
| 29 | return dd ? | ||
| 30 | DataAreaPtr dd ? ; Data buffer pointer | ||
| 31 | CountryCodePtr dd ? ; Country code pointer | ||
| 32 | DataAreaLength dw ? ; Length of data area | ||
| 33 | str ends | ||
| 34 | |||
| 35 | DosGetDBCSEv proc far | ||
| 36 | |||
| 37 | Enter DosGetDBCSEv ;AN000; push registers | ||
| 38 | |||
| 39 | ; Get the country, so we can then get the country case map stuff | ||
| 40 | |||
| 41 | ; lds si,[bp].CountryCodePtr | ||
| 42 | ; mov ax,ds:[si] | ||
| 43 | |||
| 44 | ; Note: do the country selection later (maybe never) | ||
| 45 | |||
| 46 | mov ax,6300H ;AN000; get DBCS vector | ||
| 47 | INT 21H ;AN000; DS:SI-->vector area | ||
| 48 | |||
| 49 | jc Exit | ||
| 50 | Copy_Vector: | ||
| 51 | les di,[bp].DataAreaPtr ;AN000; ES:DI-->return buffer | ||
| 52 | mov cx,[bp].DataAreaLength ;AN000; | ||
| 53 | loopx: | ||
| 54 | mov al,ds:[si] ;AN000; | ||
| 55 | mov es:[di],al ;AN000; | ||
| 56 | inc si ;AN000; | ||
| 57 | inc di ;AN000; | ||
| 58 | loop loopx ;AN000; | ||
| 59 | |||
| 60 | xor ax,ax ;AN000; | ||
| 61 | |||
| 62 | Exit: | ||
| 63 | Mexit ;AN000;pop registers | ||
| 64 | |||
| 65 | ret size str - 6 ;AN000; return | ||
| 66 | |||
| 67 | DosGetDBCSEv endp | ||
| 68 | |||
| 69 | dosxxx ends | ||
| 70 | |||
| 71 | end | ||
diff --git a/v4.0/src/MAPPER/DELETE.ASM b/v4.0/src/MAPPER/DELETE.ASM new file mode 100644 index 0000000..c9dae66 --- /dev/null +++ b/v4.0/src/MAPPER/DELETE.ASM | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosDelete mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosDelete | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: DOS012.ASM | ||
| 14 | ; * | ||
| 15 | ; * FUNCTION: This module removes a directory entry associated with a | ||
| 16 | ; * filename. | ||
| 17 | ; * | ||
| 18 | ; * | ||
| 19 | ; * CALLING SEQUENCE: | ||
| 20 | ; * | ||
| 21 | ; * PUSH@ ASCIIZ FileName ; FileName path | ||
| 22 | ; * PUSH@ DWORD 0 ; Reserved (must be zero) | ||
| 23 | ; * CALL DosDelete | ||
| 24 | ; * | ||
| 25 | ; * RETURN SEQUENCE: | ||
| 26 | ; * | ||
| 27 | ; * IF ERROR (AX not = 0) | ||
| 28 | ; * | ||
| 29 | ; * AX = Error Code: | ||
| 30 | ; * o Invalid file path name | ||
| 31 | ; * | ||
| 32 | ; * MODULES CALLED: DOS int 21H function 41H | ||
| 33 | ; * | ||
| 34 | ; * | ||
| 35 | ; * | ||
| 36 | ; ************************************************************************* | ||
| 37 | |||
| 38 | public DosDelete | ||
| 39 | .sall | ||
| 40 | .xlist | ||
| 41 | include macros.inc | ||
| 42 | .list | ||
| 43 | |||
| 44 | str struc | ||
| 45 | old_bp dw ? | ||
| 46 | return dd ? | ||
| 47 | dtrm12 dd ? ; reserved, always 0 | ||
| 48 | asc012 dd ? ; file name path pointer | ||
| 49 | str ends | ||
| 50 | |||
| 51 | DosDelete proc far | ||
| 52 | Enter DosDelete ; push registers | ||
| 53 | |||
| 54 | lds dx,dword ptr [bp].asc012 ; file path name | ||
| 55 | |||
| 56 | mov ah,041h | ||
| 57 | int 21h ; delete the file | ||
| 58 | jc err012 ; jump if no error | ||
| 59 | |||
| 60 | sub ax,ax ; set good return code | ||
| 61 | |||
| 62 | err012: | ||
| 63 | mexit ; pop registers | ||
| 64 | ret size str - 6 ; return | ||
| 65 | |||
| 66 | DosDelete endp | ||
| 67 | |||
| 68 | dosxxx ends | ||
| 69 | |||
| 70 | end | ||
diff --git a/v4.0/src/MAPPER/DEVCONFG.ASM b/v4.0/src/MAPPER/DEVCONFG.ASM new file mode 100644 index 0000000..5715300 --- /dev/null +++ b/v4.0/src/MAPPER/DEVCONFG.ASM | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | ;0 | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosDevConfig mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dosdevconfig | ||
| 12 | ;* | ||
| 13 | ;* FILE NAME: dos013.asm | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push@ other returned info address | ||
| 18 | ;* push word item type being queried | ||
| 19 | ;* push word reserved parm(must be 0) | ||
| 20 | ;* call dosdevconfig | ||
| 21 | ;* | ||
| 22 | ;* MODULES CALLED: ROM BIOS Int 11, Equipment check | ||
| 23 | ;* | ||
| 24 | ;********************************************************************* | ||
| 25 | |||
| 26 | public dosdevconfig | ||
| 27 | .sall | ||
| 28 | include macros.inc | ||
| 29 | |||
| 30 | inv_parm equ 0002h | ||
| 31 | model_byte equ 0fffeh | ||
| 32 | |||
| 33 | str struc | ||
| 34 | old_bp dw ? | ||
| 35 | return dd ? | ||
| 36 | rsrvd dw ? ; reserved | ||
| 37 | item dw ? ; item number | ||
| 38 | data dd ? ; returned information | ||
| 39 | str ends | ||
| 40 | |||
| 41 | dosdevconfig proc far | ||
| 42 | Enter dosdevconfig ; push registers | ||
| 43 | |||
| 44 | mov ax,[bp].rsrvd ; reserved parm must | ||
| 45 | cmp ax,0 ; be zero | ||
| 46 | jne error ; if not zero, jump | ||
| 47 | |||
| 48 | mov ax,[bp].item ; range check | ||
| 49 | cmp ax,0 | ||
| 50 | jl error ; if not zero, jump | ||
| 51 | |||
| 52 | cmp ax,3 ; covered by Int 11? | ||
| 53 | jg notint11 | ||
| 54 | mov bx,ax ; ax destroyed by int | ||
| 55 | |||
| 56 | int 11h ; get peripherals on the system | ||
| 57 | |||
| 58 | xchg ax,bx ; restore ax | ||
| 59 | |||
| 60 | cmp ax,0 ; check number of printers?? | ||
| 61 | jg notprint ; jump if not | ||
| 62 | mov cl,14 ; else, setup print bits | ||
| 63 | shr bx,cl ; in returned data | ||
| 64 | jmp short exit ; then return | ||
| 65 | |||
| 66 | notprint: cmp ax,1 ; check for RS232 adapters?? | ||
| 67 | jg diskchk ; jump if not | ||
| 68 | mov cl,4 ; else, setup RS232 bits | ||
| 69 | shl bx,cl ; clear top bits | ||
| 70 | mov cl,13 | ||
| 71 | shr bx,cl ; shift back | ||
| 72 | jmp short exit | ||
| 73 | |||
| 74 | diskchk: cmp ax,2 ; check for disk request?? | ||
| 75 | jg math ; jump, if not | ||
| 76 | mov cl,8 ; else setup disk bits | ||
| 77 | shl bx,cl ; clear top bits | ||
| 78 | mov cl,14 | ||
| 79 | shr bx,cl ; and shift back | ||
| 80 | inc bl ; 0=1 drive, etc. | ||
| 81 | jmp short exit | ||
| 82 | |||
| 83 | math: cmp ax,3 ; check for math coprocessor | ||
| 84 | jg notint11 ; jump, if not | ||
| 85 | mov cl,14 ; else, setup math coprocessor | ||
| 86 | shl bx,cl ; bits in return data | ||
| 87 | mov cl,15 | ||
| 88 | shr bx,cl | ||
| 89 | jmp short exit | ||
| 90 | |||
| 91 | notint11: cmp ax,4 ; check for other valid item | ||
| 92 | je error | ||
| 93 | cmp ax,5 ; check for PC type ?? | ||
| 94 | jg error ; jump if not so | ||
| 95 | push es ; else check for PC type | ||
| 96 | mov dx,0f000h ; read model byte from RAM | ||
| 97 | mov es,dx | ||
| 98 | mov al,es:model_byte ;model byte | ||
| 99 | pop es | ||
| 100 | sub al,0fch ;AT value = FC | ||
| 101 | jmp short exit ;all done, return | ||
| 102 | |||
| 103 | error: mov ax,inv_parm | ||
| 104 | jmp short exit1 | ||
| 105 | |||
| 106 | exit: sub ax,ax ; set good return code | ||
| 107 | lds si,[bp].data ; set return data area address | ||
| 108 | mov byte ptr [si],bl ; save bit pattern in return | ||
| 109 | ; data area | ||
| 110 | exit1: Mexit ; pop registers | ||
| 111 | ret size str - 6 ; return | ||
| 112 | |||
| 113 | dosdevconfig endp | ||
| 114 | |||
| 115 | dosxxx ends | ||
| 116 | |||
| 117 | end | ||
diff --git a/v4.0/src/MAPPER/D_GCTRCD.ASM b/v4.0/src/MAPPER/D_GCTRCD.ASM new file mode 100644 index 0000000..2c313b2 --- /dev/null +++ b/v4.0/src/MAPPER/D_GCTRCD.ASM | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | ; SCCSID = @(#)d_gctrcd.asm 1.1 86/06/03 | ||
| 2 | .xlist | ||
| 3 | ; include struc.inc | ||
| 4 | include nlsapi.inc | ||
| 5 | .list | ||
| 6 | |||
| 7 | DGROUP group _DATA | ||
| 8 | |||
| 9 | _TEXT segment word public 'CODE' | ||
| 10 | _TEXT ends | ||
| 11 | |||
| 12 | _DATA segment word public 'DATA' | ||
| 13 | EXTRN _ApiSel:WORD | ||
| 14 | _DATA ends | ||
| 15 | |||
| 16 | _TEXT segment | ||
| 17 | |||
| 18 | EXTRN W_NLS_APIS:near | ||
| 19 | |||
| 20 | public DOSGETCTRYINFO | ||
| 21 | DOSGETCTRYINFO proc far | ||
| 22 | assume cs:_TEXT | ||
| 23 | |||
| 24 | |||
| 25 | mov AX,BP ; Add 4 bytes of dummy parameters to the | ||
| 26 | mov BP,SP ; Stack by copying the return address down 4 | ||
| 27 | push [BP+2] | ||
| 28 | push [BP] | ||
| 29 | mov BP,AX | ||
| 30 | |||
| 31 | push DS | ||
| 32 | mov AX,_DATA | ||
| 33 | mov DS,AX | ||
| 34 | mov AX, SETFILELIST | ||
| 35 | mov DS:_ApiSel,AX | ||
| 36 | pop DS | ||
| 37 | |||
| 38 | jmp W_NLS_APIS | ||
| 39 | |||
| 40 | ; pop bp | ||
| 41 | ; ret 14 | ||
| 42 | |||
| 43 | DOSGETCTRYINFO endp | ||
| 44 | |||
| 45 | _TEXT ENDS | ||
| 46 | END | ||
| 47 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/ERROR.ASM b/v4.0/src/MAPPER/ERROR.ASM new file mode 100644 index 0000000..bf64801 --- /dev/null +++ b/v4.0/src/MAPPER/ERROR.ASM | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | |||
| 4 | title CP/DOS DosError mapper | ||
| 5 | |||
| 6 | |||
| 7 | ;********************************************************************** | ||
| 8 | ;* | ||
| 9 | ;* MODULE: doserror | ||
| 10 | ;* | ||
| 11 | ;* ;AN000; PCDOS 4.00 ptm p2629 - Drive not ready yields FORMAT TERMINATED | ||
| 12 | ;* | ||
| 13 | ;********************************************************************* | ||
| 14 | |||
| 15 | SystemIsHandling equ 1 ; system handles errors | ||
| 16 | AppIsHandling equ 0 ; application handle errors | ||
| 17 | |||
| 18 | ;------------------------------------------------------------;;; | ||
| 19 | databuff segment public 'databuff' ;;; | ||
| 20 | ;;; | ||
| 21 | errorstate db SystemIsHandling ;;; | ||
| 22 | ;;; | ||
| 23 | databuff ends ;;; | ||
| 24 | ;------------------------------------------------------------;;; | ||
| 25 | |||
| 26 | |||
| 27 | dosxxx segment byte public 'dos' | ||
| 28 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 29 | |||
| 30 | |||
| 31 | public doserror | ||
| 32 | .sall | ||
| 33 | .xlist | ||
| 34 | include macros.inc | ||
| 35 | .list | ||
| 36 | |||
| 37 | str struc | ||
| 38 | old_bp dw ? | ||
| 39 | Return dd ? | ||
| 40 | Flag dw ? ; error flag; 0 = APP handle error | ||
| 41 | str ends ; 1 = System handle error | ||
| 42 | |||
| 43 | |||
| 44 | DosError proc far | ||
| 45 | Enter doserror ; Push registers | ||
| 46 | |||
| 47 | mov ax,seg databuff ;-->RW | ||
| 48 | mov ds,ax ;-->RW | ||
| 49 | assume ds:databuff ;-->RW | ||
| 50 | |||
| 51 | mov ax,[bp].flag ; get error flag | ||
| 52 | cmp ax,AppIsHandling ; check who should handle errors | ||
| 53 | je apperrorhandle ; branch if application handles error | ||
| 54 | cmp ax,SystemIsHandling ; system handle error ?? | ||
| 55 | je syserrorhandle ; branch if true | ||
| 56 | |||
| 57 | mov ax,1 ; else, set error code | ||
| 58 | jmp exit ; return | ||
| 59 | |||
| 60 | SysErrorHandle: | ||
| 61 | |||
| 62 | cmp errorstate,SystemIsHandling ; system handles error ?? | ||
| 63 | jne setsys ; branch if not | ||
| 64 | xor ax,ax ; else set good return code | ||
| 65 | jmp exit ; return | ||
| 66 | |||
| 67 | setsys: mov errorstate,SystemIsHandling ; set flag for system | ||
| 68 | lds dx,cs:prevadrs | ||
| 69 | |||
| 70 | mov ax,02524H | ||
| 71 | int 21h ; set new vector | ||
| 72 | |||
| 73 | xor ax,ax ; set good return code | ||
| 74 | jmp exit ; return | ||
| 75 | |||
| 76 | |||
| 77 | AppErrorHandle: | ||
| 78 | cmp errorstate,AppIsHandling ; application handle errors | ||
| 79 | jne setapp ; branch if true | ||
| 80 | |||
| 81 | xor ax,ax ; else, set good error code | ||
| 82 | jmp exit ; return | ||
| 83 | |||
| 84 | setapp: mov errorstate,AppIsHandling ; indicate app handles error | ||
| 85 | mov ax,03524h ; Get Interrupt 24 Vector | ||
| 86 | int 21h | ||
| 87 | |||
| 88 | mov word ptr cs:prevadrs+0,bx ; save it in prevadrs | ||
| 89 | mov word ptr cs:prevadrs+2,es | ||
| 90 | |||
| 91 | mov dx,cs | ||
| 92 | mov ds,dx | ||
| 93 | mov dx,offset ApiErrorHandler ; put error interrupt handler | ||
| 94 | ; as new vector | ||
| 95 | mov ax,02524H | ||
| 96 | int 21h ;set new vector | ||
| 97 | |||
| 98 | xor ax,ax ; set good error return | ||
| 99 | |||
| 100 | exit: mexit ; pop all registers | ||
| 101 | ret size str - 6 ; return | ||
| 102 | |||
| 103 | DosError endp | ||
| 104 | |||
| 105 | page | ||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | ;------------------------------------------------------- | ||
| 112 | ; **** Error Handler ****** | ||
| 113 | ; This routine will get control on a hard error, returning an error. | ||
| 114 | ; If error is Drive not ready, keep retrying until drive IS ready or ^C | ||
| 115 | ;------------------------------------------------------- | ||
| 116 | DriveNotReady equ 2 ;AN000; | ||
| 117 | |||
| 118 | Ignore equ 0 ;AN000; | ||
| 119 | Retry equ 1 ;AN000; | ||
| 120 | Terminate equ 2 ;AN000; | ||
| 121 | Fail equ 3 ;AN000; | ||
| 122 | |||
| 123 | prevadrs dd ? ;AN000; ;save old interrupt handler address ;;; | ||
| 124 | |||
| 125 | ApiErrorHandler proc near ;AN000; | ||
| 126 | pushf ;AN000; | ||
| 127 | cmp di,DriveNotReady ;AN000; Is it Drive Not Ready? | ||
| 128 | jne popf_and_fail_it ;AN000; If not, fail call and return | ||
| 129 | |||
| 130 | Drive_Not_Ready: ;AN000; The drive is not ready! | ||
| 131 | call dword ptr cs:prevadrs ;AN000; Get user to respond | ||
| 132 | cmp al,Terminate ;AN000; For any resonse other than terminate, | ||
| 133 | jne retry_it ;AN000; retry the operation | ||
| 134 | int 023h ;AN000; Otherwise terminate via INT 023h | ||
| 135 | |||
| 136 | popf_and_fail_it: ;AN000; Fail the operation | ||
| 137 | pop ax ;AN000; Remove garbage from stack | ||
| 138 | mov al,Fail ;AN000; Func code for fail | ||
| 139 | jmp rett ;AN000; | ||
| 140 | retry_it: ;AN000; Retry the operation | ||
| 141 | mov al,Retry ;AN000; Func code for retry | ||
| 142 | rett: ;AN000; | ||
| 143 | iret ;AN000; return | ||
| 144 | Apierrorhandler endp | ||
| 145 | ;------------------------------------------------------- | ||
| 146 | ;------------------------------------------------------- | ||
| 147 | |||
| 148 | dosxxx ends | ||
| 149 | end | ||
diff --git a/v4.0/src/MAPPER/ERROR.INC b/v4.0/src/MAPPER/ERROR.INC new file mode 100644 index 0000000..d19e498 --- /dev/null +++ b/v4.0/src/MAPPER/ERROR.INC | |||
| @@ -0,0 +1,285 @@ | |||
| 1 | ;break <CP/DOS error codes> | ||
| 2 | |||
| 3 | ; SCCSID = @(#)error.inc 6.2 86/02/27 | ||
| 4 | ; | ||
| 5 | ; CP/DOS calls all return error codes through AX. If an error occurred then | ||
| 6 | ; the carry bit will be set and the error code is in AX. If no error occurred | ||
| 7 | ; then the carry bit is reset and AX contains returned info. | ||
| 8 | ; | ||
| 9 | ; Since the set of error codes is being extended as we extend the operating | ||
| 10 | ; system, we have provided a means for applications to ask the system for a | ||
| 11 | ; recommended course of action when they receive an error. | ||
| 12 | ; | ||
| 13 | ; The GetExtendedError system call returns a universal error, an error | ||
| 14 | ; location and a recommended course of action. The universal error code is | ||
| 15 | ; a symptom of the error REGARDLESS of the context in which GetExtendedError | ||
| 16 | ; is issued. | ||
| 17 | ; | ||
| 18 | |||
| 19 | ; | ||
| 20 | ; These are the 2.0 error codes | ||
| 21 | ; | ||
| 22 | no_error EQU 0 | ||
| 23 | error_invalid_function EQU 1 | ||
| 24 | error_file_not_found EQU 2 | ||
| 25 | error_path_not_found EQU 3 | ||
| 26 | error_too_many_open_files EQU 4 | ||
| 27 | error_access_denied EQU 5 | ||
| 28 | error_invalid_handle EQU 6 | ||
| 29 | error_arena_trashed EQU 7 | ||
| 30 | error_not_enough_memory EQU 8 | ||
| 31 | error_invalid_block EQU 9 | ||
| 32 | error_bad_environment EQU 10 | ||
| 33 | error_bad_format EQU 11 | ||
| 34 | error_invalid_access EQU 12 | ||
| 35 | error_invalid_data EQU 13 | ||
| 36 | ;**** reserved EQU 14 ; ***** | ||
| 37 | error_invalid_drive EQU 15 | ||
| 38 | error_current_directory EQU 16 | ||
| 39 | error_not_same_device EQU 17 | ||
| 40 | error_no_more_files EQU 18 | ||
| 41 | ; | ||
| 42 | ; These are the universal int 24 mappings for the old INT 24 set of errors | ||
| 43 | ; | ||
| 44 | error_write_protect EQU 19 | ||
| 45 | error_bad_unit EQU 20 | ||
| 46 | error_not_ready EQU 21 | ||
| 47 | error_bad_command EQU 22 | ||
| 48 | error_CRC EQU 23 | ||
| 49 | error_bad_length EQU 24 | ||
| 50 | error_Seek EQU 25 | ||
| 51 | error_not_DOS_disk EQU 26 | ||
| 52 | error_sector_not_found EQU 27 | ||
| 53 | error_out_of_paper EQU 28 | ||
| 54 | error_write_fault EQU 29 | ||
| 55 | error_read_fault EQU 30 | ||
| 56 | error_gen_failure EQU 31 | ||
| 57 | ; | ||
| 58 | ; These are the new 3.0 error codes reported through INT 24 | ||
| 59 | ; | ||
| 60 | error_sharing_violation EQU 32 | ||
| 61 | error_lock_violation EQU 33 | ||
| 62 | error_wrong_disk EQU 34 | ||
| 63 | error_FCB_unavailable EQU 35 | ||
| 64 | error_sharing_buffer_exceeded EQU 36 | ||
| 65 | ; | ||
| 66 | ; New OEM network-related errors are 50-79 | ||
| 67 | ; | ||
| 68 | error_not_supported EQU 50 | ||
| 69 | ; | ||
| 70 | ; End of INT 24 reportable errors | ||
| 71 | ; | ||
| 72 | error_file_exists EQU 80 | ||
| 73 | error_DUP_FCB EQU 81 ; ***** | ||
| 74 | error_cannot_make EQU 82 | ||
| 75 | error_FAIL_I24 EQU 83 | ||
| 76 | ; | ||
| 77 | ; New 3.0 network related error codes | ||
| 78 | ; | ||
| 79 | error_out_of_structures EQU 84 | ||
| 80 | error_Already_assigned EQU 85 | ||
| 81 | error_invalid_password EQU 86 | ||
| 82 | error_invalid_parameter EQU 87 | ||
| 83 | error_NET_write_fault EQU 88 | ||
| 84 | ; | ||
| 85 | ; New error codes for 4.0 | ||
| 86 | ; | ||
| 87 | error_no_proc_slots EQU 89 ; no process slots available | ||
| 88 | error_not_frozen EQU 90 | ||
| 89 | err_tstovfl EQU 91 ; timer service table overflow | ||
| 90 | err_tstdup EQU 92 ; timer service table duplicate | ||
| 91 | error_no_items EQU 93 ; There were no items to operate upon | ||
| 92 | error_interrupt EQU 95 ; interrupted system call | ||
| 93 | error_fixed_vector EQU 96 ; attempt to set fixed vector | ||
| 94 | error_vector_used EQU 97 ; vector set by another process | ||
| 95 | error_global_limit EQU 98 ; more than 16 vectors set | ||
| 96 | error_vector_notset EQU 99 ; unsetting unallocated vector | ||
| 97 | error_too_many_semaphores EQU 100 ; user/sys open sem limit hit | ||
| 98 | error_sem_already_open EQU 101 ; attempt to open sem twice | ||
| 99 | error_sem_is_set EQU 102 ; non-blk waitsem found it set | ||
| 100 | error_sem_not_set EQU 103 ; tried to sig a non-owned sem | ||
| 101 | error_sem_already_owned EQU 104 ; tried to wait on owned sem | ||
| 102 | error_sem_owner_died EQU 105 ; waitsem found owner died | ||
| 103 | error_sem_user_limit EQU 106 ; too many procs have this sem | ||
| 104 | error_disk_change EQU 107 ; insert disk b into drive a | ||
| 105 | error_drive_locked EQU 108 ; drive locked by another process | ||
| 106 | error_broken_pipe EQU 109 ; write on pipe with no reader | ||
| 107 | ; | ||
| 108 | ; New error codes for CP/DOS | ||
| 109 | ; | ||
| 110 | error_open_failed EQU 110 ; open/created failed due to | ||
| 111 | ; explicit fail command | ||
| 112 | error_buffer_overflow EQU 111 ; buffer passed to system call | ||
| 113 | ; is too small to hold return | ||
| 114 | ; data. | ||
| 115 | error_disk_full EQU 112 ; not enough space on the disk | ||
| 116 | ; (DOSNEWSIZE/w_NewSize) | ||
| 117 | error_no_more_search_handles EQU 113 ; can't allocate another search | ||
| 118 | ; structure and handle. | ||
| 119 | ; (DOSFINDFIRST/w_FindFirst) | ||
| 120 | error_invalid_target_handle EQU 114 ; Target handle in DOSDUPHANDLE | ||
| 121 | ; is invalid | ||
| 122 | |||
| 123 | error_system_trace EQU 300 ; system trace error (DosSysTrace) | ||
| 124 | error_ras_stcp EQU 301 ; system trace command processor error | ||
| 125 | error_ras_createdd EQU 302 ; error in create dump diskette | ||
| 126 | error_invalid_procid EQU 303 ; invalid process id | ||
| 127 | error_invalid_pdelta EQU 304 ; invalid priority delta | ||
| 128 | error_not_descendent EQU 305 ; not descendent | ||
| 129 | error_request_notsm EQU 306 ; requestor not session manager | ||
| 130 | error_invalid_pclass EQU 307 ; invalid p class | ||
| 131 | error_invalid_scope EQU 308 ; invalid scope | ||
| 132 | error_invalid_threadid EQU 309 ; invalid thread id | ||
| 133 | error_msp_shrink EQU 310 ; can't shrink - MspSet | ||
| 134 | error_msp_nomem EQU 311 ; no memory - MspAlloc | ||
| 135 | error_msp_overlap EQU 312 ; overlap - MspFree | ||
| 136 | error_msp_badsize EQU 313 ; bad size parameter - MspAlloc or MspFree | ||
| 137 | error_msp_badflag EQU 314 ; bad flag parameter - MspSet | ||
| 138 | error_msp_badselector EQU 315 ; invalid MspSegment Selector | ||
| 139 | error_mr_msg_too_long EQU 316 ; message too long for buffer | ||
| 140 | error_mr_mid_not_found EQU 317 ; message id number not found | ||
| 141 | error_mr_un_acc_msgf EQU 318 ; unable to access message file | ||
| 142 | error_mr_inv_msgf_format EQU 319 ; invalid message file format | ||
| 143 | error_mr_inv_ivcount EQU 320 ; invalid insertion variable count | ||
| 144 | error_mr_un_perform EQU 321 ; unable to perform function | ||
| 145 | error_ts_wakeup EQU 322 ; unable to wake up | ||
| 146 | error_ts_time EQU 323 ; time value < 0 | ||
| 147 | error_ts_notimer EQU 324 ; no times available | ||
| 148 | error_ts_ticktype EQU 325 ; tick type not 0 or 1 | ||
| 149 | error_ts_handle EQU 326 ; invalid timer handle | ||
| 150 | error_ts_datetime EQU 327 ; date or time invalid | ||
| 151 | error_sys_internal EQU 328 ; internal system error | ||
| 152 | error_que_current_name EQU 329 ; current name does not exist | ||
| 153 | error_que_proc_not_owned EQU 330 ; current process does not own queue | ||
| 154 | error_que_proc_owned EQU 331 ; current process owns queue | ||
| 155 | error_que_duplicate EQU 332 ; duplicate name | ||
| 156 | error_que_element_not_exist EQU 333 ; element does not exist | ||
| 157 | error_que_no_memory EQU 334 ; inadequate memory | ||
| 158 | error_que_invalid_name EQU 335 ; invalid name | ||
| 159 | error_que_invalid_priority EQU 336 ; invalid priority parameter | ||
| 160 | error_que_invalid_handle EQU 337 ; invalid queue handle | ||
| 161 | error_que_link_not_found EQU 338 ; link not found | ||
| 162 | error_que_memory_error EQU 339 ; memory error | ||
| 163 | error_que_prev_at_end EQU 340 ; previous element was at end of queue | ||
| 164 | error_que_proc_no_access EQU 341 ; process does not have access to queues | ||
| 165 | error_que_empty EQU 342 ; queue is empty | ||
| 166 | error_que_name_not_exist EQU 343 ; queue name does not exist | ||
| 167 | error_que_not_initialized EQU 344 ; queues not initialized | ||
| 168 | error_que_unable_to_access EQU 345 ; unable to access queues | ||
| 169 | error_que_unable_to_add EQU 346 ; unable to add new queue | ||
| 170 | error_que_unable_to_init EQU 347 ; unable to initialize queues | ||
| 171 | error_vio_register EQU 348 ; vio register disallowed | ||
| 172 | error_bvs_parameter EQU 349 ; invalid parameter supplied | ||
| 173 | error_scs_call EQU 350 ; call issued by other than sm | ||
| 174 | error_scs_value EQU 351 ; value is not for save or restore | ||
| 175 | error_scs_wait_flag EQU 352 ; invalid wait flag setting | ||
| 176 | error_scs_unlock EQU 353 ; screen not previously locked | ||
| 177 | error_sm_init EQU 354 ; session mgr init failed | ||
| 178 | error_sm_sgid EQU 355 ; invalid screen group id | ||
| 179 | error_sm_nosg EQU 356 ; all screen groups in use | ||
| 180 | error_kbd_parameter EQU 357 ; invalid parameter to kbd | ||
| 181 | |||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | ; | ||
| 188 | ; error codes for utilities | ||
| 189 | ; | ||
| 190 | |||
| 191 | error_invalid_dosver EQU 1000 ; invalid dos version | ||
| 192 | error_language_not_supported EQU 1001 ; language not supported | ||
| 193 | error_msgfile_bad_format EQU 1002 ; bad message file format | ||
| 194 | error_msgfile_bad_mid EQU 1003 ; message file has bad mid | ||
| 195 | error_msgfile_outerror EQU 1004 ; error writing output file | ||
| 196 | error_msgfile_inperror EQU 1005 ; error reading input file | ||
| 197 | error_install_failed EQU 1006 ; install failed | ||
| 198 | |||
| 199 | |||
| 200 | ; | ||
| 201 | ; intercomponent error codes (from 8000H or 32768) | ||
| 202 | ; | ||
| 203 | error_swapper_not_active EQU 32768 ; swapper is not active | ||
| 204 | error_invalid_swapid EQU 32769 ; invalid swap identifier | ||
| 205 | error_ioerr_swap_file EQU 32770 ; i/o error on swap file | ||
| 206 | error_swap_table_full EQU 32771 ; swap control table is full | ||
| 207 | error_swap_file_full EQU 32772 ; swap file is full | ||
| 208 | error_cant_init_swapper EQU 32773 ; cannot initialize swapper | ||
| 209 | error_swapper_already_init EQU 32774 ; swapper already initialized | ||
| 210 | error_pmm_insufficient_memory EQU 32775 ; insufficient memory | ||
| 211 | error_pmm_invalid_flags EQU 32776 ; invalid flags for phys. mem. | ||
| 212 | error_pmm_invalid_address EQU 32777 ; invalid address of phys. mem. | ||
| 213 | error_pmm_lock_failed EQU 32778 ; lock of storage failed | ||
| 214 | error_pmm_unlock_failed EQU 32779 ; unlock of storage failed | ||
| 215 | |||
| 216 | ;break <Interrupt 24 error codes> | ||
| 217 | |||
| 218 | error_I24_write_protect EQU 0 | ||
| 219 | error_I24_bad_unit EQU 1 | ||
| 220 | error_I24_not_ready EQU 2 | ||
| 221 | error_I24_bad_command EQU 3 | ||
| 222 | error_I24_CRC EQU 4 | ||
| 223 | error_I24_bad_length EQU 5 | ||
| 224 | error_I24_Seek EQU 6 | ||
| 225 | error_I24_not_DOS_disk EQU 7 | ||
| 226 | error_I24_sector_not_found EQU 8 | ||
| 227 | error_I24_out_of_paper EQU 9 | ||
| 228 | error_I24_write_fault EQU 0Ah | ||
| 229 | error_I24_read_fault EQU 0Bh | ||
| 230 | error_I24_gen_failure EQU 0Ch | ||
| 231 | error_I24_disk_change EQU 0Dh | ||
| 232 | error_I24_wrong_disk EQU 0Fh | ||
| 233 | error_I24_Uncertain_media EQU 10h | ||
| 234 | error_I24_Char_Call_Interrupted EQU 11h | ||
| 235 | |||
| 236 | ; THE FOLLOWING ARE MASKS FOR THE AH REGISTER ON Int 24 | ||
| 237 | |||
| 238 | Allowed_FAIL EQU 00001000B | ||
| 239 | Allowed_RETRY EQU 00010000B | ||
| 240 | Allowed_IGNORE EQU 00100000B | ||
| 241 | ;NOTE: ABORT is ALWAYS allowed | ||
| 242 | |||
| 243 | I24_operation EQU 00000001B ;Z if READ,NZ if Write | ||
| 244 | I24_area EQU 00000110B ; 00 if DOS | ||
| 245 | ; 01 if FAT | ||
| 246 | ; 10 if root DIR | ||
| 247 | ; 11 if DATA | ||
| 248 | I24_class EQU 10000000B ;Z if DISK, NZ if FAT or char | ||
| 249 | |||
| 250 | ;break <GetExtendedError CLASSes ACTIONs LOCUSs> | ||
| 251 | |||
| 252 | ; Values for error CLASS | ||
| 253 | |||
| 254 | errCLASS_OutRes EQU 1 ; Out of Resource | ||
| 255 | errCLASS_TempSit EQU 2 ; Temporary Situation | ||
| 256 | errCLASS_Auth EQU 3 ; Permission problem | ||
| 257 | errCLASS_Intrn EQU 4 ; Internal System Error | ||
| 258 | errCLASS_HrdFail EQU 5 ; Hardware Failure | ||
| 259 | errCLASS_SysFail EQU 6 ; System Failure | ||
| 260 | errCLASS_Apperr EQU 7 ; Application Error | ||
| 261 | errCLASS_NotFnd EQU 8 ; Not Found | ||
| 262 | errCLASS_BadFmt EQU 9 ; Bad Format | ||
| 263 | errCLASS_Locked EQU 10 ; Locked | ||
| 264 | errCLASS_Media EQU 11 ; Media Failure | ||
| 265 | errCLASS_Already EQU 12 ; Collision with Existing Item | ||
| 266 | errCLASS_Unk EQU 13 ; Unknown/other | ||
| 267 | |||
| 268 | ; Values for error ACTION | ||
| 269 | |||
| 270 | errACT_Retry EQU 1 ; Retry | ||
| 271 | errACT_DlyRet EQU 2 ; Delay Retry, retry after pause | ||
| 272 | errACT_User EQU 3 ; Ask user to regive info | ||
| 273 | errACT_Abort EQU 4 ; abort with clean up | ||
| 274 | errACT_Panic EQU 5 ; abort immediately | ||
| 275 | errACT_Ignore EQU 6 ; ignore | ||
| 276 | errACT_IntRet EQU 7 ; Retry after User Intervention | ||
| 277 | |||
| 278 | ; Values for error LOCUS | ||
| 279 | |||
| 280 | errLOC_Unk EQU 1 ; No appropriate value | ||
| 281 | errLOC_Disk EQU 2 ; Random Access Mass Storage | ||
| 282 | errLOC_Net EQU 3 ; Network | ||
| 283 | errLOC_SerDev EQU 4 ; Serial Device | ||
| 284 | errLOC_Mem EQU 5 ; Memory | ||
| 285 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/EXECPGM.ASM b/v4.0/src/MAPPER/EXECPGM.ASM new file mode 100644 index 0000000..738b950 --- /dev/null +++ b/v4.0/src/MAPPER/EXECPGM.ASM | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DOSExecPrg mapper | ||
| 5 | |||
| 6 | buffer segment word public 'buffer' | ||
| 7 | public DosExecPgmCalled | ||
| 8 | DosExecPgmCalled db 0 ;???????????? | ||
| 9 | public DosExecPgmReturnCode | ||
| 10 | DosExecPgmReturnCode dw 0 | ||
| 11 | |||
| 12 | DosExecParameterBlock label word | ||
| 13 | EnvironmentSegment dw 0 | ||
| 14 | ArgumentPointer dd 0 | ||
| 15 | Default_5C_FCB dd 0 | ||
| 16 | Default_6C_FCB dd 0 | ||
| 17 | |||
| 18 | buffer ends | ||
| 19 | |||
| 20 | dosxxx segment byte public 'dos' | ||
| 21 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 22 | ; | ||
| 23 | ; ************************************************************************* * | ||
| 24 | ; * | ||
| 25 | ; * MODULE: DosExecPgm | ||
| 26 | ; * | ||
| 27 | ; * FUNCTION: Allows a program to execute another program | ||
| 28 | ; * | ||
| 29 | ; * CALLING SEQUENCE: | ||
| 30 | ; * | ||
| 31 | ; * push Asyncindic ; execute asynchronously | ||
| 32 | ; * push TraceIndic ; trace process | ||
| 33 | ; * push Argpointer ; address of arguments string | ||
| 34 | ; * push Envpointer ; address of environment string | ||
| 35 | ; * push Processid ; address to put process id | ||
| 36 | ; * push PgmPointer ; address of program filename | ||
| 37 | ; * call dosexecpgm | ||
| 38 | ; * | ||
| 39 | ; * RETURN SEQUENCE: AX = error code | ||
| 40 | ; * | ||
| 41 | ; * | ||
| 42 | ; * | ||
| 43 | ; * MODULES CALLED: INT 21H function 4BH and 4DH | ||
| 44 | ; * | ||
| 45 | ; * | ||
| 46 | ; * | ||
| 47 | ; ************************************************************************* | ||
| 48 | |||
| 49 | public dosexecpgm | ||
| 50 | .sall | ||
| 51 | .xlist | ||
| 52 | include macros.inc | ||
| 53 | .list | ||
| 54 | |||
| 55 | inv_parm equ 0002 | ||
| 56 | not_suf_mem equ 0004 | ||
| 57 | |||
| 58 | str struc | ||
| 59 | old_bp dw ? | ||
| 60 | return dd ? | ||
| 61 | Pgmpointer dd ? ; address of program file name | ||
| 62 | Processid dd ? ; this is used when only sync exec | ||
| 63 | EnvPointer dd ? ; address of environment string | ||
| 64 | ArgPointer dd ? ; address of argument string | ||
| 65 | Traceindic dw ? ; ignored, what is a trace process? | ||
| 66 | Asyncindic dw ? ; ignored, PC-DOS always waits! | ||
| 67 | str ends | ||
| 68 | |||
| 69 | dosexecpgm proc far ; push registers | ||
| 70 | Enter dosexecpgm | ||
| 71 | |||
| 72 | mov ax,seg buffer ; setup buffer segment | ||
| 73 | mov ds,ax ; and copy info into | ||
| 74 | assume ds:buffer ; data buffer | ||
| 75 | |||
| 76 | mov ax,word ptr [bp+2].EnvPointer ; seg portion only for pc-dos | ||
| 77 | mov EnvironmentSegment,ax ; copy environment string | ||
| 78 | |||
| 79 | les di,[bp].ArgPointer | ||
| 80 | mov word ptr ArgumentPointer+0,di ; copy argument string | ||
| 81 | mov word ptr ArgumentPointer+2,es | ||
| 82 | |||
| 83 | xor ax,ax | ||
| 84 | mov word ptr Default_5C_FCB+0,ax ; setup defaults | ||
| 85 | mov word ptr Default_5C_FCB+2,ax | ||
| 86 | |||
| 87 | mov word ptr Default_6C_FCB+0,ax | ||
| 88 | mov word ptr Default_6C_FCB+2,ax | ||
| 89 | |||
| 90 | mov bx,ds | ||
| 91 | mov es,bx | ||
| 92 | mov bx,offset buffer:DosExecParameterBlock | ||
| 93 | |||
| 94 | lds dx,[bp].PgmPointer ; setup program name | ||
| 95 | mov ax,4b00h | ||
| 96 | int 21h ; exec program and | ||
| 97 | jc ErrorExit ; check for error | ||
| 98 | |||
| 99 | mov ah,4dh | ||
| 100 | int 21h ; get return code of program | ||
| 101 | jc ErrorExit ; just executed and jump if | ||
| 102 | ; error | ||
| 103 | mov bx,seg buffer | ||
| 104 | mov ds,bx | ||
| 105 | mov DosExecPgmReturnCode,ax ; else, save return code | ||
| 106 | |||
| 107 | xor ax,ax ; set no error code | ||
| 108 | |||
| 109 | ErrorExit: | ||
| 110 | Mexit ; pop registers | ||
| 111 | ret size str - 6 ; return | ||
| 112 | |||
| 113 | dosexecpgm endp | ||
| 114 | |||
| 115 | dosxxx ends | ||
| 116 | |||
| 117 | end | ||
diff --git a/v4.0/src/MAPPER/EXIT.ASM b/v4.0/src/MAPPER/EXIT.ASM new file mode 100644 index 0000000..5f98f70 --- /dev/null +++ b/v4.0/src/MAPPER/EXIT.ASM | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosExit mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dosexit | ||
| 12 | ;* | ||
| 13 | ;* FUNCTION: Exit a process | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push word action code | ||
| 18 | ;* push word result code | ||
| 19 | ;* call dosexit | ||
| 20 | ;* | ||
| 21 | ;* MODULES CALLED: DOS Int 21h, Function 4ch, terminate process | ||
| 22 | ;* | ||
| 23 | ;********************************************************************* | ||
| 24 | |||
| 25 | public dosexit | ||
| 26 | .sall | ||
| 27 | include macros.inc | ||
| 28 | |||
| 29 | str struc | ||
| 30 | old_bp dw ? | ||
| 31 | return dd ? | ||
| 32 | Result dw ? ; result code | ||
| 33 | Action dw ? ; action code | ||
| 34 | str ends | ||
| 35 | |||
| 36 | dosexit proc far | ||
| 37 | |||
| 38 | Enter DosExit ; push registers | ||
| 39 | |||
| 40 | mov ax,[bp].action ; set resule code area | ||
| 41 | cmp ax,1 ; check for valid action code | ||
| 42 | jg exit ; jump if invalid action code | ||
| 43 | |||
| 44 | mov ax,[bp].result ; else, set result code | ||
| 45 | |||
| 46 | mov ah,4ch ; load opcode | ||
| 47 | int 21h ; do exit | ||
| 48 | |||
| 49 | xor ax,ax ; set good return code | ||
| 50 | |||
| 51 | exit: mexit ; pop registers | ||
| 52 | ret size str - 6 ; return | ||
| 53 | |||
| 54 | dosexit endp | ||
| 55 | |||
| 56 | dosxxx ends | ||
| 57 | |||
| 58 | end | ||
diff --git a/v4.0/src/MAPPER/FIND.INC b/v4.0/src/MAPPER/FIND.INC new file mode 100644 index 0000000..d4e1588 --- /dev/null +++ b/v4.0/src/MAPPER/FIND.INC | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | ; find.inc | ||
| 2 | |||
| 3 | if1 | ||
| 4 | %out find.inc | ||
| 5 | endif | ||
| 6 | |||
| 7 | FileFindBuf struc | ||
| 8 | Create_Date dw ? | ||
| 9 | Create_Time dw ? | ||
| 10 | Access_Date dw ? | ||
| 11 | Access_Time dw ? | ||
| 12 | Write_Date dw ? | ||
| 13 | Write_Time dw ? | ||
| 14 | File_Size dd ? | ||
| 15 | FAlloc_Size dd ? | ||
| 16 | Attributes dw ? | ||
| 17 | String_Len db ? | ||
| 18 | File_Name db 12 dup (?) | ||
| 19 | FileFindBuf ends | ||
| 20 | |||
| 21 | ; | ||
| 22 | ; dta buffer structure | ||
| 23 | ; | ||
| 24 | |||
| 25 | dtastr struc | ||
| 26 | db 21 dup (?) | ||
| 27 | DTAFileAttrib db ? | ||
| 28 | DTAFileTime dw ? | ||
| 29 | DTAFileDate dw ? | ||
| 30 | DTAFileSize dd ? | ||
| 31 | DTAFileName db 13 dup (?) | ||
| 32 | dtastr ends | ||
| 33 | |||
| 34 | MaxFinds equ 8 | ||
| 35 | OpenedHandle equ 08000h | ||
| 36 | |||
| 37 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/FLUSHBUF.ASM b/v4.0/src/MAPPER/FLUSHBUF.ASM new file mode 100644 index 0000000..85e678a --- /dev/null +++ b/v4.0/src/MAPPER/FLUSHBUF.ASM | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | |||
| 4 | title CP/DOS KbdFlushBuffer mapper | ||
| 5 | |||
| 6 | kbdxxx segment byte public 'kbd' | ||
| 7 | assume cs:kbdxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | |||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: kbdflushbuffer | ||
| 12 | ; * | ||
| 13 | ; ************************************************************************* | ||
| 14 | ; | ||
| 15 | public kbdflushbuffer | ||
| 16 | .sall | ||
| 17 | .xlist | ||
| 18 | include kbd.inc | ||
| 19 | .list | ||
| 20 | |||
| 21 | public savedkbdinput | ||
| 22 | savedkbdinput label word | ||
| 23 | db 0 ; Character goes here | ||
| 24 | db 0 ; Not zero means char is here | ||
| 25 | |||
| 26 | |||
| 27 | str struc | ||
| 28 | old_bp dw ? | ||
| 29 | return dd ? | ||
| 30 | handle dw ? ; kbd handle | ||
| 31 | str ends | ||
| 32 | |||
| 33 | kbdflushbuffer proc far | ||
| 34 | Enter KbdFlushBuffer ; push registers | ||
| 35 | mov ah,0bh ; Check for ^C | ||
| 36 | int 021h | ||
| 37 | |||
| 38 | mov ax,0c06h | ||
| 39 | mov dl,-1 | ||
| 40 | int 021h | ||
| 41 | jz nochar | ||
| 42 | |||
| 43 | mov ah,1 | ||
| 44 | mov savedkbdinput,ax | ||
| 45 | jmp done | ||
| 46 | nochar: | ||
| 47 | mov savedkbdinput,0 | ||
| 48 | |||
| 49 | done: sub ax,ax ; set good return code | ||
| 50 | Mexit ; pop registers | ||
| 51 | ret size str - 6 ; return | ||
| 52 | |||
| 53 | kbdflushbuffer endp | ||
| 54 | |||
| 55 | kbdxxx ends | ||
| 56 | |||
| 57 | end | ||
diff --git a/v4.0/src/MAPPER/FREESEG.ASM b/v4.0/src/MAPPER/FREESEG.ASM new file mode 100644 index 0000000..b3f2c1c --- /dev/null +++ b/v4.0/src/MAPPER/FREESEG.ASM | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosFreeSeg mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosFreeSeg | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: dos023.asm | ||
| 14 | ; * | ||
| 15 | ; * FUNCTION: This module deallocates a segment | ||
| 16 | ; * | ||
| 17 | ; * | ||
| 18 | ; * CALLING SEQUENCE: | ||
| 19 | ; * | ||
| 20 | ; * push selector ; selector of the segment | ||
| 21 | ; * call dosfreeseg | ||
| 22 | ; * | ||
| 23 | ; * RETURN SEQUENCE: | ||
| 24 | ; * | ||
| 25 | ; * MODULES CALLED: DOS int 21h, ah=49h | ||
| 26 | ; * | ||
| 27 | ; ************************************************************************* | ||
| 28 | |||
| 29 | public dosfreeseg | ||
| 30 | .sall | ||
| 31 | .xlist | ||
| 32 | include macros.inc | ||
| 33 | .list | ||
| 34 | |||
| 35 | invalid_selector equ 0006h | ||
| 36 | |||
| 37 | |||
| 38 | str struc | ||
| 39 | Old_bp dw ? | ||
| 40 | Return dd ? | ||
| 41 | Selector dw ? ; selector of the segment to be freed | ||
| 42 | str ends | ||
| 43 | |||
| 44 | dosfreeseg proc far | ||
| 45 | Enter dosfreeseg ; push registers | ||
| 46 | |||
| 47 | mov es,[bp].selector ; get selector in es | ||
| 48 | |||
| 49 | mov ah,49h | ||
| 50 | int 21h ; free memory segment | ||
| 51 | jc error ; jump if error | ||
| 52 | |||
| 53 | sub ax,ax ; zero return code | ||
| 54 | jmp exit ; go to exit | ||
| 55 | |||
| 56 | error: mov ax,invalid_selector ; put in error code | ||
| 57 | |||
| 58 | exit: Mexit ; pop registers | ||
| 59 | ret size str - 6 ; return | ||
| 60 | |||
| 61 | dosfreeseg endp | ||
| 62 | |||
| 63 | dosxxx ends | ||
| 64 | |||
| 65 | end | ||
diff --git a/v4.0/src/MAPPER/F_CLOSE.ASM b/v4.0/src/MAPPER/F_CLOSE.ASM new file mode 100644 index 0000000..2da07b5 --- /dev/null +++ b/v4.0/src/MAPPER/F_CLOSE.ASM | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosFindClose mapper | ||
| 4 | |||
| 5 | include find.inc | ||
| 6 | |||
| 7 | |||
| 8 | FindSegment segment word public 'find' | ||
| 9 | |||
| 10 | ; We will use the offset into the segment 'FindSegment' as the handle that we | ||
| 11 | ; return and use in subsequent FindNext and FindClose calls. The data that is | ||
| 12 | ; in the word is the offset into the 'FindSegment' to the DTA that we should | ||
| 13 | ; use. | ||
| 14 | extrn FindDTAs:word | ||
| 15 | extrn FindHandles:word | ||
| 16 | |||
| 17 | FindSegment ends | ||
| 18 | |||
| 19 | |||
| 20 | ; ************************************************************************* * | ||
| 21 | ; * | ||
| 22 | ; * MODULE: DosFindClose | ||
| 23 | ; * | ||
| 24 | ; * FUNCTION: Close Find Handle | ||
| 25 | ; * | ||
| 26 | ; * FUNCTION: This module closes the directory handle used by CP/DOS | ||
| 27 | ; * in a find first/find next search. Since PC/DOS does not | ||
| 28 | ; * use directory handles it will simply return to the caller | ||
| 29 | ; * removing the parameters passed on the stack. | ||
| 30 | ; * | ||
| 31 | ; * CALLING SEQUENCE: | ||
| 32 | ; * | ||
| 33 | ; * PUSH WORD DirHandle ; Directory search handle | ||
| 34 | ; * CALL DosFindClose | ||
| 35 | ; * | ||
| 36 | ; * | ||
| 37 | ; * RETURN SEQUENCE: | ||
| 38 | ; * | ||
| 39 | ; * IF ERROR (AX not = 0) | ||
| 40 | ; * | ||
| 41 | ; * AX = Error Code: | ||
| 42 | ; * | ||
| 43 | ; * | ||
| 44 | ; * MODULES CALLED: None | ||
| 45 | ; * | ||
| 46 | ; ************************************************************************* | ||
| 47 | |||
| 48 | public DosFindClose | ||
| 49 | .sall | ||
| 50 | .xlist | ||
| 51 | include macros.inc | ||
| 52 | .list | ||
| 53 | |||
| 54 | str struc | ||
| 55 | old_bp dw ? | ||
| 56 | return dd ? | ||
| 57 | DirHandle dw ? ; dirctory search handle | ||
| 58 | str ends | ||
| 59 | |||
| 60 | |||
| 61 | dosxxx segment byte public 'dos' | ||
| 62 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 63 | |||
| 64 | DosFindClose proc far | ||
| 65 | Enter DosFindClose ; push registers | ||
| 66 | |||
| 67 | mov ax,seg FindSegment ; get address to our data | ||
| 68 | mov ds,ax | ||
| 69 | assume ds:FindSegment | ||
| 70 | |||
| 71 | ; Close the handle | ||
| 72 | |||
| 73 | ; The 'DirHandle' that the mapper returns from FindFirst, is the offset into | ||
| 74 | ; 'FindSegment' of the pointer to the DTA for that Handle. The 08000h bit | ||
| 75 | ; of the pointer is used to indicate that the handle is open. Reset the bit. | ||
| 76 | |||
| 77 | ; Special Logic to handle DirHandle = 1 | ||
| 78 | |||
| 79 | mov si,[bp].DirHandle ; get directory hanlde | ||
| 80 | cmp si,1 ; handle = 1?? | ||
| 81 | jne CheckForClose ; branch if not | ||
| 82 | |||
| 83 | mov si,offset FindSegment:FindHandles | ||
| 84 | |||
| 85 | CheckForClose: | ||
| 86 | test ds:[si],OpenedHandle ; handle is open ?? | ||
| 87 | jnz OkToClose ; go and close if it is open | ||
| 88 | |||
| 89 | mov ax,6 ; else load error code | ||
| 90 | jmp ErrorExit ; return | ||
| 91 | |||
| 92 | OkToClose: | ||
| 93 | and ds:[si],not OpenedHandle ; set close flag | ||
| 94 | xor ax,ax ; set good return code | ||
| 95 | |||
| 96 | ErrorExit: | ||
| 97 | mexit ; pop registers | ||
| 98 | ret size str - 6 ; return | ||
| 99 | |||
| 100 | DosFindClose endp | ||
| 101 | |||
| 102 | dosxxx ends | ||
| 103 | |||
| 104 | end | ||
diff --git a/v4.0/src/MAPPER/F_FIRST.ASM b/v4.0/src/MAPPER/F_FIRST.ASM new file mode 100644 index 0000000..90f6e7f --- /dev/null +++ b/v4.0/src/MAPPER/F_FIRST.ASM | |||
| @@ -0,0 +1,354 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosFindFirst mapper | ||
| 4 | |||
| 5 | |||
| 6 | include find.inc | ||
| 7 | |||
| 8 | FindSegment segment word public 'find' | ||
| 9 | |||
| 10 | public SearchCount | ||
| 11 | SearchCount dw 0 | ||
| 12 | public ReturnBufferSave | ||
| 13 | ReturnBufferSave dd 0 | ||
| 14 | public CurrentDTA | ||
| 15 | CurrentDTA dw 0 | ||
| 16 | public ReturnLengthToGo | ||
| 17 | ReturnLengthToGo dw 0 | ||
| 18 | |||
| 19 | public SaveDTA | ||
| 20 | SaveDTA Label dword | ||
| 21 | public SaveDTAOffset | ||
| 22 | SaveDTAOffset dw 0 | ||
| 23 | public SaveDTASegment | ||
| 24 | SaveDTASegment dw 0 | ||
| 25 | public SaveDTAFlag | ||
| 26 | SaveDTAFlag db 0 ; 0 -> not saved | ||
| 27 | ; 1 -> is saved | ||
| 28 | |||
| 29 | ; We will use the offset into the segment 'FindSegment' as the handle that we | ||
| 30 | ; return and use in subsequent FindNext and FindClose calls. The data that is | ||
| 31 | ; in the word is the offset into the 'FindSegment' to the DTA that we should | ||
| 32 | ; use. | ||
| 33 | |||
| 34 | public FindDTAs | ||
| 35 | FindDTAs label word | ||
| 36 | rept MaxFinds | ||
| 37 | dtastr <> | ||
| 38 | endm | ||
| 39 | |||
| 40 | public FindHandles | ||
| 41 | FindHandles label word | ||
| 42 | FindDTAIndex = 0 | ||
| 43 | rept MaxFinds | ||
| 44 | dw FindDTAs + FindDTAIndex | ||
| 45 | FindDTAIndex = FindDTAIndex + size dtastr | ||
| 46 | endm | ||
| 47 | |||
| 48 | |||
| 49 | FindSegment ends | ||
| 50 | |||
| 51 | dosxxx segment byte public 'dos' | ||
| 52 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 53 | |||
| 54 | ; ************************************************************************* * | ||
| 55 | ; * | ||
| 56 | ; * MODULE: DosFindFirst | ||
| 57 | ; * | ||
| 58 | ; * FILE NAME: DOS021.ASM | ||
| 59 | ; * | ||
| 60 | ; * FUNCTION: This module Finds the first filename that matches the | ||
| 61 | ; * specified file specification. The directory handle | ||
| 62 | ; * parameter passed will be ignored since PC/DOS does not | ||
| 63 | ; * support directory handles. The last access, last write | ||
| 64 | ; * and the creation date and time are all set to the same, | ||
| 65 | ; * because PC/DOS does not have seperate last access and | ||
| 66 | ; * last write fields in the directory. The allocation | ||
| 67 | ; * fields are set equal to the eod because of the same | ||
| 68 | ; * reason. | ||
| 69 | ; * | ||
| 70 | ; * CALLING SEQUENCE: | ||
| 71 | ; * | ||
| 72 | ; * PUSH@ ASCIIZ FileName ; File path name | ||
| 73 | ; * PUSH@ WORD DirHandle ; Directory search handle | ||
| 74 | ; * PUSH WORD Attribute ; Search attribute | ||
| 75 | ; * PUSH@ OTHER ResultBuf ; Result buffer | ||
| 76 | ; * PUSH DWORD ResultBufLen ; Result buffer length | ||
| 77 | ; * PUSH@ WORD SearchCount ; # of entries to find | ||
| 78 | ; * PUSH DWORD 0 ; Reserved (must be zero) | ||
| 79 | ; * CALL DosFindFirst | ||
| 80 | ; * | ||
| 81 | ; * RETURN SEQUENCE: | ||
| 82 | ; * | ||
| 83 | ; * IF ERROR (AX not = 0) | ||
| 84 | ; * | ||
| 85 | ; * AX = Error Code: | ||
| 86 | ; * | ||
| 87 | ; * o Invalid file path name | ||
| 88 | ; * | ||
| 89 | ; * o Invalid search attribute | ||
| 90 | ; * | ||
| 91 | ; * MODULES CALLED: DOS int 21H function 2FH | ||
| 92 | ; * DOS int 21H function 4EH | ||
| 93 | ; * DOS int 21H function 4FH | ||
| 94 | ; * | ||
| 95 | ; ************************************************************************* | ||
| 96 | ; | ||
| 97 | public DosFindFirst | ||
| 98 | .sall | ||
| 99 | .xlist | ||
| 100 | include macros.inc | ||
| 101 | .list | ||
| 102 | |||
| 103 | |||
| 104 | str struc | ||
| 105 | old_bp dw ? | ||
| 106 | return dd ? | ||
| 107 | ReservedZero dd 0 ; reserved | ||
| 108 | FindCountPtr dd ? ; number of entries to find | ||
| 109 | FindBufferLen dw ? ; result buffer lenght | ||
| 110 | FindBufferPtr dd ? ; result buffer pointer | ||
| 111 | FileAttribute dw ? ; search attribute | ||
| 112 | DirHandlePtr dd ? ; directory search handle | ||
| 113 | PathNamePtr dd ? ; file path name pointer | ||
| 114 | str ends | ||
| 115 | |||
| 116 | |||
| 117 | DosFindFirst proc far | ||
| 118 | |||
| 119 | Enter DosFindFirst | ||
| 120 | |||
| 121 | mov ax,seg FindSegment ; get address to our data | ||
| 122 | mov ds,ax | ||
| 123 | assume ds:FindSegment | ||
| 124 | |||
| 125 | ; Search for an available Find Handle | ||
| 126 | |||
| 127 | ; The Dir handle that we will return is the offset into the 'FindSegment' that | ||
| 128 | ; the pointer to the DTA for that handle is at. Two special things: | ||
| 129 | ; | ||
| 130 | ; 1) when we see file handle one, will use the first pointer and DTA | ||
| 131 | ; 2) the high order bit of the DTA pointer is used to indicate that | ||
| 132 | ; the handle is allocated | ||
| 133 | |||
| 134 | mov si,offset FindSegment:FindHandles | ||
| 135 | mov cx,MaxFinds | ||
| 136 | |||
| 137 | ; DS:[SI] -> Find DTA Pointer Table | ||
| 138 | ; CX = number of Find DTAs | ||
| 139 | |||
| 140 | ; Incoming DirHandle = -1 ==> allocate a new dir handle | ||
| 141 | |||
| 142 | les di,[bp].DirHandlePtr | ||
| 143 | mov ax,es:[di] | ||
| 144 | cmp ax,-1 | ||
| 145 | je AllocateHandle | ||
| 146 | |||
| 147 | ; Incoming DirHandle = 1, we will use the first DTA | ||
| 148 | |||
| 149 | cmp ax,1 | ||
| 150 | je HandleFound | ||
| 151 | |||
| 152 | ; We have not been requested to allocate a new handle, and we are not using | ||
| 153 | ; DirHandle 1. At this time, we need to reuse the incoming handle, but only | ||
| 154 | ; if it is a valid (ie - previously allocated by us) DirHandle | ||
| 155 | |||
| 156 | mov si,ax ; verify it is an active handle | ||
| 157 | test ds:[si],OpenedHandle | ||
| 158 | jnz HandleFound ; jump if true | ||
| 159 | |||
| 160 | mov ax,6 ; else set error code | ||
| 161 | jmp ErrorExit ; return | ||
| 162 | |||
| 163 | ; Allocate a new handle from the DTA pointer list | ||
| 164 | |||
| 165 | AllocateHandle: | ||
| 166 | add si,2 | ||
| 167 | dec cx | ||
| 168 | |||
| 169 | FindHandleLoop: | ||
| 170 | test ds:[si],OpenedHandle | ||
| 171 | jz HandleFound | ||
| 172 | |||
| 173 | add si,2 | ||
| 174 | loop FindHandleLoop | ||
| 175 | |||
| 176 | ; No Handles available, return error | ||
| 177 | |||
| 178 | mov ax,4 ; report 'no handles available' | ||
| 179 | jmp ErrorExit ; error return - buffer not large enough | ||
| 180 | |||
| 181 | |||
| 182 | ; We have a handle, let's look for the file(s) | ||
| 183 | |||
| 184 | HandleFound: | ||
| 185 | mov ax,ds:[si] ; get the dta pointer | ||
| 186 | or ds:[si],OpenedHandle ; allocate the handle | ||
| 187 | and ax,not OpenedHandle | ||
| 188 | mov CurrentDTA,ax | ||
| 189 | |||
| 190 | les di,[bp].DirHandlePtr ; the handle number we return is the | ||
| 191 | mov es:[di],si ; offset to the entry in FindSegment | ||
| 192 | |||
| 193 | ; save the callers dta so we can restore it later | ||
| 194 | |||
| 195 | mov ah,02fh ; get callers DTA | ||
| 196 | int 21h | ||
| 197 | |||
| 198 | mov SaveDTAOffset,bx ; save it | ||
| 199 | mov SaveDTASegment,es | ||
| 200 | mov SaveDTAFlag,1 | ||
| 201 | |||
| 202 | ; Set the dta to our area | ||
| 203 | |||
| 204 | mov dx,CurrentDTA ; set DTA address | ||
| 205 | mov ah,1ah | ||
| 206 | int 21h | ||
| 207 | |||
| 208 | ; Get the count of files to search for | ||
| 209 | |||
| 210 | les di,[bp].FindCountPtr ; load result buffer pointer | ||
| 211 | mov ax,es:[di] ; save the search | ||
| 212 | mov SearchCount,ax ; count | ||
| 213 | mov es:word ptr [di],0 ; set found count to zero | ||
| 214 | |||
| 215 | cmp ax,0 ; just in case they try to trick us! | ||
| 216 | jne DoSearch | ||
| 217 | |||
| 218 | jmp SearchDone | ||
| 219 | |||
| 220 | ; Find first file | ||
| 221 | |||
| 222 | DoSearch: | ||
| 223 | lds dx,[bp].PathNamePtr ; load address of asciiz string | ||
| 224 | assume ds:nothing | ||
| 225 | mov cx,[bp].FileAttribute ; load the attribute | ||
| 226 | mov ax,04E00h | ||
| 227 | int 21h ; find the first occurance of file | ||
| 228 | jnc FindFirstOK ; continue | ||
| 229 | |||
| 230 | jmp ErrorExit | ||
| 231 | |||
| 232 | FindFirstOK: | ||
| 233 | mov ax,seg FindSegment | ||
| 234 | mov ds,ax | ||
| 235 | assume ds:FindSegment | ||
| 236 | |||
| 237 | mov ax,[bp].FindBufferLen ; load the buffer length | ||
| 238 | mov ReturnLengthToGo,ax ; save low order buffer length | ||
| 239 | |||
| 240 | les di,[bp].FindBufferPtr ; load result buffer pointer | ||
| 241 | |||
| 242 | mov word ptr ReturnBufferSave+0,di | ||
| 243 | mov word ptr ReturnBufferSave+2,es | ||
| 244 | |||
| 245 | ; Move find data into the return areas | ||
| 246 | |||
| 247 | MoveFindData: | ||
| 248 | sub ReturnLengthToGo,size FileFindBuf ; check if result buffer is larg enough | ||
| 249 | jnc BufferLengthOk ; it is ok | ||
| 250 | |||
| 251 | mov ax,8 ; report 'Insufficient memory' | ||
| 252 | jmp ErrorExit ; error return - buffer not large enough | ||
| 253 | |||
| 254 | BufferLengthOk: | ||
| 255 | mov si,CurrentDTA ; DS:SI -> our dta area | ||
| 256 | les di,ReturnBufferSave | ||
| 257 | |||
| 258 | ; At this point, the following MUST be true: | ||
| 259 | ; es:di -> where we are to put the resultant data | ||
| 260 | ; ds:si -> DTA from find (either first or next) | ||
| 261 | |||
| 262 | mov ax,ds:[si].DTAFileDate ; save date | ||
| 263 | mov es:[di].Create_Date,ax | ||
| 264 | mov es:[di].Access_Date,ax | ||
| 265 | mov es:[di].Write_Date,ax | ||
| 266 | |||
| 267 | mov ax,ds:[si].DTAFileTime ; save time | ||
| 268 | mov es:[di].Create_Time,ax | ||
| 269 | mov es:[di].Access_Time,ax | ||
| 270 | mov es:[di].Write_Time,ax | ||
| 271 | |||
| 272 | mov ax,ds:word ptr [si].DTAFileSize+0 ; save file size | ||
| 273 | mov es:word ptr [di].File_Size+0,ax | ||
| 274 | mov es:word ptr [di].FAlloc_Size+0,ax | ||
| 275 | mov ax,ds:word ptr [si].DTAFileSize+2 | ||
| 276 | mov es:word ptr [di].File_Size+2,ax | ||
| 277 | mov es:word ptr [di].FAlloc_Size+2,ax | ||
| 278 | |||
| 279 | test es:word ptr [di].FAlloc_Size,001ffh | ||
| 280 | jz AllocateSizeSet | ||
| 281 | |||
| 282 | and es:word ptr [di].FAlloc_Size,not 001ffh | ||
| 283 | add es:word ptr [di].FAlloc_Size,00200h | ||
| 284 | |||
| 285 | AllocateSizeSet: | ||
| 286 | xor ax,ax | ||
| 287 | mov al,ds:[si].DTAFileAttrib | ||
| 288 | mov es:[di].Attributes,ax | ||
| 289 | |||
| 290 | mov cx,12 | ||
| 291 | mov bx,0 | ||
| 292 | |||
| 293 | MoveNameLoop: | ||
| 294 | mov al,ds:[si+bx].DTAFileName | ||
| 295 | cmp al,0 | ||
| 296 | je EndOfName | ||
| 297 | |||
| 298 | mov es:[di+bx].File_Name,al | ||
| 299 | inc bx | ||
| 300 | loop MoveNameLoop | ||
| 301 | |||
| 302 | EndOfName: | ||
| 303 | mov es:[di+bx].File_Name,0 | ||
| 304 | mov ax,bx | ||
| 305 | mov es:[di].String_len,al | ||
| 306 | |||
| 307 | add di,bx | ||
| 308 | mov word ptr ReturnBufferSave+0,di | ||
| 309 | mov word ptr ReturnBufferSave+2,es | ||
| 310 | |||
| 311 | les di,[bp].FindCountPtr | ||
| 312 | inc word ptr es:[di] | ||
| 313 | |||
| 314 | ; | ||
| 315 | ; Check if the request was for more than one | ||
| 316 | ; | ||
| 317 | dec SearchCount | ||
| 318 | jz SearchDone | ||
| 319 | |||
| 320 | mov ax,04f00h ; set opcode | ||
| 321 | int 21h ; find next matching file | ||
| 322 | jc ErrorExit ; jump if error | ||
| 323 | |||
| 324 | les di,ReturnBufferSave ; | ||
| 325 | jmp MoveFindData | ||
| 326 | |||
| 327 | SearchDone: | ||
| 328 | sub ax,ax ; set good return code | ||
| 329 | |||
| 330 | ErrorExit: | ||
| 331 | push ax | ||
| 332 | mov ax,seg FindSegment | ||
| 333 | mov ds,ax | ||
| 334 | assume ds:FindSegment | ||
| 335 | cmp SaveDTAFlag,0 | ||
| 336 | je DoNotRestore | ||
| 337 | |||
| 338 | mov SaveDTAFlag,0 | ||
| 339 | |||
| 340 | lds dx,SaveDTA | ||
| 341 | mov ah,1ah ; load opcode | ||
| 342 | int 21h ; setup DTA | ||
| 343 | |||
| 344 | DoNotRestore: | ||
| 345 | pop ax | ||
| 346 | |||
| 347 | mexit ; pop registers | ||
| 348 | ret size str - 6 ; return | ||
| 349 | |||
| 350 | DosFindFirst endp | ||
| 351 | |||
| 352 | dosxxx ends | ||
| 353 | |||
| 354 | end | ||
diff --git a/v4.0/src/MAPPER/F_NEXT.ASM b/v4.0/src/MAPPER/F_NEXT.ASM new file mode 100644 index 0000000..eaef626 --- /dev/null +++ b/v4.0/src/MAPPER/F_NEXT.ASM | |||
| @@ -0,0 +1,271 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosFindNext mapper | ||
| 5 | ; | ||
| 6 | |||
| 7 | include find.inc | ||
| 8 | |||
| 9 | FindSegment segment word public 'find' | ||
| 10 | |||
| 11 | extrn SearchCount:word | ||
| 12 | extrn ReturnBufferSave:dword | ||
| 13 | extrn CurrentDTA:word | ||
| 14 | extrn ReturnLengthToGo:word | ||
| 15 | |||
| 16 | extrn SaveDTA:dword | ||
| 17 | extrn SaveDTAOffset:word | ||
| 18 | extrn SaveDTASegment:word | ||
| 19 | extrn SaveDTAFlag:byte | ||
| 20 | |||
| 21 | ; We will use the offset into the segment 'FindSegment' as the handle that we | ||
| 22 | ; return and use in subsequent FindNext and FindClose calls. The data that is | ||
| 23 | ; in the word is the offset into the 'FindSegment' to the DTA that we should | ||
| 24 | ; use. | ||
| 25 | |||
| 26 | extrn FindDTAs:word | ||
| 27 | |||
| 28 | extrn FindHandles:word | ||
| 29 | |||
| 30 | FindSegment ends | ||
| 31 | |||
| 32 | dosxxx segment byte public 'dos' | ||
| 33 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 34 | ; | ||
| 35 | ; ************************************************************************* * | ||
| 36 | ; * | ||
| 37 | ; * MODULE: DosFindNext | ||
| 38 | ; * | ||
| 39 | ; * FILE NAME: DOS022.ASM | ||
| 40 | ; * | ||
| 41 | ; * FUNCTION: This module finds the next file in a sequence initiated | ||
| 42 | ; * by the find first the command. | ||
| 43 | ; * | ||
| 44 | ; * | ||
| 45 | ; * | ||
| 46 | ; * | ||
| 47 | ; * CALLING SEQUENCE: | ||
| 48 | ; * | ||
| 49 | ; * PUSH WORD DirHandle ; Directory search handle | ||
| 50 | ; * PUSH@ OTHER ResultBuf ; Result buffer | ||
| 51 | ; * PUSH DWORD ResultBufLen ; Result buffer length | ||
| 52 | ; * PUSH@ WORD SearchCount ; # of entries to find | ||
| 53 | ; * CALL DosFindNext | ||
| 54 | ; * | ||
| 55 | ; * | ||
| 56 | ; * RETURN SEQUENCE: | ||
| 57 | ; * | ||
| 58 | ; * IF ERROR (AX not = 0) | ||
| 59 | ; * | ||
| 60 | ; * AX = Error Code: | ||
| 61 | ; * | ||
| 62 | ; * o Invalid file path name | ||
| 63 | ; * | ||
| 64 | ; * o Invalid search attribute | ||
| 65 | ; * | ||
| 66 | ; * MODULES CALLED: DOS int 21H function 2FH | ||
| 67 | ; * DOS int 21H function 4FH | ||
| 68 | ; * | ||
| 69 | ; ************************************************************************* | ||
| 70 | ; | ||
| 71 | public DosFindNext | ||
| 72 | .sall | ||
| 73 | .xlist | ||
| 74 | include macros.inc | ||
| 75 | .list | ||
| 76 | ; | ||
| 77 | |||
| 78 | str struc | ||
| 79 | old_bp dw ? | ||
| 80 | return dd ? | ||
| 81 | FindCountPtr dd ? | ||
| 82 | FindBufferLen dw ? | ||
| 83 | FindBufferPtr dd ? ;Changed to DW to match the DOSCALL.h PyL 6/1 Rsltbuf21 dd ? | ||
| 84 | DirHandle dw ? | ||
| 85 | str ends | ||
| 86 | |||
| 87 | ; | ||
| 88 | DosFindNext proc far | ||
| 89 | |||
| 90 | |||
| 91 | Enter DosFindNext | ||
| 92 | |||
| 93 | mov ax,seg FindSegment ; get address to our data | ||
| 94 | mov ds,ax | ||
| 95 | assume ds:FindSegment | ||
| 96 | |||
| 97 | ; check for a valid dir handle | ||
| 98 | |||
| 99 | ; Special Logic to handle DirHandle = 1 | ||
| 100 | |||
| 101 | mov si,[bp].DirHandle | ||
| 102 | cmp si,1 | ||
| 103 | jne CheckForNext | ||
| 104 | |||
| 105 | mov si,offset FindSegment:FindHandles | ||
| 106 | |||
| 107 | CheckForNext: | ||
| 108 | test ds:[si],OpenedHandle | ||
| 109 | jnz OkToFindNext | ||
| 110 | |||
| 111 | mov ax,6 | ||
| 112 | jmp ErrorExit | ||
| 113 | |||
| 114 | OkToFindNext: | ||
| 115 | |||
| 116 | ; We have a handle, let's look for the file(s) | ||
| 117 | |||
| 118 | HandleFound: | ||
| 119 | mov si,ds:[si] ; get the DTA pointer | ||
| 120 | and si,not OpenedHandle ; and get rid of the allocated flag | ||
| 121 | mov CurrentDTA,si ; and save the current DTA value | ||
| 122 | |||
| 123 | ; save the callers dta so we can restore it later | ||
| 124 | |||
| 125 | mov ah,02fh | ||
| 126 | int 21h | ||
| 127 | mov SaveDTAOffset,bx | ||
| 128 | mov SaveDTASegment,es | ||
| 129 | mov SaveDTAFlag,1 | ||
| 130 | |||
| 131 | ; Set the dta to our area | ||
| 132 | |||
| 133 | mov dx,CurrentDTA | ||
| 134 | mov ah,1ah | ||
| 135 | int 21h | ||
| 136 | |||
| 137 | ; Get the count of files to search for | ||
| 138 | |||
| 139 | les di,[bp].FindCountPtr ; load result buffer pointer | ||
| 140 | mov ax,es:[di] ; save the search | ||
| 141 | mov SearchCount,ax ; count | ||
| 142 | mov es:word ptr [di],0 ; set found count to zero | ||
| 143 | |||
| 144 | cmp ax,0 ; just in case they try to trick us! | ||
| 145 | jne DoSearch | ||
| 146 | |||
| 147 | jmp SearchDone | ||
| 148 | |||
| 149 | ; Find first file | ||
| 150 | |||
| 151 | DoSearch: | ||
| 152 | mov ax,[bp].FindBufferLen ; load the buffer length | ||
| 153 | mov ReturnLengthToGo,ax ; save low order buffer length | ||
| 154 | |||
| 155 | les di,[bp].FindBufferPtr ; load result buffer pointer | ||
| 156 | mov word ptr ReturnBufferSave+0,di | ||
| 157 | mov word ptr ReturnBufferSave+2,es | ||
| 158 | |||
| 159 | DoFindNext: | ||
| 160 | mov ax,4f00h | ||
| 161 | int 21h | ||
| 162 | jnc MoveFindData | ||
| 163 | |||
| 164 | jmp ErrorExit | ||
| 165 | |||
| 166 | ; Move find data into the return areas | ||
| 167 | |||
| 168 | MoveFindData: | ||
| 169 | sub ReturnLengthToGo,size FileFindBuf ; check if result buffer is larg enough | ||
| 170 | jnc BufferLengthOk ; it is ok | ||
| 171 | |||
| 172 | mov ax,8 ; report 'Insufficient memory' | ||
| 173 | jmp ErrorExit ; error return - buffer not large enough | ||
| 174 | |||
| 175 | BufferLengthOk: | ||
| 176 | mov si,CurrentDTA ; DS:SI -> our dta area | ||
| 177 | les di,ReturnBufferSave | ||
| 178 | |||
| 179 | ; At this point, the following MUST be true: | ||
| 180 | ; es:di -> where we are to put the resultant data | ||
| 181 | ; ds:si -> DTA from find (either first or next) | ||
| 182 | |||
| 183 | mov ax,ds:[si].DTAFileDate | ||
| 184 | mov es:[di].Create_Date,ax | ||
| 185 | mov es:[di].Access_Date,ax | ||
| 186 | mov es:[di].Write_Date,ax | ||
| 187 | |||
| 188 | mov ax,ds:[si].DTAFileTime | ||
| 189 | mov es:[di].Create_Time,ax | ||
| 190 | mov es:[di].Access_Time,ax | ||
| 191 | mov es:[di].Write_Time,ax | ||
| 192 | |||
| 193 | mov ax,ds:word ptr [si].DTAFileSize+0 | ||
| 194 | mov es:word ptr [di].File_Size+0,ax | ||
| 195 | mov es:word ptr [di].FAlloc_Size+0,ax | ||
| 196 | mov ax,ds:word ptr [si].DTAFileSize+2 | ||
| 197 | mov es:word ptr [di].File_Size+2,ax | ||
| 198 | mov es:word ptr [di].FAlloc_Size+2,ax | ||
| 199 | |||
| 200 | test es:word ptr [di].FAlloc_Size,001ffh | ||
| 201 | jz AllocateSizeSet | ||
| 202 | |||
| 203 | and es:word ptr [di].FAlloc_Size,not 001ffh | ||
| 204 | add es:word ptr [di].FAlloc_Size,00200h | ||
| 205 | |||
| 206 | AllocateSizeSet: | ||
| 207 | xor ax,ax | ||
| 208 | mov al,ds:[si].DTAFileAttrib | ||
| 209 | mov es:[di].Attributes,ax | ||
| 210 | |||
| 211 | mov cx,12 | ||
| 212 | mov bx,0 | ||
| 213 | |||
| 214 | MoveNameLoop: | ||
| 215 | mov al,ds:[si+bx].DTAFileName | ||
| 216 | cmp al,0 | ||
| 217 | je EndOfName | ||
| 218 | |||
| 219 | mov es:[di+bx].File_Name,al | ||
| 220 | inc bx | ||
| 221 | loop MoveNameLoop | ||
| 222 | |||
| 223 | EndOfName: | ||
| 224 | mov es:[di+bx].File_Name,0 | ||
| 225 | mov ax,bx | ||
| 226 | mov es:[di].String_len,al | ||
| 227 | |||
| 228 | add di,bx | ||
| 229 | mov word ptr ReturnBufferSave+0,di | ||
| 230 | mov word ptr ReturnBufferSave+2,es | ||
| 231 | |||
| 232 | les di,[bp].FindCountPtr | ||
| 233 | inc word ptr es:[di] | ||
| 234 | |||
| 235 | ; | ||
| 236 | ; Check if the request was for more than one | ||
| 237 | ; | ||
| 238 | dec SearchCount | ||
| 239 | jz SearchDone | ||
| 240 | |||
| 241 | jmp DoFindNext | ||
| 242 | |||
| 243 | SearchDone: | ||
| 244 | sub ax,ax ; set good return code | ||
| 245 | |||
| 246 | ErrorExit: | ||
| 247 | push ax | ||
| 248 | mov ax,seg FindSegment | ||
| 249 | mov ds,ax | ||
| 250 | assume ds:FindSegment | ||
| 251 | cmp SaveDTAFlag,0 | ||
| 252 | je DoNotRestore | ||
| 253 | |||
| 254 | mov SaveDTAFlag,0 | ||
| 255 | |||
| 256 | lds dx,SaveDTA | ||
| 257 | mov ah,1ah | ||
| 258 | int 21h | ||
| 259 | |||
| 260 | DoNotRestore: | ||
| 261 | pop ax | ||
| 262 | |||
| 263 | mexit | ||
| 264 | |||
| 265 | ret size str - 6 | ||
| 266 | |||
| 267 | DosFindNext endp | ||
| 268 | |||
| 269 | dosxxx ends | ||
| 270 | |||
| 271 | end | ||
diff --git a/v4.0/src/MAPPER/GETCNTRY.ASM b/v4.0/src/MAPPER/GETCNTRY.ASM new file mode 100644 index 0000000..d107b9d --- /dev/null +++ b/v4.0/src/MAPPER/GETCNTRY.ASM | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosGetCtryInfo mapper | ||
| 5 | |||
| 6 | Buffer segment word public 'buffer' | ||
| 7 | CountryInfo db 64 | ||
| 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: dosgetctryinfo | ||
| 16 | ;* | ||
| 17 | ;* FUNCTION:get country information | ||
| 18 | ;* | ||
| 19 | ;* CALLING SEQUENCE: | ||
| 20 | ;* | ||
| 21 | ;* push word data area length | ||
| 22 | ;* push word country code | ||
| 23 | ;* push@ struc data area | ||
| 24 | ;* call dosgetctryinfo | ||
| 25 | ;* | ||
| 26 | ;* MODULES CALLED: PC-DOS Int 21h, ah=38h, get cntry info | ||
| 27 | ;* | ||
| 28 | ;********************************************************************* | ||
| 29 | |||
| 30 | public dosgetctryinfo | ||
| 31 | .sall | ||
| 32 | include macros.inc | ||
| 33 | |||
| 34 | |||
| 35 | str struc | ||
| 36 | old_bp dw ? | ||
| 37 | return dd ? | ||
| 38 | ReturnLength dd ? | ||
| 39 | BufferPtr dd ? | ||
| 40 | CountryCodePtr dd ? | ||
| 41 | BufferLength dw ? | ||
| 42 | str ends | ||
| 43 | |||
| 44 | |||
| 45 | cntry struc ;country info. sturctrue | ||
| 46 | ctry_code dw ? | ||
| 47 | code_page dw ? | ||
| 48 | dformat dw ? | ||
| 49 | curr_sym db 5 dup(?) | ||
| 50 | thous_sep dw ? | ||
| 51 | decimal_sep dw ? | ||
| 52 | date_sep dw ? | ||
| 53 | time_sep dw ? | ||
| 54 | bit_field db ? | ||
| 55 | curr_cents db ? | ||
| 56 | tformat db ? | ||
| 57 | map_call dd ? | ||
| 58 | data_sep dw ? | ||
| 59 | ra db 5 dup(?) | ||
| 60 | cntry ends | ||
| 61 | |||
| 62 | |||
| 63 | Doscntry struc ;country info. sturctrue | ||
| 64 | Ddformat dw ? | ||
| 65 | Dcurr_sym db 5 dup(?) | ||
| 66 | Dthous_sep dw ? | ||
| 67 | Ddecimal_sep dw ? | ||
| 68 | Ddate_sep dw ? | ||
| 69 | Dtime_sep dw ? | ||
| 70 | Dbit_field db ? | ||
| 71 | Dsig_digit db ? | ||
| 72 | Dtformat db ? | ||
| 73 | Dmap_call dd ? | ||
| 74 | Ddata_sep dw ? | ||
| 75 | DResv db 5 dup(?) | ||
| 76 | Doscntry ends | ||
| 77 | |||
| 78 | |||
| 79 | dosgetctryinfo proc far | ||
| 80 | |||
| 81 | Enter Dosgetcntryinfo ; save registers | ||
| 82 | |||
| 83 | lds si,[bp].CountryCodePtr | ||
| 84 | mov ax,ds:[si] ; get country code pointer | ||
| 85 | |||
| 86 | cmp ax,256 ; 16 bit country code | ||
| 87 | jc getinfo | ||
| 88 | |||
| 89 | mov bx,ax ; if so, load into bx | ||
| 90 | mov al,0ffH ; and tell DOS it is get country | ||
| 91 | |||
| 92 | getinfo: | ||
| 93 | mov dx,seg buffer | ||
| 94 | mov ds,dx | ||
| 95 | assume ds:buffer | ||
| 96 | mov dx,offset buffer:CountryInfo | ||
| 97 | |||
| 98 | mov ah,38h ; remember: the al value was set above!!! | ||
| 99 | int 21h ; get country information | ||
| 100 | jc ErrorExit | ||
| 101 | |||
| 102 | mov si,offset buffer:CountryInfo ;pointer to DOS cntry infor | ||
| 103 | les di,[bp].BufferPtr ;pointer to return data area | ||
| 104 | |||
| 105 | mov ax,[si].ddformat ;copy date format | ||
| 106 | mov es:[di].dformat,ax | ||
| 107 | mov ax,[si].ddate_sep ;copy date seperator | ||
| 108 | mov es:[di].date_sep,ax | ||
| 109 | mov ax,[si].dtime_sep ;copy time separator | ||
| 110 | mov es:[di].time_sep,ax | ||
| 111 | mov al,[si].dtformat ;copy time format | ||
| 112 | mov es:[di].tformat,al | ||
| 113 | |||
| 114 | mov cx,[bp].BufferLength ;was buffer larger than pc-dos gave us? | ||
| 115 | sub cx,34 | ||
| 116 | jc NoFillNecessary ; no fill necessary | ||
| 117 | |||
| 118 | les di,[bp].BufferPtr ; else fill the remaining area | ||
| 119 | add di,34 ; with zeros | ||
| 120 | mov al,0 | ||
| 121 | rep stosb | ||
| 122 | |||
| 123 | NoFillNecessary: | ||
| 124 | sub ax,ax ; set good return code | ||
| 125 | |||
| 126 | ErrorExit: | ||
| 127 | Mexit ; pop registers | ||
| 128 | |||
| 129 | ret size str - 6 ; return | ||
| 130 | |||
| 131 | dosgetctryinfo endp | ||
| 132 | |||
| 133 | dosxxx ends | ||
| 134 | |||
| 135 | end | ||
diff --git a/v4.0/src/MAPPER/GETMSG.ASM b/v4.0/src/MAPPER/GETMSG.ASM new file mode 100644 index 0000000..12dfaa3 --- /dev/null +++ b/v4.0/src/MAPPER/GETMSG.ASM | |||
| @@ -0,0 +1,586 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosGetMessage mapper | ||
| 5 | ; | ||
| 6 | messages segment word public 'messages' | ||
| 7 | |||
| 8 | OurMessage db 0dh,0ah,"DosGetMessage returning ->",'$' | ||
| 9 | |||
| 10 | ErrorMessageFlag db 0 | ||
| 11 | MessageToGo dw 0 | ||
| 12 | MessageLength dw 0 | ||
| 13 | NextVarPointer dd 0 | ||
| 14 | VarsToGo dw 0 | ||
| 15 | |||
| 16 | MaxMessageNumber = 0 | ||
| 17 | |||
| 18 | ; This macro is used to define/declare all of the messages | ||
| 19 | |||
| 20 | ; We will have four macros, msg -> defines a complete message | ||
| 21 | ; msgStart -> defines the first part of a message | ||
| 22 | ; msgContinue -> continues a started message | ||
| 23 | ; msgEnd -> ends a message | ||
| 24 | |||
| 25 | MacroState = 0 | ||
| 26 | |||
| 27 | ;---------------------------------------------- | ||
| 28 | |||
| 29 | MsgError macro text ; message string error | ||
| 30 | |||
| 31 | if1 | ||
| 32 | else | ||
| 33 | %out | ||
| 34 | %out $ERROR - &text | ||
| 35 | endif | ||
| 36 | |||
| 37 | $ERROR - &text | ||
| 38 | |||
| 39 | endm | ||
| 40 | |||
| 41 | ;---------------------------------------------- | ||
| 42 | |||
| 43 | msg macro number,text | ||
| 44 | |||
| 45 | if MacroState NE 0 | ||
| 46 | MsgError <Cannot use the 'Msg' Macro when inside a message definition.> | ||
| 47 | mexit | ||
| 48 | endif | ||
| 49 | |||
| 50 | Message&Number db text | ||
| 51 | db 0 | ||
| 52 | |||
| 53 | if MaxMessageNumber lt &number | ||
| 54 | MaxMessageNumber = &Number | ||
| 55 | endif | ||
| 56 | |||
| 57 | MacroState = 0 | ||
| 58 | |||
| 59 | endm | ||
| 60 | |||
| 61 | ;---------------------------------------------- | ||
| 62 | |||
| 63 | msgStart macro number,text ; start of a message string | ||
| 64 | |||
| 65 | if MacroState NE 0 | ||
| 66 | MsgError <Cannot use the 'MsgStart' macro when inside a message definition.> | ||
| 67 | mexit | ||
| 68 | endif | ||
| 69 | |||
| 70 | Message&Number db text | ||
| 71 | |||
| 72 | if MaxMessageNumber lt &number | ||
| 73 | MaxMessageNumber = &Number | ||
| 74 | endif | ||
| 75 | |||
| 76 | MacroState = 1 | ||
| 77 | |||
| 78 | endm | ||
| 79 | |||
| 80 | ;---------------------------------------------- | ||
| 81 | |||
| 82 | msgContinue macro text ; messgage string contination | ||
| 83 | |||
| 84 | if MacroState EQ 0 | ||
| 85 | MsgError <Cannot use the 'MsgContinue' macro unless inside a message definition.> | ||
| 86 | mexit | ||
| 87 | endif | ||
| 88 | |||
| 89 | db text | ||
| 90 | |||
| 91 | MacroState = 1 | ||
| 92 | |||
| 93 | endm | ||
| 94 | |||
| 95 | ;---------------------------------------------- | ||
| 96 | |||
| 97 | msgEnd macro ; end of message string | ||
| 98 | |||
| 99 | if MacroState EQ 0 | ||
| 100 | MsgError <Cannot use the 'MsgEnd' macro unless inside a message definition.> | ||
| 101 | mexit | ||
| 102 | endif | ||
| 103 | |||
| 104 | db 0 | ||
| 105 | |||
| 106 | MacroState = 0 | ||
| 107 | |||
| 108 | endm | ||
| 109 | |||
| 110 | |||
| 111 | ;----------------------------------------------- | ||
| 112 | |||
| 113 | ; Define/declare the messages first! | ||
| 114 | |||
| 115 | include messages.inc | ||
| 116 | |||
| 117 | NotFoundNumber = -2 | ||
| 118 | |||
| 119 | NotFoundMessage label byte | ||
| 120 | msg NotFoundNumber,<'We could not find your message #'> | ||
| 121 | |||
| 122 | ; Now, for each defined message, generate an index | ||
| 123 | |||
| 124 | msgidx macro number | ||
| 125 | ifdef Message&Number | ||
| 126 | dw &Number | ||
| 127 | dw offset messages:Message&Number | ||
| 128 | endif | ||
| 129 | endm | ||
| 130 | |||
| 131 | even | ||
| 132 | |||
| 133 | MessageIndex label word | ||
| 134 | |||
| 135 | ThisMessageNumber = 0 | ||
| 136 | rept MaxMessageNumber + 1 | ||
| 137 | msgidx %ThisMessageNumber | ||
| 138 | ThisMessageNumber = ThisMessageNumber + 1 | ||
| 139 | endm | ||
| 140 | |||
| 141 | dw -1 | ||
| 142 | |||
| 143 | NotFoundIndex dw -2 | ||
| 144 | dw offset messages:NotFoundMessage | ||
| 145 | |||
| 146 | messages ends | ||
| 147 | ; | ||
| 148 | dosxxx segment byte public 'dos' | ||
| 149 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 150 | ; | ||
| 151 | ;********************************************************************** | ||
| 152 | ;* | ||
| 153 | ;* MODULE: dosgetmessage | ||
| 154 | ;* | ||
| 155 | ;* FILE NAME: dos029.asm | ||
| 156 | ;* | ||
| 157 | ;* CALLING SEQUENCE: | ||
| 158 | ;* | ||
| 159 | ;* push@ other insert variable table | ||
| 160 | ;* push word insert variable count | ||
| 161 | ;* push@ other message buffer address | ||
| 162 | ;* push word buffer length | ||
| 163 | ;* push word message number | ||
| 164 | ;* push@ asciiz message file name | ||
| 165 | ;* push@ word returned message length | ||
| 166 | ;* call dosgetmessage | ||
| 167 | ;* | ||
| 168 | ;* MODULES CALLED: None (preliminary version) | ||
| 169 | ;* | ||
| 170 | ;********************************************************************* | ||
| 171 | ; | ||
| 172 | public dosgetmessage | ||
| 173 | .sall | ||
| 174 | .xlist | ||
| 175 | include macros.inc | ||
| 176 | .list | ||
| 177 | |||
| 178 | str struc | ||
| 179 | old_bp dw ? | ||
| 180 | return dd ? | ||
| 181 | ReturnLengthPtr dd ? ; length of returned message | ||
| 182 | MessageFileName dd ? ; message file name | ||
| 183 | MessageNumber dw ? ; number of the message | ||
| 184 | MessageBufferLen dw ? ; length of the message buffer | ||
| 185 | MessageBufferPtr dd ? ; buffer address to return message | ||
| 186 | VariablesCount dw ? ; number of variables | ||
| 187 | VariableTablePtr dd ? ; table of variables to insert | ||
| 188 | str ends | ||
| 189 | |||
| 190 | |||
| 191 | dosgetmessage proc far | ||
| 192 | |||
| 193 | Enter Dosgetmessage ; push registers | ||
| 194 | mov ax,messages ; setup message buffer | ||
| 195 | mov ds,ax | ||
| 196 | assume ds:messages | ||
| 197 | mov ErrorMessageFlag,0 ; reset error message flag | ||
| 198 | |||
| 199 | mov bx,[bp].MessageNumber ; get message number | ||
| 200 | mov si,offset messages:MessageIndex | ||
| 201 | |||
| 202 | SearchForMessageLoop: ; search for message in table | ||
| 203 | lodsw | ||
| 204 | cmp ax,bx ; found ?? | ||
| 205 | je FoundMessage ; jump if true | ||
| 206 | |||
| 207 | add si,2 ; if not serach continues | ||
| 208 | cmp ax,-1 | ||
| 209 | jne SearchForMessageLoop | ||
| 210 | |||
| 211 | mov si,offset messages:NotFoundIndex + 2 | ||
| 212 | mov ErrorMessageFlag,1 | ||
| 213 | |||
| 214 | ; Here, ds:[si] -> word message number, followed by word message offset | ||
| 215 | |||
| 216 | FoundMessage: | ||
| 217 | mov si,ds:[si] | ||
| 218 | |||
| 219 | ; Here, ds:[si] -> message text bytes | ||
| 220 | |||
| 221 | les di,[bp].VariableTablePtr ; get variable address | ||
| 222 | mov word ptr NextVarPointer+0,di ; save it | ||
| 223 | mov word ptr NextVarPointer+2,es | ||
| 224 | |||
| 225 | mov di,[bp].VariablesCount ; get variable count | ||
| 226 | mov VarsToGo,di ; save it | ||
| 227 | |||
| 228 | les di,[bp].MessageBufferPtr ; get return message buffer | ||
| 229 | ; address | ||
| 230 | mov ax,[bp].MessageBufferLen ; get return message buffer | ||
| 231 | mov MessageToGo,ax ; length | ||
| 232 | |||
| 233 | cmp ax,0 ; length = 0 ?? | ||
| 234 | jne HaveLengthToCopy ; if not, jump | ||
| 235 | |||
| 236 | jmp GetMessageDone ; done | ||
| 237 | |||
| 238 | HaveLengthToCopy: | ||
| 239 | mov MessageLength,0 ; initialize counter | ||
| 240 | |||
| 241 | MoveCharsLoop: | ||
| 242 | lodsb ; get next character | ||
| 243 | cmp al,'%' ; is it a % sign | ||
| 244 | je DoSubstitution ; if so, need substitution | ||
| 245 | |||
| 246 | cmp al,0 ; end of string ?? | ||
| 247 | jne RealCharacter ; if not look for real chars | ||
| 248 | |||
| 249 | jmp GetMessageDone ; else, jump to update | ||
| 250 | ; return message length | ||
| 251 | |||
| 252 | RealCharacter: ; look for real character | ||
| 253 | stosb | ||
| 254 | inc MessageLength ; update message length counter | ||
| 255 | dec MessageToGo | ||
| 256 | jnz MoveCharsLoop ; branch if not all done | ||
| 257 | |||
| 258 | jmp GetMessageDone ; else alldone, branch | ||
| 259 | |||
| 260 | DoSubstitution: ; do substitution | ||
| 261 | lodsb ; get character | ||
| 262 | cmp al,'%' ; check for %% | ||
| 263 | je RealCharacter ; if so, get next character | ||
| 264 | |||
| 265 | |||
| 266 | |||
| 267 | ; skip the numbers that indicate field width! | ||
| 268 | |||
| 269 | SkipFieldWidth: ; check for field width digit | ||
| 270 | cmp al,'0' ; indicator digits | ||
| 271 | jc CheckChar | ||
| 272 | |||
| 273 | cmp al,'9'+1 | ||
| 274 | jnc CheckChar | ||
| 275 | ; if field width indicator | ||
| 276 | lodsb ; jump to examine next char | ||
| 277 | jmp SkipFieldWidth | ||
| 278 | |||
| 279 | ;----------------------------------------- | ||
| 280 | |||
| 281 | CheckChar: ; check for char substitution | ||
| 282 | cmp al,'c' ; if true go do character | ||
| 283 | je SubstituteChar ; substitution | ||
| 284 | cmp al,'C' | ||
| 285 | jne CheckDecimal | ||
| 286 | |||
| 287 | SubstituteChar: ; do character subtitution | ||
| 288 | push ds | ||
| 289 | push si | ||
| 290 | lds si,NextVarPointer | ||
| 291 | lds si,ds:dword ptr [si] | ||
| 292 | |||
| 293 | assume ds:nothing | ||
| 294 | |||
| 295 | lodsb | ||
| 296 | pop si | ||
| 297 | pop ds | ||
| 298 | |||
| 299 | assume ds:messages | ||
| 300 | |||
| 301 | add word ptr NextVarPointer,4 | ||
| 302 | dec VarsToGo | ||
| 303 | |||
| 304 | jmp RealCharacter | ||
| 305 | |||
| 306 | ;----------------------------------------- | ||
| 307 | |||
| 308 | CheckDecimal: ; check for decimal subtitution | ||
| 309 | cmp al,'d' ; if true, do decimal | ||
| 310 | je SubstituteDecimal ; substitution | ||
| 311 | cmp al,'D' | ||
| 312 | jne CheckString | ||
| 313 | |||
| 314 | SubstituteDecimal: ; do decimal subtitution | ||
| 315 | push ds | ||
| 316 | push si | ||
| 317 | lds si,NextVarPointer | ||
| 318 | lds si,ds:dword ptr [si] | ||
| 319 | |||
| 320 | assume ds:nothing | ||
| 321 | |||
| 322 | lodsw | ||
| 323 | pop si | ||
| 324 | pop ds | ||
| 325 | |||
| 326 | assume ds:messages | ||
| 327 | |||
| 328 | add word ptr NextVarPointer,4 | ||
| 329 | dec VarsToGo | ||
| 330 | |||
| 331 | mov dx,0 | ||
| 332 | call ConvDec | ||
| 333 | |||
| 334 | add MessageLength,ax | ||
| 335 | sub MessageToGo,ax | ||
| 336 | jc PastEndOfBuffer | ||
| 337 | |||
| 338 | jmp MoveCharsLoop | ||
| 339 | |||
| 340 | PastEndOfBuffer: | ||
| 341 | jmp GetMessageDone | ||
| 342 | |||
| 343 | ;----------------------------------------- | ||
| 344 | |||
| 345 | CheckString: | ||
| 346 | cmp al,'s' ; check for string subtitution | ||
| 347 | je SubstituteString ; if true, do string | ||
| 348 | cmp al,'S' ; substitution | ||
| 349 | jne CheckLong | ||
| 350 | |||
| 351 | SubstituteString: ; do string substitution | ||
| 352 | push ds | ||
| 353 | push si | ||
| 354 | mov cx,MessageToGo | ||
| 355 | mov dx,MessageLength | ||
| 356 | lds si,NextVarPointer | ||
| 357 | lds si,ds:dword ptr [si] | ||
| 358 | assume ds:nothing | ||
| 359 | |||
| 360 | ContinueStringSubstitution: | ||
| 361 | lodsb | ||
| 362 | cmp al,0 | ||
| 363 | je EndOfSubstituteString | ||
| 364 | |||
| 365 | stosb | ||
| 366 | inc dx | ||
| 367 | loop ContinueStringSubstitution | ||
| 368 | |||
| 369 | EndOfSubstituteString: | ||
| 370 | pop si | ||
| 371 | pop ds | ||
| 372 | assume ds:messages | ||
| 373 | |||
| 374 | add word ptr NextVarPointer,4 | ||
| 375 | dec VarsToGo | ||
| 376 | |||
| 377 | mov MessageLength,dx | ||
| 378 | mov MessageToGo,cx | ||
| 379 | jcxz PastEndOfBuffer | ||
| 380 | |||
| 381 | jmp MoveCharsLoop | ||
| 382 | |||
| 383 | ;----------------------------------------- | ||
| 384 | |||
| 385 | CheckLong: ; need long substitution | ||
| 386 | cmp al,'l' | ||
| 387 | je SubstituteLong ; if true go do it | ||
| 388 | cmp al,'L' | ||
| 389 | jne Unknown ; else unknown substitution | ||
| 390 | |||
| 391 | SubstituteLong: | ||
| 392 | jmp RealCharacter ; just go back | ||
| 393 | |||
| 394 | ;----------------------------------------- | ||
| 395 | |||
| 396 | Unknown: | ||
| 397 | jmp RealCharacter ; just go back | ||
| 398 | |||
| 399 | |||
| 400 | |||
| 401 | |||
| 402 | ; Update the return message length | ||
| 403 | |||
| 404 | GetMessageDone: | ||
| 405 | push ds | ||
| 406 | push si | ||
| 407 | mov ax,MessageLength | ||
| 408 | lds si,[bp].ReturnLengthPtr | ||
| 409 | assume ds:nothing | ||
| 410 | mov ds:[si],ax | ||
| 411 | pop si | ||
| 412 | pop ds | ||
| 413 | assume ds:messages | ||
| 414 | |||
| 415 | cmp ErrorMessageFlag,0 | ||
| 416 | je NotErrorMessage | ||
| 417 | |||
| 418 | mov ErrorMessageFlag,0 | ||
| 419 | |||
| 420 | KeepGoingBackwards: | ||
| 421 | cmp es:byte ptr [di-1],0 | ||
| 422 | jne PutItHere | ||
| 423 | |||
| 424 | dec di | ||
| 425 | jmp KeepGoingBackwards | ||
| 426 | |||
| 427 | PutItHere: | ||
| 428 | mov ax,[bp].MessageNumber | ||
| 429 | mov dx,0 | ||
| 430 | |||
| 431 | call convdec | ||
| 432 | lds si,[bp].ReturnLengthPtr | ||
| 433 | assume ds:nothing | ||
| 434 | add ax,3 ; for cr, lf, nul | ||
| 435 | add ds:[si],ax | ||
| 436 | |||
| 437 | mov al,0dh | ||
| 438 | stosb | ||
| 439 | mov al,0ah | ||
| 440 | stosb | ||
| 441 | |||
| 442 | mov al,0 | ||
| 443 | stosb | ||
| 444 | |||
| 445 | NotErrorMessage: | ||
| 446 | jmp SkipToHere | ||
| 447 | |||
| 448 | mov dx,seg messages | ||
| 449 | mov ds,dx | ||
| 450 | mov dx,offset messages:OurMessage | ||
| 451 | |||
| 452 | mov ah,9 ; load op code | ||
| 453 | int 21h ; display message | ||
| 454 | |||
| 455 | lds si,[bp].ReturnLengthPtr | ||
| 456 | mov cx,ds:[si] | ||
| 457 | lds dx,[bp].MessageBufferPtr | ||
| 458 | |||
| 459 | mov bx,1 | ||
| 460 | mov ah,40h | ||
| 461 | int 21h ; display message | ||
| 462 | |||
| 463 | SkipToHere: | ||
| 464 | xor ax,ax ; set good return code | ||
| 465 | |||
| 466 | mexit ; pop registers | ||
| 467 | ret size str - 6 ; return | ||
| 468 | |||
| 469 | dosgetmessage endp | ||
| 470 | |||
| 471 | page | ||
| 472 | |||
| 473 | ;������������������������������������������������������������������ | ||
| 474 | |||
| 475 | Tens dd 10000000 | ||
| 476 | dd 1000000 | ||
| 477 | dd 100000 | ||
| 478 | dd 10000 | ||
| 479 | dd 1000 | ||
| 480 | dd 100 | ||
| 481 | dd 10 | ||
| 482 | dd 1 | ||
| 483 | dd 0 | ||
| 484 | |||
| 485 | convdec proc near | ||
| 486 | |||
| 487 | ; input es:di -> location to put decimal characters at | ||
| 488 | ; dx:ax -> 32bit value to be displayed | ||
| 489 | |||
| 490 | ; output es:di -> next location for output characters | ||
| 491 | ; ax = number of characters output | ||
| 492 | |||
| 493 | push bp | ||
| 494 | sub sp,6 | ||
| 495 | mov bp,sp | ||
| 496 | |||
| 497 | DecLength equ word ptr [bp+0] | ||
| 498 | LowValue equ word ptr [bp+2] | ||
| 499 | HighValue equ word ptr [bp+4] | ||
| 500 | |||
| 501 | mov DecLength,0 | ||
| 502 | mov HighValue,dx | ||
| 503 | mov LowValue,ax | ||
| 504 | |||
| 505 | mov bx,offset dosxxx:Tens | ||
| 506 | |||
| 507 | ; Start with a count of zero. | ||
| 508 | |||
| 509 | DigitLoop: | ||
| 510 | mov dx,0 | ||
| 511 | |||
| 512 | ; Loop, counting the number of times you can subtract the current digit value | ||
| 513 | |||
| 514 | CountLoop: | ||
| 515 | mov ax,cs:[bx+0] | ||
| 516 | sub LowValue,ax | ||
| 517 | mov ax,cs:[bx+2] | ||
| 518 | sbb HighValue,ax | ||
| 519 | jc TooFar | ||
| 520 | inc dx ; Subtraction did no go negative, inc digit | ||
| 521 | jmp CountLoop | ||
| 522 | |||
| 523 | ; Since we know when this digit is done by the number going negative, we must | ||
| 524 | ; fixup the damage. | ||
| 525 | |||
| 526 | TooFar: | ||
| 527 | mov ax,cs:[bx+0] | ||
| 528 | add LowValue,ax | ||
| 529 | mov ax,cs:[bx+2] | ||
| 530 | adc HighValue,ax | ||
| 531 | |||
| 532 | ; We need to supress leading zeros, so check to see if this digit is non zero | ||
| 533 | |||
| 534 | cmp dx,0 | ||
| 535 | jnz DoDisplay | ||
| 536 | |||
| 537 | ; Digit is zero, check to see if we have put out any digits yet? | ||
| 538 | |||
| 539 | cmp Declength,0 | ||
| 540 | jz NextDigit | ||
| 541 | |||
| 542 | ; Either digit was non zero, or we have already output the leading non-zero. | ||
| 543 | ; It really doesn't matter, display the digit | ||
| 544 | |||
| 545 | DoDisplay: | ||
| 546 | mov al,dl | ||
| 547 | add al,'0' | ||
| 548 | stosb | ||
| 549 | inc DecLength | ||
| 550 | |||
| 551 | ; Set up for the next digit, and determine if we are done | ||
| 552 | |||
| 553 | NextDigit: | ||
| 554 | add bx,4 | ||
| 555 | cmp cs:word ptr [bx+0],0 | ||
| 556 | jnz DigitLoop | ||
| 557 | cmp cs:word ptr [bx+2],0 | ||
| 558 | jnz DigitLoop | ||
| 559 | |||
| 560 | ; Check to see that we at least put out a single 0 character | ||
| 561 | |||
| 562 | cmp DecLength,0 | ||
| 563 | jne Done | ||
| 564 | |||
| 565 | ; We didn't, so let's put the zero there | ||
| 566 | |||
| 567 | mov al,'0' | ||
| 568 | stosb | ||
| 569 | inc DecLength | ||
| 570 | |||
| 571 | ; The decimal display is complete. Get the return value and return | ||
| 572 | |||
| 573 | Done: | ||
| 574 | mov ax,DecLength | ||
| 575 | |||
| 576 | mov sp,bp | ||
| 577 | add sp,6 | ||
| 578 | pop bp | ||
| 579 | |||
| 580 | ret | ||
| 581 | |||
| 582 | convdec endp | ||
| 583 | |||
| 584 | dosxxx ends | ||
| 585 | |||
| 586 | end | ||
diff --git a/v4.0/src/MAPPER/GETVER.ASM b/v4.0/src/MAPPER/GETVER.ASM new file mode 100644 index 0000000..3f94ec7 --- /dev/null +++ b/v4.0/src/MAPPER/GETVER.ASM | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosGetVersion mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | ; | ||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosgetversion | ||
| 11 | ;* | ||
| 12 | ;* CALLING SEQUENCE: | ||
| 13 | ;* | ||
| 14 | ;* push@ word versionword pointer | ||
| 15 | ;* call dosgetversion | ||
| 16 | ;* | ||
| 17 | ;* MODULES CALLED: PC-DOS Int 21h, ah=30h, get version | ||
| 18 | ;* | ||
| 19 | ;********************************************************************* | ||
| 20 | |||
| 21 | public dosgetversion | ||
| 22 | .sall | ||
| 23 | include macros.inc | ||
| 24 | |||
| 25 | str struc | ||
| 26 | old_bp dw ? | ||
| 27 | Return dd ? | ||
| 28 | Data dd ? ; return data area pointer | ||
| 29 | str ends | ||
| 30 | |||
| 31 | dosgetversion proc far | ||
| 32 | Enter dosgetversion | ||
| 33 | lds si,[bp].data ; set pointer | ||
| 34 | |||
| 35 | mov ah,30h ; get DOS version | ||
| 36 | int 21h | ||
| 37 | |||
| 38 | mov byte ptr [si],ah ; minor version | ||
| 39 | mov byte ptr [si]+1,al ; major version | ||
| 40 | |||
| 41 | exit: mexit ; pop registers | ||
| 42 | sub ax,ax | ||
| 43 | ret size str - 6 | ||
| 44 | ; | ||
| 45 | dosgetversion endp | ||
| 46 | |||
| 47 | dosxxx ends | ||
| 48 | |||
| 49 | end | ||
diff --git a/v4.0/src/MAPPER/GET_TOD.ASM b/v4.0/src/MAPPER/GET_TOD.ASM new file mode 100644 index 0000000..d6c390f --- /dev/null +++ b/v4.0/src/MAPPER/GET_TOD.ASM | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosGetDateTime mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dosgetdatetime | ||
| 12 | ;* | ||
| 13 | ;* FUNCTION: get date and time information | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push@ struc date/time | ||
| 18 | ;* call dosgetdatetime | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=2ah, get date | ||
| 21 | ;* ah=2ch, get time | ||
| 22 | ;* | ||
| 23 | ;********************************************************************* | ||
| 24 | |||
| 25 | public dosgetdatetime | ||
| 26 | .sall | ||
| 27 | include macros.inc | ||
| 28 | |||
| 29 | str struc | ||
| 30 | old_bp dw ? | ||
| 31 | return dd ? | ||
| 32 | data dd ? ; date and time info return pointer | ||
| 33 | str ends | ||
| 34 | |||
| 35 | dosgetdatetime proc far | ||
| 36 | |||
| 37 | Enter dosgetdatetime ; push registers | ||
| 38 | |||
| 39 | lds si,[bp].data ; set return data area | ||
| 40 | |||
| 41 | mov ah,2ch ; get time information | ||
| 42 | int 21h | ||
| 43 | ; save info in return data are | ||
| 44 | mov byte ptr [si],ch ; save hour | ||
| 45 | mov byte ptr [si]+1,cl ; minutes | ||
| 46 | mov byte ptr [si]+2,dh ; seconds | ||
| 47 | mov byte ptr [si]+3,dl ; hundredths | ||
| 48 | |||
| 49 | mov ah,2ah ; get date and save it | ||
| 50 | int 21h ; in return data area | ||
| 51 | |||
| 52 | mov byte ptr [si]+4,dl ; save day | ||
| 53 | mov byte ptr [si]+5,dh ; month | ||
| 54 | mov word ptr [si]+6,cx ; year | ||
| 55 | mov word ptr [si]+8,360 ; min. from GMT | ||
| 56 | mov byte ptr [si]+10,al ; day of week | ||
| 57 | |||
| 58 | exit: sub ax,ax ; set good return code | ||
| 59 | |||
| 60 | Mexit ; pop registers | ||
| 61 | ret size str - 6 ; return | ||
| 62 | |||
| 63 | dosgetdatetime endp | ||
| 64 | |||
| 65 | dosxxx ends | ||
| 66 | |||
| 67 | end | ||
diff --git a/v4.0/src/MAPPER/GMACHMOD.ASM b/v4.0/src/MAPPER/GMACHMOD.ASM new file mode 100644 index 0000000..a460aab --- /dev/null +++ b/v4.0/src/MAPPER/GMACHMOD.ASM | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DOSGETMACHINEMODE mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dosgetmachinemode | ||
| 12 | ;* Note that in PCDOS, this call should NOT BE ISSUED! | ||
| 13 | ;* This mapper does not return anything, it is meant | ||
| 14 | ;* only to allow the utility to link without errors. | ||
| 15 | ;* | ||
| 16 | ;********************************************************************* | ||
| 17 | |||
| 18 | public dosgetmachinemode | ||
| 19 | .sall | ||
| 20 | .xlist | ||
| 21 | include macros.inc | ||
| 22 | .list | ||
| 23 | |||
| 24 | str struc | ||
| 25 | modeaddr dw ? | ||
| 26 | str ends | ||
| 27 | |||
| 28 | dosgetmachinemode proc far | ||
| 29 | Enter DosGetMachMode ; push registers | ||
| 30 | |||
| 31 | sub ax,ax ; set good return code | ||
| 32 | |||
| 33 | mexit ; pop registers | ||
| 34 | ret size str - 6 ; return garbage (Not supported in PCDOS) | ||
| 35 | |||
| 36 | dosgetmachinemode endp | ||
| 37 | |||
| 38 | dosxxx ends | ||
| 39 | |||
| 40 | end | ||
diff --git a/v4.0/src/MAPPER/IOCTL.ASM b/v4.0/src/MAPPER/IOCTL.ASM new file mode 100644 index 0000000..03302db --- /dev/null +++ b/v4.0/src/MAPPER/IOCTL.ASM | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosDevIOCTl mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | ; | ||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosdevioctl | ||
| 11 | ;* | ||
| 12 | ;* FILE NAME: dos007.asm | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push@ dword Data | ||
| 17 | ;* push@ dword Paramlist | ||
| 18 | ;* push word Function | ||
| 19 | ;* push word Category | ||
| 20 | ;* push@ word Devicehandle | ||
| 21 | ;* | ||
| 22 | ;* call doschgfileptr | ||
| 23 | ;* | ||
| 24 | ;* MODULES CALLED: PC-DOS Int 21h, ah=42h, move file pointer | ||
| 25 | ;* | ||
| 26 | ;********************************************************************* | ||
| 27 | |||
| 28 | public dosdevioctl | ||
| 29 | .sall | ||
| 30 | .xlist | ||
| 31 | include macros.inc | ||
| 32 | .list | ||
| 33 | |||
| 34 | str struc | ||
| 35 | Old_bp dw ? | ||
| 36 | Return dd ? | ||
| 37 | Handle dw ? ; handle | ||
| 38 | Category dw ? ; device category | ||
| 39 | Function dw ? ; device function | ||
| 40 | Parmlist dd ? ; command arguments | ||
| 41 | Data dd ? ; data area | ||
| 42 | str ends | ||
| 43 | |||
| 44 | dosdevioctl proc far | ||
| 45 | Enter dosdevioctl ; push registers | ||
| 46 | |||
| 47 | mov bx,[bp].handle ; get handle | ||
| 48 | |||
| 49 | cmp bx,0ffe5h ; is it a device handle ?? | ||
| 50 | jl filehandle ; branch if not | ||
| 51 | |||
| 52 | ; Convert DASD device handle to drive number as follows: | ||
| 53 | ; Drive Open IOCTL | ||
| 54 | ; Letter Handle DASD # | ||
| 55 | ; ----------------------------- | ||
| 56 | ; A -2 1 | ||
| 57 | ; B -3 2 | ||
| 58 | ; C -4 3 | ||
| 59 | ; D -5 4 | ||
| 60 | ; E -6 5 | ||
| 61 | neg bx ; convert dev handle to | ||
| 62 | dec bx ; drive number | ||
| 63 | |||
| 64 | filehandle: | ||
| 65 | mov ax,[bp].function ; get function code | ||
| 66 | cmp ax,020H ; check for right function | ||
| 67 | je continue1 ; continue if right function code | ||
| 68 | mov ax,01H ; else, load error code | ||
| 69 | jmp exit ; return | ||
| 70 | |||
| 71 | continue1: ; only category 8 is supported | ||
| 72 | mov ax,[bp].category ; set category | ||
| 73 | |||
| 74 | mov ah,44h | ||
| 75 | int 21h ; do ioctl | ||
| 76 | jnc continue ; check for error | ||
| 77 | |||
| 78 | cmp ax,1 ; if error and return code = 1 | ||
| 79 | jne exit ; then it is network drive | ||
| 80 | ; therefore continue | ||
| 81 | continue: | ||
| 82 | lds si,[bp].data ; media changable | ||
| 83 | mov byte ptr [si],al ; save in data area | ||
| 84 | xor ax,ax ; set no error coe | ||
| 85 | |||
| 86 | exit: mexit ; pop registers | ||
| 87 | ret size str - 6 ; return | ||
| 88 | |||
| 89 | dosdevioctl endp | ||
| 90 | |||
| 91 | dosxxx ends | ||
| 92 | |||
| 93 | end | ||
diff --git a/v4.0/src/MAPPER/KBD.INC b/v4.0/src/MAPPER/KBD.INC new file mode 100644 index 0000000..8c74eed --- /dev/null +++ b/v4.0/src/MAPPER/KBD.INC | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | ; KeyData | ||
| 2 | |||
| 3 | KeyData struc | ||
| 4 | |||
| 5 | Char_Code db ? | ||
| 6 | Scan_Code db ? | ||
| 7 | Status db ? | ||
| 8 | Shift_State dw ? | ||
| 9 | Time dd ? | ||
| 10 | |||
| 11 | KeyData ends | ||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | KbdStatus struc | ||
| 16 | |||
| 17 | KS_Length dw ? | ||
| 18 | Bit_mask dw ? | ||
| 19 | Turn_Around_Char dw ? | ||
| 20 | Interim_Char_Flags dw ? | ||
| 21 | Status_Shift_State dw ? | ||
| 22 | |||
| 23 | KbdStatus ends | ||
| 24 | |||
| 25 | ; Bit_Mask equates | ||
| 26 | |||
| 27 | CookedModeOn equ 8 | ||
| 28 | RawModeOn equ 4 | ||
| 29 | EchoOff equ 2 | ||
| 30 | EchoOn equ 1 | ||
| 31 | |||
| 32 | |||
| 33 | include macros.inc | ||
| 34 | |||
| 35 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/KBDGSTAT.ASM b/v4.0/src/MAPPER/KBDGSTAT.ASM new file mode 100644 index 0000000..078fd5d --- /dev/null +++ b/v4.0/src/MAPPER/KBDGSTAT.ASM | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS KbdGetStatus | ||
| 5 | ; | ||
| 6 | .sall | ||
| 7 | .xlist | ||
| 8 | include kbd.inc | ||
| 9 | .list | ||
| 10 | |||
| 11 | kbddata segment word public 'kbddata' | ||
| 12 | |||
| 13 | public KbdBitMask | ||
| 14 | KbdBitMask dw CookedModeOn or EchoOn | ||
| 15 | |||
| 16 | public KbdTurnAroundCharacter | ||
| 17 | KbdTurnAroundCharacter dw 0dh | ||
| 18 | |||
| 19 | public KbdInterimCharFlags | ||
| 20 | KbdInterimCharFlags dw 0 | ||
| 21 | |||
| 22 | kbddata ends | ||
| 23 | |||
| 24 | kbdxxx segment byte public 'kbd' | ||
| 25 | assume cs:kbdxxx,ds:nothing,es:nothing,ss:nothing | ||
| 26 | ; | ||
| 27 | ; ************************************************************************* * | ||
| 28 | ; * | ||
| 29 | ; * MODULE: kbdGetStatus | ||
| 30 | ; * | ||
| 31 | ; * CALLING SEQUENCE: | ||
| 32 | ; * | ||
| 33 | ; * | ||
| 34 | ; ************************************************************************* | ||
| 35 | |||
| 36 | public kbdgetstatus | ||
| 37 | |||
| 38 | str struc | ||
| 39 | old_bp dw ? | ||
| 40 | return dd ? | ||
| 41 | handle dw ? ; kbd handle | ||
| 42 | data dd ? ; data area pointer | ||
| 43 | str ends | ||
| 44 | |||
| 45 | kbdgetstatus proc far | ||
| 46 | |||
| 47 | Enter KbdGetStatus ; push registers | ||
| 48 | |||
| 49 | les di,[bp].data ; setup area where status is | ||
| 50 | ; returned | ||
| 51 | mov ax,seg kbddata | ||
| 52 | mov ds,ax | ||
| 53 | assume ds:kbddata | ||
| 54 | |||
| 55 | mov ax,KbdBitMask ; save kbd bit mask in | ||
| 56 | mov es:[di].Bit_Mask,ax ; return data area | ||
| 57 | |||
| 58 | mov ax,KbdTurnAroundCharacter ; save turn around character | ||
| 59 | mov es:[di].Turn_Around_Char,ax | ||
| 60 | |||
| 61 | mov ax,KbdInterimCharFlags ; save interim character flag | ||
| 62 | mov es:[di].Interim_Char_Flags,ax | ||
| 63 | |||
| 64 | mov ah,2 | ||
| 65 | int 16h ; get kbd shift status | ||
| 66 | |||
| 67 | xor ah,ah | ||
| 68 | mov es:[di].Status_Shift_State,ax ; save it in return data | ||
| 69 | ; area | ||
| 70 | Mexit ; restore registers | ||
| 71 | |||
| 72 | ret size str - 6 ; return | ||
| 73 | |||
| 74 | kbdgetstatus endp | ||
| 75 | kbdxxx ends | ||
| 76 | end | ||
diff --git a/v4.0/src/MAPPER/KBDSSTAT.ASM b/v4.0/src/MAPPER/KBDSSTAT.ASM new file mode 100644 index 0000000..1e76ffc --- /dev/null +++ b/v4.0/src/MAPPER/KBDSSTAT.ASM | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS KbdSetStatus | ||
| 5 | |||
| 6 | .sall | ||
| 7 | .xlist | ||
| 8 | include kbd.inc ; kbd set status data structure | ||
| 9 | .list | ||
| 10 | |||
| 11 | kbddata segment word public 'kbddata' | ||
| 12 | |||
| 13 | extrn KbdBitMask:word | ||
| 14 | extrn KbdTurnAroundCharacter:word | ||
| 15 | extrn KbdInterimCharFlags:word | ||
| 16 | |||
| 17 | kbddata ends | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | kbdxxx segment byte public 'kbd' | ||
| 22 | assume cs:kbdxxx,ds:nothing,es:nothing,ss:nothing | ||
| 23 | ; | ||
| 24 | ; ************************************************************************* * | ||
| 25 | ; * | ||
| 26 | ; * MODULE: kbdsetStatus | ||
| 27 | ; * | ||
| 28 | ; * | ||
| 29 | ; * CALLING SEQUENCE: | ||
| 30 | ; * | ||
| 31 | ; * PUSH@ DWORD data ; kbd data structure | ||
| 32 | ; * PUSH WORD handle ; kbd handle | ||
| 33 | ; * | ||
| 34 | ; * CALL kbdsetstatus | ||
| 35 | ; * | ||
| 36 | ; * RETURN SEQUENCE: | ||
| 37 | ; * | ||
| 38 | ; * | ||
| 39 | ; * | ||
| 40 | ; ************************************************************************* | ||
| 41 | ; | ||
| 42 | public kbdsetstatus | ||
| 43 | |||
| 44 | str struc | ||
| 45 | old_bp dw ? | ||
| 46 | return dd ? | ||
| 47 | handle dw ? ; kbd handle | ||
| 48 | data dd ? ; kbd data strructure pointer | ||
| 49 | str ends | ||
| 50 | |||
| 51 | kbdsetstatus proc far | ||
| 52 | |||
| 53 | Enter KbdSetStatus ; save registers | ||
| 54 | |||
| 55 | les di,[bp].data ; set up kbd data structure | ||
| 56 | mov ax,seg kbddata | ||
| 57 | mov ds,ax | ||
| 58 | assume ds:kbddata | ||
| 59 | |||
| 60 | mov ax,es:[di].Bit_Mask ; get bit mask | ||
| 61 | |||
| 62 | CheckTurnAround: | ||
| 63 | test ax,040h ; define turnaround character ?? | ||
| 64 | jz CheckInterimFlags ; jump if not | ||
| 65 | |||
| 66 | mov bx,es:[di].Turn_Around_Char ; else, save turnaround character | ||
| 67 | mov KbdTurnAroundCharacter,bx | ||
| 68 | |||
| 69 | CheckInterimFlags: | ||
| 70 | test ax,020h ; check for interim character flag ?? | ||
| 71 | jz CheckShiftState ; if not jump | ||
| 72 | |||
| 73 | mov bx,es:[di].Interim_Char_Flags ; save interim character flag | ||
| 74 | mov KbdInterimCharFlags,bx | ||
| 75 | |||
| 76 | CheckShiftState: | ||
| 77 | test ax,010h ; check for shift state ?? | ||
| 78 | jz CheckCookedOn ; jump if not | ||
| 79 | |||
| 80 | push ds ; setup for shift state | ||
| 81 | mov bx,040h | ||
| 82 | mov ds,bx | ||
| 83 | assume ds:nothing | ||
| 84 | |||
| 85 | mov bx,es:[di].Status_Shift_State ; save shift state data | ||
| 86 | mov ds:018h,bl | ||
| 87 | |||
| 88 | pop ds | ||
| 89 | assume ds:kbddata | ||
| 90 | |||
| 91 | CheckCookedOn: ; check for cooked mode ?? | ||
| 92 | test ax,008h | ||
| 93 | jz CheckRawOn | ||
| 94 | |||
| 95 | and KbdBitMask,not RawModeOn ; setup cooked mode status | ||
| 96 | or KbdBitMask,CookedModeOn | ||
| 97 | |||
| 98 | CheckRawOn: | ||
| 99 | test ax,004h ; check for raw mdoe ?? | ||
| 100 | jz CheckEchoOff | ||
| 101 | |||
| 102 | and KbdBitMask,not CookedModeOn ; setup for raw mode | ||
| 103 | or KbdBitMask,RawModeOn | ||
| 104 | |||
| 105 | CheckEchoOff: | ||
| 106 | test ax,002h ; check for echo on | ||
| 107 | jz CheckEchoOn ; branch if so | ||
| 108 | |||
| 109 | and KbdBitMask,not EchoOn ; else setup echo off | ||
| 110 | or KbdBitMask,EchoOff | ||
| 111 | |||
| 112 | CheckEchoOn: | ||
| 113 | test ax,001h | ||
| 114 | jz EverythingSet | ||
| 115 | |||
| 116 | and KbdBitMask,not EchoOff ; setup echo on | ||
| 117 | or KbdBitMask,EchoOn | ||
| 118 | |||
| 119 | EverythingSet: | ||
| 120 | Mexit ; pop registers | ||
| 121 | |||
| 122 | ret size str - 6 ; return | ||
| 123 | |||
| 124 | KbdSetStatus endp | ||
| 125 | |||
| 126 | kbdxxx ends | ||
| 127 | |||
| 128 | end | ||
| 129 | |||
diff --git a/v4.0/src/MAPPER/LSEEK.ASM b/v4.0/src/MAPPER/LSEEK.ASM new file mode 100644 index 0000000..450f8c7 --- /dev/null +++ b/v4.0/src/MAPPER/LSEEK.ASM | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ;0 | ||
| 4 | title CP/DOS DosChgFilePtr mapper * * * | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | |||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: doschgfileptr | ||
| 12 | ;* | ||
| 13 | ;* FILE NAME: dos007.asm | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push word file handle | ||
| 18 | ;* push dword distance | ||
| 19 | ;* push word move type | ||
| 20 | ;* push@ dword new pointer | ||
| 21 | ;* call doschgfileptr | ||
| 22 | ;* | ||
| 23 | ;* MODULES CALLED: PC-DOS Int 21h, ah=42h, move file pointer | ||
| 24 | ;* | ||
| 25 | ;********************************************************************* | ||
| 26 | |||
| 27 | public doschgfileptr | ||
| 28 | .sall | ||
| 29 | .xlist | ||
| 30 | include macros.inc | ||
| 31 | .list | ||
| 32 | |||
| 33 | str struc | ||
| 34 | old_bp dw ? | ||
| 35 | return dd ? | ||
| 36 | newptr dd ? ; new file pointer | ||
| 37 | movtyp dw ? ; move type | ||
| 38 | dstnce dd ? ; distance to be moved | ||
| 39 | handle dw ? ; file handle | ||
| 40 | str ends | ||
| 41 | |||
| 42 | doschgfileptr proc far | ||
| 43 | Enter doschgfileptr ; push registers | ||
| 44 | |||
| 45 | push es | ||
| 46 | les dx,[bp].dstnce | ||
| 47 | mov cx,es ; set distance | ||
| 48 | pop es | ||
| 49 | mov ax,[bp].movtyp ; get move type | ||
| 50 | mov bx,[bp].handle ; get handle | ||
| 51 | |||
| 52 | mov ah,42h | ||
| 53 | int 21h ; move file pointer | ||
| 54 | jc exit ; return if error | ||
| 55 | |||
| 56 | lds si,[bp].newptr ; set pointer | ||
| 57 | mov word ptr [si],ax ; save the new pointer | ||
| 58 | mov word ptr [si]+2,dx ; | ||
| 59 | sub ax,ax ; set godd return code | ||
| 60 | |||
| 61 | exit: mexit ;pop registers | ||
| 62 | ret size str - 6 ;return | ||
| 63 | |||
| 64 | doschgfileptr endp | ||
| 65 | |||
| 66 | dosxxx ends | ||
| 67 | |||
| 68 | end | ||
diff --git a/v4.0/src/MAPPER/MACROS.INC b/v4.0/src/MAPPER/MACROS.INC new file mode 100644 index 0000000..0fdf4c3 --- /dev/null +++ b/v4.0/src/MAPPER/MACROS.INC | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | ; | ||
| 2 | if1 | ||
| 3 | %out macros.inc | ||
| 4 | endif | ||
| 5 | |||
| 6 | |||
| 7 | pushal macro | ||
| 8 | push bx | ||
| 9 | push cx | ||
| 10 | push dx | ||
| 11 | push si | ||
| 12 | push di | ||
| 13 | push ds | ||
| 14 | push es | ||
| 15 | push ss | ||
| 16 | push bp | ||
| 17 | endm | ||
| 18 | ; | ||
| 19 | popal macro | ||
| 20 | pop bp | ||
| 21 | pop ss | ||
| 22 | pop es | ||
| 23 | pop ds | ||
| 24 | pop di | ||
| 25 | pop si | ||
| 26 | pop dx | ||
| 27 | pop cx | ||
| 28 | pop bx | ||
| 29 | endm | ||
| 30 | ; | ||
| 31 | Enter macro Routine | ||
| 32 | |||
| 33 | push bp | ||
| 34 | mov bp,sp | ||
| 35 | pushal | ||
| 36 | |||
| 37 | endm | ||
| 38 | ; | ||
| 39 | Mexit macro | ||
| 40 | |||
| 41 | popal | ||
| 42 | mov sp,bp | ||
| 43 | pop bp | ||
| 44 | |||
| 45 | endm | ||
| 46 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/MAKEFILE b/v4.0/src/MAPPER/MAKEFILE new file mode 100644 index 0000000..f0cc850 --- /dev/null +++ b/v4.0/src/MAPPER/MAKEFILE | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | #************************** makefile for mapper *************************** | ||
| 2 | |||
| 3 | msg =..\messages | ||
| 4 | dos =..\dos | ||
| 5 | inc =..\inc | ||
| 6 | hinc =..\h | ||
| 7 | |||
| 8 | # | ||
| 9 | ####################### dependencies begin here. ######################### | ||
| 10 | # | ||
| 11 | |||
| 12 | all: mapper.lib | ||
| 13 | |||
| 14 | chdir.obj: chdir.asm makefile macros.inc | ||
| 15 | |||
| 16 | getver.obj: getver.asm makefile macros.inc | ||
| 17 | |||
| 18 | f_first.obj: f_first.asm makefile macros.inc find.inc | ||
| 19 | |||
| 20 | set_tod.obj: set_tod.asm makefile macros.inc | ||
| 21 | |||
| 22 | write.obj: write.asm makefile macros.inc | ||
| 23 | |||
| 24 | beep.obj: beep.asm makefile macros.inc | ||
| 25 | |||
| 26 | mkdir.obj: mkdir.asm makefile macros.inc | ||
| 27 | |||
| 28 | exit.obj: exit.asm makefile macros.inc | ||
| 29 | |||
| 30 | delete.obj: delete.asm makefile macros.inc | ||
| 31 | |||
| 32 | getcntry.obj: getcntry.asm makefile macros.inc | ||
| 33 | |||
| 34 | f_close.obj: f_close.asm makefile macros.inc find.inc | ||
| 35 | |||
| 36 | open.obj: open.asm makefile macros.inc | ||
| 37 | |||
| 38 | read.obj: read.asm makefile macros.inc | ||
| 39 | |||
| 40 | rmdir.obj: rmdir.asm makefile macros.inc | ||
| 41 | |||
| 42 | qcurdir.obj: qcurdir.asm makefile macros.inc | ||
| 43 | |||
| 44 | qcurdsk.obj: qcurdsk.asm makefile macros.inc | ||
| 45 | |||
| 46 | qverify.obj: qverify.asm makefile macros.inc | ||
| 47 | |||
| 48 | qfilemod.obj: qfilemod.asm makefile macros.inc | ||
| 49 | |||
| 50 | sverify.obj: sverify.asm makefile macros.inc | ||
| 51 | |||
| 52 | sfilemod.obj: sfilemod.asm makefile macros.inc | ||
| 53 | |||
| 54 | lseek.obj: lseek.asm makefile macros.inc | ||
| 55 | |||
| 56 | sfileinf.obj: sfileinf.asm makefile macros.inc | ||
| 57 | |||
| 58 | close.obj: close.asm makefile macros.inc | ||
| 59 | |||
| 60 | allocseg.obj: allocseg.asm makefile macros.inc | ||
| 61 | |||
| 62 | freeseg.obj: freeseg.asm makefile macros.inc | ||
| 63 | |||
| 64 | sel_disk.obj: sel_disk.asm makefile macros.inc | ||
| 65 | |||
| 66 | qfsinfo.obj: qfsinfo.asm makefile macros.inc | ||
| 67 | |||
| 68 | f_next.obj: f_next.asm makefile macros.inc find.inc | ||
| 69 | |||
| 70 | getmsg.obj: getmsg.asm makefile macros.inc | ||
| 71 | |||
| 72 | get_tod.obj: get_tod.asm makefile macros.inc | ||
| 73 | |||
| 74 | charin.obj: charin.asm makefile macros.inc | ||
| 75 | |||
| 76 | flushbuf.obj: flushbuf.asm makefile macros.inc | ||
| 77 | |||
| 78 | devconfg.obj: devconfg.asm makefile macros.inc | ||
| 79 | |||
| 80 | reallseg.obj: reallseg.asm makefile macros.inc | ||
| 81 | |||
| 82 | putmsg.obj: putmsg.asm makefile macros.inc | ||
| 83 | |||
| 84 | execpgm.obj: execpgm.asm makefile macros.inc | ||
| 85 | |||
| 86 | qhandtyp.obj: qhandtyp.asm makefile macros.inc | ||
| 87 | |||
| 88 | cwait.obj: cwait.asm makefile macros.inc | ||
| 89 | |||
| 90 | kbdgstat.obj: kbdgstat.asm makefile macros.inc | ||
| 91 | |||
| 92 | kbdsstat.obj: kbdsstat.asm makefile macros.inc | ||
| 93 | |||
| 94 | casemap.obj: casemap.asm makefile macros.inc | ||
| 95 | |||
| 96 | dbcs.obj: dbcs.asm makefile macros.inc | ||
| 97 | |||
| 98 | ioctl.obj: ioctl.asm makefile macros.inc | ||
| 99 | |||
| 100 | sighand.obj: sighand.asm makefile macros.inc | ||
| 101 | |||
| 102 | error.obj: error.asm makefile macros.inc | ||
| 103 | |||
| 104 | setint24.obj: setint24.asm makefile macros.inc | ||
| 105 | |||
| 106 | qfileinf.obj: qfileinf.asm makefile macros.inc | ||
| 107 | |||
| 108 | scurpos.obj: scurpos.asm makefile macros.inc | ||
| 109 | |||
| 110 | scrollup.obj: scrollup.asm makefile macros.inc | ||
| 111 | |||
| 112 | wchstra.obj: wchstra.asm makefile macros.inc | ||
| 113 | |||
| 114 | scntry.obj: scntry.asm makefile macros.inc | ||
| 115 | |||
| 116 | setfsinf.obj: setfsinf.asm makefile macros.inc | ||
| 117 | |||
| 118 | gmachmod.obj: gmachmod.asm makefile macros.inc | ||
| 119 | |||
| 120 | mapper.lib: makefile chdir.obj getver.obj f_first.obj set_tod.obj \ | ||
| 121 | write.obj beep.obj mkdir.obj exit.obj delete.obj getcntry.obj \ | ||
| 122 | f_close.obj open.obj read.obj rmdir.obj qcurdir.obj qcurdsk.obj \ | ||
| 123 | qverify.obj qfilemod.obj sverify.obj sfilemod.obj lseek.obj \ | ||
| 124 | sfileinf.obj close.obj allocseg.obj freeseg.obj sel_disk.obj \ | ||
| 125 | qfsinfo.obj f_next.obj getmsg.obj get_tod.obj charin.obj \ | ||
| 126 | flushbuf.obj devconfg.obj reallseg.obj putmsg.obj execpgm.obj \ | ||
| 127 | qhandtyp.obj cwait.obj kbdgstat.obj kbdsstat.obj casemap.obj \ | ||
| 128 | dbcs.obj ioctl.obj sighand.obj error.obj setint24.obj \ | ||
| 129 | qfileinf.obj scurpos.obj scrollup.obj wchstra.obj scntry.obj \ | ||
| 130 | setfsinf.obj gmachmod.obj | ||
| 131 | del mapper.lib | ||
| 132 | lib @mapper.lbr | ||
diff --git a/v4.0/src/MAPPER/MAPPER.INC b/v4.0/src/MAPPER/MAPPER.INC new file mode 100644 index 0000000..be295fa --- /dev/null +++ b/v4.0/src/MAPPER/MAPPER.INC | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | |||
| 2 | |||
| 3 | _TEXT SEGMENT BYTE PUBLIC 'CODE' | ||
| 4 | _TEXT ENDS | ||
| 5 | |||
| 6 | CONST SEGMENT WORD PUBLIC 'CONST' | ||
| 7 | CONST ENDS | ||
| 8 | |||
| 9 | _BSS SEGMENT WORD PUBLIC 'BSS' | ||
| 10 | _BSS ENDS | ||
| 11 | |||
| 12 | _DATA SEGMENT WORD PUBLIC 'DATA' | ||
| 13 | _DATA ENDS | ||
| 14 | |||
| 15 | DGROUP GROUP CONST, _BSS, _DATA | ||
| 16 | |||
| 17 | ASSUME CS: _TEXT | ||
| 18 | ASSUME DS: DGROUP | ||
| 19 | ASSUME SS: DGROUP | ||
| 20 | ASSUME ES: DGROUP | ||
| 21 | |||
| 22 | |||
| 23 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/MAPPER.LBR b/v4.0/src/MAPPER/MAPPER.LBR new file mode 100644 index 0000000..226075f --- /dev/null +++ b/v4.0/src/MAPPER/MAPPER.LBR | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | mapper.lib | ||
| 2 | y | ||
| 3 | +CHDIR& | ||
| 4 | +GETVER& | ||
| 5 | +F_FIRST& | ||
| 6 | +SET_TOD.obj& | ||
| 7 | +WRITE.obj& | ||
| 8 | +BEEP.obj& | ||
| 9 | +MKDIR.obj& | ||
| 10 | +EXIT.obj& | ||
| 11 | +DELETE.obj& | ||
| 12 | +GETCNTRY.obj& | ||
| 13 | +F_CLOSE.obj& | ||
| 14 | +OPEN.obj& | ||
| 15 | +READ.obj& | ||
| 16 | +RMDIR.obj& | ||
| 17 | +QCURDIR.obj& | ||
| 18 | +QCURDSK.obj& | ||
| 19 | +QVERIFY.obj& | ||
| 20 | +QFILEMOD.obj& | ||
| 21 | +SVERIFY.obj& | ||
| 22 | +SFILEMOD.obj& | ||
| 23 | +LSEEK.obj& | ||
| 24 | +SFILEINF.obj& | ||
| 25 | +CLOSE.obj& | ||
| 26 | +ALLOCSEG.obj& | ||
| 27 | +FREESEG.obj& | ||
| 28 | +SEL_DISK.obj& | ||
| 29 | +QFSINFO.obj& | ||
| 30 | +F_NEXT.obj& | ||
| 31 | +GETMSG.obj& | ||
| 32 | +GET_TOD.obj& | ||
| 33 | +CHARIN.obj& | ||
| 34 | +FLUSHBUF.obj& | ||
| 35 | +DEVCONFG.obj& | ||
| 36 | +REALLSEG.obj& | ||
| 37 | +PUTMSG.obj& | ||
| 38 | +EXECPGM.obj& | ||
| 39 | +QHANDTYP.obj& | ||
| 40 | +CWAIT.obj& | ||
| 41 | +KBDGSTAT.obj& | ||
| 42 | +KBDSSTAT.obj& | ||
| 43 | +CASEMAP.obj& | ||
| 44 | +DBCS.obj& | ||
| 45 | +IOCTL.obj& | ||
| 46 | +SIGHAND.obj& | ||
| 47 | +ERROR.obj& | ||
| 48 | +setint24.obj& | ||
| 49 | +QFILEINF.obj& | ||
| 50 | +SCURPOS.obj& | ||
| 51 | +SCROLLUP.obj& | ||
| 52 | +WCHSTRA.obj& | ||
| 53 | +SCNTRY.obj& | ||
| 54 | +SETFSINF.obj& | ||
| 55 | +GMACHMOD.obj | ||
| 56 | mapper.lst; | ||
| 57 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/MESSAGES.INC b/v4.0/src/MAPPER/MESSAGES.INC new file mode 100644 index 0000000..e2286e0 --- /dev/null +++ b/v4.0/src/MAPPER/MESSAGES.INC | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | page | ||
| 2 | |||
| 3 | ; Restore Messages 0 | ||
| 4 | |||
| 5 | MSG0 equ 0 | ||
| 6 | INSERT_SOURCE_DISK equ 1635 ;925 | ||
| 7 | SOURCE_TARGET_SAME equ 1642 ;932 | ||
| 8 | INVALID_NUM_PARM equ 1643 ;933 | ||
| 9 | INVALID_DRIVE equ 1644 ;934 | ||
| 10 | NO_FILE_TO_RESTORE equ 1645 ;935 | ||
| 11 | INVALID_PARM equ 1646 ;936 | ||
| 12 | LAST_FILE_NOT_RESTORED equ 1648 ;938 | ||
| 13 | SOURCE_NO_BACKUP_FILE equ 1649 ;939 | ||
| 14 | INSUFFICIENT_MEMORY equ 8 ;8 | ||
| 15 | FILE_SEQUENCE_ERROR equ 1651 ;941 | ||
| 16 | FILE_CREATION_ERROR equ 1652 ;942 | ||
| 17 | TARGET_IS_FULL equ 1653 ;943 | ||
| 18 | NOT_ABLE_TO_RESTORE_FILE equ 1655 ;945 | ||
| 19 | INVALID_DOS_VER equ 1210 ;500 | ||
| 20 | FILE_SHARING_ERROR equ 1647 ;937 | ||
| 21 | FILE_WAS_CHANGED equ 1638 ;928 | ||
| 22 | DISK_OUT_OF_SEQUENCE equ 1636 ;926 | ||
| 23 | FILE_IS_READONLY equ 1637 ;927 | ||
| 24 | SYSTEM_FILE_RESTORED equ 1639 ;929 | ||
| 25 | FILES_WERE_BACKUP_ON equ 1640 ;930 | ||
| 26 | RESTORE_FILE_FROM_DRIVE equ 1634 ;924 | ||
| 27 | INSERT_TARGET_DISK equ 1657 ;947 | ||
| 28 | FILE_TO_BE_RESTORED equ 1641 ;931 | ||
| 29 | DISKETTE_NUM equ 1656 ;946 | ||
| 30 | INVALID_PATH equ 1670 ;960 | ||
| 31 | |||
| 32 | db ' The Microsoft MS DOS (R) Restore Utility' | ||
| 33 | db ' Version 4.00 Copyright 1988 Microsoft ' | ||
| 34 | db ' Licensed Material - Property of Microsoft ' | ||
| 35 | db ' Author - ** **** ' | ||
| 36 | |||
| 37 | |||
| 38 | msg %MSG0,<"Y N A R I",0dh,0ah> | ||
| 39 | Msg %SOURCE_TARGET_SAME,<0dh,0ah,"Source and target drives are the same",0dh,0ah> | ||
| 40 | Msg %INVALID_NUM_PARM,<0dh,0ah,"Invalid number of parameters",0dh,0ah> | ||
| 41 | Msg %INVALID_PATH,<0dh,0ah,"Invalid path",0dh,0ah> | ||
| 42 | Msg %INVALID_DRIVE,<0dh,0ah,"Invalid drive specification",0dh,0ah> | ||
| 43 | Msg %NO_FILE_TO_RESTORE,<0dh,0ah,"Warning! No files were found to restore",0dh,0ah> | ||
| 44 | msg %INVALID_PARM,<0dh,0ah,"Invalid parameter %s",0dh,0ah> | ||
| 45 | Msgstart %INSERT_SOURCE_DISK,<0dh,0ah,"Insert backup diskette %s in drive"> | ||
| 46 | MsgContinue <" %c:",0dh,0ah> | ||
| 47 | MsgContinue <"Strike any key when ready ",0dh,0ah> | ||
| 48 | MsgEnd | ||
| 49 | |||
| 50 | MsgStart %DISK_OUT_OF_SEQUENCE,<0dh,0ah,"Warning! Diskette is out of sequence",0dh,0ah> | ||
| 51 | MsgContinue <"Replace diskette or continue if okay",0dh,0ah> | ||
| 52 | MsgContinue <"Strike any key when ready ",0dh,0ah> | ||
| 53 | MsgEnd | ||
| 54 | |||
| 55 | Msg %LAST_FILE_NOT_RESTORED,<0dh,0ah,"The last file was not restored",0dh,0ah> | ||
| 56 | Msg %FILES_WERE_BACKUP_ON,<0dh,0ah,"*** Files were backed up %s *** ",0dh,0ah> | ||
| 57 | Msg %SOURCE_NO_BACKUP_FILE,<0dh,0ah,"Source does not contain backup files",0dh,0ah> | ||
| 58 | Msg %INSUFFICIENT_MEMORY,<0dh,0ah,"Insufficient memory",0dh,0ah> | ||
| 59 | MsgStart %FILE_IS_READONLY,<0dh,0ah,"Warning! File %s",0dh,0ah> | ||
| 60 | MsgContinue <"is a read-only file",0dh,0ah> | ||
| 61 | MsgContinue <"Replace the file (Y/N)? ",0dh,0ah> | ||
| 62 | MsgEnd | ||
| 63 | |||
| 64 | Msg %FILE_SEQUENCE_ERROR,<0dh,0ah,"Restore file sequence error",0dh,0ah> | ||
| 65 | Msg %FILE_CREATION_ERROR,<0dh,0ah,"File creation error",0dh,0ah> | ||
| 66 | Msg %TARGET_IS_FULL,<0dh,0ah,"Target is full",0dh,0ah> | ||
| 67 | Msg %NOT_ABLE_TO_RESTORE_FILE,<0dh,0ah,"*** Not able to restore file ***",0dh,0ah> | ||
| 68 | MsgStart %INSERT_TARGET_DISK,<0dh,0ah,"Insert restore target in " > | ||
| 69 | MsgContinue <"drive %s:",0dh,0ah> | ||
| 70 | MsgContinue <"Strike any key when ready ",0dh,0ah> | ||
| 71 | MsgEnd | ||
| 72 | msg %INVALID_DOS_VER,<0dh,0ah,"Incorrect DOS version",0dh,0ah> | ||
| 73 | msg %FILE_TO_BE_RESTORED,<0dh,0ah,"%s",0> | ||
| 74 | |||
| 75 | msg %RESTORE_FILE_FROM_DRIVE,<0dh,0ah,"*** Restoring files from drive %s: ***",0> | ||
| 76 | |||
| 77 | Msg %FILE_SHARING_ERROR,<0dh,0ah,"Unrecoverable file sharing error",0dh,0ah> | ||
| 78 | |||
| 79 | MsgStart %SYSTEM_FILE_RESTORED,<0dh,0ah,"System files restored",0dh,0ah> | ||
| 80 | MsgContinue <"Target disk may not be bootable",0dh,0ah> | ||
| 81 | MsgEnd | ||
| 82 | |||
| 83 | MsgStart %FILE_WAS_CHANGED,<0dh,0ah,"Warning! File %s",0dh,0ah> | ||
| 84 | MsgContinue <"was changed after it was backed up",0dh,0ah> | ||
| 85 | MsgContinue <"Replace the file (Y/N)? ",0dh,0ah> | ||
| 86 | MsgEnd | ||
| 87 | msg %DISKETTE_NUM,<0dh,0ah,"Diskette: %s",0> | ||
| 88 | |||
diff --git a/v4.0/src/MAPPER/MKDIR.ASM b/v4.0/src/MAPPER/MKDIR.ASM new file mode 100644 index 0000000..3444435 --- /dev/null +++ b/v4.0/src/MAPPER/MKDIR.ASM | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosMkDir mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | ; | ||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosmkdir | ||
| 11 | ;* | ||
| 12 | ;* FUNCTION: Create a new directory | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push@ asciiz directory name | ||
| 17 | ;* push dword reserved (must be zero) | ||
| 18 | ;* call dosmkdir | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=39h | ||
| 21 | ;* | ||
| 22 | ;********************************************************************* | ||
| 23 | |||
| 24 | public dosmkdir | ||
| 25 | .sall | ||
| 26 | include macros.inc | ||
| 27 | |||
| 28 | str struc | ||
| 29 | old_bp dw ? | ||
| 30 | return dd ? | ||
| 31 | rsrvd dd ? | ||
| 32 | Asciiz dd ? ; new directory name pointer | ||
| 33 | str ends | ||
| 34 | |||
| 35 | dosmkdir proc far | ||
| 36 | |||
| 37 | Enter DosMkdir ; push registers | ||
| 38 | lds dx,[bp].asciiz ; set pointer to directory name | ||
| 39 | |||
| 40 | mov ah,39h ; load opcode | ||
| 41 | int 21h ; create new directory | ||
| 42 | jc exit ; jump if error | ||
| 43 | |||
| 44 | sub ax,ax ; else, set good return code | ||
| 45 | |||
| 46 | exit: mexit ; pop registers | ||
| 47 | ret size str - 6 ; return | ||
| 48 | |||
| 49 | dosmkdir endp | ||
| 50 | |||
| 51 | dosxxx ends | ||
| 52 | |||
| 53 | end | ||
diff --git a/v4.0/src/MAPPER/MSC.INC b/v4.0/src/MAPPER/MSC.INC new file mode 100644 index 0000000..0a22667 --- /dev/null +++ b/v4.0/src/MAPPER/MSC.INC | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | _DATA SEGMENT WORD PUBLIC 'DATA' | ||
| 2 | _DATA ENDS | ||
| 3 | |||
| 4 | CONST SEGMENT WORD PUBLIC 'CONST' | ||
| 5 | CONST ENDS | ||
| 6 | |||
| 7 | _BSS SEGMENT WORD PUBLIC 'BSS' | ||
| 8 | _BSS ENDS | ||
| 9 | |||
| 10 | STACK SEGMENT PARA PUBLIC 'STACK' | ||
| 11 | STACK ENDS | ||
| 12 | |||
| 13 | DGROUP GROUP _DATA, CONST, _BSS, STACK | ||
| 14 | |||
| 15 | |||
| 16 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/NLSAPI.INC b/v4.0/src/MAPPER/NLSAPI.INC new file mode 100644 index 0000000..e10b441 --- /dev/null +++ b/v4.0/src/MAPPER/NLSAPI.INC | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | ; SCCSID = @(#)nlsapi.inc 1.1 86/06/03 | ||
| 2 | SETCOUNTRYINFO equ 1 ; select country info | ||
| 3 | SETUCASE equ 2 ; select uppercase tbl | ||
| 4 | SETLCASE equ 3 ; select lowercase tbl | ||
| 5 | SETUCASEFILE equ 4 ; select uppercase spec table | ||
| 6 | SETFILELIST equ 5 ; select valid file character list | ||
| 7 | SETCOLLATE equ 6 ; select collating sequence | ||
| 8 | SETDBCS equ 7 ; select double byte char set | ||
| 9 | |||
| 10 | MAXLBUFFER equ 500 ; max size for local buffer | ||
| 11 | |||
| 12 | MAXCASEMAP equ 256 ; max size for ucase table in casemap | ||
| 13 | |||
| 14 | MAXDBCS equ 256 ; max size for dbcs table in casemap | ||
| 15 | |||
| 16 | NOT_DBCS_CHAR equ 0 | ||
| 17 | DBCS_CHAR equ 1 | ||
diff --git a/v4.0/src/MAPPER/OLDGETCN.ASM b/v4.0/src/MAPPER/OLDGETCN.ASM new file mode 100644 index 0000000..f3dd5a7 --- /dev/null +++ b/v4.0/src/MAPPER/OLDGETCN.ASM | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosGetCtryInfo mapper | ||
| 5 | |||
| 6 | Buffer segment word public 'buffer' | ||
| 7 | CountryInfo db 64 | ||
| 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: dosgetctryinfo | ||
| 16 | ;* | ||
| 17 | ;* FILE NAME: dos024.asm | ||
| 18 | ;* | ||
| 19 | ;* CALLING SEQUENCE: | ||
| 20 | ;* | ||
| 21 | ;* push word data area length | ||
| 22 | ;* push word country code | ||
| 23 | ;* push@ struc data area | ||
| 24 | ;* call dosgetctryinfo | ||
| 25 | ;* | ||
| 26 | ;* MODULES CALLED: PC-DOS Int 21h, ah=38h, get cntry info | ||
| 27 | ;* | ||
| 28 | ;********************************************************************* | ||
| 29 | ; | ||
| 30 | public dosgetctryinfo | ||
| 31 | .sall | ||
| 32 | include macros.inc | ||
| 33 | |||
| 34 | ; | ||
| 35 | str struc | ||
| 36 | old_bp dw ? | ||
| 37 | return dd ? | ||
| 38 | ReturnLength dd ? | ||
| 39 | BufferPtr dd ? | ||
| 40 | CountryCodePtr dd ? | ||
| 41 | BufferLength dw ? | ||
| 42 | str ends | ||
| 43 | ; | ||
| 44 | |||
| 45 | cntry struc ;country info. sturctrue | ||
| 46 | ctry_code dw ? | ||
| 47 | code_page dw ? | ||
| 48 | dformat dw ? | ||
| 49 | curr_sym db 5 dup(?) | ||
| 50 | thous_sep db 2 dup(?) | ||
| 51 | decimal_sep db 2 dup(?) | ||
| 52 | date_sep db 2 dup(?) | ||
| 53 | time_sep db 2 dup(?) | ||
| 54 | bit_field dw ? | ||
| 55 | curr_cents dw ? | ||
| 56 | tformat dw ? | ||
| 57 | map_call dd ? | ||
| 58 | data_sep dw ? | ||
| 59 | ra 5 dup(?) | ||
| 60 | cntry ends | ||
| 61 | ; | ||
| 62 | |||
| 63 | Doscntry struc ;country info. sturctrue | ||
| 64 | Ddformat dw ? | ||
| 65 | Dcurr_sym db 5 dup(?) | ||
| 66 | Dthous_sep db 2 dup(?) | ||
| 67 | Ddecimal_sep db 2 dup(?) | ||
| 68 | Ddate_sep db 2 dup(?) | ||
| 69 | Dtime_sep db 2 dup(?) | ||
| 70 | Dbit_field db ? | ||
| 71 | Dsig_digit db ? | ||
| 72 | Dtformat db ? | ||
| 73 | Dmap_call dd ? | ||
| 74 | Ddata_sep dw ? | ||
| 75 | DResv 5 dup(?) | ||
| 76 | Doscntry ends | ||
| 77 | |||
| 78 | |||
| 79 | dosgetctryinfo proc far | ||
| 80 | |||
| 81 | Enter Dosgetcntryinfo | ||
| 82 | |||
| 83 | lds si,[bp].CountryCodePtr | ||
| 84 | mov ax,ds:[si] | ||
| 85 | |||
| 86 | cmp ax,256 ;16 bit country code | ||
| 87 | jc getinfo | ||
| 88 | |||
| 89 | mov bx,ax ;if so, load into bx | ||
| 90 | mov al,0ffH ;and tell DOS | ||
| 91 | |||
| 92 | getinfo: | ||
| 93 | mov dx,seg buffer | ||
| 94 | mov ds,dx | ||
| 95 | assume ds:buffer | ||
| 96 | mov dx,offset buffer:CountryInfo | ||
| 97 | |||
| 98 | mov ah,38h ; remember: the al value was set above!!! | ||
| 99 | int 21h | ||
| 100 | jc ErrorExit | ||
| 101 | ; | ||
| 102 | mov si,offset buffer:CountryInfo | ||
| 103 | les di,[bp].BufferPtr | ||
| 104 | cld ;string move op. | ||
| 105 | |||
| 106 | mov cx,[bp].BufferLength ;length to move | ||
| 107 | |||
| 108 | rep movsb ;copy all to output area | ||
| 109 | |||
| 110 | mov cx,[bp].BufferLength ;was buffer larger than pc-dos gave us? | ||
| 111 | sub cx,34 | ||
| 112 | jc NoFillNecessary | ||
| 113 | |||
| 114 | les di,[bp].BufferPtr | ||
| 115 | add di,34 | ||
| 116 | |||
| 117 | mov al,0 ;fill with zeroes | ||
| 118 | rep stosb | ||
| 119 | ; | ||
| 120 | NoFillNecessary: | ||
| 121 | sub ax,ax | ||
| 122 | |||
| 123 | ErrorExit: | ||
| 124 | Mexit | ||
| 125 | |||
| 126 | ret size str - 6 | ||
| 127 | ; | ||
| 128 | dosgetctryinfo endp | ||
| 129 | |||
| 130 | dosxxx ends | ||
| 131 | |||
| 132 | end | ||
diff --git a/v4.0/src/MAPPER/OPEN.ASM b/v4.0/src/MAPPER/OPEN.ASM new file mode 100644 index 0000000..dec1f72 --- /dev/null +++ b/v4.0/src/MAPPER/OPEN.ASM | |||
| @@ -0,0 +1,289 @@ | |||
| 1 | page 80,132 | ||
| 2 | ;0 | ||
| 3 | title CP/DOS DosOpen mapper | ||
| 4 | |||
| 5 | |||
| 6 | FileAttributeSegment segment word public 'fat' | ||
| 7 | |||
| 8 | public FileAttributeTable | ||
| 9 | |||
| 10 | FileAttributeTable dw 100 dup(0) | ||
| 11 | |||
| 12 | FileAttributeSegment ends | ||
| 13 | |||
| 14 | |||
| 15 | dosxxx segment byte public 'dos' | ||
| 16 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 17 | ; | ||
| 18 | ; ************************************************************************* * | ||
| 19 | ; * | ||
| 20 | ; * MODULE: DosOpen | ||
| 21 | ; * | ||
| 22 | ; * FILE NAME: DosOpen.ASM | ||
| 23 | ; * | ||
| 24 | ; * FUNCTION: This module creates the specified file (if necessary), | ||
| 25 | ; * and opens it. If the file name is a device then the | ||
| 26 | ; * handle returned will be a device handle. The high order | ||
| 27 | ; * byte of the open flag is ignored because PC/DOS does not | ||
| 28 | ; * support a word long open mode. Invalid parameters are | ||
| 29 | ; * reported as general failures because there are no error | ||
| 30 | ; * codes defined at this time. | ||
| 31 | ; * | ||
| 32 | ; * CALLING SEQUENCE: | ||
| 33 | ; * | ||
| 34 | ; * PUSH@ ASCIIZ FileName ; File path name | ||
| 35 | ; * PUSH@ WORD FileHandle ; New file's handle | ||
| 36 | ; * PUSH@ WORD ActionTaken ; Action taken | ||
| 37 | ; * PUSH DWORD FileSize ; File primary allocation | ||
| 38 | ; * PUSH WORD FileAttribute ; File attribute | ||
| 39 | ; * PUSH WORD OpenFlag ; Open function type | ||
| 40 | ; * PUSH WORD OpenMode ; Open mode of the file | ||
| 41 | ; * PUSH@ DWORD 0 ; Reserved (must be zero) | ||
| 42 | ; * CALL DosOpen | ||
| 43 | ; * | ||
| 44 | ; * RETURN SEQUENCE: | ||
| 45 | ; * | ||
| 46 | ; * IF ERROR (AX not = 0) | ||
| 47 | ; * | ||
| 48 | ; * AX = Error Code: | ||
| 49 | ; * | ||
| 50 | ; * o Invalid parameter(s) | ||
| 51 | ; * | ||
| 52 | ; * o Insufficient disk space available | ||
| 53 | ; * | ||
| 54 | ; * o Insufficient resources (i.e., file handles) | ||
| 55 | ; * | ||
| 56 | ; * | ||
| 57 | ; * MODULES CALLED: DOS int 21H function 3DH | ||
| 58 | ; * DOS int 21H function 3EH | ||
| 59 | ; * DOS int 21H function 40H | ||
| 60 | ; * DOS int 21H function 42H | ||
| 61 | ; * DOS int 21H function 43H | ||
| 62 | ; * | ||
| 63 | ; ************************************************************************* | ||
| 64 | ; | ||
| 65 | public DosOpen | ||
| 66 | .sall | ||
| 67 | .xlist | ||
| 68 | include macros.inc | ||
| 69 | .list | ||
| 70 | |||
| 71 | ACT_FileExisted equ 1 | ||
| 72 | ACT_FileCreated equ 2 | ||
| 73 | |||
| 74 | |||
| 75 | str struc | ||
| 76 | old_bp dw ? | ||
| 77 | return dd ? | ||
| 78 | resrv34 dd ? ; reserved | ||
| 79 | OpenMode dw ? ; open mode | ||
| 80 | OpenFlag dw ? ; open function type (1=Open only if already exist) | ||
| 81 | OpenFileAttr dw ? ; file attribute | ||
| 82 | FileSize dd ? ; file allocation size | ||
| 83 | acttak34 dd ? ; action taken | ||
| 84 | FileHandlePtr dd ? ; New file handler | ||
| 85 | FileNamePtr dd ? ; file name pointer | ||
| 86 | str ends | ||
| 87 | |||
| 88 | ; | ||
| 89 | DosOpen proc far | ||
| 90 | Enter DosOpen ; save registers | ||
| 91 | sub sp,2 ; allocate space on the stack | ||
| 92 | SaveArea equ -2 | ||
| 93 | |||
| 94 | ; Check to see if we are trying to open a DASD device. If so, we must do | ||
| 95 | ; something unique as PC-DOS does not support this behavior. | ||
| 96 | ; Return a dummy DASD file handle. This used by IOCTL category 8 option. | ||
| 97 | |||
| 98 | test [bp].OpenMode,08000h ; DASD open ? | ||
| 99 | jz FileOpenRequest ; branch if file open | ||
| 100 | |||
| 101 | lds si,[bp].FileNamePtr ; convert device name to upper case | ||
| 102 | mov al,ds:[si] | ||
| 103 | cmp al,'a' | ||
| 104 | jc NoFold | ||
| 105 | cmp al,'z'+1 | ||
| 106 | jnc NoFold | ||
| 107 | |||
| 108 | add al,'A' - 'a' | ||
| 109 | |||
| 110 | NoFold: | ||
| 111 | sub al,'A' | ||
| 112 | jc BadDASDName ; jump if bad DASD name | ||
| 113 | |||
| 114 | cmp al,27 | ||
| 115 | jnc BadDASDName | ||
| 116 | |||
| 117 | xor ah,ah ; drive number from 0 to 25 | ||
| 118 | inc ax ; 1 to 26 | ||
| 119 | inc ax ; 2 to 27 | ||
| 120 | neg ax ; -2 to -27 | ||
| 121 | |||
| 122 | lds si,[bp].FileHandlePtr | ||
| 123 | mov ds:[si],ax ; save dasd dummy device handle | ||
| 124 | jmp GoodExit ; in return data area and return | ||
| 125 | |||
| 126 | BadDASDName: | ||
| 127 | mov ax,3 ; set error code | ||
| 128 | jmp ErrorExit ; return | ||
| 129 | |||
| 130 | |||
| 131 | ; Query the file attribute to determine if file exists | ||
| 132 | |||
| 133 | |||
| 134 | FileOpenRequest: | ||
| 135 | lds dx,dword ptr [bp].FileNamePtr ; load asciiz string address | ||
| 136 | mov ax,04300h ; query file mode | ||
| 137 | int 21h ; get file mode | ||
| 138 | jnc SaveAttribute ; file does exist | ||
| 139 | |||
| 140 | cmp ax,00002h ; check if file does not exist error | ||
| 141 | je dne34 ; go here if does not exist | ||
| 142 | |||
| 143 | jmp erret34 ; error return | ||
| 144 | |||
| 145 | SaveAttribute: | ||
| 146 | mov [bp].SaveArea,cx | ||
| 147 | |||
| 148 | ; File exists - determine what to do | ||
| 149 | |||
| 150 | lds si,dword ptr [bp].acttak34 ; Load action taken pointer | ||
| 151 | mov word ptr[si],ACT_FileExisted ; Indicate that file existed | ||
| 152 | mov ax,[bp].OpenFlag ; load open flag | ||
| 153 | and ax,00003h ; mask off the replace and open flags | ||
| 154 | cmp ax,00003h ; check if both are requested | ||
| 155 | je nxt134 ; error - invalid parm | ||
| 156 | |||
| 157 | cmp ax,00001h ; check if file is to be opened | ||
| 158 | je opn34 ; file should be opened | ||
| 159 | |||
| 160 | cmp ax,00002h ; check if file should be replaced | ||
| 161 | je creat34 ; file should be replaced | ||
| 162 | |||
| 163 | nxt134:; | ||
| 164 | mov ax,0000ch ; report general | ||
| 165 | jmp erret34 ; failure | ||
| 166 | |||
| 167 | ; | ||
| 168 | opn34:; | ||
| 169 | |||
| 170 | ; set the file attribute ( *** commented to fix mapper problem Pylee 6/10 | ||
| 171 | ; | ||
| 172 | ; lds dx,dword ptr [bp].FileNamePtr ; load asciiz string address | ||
| 173 | ; mov cx,[bp].OpenFileAttr ; load the file attribute | ||
| 174 | ; mov ax,04301h ; change file mode | ||
| 175 | ; int 21h ; get file mode | ||
| 176 | ; jnc nxto34 ; continue good return | ||
| 177 | ; jmp erret34 ; error retrun | ||
| 178 | |||
| 179 | nxto34:; | ||
| 180 | |||
| 181 | ; open the file | ||
| 182 | |||
| 183 | lds si,dword ptr [bp].acttak34 ; load action taken pointer | ||
| 184 | mov word ptr [si],00h ; clear action reported flag | ||
| 185 | lds dx,dword ptr [bp].FileNamePtr ; load asciiz string address | ||
| 186 | mov ax,[bp].OpenMode ; load the file mode | ||
| 187 | |||
| 188 | mov ah,03dh ; load opcode | ||
| 189 | int 21h ; open file | ||
| 190 | jc ErrorExit ; error return | ||
| 191 | |||
| 192 | FileWasThere: | ||
| 193 | lds si,dword ptr [bp].FileHandlePtr ; load file handle address | ||
| 194 | mov [si],ax ; save file handle | ||
| 195 | jmp PutAwayAttribute ; normal return | ||
| 196 | |||
| 197 | dne34:; | ||
| 198 | |||
| 199 | ; File does not exist - determine what to do | ||
| 200 | |||
| 201 | mov ax,[bp].OpenFlag ; load open flag | ||
| 202 | and ax,00010h ; check create | ||
| 203 | cmp ax,00010h ; and open file flag | ||
| 204 | je creat34 ; go create the file | ||
| 205 | |||
| 206 | mov ax,0000ch ; report general failure | ||
| 207 | jmp erret34 ; if create not requested | ||
| 208 | |||
| 209 | creat34:; | ||
| 210 | |||
| 211 | ; file did not exist so it was created or replacement was requested | ||
| 212 | |||
| 213 | lds si,dword ptr [bp].acttak34 ; load action taken pointer | ||
| 214 | mov word ptr [si],ACT_FileCreated ; file created - action reported | ||
| 215 | lds dx,dword ptr [bp].FileNamePtr ; load asciiz string address | ||
| 216 | mov cx,[bp].OpenFileAttr ; set file attribute | ||
| 217 | |||
| 218 | mov ah,03ch | ||
| 219 | int 21h ; create the file | ||
| 220 | jc erret34 ; error return | ||
| 221 | |||
| 222 | lds si,dword ptr [bp].FileHandlePtr ; load file handle address | ||
| 223 | mov [si],ax ; save file handle | ||
| 224 | ; | ||
| 225 | ; set file length | ||
| 226 | ; | ||
| 227 | les dx,[bp].FileSize | ||
| 228 | mov cx,es | ||
| 229 | mov bx,ax ; load file handle | ||
| 230 | |||
| 231 | mov ax,04202h ; load opcode | ||
| 232 | int 21h ; move file pointer | ||
| 233 | jc erret34 ; error return | ||
| 234 | |||
| 235 | len134:; | ||
| 236 | lds si,dword ptr [bp].FileHandlePtr ; load file handle address | ||
| 237 | mov bx,[si] ; load file handle | ||
| 238 | lds dx,dword ptr [bp].acttak34 | ||
| 239 | sub cx,cx | ||
| 240 | |||
| 241 | mov ah,040h | ||
| 242 | int 21h ; write 0 length record | ||
| 243 | jc erret34 ; error return | ||
| 244 | |||
| 245 | ; | ||
| 246 | len234:; | ||
| 247 | ; | ||
| 248 | ; close and reopen the file to make the length permanent | ||
| 249 | ; | ||
| 250 | lds si,dword ptr [bp].FileHandlePtr ; load file handle address | ||
| 251 | mov bx,[si] ; load file handle | ||
| 252 | mov ah,03eh | ||
| 253 | int 21h | ||
| 254 | jc erret34 ; error return | ||
| 255 | |||
| 256 | lds dx,dword ptr [bp].FileNamePtr ; load asciiz string address | ||
| 257 | mov ax,[bp].OpenMode ; load the file mode | ||
| 258 | mov ah,03dh ; | ||
| 259 | int 21h ; open the file | ||
| 260 | jc erret34 ; error return | ||
| 261 | |||
| 262 | lds si,dword ptr [bp].FileHandlePtr ; load file handle address | ||
| 263 | mov [si],ax ; save file handle | ||
| 264 | |||
| 265 | PutAwayAttribute: ; save file attribute for other mapper | ||
| 266 | mov bx,ax ; calls | ||
| 267 | add bx,bx | ||
| 268 | |||
| 269 | mov ax,seg FileAttributeSegment | ||
| 270 | mov ds,ax | ||
| 271 | assume ds:FileAttributeSegment | ||
| 272 | |||
| 273 | mov ax,[bp].SaveArea | ||
| 274 | mov FileAttributeTable[bx],ax ; save file attribute | ||
| 275 | |||
| 276 | GoodExit: | ||
| 277 | sub ax,ax ; set good return code | ||
| 278 | |||
| 279 | erret34:; | ||
| 280 | ErrorExit: | ||
| 281 | add sp,2 ; deallocate space | ||
| 282 | mexit ; restore registers | ||
| 283 | ret size str - 6 ; return | ||
| 284 | |||
| 285 | DosOpen endp | ||
| 286 | |||
| 287 | dosxxx ends | ||
| 288 | |||
| 289 | end | ||
diff --git a/v4.0/src/MAPPER/OPENPTMS.DAT b/v4.0/src/MAPPER/OPENPTMS.DAT new file mode 100644 index 0000000..ff99b68 --- /dev/null +++ b/v4.0/src/MAPPER/OPENPTMS.DAT | |||
| @@ -0,0 +1,502 @@ | |||
| 1 | D0000004 | ||
| 2 | D4 | ||
| 3 | D0000009 | ||
| 4 | D9 | ||
| 5 | D0000013 | ||
| 6 | D13 | ||
| 7 | D0000039 | ||
| 8 | D39 | ||
| 9 | D0000043 | ||
| 10 | D43 | ||
| 11 | D0000047 | ||
| 12 | D47 | ||
| 13 | D0000058 | ||
| 14 | D58 | ||
| 15 | D0000064 | ||
| 16 | D64 | ||
| 17 | D0000069 | ||
| 18 | D69 | ||
| 19 | D0000072 | ||
| 20 | D72 | ||
| 21 | D0000074 | ||
| 22 | D74 | ||
| 23 | D0000075 | ||
| 24 | D75 | ||
| 25 | D0000079 | ||
| 26 | D79 | ||
| 27 | D0000088 | ||
| 28 | D88 | ||
| 29 | D0000089 | ||
| 30 | D89 | ||
| 31 | D0000091 | ||
| 32 | D91 | ||
| 33 | D0000093 | ||
| 34 | D93 | ||
| 35 | D0000096 | ||
| 36 | D96 | ||
| 37 | D0000097 | ||
| 38 | D97 | ||
| 39 | D0000102 | ||
| 40 | D102 | ||
| 41 | D0000107 | ||
| 42 | D107 | ||
| 43 | D0000112 | ||
| 44 | D112 | ||
| 45 | D0000113 | ||
| 46 | D113 | ||
| 47 | D0000115 | ||
| 48 | D115 | ||
| 49 | D0000120 | ||
| 50 | D120 | ||
| 51 | D0000134 | ||
| 52 | D134 | ||
| 53 | D0000136 | ||
| 54 | D136 | ||
| 55 | D0000137 | ||
| 56 | D137 | ||
| 57 | D0000138 | ||
| 58 | D138 | ||
| 59 | D0000143 | ||
| 60 | D143 | ||
| 61 | D0000146 | ||
| 62 | D146 | ||
| 63 | D0000149 | ||
| 64 | D149 | ||
| 65 | D0000150 | ||
| 66 | D150 | ||
| 67 | D0000151 | ||
| 68 | D151 | ||
| 69 | D0000152 | ||
| 70 | D152 | ||
| 71 | D0000156 | ||
| 72 | D156 | ||
| 73 | D0000157 | ||
| 74 | D157 | ||
| 75 | D0000158 | ||
| 76 | D158 | ||
| 77 | D0000159 | ||
| 78 | D159 | ||
| 79 | D0000160 | ||
| 80 | D160 | ||
| 81 | D0000161 | ||
| 82 | D161 | ||
| 83 | D0000162 | ||
| 84 | D162 | ||
| 85 | D0000163 | ||
| 86 | D163 | ||
| 87 | D0000164 | ||
| 88 | D164 | ||
| 89 | D0000165 | ||
| 90 | D165 | ||
| 91 | D0000166 | ||
| 92 | D166 | ||
| 93 | D0000167 | ||
| 94 | D167 | ||
| 95 | D0000171 | ||
| 96 | D171 | ||
| 97 | D0000172 | ||
| 98 | D172 | ||
| 99 | D0000173 | ||
| 100 | D173 | ||
| 101 | D0000174 | ||
| 102 | D174 | ||
| 103 | D0000175 | ||
| 104 | D175 | ||
| 105 | D0000176 | ||
| 106 | D176 | ||
| 107 | D0000177 | ||
| 108 | D177 | ||
| 109 | D0000178 | ||
| 110 | D178 | ||
| 111 | D0000180 | ||
| 112 | D180 | ||
| 113 | D0000181 | ||
| 114 | D181 | ||
| 115 | D0000182 | ||
| 116 | D182 | ||
| 117 | D0000183 | ||
| 118 | D183 | ||
| 119 | D0000184 | ||
| 120 | D184 | ||
| 121 | D0000185 | ||
| 122 | D185 | ||
| 123 | P0000004 | ||
| 124 | P4 | ||
| 125 | P0000020 | ||
| 126 | P20 | ||
| 127 | P0000021 | ||
| 128 | P21 | ||
| 129 | P0000023 | ||
| 130 | P23 | ||
| 131 | P0000025 | ||
| 132 | P25 | ||
| 133 | P0000026 | ||
| 134 | P26 | ||
| 135 | P0000032 | ||
| 136 | P32 | ||
| 137 | P0000037 | ||
| 138 | P37 | ||
| 139 | P0000044 | ||
| 140 | P44 | ||
| 141 | P0000046 | ||
| 142 | P46 | ||
| 143 | P0000047 | ||
| 144 | P47 | ||
| 145 | P0000063 | ||
| 146 | P63 | ||
| 147 | P0000068 | ||
| 148 | P68 | ||
| 149 | P0000071 | ||
| 150 | P71 | ||
| 151 | P0000073 | ||
| 152 | P73 | ||
| 153 | P0000074 | ||
| 154 | P74 | ||
| 155 | P0000075 | ||
| 156 | P75 | ||
| 157 | P0000084 | ||
| 158 | P84 | ||
| 159 | P0000086 | ||
| 160 | P86 | ||
| 161 | P0000088 | ||
| 162 | P88 | ||
| 163 | P0000097 | ||
| 164 | P97 | ||
| 165 | P0000103 | ||
| 166 | P103 | ||
| 167 | P0000112 | ||
| 168 | P112 | ||
| 169 | P0000134 | ||
| 170 | P134 | ||
| 171 | P0000160 | ||
| 172 | P160 | ||
| 173 | P0000163 | ||
| 174 | P163 | ||
| 175 | P0000164 | ||
| 176 | P164 | ||
| 177 | P0000169 | ||
| 178 | P169 | ||
| 179 | P0000170 | ||
| 180 | P170 | ||
| 181 | P0000171 | ||
| 182 | P171 | ||
| 183 | P0000172 | ||
| 184 | P172 | ||
| 185 | P0000177 | ||
| 186 | P177 | ||
| 187 | P0000178 | ||
| 188 | P178 | ||
| 189 | P0000188 | ||
| 190 | P188 | ||
| 191 | P0000189 | ||
| 192 | P189 | ||
| 193 | P0000191 | ||
| 194 | P191 | ||
| 195 | P0000200 | ||
| 196 | P200 | ||
| 197 | P0000209 | ||
| 198 | P209 | ||
| 199 | P0000218 | ||
| 200 | P218 | ||
| 201 | P0000219 | ||
| 202 | P219 | ||
| 203 | P0000220 | ||
| 204 | P220 | ||
| 205 | P0000222 | ||
| 206 | P222 | ||
| 207 | P0000227 | ||
| 208 | P227 | ||
| 209 | P0000231 | ||
| 210 | P231 | ||
| 211 | P0000232 | ||
| 212 | P232 | ||
| 213 | P0000233 | ||
| 214 | P233 | ||
| 215 | P0000237 | ||
| 216 | P237 | ||
| 217 | P0000242 | ||
| 218 | P242 | ||
| 219 | P0000244 | ||
| 220 | P244 | ||
| 221 | P0000246 | ||
| 222 | P246 | ||
| 223 | P0000254 | ||
| 224 | P254 | ||
| 225 | P0000255 | ||
| 226 | P255 | ||
| 227 | P0000256 | ||
| 228 | P256 | ||
| 229 | P0000258 | ||
| 230 | P258 | ||
| 231 | P0000259 | ||
| 232 | P259 | ||
| 233 | P0000260 | ||
| 234 | P260 | ||
| 235 | P0000262 | ||
| 236 | P262 | ||
| 237 | P0000264 | ||
| 238 | P264 | ||
| 239 | P0000265 | ||
| 240 | P265 | ||
| 241 | P0000270 | ||
| 242 | P270 | ||
| 243 | P0000271 | ||
| 244 | P271 | ||
| 245 | P0000272 | ||
| 246 | P272 | ||
| 247 | P0000282 | ||
| 248 | P282 | ||
| 249 | P0000284 | ||
| 250 | P284 | ||
| 251 | P0000285 | ||
| 252 | P285 | ||
| 253 | P0000295 | ||
| 254 | P295 | ||
| 255 | P0000296 | ||
| 256 | P296 | ||
| 257 | P0000297 | ||
| 258 | P297 | ||
| 259 | P0000298 | ||
| 260 | P298 | ||
| 261 | P0000301 | ||
| 262 | P301 | ||
| 263 | P0000302 | ||
| 264 | P302 | ||
| 265 | P0000303 | ||
| 266 | P303 | ||
| 267 | P0000304 | ||
| 268 | P304 | ||
| 269 | P0000305 | ||
| 270 | P305 | ||
| 271 | P0000306 | ||
| 272 | P306 | ||
| 273 | P0000308 | ||
| 274 | P308 | ||
| 275 | P0000312 | ||
| 276 | P312 | ||
| 277 | P0000314 | ||
| 278 | P314 | ||
| 279 | P0000315 | ||
| 280 | P315 | ||
| 281 | P0000320 | ||
| 282 | P320 | ||
| 283 | P0000321 | ||
| 284 | P321 | ||
| 285 | P0000322 | ||
| 286 | P322 | ||
| 287 | P0000323 | ||
| 288 | P323 | ||
| 289 | P0000324 | ||
| 290 | P324 | ||
| 291 | P0000325 | ||
| 292 | P325 | ||
| 293 | P0000326 | ||
| 294 | P326 | ||
| 295 | P0000327 | ||
| 296 | P327 | ||
| 297 | P0000328 | ||
| 298 | P328 | ||
| 299 | P0000332 | ||
| 300 | P332 | ||
| 301 | P0000333 | ||
| 302 | P333 | ||
| 303 | P0000334 | ||
| 304 | P334 | ||
| 305 | P0000335 | ||
| 306 | P335 | ||
| 307 | P0000339 | ||
| 308 | P339 | ||
| 309 | P0000341 | ||
| 310 | P341 | ||
| 311 | P0000342 | ||
| 312 | P342 | ||
| 313 | P0000343 | ||
| 314 | P343 | ||
| 315 | P0000345 | ||
| 316 | P345 | ||
| 317 | P0000347 | ||
| 318 | P347 | ||
| 319 | P0000348 | ||
| 320 | P348 | ||
| 321 | P0000349 | ||
| 322 | P349 | ||
| 323 | P0000350 | ||
| 324 | P350 | ||
| 325 | P0000351 | ||
| 326 | P351 | ||
| 327 | P0000352 | ||
| 328 | P352 | ||
| 329 | P0000354 | ||
| 330 | P354 | ||
| 331 | P0000355 | ||
| 332 | P355 | ||
| 333 | P0000359 | ||
| 334 | P359 | ||
| 335 | P0000360 | ||
| 336 | P360 | ||
| 337 | P0000363 | ||
| 338 | P363 | ||
| 339 | P0000365 | ||
| 340 | P365 | ||
| 341 | P0000366 | ||
| 342 | P366 | ||
| 343 | P0000367 | ||
| 344 | P367 | ||
| 345 | P0000368 | ||
| 346 | P368 | ||
| 347 | P0000369 | ||
| 348 | P369 | ||
| 349 | P0000370 | ||
| 350 | P370 | ||
| 351 | P0000371 | ||
| 352 | P371 | ||
| 353 | P0000373 | ||
| 354 | P373 | ||
| 355 | P0000374 | ||
| 356 | P374 | ||
| 357 | P0000376 | ||
| 358 | P376 | ||
| 359 | P0000377 | ||
| 360 | P377 | ||
| 361 | P0000378 | ||
| 362 | P378 | ||
| 363 | P0000379 | ||
| 364 | P379 | ||
| 365 | P0000380 | ||
| 366 | P380 | ||
| 367 | P0000381 | ||
| 368 | P381 | ||
| 369 | P0000382 | ||
| 370 | P382 | ||
| 371 | P0000383 | ||
| 372 | P383 | ||
| 373 | P0000384 | ||
| 374 | P384 | ||
| 375 | P0000385 | ||
| 376 | P385 | ||
| 377 | P0000386 | ||
| 378 | P386 | ||
| 379 | P0000387 | ||
| 380 | P387 | ||
| 381 | P0000388 | ||
| 382 | P388 | ||
| 383 | P0000389 | ||
| 384 | P389 | ||
| 385 | P0000390 | ||
| 386 | P390 | ||
| 387 | P0000391 | ||
| 388 | P391 | ||
| 389 | P0000392 | ||
| 390 | P392 | ||
| 391 | P0000393 | ||
| 392 | P393 | ||
| 393 | P0000394 | ||
| 394 | P394 | ||
| 395 | P0000395 | ||
| 396 | P395 | ||
| 397 | P0000397 | ||
| 398 | P397 | ||
| 399 | P0000398 | ||
| 400 | P398 | ||
| 401 | P0000400 | ||
| 402 | P400 | ||
| 403 | P0000401 | ||
| 404 | P401 | ||
| 405 | P0000402 | ||
| 406 | P402 | ||
| 407 | P0000404 | ||
| 408 | P404 | ||
| 409 | P0000405 | ||
| 410 | P405 | ||
| 411 | P0000406 | ||
| 412 | P406 | ||
| 413 | P0000407 | ||
| 414 | P407 | ||
| 415 | P0000408 | ||
| 416 | P408 | ||
| 417 | P0000409 | ||
| 418 | P409 | ||
| 419 | P0000410 | ||
| 420 | P410 | ||
| 421 | P0000411 | ||
| 422 | P411 | ||
| 423 | P0000412 | ||
| 424 | P412 | ||
| 425 | P0000413 | ||
| 426 | P413 | ||
| 427 | P0000414 | ||
| 428 | P414 | ||
| 429 | P0000415 | ||
| 430 | P415 | ||
| 431 | P0000416 | ||
| 432 | P416 | ||
| 433 | P0000417 | ||
| 434 | P417 | ||
| 435 | P0000418 | ||
| 436 | P418 | ||
| 437 | P0000419 | ||
| 438 | P419 | ||
| 439 | P0000420 | ||
| 440 | P420 | ||
| 441 | P0000421 | ||
| 442 | P421 | ||
| 443 | P0000422 | ||
| 444 | P422 | ||
| 445 | P0000424 | ||
| 446 | P424 | ||
| 447 | P0000425 | ||
| 448 | P425 | ||
| 449 | P0000426 | ||
| 450 | P426 | ||
| 451 | P0000427 | ||
| 452 | P427 | ||
| 453 | P0000428 | ||
| 454 | P428 | ||
| 455 | P0000430 | ||
| 456 | P430 | ||
| 457 | P0000431 | ||
| 458 | P431 | ||
| 459 | P0000432 | ||
| 460 | P432 | ||
| 461 | P0000433 | ||
| 462 | P433 | ||
| 463 | P0000434 | ||
| 464 | P434 | ||
| 465 | P0000435 | ||
| 466 | P435 | ||
| 467 | P0000436 | ||
| 468 | P436 | ||
| 469 | P0000437 | ||
| 470 | P437 | ||
| 471 | P0000438 | ||
| 472 | P438 | ||
| 473 | P0000441 | ||
| 474 | P441 | ||
| 475 | P0000442 | ||
| 476 | P442 | ||
| 477 | P0000443 | ||
| 478 | P443 | ||
| 479 | P0000444 | ||
| 480 | P444 | ||
| 481 | P0000445 | ||
| 482 | P445 | ||
| 483 | P0000446 | ||
| 484 | P446 | ||
| 485 | P0000447 | ||
| 486 | P447 | ||
| 487 | P0000448 | ||
| 488 | P448 | ||
| 489 | P0000449 | ||
| 490 | P449 | ||
| 491 | P0000450 | ||
| 492 | P450 | ||
| 493 | 0000443 | ||
| 494 | P443 | ||
| 495 | P0000444 | ||
| 496 | P444 | ||
| 497 | P0000445 | ||
| 498 | P445 | ||
| 499 | P0000446 | ||
| 500 | P446 | ||
| 501 | P0000447 | ||
| 502 | P \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/PUTMSG.ASM b/v4.0/src/MAPPER/PUTMSG.ASM new file mode 100644 index 0000000..ef1bef9 --- /dev/null +++ b/v4.0/src/MAPPER/PUTMSG.ASM | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | page 60,132 | ||
| 2 | |||
| 3 | title CP/DOS DOSPutMessage mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | ; | ||
| 8 | ; ************************************************************************* * | ||
| 9 | ; * | ||
| 10 | ; * MODULE: DosPutMessage | ||
| 11 | ; * | ||
| 12 | ; * FILE NAME: dos035.asm | ||
| 13 | ; * | ||
| 14 | ; * FUNCTION: diplay message | ||
| 15 | ; * | ||
| 16 | ; * CALLING SEQUENCE: | ||
| 17 | ; * | ||
| 18 | ; * push handle ; file handle | ||
| 19 | ; * push messlgth ; message length | ||
| 20 | ; * push messbuff ; message buffer | ||
| 21 | ; * call dosputmessage | ||
| 22 | ; * | ||
| 23 | ; * RETURN SEQUENCE: AX = return code | ||
| 24 | ; * | ||
| 25 | ; * | ||
| 26 | ; * | ||
| 27 | ; * MODULES CALLED: INT 21H function 4 | ||
| 28 | ; * | ||
| 29 | ; ************************************************************************* | ||
| 30 | |||
| 31 | public dosputmessage | ||
| 32 | .sall | ||
| 33 | .xlist | ||
| 34 | include macros.inc | ||
| 35 | .list | ||
| 36 | |||
| 37 | str struc | ||
| 38 | old_bp dw ? | ||
| 39 | return dd ? | ||
| 40 | MessagePtr dd ? ; message pointer | ||
| 41 | MessageLength dw ? ; message length | ||
| 42 | Handle dw ? ; file handle | ||
| 43 | str ends | ||
| 44 | |||
| 45 | dosputmessage proc far | ||
| 46 | |||
| 47 | Enter dosputmessage ; save registers | ||
| 48 | |||
| 49 | mov bx,[bp].Handle ; get handle | ||
| 50 | mov cx,[bp].MessageLength ; get message length | ||
| 51 | lds dx,[bp].MessagePtr ; setup message buffer | ||
| 52 | |||
| 53 | mov ah,40h ; load opcode | ||
| 54 | int 21h ; display message | ||
| 55 | jc ErrorExit ; jump if error | ||
| 56 | |||
| 57 | xor ax,ax ; else set good return code | ||
| 58 | |||
| 59 | ErrorExit: | ||
| 60 | Mexit ; pop registers | ||
| 61 | ret size str - 6 ; return | ||
| 62 | |||
| 63 | dosputmessage endp | ||
| 64 | |||
| 65 | dosxxx ends | ||
| 66 | |||
| 67 | end | ||
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 | |||
diff --git a/v4.0/src/MAPPER/QCURDSK.ASM b/v4.0/src/MAPPER/QCURDSK.ASM new file mode 100644 index 0000000..7abf22e --- /dev/null +++ b/v4.0/src/MAPPER/QCURDSK.ASM | |||
| @@ -0,0 +1,148 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosQCurDisk mapper | ||
| 5 | |||
| 6 | extrn dosqcurdir:far | ||
| 7 | extrn dosdevconfig:far | ||
| 8 | |||
| 9 | buffer segment word public 'buffer' | ||
| 10 | drive dw ? ; driver number | ||
| 11 | buffr db 20 dup(?) ; buffer | ||
| 12 | bufflng dw 20 ; buffer length | ||
| 13 | map dw 2 dup(?) ; map area | ||
| 14 | dsket db ? ; | ||
| 15 | buffer ends | ||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | dosxxx segment byte public 'dos' | ||
| 20 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 21 | |||
| 22 | ; | ||
| 23 | ;********************************************************************** | ||
| 24 | ;* | ||
| 25 | ;* MODULE: dosqcurdisk | ||
| 26 | ;* | ||
| 27 | ;* FILE NAME: dos037.asm | ||
| 28 | ;* | ||
| 29 | ;* CALLING SEQUENCE: | ||
| 30 | ;* | ||
| 31 | ;* push@ dword drive number return location pointer | ||
| 32 | ;* push@ dword drive map area pointer | ||
| 33 | ;* call dosqcurdisk | ||
| 34 | ;* | ||
| 35 | ;* MODULES CALLED: PC-DOS Int 21h, AH=19h, get current disk | ||
| 36 | ;* Rom Bios Int 11 (called by DosDevConfig) | ||
| 37 | ;* | ||
| 38 | ;********************************************************************* | ||
| 39 | ; | ||
| 40 | public dosqcurdisk | ||
| 41 | .sall | ||
| 42 | .xlist | ||
| 43 | include macros.inc | ||
| 44 | .list | ||
| 45 | |||
| 46 | str struc | ||
| 47 | old_bp dw ? | ||
| 48 | return dd ? | ||
| 49 | Drvmap dd ? ; drive map pointer | ||
| 50 | Drvnbr dd ? ; drive number | ||
| 51 | str ends | ||
| 52 | |||
| 53 | |||
| 54 | defdrive db ? ; Save area for default drive -->RW | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | dosqcurdisk proc far | ||
| 59 | |||
| 60 | Enter Dosqcurdisk ; push registers | ||
| 61 | |||
| 62 | mov ah,19h ; get current default drive | ||
| 63 | int 21h | ||
| 64 | mov defdrive,al ; Save default drive | ||
| 65 | |||
| 66 | cbw ; fill ax with drive # | ||
| 67 | lds si,[bp].drvnbr ; output address | ||
| 68 | inc ax ; set drive A = 1 | ||
| 69 | mov word ptr [si],ax ; drive number | ||
| 70 | |||
| 71 | mov ax,buffer ; prepare data segment | ||
| 72 | mov ds,ax ; register for calls | ||
| 73 | |||
| 74 | assume ds:buffer | ||
| 75 | |||
| 76 | lea di,dsket ; diskette address | ||
| 77 | push ds | ||
| 78 | push di | ||
| 79 | mov ax,2 ; request diskette count | ||
| 80 | push ax | ||
| 81 | sub ax,ax ; reserved parm | ||
| 82 | push ax | ||
| 83 | |||
| 84 | call dosdevconfig ; get number of drives | ||
| 85 | |||
| 86 | cmp dsket,0 ; if none, jump | ||
| 87 | je nodisk | ||
| 88 | stc ; else set flag | ||
| 89 | jmp short dskbits | ||
| 90 | |||
| 91 | nodisk: clc ; clear flag | ||
| 92 | |||
| 93 | dskbits: mov map+2,0 ; clear output areas | ||
| 94 | mov map,0 | ||
| 95 | pushf ; save carry status, then | ||
| 96 | rcr map+2,1 ; set flags for devices | ||
| 97 | popf ; A and B | ||
| 98 | rcr map+2,1 | ||
| 99 | |||
| 100 | mov drive,2 ; start at C -->RW --> Changed 3 to 2 | ||
| 101 | mov di,2 ; start with low-order | ||
| 102 | loopx: | ||
| 103 | mov ah,0eh ; DOS Select Disk -->RW | ||
| 104 | mov dx,drive ; Drive number in DL -->RW | ||
| 105 | int 021h ; -->RW | ||
| 106 | |||
| 107 | mov ah,019h ; DOS Get Current Disk -->RW | ||
| 108 | int 021h ; -->RW | ||
| 109 | xor ah,ah ; Clear AH -->RW | ||
| 110 | cmp ax,drive ; Drive now in AX -->RW | ||
| 111 | |||
| 112 | je driveok ; drive at this number | ||
| 113 | clc ; else drive no good | ||
| 114 | jmp short rotate | ||
| 115 | |||
| 116 | driveok: stc | ||
| 117 | |||
| 118 | rotate: rcr map[di],1 ; shift bit in | ||
| 119 | inc drive | ||
| 120 | cmp drive,17 ; finished first word? | ||
| 121 | jl loopx ; if no, jump | ||
| 122 | mov di,0 ; if so, switch to high | ||
| 123 | cmp drive,26 ; order word, and check | ||
| 124 | jle loopx ; for last drive. | ||
| 125 | ;restore current drive | ||
| 126 | mov ah,0eh ; DOS Select Disk -->RW | ||
| 127 | mov dl,defdrive ; Drive number in DL -->RW | ||
| 128 | int 021h ; -->RW | ||
| 129 | |||
| 130 | mov cl,6 ; only ten bits used | ||
| 131 | shr map,cl ; in high-order word. | ||
| 132 | mov ax,map ; Now put in registers | ||
| 133 | mov bx,map+2 ; for shift into output | ||
| 134 | push cs ; area. | ||
| 135 | pop ds | ||
| 136 | lds si,[bp].drvmap ; | ||
| 137 | mov [si],ax | ||
| 138 | mov [si]+2,bx ; | ||
| 139 | ; Set good return code -->RW | ||
| 140 | xor ax,ax | ||
| 141 | exit: mexit ; pop registers | ||
| 142 | ret size str - 6 ; return | ||
| 143 | |||
| 144 | dosqcurdisk endp | ||
| 145 | |||
| 146 | dosxxx ends | ||
| 147 | |||
| 148 | end | ||
diff --git a/v4.0/src/MAPPER/QFILEINF.ASM b/v4.0/src/MAPPER/QFILEINF.ASM new file mode 100644 index 0000000..b35bdbb --- /dev/null +++ b/v4.0/src/MAPPER/QFILEINF.ASM | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | ; 0 | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosQFileInfo mapper | ||
| 5 | ; | ||
| 6 | |||
| 7 | FileAttributeSegment segment word public 'fat' | ||
| 8 | |||
| 9 | extrn FileAttributeTable:word | ||
| 10 | |||
| 11 | FileAttributeSegment ends | ||
| 12 | |||
| 13 | dosxxx segment byte public 'dos' | ||
| 14 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 15 | ; | ||
| 16 | ;********************************************************************** | ||
| 17 | ;* | ||
| 18 | ;* MODULE: dosQfileinfo | ||
| 19 | ;* | ||
| 20 | ;* FILE NAME: dos052.asm | ||
| 21 | ;* | ||
| 22 | ;* CALLING SEQUENCE: | ||
| 23 | ;* | ||
| 24 | ;* push word filehandle | ||
| 25 | ;* push word fileinfolevel | ||
| 26 | ;* push@ other fileinfobuffer | ||
| 27 | ;* push word filebuffersize | ||
| 28 | ;* call dossetfileinfo | ||
| 29 | ;* | ||
| 30 | ;* MODULES CALLED: PC-DOS Int 21h, ah=57h, set file's date/time | ||
| 31 | ;* | ||
| 32 | ;********************************************************************* | ||
| 33 | |||
| 34 | public dosQfileinfo | ||
| 35 | .sall | ||
| 36 | .xlist | ||
| 37 | include macros.inc | ||
| 38 | .list | ||
| 39 | |||
| 40 | |||
| 41 | FileInfo struc | ||
| 42 | CreateDate dw ? | ||
| 43 | CreateTime dw ? | ||
| 44 | LastAccessDate dw ? | ||
| 45 | LastAccessTime dw ? | ||
| 46 | LastWriteDate dw ? | ||
| 47 | LastWriteTime dw ? | ||
| 48 | DataLength dd ? ; File size | ||
| 49 | FileSpace dd ? ; falloc_size | ||
| 50 | Attributes dw ? ; attributes | ||
| 51 | FileInfo ends | ||
| 52 | |||
| 53 | |||
| 54 | str struc | ||
| 55 | old_bp dw ? | ||
| 56 | return dd ? | ||
| 57 | BufferSize dw ? ; file data buffer size | ||
| 58 | BufferPtr dd ? ; file data buffer | ||
| 59 | Level dw ? ; file data info level | ||
| 60 | Handle dw ? ; file handle | ||
| 61 | str ends | ||
| 62 | |||
| 63 | dosQfileinfo proc far | ||
| 64 | Enter dosQfileinfo ; save registers | ||
| 65 | |||
| 66 | mov bx,[bp].handle ;fill registers for function call | ||
| 67 | |||
| 68 | mov ax,05700h | ||
| 69 | int 21h ; get file date and time | ||
| 70 | jc ErrorExit ; jump if error | ||
| 71 | |||
| 72 | lds si,[bp].BufferPtr ; copy date and time to | ||
| 73 | mov ds:[si].CreateDate,dx ; file info return data area | ||
| 74 | mov ds:[si].CreateTime,cx | ||
| 75 | mov ds:[si].LastAccessDate,dx | ||
| 76 | mov ds:[si].LastAccessTime,cx | ||
| 77 | mov ds:[si].LastWriteDate,dx | ||
| 78 | mov ds:[si].LastWriteTime,cx | ||
| 79 | |||
| 80 | ; Calculate the file length and file space and save in the file info data area | ||
| 81 | |||
| 82 | mov cx,0 ; get the current position | ||
| 83 | mov dx,0 | ||
| 84 | mov bx,[bp].handle ; get file handle | ||
| 85 | |||
| 86 | mov ax,04201h | ||
| 87 | int 21h ; move file pointer to the | ||
| 88 | jc ErrorExit ; current position | ||
| 89 | |||
| 90 | push dx | ||
| 91 | push ax | ||
| 92 | |||
| 93 | mov cx,0 | ||
| 94 | mov dx,0 | ||
| 95 | mov bx,[bp].Handle | ||
| 96 | |||
| 97 | mov ax,04202h ; move file pointer to end-of-file | ||
| 98 | int 21h | ||
| 99 | |||
| 100 | lds si,[bp].BufferPtr ; save the file length in | ||
| 101 | mov ds:word ptr DataLength[si+0],ax ; file info data area | ||
| 102 | mov ds:word ptr DataLength[si+2],dx | ||
| 103 | |||
| 104 | test ax,511 | ||
| 105 | jz HaveSpace | ||
| 106 | |||
| 107 | and ax,not 511 | ||
| 108 | add ax,512 | ||
| 109 | adc dx,0 | ||
| 110 | |||
| 111 | HaveSpace: | ||
| 112 | mov ds:word ptr FileSpace[si+0],ax ; save file space | ||
| 113 | mov ds:word ptr FileSpace[si+2],dx ; in return data area | ||
| 114 | |||
| 115 | ; calculate the file attribute and save | ||
| 116 | |||
| 117 | pop dx | ||
| 118 | pop cx | ||
| 119 | |||
| 120 | mov bx,[bp].Handle | ||
| 121 | |||
| 122 | mov ax,04200h | ||
| 123 | int 21h ; move the file pointer | ||
| 124 | jc ErrorExit | ||
| 125 | |||
| 126 | mov ax,seg FileAttributeSegment | ||
| 127 | mov ds,ax | ||
| 128 | assume ds:FileAttributeSegment | ||
| 129 | |||
| 130 | mov bx,[bp].Handle | ||
| 131 | add bx,bx | ||
| 132 | |||
| 133 | mov ax,FileAttributeTable[bx] | ||
| 134 | mov [bp].Attributes,ax ; save file attribute | ||
| 135 | |||
| 136 | sub ax,ax ; set good return code | ||
| 137 | |||
| 138 | ErrorExit: | ||
| 139 | mexit ; restore registers | ||
| 140 | ret size str - 6 ; return | ||
| 141 | |||
| 142 | dosqfileinfo endp | ||
| 143 | |||
| 144 | dosxxx ends | ||
| 145 | |||
| 146 | end | ||
diff --git a/v4.0/src/MAPPER/QFILEMOD.ASM b/v4.0/src/MAPPER/QFILEMOD.ASM new file mode 100644 index 0000000..59fc70c --- /dev/null +++ b/v4.0/src/MAPPER/QFILEMOD.ASM | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosQFileMode mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | ; | ||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosqfilemode Read file attribute | ||
| 11 | ;* | ||
| 12 | ;* FUNCTION: Query file mode | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push@ asciiz file path name | ||
| 17 | ;* push@ word attribute return area | ||
| 18 | ;* push dword reserved | ||
| 19 | ;* call dosqfilemode | ||
| 20 | ;* | ||
| 21 | ;* MODULES CALLED: PC-DOS Int 21h, ah=43h, change file mode | ||
| 22 | ;* | ||
| 23 | ;********************************************************************* | ||
| 24 | |||
| 25 | public dosqfilemode | ||
| 26 | .sall | ||
| 27 | .xlist | ||
| 28 | include macros.inc | ||
| 29 | .list | ||
| 30 | |||
| 31 | error_code equ 0002h | ||
| 32 | |||
| 33 | str struc | ||
| 34 | old_bp dw ? | ||
| 35 | return dd ? | ||
| 36 | rsrvd dd ? | ||
| 37 | Attrib dd ? ; current attribute pointer | ||
| 38 | Path dd ? ; file path name pointer | ||
| 39 | str ends | ||
| 40 | |||
| 41 | dosqfilemode proc far | ||
| 42 | Enter dosqfilemode ; push registers | ||
| 43 | |||
| 44 | lds dx,[bp].path ; set path name | ||
| 45 | |||
| 46 | mov ax,4300h ; set op code | ||
| 47 | int 21h ; get file mode | ||
| 48 | jc error ; jump if error | ||
| 49 | |||
| 50 | lds si,[bp].attrib ; setup return data area | ||
| 51 | mov word ptr [si],cx ; save attribute there | ||
| 52 | sub ax,ax ; set good return code | ||
| 53 | jmp short exit ; return | ||
| 54 | |||
| 55 | error: mov ax,error_code ; set error code | ||
| 56 | |||
| 57 | exit: mexit ; pop registers | ||
| 58 | ret size str - 6 ; return | ||
| 59 | |||
| 60 | dosqfilemode endp | ||
| 61 | |||
| 62 | dosxxx ends | ||
| 63 | |||
| 64 | end | ||
diff --git a/v4.0/src/MAPPER/QFSINFO.ASM b/v4.0/src/MAPPER/QFSINFO.ASM new file mode 100644 index 0000000..fe0fdba --- /dev/null +++ b/v4.0/src/MAPPER/QFSINFO.ASM | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosQFsInfo mapper | ||
| 4 | |||
| 5 | buffer segment word public 'buffer' | ||
| 6 | |||
| 7 | clsdr40 dw ? | ||
| 8 | avlcls40 dw ? | ||
| 9 | secalc40 dw ? | ||
| 10 | bytsec40 dw ? | ||
| 11 | |||
| 12 | buffer ends | ||
| 13 | |||
| 14 | dosxxx segment byte public 'dos' | ||
| 15 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 16 | ; | ||
| 17 | ; ************************************************************************* * | ||
| 18 | ; * | ||
| 19 | ; * MODULE: DosQFsInfo | ||
| 20 | ; * | ||
| 21 | ; * FILE NAME: DOS040.ASM | ||
| 22 | ; * | ||
| 23 | ; * FUNCTION: This module will return the information for a file | ||
| 24 | ; * system device. | ||
| 25 | ; * | ||
| 26 | ; * CALLING SEQUENCE: | ||
| 27 | ; * | ||
| 28 | ; * PUSH WORD DriveNumber ; Drive Number | ||
| 29 | ; * PUSH OTHER FSInfoLevel ; File system info required | ||
| 30 | ; * PUSH@ OTHER FSInfoBuf ; File system info buffer | ||
| 31 | ; * PUSH WORD FSInfoBufSize ; file system info buffer size | ||
| 32 | ; * Call DosQFsInfo | ||
| 33 | ; * | ||
| 34 | ; * | ||
| 35 | ; * RETURN SEQUENCE: | ||
| 36 | ; * | ||
| 37 | ; * IF ERROR (AX not = 0) | ||
| 38 | ; * | ||
| 39 | ; * AX = Error Code: | ||
| 40 | ; * | ||
| 41 | ; * o Invalid parameter | ||
| 42 | ; * | ||
| 43 | ; * | ||
| 44 | ; * MODULES CALLED: DOS int 21H function 19H | ||
| 45 | ; * DOS int 25H | ||
| 46 | ; * | ||
| 47 | ; * | ||
| 48 | ; ************************************************************************* | ||
| 49 | |||
| 50 | public DosQFsInfo | ||
| 51 | .sall | ||
| 52 | .xlist | ||
| 53 | include macros.inc | ||
| 54 | include error.inc | ||
| 55 | .list | ||
| 56 | |||
| 57 | str struc | ||
| 58 | old_bp dw ? | ||
| 59 | return dd ? | ||
| 60 | FSIBS40 dw ? ; info buffer size | ||
| 61 | FSIB40 dd ? ; info buffer | ||
| 62 | ILL40 dw ? ; info level | ||
| 63 | DRNUM40 dw ? ; driver number | ||
| 64 | str ends | ||
| 65 | |||
| 66 | DosQFsInfo proc far | ||
| 67 | Enter Dosqfsinfo ; push registers | ||
| 68 | |||
| 69 | mov dx,[bp].drnum40 ; load drive number | ||
| 70 | mov ah,036h | ||
| 71 | int 21h ; get disk space | ||
| 72 | |||
| 73 | cmp ax,0ffffh ; check if valid drive number | ||
| 74 | jne valdr40 ; jump if drive is ok | ||
| 75 | |||
| 76 | mov ax,error_invalid_parameter ; esle set error code | ||
| 77 | jmp erret40 ; error return | ||
| 78 | |||
| 79 | valdr40:; | ||
| 80 | push ax | ||
| 81 | mov ax,buffer ; set the data segment and save | ||
| 82 | push ax ; space information in the data area | ||
| 83 | pop ds | ||
| 84 | assume ds:buffer | ||
| 85 | mov avlcls40,bx ; save available cluster | ||
| 86 | mov clsdr40,dx ; save clusters per drive | ||
| 87 | mov bytsec40,cx ; save bytes per sector | ||
| 88 | pop ax ; | ||
| 89 | mov secalc40,ax ; save sectors per allocation unit | ||
| 90 | mov ax,[bp].ill40 ; get info level | ||
| 91 | cmp al,01 ; valid level ?? | ||
| 92 | je getinfo40 ; jump if valid | ||
| 93 | |||
| 94 | mov ax,error_invalid_parameter ; else invalid parameter | ||
| 95 | jmp erret40 ; error return | ||
| 96 | |||
| 97 | getinfo40:; | ||
| 98 | mov ax,[bp].fsibs40 ; get info buffer size address | ||
| 99 | cmp ax,18 ; check if valid | ||
| 100 | jge bufok40 ; jump if valid | ||
| 101 | |||
| 102 | mov ax,error_buffer_overflow ; move buffer not big enough | ||
| 103 | jmp erret40 ; error return | ||
| 104 | |||
| 105 | bufok40:; | ||
| 106 | les di,[bp].fsib40 ; get FSI buffer pointer | ||
| 107 | sub ax,ax ; return | ||
| 108 | mov es:[di],ax ; null | ||
| 109 | mov es:[di]+2,ax ; File system ID | ||
| 110 | add di,4 ; set pointer to number of sectors in alloc | ||
| 111 | sub ax,ax ; | ||
| 112 | mov es:[di]+2,ax ; set high order # of sectors in alloc to 0 | ||
| 113 | mov ax,secalc40 ; | ||
| 114 | mov es:[di],ax ; store low order # of sectors in alloc | ||
| 115 | add di,4 ; set pointer to number of allocation units | ||
| 116 | mov ax,clsdr40 ; load low order number | ||
| 117 | mov es:[di],ax ; of alloc units | ||
| 118 | sub ax,ax ; | ||
| 119 | mov es:[di]+2,ax ; set high order # of alloc units to 0 | ||
| 120 | mov ax,avlcls40 ; load low order number | ||
| 121 | mov es:[di]+4,ax ; of avail alloc units | ||
| 122 | sub ax,ax ; | ||
| 123 | mov es:[di]+6,ax ; set high order # of avail alloc to 0 | ||
| 124 | mov ax,bytsec40 ; get number | ||
| 125 | mov es:[di]+8,ax ; of bytes per sector | ||
| 126 | sub ax,ax ; set good return code | ||
| 127 | |||
| 128 | erret40:; | ||
| 129 | mexit ; pop registers | ||
| 130 | ret size str - 6 ; return | ||
| 131 | |||
| 132 | DosQFsInfo endp | ||
| 133 | |||
| 134 | dosxxx ends | ||
| 135 | |||
| 136 | end | ||
diff --git a/v4.0/src/MAPPER/QHANDTYP.ASM b/v4.0/src/MAPPER/QHANDTYP.ASM new file mode 100644 index 0000000..e9fcaaf --- /dev/null +++ b/v4.0/src/MAPPER/QHANDTYP.ASM | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DOSQhandtype mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosQhandtype | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: DosQhandtype | ||
| 14 | ; * | ||
| 15 | ; * FUNCTION: Determine whether a handle is file or device | ||
| 16 | ; * | ||
| 17 | ; * CALLING SEQUENCE: | ||
| 18 | ; * | ||
| 19 | ; * push handle ; file handle | ||
| 20 | ; * push@ handtype ; handle type | ||
| 21 | ; * push@ flagword ; device descriptor word | ||
| 22 | ; * call dosqhandtype | ||
| 23 | ; * | ||
| 24 | ; * RETURN SEQUENCE: | ||
| 25 | ; * | ||
| 26 | ; * handle type: 0 - if a file | ||
| 27 | ; * 1 - if a device | ||
| 28 | ; * MODULES CALLED: | ||
| 29 | ; * | ||
| 30 | ; * | ||
| 31 | ; ************************************************************************* | ||
| 32 | |||
| 33 | public dosqhandtype | ||
| 34 | .sall | ||
| 35 | .xlist | ||
| 36 | include macros.inc | ||
| 37 | .list | ||
| 38 | |||
| 39 | |||
| 40 | str struc | ||
| 41 | old_bp dw ? | ||
| 42 | return dd ? | ||
| 43 | AttributePtr dd ? ; Device descriptor word returned if device | ||
| 44 | HandleTypePtr dd ? ; handle type; 0 = file handle, 1 = device handle | ||
| 45 | Handle dw ? ; file handle | ||
| 46 | str ends | ||
| 47 | |||
| 48 | |||
| 49 | dosqhandtype proc far | ||
| 50 | |||
| 51 | Enter dosqhandtype ; push registers | ||
| 52 | |||
| 53 | mov bx,[bp].Handle ; get file handle | ||
| 54 | mov ax,4400h | ||
| 55 | int 21h ; get handle type | ||
| 56 | |||
| 57 | lds si,[bp].AttributePtr ; setup area for attribute return | ||
| 58 | mov ds:[si],dx | ||
| 59 | |||
| 60 | lds si,[bp].HandleTypePtr | ||
| 61 | mov ds:word ptr [si],0 ; assume it is a file | ||
| 62 | |||
| 63 | test dx,00080h ; test for file | ||
| 64 | jz ItIsAFile ; jump if true | ||
| 65 | |||
| 66 | mov ds:word ptr [si],1 ; else, it is a device, set flag | ||
| 67 | |||
| 68 | ItIsAFile: | ||
| 69 | Mexit ; pop registers | ||
| 70 | ret size str - 6 ; return | ||
| 71 | |||
| 72 | dosqhandtype endp | ||
| 73 | |||
| 74 | dosxxx ends | ||
| 75 | |||
| 76 | end | ||
diff --git a/v4.0/src/MAPPER/QVERIFY.ASM b/v4.0/src/MAPPER/QVERIFY.ASM new file mode 100644 index 0000000..4ebd154 --- /dev/null +++ b/v4.0/src/MAPPER/QVERIFY.ASM | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosQVerify mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dosqverify Returns the value of the verify flag | ||
| 12 | ;* | ||
| 13 | ;* FILE NAME: dos041.asm | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push@ word verify setting | ||
| 18 | ;* call dosqverify | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=54h, get verify setting | ||
| 21 | ;* | ||
| 22 | ;********************************************************************* | ||
| 23 | |||
| 24 | public dosqverify | ||
| 25 | .sall | ||
| 26 | .xlist | ||
| 27 | include macros.inc | ||
| 28 | .list | ||
| 29 | |||
| 30 | str struc | ||
| 31 | old_bp dw ? | ||
| 32 | return dd ? | ||
| 33 | verify dd ? ; return data area pointer | ||
| 34 | str ends | ||
| 35 | |||
| 36 | dosqverify proc far | ||
| 37 | Enter dosqverify ; save registers | ||
| 38 | |||
| 39 | mov ah,54h | ||
| 40 | int 21h ; get verify flag setting | ||
| 41 | |||
| 42 | lds si,[bp].verify ; setup return data area | ||
| 43 | cbw ; fill word | ||
| 44 | mov word ptr [si],ax ; save verify flag setting | ||
| 45 | sub ax,ax ; set good return code | ||
| 46 | |||
| 47 | exit: Mexit ; pop registers | ||
| 48 | ret size str - 6 ; return | ||
| 49 | |||
| 50 | dosqverify endp | ||
| 51 | |||
| 52 | dosxxx ends | ||
| 53 | |||
| 54 | end | ||
diff --git a/v4.0/src/MAPPER/READ.ASM b/v4.0/src/MAPPER/READ.ASM new file mode 100644 index 0000000..ec2367b --- /dev/null +++ b/v4.0/src/MAPPER/READ.ASM | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosRead mapper * * * | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | |||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosreade | ||
| 11 | ;* | ||
| 12 | ;* FUNCTION: Read a specified number of bytes from the file | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push word file handle | ||
| 17 | ;* push@ other buffer area | ||
| 18 | ;* push word buffer length | ||
| 19 | ;* push@ word bytes read | ||
| 20 | ;* call dosread | ||
| 21 | ;* | ||
| 22 | ;* MODULES CALLED: PC-DOS Int 21h, ah=3fh, | ||
| 23 | ;* | ||
| 24 | ;********************************************************************* | ||
| 25 | |||
| 26 | public dosread | ||
| 27 | .sall | ||
| 28 | .xlist | ||
| 29 | include macros.inc | ||
| 30 | .list | ||
| 31 | |||
| 32 | str struc | ||
| 33 | old_bp dw ? | ||
| 34 | return dd ? | ||
| 35 | Written dd ? ; number of bytes actually read | ||
| 36 | Bufflng dw ? ; number of bytes to be read | ||
| 37 | Buffer dd ? ; read buffer | ||
| 38 | Handle dw ? ; handle | ||
| 39 | str ends | ||
| 40 | |||
| 41 | dosread proc far | ||
| 42 | Enter Dosread ; save registers | ||
| 43 | |||
| 44 | mov bx,[bp].handle ; fill registers for | ||
| 45 | lds dx,[bp].buffer ; function call | ||
| 46 | mov cx,[bp].bufflng ; number of bytes to read | ||
| 47 | |||
| 48 | mov ah,3fh ; load opcode | ||
| 49 | int 21h ; read from file | ||
| 50 | jc exit ; jump if error | ||
| 51 | |||
| 52 | lds si,[bp].written ; else, set return data area | ||
| 53 | mov word ptr [si],ax ; save number of bytes read | ||
| 54 | sub ax,ax ; set good return code | ||
| 55 | |||
| 56 | exit: mexit ; pop registers | ||
| 57 | ret size str - 6 ; rturn | ||
| 58 | |||
| 59 | dosread endp | ||
| 60 | |||
| 61 | dosxxx ends | ||
| 62 | |||
| 63 | end | ||
diff --git a/v4.0/src/MAPPER/REALLSEG.ASM b/v4.0/src/MAPPER/REALLSEG.ASM new file mode 100644 index 0000000..352a091 --- /dev/null +++ b/v4.0/src/MAPPER/REALLSEG.ASM | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosReallocSeg mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: DosReallocSeg | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: dos043.asm | ||
| 14 | ; * | ||
| 15 | ; * FUNCTION: This module changes the size of a segment already | ||
| 16 | ; * allocated | ||
| 17 | ; * | ||
| 18 | ; * CALLING SEQUENCE: | ||
| 19 | ; * | ||
| 20 | ; * push size ; new segment size requested in bytes | ||
| 21 | ; * push selector ; selector | ||
| 22 | ; * call dosreallocseg | ||
| 23 | ; * | ||
| 24 | ; * RETURN SEQUENCE: | ||
| 25 | ; * | ||
| 26 | ; * | ||
| 27 | ; * | ||
| 28 | ; * MODULES CALLED: DOS Int 21, AH=4A | ||
| 29 | ; * | ||
| 30 | ; * | ||
| 31 | ; * | ||
| 32 | ; ************************************************************************* | ||
| 33 | ; | ||
| 34 | public dosreallocseg | ||
| 35 | .sall | ||
| 36 | .xlist | ||
| 37 | include macros.inc | ||
| 38 | .list | ||
| 39 | |||
| 40 | str struc | ||
| 41 | old_bp dw ? | ||
| 42 | return dd ? | ||
| 43 | Selector dw ? ; segment selector | ||
| 44 | SegmentSize dw ? ; new segment size in bytes | ||
| 45 | str ends | ||
| 46 | |||
| 47 | dosreallocseg proc far | ||
| 48 | Enter dosreallocseg ; save registers | ||
| 49 | |||
| 50 | mov bx,[bp].SegmentSize ; Get new segment size | ||
| 51 | cmp bx,0 ; check for 0 | ||
| 52 | je AllocateMax ; jmp to full seg | ||
| 53 | |||
| 54 | shr bx,1 ; else convert segment in bytes | ||
| 55 | shr bx,1 ; paragraph | ||
| 56 | shr bx,1 | ||
| 57 | shr bx,1 | ||
| 58 | jmp HaveSize | ||
| 59 | |||
| 60 | AllocateMax: | ||
| 61 | mov bx,4096 ; default segment size in paragraph | ||
| 62 | |||
| 63 | HaveSize: | ||
| 64 | mov es,[bp].Selector ; set up segment for new size | ||
| 65 | |||
| 66 | mov ah,4ah ; set up for DOS realloc call | ||
| 67 | int 21h ; realloc segment | ||
| 68 | jc ErrorExit ; jump if error | ||
| 69 | |||
| 70 | sub ax,ax ; else set good return code | ||
| 71 | |||
| 72 | ErrorExit: | ||
| 73 | Mexit ; restore registers | ||
| 74 | |||
| 75 | ret size str - 6 ; return | ||
| 76 | |||
| 77 | dosreallocseg endp | ||
| 78 | |||
| 79 | dosxxx ends | ||
| 80 | |||
| 81 | end | ||
diff --git a/v4.0/src/MAPPER/RMDIR.ASM b/v4.0/src/MAPPER/RMDIR.ASM new file mode 100644 index 0000000..4925ac5 --- /dev/null +++ b/v4.0/src/MAPPER/RMDIR.ASM | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosRmDir mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | |||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dosrmdir | ||
| 11 | ;* | ||
| 12 | ;* FUNCTION: remove directory | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push@ asciiz directory name | ||
| 17 | ;* push dword reserved (must be zero) | ||
| 18 | ;* call dosrmdir | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=3ah, remove subdirectory | ||
| 21 | ;* | ||
| 22 | ;********************************************************************* | ||
| 23 | |||
| 24 | public dosrmdir | ||
| 25 | .sall | ||
| 26 | include macros.inc | ||
| 27 | |||
| 28 | str struc | ||
| 29 | old_bp dw ? | ||
| 30 | return dd ? | ||
| 31 | rsrvd dd ? ; reserved | ||
| 32 | asciiz dd ? ; directory name pointer | ||
| 33 | str ends | ||
| 34 | |||
| 35 | dosrmdir proc far | ||
| 36 | |||
| 37 | Enter dosrmdir ; push registers | ||
| 38 | |||
| 39 | lds dx,[bp].asciiz ; set pointer to directory name | ||
| 40 | |||
| 41 | mov ah,3ah ; load opcode | ||
| 42 | int 21h ; remove directory | ||
| 43 | jc exit ; check for error | ||
| 44 | |||
| 45 | sub ax,ax ; set good return code | ||
| 46 | exit: Mexit ; pop registers | ||
| 47 | ret size str - 6 ; return | ||
| 48 | |||
| 49 | dosrmdir endp | ||
| 50 | |||
| 51 | dosxxx ends | ||
| 52 | |||
| 53 | end | ||
diff --git a/v4.0/src/MAPPER/SCNTRY.ASM b/v4.0/src/MAPPER/SCNTRY.ASM new file mode 100644 index 0000000..2d17ce9 --- /dev/null +++ b/v4.0/src/MAPPER/SCNTRY.ASM | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosSetCtryCode mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment | ||
| 7 | assume cs:dosxxx,ds:dosxxx,es:dosxxx,ss:dosxxx | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dossetctrycode | ||
| 12 | ;* | ||
| 13 | ;* FILE NAME: dos049.asm | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push@ dword country code | ||
| 18 | ;* call dossetctrycode | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=38h, set country code | ||
| 21 | ;* | ||
| 22 | ;********************************************************************* | ||
| 23 | |||
| 24 | public dossetctrycode | ||
| 25 | .sall | ||
| 26 | include macros.inc | ||
| 27 | |||
| 28 | str struc | ||
| 29 | Old_bp dw ? | ||
| 30 | Return dd ? | ||
| 31 | Ccode dd ? ; country code | ||
| 32 | str ends | ||
| 33 | |||
| 34 | dossetctrycode proc far | ||
| 35 | Enter dossetctrycode ; push registers | ||
| 36 | |||
| 37 | lds si,[bp].ccode | ||
| 38 | mov ax,word ptr [si] ; get country code | ||
| 39 | mov cx,255 | ||
| 40 | cmp ax,cx ; check for country code >= 255 | ||
| 41 | jl okay ; branch if less | ||
| 42 | |||
| 43 | mov bx,ax ; if so, load into bx | ||
| 44 | mov al,cl ; and set flag | ||
| 45 | okay: mov dx,0ffffh ; Set DX | ||
| 46 | |||
| 47 | mov ah,38h ; DOS INT function code | ||
| 48 | int 21h ; set country information | ||
| 49 | jc exit ; branch if error | ||
| 50 | |||
| 51 | sub ax,ax ; set good return | ||
| 52 | exit: mexit ; pop registers | ||
| 53 | ret size str - 6 ; return | ||
| 54 | |||
| 55 | dossetctrycode endp | ||
| 56 | dosxxx ends | ||
| 57 | end | ||
diff --git a/v4.0/src/MAPPER/SCROLLUP.ASM b/v4.0/src/MAPPER/SCROLLUP.ASM new file mode 100644 index 0000000..cb92e8c --- /dev/null +++ b/v4.0/src/MAPPER/SCROLLUP.ASM | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS VioScrollUp mapper | ||
| 5 | ; | ||
| 6 | vioxxx segment byte public 'vio' | ||
| 7 | assume cs:vioxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: VioScrollUp | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: scrollup.asm | ||
| 14 | ; * | ||
| 15 | ; * CALLING SEQUENCE: | ||
| 16 | ; * | ||
| 17 | ; * | ||
| 18 | ; * push word toprow | ||
| 19 | ; * push word leftcol | ||
| 20 | ; * push word botrow | ||
| 21 | ; * push word rightcol | ||
| 22 | ; * push word lines | ||
| 23 | ; * push@ dword cell | ||
| 24 | ; * push word vio handle | ||
| 25 | ; * call vioscrollup | ||
| 26 | ; * | ||
| 27 | ; * MODULES CALLED: BIOS Int 10h | ||
| 28 | ; * | ||
| 29 | ; * | ||
| 30 | ; * | ||
| 31 | ; ************************************************************************* | ||
| 32 | |||
| 33 | public vioscrollup | ||
| 34 | .sall | ||
| 35 | .xlist | ||
| 36 | include macros.inc | ||
| 37 | .list | ||
| 38 | |||
| 39 | error_bvs_parameter equ 0002h | ||
| 40 | |||
| 41 | str struc | ||
| 42 | old_bp dw ? | ||
| 43 | return dd ? | ||
| 44 | handle dw ? ; vio handle | ||
| 45 | cell dd ? ; cell to be written | ||
| 46 | lines dw ? ; number of blank lines | ||
| 47 | rightcol dw ? ; right column | ||
| 48 | botrow dw ? ; bottom row | ||
| 49 | leftcol dw ? ; left column | ||
| 50 | toprow dw ? ; top row | ||
| 51 | str ends | ||
| 52 | |||
| 53 | vioscrollup proc far | ||
| 54 | Enter VioScrollUp ; save registers | ||
| 55 | |||
| 56 | mov bx,[bp].lines ; get number of blank lines | ||
| 57 | cmp bl,25 ; check for validity | ||
| 58 | jg error ; jump if invalid | ||
| 59 | |||
| 60 | mov al,bl | ||
| 61 | jmp ar02 | ||
| 62 | |||
| 63 | ar01: mov al,00h | ||
| 64 | ar02: mov ah,06h ; set scroll up function code | ||
| 65 | |||
| 66 | mov bx,[bp].rightcol ; get right col number | ||
| 67 | cmp bl,80 ; check the validity | ||
| 68 | jg error ; branch if error | ||
| 69 | mov dl,bl ; right column number in DL | ||
| 70 | |||
| 71 | mov bx,[bp].botrow ; get bottom row | ||
| 72 | cmp bl,25 ; check for validity | ||
| 73 | jg error ; branch if error | ||
| 74 | mov dh,bl ; bottom row in DH | ||
| 75 | |||
| 76 | mov bx,[bp].leftcol ; get left column number | ||
| 77 | mov cl,bl ; left column in CL | ||
| 78 | |||
| 79 | mov bx,[bp].toprow ; get top row number | ||
| 80 | mov ch,bl ; top row in CH | ||
| 81 | |||
| 82 | lds si,[bp].cell ; Set up cell in BX | ||
| 83 | mov bx,ds:[si] ; ***************** | ||
| 84 | ; cmp bl,15 ; check validity ** assume good ** | ||
| 85 | ; jg error ; branch if error ** attribute! ** | ||
| 86 | ; ***************** | ||
| 87 | mov bh,bl ; filler attribute in BH | ||
| 88 | pushal ; Save registers in case int 10h | ||
| 89 | ; messes them up | ||
| 90 | int 10h ; scrollup the display | ||
| 91 | |||
| 92 | popal | ||
| 93 | sub ax,ax ; set no error code | ||
| 94 | jmp exit ; return | ||
| 95 | |||
| 96 | error: mov ax,error_bvs_parameter ; set error code | ||
| 97 | |||
| 98 | exit: Mexit ; pop registers | ||
| 99 | ret size str - 6 ; return | ||
| 100 | |||
| 101 | vioscrollup endp | ||
| 102 | vioxxx ends | ||
| 103 | end | ||
diff --git a/v4.0/src/MAPPER/SCURPOS.ASM b/v4.0/src/MAPPER/SCURPOS.ASM new file mode 100644 index 0000000..e7af7a6 --- /dev/null +++ b/v4.0/src/MAPPER/SCURPOS.ASM | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS VioSetCurPos mapper | ||
| 5 | ; | ||
| 6 | vioxxx segment byte public 'vio' | ||
| 7 | assume cs:vioxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: viosetcurpos | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: scurpos.asm | ||
| 14 | ; * | ||
| 15 | ; * CALLING SEQUENCE: | ||
| 16 | ; * | ||
| 17 | ; * push word row value | ||
| 18 | ; * push word column value | ||
| 19 | ; * push word vio handle | ||
| 20 | ; * call viosetcurpos | ||
| 21 | ; * | ||
| 22 | ; * | ||
| 23 | ; * MODULES CALLED: BIOS Int 10h | ||
| 24 | ; * | ||
| 25 | ; ************************************************************************* | ||
| 26 | |||
| 27 | public viosetcurpos | ||
| 28 | .sall | ||
| 29 | .xlist | ||
| 30 | include macros.inc | ||
| 31 | .list | ||
| 32 | |||
| 33 | error_bvs_parameter equ 0002h | ||
| 34 | |||
| 35 | str struc | ||
| 36 | old_bp dw ? | ||
| 37 | return dd ? | ||
| 38 | handle dw ? ; vio handle | ||
| 39 | column dw ? ; column value | ||
| 40 | row dw ? ; row value | ||
| 41 | str ends | ||
| 42 | |||
| 43 | viosetcurpos proc far | ||
| 44 | Enter viosetcurpos ; push registers | ||
| 45 | |||
| 46 | mov bh,0 | ||
| 47 | mov ax,[bp].row ; get column number | ||
| 48 | cmp al,25 ; compare with maximum size allowed | ||
| 49 | jg error ; branch if illegal size | ||
| 50 | mov dh,al ; load row in dh | ||
| 51 | |||
| 52 | mov ax,[bp].column ; get column number | ||
| 53 | cmp al,80 ; check for upper boundry | ||
| 54 | jg error ; branch if illegal size | ||
| 55 | mov dl,al ; load column in dl | ||
| 56 | |||
| 57 | mov ah,02 ; set BIOS function code | ||
| 58 | pushal ; Save registers in case int 10h | ||
| 59 | ; messes them up | ||
| 60 | int 10h ; set cursor position | ||
| 61 | popal | ||
| 62 | |||
| 63 | sub ax,ax ; set good return code | ||
| 64 | jmp exit ; return | ||
| 65 | |||
| 66 | error: mov ax,error_bvs_parameter ; set error return code | ||
| 67 | exit: Mexit ; pop registers | ||
| 68 | ret size str - 6 ; return | ||
| 69 | |||
| 70 | viosetcurpos endp | ||
| 71 | vioxxx ends | ||
| 72 | end | ||
diff --git a/v4.0/src/MAPPER/SEL_DISK.ASM b/v4.0/src/MAPPER/SEL_DISK.ASM new file mode 100644 index 0000000..ab3bbc9 --- /dev/null +++ b/v4.0/src/MAPPER/SEL_DISK.ASM | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosSelectDisk mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dosselectdisk | ||
| 12 | ;* | ||
| 13 | ;* FILE NAME: dos048.asm | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push word drive drive number | ||
| 18 | ;* call dosselectdisk | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=0eh, select disk | ||
| 21 | ;* | ||
| 22 | ;********************************************************************* | ||
| 23 | |||
| 24 | public dosselectdisk | ||
| 25 | .sall | ||
| 26 | .xlist | ||
| 27 | include macros.inc | ||
| 28 | .list | ||
| 29 | |||
| 30 | str struc | ||
| 31 | old_bp dw ? | ||
| 32 | Return dd ? | ||
| 33 | Drive dw ? ; drive number | ||
| 34 | str ends | ||
| 35 | |||
| 36 | dosselectdisk proc far | ||
| 37 | Enter Dosselectdisk ; push registers | ||
| 38 | |||
| 39 | mov dx,[bp].drive ; load drive number | ||
| 40 | dec dx ; adjust for cp/dos incompatibility | ||
| 41 | |||
| 42 | mov ah,0eh | ||
| 43 | int 21h ; select the drive | ||
| 44 | |||
| 45 | sub ax,ax ; set good return code | ||
| 46 | |||
| 47 | mexit ; pop registers | ||
| 48 | ret size str - 6 ; return | ||
| 49 | |||
| 50 | dosselectdisk endp | ||
| 51 | |||
| 52 | dosxxx ends | ||
| 53 | |||
| 54 | end | ||
diff --git a/v4.0/src/MAPPER/SETFSINF.ASM b/v4.0/src/MAPPER/SETFSINF.ASM new file mode 100644 index 0000000..fb45a26 --- /dev/null +++ b/v4.0/src/MAPPER/SETFSINF.ASM | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | |||
| 2 | page 80,132 | ||
| 3 | ;0 | ||
| 4 | title CP/DOS DosSetFsInfo mapper | ||
| 5 | |||
| 6 | |||
| 7 | dosxxx segment byte public 'dos' | ||
| 8 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 9 | ; | ||
| 10 | ; ************************************************************************* * | ||
| 11 | ; * | ||
| 12 | ; * MODULE: DosSetFsInfo | ||
| 13 | ; * | ||
| 14 | ; * FUNCTION: This module will delete the volume label on a specified | ||
| 15 | ; * drive. | ||
| 16 | ; * | ||
| 17 | ; * CALLING SEQUENCE: | ||
| 18 | ; * | ||
| 19 | ; * PUSH WORD DriveNumber ; Drive Number | ||
| 20 | ; * PUSH OTHER FSInfoLevel ; File system info required | ||
| 21 | ; * PUSH@ OTHER FSInfoBuf ; File system info buffer | ||
| 22 | ; * PUSH WORD FSInfoBufSize ; file system info buffer size | ||
| 23 | ; * Call DosSetFsInfo | ||
| 24 | ; * | ||
| 25 | ; * | ||
| 26 | ; * MODULES CALLED: DOS int 21H function 13H | ||
| 27 | ; * | ||
| 28 | ; ************************************************************************* | ||
| 29 | |||
| 30 | public DosSetFsInfo | ||
| 31 | .sall | ||
| 32 | .xlist | ||
| 33 | include macros.inc | ||
| 34 | include error.inc | ||
| 35 | .list | ||
| 36 | |||
| 37 | str struc | ||
| 38 | old_bp dw ? | ||
| 39 | return dd ? | ||
| 40 | sbufsize dw ? ; info buffer size | ||
| 41 | sbuffoff dw ? ; info buffer offset | ||
| 42 | sbuffseg dw ? ; info buffer segment | ||
| 43 | slevel dw ? ; info level | ||
| 44 | sdrive dw ? ; drive number | ||
| 45 | str ends | ||
| 46 | |||
| 47 | |||
| 48 | ;----------------------------------------------- | ||
| 49 | ;--- Extended FCB, used to delete Volume Labels. | ||
| 50 | ;----------------------------------------------- | ||
| 51 | Ext_FCB db 0FFh ;Indicates extended FCB | ||
| 52 | db 0,0,0,0,0 ;Reserved | ||
| 53 | FCB_Attr db 08 ;Attribute for vol label | ||
| 54 | FCBDrive db 0 ;Drive number | ||
| 55 | VLabel db "???????????" ;Match any vol name found | ||
| 56 | db 25 dup (0) ;Rest of the opened FCB | ||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | |||
| 65 | DosSetFsInfo proc far | ||
| 66 | Enter DosSetfsinfo ; push registers | ||
| 67 | mov ax,[bp].sdrive ; Get drive number | ||
| 68 | mov FCBDrive,al ; Place it in the extended FCB | ||
| 69 | ;-------------------------- | ||
| 70 | ;-- FCB Delete old volume label | ||
| 71 | ;-------------------------- | ||
| 72 | mov ah,013h ; FCB Delete | ||
| 73 | push cs | ||
| 74 | pop ds | ||
| 75 | mov dx,offset Ext_FCB | ||
| 76 | int 021h ; Call DOS to delete volume label | ||
| 77 | ;--------------------------------- | ||
| 78 | ;-- Handle_Create new Volume label | ||
| 79 | ;--------------------------------- | ||
| 80 | mov cx,08h ; Volume label attribute | ||
| 81 | mov ah,03ch ; Handle create new volume label | ||
| 82 | mov dx,[bp].sbuffoff | ||
| 83 | push [bp].sbuffseg | ||
| 84 | pop ds | ||
| 85 | int 021h ; Do it | ||
| 86 | jc retrn ; Oops, there was an error. Not surprised... | ||
| 87 | ;-------------------------- | ||
| 88 | ;-- Close the Volume Label | ||
| 89 | ;-------------------------- | ||
| 90 | mov bx,ax ; Place handle in BX | ||
| 91 | mov ah,03eh ; Close the volume label | ||
| 92 | int 021h ; Do IT! | ||
| 93 | |||
| 94 | |||
| 95 | deleted: | ||
| 96 | sub ax,ax ; set good return code | ||
| 97 | retrn: | ||
| 98 | mexit ; pop registers | ||
| 99 | ret size str - 6 ; return | ||
| 100 | |||
| 101 | DosSetFsInfo endp | ||
| 102 | |||
| 103 | dosxxx ends | ||
| 104 | |||
| 105 | end | ||
diff --git a/v4.0/src/MAPPER/SETINT24.ASM b/v4.0/src/MAPPER/SETINT24.ASM new file mode 100644 index 0000000..9e3e8d8 --- /dev/null +++ b/v4.0/src/MAPPER/SETINT24.ASM | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | |||
| 4 | ;********************************************************************** | ||
| 5 | ;* | ||
| 6 | ;* MODULE: set_int24_vector | ||
| 7 | ;* | ||
| 8 | ;* Critical error handler for C programs BACKUP and RESTORE | ||
| 9 | ;* | ||
| 10 | ;********************************************************************* | ||
| 11 | ;------------------------------------------------------------;;;;AN000; | ||
| 12 | databuff segment public 'databuff' ;;;;AN000; | ||
| 13 | databuff ends ;;;;AN000; | ||
| 14 | ;------------------------------------------------------------;;;;AN000; | ||
| 15 | |||
| 16 | |||
| 17 | dosxxx segment byte public 'dos' ;AN000; | ||
| 18 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing ;AN000; | ||
| 19 | |||
| 20 | |||
| 21 | public set_int24_vector ;AN000; | ||
| 22 | .sall ;AN000; | ||
| 23 | .xlist ;AN000; | ||
| 24 | include macros.inc ;AN000; | ||
| 25 | .list ;AN000; | ||
| 26 | |||
| 27 | str struc ;AN000; | ||
| 28 | old_bp dw ? ;AN000; | ||
| 29 | Return dd ? ;AN000; | ||
| 30 | Flag dw ? ;AN000; | ||
| 31 | str ends ;AN000; | ||
| 32 | |||
| 33 | |||
| 34 | set_int24_vector proc far ;AN000; | ||
| 35 | Enter set_int24_vector ;AN000; | ||
| 36 | |||
| 37 | mov ax,seg databuff ;AN000; | ||
| 38 | mov ds,ax ;AN000; | ||
| 39 | assume ds:databuff ;AN000; | ||
| 40 | |||
| 41 | mov ax,03524h ;Get Int24 Vector ;AN000; | ||
| 42 | int 21h ;AN000; | ||
| 43 | ;Save it | ||
| 44 | mov word ptr cs:OldInt24,bx ;AN000; | ||
| 45 | mov word ptr cs:OldInt24+2,es ;AN000; | ||
| 46 | |||
| 47 | ;Get address of my Int24 Handler | ||
| 48 | mov dx,cs ;AN000; | ||
| 49 | mov ds,dx ;AN000; | ||
| 50 | mov dx,offset AppErrorHandler ;AN000; | ||
| 51 | |||
| 52 | mov ax,02524H ;Set new INT24 vector ;AN000; | ||
| 53 | int 21h ;AN000; | ||
| 54 | |||
| 55 | xor ax,ax ;Set good error return ;AN000; | ||
| 56 | |||
| 57 | exit: mexit ; pop all registers ;AN000; | ||
| 58 | ret size str - 6 ; return ;AN000; | ||
| 59 | |||
| 60 | set_int24_vector endp ;AN000; | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | ;------------------------------------------------------- | ||
| 67 | ; | ||
| 68 | ; **** Error Handler ****** | ||
| 69 | ; | ||
| 70 | ;------------------------------------------------------- | ||
| 71 | Ignore equ 0 ;AN000; | ||
| 72 | Retry equ 1 ;AN000; | ||
| 73 | Abort equ 2 ;AN000; | ||
| 74 | Fail equ 3 ;AN000; | ||
| 75 | |||
| 76 | OldInt24 dd ? ;AN000; ;save old interrupt handler address ;;; | ||
| 77 | |||
| 78 | AppErrorHandler proc near ;AN000; | ||
| 79 | pushf ;AN000; | ||
| 80 | call dword ptr cs:OldInt24 ;AN000; Get user to respond | ||
| 81 | cmp al,Abort ;AN000; For any resonse other than Abort | ||
| 82 | jne rett ;AN000; retry the operation | ||
| 83 | |||
| 84 | int 023h ;AN000; | ||
| 85 | |||
| 86 | rett: ;AN000; | ||
| 87 | iret ;AN000; return to caller | ||
| 88 | AppErrorHandler endp ;AN000; | ||
| 89 | ;------------------------------------------------------- | ||
| 90 | ;------------------------------------------------------- | ||
| 91 | |||
| 92 | dosxxx ends ;AN000; | ||
| 93 | end ;AN000; | ||
| 94 | \ No newline at end of file | ||
diff --git a/v4.0/src/MAPPER/SET_TOD.ASM b/v4.0/src/MAPPER/SET_TOD.ASM new file mode 100644 index 0000000..2cc058b --- /dev/null +++ b/v4.0/src/MAPPER/SET_TOD.ASM | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | ; | ||
| 2 | page 80,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS DosSetDateTime mapper | ||
| 5 | ; | ||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dossetdatetime | ||
| 12 | ;* | ||
| 13 | ;* FILE NAME: dos050.asm | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push@ struc date/time | ||
| 18 | ;* call dossetdatetime | ||
| 19 | ;* | ||
| 20 | ;* MODULES CALLED: PC-DOS Int 21h, ah=2bh, set date | ||
| 21 | ;* ah=2dh, set time | ||
| 22 | ;* | ||
| 23 | ;********************************************************************* | ||
| 24 | |||
| 25 | public dossetdatetime | ||
| 26 | .sall | ||
| 27 | include macros.inc | ||
| 28 | |||
| 29 | error_ts_datetime equ 0002h | ||
| 30 | |||
| 31 | str struc | ||
| 32 | old_bp dw ? | ||
| 33 | return dd ? | ||
| 34 | Data dd ? ; TOD data pointer | ||
| 35 | str ends | ||
| 36 | |||
| 37 | dossetdatetime proc far | ||
| 38 | Enter dossetdatetime ; push registers | ||
| 39 | |||
| 40 | lds si,[bp].data ; set TOD data pointer and load | ||
| 41 | ; info into registers | ||
| 42 | mov ch,byte ptr [si] ; load hour | ||
| 43 | mov cl,byte ptr [si]+1 ; minutes | ||
| 44 | mov dh,byte ptr [si]+2 ; seconds | ||
| 45 | mov dl,byte ptr [si]+3 ; hundredths | ||
| 46 | |||
| 47 | mov ah,2dh ; set time opcode | ||
| 48 | int 21h ; set new time | ||
| 49 | push ax ; check for error later | ||
| 50 | |||
| 51 | mov dl,byte ptr [si]+4 ; load day | ||
| 52 | mov dh,byte ptr [si]+5 ; month | ||
| 53 | mov cx,word ptr [si]+6 ; year | ||
| 54 | |||
| 55 | mov ah,2bh ; new date opcode | ||
| 56 | int 21h ; set new date | ||
| 57 | |||
| 58 | pop bx | ||
| 59 | mov cl,0 | ||
| 60 | cmp bl,cl ; return code from time set | ||
| 61 | jnz error | ||
| 62 | cmp al,0 ; return code from date set | ||
| 63 | jz exit | ||
| 64 | |||
| 65 | error: mov ax,error_ts_datetime ; set error code | ||
| 66 | jmp short exit1 | ||
| 67 | |||
| 68 | exit: sub ax,ax ; set good return code | ||
| 69 | exit1: Mexit ; pop registers | ||
| 70 | ret size str - 6 ; return | ||
| 71 | |||
| 72 | dossetdatetime endp | ||
| 73 | |||
| 74 | dosxxx ends | ||
| 75 | |||
| 76 | end | ||
diff --git a/v4.0/src/MAPPER/SFILEINF.ASM b/v4.0/src/MAPPER/SFILEINF.ASM new file mode 100644 index 0000000..e057da3 --- /dev/null +++ b/v4.0/src/MAPPER/SFILEINF.ASM | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | ; 0 | ||
| 2 | page 80,132 | ||
| 3 | |||
| 4 | title CP/DOS DosSetFileInfo mapper | ||
| 5 | |||
| 6 | |||
| 7 | FileAttributeSegment segment word public 'fat' | ||
| 8 | |||
| 9 | extrn FileAttributeTable:word | ||
| 10 | |||
| 11 | FileAttributeSegment ends | ||
| 12 | |||
| 13 | |||
| 14 | dosxxx segment byte public 'dos' | ||
| 15 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 16 | ; | ||
| 17 | ;********************************************************************** | ||
| 18 | ;* | ||
| 19 | ;* MODULE: dossetfileinfo | ||
| 20 | ;* | ||
| 21 | ;* FUNCTION: set file information | ||
| 22 | ;* | ||
| 23 | ;* CALLING SEQUENCE: | ||
| 24 | ;* | ||
| 25 | ;* push word file handle | ||
| 26 | ;* push word info level | ||
| 27 | ;* push@ other file info buffer | ||
| 28 | ;* push word file buffer size | ||
| 29 | ;* call dossetfileinfo | ||
| 30 | ;* | ||
| 31 | ;* MODULES CALLED: PC-DOS Int 21h, ah=57h, set file's date/time | ||
| 32 | ;* | ||
| 33 | ;********************************************************************* | ||
| 34 | |||
| 35 | public dossetfileinfo | ||
| 36 | .sall | ||
| 37 | .xlist | ||
| 38 | include macros.inc | ||
| 39 | .list | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | str struc | ||
| 44 | old_bp dw ? | ||
| 45 | return dd ? | ||
| 46 | BufferSize dw ? ; file info buufer size | ||
| 47 | BufferPtr dd ? ; file info buffer | ||
| 48 | Level dw ? ; file info level | ||
| 49 | Handle dw ? ; file handle | ||
| 50 | str ends | ||
| 51 | |||
| 52 | dossetfileinfo proc far | ||
| 53 | Enter dossetfileinfo ; push registers | ||
| 54 | |||
| 55 | mov bx,[bp].Handle ; fill registers for function call | ||
| 56 | lds si,[bp].BufferPtr ; date/time pointer | ||
| 57 | mov dx,word ptr [si]+8 ; date to be set | ||
| 58 | mov cx,word ptr [si]+10 ; time to be set | ||
| 59 | |||
| 60 | mov ax,5701h | ||
| 61 | int 21h | ||
| 62 | jc ErrorExit ; check for error | ||
| 63 | |||
| 64 | ; This code should be un-commented when the attribute can be set from | ||
| 65 | ; the setfileinfo call | ||
| 66 | |||
| 67 | ; lds si,[bp].BufferPtr | ||
| 68 | ; mov ax,ds:[si].the offset to the attribute word | ||
| 69 | |||
| 70 | ; mov bx,seg FileAttributeSegment | ||
| 71 | ; mov ds,bx | ||
| 72 | ; assume ds:FileAttributeSegment | ||
| 73 | |||
| 74 | ; mov bx,[bp].Handle | ||
| 75 | ; add bx,bx | ||
| 76 | |||
| 77 | ; mov FileAttributeTable[bx],ax | ||
| 78 | |||
| 79 | sub ax,ax ; set good return code | ||
| 80 | |||
| 81 | ErrorExit: | ||
| 82 | mexit ; pop registers | ||
| 83 | ret size str - 6 ; return | ||
| 84 | |||
| 85 | dossetfileinfo endp | ||
| 86 | |||
| 87 | dosxxx ends | ||
| 88 | |||
| 89 | end | ||
diff --git a/v4.0/src/MAPPER/SFILEMOD.ASM b/v4.0/src/MAPPER/SFILEMOD.ASM new file mode 100644 index 0000000..ecc3009 --- /dev/null +++ b/v4.0/src/MAPPER/SFILEMOD.ASM | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | ;0 | ||
| 2 | page 80,132 | ||
| 3 | |||
| 4 | title CP/DOS DosSetFileMode mapper | ||
| 5 | |||
| 6 | dosxxx segment byte public 'dos' | ||
| 7 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | |||
| 9 | ;********************************************************************** | ||
| 10 | ;* | ||
| 11 | ;* MODULE: dossetfilemode | ||
| 12 | ;* | ||
| 13 | ;* FUNCTION: Set file mode | ||
| 14 | ;* | ||
| 15 | ;* CALLING SEQUENCE: | ||
| 16 | ;* | ||
| 17 | ;* push@ asciiz file path name | ||
| 18 | ;* push word new attribute | ||
| 19 | ;* push dword reserved | ||
| 20 | ;* call dossetfilemode | ||
| 21 | ;* | ||
| 22 | ;* MODULES CALLED: PC-DOS Int 21h, ah=43h, change file mode | ||
| 23 | ;* | ||
| 24 | ;********************************************************************* | ||
| 25 | |||
| 26 | public dossetfilemode | ||
| 27 | .sall | ||
| 28 | .xlist | ||
| 29 | include macros.inc | ||
| 30 | .list | ||
| 31 | |||
| 32 | |||
| 33 | str struc | ||
| 34 | old_bp dw ? | ||
| 35 | return dd ? | ||
| 36 | Rsrvd dd ? ; reserved | ||
| 37 | Attrib dw ? ; file attribute | ||
| 38 | Path dd ? ; path name pointer pointer | ||
| 39 | str ends | ||
| 40 | |||
| 41 | dossetfilemode proc far | ||
| 42 | Enter dossetfilemode ; push registers | ||
| 43 | |||
| 44 | lds dx,[bp].path ; set pointer to path | ||
| 45 | mov cx,[bp].attrib | ||
| 46 | |||
| 47 | mov ax,4301h | ||
| 48 | int 21h ; change file mode | ||
| 49 | jc exit ; jump if error, return DOS error in ax | ||
| 50 | |||
| 51 | xor ax,ax ; set good return code | ||
| 52 | jmp short exit ; return | ||
| 53 | |||
| 54 | exit: mexit ; pop registers | ||
| 55 | ret size str - 6 ; return | ||
| 56 | |||
| 57 | dossetfilemode endp | ||
| 58 | |||
| 59 | dosxxx ends | ||
| 60 | |||
| 61 | end | ||
diff --git a/v4.0/src/MAPPER/SIGHAND.ASM b/v4.0/src/MAPPER/SIGHAND.ASM new file mode 100644 index 0000000..2258d1c --- /dev/null +++ b/v4.0/src/MAPPER/SIGHAND.ASM | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosSetSigHandler mapper | ||
| 4 | |||
| 5 | include msc.inc | ||
| 6 | |||
| 7 | dosxxx segment byte public 'dos' | ||
| 8 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 9 | |||
| 10 | ;********************************************************************** | ||
| 11 | ;* | ||
| 12 | ;* MODULE: dossetsighandler | ||
| 13 | ;* | ||
| 14 | ;* FILE NAME: dos007.asm | ||
| 15 | ;* | ||
| 16 | ;* CALLING SEQUENCE: | ||
| 17 | ;* | ||
| 18 | ;* push word file handle | ||
| 19 | ;* push dword distance | ||
| 20 | ;* push word move type | ||
| 21 | ;* push@ dword new pointer | ||
| 22 | ;* call doschgfileptr | ||
| 23 | ;* | ||
| 24 | ;* MODULES CALLED: PC-DOS Int 21h, ah=42h | ||
| 25 | ;* | ||
| 26 | ;********************************************************************* | ||
| 27 | |||
| 28 | public dossetsighandler | ||
| 29 | .sall | ||
| 30 | .xlist | ||
| 31 | include macros.inc | ||
| 32 | .list | ||
| 33 | |||
| 34 | str struc | ||
| 35 | old_bp dw ? | ||
| 36 | return dd ? | ||
| 37 | Signumber dw ? ; signal number | ||
| 38 | Action dw ? ; action code | ||
| 39 | Prevaction dd ? ; previous action code | ||
| 40 | Prevadrs dd ? ; previous vector address | ||
| 41 | Routineadrs dd ? ; interrupt handler address | ||
| 42 | str ends | ||
| 43 | |||
| 44 | ; While we hate to do this, we have to. The following data areas are | ||
| 45 | ; expected to be in the CODE segment. | ||
| 46 | |||
| 47 | NextControlBreakHandler label dword | ||
| 48 | NextControlBreakHandlerOffset dw DummyControlBreakHandler | ||
| 49 | NextControlBreakHandlerSegment dw dosxxx | ||
| 50 | |||
| 51 | NextCriticalErrorHandler label dword | ||
| 52 | NextCriticalErrorHandlerOffset dw DummyCriticalErrorHandler | ||
| 53 | NextCriticalErrorHandlerSegment dw dosxxx | ||
| 54 | |||
| 55 | dossetsighandler proc far | ||
| 56 | |||
| 57 | Enter dossetsighandler ; push registers | ||
| 58 | |||
| 59 | mov ax,[bp].action ; get action code | ||
| 60 | cmp ax,2 ; action code 2 ?? | ||
| 61 | je continue1 ; branch if true | ||
| 62 | mov ax,1 ; else, set error code | ||
| 63 | jmp exit ; return | ||
| 64 | |||
| 65 | continue1: | ||
| 66 | mov ax,[bp].signumber ; get signel number | ||
| 67 | cmp ax,1 ; signal 1 (cntrl chara) ?? | ||
| 68 | je cntrlc ; jump if true | ||
| 69 | cmp ax,4 ; signal 4 (cntrl chara) ?? | ||
| 70 | je cntrlc ; jump if true | ||
| 71 | mov ax,2 ; else, set error code | ||
| 72 | jmp exit ; return | ||
| 73 | |||
| 74 | cntrlc: mov ax,03523h | ||
| 75 | int 21h ; get old vector address | ||
| 76 | |||
| 77 | lds si,[bp].prevadrs ; previous handler pointer | ||
| 78 | mov word ptr [si],bx ; save it in prevsdrs | ||
| 79 | mov word ptr [si]+2,es | ||
| 80 | |||
| 81 | lds dx,[bp].routineadrs ; get address of signal handler | ||
| 82 | |||
| 83 | mov NextControlBreakHandlerOffset,dx ; save it | ||
| 84 | mov NextControlBreakHandlerSegment,ds | ||
| 85 | |||
| 86 | mov dx,cs | ||
| 87 | mov ds,dx | ||
| 88 | mov dx,offset RealControlBreakHandler | ||
| 89 | |||
| 90 | mov ax,02523H | ||
| 91 | int 21h ; set signal handler addrs in vector | ||
| 92 | |||
| 93 | sub ax,ax ; set good return code | ||
| 94 | |||
| 95 | exit: mexit ; pop registers | ||
| 96 | ret size str - 6 ; return | ||
| 97 | |||
| 98 | dossetsighandler endp | ||
| 99 | |||
| 100 | page | ||
| 101 | |||
| 102 | ;------------------------------------------------------------------------------ | ||
| 103 | |||
| 104 | ; This routine will get control on control break, and it will make | ||
| 105 | ; sure that the environment is acceptable prior to calling the new | ||
| 106 | ; handler. NOTE: we expect the new handler to be written in MicroSoft 'C' | ||
| 107 | |||
| 108 | RealControlBreakHandler proc far | ||
| 109 | |||
| 110 | push ds | ||
| 111 | push es | ||
| 112 | push di | ||
| 113 | push si | ||
| 114 | push bp | ||
| 115 | push dx | ||
| 116 | push cx | ||
| 117 | push bx | ||
| 118 | push ax | ||
| 119 | |||
| 120 | ; reestablish the es and ds segment registers before going to 'C' | ||
| 121 | |||
| 122 | mov ax,seg DGroup | ||
| 123 | mov ds,ax | ||
| 124 | mov es,ax | ||
| 125 | |||
| 126 | call NextControlBreakHandler | ||
| 127 | |||
| 128 | pop ax | ||
| 129 | pop bx | ||
| 130 | pop cx | ||
| 131 | pop dx | ||
| 132 | pop bp | ||
| 133 | pop si | ||
| 134 | pop di | ||
| 135 | pop es | ||
| 136 | pop ds | ||
| 137 | |||
| 138 | iret | ||
| 139 | |||
| 140 | RealControlBreakHandler endp | ||
| 141 | |||
| 142 | page | ||
| 143 | |||
| 144 | ;------------------------------------------------------------------------------ | ||
| 145 | |||
| 146 | ; This routine will get control on the control break, and it will make | ||
| 147 | ; sure that the environment is acceptable prior to calling the new | ||
| 148 | ; handler. NOTE: we expect the new handler to be written in MicroSoft 'C' | ||
| 149 | |||
| 150 | RealCriticalErrorHandler proc far | ||
| 151 | |||
| 152 | push ds | ||
| 153 | push es | ||
| 154 | push di | ||
| 155 | push si | ||
| 156 | push bp | ||
| 157 | push dx | ||
| 158 | push cx | ||
| 159 | push bx | ||
| 160 | push ax | ||
| 161 | |||
| 162 | ; reestablish the es and ds segment registers before going to 'C' | ||
| 163 | |||
| 164 | mov ax,seg DGroup | ||
| 165 | mov ds,ax | ||
| 166 | mov es,ax | ||
| 167 | |||
| 168 | call NextControlBreakHandler | ||
| 169 | |||
| 170 | pop ax | ||
| 171 | pop bx | ||
| 172 | pop cx | ||
| 173 | pop dx | ||
| 174 | pop bp | ||
| 175 | pop si | ||
| 176 | pop di | ||
| 177 | pop es | ||
| 178 | pop ds | ||
| 179 | |||
| 180 | iret | ||
| 181 | |||
| 182 | RealCriticalErrorHandler endp | ||
| 183 | |||
| 184 | page | ||
| 185 | |||
| 186 | ;------------------------------------------------------------------------------ | ||
| 187 | |||
| 188 | DummyControlBreakHandler proc far | ||
| 189 | |||
| 190 | iret | ||
| 191 | |||
| 192 | DummyControlBreakHandler endp | ||
| 193 | |||
| 194 | DummyCriticalErrorHandler proc far | ||
| 195 | |||
| 196 | iret | ||
| 197 | |||
| 198 | DummyCriticalErrorHandler endp | ||
| 199 | |||
| 200 | |||
| 201 | |||
| 202 | dosxxx ends | ||
| 203 | |||
| 204 | end | ||
diff --git a/v4.0/src/MAPPER/SVERIFY.ASM b/v4.0/src/MAPPER/SVERIFY.ASM new file mode 100644 index 0000000..97495ed --- /dev/null +++ b/v4.0/src/MAPPER/SVERIFY.ASM | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosSetVerify mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | |||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: dossetverify Set new verify switch value | ||
| 11 | ;* | ||
| 12 | ;* FILE NAME: dos054.asm | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push word verify setting | ||
| 17 | ;* call dossetverify | ||
| 18 | ;* | ||
| 19 | ;* MODULES CALLED: PC-DOS Int 21h, ah=2eh, get verify setting | ||
| 20 | ;* | ||
| 21 | ;********************************************************************* | ||
| 22 | |||
| 23 | public dossetverify | ||
| 24 | .sall | ||
| 25 | .xlist | ||
| 26 | include macros.inc | ||
| 27 | .list | ||
| 28 | |||
| 29 | error_code equ 0002h | ||
| 30 | |||
| 31 | str struc | ||
| 32 | old_bp dw ? | ||
| 33 | return dd ? | ||
| 34 | verify dw ? ; new verify settings value | ||
| 35 | str ends | ||
| 36 | |||
| 37 | dossetverify proc far | ||
| 38 | Enter dossetverify ; push registers | ||
| 39 | |||
| 40 | mov ax,[bp].verify ; check request | ||
| 41 | cmp al,1 ; for validity | ||
| 42 | jg error | ||
| 43 | |||
| 44 | mov ah,2eh ; setup new verify value | ||
| 45 | int 21h | ||
| 46 | |||
| 47 | sub ax,ax ; set good return code | ||
| 48 | jmp short exit ; return | ||
| 49 | |||
| 50 | error: mov ax,error_code ; set error return code | ||
| 51 | |||
| 52 | exit: Mexit ; pop registers | ||
| 53 | ret size str - 6 ; return | ||
| 54 | |||
| 55 | dossetverify endp | ||
| 56 | |||
| 57 | dosxxx ends | ||
| 58 | |||
| 59 | end | ||
diff --git a/v4.0/src/MAPPER/WCHSTRA.ASM b/v4.0/src/MAPPER/WCHSTRA.ASM new file mode 100644 index 0000000..2f42822 --- /dev/null +++ b/v4.0/src/MAPPER/WCHSTRA.ASM | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS VioWrtCharStrAtt mapper | ||
| 5 | ; | ||
| 6 | vioxxx segment byte public 'vio' | ||
| 7 | assume cs:vioxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: viowrtcharstratt Write character string with attribute | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: wchstra.asm | ||
| 14 | ; * | ||
| 15 | ; * CALLING SEQUENCE: | ||
| 16 | ; * | ||
| 17 | ; * push@ dword char_str | ||
| 18 | ; * push word length | ||
| 19 | ; * push word row | ||
| 20 | ; * push word column | ||
| 21 | ; * push@ dword attribute | ||
| 22 | ; * push word vio handle | ||
| 23 | ; * call viowrtcharstr | ||
| 24 | ; * | ||
| 25 | ; * | ||
| 26 | ; * MODULES CALLED: BIOS int 10h | ||
| 27 | ; * | ||
| 28 | ; ************************************************************************* | ||
| 29 | |||
| 30 | public viowrtcharstratt | ||
| 31 | .sall | ||
| 32 | .xlist | ||
| 33 | include macros.inc | ||
| 34 | .list | ||
| 35 | |||
| 36 | full_scr_err equ 0001h | ||
| 37 | error_bvs_parameter equ 0002h | ||
| 38 | |||
| 39 | str struc | ||
| 40 | old_bp dw ? | ||
| 41 | return dd ? | ||
| 42 | handle dw ? ; vio handle | ||
| 43 | attr dd ? ; attribute pointer | ||
| 44 | column dw ? ; column number | ||
| 45 | row dw ? ; starting position for output | ||
| 46 | lngth dw ? ; length of the string | ||
| 47 | addr dd ? ; string to be written (pointer) | ||
| 48 | str ends | ||
| 49 | |||
| 50 | viowrtcharstratt proc far | ||
| 51 | Enter viowrtcharstratt ; push registers | ||
| 52 | |||
| 53 | sub bh,bh | ||
| 54 | sub ax,ax ; Start with clean error condition | ||
| 55 | mov dx,[bp].column ; get column number | ||
| 56 | cmp dl,80 ; check for upper boundry | ||
| 57 | jg error ; branch if illegal number | ||
| 58 | |||
| 59 | mov ax,[bp].row ; get row number | ||
| 60 | cmp al,25 ; check for upper boundry | ||
| 61 | jg error ; branch if illegal number | ||
| 62 | mov dh,al | ||
| 63 | mov ah,02h | ||
| 64 | pushal ; Save registers in case int 10h | ||
| 65 | ; messes them up | ||
| 66 | int 10h ; Set start cursor position | ||
| 67 | |||
| 68 | popal | ||
| 69 | lds si,[bp].attr ; Set up attribute in BL | ||
| 70 | mov bl,byte ptr ds:[si] | ||
| 71 | lds si,[bp].addr ; DS:SI is pointer to string | ||
| 72 | mov di,[bp].lngth | ||
| 73 | ; **************************** | ||
| 74 | ; cmp bl,15 ; ** assume good attribute! ** | ||
| 75 | ; jg error ; **************************** | ||
| 76 | |||
| 77 | top: mov al,byte ptr [si] | ||
| 78 | mov ah,09h ; set write char/attrib function code | ||
| 79 | mov cx,1 ; write only one character | ||
| 80 | pushal ; Save registers in case int 10h | ||
| 81 | ; messes them up | ||
| 82 | int 10h ; Output one character | ||
| 83 | |||
| 84 | popal ; restore registers | ||
| 85 | inc si | ||
| 86 | dec di | ||
| 87 | inc dl | ||
| 88 | cmp dl,80 ; Handle end of line condition | ||
| 89 | jne around ; | | ||
| 90 | inc dh ; | | ||
| 91 | mov dl,00 ; V | ||
| 92 | cmp dh,25 ; Handle end of screen condition | ||
| 93 | jne around ; | | ||
| 94 | mov ax,full_scr_err ; Error in AX | ||
| 95 | jmp exit | ||
| 96 | |||
| 97 | around: mov ah,02h | ||
| 98 | pushal ; Save registers in case int 10h | ||
| 99 | ; messes them up | ||
| 100 | int 10h ; Increment cursor position | ||
| 101 | |||
| 102 | popal | ||
| 103 | cmp di,0 ; check if complete string is written | ||
| 104 | jne top ; else, go and write next character | ||
| 105 | |||
| 106 | sub ax,ax ; set no error code | ||
| 107 | |||
| 108 | error: mov ax,error_bvs_parameter | ||
| 109 | |||
| 110 | exit: Mexit ; return | ||
| 111 | ret size str - 6 | ||
| 112 | ; | ||
| 113 | viowrtcharstratt endp | ||
| 114 | vioxxx ends | ||
| 115 | end | ||
diff --git a/v4.0/src/MAPPER/WRITE.ASM b/v4.0/src/MAPPER/WRITE.ASM new file mode 100644 index 0000000..24ebcde --- /dev/null +++ b/v4.0/src/MAPPER/WRITE.ASM | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | page 80,132 | ||
| 2 | |||
| 3 | title CP/DOS DosWrite mapper | ||
| 4 | |||
| 5 | dosxxx segment byte public 'dos' | ||
| 6 | assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing | ||
| 7 | |||
| 8 | ;********************************************************************** | ||
| 9 | ;* | ||
| 10 | ;* MODULE: doswrite | ||
| 11 | ;* | ||
| 12 | ;* FUNCTION: Write a specified number of bytes to a file | ||
| 13 | ;* | ||
| 14 | ;* CALLING SEQUENCE: | ||
| 15 | ;* | ||
| 16 | ;* push word file handle | ||
| 17 | ;* push@ other buffer area | ||
| 18 | ;* push word buffer length | ||
| 19 | ;* push@ word bytes written | ||
| 20 | ;* call doswrite | ||
| 21 | ;* | ||
| 22 | ;* MODULES CALLED: PC-DOS Int 21h, ah=40h, write | ||
| 23 | ;* | ||
| 24 | ;********************************************************************* | ||
| 25 | |||
| 26 | public doswrite | ||
| 27 | .sall | ||
| 28 | .xlist | ||
| 29 | include macros.inc | ||
| 30 | .list | ||
| 31 | |||
| 32 | str struc | ||
| 33 | old_bp dw ? | ||
| 34 | return dd ? | ||
| 35 | Written dd ? ; number of bytes actually written | ||
| 36 | Bufflng dw ? ; number of bytes to be written | ||
| 37 | Buffer dd ? ; write buffer address | ||
| 38 | Handle dw ? ; file handle | ||
| 39 | str ends | ||
| 40 | |||
| 41 | doswrite proc far | ||
| 42 | |||
| 43 | Enter doswrite ; push registers | ||
| 44 | |||
| 45 | mov bx,[bp].handle ; get handle | ||
| 46 | lds dx,[bp].buffer ; set write buffer | ||
| 47 | mov cx,[bp].bufflng ; number of bytes to be written | ||
| 48 | |||
| 49 | mov ah,40h ; load opcode | ||
| 50 | int 21h ; write bytes to the file | ||
| 51 | jc exit ; jump if error | ||
| 52 | |||
| 53 | lds si,[bp].written ; pointer to return data | ||
| 54 | mov word ptr [si],ax ; save actual number of bytes written | ||
| 55 | sub ax,ax ; set good return code | ||
| 56 | |||
| 57 | exit: mexit ; pop registers | ||
| 58 | ret size str - 6 ; return | ||
| 59 | |||
| 60 | doswrite endp | ||
| 61 | |||
| 62 | dosxxx ends | ||
| 63 | |||
| 64 | end | ||