summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/KEYB/KEYBI48.ASM
blob: 05ed786869262a235aebaa57725bd70cd84512a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
        PAGE    ,132
        TITLE   DOS - KEYB Command  -  Interrupt 48H Handler

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DOS - NLS Support - KEYB Command
;; (C) Copyright 1988 Microsoft
;;
;; File Name:  KEYBI48.ASM
;; ----------
;;
;; Description:
;; ------------
;;       Contains Interrupt 48H handler.
;;
;; Documentation Reference:
;; ------------------------
;;       PC DOS 3.3 Detailed Design Document - May ?? 1986
;;
;; Procedures Contained in This File:
;; ----------------------------------
;;
;; Include Files Required:
;; -----------------------
;;       INCLUDE KEYBEQU.INC
;;       INCLUDE KEYBSHAR.INC
;;       INCLUDE KEYBMAC.INC
;;       INCLUDE KEYBCMD.INC
;;       INCLUDE KEYBCPSD.INC
;;       INCLUDE POSTEQU.inc
;;       INCLUDE DSEG.inc
;;
;; External Procedure References:
;; ------------------------------
;;       FROM FILE  ????????.ASM:
;;            procedure - description????????????????????????????????
;;
;; Linkage Information:  Refer to file KEYB.ASM
;; --------------------
;;
;; Change History:
;; ---------------
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                                       ;;
        INCLUDE KEYBEQU.INC            ;;
        INCLUDE KEYBSHAR.INC           ;;
        INCLUDE KEYBMAC.INC            ;;
        INCLUDE KEYBCMD.INC            ;;
        INCLUDE KEYBCPSD.INC           ;;
        INCLUDE POSTEQU.inc            ;;
        INCLUDE DSEG.inc               ;;
                                       ;;
        PUBLIC KEYB_INT_48             ;;
                                       ;;
        EXTRN  ERROR_BEEP:NEAR         ;;
                                       ;;
CODE    SEGMENT PUBLIC 'CODE'          ;;
                                       ;;
        ASSUME  CS:CODE,DS:CODE,ES:DATA;;
                                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Module: KEYB_INT_48
;;
;; Description:
;;
;; Input Registers:
;;     AL := Scan Code
;;
;; Output Registers:
;;     N/A
;;
;; Logic:
;;    IF scan code is not a break code THEN
;;       IF CNTL was not entered THEN
;;          IF ALT+SHIFT was pressed THEN
;;             Set JB_KB_FLAG in SHARED_DATA_AREA
;;             Clear ALT and SHIFT states in KB_FLAG
;;    IRET or JMP to a chained INT48 routine
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;   Program Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                                       ;;
KEYB_INT_48   PROC                     ;;
                                       ;;
        STI                            ;; allow NON-KB interrupts
        PUSH   BX                      ;;
        PUSH   BP                      ;;
        PUSH   CX                      ;;
        PUSH   DX                      ;;
        PUSH   DI                      ;;
        PUSH   SI                      ;;
        PUSH   DS                      ;;
        PUSH   ES                      ;;
        PUSH   AX                      ;;
                                       ;;
        MOV     SD.JR_KB_FLAG,0        ;; Clear the flag
                                       ;;
        CMP     AL,80H                 ;; Test for break code
        JA      INT48_EXIT             ;; IF not a break code THEN
                                       ;;
        PUSH    DS                     ;; Save segment registers
        PUSH    ES                     ;;
                                       ;;
        PUSH    CS                     ;; Set up addressing
        POP     DS                     ;;  for DATA SEGMENT (=CODE SEGMENT)
        MOV     BX,DATA                ;; Set up addressing
        MOV     ES,BX                  ;;  for EXTRA SEGMENT (=BIOS RAM AREA)
                                       ;;
        MOV     AH,KB_FLAG             ;; Get the flag status
        AND     AH,0FH                 ;; Clear all shift states
                                       ;;
        TEST    AH,CTL_SHIFT           ;; Test if CNTL was entered?
        JNE     INT48_PASS             ;;;;;;;;;;;;;;;; IF yes THEN
                                                     ;;     pass to ROM INT48
        AND     AH,ALT_SHIFT+RIGHT_SHIFT+LEFT_SHIFT  ;; Test if both ALT and
        CMP     AH,ALT_SHIFT                         ;;     SHIFT were pressed
        JBE     INT48_PASS                           ;; IF no THEN
                                                     ;;     pass to ROM INT48
        MOV     BH,KB_FLAG                           ;;;;;;;;;;;; IF yes then
        MOV     SD.JR_KB_FLAG,BH                               ;;  Setup JR flag
        AND     SD.JR_KB_FLAG,ALT_SHIFT+RIGHT_SHIFT+LEFT_SHIFT ;; Pass flags
                                                               ;;   (ALT and
                                       ;;;;;;;;;;;;;;;;;;;;;;;;;; EITHER/BOTH SHIFT)
        XOR     KB_FLAG,AH             ;; Clear the ALT state and SHIFT state
                                       ;; Reset the KB_FLAG to permit
                                       ;;    third shifts to go through
INT48_PASS:                            ;;
        POP     ES                     ;;
        POP     DS                     ;;
                                       ;;;;;;;
INT48_EXIT:                                 ;;
        CMP   WORD PTR CS:SD.OLD_INT_48,0   ;; Q..are we the last in the chain?
        JNE   INT_48_JMP                    ;; N..call next in chain
        CMP   WORD PTR CS:SD.OLD_INT_48+2,0 ;; Q..are we the last in the chain?
        JNE   INT_48_JMP                    ;; N..call next in chain
                                       ;;;;;;;
        POP    AX                      ;; restore regs
        POP    ES                      ;;
        POP    DS                      ;;
        POP    SI                      ;;
        POP    DI                      ;;
        POP    DX                      ;;
        POP    CX                      ;;
        POP    BP                      ;;
        POP    BX                      ;;
                                       ;;
        IRET                           ;; Y..return to caller
                                       ;;
INT_48_JMP:                            ;;
                                       ;;
        POP    AX                      ;; restore regs
        POP    ES                      ;;
        POP    DS                      ;;
        POP    SI                      ;;
        POP    DI                      ;;
        POP    DX                      ;;
        POP    CX                      ;;
        POP    BP                      ;;
        POP    BX                      ;;
                                       ;;
        JMP   CS:SD.OLD_INT_48         ;;
                                       ;;
KEYB_INT_48   ENDP                     ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

CODE   ENDS
       END