diff options
Diffstat (limited to 'v4.0/src/BIOS/MSAUX.ASM')
| -rw-r--r-- | v4.0/src/BIOS/MSAUX.ASM | 281 |
1 files changed, 281 insertions, 0 deletions
diff --git a/v4.0/src/BIOS/MSAUX.ASM b/v4.0/src/BIOS/MSAUX.ASM new file mode 100644 index 0000000..4d5a95e --- /dev/null +++ b/v4.0/src/BIOS/MSAUX.ASM | |||
| @@ -0,0 +1,281 @@ | |||
| 1 | TITLE MSAUX - DOS 3.3 | ||
| 2 | ;---------------------------------------------------------------- | ||
| 3 | ; : | ||
| 4 | ; A U X - AUXILARY DEVICE DRIVER : | ||
| 5 | ; : | ||
| 6 | ; : | ||
| 7 | ; This file contains the Auxilary Device Driver. The : | ||
| 8 | ; auxilary driver handles calls to and from the RS-232 port. : | ||
| 9 | ; Three devices uses this code: AUX, COM1, and COM2. AUX and : | ||
| 10 | ; COM1 talk to the zero RS-232 card and COM2 talks to the : | ||
| 11 | ; 'one' RS-232 card. The beginning of the interrupt entry : | ||
| 12 | ; point for these devices sets the variable AUXNUM in the : | ||
| 13 | ; msbio.asm module. If the value is 0 the routines in this : | ||
| 14 | ; file will talk to the the 'zero' card. If the value in : | ||
| 15 | ; AUXNUM is 1 the routines will talk to the 'one' card. : | ||
| 16 | ; The procedure GETDX is called to put the value 0 or 1 in : | ||
| 17 | ; the DX register depending on the value in AUXBUF. : | ||
| 18 | ; : | ||
| 19 | ; The routines in this files are: : | ||
| 20 | ; : | ||
| 21 | ; routine function : | ||
| 22 | ; ------- -------- : | ||
| 23 | ; AUX$READ Read characters from the : | ||
| 24 | ; specified device. : | ||
| 25 | ; AUX$RDND Non-desrucrtive read with : | ||
| 26 | ; no waiting. : | ||
| 27 | ; AUX$FLSH Flush specified device input : | ||
| 28 | ; buffer. : | ||
| 29 | ; AUX$WRIT Write characters to the : | ||
| 30 | ; specified device. : | ||
| 31 | ; AUX$WRST Get status of specified : | ||
| 32 | ; device : | ||
| 33 | ; : | ||
| 34 | ; These routines are not called directly. Call are made via : | ||
| 35 | ; the strategy and interrupt entry point (see Device Header). : | ||
| 36 | ; : | ||
| 37 | ; Data structure: : | ||
| 38 | ; The Aux Device has a two byte buffer called AUXBUF. The : | ||
| 39 | ; first byte is for the zero card, the second byte is for the : | ||
| 40 | ; one card. A zero value in the byte indicates the buffer is : | ||
| 41 | ; empty. The routines use GETBX to get the address of the : | ||
| 42 | ; buffer. : | ||
| 43 | ; : | ||
| 44 | ;---------------------------------------------------------------- | ||
| 45 | |||
| 46 | ;;Ver 3.30 modification --------------------------- | ||
| 47 | itest=0 | ||
| 48 | INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT | ||
| 49 | INCLUDE JUMPMAC.INC | ||
| 50 | INCLUDE MSMACRO.INC | ||
| 51 | |||
| 52 | EXTRN ERR$CNT:NEAR ;MSBIO1 | ||
| 53 | EXTRN GETDX:NEAR ;MSBIO1 | ||
| 54 | EXTRN RDEXIT:NEAR ;MSCON | ||
| 55 | EXTRN EXIT:NEAR ;MSBIO1 | ||
| 56 | EXTRN BUS$EXIT:NEAR ;MSBIO1 | ||
| 57 | ;DATA | ||
| 58 | EXTRN AUXBUF:BYTE ;MSDATA | ||
| 59 | |||
| 60 | ; VALUES IN AH, REQUESTING FUNCTION OF INT 14H IN ROM BIOS | ||
| 61 | AUXFUNC_SEND EQU 1 ;TRANSMIT | ||
| 62 | AUXFUNC_RECEIVE EQU 2 ;READ | ||
| 63 | AUXFUNC_STATUS EQU 3 ;REQUEST STATUS | ||
| 64 | |||
| 65 | ; ERROR FLAGS, REPORTED BY INT 14H | ||
| 66 | |||
| 67 | ; THESE FLAGS REPORTED IN AH: | ||
| 68 | FLAG_DATA_READY EQU 01H ;DATA READY | ||
| 69 | FLAG_OVERRUN EQU 02H ;OVERRUN ERROR | ||
| 70 | FLAG_PARITY EQU 04H ;PARITY ERROR | ||
| 71 | FLAG_FRAME EQU 08H ;FRAMING ERROR | ||
| 72 | FLAG_BREAK EQU 10H ;BREAK DETECT | ||
| 73 | FLAG_TRANHOL_EMP EQU 20H ;TRANSMIT HOLDING REGISTER EMPTY | ||
| 74 | FLAG_TRANSHF_EMP EQU 40H ;TRANSMIT SHIFT REGISTER EMPTY | ||
| 75 | FLAG_TIMEOUT EQU 80H ;TIMEOUT | ||
| 76 | |||
| 77 | ; THESE FLAGS REPORTED IN AL: | ||
| 78 | FLAG_DELTA_CTS EQU 01H ;DELTA CLEAR TO SEND | ||
| 79 | FLAG_DELTA_DSR EQU 02H ;DELTA DATA SET READY | ||
| 80 | FLAG_TRAIL_RING EQU 04H ;TRAILING EDGE RING INDICATOR | ||
| 81 | FLAG_DELTA_SIG EQU 08H ;DELTA RECEIVE LINE SIGNAL DETECT | ||
| 82 | FLAG_CTS EQU 10H ;CLEAR TO SEND | ||
| 83 | FLAG_DSR EQU 20H ;DATA SET READY | ||
| 84 | FLAG_RING EQU 40H ;RING INDICATOR | ||
| 85 | FLAG_REC_SIG EQU 80H ;RECEIVE LINE SIGNAL DETECT | ||
| 86 | ;;End of modification ------------------ | ||
| 87 | |||
| 88 | |||
| 89 | ;---------------------------------------------------------------- | ||
| 90 | ; : | ||
| 91 | ; Read zero or more characters from Auxilary Device : | ||
| 92 | ; : | ||
| 93 | ; input:es:[di] points to area to receive aux data : | ||
| 94 | ; cx has number of bytes to be read : | ||
| 95 | ; "auxnum" first byte has number of aux device (rel 0): | ||
| 96 | ; : | ||
| 97 | ;---------------------------------------------------------------- | ||
| 98 | PUBLIC AUX$READ | ||
| 99 | AUX$READ PROC NEAR | ||
| 100 | ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE | ||
| 101 | jcxz EXVEC2 ; if no characters, get out | ||
| 102 | call GETBX ; put address of AUXBUF in BX | ||
| 103 | xor AX,AX ; clear AX register | ||
| 104 | xchg AL,[BX] ; Get character , if any, from | ||
| 105 | ; buffer and clear buffer | ||
| 106 | or AL,AL ; if AL is nonzero there was a | ||
| 107 | ; character in the buffer | ||
| 108 | jnz AUX2 ; if so skip AUXIN call | ||
| 109 | AUX1: ; | ||
| 110 | call AUXIN ; get character from port | ||
| 111 | AUX2: ; | ||
| 112 | stosb ; store character | ||
| 113 | loop AUX1 ; if more character, go around again | ||
| 114 | EXVEC2: ; | ||
| 115 | Jump EXIT ; all done, successful exit | ||
| 116 | AUX$READ ENDP | ||
| 117 | |||
| 118 | ; | ||
| 119 | ; AUXIN: make a call on ROM BIOS to read character from | ||
| 120 | ; the auxilary device, then do some error checking. | ||
| 121 | ; If an error occurs then AUXIN jumps to ERR$CNT and | ||
| 122 | ; does NOT return to where it was called from. | ||
| 123 | ; | ||
| 124 | |||
| 125 | AUXIN PROC NEAR | ||
| 126 | |||
| 127 | mov ah,AUXFUNC_RECEIVE | ||
| 128 | call AUXOP | ||
| 129 | ;check for Frame, Parity, or Overrun errors | ||
| 130 | ;WARNING: these error bits are unpredictable | ||
| 131 | ; if timeout (bit 7) is set | ||
| 132 | test ah,FLAG_FRAME or FLAG_PARITY or FLAG_OVERRUN | ||
| 133 | jz AROK ;No error if all bits are clear | ||
| 134 | |||
| 135 | ;Error getting character | ||
| 136 | add sp,+2 ;Remove rtn address (near call) | ||
| 137 | xor al,al | ||
| 138 | or al,FLAG_REC_SIG or FLAG_DSR or FLAG_CTS | ||
| 139 | |||
| 140 | JUMP ERR$CNT | ||
| 141 | AROK: | ||
| 142 | RET ;CHAR JUST READ IS IN AL, STATUS IS IN AH | ||
| 143 | AUXIN ENDP | ||
| 144 | |||
| 145 | ;---------------------------------------------------------------- | ||
| 146 | ; : | ||
| 147 | ; Aux non-destructive read with no waiting : | ||
| 148 | ; : | ||
| 149 | ; input: es:[di] points to area to receive aux data : | ||
| 150 | ; : | ||
| 151 | ;---------------------------------------------------------------- | ||
| 152 | ; | ||
| 153 | PUBLIC AUX$RDND | ||
| 154 | AUX$RDND PROC NEAR | ||
| 155 | ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE | ||
| 156 | call GETBX ; have BX point to AUXBUF | ||
| 157 | mov AL,[BX] ; copy contents of buffer to AL | ||
| 158 | or AL,AL ; if AL is non-zero (char in buffer) | ||
| 159 | jnz AUXRDX ; then return character | ||
| 160 | call AUXSTAT ; if not, get status of AUX device | ||
| 161 | TEST AH,FLAG_DATA_READY ;TEST DATA READY | ||
| 162 | jz AUXBUS ; then device is busy (not ready) | ||
| 163 | |||
| 164 | TEST AL,FLAG_DSR ;TEST DATA SET READY | ||
| 165 | jz AUXBUS ; then device is busy (not ready) | ||
| 166 | call AUXIN ; else aux is ready, get character | ||
| 167 | call GETBX ; have bx point to AUXBUF | ||
| 168 | mov [BX],AL ; save character in buffer | ||
| 169 | AUXRDX: ; | ||
| 170 | Jump RDEXIT ; return character | ||
| 171 | |||
| 172 | AUXBUS: ; | ||
| 173 | Jump BUS$EXIT ; jump to device busy exit | ||
| 174 | AUX$RDND ENDP | ||
| 175 | |||
| 176 | ;---------------------------------------------------------------- | ||
| 177 | ; : | ||
| 178 | ; Aux Output Status : | ||
| 179 | ; : | ||
| 180 | ;---------------------------------------------------------------- | ||
| 181 | PUBLIC AUX$WRST | ||
| 182 | AUX$WRST PROC NEAR | ||
| 183 | ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE | ||
| 184 | call AUXSTAT ; get status of AUX in AX | ||
| 185 | ; now test to see if device is busy | ||
| 186 | ; if this bit is not set, | ||
| 187 | ;;Ver 3.30 modification ----------------------- | ||
| 188 | TEST AL,FLAG_DSR ;TEST DATA SET READY | ||
| 189 | jz AUXBUS ; then device is busy (not ready) | ||
| 190 | TEST AH,FLAG_TRANHOL_EMP ;TEST TRANSMIT HOLD REG EMPTY | ||
| 191 | ;;End of modification ------------------------- | ||
| 192 | jz AUXBUS ; then device is busy (not ready) | ||
| 193 | Jump Exit | ||
| 194 | |||
| 195 | AUX$WRST ENDP | ||
| 196 | |||
| 197 | ; | ||
| 198 | ; AUXSTAT makes a call on the ROM-BIOS to determine the status | ||
| 199 | ; of the auxilary device | ||
| 200 | ; Outputs: | ||
| 201 | ; AX is filled with status of port. | ||
| 202 | ; DX is changes to specify which card - either 0, 1 (, 2, 3) ;ba | ||
| 203 | ; NO other registers are modified | ||
| 204 | ; | ||
| 205 | |||
| 206 | AUXSTAT proc near | ||
| 207 | mov ah,AUXFUNC_STATUS | ||
| 208 | call AUXOP | ||
| 209 | ret | ||
| 210 | AUXSTAT endp | ||
| 211 | |||
| 212 | AUXOP PROC NEAR | ||
| 213 | ;AH=FUNCTION CODE | ||
| 214 | ;0=INIT, 1=SEND, 2=RECEIVE, 3=STATUS | ||
| 215 | call GETDX ; have DX point to proper card | ||
| 216 | int 14h ; call rom-bios for status | ||
| 217 | ret | ||
| 218 | AUXOP ENDP | ||
| 219 | |||
| 220 | ;---------------------------------------------------------------- | ||
| 221 | ; : | ||
| 222 | ; Flush AUX Input buffer - set contents of AUXBUF to zero : | ||
| 223 | ; : | ||
| 224 | ;---------------------------------------------------------------- | ||
| 225 | PUBLIC AUX$FLSH | ||
| 226 | AUX$FLSH PROC NEAR | ||
| 227 | ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE | ||
| 228 | call GETBX ; get BX to point to AUXBUF | ||
| 229 | mov BYTE PTR [BX],0 ; zero out buffer | ||
| 230 | Jump Exit ; all done, successful return | ||
| 231 | AUX$FLSH ENDP | ||
| 232 | |||
| 233 | |||
| 234 | |||
| 235 | ;---------------------------------------------------------------- | ||
| 236 | ; : | ||
| 237 | ; Write to Auxilary Device : | ||
| 238 | ; : | ||
| 239 | ;---------------------------------------------------------------- | ||
| 240 | PUBLIC AUX$WRIT | ||
| 241 | AUX$WRIT PROC NEAR | ||
| 242 | ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE | ||
| 243 | jcxz EXVEC2 ; if CX is zero, no characters | ||
| 244 | ; to be written, jump to exit | ||
| 245 | AUX$LOOP: | ||
| 246 | mov AL,ES:[DI] ; get character to be written | ||
| 247 | inc DI ; move DI pointer to next character | ||
| 248 | ;;Ver 3.30 modification --------------------------- | ||
| 249 | MOV AH,AUXFUNC_SEND ;VALUE=1, INDICATES A WRITE | ||
| 250 | CALL AUXOP ;SEND CHARACTER OVER AUX PORT | ||
| 251 | |||
| 252 | TEST AH,FLAG_TIMEOUT ;CHECK FOR ERROR | ||
| 253 | ;;End of modification --------------------------- | ||
| 254 | jz AWOK ; then no error | ||
| 255 | mov AL,10 ; else indicate write fault | ||
| 256 | Jump ERR$CNT ; call error routines | ||
| 257 | |||
| 258 | ; if CX is non-zero, still more | ||
| 259 | AWOK: | ||
| 260 | loop AUX$LOOP ; more characrter to print | ||
| 261 | Jump Exit ; all done, successful return | ||
| 262 | AUX$WRIT ENDP | ||
| 263 | |||
| 264 | |||
| 265 | ; | ||
| 266 | ; GETBX puts the address of AUXBUF (the Auxilary Device buffer) | ||
| 267 | ; in BX. After calling GETBX, a routine can get to AUXBUF | ||
| 268 | ; with [BX]. | ||
| 269 | ; | ||
| 270 | ; NOTE: The getdx routine is in msbio1 and looks like: | ||
| 271 | ; mov dx,word ptr cs:[auxnum] | ||
| 272 | ; | ||
| 273 | GETBX PROC NEAR | ||
| 274 | call GETDX | ||
| 275 | mov BX,DX | ||
| 276 | add BX,OFFSET AUXBUF | ||
| 277 | ret | ||
| 278 | GETBX ENDP | ||
| 279 | |||
| 280 | CODE ENDS | ||
| 281 | END | ||