home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SCREEN / ZAVT11.ZIP / ZAVT_I.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-28  |  2.7 KB  |  112 lines

  1. ;------ zavt_i.asm ----------------------------------------------
  2. ; Zephyr Avatar terminal driver.
  3. ;    Copyright (C) 1989-1990, Luns Tee, Toronto ON.
  4. ;    Based on original code for ZANSI by Thomas Hanlin III, Alexandria VA.
  5. ;    and original code for NANSI by Daniel Kegel, Pasadena CA.
  6. ;------------------------------------------------------------------------
  7. ; Contains code only needed at initialization time.
  8.     include    zavt_d.asm        ; get equates
  9.  
  10.     ; to zavt.asm
  11.     public    dosfn0
  12.     if    fullscreen
  13.     public    linebuf
  14.     public    linebufend
  15.     endif
  16.  
  17.     ; to zavt_p.asm
  18.     public    param_buffer, param_end
  19.  
  20.     ; from zavt.asm
  21.     extrn    hdrseg:word
  22.     extrn    break_handler:near
  23.     extrn    int_29:near
  24.     extrn    req_ptr:dword
  25.  
  26.     if    xlate
  27.     extrn    key_init:near
  28.     public    redef_end
  29.     endif
  30.  
  31. ZeroSeg    segment at 0h
  32.     org    6Ch
  33. BrInt    dw    ?,?
  34.  
  35.     org    0A4h
  36. Int29    dw    ?,?
  37.  
  38. ZeroSeg    ends
  39.  
  40. code    segment byte public 'CODE'
  41.     assume    cs:code, ds:code
  42.  
  43. param_buffer    equ    offset dosfn0
  44.                 ; address of first byte free for new params
  45.     if    xlate
  46. param_end    dw    dosfn0+511
  47. redef_end    equ    dosfn0+510
  48.     else
  49. param_end    equ    offset dosfn0+511
  50.     endif                ; address of end of free area
  51.     if    fullscreen
  52. linebuf        equ    dosfn0+512
  53. linebufend    equ    linebuf+255
  54. endofdriver    equ    linebufend+1
  55.     else
  56. endofdriver    equ    dosfn0+512
  57.     endif
  58.  
  59. ;-------- dos function # 0 : init driver ---------------------
  60. ; Initializes device driver interrupts and buffers, then
  61. ; passes ending address of the device driver to DOS.
  62. ; Since this code is only used once, the buffer can be set up on top
  63. ; of it to save RAM.
  64.  
  65. dosfn0    proc    near
  66.     if    two_handlers
  67.     cmp    hdrseg,-1        ; everything been intialized?
  68.     jnz    second_call        ; oui?
  69.     mov    hdrseg,cs        ; nah
  70.     endif
  71.  
  72.     ; Calculate address of end of parameter buffer.
  73.     ; The buffer occupies the same area of memory as this code!
  74.     ; ANSI parameters are accumulated at the lower end, and
  75.     ; param_end is the last byte used by params
  76.     if    xlate
  77.     call    key_init        ; clear keyboard translation table
  78.     endif
  79.  
  80.     ; Install BIOS keyboard break handler.
  81.     xor    ax,ax
  82.     mov    ds,ax
  83.     assume    ds:zeroseg
  84.     mov    word ptr [BrInt],offset break_handler
  85.     mov    [BrInt+2],cs
  86.  
  87.     ; Install INT 29 quick putchar.
  88.     mov    word ptr [Int29],offset int_29
  89.     mov    [Int29+2],cs
  90.  
  91.     mov    bx,ABS40
  92.     mov    ds,bx
  93.     assume    ds:ABS40
  94.     mov    bl,crt_rows        ; see if a sub EGA is
  95.     or    bl,bl            ; installed and initialize
  96.     jnz    second_call        ; BIOS data area's entry
  97.     mov    crt_rows,24        ; for rows on screen
  98.  
  99. second_call:
  100.  
  101.     ; Return ending address of this device driver, with status in AX.
  102.     lds    si,cs:[req_ptr]
  103.     mov    14[si], offset endofdriver
  104.     mov    16[si],cs
  105.  
  106.     ret                ; Return exit status (still 0) in ax.
  107.  
  108. dosfn0    endp
  109.  
  110. code    ends
  111.     end                ; of zansi_i.asm
  112.