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