diff options
| author | 2024-04-25 21:24:10 +0100 | |
|---|---|---|
| committer | 2024-04-25 22:32:27 +0000 | |
| commit | 2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch) | |
| tree | 80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DEV/SMARTDRV/FL13.ASM | |
| parent | Merge pull request #430 from jpbaltazar/typoptbr (diff) | |
| download | ms-dos-main.tar.gz ms-dos-main.tar.xz ms-dos-main.zip | |
Diffstat (limited to 'v4.0/src/DEV/SMARTDRV/FL13.ASM')
| -rw-r--r-- | v4.0/src/DEV/SMARTDRV/FL13.ASM | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/v4.0/src/DEV/SMARTDRV/FL13.ASM b/v4.0/src/DEV/SMARTDRV/FL13.ASM new file mode 100644 index 0000000..6ae1e44 --- /dev/null +++ b/v4.0/src/DEV/SMARTDRV/FL13.ASM | |||
| @@ -0,0 +1,148 @@ | |||
| 1 | TITLE Assembler helper routines for FLUSH13 | ||
| 2 | |||
| 3 | PAGE 58,132 | ||
| 4 | |||
| 5 | |||
| 6 | memS EQU 1 ; Small model | ||
| 7 | ?PLM = 0 ; Standard 'C' | ||
| 8 | ?WIN = 0 ; Not windows | ||
| 9 | |||
| 10 | include cmacros.inc | ||
| 11 | |||
| 12 | ;extern int IOCTLOpen(char *); | ||
| 13 | ;extern int IOCTLWrite(int,char *,int); | ||
| 14 | ;extern int IOCTLRead(int,status *,int); | ||
| 15 | ;extern int IOCTLClose(int); | ||
| 16 | |||
| 17 | sBegin CODE | ||
| 18 | |||
| 19 | assumes CS, CODE | ||
| 20 | assumes DS, DATA | ||
| 21 | |||
| 22 | ;** IOCTLOpen - Open the indicated device and make sure it's a device | ||
| 23 | ; | ||
| 24 | ; ENTRY: | ||
| 25 | ; Pointer to name of device | ||
| 26 | ; EXIT: | ||
| 27 | ; AX = -1 if error, device not opened | ||
| 28 | ; else AX = handle of open device | ||
| 29 | ; USES: | ||
| 30 | ; Standard 'C' | ||
| 31 | ; | ||
| 32 | cProc IOCTLOpen, <PUBLIC>, <si,di,es> | ||
| 33 | |||
| 34 | ParmW Nameptr | ||
| 35 | |||
| 36 | cBegin | ||
| 37 | mov dx,Nameptr | ||
| 38 | MOV AX,3D02H | ||
| 39 | INT 21H ; Open the device | ||
| 40 | JC NO_DEV_ERR ; No device | ||
| 41 | MOV BX,AX | ||
| 42 | MOV AX,4400H | ||
| 43 | INT 21H ; Make sure it IS a device | ||
| 44 | JC CLOSE_NO_DEV | ||
| 45 | TEST DX,4080H | ||
| 46 | JZ CLOSE_NO_DEV | ||
| 47 | mov ax,bx ; Return the handle | ||
| 48 | jmp short PXDONE | ||
| 49 | |||
| 50 | CLOSE_NO_DEV: | ||
| 51 | mov ax,3e00H ; Close | ||
| 52 | int 21H | ||
| 53 | NO_DEV_ERR: | ||
| 54 | mov ax,-1 | ||
| 55 | PXDONE: | ||
| 56 | cEnd | ||
| 57 | |||
| 58 | ;** IOCTLClose - Close the indicated handle | ||
| 59 | ; | ||
| 60 | ; ENTRY: | ||
| 61 | ; Handle | ||
| 62 | ; EXIT: | ||
| 63 | ; None | ||
| 64 | ; USES: | ||
| 65 | ; Standard 'C' | ||
| 66 | ; | ||
| 67 | cProc IOCTLClose, <PUBLIC>, <si,di,es> | ||
| 68 | |||
| 69 | ParmW Handle | ||
| 70 | |||
| 71 | cBegin | ||
| 72 | mov bx,Handle | ||
| 73 | MOV AX,3E00H | ||
| 74 | INT 21H ; close the device | ||
| 75 | cEnd | ||
| 76 | |||
| 77 | ;** IOCTLWrite - Perform IOCTLWrite to device handle | ||
| 78 | ; | ||
| 79 | ; ENTRY: | ||
| 80 | ; Handle to open device | ||
| 81 | ; Pointer to data to write | ||
| 82 | ; Count in bytes of data to write | ||
| 83 | ; EXIT: | ||
| 84 | ; AX = -1 error | ||
| 85 | ; else AX = input count | ||
| 86 | ; USES: | ||
| 87 | ; Standard 'C' | ||
| 88 | ; | ||
| 89 | cProc IOCTLWrite, <PUBLIC>, <si,di,es> | ||
| 90 | |||
| 91 | ParmW WHandle | ||
| 92 | ParmW WDataPtr | ||
| 93 | ParmW WCount | ||
| 94 | |||
| 95 | cBegin | ||
| 96 | mov bx,WHandle | ||
| 97 | mov cx,WCount | ||
| 98 | mov dx,WDataPtr | ||
| 99 | MOV AX,4403H ; IOCTL Write | ||
| 100 | INT 21H | ||
| 101 | JC Werr | ||
| 102 | CMP AX,CX | ||
| 103 | JNZ Werr | ||
| 104 | jmp short WDONE | ||
| 105 | |||
| 106 | WERR: | ||
| 107 | mov ax,-1 | ||
| 108 | WDONE: | ||
| 109 | cEnd | ||
| 110 | |||
| 111 | ;** IOCTLRead - Perform IOCTLRead to device handle | ||
| 112 | ; | ||
| 113 | ; ENTRY: | ||
| 114 | ; Handle to open device | ||
| 115 | ; Pointer to data area to read into | ||
| 116 | ; Count in bytes of size of data area | ||
| 117 | ; EXIT: | ||
| 118 | ; AX = -1 error | ||
| 119 | ; else AX = input count | ||
| 120 | ; USES: | ||
| 121 | ; Standard 'C' | ||
| 122 | ; | ||
| 123 | cProc IOCTLRead, <PUBLIC>, <si,di,es> | ||
| 124 | |||
| 125 | ParmW RHandle | ||
| 126 | ParmW RDataPtr | ||
| 127 | ParmW RCount | ||
| 128 | |||
| 129 | cBegin | ||
| 130 | mov bx,RHandle | ||
| 131 | mov cx,RCount | ||
| 132 | mov dx,RDataPtr | ||
| 133 | MOV AX,4402H ; IOCTL Read | ||
| 134 | INT 21H | ||
| 135 | JC Rerr | ||
| 136 | CMP AX,CX | ||
| 137 | JNZ Rerr | ||
| 138 | jmp short RDONE | ||
| 139 | |||
| 140 | RERR: | ||
| 141 | mov ax,-1 | ||
| 142 | RDONE: | ||
| 143 | cEnd | ||
| 144 | |||
| 145 | |||
| 146 | sEnd CODE | ||
| 147 | |||
| 148 | end | ||