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/BIOS/MSCON.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/BIOS/MSCON.ASM')
| -rw-r--r-- | v4.0/src/BIOS/MSCON.ASM | 328 |
1 files changed, 328 insertions, 0 deletions
diff --git a/v4.0/src/BIOS/MSCON.ASM b/v4.0/src/BIOS/MSCON.ASM new file mode 100644 index 0000000..68fcfff --- /dev/null +++ b/v4.0/src/BIOS/MSCON.ASM | |||
| @@ -0,0 +1,328 @@ | |||
| 1 | PAGE ,132 ; | ||
| 2 | TITLE MSCON - BIOS | ||
| 3 | %OUT ...MSCON.ASM | ||
| 4 | ;============================================================================== | ||
| 5 | ;REVISION HISTORY: | ||
| 6 | ;AN000 - New for DOS Version 4.00 - J.K. | ||
| 7 | ;AC000 - Changed for DOS Version 4.00 - J.K. | ||
| 8 | ;AN00x - PTM number for DOS Version 4.00 - J.K. | ||
| 9 | ;============================================================================== | ||
| 10 | |||
| 11 | itest=0 | ||
| 12 | INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT | ||
| 13 | INCLUDE JUMPMAC.INC | ||
| 14 | INCLUDE MSEQU.INC | ||
| 15 | INCLUDE MSMACRO.INC | ||
| 16 | |||
| 17 | ;*** DOS 3.3 will not support more than 25 rows | ||
| 18 | ; INCLUDE DEVSYM.INC ;J.K. 4/29/86 for CON$GENIOCTL support | ||
| 19 | ; INCLUDE IOCTL.INC ;J.K. 4/29/86 for CON$GENIOCTL support | ||
| 20 | |||
| 21 | EXTRN EXIT:NEAR ;MSBIO1 | ||
| 22 | EXTRN BUS$EXIT:NEAR ;MSBIO1 | ||
| 23 | |||
| 24 | ; EXTRN CMDERR:NEAR ;MSBIO1 J.K. 4/29/86 | ||
| 25 | |||
| 26 | ;DATA | ||
| 27 | EXTRN PTRSAV:DWORD ;MSBIO1 | ||
| 28 | EXTRN FHAVEK09:BYTE ;MSDISK | ||
| 29 | EXTRN ALTAH:BYTE ;MSBDATA | ||
| 30 | EXTRN KEYRD_Func:Byte ;MSBDATA | ||
| 31 | EXTRN KEYSTS_Func:Byte ;MSBDATA | ||
| 32 | |||
| 33 | ; EXTRN SAV_SC_INFO:BYTE ;MSBDATA J.K. 4/29/86 | ||
| 34 | ; EXTRN SAV_SC_MODE:BYTE ;MSBDATA J.K. 4/29/86 | ||
| 35 | ;------------------------------------------------------ | ||
| 36 | ; | ||
| 37 | ; CONSOLE READ ROUTINE | ||
| 38 | ; | ||
| 39 | ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT | ||
| 40 | PUBLIC CON$READ | ||
| 41 | CON$READ PROC NEAR | ||
| 42 | JCXZ CON$EXIT | ||
| 43 | CON$LOOP: | ||
| 44 | CALL CHRIN ;GET CHAR IN AL | ||
| 45 | STOSB ;STORE CHAR AT ES:DI | ||
| 46 | LOOP CON$LOOP | ||
| 47 | CON$EXIT: | ||
| 48 | JUMP EXIT | ||
| 49 | CON$READ ENDP | ||
| 50 | ;--------------------------------------------------------- | ||
| 51 | ; | ||
| 52 | ; INPUT SINGLE CHAR INTO AL | ||
| 53 | ; | ||
| 54 | ;J.K.5/12/87 We are going to issue extended keyboard function, if supported. | ||
| 55 | ;The returning value of the extended key stroke of the extended key board | ||
| 56 | ;function uses 0E0h in AL instead of 00 as in the conventional key board | ||
| 57 | ;function. This creates a conflict when the user entered real Greek Alpha | ||
| 58 | ;charater (= 0E0h) to distinguish the extended key stroke and the Greek Alpha. | ||
| 59 | ;This case will be handled in the following manner; | ||
| 60 | ; AH = 16h | ||
| 61 | ; INT 16h | ||
| 62 | ; If AL == 0, then extended code (in AH) | ||
| 63 | ; else If AL == 0E0h, then | ||
| 64 | ; IF AH <> 0, then extended code (in AH) | ||
| 65 | ; else Greek_Alpha character. | ||
| 66 | ;Also, for compatibility reason, if an extended code is detected, then we | ||
| 67 | ;are going to change the value in AL from 0E0h to 00h. | ||
| 68 | |||
| 69 | |||
| 70 | CHRIN PROC NEAR | ||
| 71 | ;AN000; | ||
| 72 | ; XOR AX,AX | ||
| 73 | mov ah,KEYRD_Func ;AN000; Set by MSINIT. 0 or 10h | ||
| 74 | xor al,al ;AN000; | ||
| 75 | XCHG AL,ALTAH ;GET CHARACTER & ZERO ALTAH | ||
| 76 | |||
| 77 | OR AL,AL | ||
| 78 | JNZ KEYRET | ||
| 79 | ;SB34CON000************************************************************** | ||
| 80 | ;SB Keyboard I/O interrupt | ||
| 81 | ;SB AH already contains the keyboard read function number | ||
| 82 | ;SB 1 LOC | ||
| 83 | |||
| 84 | int 16h | ||
| 85 | ;SB34CON000************************************************************** | ||
| 86 | ALT10: | ||
| 87 | OR AX,AX ;CHECK FOR NON-KEY AFTER BREAK | ||
| 88 | JZ CHRIN | ||
| 89 | CMP AX,7200H ;CHECK FOR CTRL-PRTSC | ||
| 90 | JNZ ALT_Ext_Chk ;AN000; | ||
| 91 | MOV AL,16 | ||
| 92 | jmp KeyRet ;AN000; | ||
| 93 | ALT_Ext_Chk: | ||
| 94 | ;SB34CON001************************************************************** | ||
| 95 | ;SB IF operation was extended function (i.e. KEYRD_Func != 0) THEN | ||
| 96 | ;SB IF character read was 0E0h THEN | ||
| 97 | ;SB IF extended byte was zero (i.e. AH == 0) THEN | ||
| 98 | ;SB goto keyret | ||
| 99 | ;SB ELSE | ||
| 100 | ;SB set AL to zero | ||
| 101 | ;SB goto ALT_SAVE | ||
| 102 | ;SB ENDIF | ||
| 103 | ;SB ENDIF | ||
| 104 | ;SB ENDIF | ||
| 105 | ;SB 9 LOCS | ||
| 106 | |||
| 107 | cmp BYTE PTR KEYRD_Func,0 | ||
| 108 | jz NOT_EXT | ||
| 109 | cmp al,0E0h | ||
| 110 | jnz NOT_EXT | ||
| 111 | or ah,ah | ||
| 112 | jz KEYRET | ||
| 113 | xor al,al | ||
| 114 | jmp short ALT_SAVE | ||
| 115 | NOT_EXT: | ||
| 116 | |||
| 117 | ;SB34CON001************************************************************** | ||
| 118 | OR AL,AL ;SPECIAL CASE? | ||
| 119 | JNZ KEYRET | ||
| 120 | ALT_SAVE: | ||
| 121 | MOV ALTAH,AH ;STORE SPECIAL KEY | ||
| 122 | KEYRET: | ||
| 123 | RET | ||
| 124 | CHRIN ENDP | ||
| 125 | |||
| 126 | ;-------------------------------------------------------------- | ||
| 127 | ; | ||
| 128 | ; KEYBOARD NON DESTRUCTIVE READ, NO WAIT | ||
| 129 | ; | ||
| 130 | ; PC-CONVERTIBLE-TYPE MACHINE: IF BIT 10 IS SET BY THE DOS IN THE STATUS WORD | ||
| 131 | ; OF THE REQUEST PACKET, AND THERE IS NO CHARACTER IN THE INPUT BUFFER, THE | ||
| 132 | ; DRIVER ISSUES A SYSTEM WAIT REQUEST TO THE ROM. ON RETURN FROM THE ROM, IT | ||
| 133 | ; RETURNS A 'CHAR-NOT-FOUND' TO THE DOS. | ||
| 134 | ; | ||
| 135 | CONBUSJ: | ||
| 136 | ASSUME DS:NOTHING | ||
| 137 | JMP CONBUS | ||
| 138 | |||
| 139 | ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT | ||
| 140 | PUBLIC CON$RDND | ||
| 141 | CON$RDND: | ||
| 142 | MOV AL,[ALTAH] | ||
| 143 | OR AL,AL | ||
| 144 | JZ RD1 | ||
| 145 | JMP RDEXIT | ||
| 146 | |||
| 147 | RD1: | ||
| 148 | ;SB34CON002************************************************************** | ||
| 149 | ;SB Keyboard I/O interrupt | ||
| 150 | ;SB Get keystroke status (KEYSTS_Func) | ||
| 151 | ;SB 2 LOCS | ||
| 152 | |||
| 153 | mov ah,KEYSTS_Func | ||
| 154 | int 16h | ||
| 155 | ;SB34CON002************************************************************** | ||
| 156 | JZ NOCHR | ||
| 157 | JMP GOTCHR | ||
| 158 | NOCHR: | ||
| 159 | CMP FHAVEK09,0 | ||
| 160 | JZ CONBUSJ | ||
| 161 | LDS BX,[PTRSAV] | ||
| 162 | ASSUME DS:NOTHING | ||
| 163 | TEST [BX].STATUS,0400H ; SYSTEM WAIT ENABLED? | ||
| 164 | JZ CONBUSJ | ||
| 165 | |||
| 166 | ;******************************** | ||
| 167 | ; NEED TO WAIT FOR IBM RESPONSE TO REQUEST FOR CODE ON HOW TO USE THE SYSTEM | ||
| 168 | ; WAIT CALL. | ||
| 169 | ;******************************** | ||
| 170 | MESSAGE FTESTCON,<"SYSTEM WAIT STAGE",CR,LF> | ||
| 171 | MOV AX,4100H ; WAIT ON AN EXTERNAL EVENT | ||
| 172 | ; MOV BX,0300H ; NO TIMEOUT | ||
| 173 | ; MOV DX,60H ; LOOK AT I/O PORT 60H | ||
| 174 | INT 15H ; CALL ROM FOR SYSTEM WAIT | ||
| 175 | MESSAGE FTESTCON,<"OUT OF WAIT. AX IS "> | ||
| 176 | MNUM FTESTCON,AX | ||
| 177 | MESSAGE FTESTCON,<CR,LF> | ||
| 178 | JMP CONBUS | ||
| 179 | |||
| 180 | ASSUME DS:CODE | ||
| 181 | GOTCHR: | ||
| 182 | OR AX,AX | ||
| 183 | JNZ NOTBRK ;CHECK FOR NULL AFTER BREAK | ||
| 184 | ;SB34CON004************************************************************** | ||
| 185 | ;SB Keyboard I/O interrupt | ||
| 186 | ;SB Keyboard read function (KEYRD_Func) | ||
| 187 | ;SB 2 LOCS | ||
| 188 | |||
| 189 | mov ah,KEYRD_Func | ||
| 190 | int 16h | ||
| 191 | ;SB34CON004************************************************************** | ||
| 192 | JUMP CON$RDND ;AND GET A REAL STATUS | ||
| 193 | NOTBRK: | ||
| 194 | CMP AX,7200H ;CHECK FOR CTRL-PRTSC | ||
| 195 | JNZ RD_Ext_Chk ;AN000; | ||
| 196 | MOV AL,16 | ||
| 197 | jmp RDEXIT ;AN000; | ||
| 198 | RD_Ext_Chk: ;AN000; | ||
| 199 | cmp KEYRD_Func, 0 ;AN000; Extended Keyboard function? | ||
| 200 | jz RDEXIT ;AN000; No. Normal exit. | ||
| 201 | cmp al,0E0h ;AN000; Extended key value or Greek Alpha? | ||
| 202 | jne RDEXIT ;AN000; | ||
| 203 | cmp ah, 0 ;AN000; Scan code exist? | ||
| 204 | jz RDEXIT ;AN000; Yes. Greek Alpha char. | ||
| 205 | mov al, 0 ;AN000; No. Extended key stroke. Change it for compatibility | ||
| 206 | PUBLIC RDEXIT | ||
| 207 | RDEXIT: | ||
| 208 | LDS BX,[PTRSAV] | ||
| 209 | ASSUME DS:NOTHING | ||
| 210 | MOV [BX].MEDIA,AL | ||
| 211 | EXVEC: | ||
| 212 | JUMP EXIT | ||
| 213 | |||
| 214 | CONBUS: | ||
| 215 | ASSUME DS:NOTHING | ||
| 216 | JUMP BUS$EXIT | ||
| 217 | ;-------------------------------------------------------------- | ||
| 218 | ; | ||
| 219 | ; KEYBOARD FLUSH ROUTINE | ||
| 220 | ; | ||
| 221 | ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT | ||
| 222 | PUBLIC CON$FLSH | ||
| 223 | CON$FLSH: | ||
| 224 | CALL FLUSH | ||
| 225 | JUMP EXIT | ||
| 226 | |||
| 227 | PUBLIC FLUSH | ||
| 228 | FLUSH: | ||
| 229 | MOV [ALTAH],0 ;CLEAR OUT HOLDING BUFFER | ||
| 230 | |||
| 231 | FLLOOP: | ||
| 232 | ;SB33012**************************************************************** | ||
| 233 | ;SB ; Is there a char there? | ||
| 234 | mov AH, 1 ;SB ; command code for check status | ||
| 235 | int 16h ;SB ; call rom-bios keyboard routine | ||
| 236 | ;SB33012**************************************************************** | ||
| 237 | JZ FLDONE | ||
| 238 | ;SB33013**************************************************************** | ||
| 239 | xor AH, AH ;SB ; if zf is nof set, get character | ||
| 240 | int 16h ;SB ; call rom-bios to get character | ||
| 241 | ;SB33013**************************************************************** | ||
| 242 | JMP FLLOOP | ||
| 243 | FLDONE: | ||
| 244 | |||
| 245 | RET | ||
| 246 | ;---------------------------------------------------------- | ||
| 247 | ; | ||
| 248 | ; CONSOLE WRITE ROUTINE | ||
| 249 | ; | ||
| 250 | ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT | ||
| 251 | PUBLIC CON$WRIT | ||
| 252 | CON$WRIT: | ||
| 253 | JCXZ EXVEC | ||
| 254 | CON$LP: | ||
| 255 | MOV AL,ES:[DI] ;GET CHAR | ||
| 256 | INC DI | ||
| 257 | INT CHROUT ;OUTPUT CHAR | ||
| 258 | LOOP CON$LP ;REPEAT UNTIL ALL THROUGH | ||
| 259 | JUMP EXIT | ||
| 260 | ;----------------------------------------------- | ||
| 261 | ; | ||
| 262 | ; BREAK KEY HANDLING | ||
| 263 | ; | ||
| 264 | PUBLIC CBREAK | ||
| 265 | CBREAK: | ||
| 266 | MOV CS:ALTAH,3 ;INDICATE BREAK KEY SET | ||
| 267 | |||
| 268 | PUBLIC INTRET | ||
| 269 | INTRET: | ||
| 270 | IRET | ||
| 271 | |||
| 272 | ;------------------------------------------------------------------------------ | ||
| 273 | ;J.K. 4/29/86 - CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3. | ||
| 274 | ;CON$GENIOCTL supports Get mode information, Set mode information functions. | ||
| 275 | ;It will only save the value from "Set mode information" and will return | ||
| 276 | ;the value through "Get mode information". It is supposed to be set by | ||
| 277 | ;the MODE.COM and other application program can retrieve information | ||
| 278 | ;through "Get mode information" call. | ||
| 279 | ;Initially, there is no valuable informaton until set by MODE command, so | ||
| 280 | ;any attemp to "Get mode information" at that points will fail. (unknown | ||
| 281 | ;command with carry set.) | ||
| 282 | ;At entry: CS = DS = code | ||
| 283 | ; CS:[PTRSAV] has seg, address of the Request Header saved in | ||
| 284 | ; in Strategy routine. | ||
| 285 | ; | ||
| 286 | ; PUBLIC CON$GENIOCTL | ||
| 287 | ; ASSUME DS:CODE | ||
| 288 | ;CON$GENIOCTL: | ||
| 289 | ; les di, CS:[PTRSAV] ;get the request header | ||
| 290 | ; cmp es:[di].MajorFunction, IOC_SC | ||
| 291 | ; je Major_SC_OK | ||
| 292 | ;SC_CMDERR: | ||
| 293 | ; stc | ||
| 294 | ; jmp cmderr ;carry is set, exit to cmderr | ||
| 295 | ;Major_SC_OK: | ||
| 296 | ; mov al, es:[di].MinorFunction ;save minor function | ||
| 297 | ; les di, es:[di].GenericIOCTL_Packet ;pointer of SC_MODE_INFO structure | ||
| 298 | ; mov cx, es:[di].SC_INFO_LENGTH ;save length | ||
| 299 | ; inc di | ||
| 300 | ; inc di ;ES:DI -> SC_MODE in Info. Packet | ||
| 301 | ; cmp cx, SC_INFO_PACKET_LENGTH ;currently 9. | ||
| 302 | ; jne SC_CMDERR ;cannot accept the different packet | ||
| 303 | ; cmp al, GET_SC_MODE ;minor function = 60h ? | ||
| 304 | ; jne SC_SET_MODE_FUNC ;no, check if it is "Set mode function" | ||
| 305 | ; cmp SAV_SC_MODE, 0 ;information set before? | ||
| 306 | ; je SC_CMDERR ;no, cannot get the info. | ||
| 307 | ;;SC_GET_MODE_FUNC: ;es:di -> SC_MODE in info. packet | ||
| 308 | ; ;cx - length | ||
| 309 | ; mov si, offset SAV_SC_INFO | ||
| 310 | ; rep movsb ;ds:si -> sav_sc_info, es:di -> sc_mode | ||
| 311 | ; jmp exit | ||
| 312 | ; | ||
| 313 | ;SC_SET_MODE_FUNC: ;es:di -> SC_MODE | ||
| 314 | ; cmp al, SET_SC_MODE ;minor function = 40h ? | ||
| 315 | ; jne SC_CMDERR | ||
| 316 | ; mov si, offset SAV_SC_INFO | ||
| 317 | ; xchg di, si | ||
| 318 | ; push es | ||
| 319 | ; push ds | ||
| 320 | ; pop es | ||
| 321 | ; pop ds | ||
| 322 | ; rep movsb ;ds:si -> sc_mode, es:di -> sav_sc_info | ||
| 323 | ; jmp exit | ||
| 324 | ; | ||
| 325 | ;J.K. 4/29/86 - End of CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3. | ||
| 326 | |||
| 327 | CODE ENDS | ||
| 328 | END | ||