2 * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
4 * ELKS utility routines for Micro-Windows drivers
10 * Return the byte at far address
13 GETBYTE_FP(FARADDR addr)
20 mov bx,[bp+4] ! bx = lo addr
21 mov ax,[bp+6] ! ds = hi addr
23 mov al,[bx] ! get byte at ds:bx
32 * Put the byte at far address
35 PUTBYTE_FP(FARADDR addr,unsigned char val)
42 mov bx,[bp+4] ! bx = lo addr
43 mov ax,[bp+6] ! ds = hi addr
45 mov al,[bp+8] ! al = val
46 mov [bx],al ! put byte at ds:bx
54 * Read-modify-write the byte at far address
64 mov bx,[bp+4] ! bx = lo addr
65 mov ax,[bp+6] ! ds = hi addr
67 or [bx],al ! rmw byte at ds:bx, al value doesnt matter
75 * Or the byte at far address
78 ORBYTE_FP(FARADDR addr,unsigned char val)
85 mov bx,[bp+4] ! bx = lo addr
86 mov ax,[bp+6] ! ds = hi addr
88 mov al,[bp+8] ! al = val
89 or [bx],al ! or byte at ds:bx
97 * And the byte at far address
100 ANDBYTE_FP(FARADDR addr,unsigned char val)
107 mov bx,[bp+4] ! bx = lo addr
108 mov ax,[bp+6] ! ds = hi addr
110 mov al,[bp+8] ! al = val
111 and [bx],al ! and byte at ds:bx
119 * Input byte from i/o port
128 mov dx,[bp+4] ! dx = port
129 in al,dx ! input byte
137 * Output byte to i/o port
140 outportb(int port,unsigned char data)
146 mov dx,[bp+4] ! dx = port
147 mov al,[bp+6] ! al = data
155 * Output word i/o port
158 outport(int port,int data)
164 mov dx,[bp+4] ! dx = port
165 mov ax,[bp+6] ! ax = data
173 * es:bp = int10(int ax,int bx)
174 * Call video bios using interrupt 10h
187 mov ax,[bp+4] ! get first arg
188 mov bx,[bp+6] ! get second arg
190 mov dx,es ! return es:bp
201 /* poll the keyboard*/
206 mov ah,1 ! read, no remove
208 jz nordy ! no chars ready
209 mov ax,1 ! chars ready
211 nordy: xor ax,ax ! no chars ready
215 /* wait and read a kbd char when ready*/
220 xor ah,ah ! read and remove
225 /* return kbd shift status*/
230 mov ah,2 ! get shift status
232 mov ah,0 ! low bits only for now...