home *** CD-ROM | disk | FTP | other *** search
- ;/*
- ;** dinptokb.asm
- ;** contains: dinptokb()
- ;*/
-
- ROMSEG equ 040h ;ROM Bios data segment
- KEYBOARDBUFFER equ 01eh ;Offset of keyboard buffer in ROMSEG
- KEYBOARDEND equ KEYBOARDBUFFER+32 ;End of keyboard buffer
- KEYBOARDTAIL equ 01ch ;Offset of keyboard tail pointer
- KEYBOARDHEAD equ 01ah ;Offset of keyboard head pointer
-
-
- include model.h
- include prologue.h
-
- pseg cdinptokb
-
- ;/*
- ;** int
- ;** dinptokb(unsigned ScanChar)
- ;**
- ;** ARGUMENT(s)
- ;** ScanChar - Scan code in high order 8 bits,
- ;** ASCII code in low order 8 bits.
- ;**
- ;** DESCRIPTION
- ;** Puts characters directly into the keyboard buffer. Does not use the
- ;** ROM BIOS. Depends on the keyboard buffer being located at 40:1E as
- ;** documented by IBM.
- ;**
- ;** RETURNS
- ;** 0 = operation successfully completed.
- ;** 1 = Buffer is full.
- ;**
- ;** AUTHOR
- ;** "" Fri 11-Nov-1988 10:10:45
- ;** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- ;**
- ;** MODIFICATIONS
- ;**
- ;*/
- cproc dinptokb
- push ds
- mov ax,ROMSEG
- mov ds,ax
- mov di,KEYBOARDHEAD
- cli ;shutdown interrupts
- mov bx,[di+2] ;bx=buffer tail
- mov si,bx ;save in SI
- add bx,2 ;move tail forward
- cmp bx,KEYBOARDEND ;check for end
- jnz skipwrap
- mov bx,KEYBOARDBUFFER ;wrap back to beginning
- skipwrap: cmp bx,[di] ;if equal to head then full
- mov ax,1 ;assume full
- jz directinexit ;check assumption
- mov ax,parm1_ ;ah=scan code, al=character code
- mov [si],ax ;save in buffer
- mov [di+2],bx ;update new tail position
- xor ax,ax
- directinexit: sti
- pop ds
- cproce
-
- endps
- end
-