home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
norge.freeshell.org (192.94.73.8)
/
192.94.73.8.tar
/
192.94.73.8
/
pub
/
computers
/
pcjr
/
screen
/
ZANSI.LZH
/
ZANSI_I.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-11-29
|
3KB
|
85 lines
;------ zansi_i.asm ----------------------------------------------
; Zephyr ANSI terminal driver.
; Copyright (C) 1986, Thomas Hanlin III, Springfield VA.
; Based on original code for NANSI by Daniel Kegel, Pasadena, CA.
;------------------------------------------------------------------------
; Contains code only needed at initialization time.
; to zansi.asm
public dosfn0
; from zansi.asm
extrn break_handler:near
extrn int_29:near
extrn req_ptr:dword
; from zansi_p.asm
extrn param_buffer:word ; adr of first byte free for params
extrn param_end:word ; adr of last byte used for params
extrn redef_end:word ; adr of last used byte for redefs
code segment byte public 'CODE'
assume cs:code, ds:code
;-------- dos function # 0 : init driver ---------------------
; Initializes device driver interrupts and buffers, then
; passes ending address of the device driver to DOS.
; Since this code is only used once, the buffer can be set up on top
; of it to save RAM.
dosfn0 proc near
; Install BIOS keyboard break handler.
xor ax,ax
mov ds,ax
mov bx,6Ch
mov word ptr [BX],offset break_handler
mov [BX+02],cs
; Install INT 29 quick putchar.
mov bx,0a4h
mov word ptr [bx],offset int_29
mov [bx+2],cs
push cs
pop ds
push cs
pop es ; es=cs so we can use stosb
cld ; make sure stosb increments di
; Calculate addresses of start and end of parameter/redef buffer.
; The buffer occupies the same area of memory as this code!
; ANSI parameters are accumulated at the lower end, and
; keyboard redefinitions are stored at the upper end; the variable
; param_end is the last byte used by params (changes as redefs added);
; redef_end is the last word used by redefinitions.
mov di,offset dosfn0
mov param_buffer,di
add di,512
mov param_end,di ; addr of last byte in free area
inc di
; Build the default redefinition table:
; control-printscreen -> control-P
; (Must be careful not to overwrite ourselves here!)
mov al,16 ; control P
stosb
mov ax,7200h ; control-printscreen
stosw
mov ax,1 ; length field
mov redef_end, di ; address of last used word in table
stosw
xor ax,ax
; Return ending address of this device driver, with status in AX.
lds si,req_ptr
mov 14[si],di
mov 16[si],cs
; Return exit status in ax.
ret
dosfn0 endp
code ends
end ; of zansi_i.asm