1 ;****************************************************************************
3 ;* SciTech Multi-platform Graphics Library
5 ;* ========================================================================
7 ;* The contents of this file are subject to the SciTech MGL Public
8 ;* License Version 1.0 (the "License"); you may not use this file
9 ;* except in compliance with the License. You may obtain a copy of
10 ;* the License at http://www.scitechsoft.com/mgl-license.txt
12 ;* Software distributed under the License is distributed on an
13 ;* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 ;* implied. See the License for the specific language governing
15 ;* rights and limitations under the License.
17 ;* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 ;* The Initial Developer of the Original Code is SciTech Software, Inc.
20 ;* All Rights Reserved.
22 ;* ========================================================================
24 ;* Language: 80386 Assembler
25 ;* Environment: IBM PC (MS DOS)
27 ;* Description: Assembly language support routines for the event module.
29 ;****************************************************************************
33 include "scitech.mac" ; Memory model macros
37 header _event ; Set up memory model
41 cextern _EVT_biosPtr,DPTR
43 cpublic _EVT_dataStart
46 %define KB_HEAD WORD esi+01Ah ; Keyboard buffer head in BIOS data area
47 %define KB_TAIL WORD esi+01Ch ; Keyboard buffer tail in BIOS data area
48 %define KB_START WORD esi+080h ; Start of keyboard buffer in BIOS data area
49 %define KB_END WORD esi+082h ; End of keyboard buffer in BIOS data area
51 KB_HEAD EQU WORD esi+01Ah ; Keyboard buffer head in BIOS data area
52 KB_TAIL EQU WORD esi+01Ch ; Keyboard buffer tail in BIOS data area
53 KB_START EQU WORD esi+080h ; Start of keyboard buffer in BIOS data area
54 KB_END EQU WORD esi+082h ; End of keyboard buffer in BIOS data area
61 begcodeseg _event ; Start of code segment
63 cpublic _EVT_codeStart
65 ;----------------------------------------------------------------------------
66 ; int _EVT_getKeyCode(void)
67 ;----------------------------------------------------------------------------
68 ; Returns the key code for the next available key by extracting it from
69 ; the BIOS keyboard buffer.
70 ;----------------------------------------------------------------------------
71 cprocstart _EVT_getKeyCode
75 mov esi,[_EVT_biosPtr]
82 mov ax,[esi+ebx] ; EAX := character from keyboard buffer
85 cmp bx,[KB_END] ; Hit the end of the keyboard buffer?
88 @@1: mov [KB_HEAD],bx ; Update keyboard buffer head pointer
95 ;----------------------------------------------------------------------------
96 ; int _EVT_disableInt(void);
97 ;----------------------------------------------------------------------------
98 ; Return processor interrupt status and disable interrupts.
99 ;----------------------------------------------------------------------------
100 cprocstart _EVT_disableInt
102 pushf ; Put flag word on stack
103 cli ; Disable interrupts!
104 pop eax ; deposit flag word in return register
109 ;----------------------------------------------------------------------------
110 ; void _EVT_restoreInt(int ps);
111 ;----------------------------------------------------------------------------
112 ; Restore processor interrupt status.
113 ;----------------------------------------------------------------------------
114 cprocstart _EVT_restoreInt
119 mov ebp,esp ; Set up stack frame
121 popf ; Restore processor status (and interrupts)
127 ;----------------------------------------------------------------------------
128 ; int EVT_rdinx(int port,int index)
129 ;----------------------------------------------------------------------------
130 ; Reads an indexed register value from an I/O port.
131 ;----------------------------------------------------------------------------
134 ARG port:UINT, index:UINT
149 ;----------------------------------------------------------------------------
150 ; void EVT_wrinx(int port,int index,int value)
151 ;----------------------------------------------------------------------------
152 ; Writes an indexed register value to an I/O port.
153 ;----------------------------------------------------------------------------
156 ARG port:UINT, index:UINT, value:UINT