home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / ansi / zansi / zansi_i.asm < prev    next >
Assembly Source File  |  1987-07-02  |  2KB  |  71 lines

  1. ;------ zansi_i.asm ----------------------------------------------
  2. ; Zephyr ANSI terminal driver.
  3. ;    Copyright (C) 1986-1987, Thomas Hanlin III, Alexandria VA.
  4. ;    Based on original code for NANSI by Daniel Kegel, Pasadena CA.
  5. ;------------------------------------------------------------------------
  6. ; Contains code only needed at initialization time.
  7.  
  8.  
  9.         ; to zansi.asm
  10.         public  dosfn0
  11.  
  12.         ; from zansi.asm
  13.         extrn   break_handler:near
  14.         extrn   int_29:near
  15.         extrn   req_ptr:dword
  16.  
  17.         ; from zansi_p.asm
  18.         extrn   param_buffer:word       ; adr of first byte free for params
  19.         extrn   param_end:word          ; adr of last byte used for params
  20.  
  21.  
  22. code    segment byte public 'CODE'
  23.         assume  cs:code, ds:code
  24.  
  25. ;-------- dos function # 0 : init driver ---------------------
  26. ; Initializes device driver interrupts and buffers, then
  27. ; passes ending address of the device driver to DOS.
  28. ; Since this code is only used once, the buffer can be set up on top
  29. ; of it to save RAM.
  30.  
  31. dosfn0  proc    near
  32.         ; Install BIOS keyboard break handler.
  33.         xor     ax,ax
  34.         mov     ds,ax
  35.         mov     bx,6Ch
  36.         mov     word ptr [BX],offset break_handler
  37.         mov     [BX+02],cs
  38.         ; Install INT 29 quick putchar.
  39.         mov     bx,0a4h
  40.         mov     word ptr [bx],offset int_29
  41.         mov     [bx+2],cs
  42.  
  43.         push    cs
  44.         pop     ds
  45.         push    cs
  46.         pop     es                      ; es=cs so we can use stosb
  47.         cld                             ; make sure stosb increments di
  48.  
  49.         ; Calculate addresses of start and end of parameter buffer.
  50.         ; The buffer occupies the same area of memory as this code!
  51.         ; ANSI parameters are accumulated at the lower end, and
  52.         ; param_end is the last byte used by params
  53.         mov     di,offset dosfn0
  54.         mov     param_buffer,di
  55.         add     di,512
  56.         mov     param_end,di    ; addr of last byte in free area
  57.         inc     di
  58.  
  59.         ; Return ending address of this device driver, with status in AX.
  60.         lds     si,req_ptr
  61.         mov     14[si],di
  62.         mov     16[si],cs
  63.  
  64.         xor     ax,ax              ; Return exit status in ax.
  65.         ret
  66.  
  67. dosfn0  endp
  68.  
  69. code    ends
  70.         end                             ; of zansi_i.asm
  71.