home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Homebrewer's Handbook / vr.iso / vr386 / vdrinte.asm < prev    next >
Assembly Source File  |  1996-03-19  |  5KB  |  233 lines

  1.  
  2.     TITLE    VDRINTE - Interface to BIN loadable video drivers.
  3.  
  4.     COMMENT    $
  5.  
  6.  
  7. /*
  8.  This code is part of the VR-386 project, created by Dave Stampe.
  9.  VR-386 is a desendent of REND386, created by Dave Stampe and
  10.  Bernie Roehl.  Almost all the code has been rewritten by Dave
  11.  Stampre for VR-386.
  12.  
  13.  Copyright (c) 1994 by Dave Stampe:
  14.  May be freely used to write software for release into the public domain
  15.  or for educational use; all commercial endeavours MUST contact Dave Stampe
  16.  (dstampe@psych.toronto.edu) for permission to incorporate any part of
  17.  this software or source code into their products!  Usually there is no
  18.  charge for under 50-100 items for low-cost or shareware products, and terms
  19.  are reasonable.  Any royalties are used for development, so equipment is
  20.  often acceptable payment.
  21.  
  22.  ATTRIBUTION:  If you use any part of this source code or the libraries
  23.  in your projects, you must give attribution to VR-386 and Dave Stampe,
  24.  and any other authors in your documentation, source code, and at startup
  25.  of your program.  Let's keep the freeware ball rolling!
  26.  
  27.  DEVELOPMENT: VR-386 is a effort to develop the process started by
  28.  REND386, improving programmer access by rewriting the code and supplying
  29.  a standard API.  If you write improvements, add new functions rather
  30.  than rewriting current functions.  This will make it possible to
  31.  include you improved code in the next API release.  YOU can help advance
  32.  VR-386.  Comments on the API are welcome.
  33.  
  34.  CONTACT: dstampe@psych.toronto.edu
  35. */
  36.  
  37.         $
  38.  
  39.  
  40.  
  41.         .MODEL large
  42.         .CODE
  43.  
  44.         .386
  45.  
  46. public    _screen_data     ; the C callable stubs
  47. public    _vsync
  48. public    _setup_hdwe
  49. public    _reset_hdwe
  50. public    _clr_page
  51. public    _copy_page
  52. public    _copy_block
  53. public    _clr_block
  54. public    _fastpoly
  55. public    _m_fastpoly
  56. public    _set_gmode
  57. public    _set_drawpage
  58. public    _exit_gmode
  59. public    _set_vpage
  60. public    _clipline
  61. public    _set_clip_rect
  62. public    _printxyr
  63. public    _erase_cursor
  64. public    _draw_cursor
  65. public    _vgaline
  66. public    _vgapoint
  67. public    _load_DAC_colors
  68. public    _read_DAC_colors
  69. public    _VGA_select
  70. public    _read_video_line
  71. public    _set_video_segment
  72. public    _write_video_line
  73. public    _vd_spare_4
  74. public    _vd_spare_5
  75. public    _vd_spare_6
  76. public    _vd_spare_7
  77. public    _vd_spare_8
  78.  
  79. _screen_data:
  80.     mov    ax,18
  81.     jmp    nonreentrant
  82. _vsync:
  83.     mov    ax,20
  84.     jmp    reentrant
  85. _setup_hdwe:
  86.     mov    ax,22
  87.     jmp    nonreentrant
  88. _reset_hdwe:
  89.     mov    ax,24
  90.     jmp    nonreentrant
  91. _clr_page:
  92.     mov    ax,26
  93.     jmp    nonreentrant
  94. _copy_page:
  95.     mov    ax,28
  96.     jmp    nonreentrant
  97. _clr_block:
  98.     mov    ax,30
  99.     jmp    nonreentrant
  100. _copy_block:
  101.     mov    ax,32
  102.     jmp    nonreentrant
  103. _fastpoly:
  104.     mov    ax,34
  105.     jmp    nonreentrant
  106. _m_fastpoly:
  107.     mov    ax,36
  108.     jmp    nonreentrant
  109. _set_gmode:
  110.     mov    ax,38
  111.     jmp    nonreentrant
  112. _exit_gmode:
  113.     mov    ax,40
  114.     jmp    nonreentrant
  115. _set_drawpage:
  116.     mov    ax,42
  117.     jmp    nonreentrant
  118. _set_vpage:
  119.     mov    ax,44
  120.     jmp    reentrant
  121. _vgaline:
  122.     mov    ax,46
  123.     jmp    nonreentrant
  124. _vgapoint:
  125.     mov    ax,48
  126.     jmp    nonreentrant
  127. _set_clip_rect:
  128.     mov    ax,50
  129.     jmp    nonreentrant
  130. _clipline:
  131.     mov    ax,52
  132.     jmp    nonreentrant
  133. _printxyr:
  134.     mov    ax,54
  135.     jmp    nonreentrant
  136. _draw_cursor:
  137.     mov    ax,56
  138.     jmp    nonreentrant
  139. _erase_cursor:
  140.     mov    ax,58
  141.     jmp    nonreentrant
  142. _load_DAC_colors:
  143.     mov    ax,60
  144.     jmp    nonreentrant
  145. _read_DAC_colors:
  146.     mov    ax,62
  147.     jmp    nonreentrant
  148. _VGA_select:
  149.     mov    ax,64
  150.     jmp    reentrant
  151. _read_video_line:
  152.     mov    ax,66
  153.     jmp    nonreentrant
  154. _set_video_segment:
  155.     mov    ax,68
  156.     jmp    nonreentrant
  157. _write_video_line:
  158.     mov    ax,70
  159.     jmp    nonreentrant
  160. _vd_spare_4:
  161.     mov    ax,72
  162.     jmp    nonreentrant
  163. _vd_spare_5:
  164.     mov    ax,74
  165.     jmp    nonreentrant
  166. _vd_spare_6:
  167.     mov    ax,76
  168.     jmp    nonreentrant
  169. _vd_spare_7:
  170.     mov    ax,78
  171.     jmp    nonreentrant
  172. _vd_spare_8:
  173.     mov    ax,80
  174.     jmp    nonreentrant
  175.  
  176. extrn _v_driver_pointer
  177.  
  178. nonreentrant:
  179.     push    bp
  180.     push    ds
  181.     mov      bp,sp
  182.     mov      dx,ss                  ; save stack seg
  183.     mov      es,dx
  184.     lds   bx,DWORD PTR _v_driver_pointer  ; get routine address
  185.     push    ds                     ; new stack seg
  186.     pop      ss                     ; all int's disabled till next instr..
  187.     mov      sp,2000                ; stack internal to driver
  188.     push    dx                     ; push old stack seg (bp=old stack ptr)
  189.     push    DWORD PTR es:[bp+24]   ; up to 20 bytes of arguments
  190.     push    DWORD PTR es:[bp+20]   ; copy adds 1 uS, but needed
  191.     push    DWORD PTR es:[bp+16]   ; to keep ints from crashing
  192.     push    DWORD PTR es:[bp+12]
  193.     push    DWORD PTR es:[bp+8]
  194.     push    cs                            ; push default return
  195.     push    offset nrtnh
  196.     push    ds
  197.     add   bx,ax                           ; push as call address
  198.     push    ds:[bx]
  199.     retf                                ; "call"
  200.  
  201. nrtnh:
  202.     add    sp,20
  203.     pop    ss                              ; restore stack
  204.     mov    sp,bp
  205.     pop    ds
  206.     pop    bp
  207.     retf                                ; exit
  208.  
  209. reentrant:
  210.     push    bp
  211.     push    ds
  212.     mov    bp,sp
  213.     push    DWORD PTR ss:[bp+24]   ; up to 20 bytes of arguments
  214.     push    DWORD PTR ss:[bp+20]   ; copy adds 1 uS, but needed
  215.     push    DWORD PTR ss:[bp+16]   ; to keep ints from crashing
  216.     push    DWORD PTR ss:[bp+12]
  217.     push    DWORD PTR ss:[bp+8]
  218.     push    cs                              ; push default return
  219.     push    offset rtnh
  220.     lds    bx,DWORD PTR _v_driver_pointer  ; get routine address
  221.     push    ds
  222.     add    bx,ax                           ; push as call address
  223.     push    ds:[bx]
  224.     retf                                    ; "call"
  225.  
  226. rtnh:    mov    sp,bp
  227.     pop    ds
  228.     pop    bp
  229.     retf                                    ; exit
  230.  
  231.  
  232.     end
  233.