home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB140 / grlibfor.arj / ASSERT.ASM < prev    next >
Assembly Source File  |  1988-12-11  |  11KB  |  358 lines

  1. PAGE ,132
  2. TITLE ASSERT.ASM
  3. ;14/11/84  convert to v2 ci86
  4. ;29/11
  5. /84  fix bug in repl mode
  6. ; 4 dec 84 move PATTERN.ASM into this progr
  7. am
  8.  
  9.     include    asmc.h
  10.  
  11.     SEGEND    CODE
  12.  
  13.     SEGDEF    DATA
  14.  
  15.  
  16. EXTRN    gbmod_:BYTE, ws_number_:BYTE, fgbg_:BYTE, alups_:BYTE
  17. EX
  18. TRN    gbmskl_:BYTE, ws_wmo_:BYTE
  19. EXTRN    l_type_:BYTE, pattbl_:BYTE
  20.  
  21.  
  22.     SEGEND    DATA
  23.  
  24.     SEGDEF    CODE
  25.  
  26. PUBLIC    gdc_nb_, fifo_mt
  27. _, g_off_, g_on_, a_mode_
  28. PUBLIC    a_fgbg_, a_alups_, a_gbmsk_, a_wmod
  29. e_
  30. PUBLIC    a_patrn_
  31.  
  32.  
  33. ;********************************************************************
  34. ;*                                                                  *
  35. ;*      f u n c t i o n
  36.      gdc_nb()                                *
  37. ;*                                                                  *
  38. ;*      gdc_not_busy will put a harmless comma
  39. nd into the GDC and   *
  40. ;*      wait for the command to be read out of t
  41. he command FIFO.    *
  42. ;*      This means that the GDC is not busy doing a
  43.  write or read   *
  44. ;*      operation.                                                  *
  45. ;*                                                                  *
  46. ;*      entry:          non
  47. e                                        *
  48. ;*      exit:           ax = 0 if more than approx 74ms elapsed     *
  49. ;*                      
  50. without "gdc not busy"                      *
  51. ;********************************************************************
  52.  
  53.         PROCDEF gdc_nb_
  54.         push    
  55. cx              ;use cx as a time-out loop counter.
  56.         mov     cx,8000H       ;wait fo
  57. r FIFO not full or reasonable time.
  58. L0:     in    al,56H        ;first check 
  59. if the FIFO is full.
  60.         and     al,2
  61.         jz      L1              ;jump if not.
  62.         
  63. loop    L0
  64.  
  65. L1:     call    fifo_mt_        ;wait for fifo to empty
  66.  
  67.  
  68. L2:     in      al,56H         ;wait for vert. or horiz. sync
  69.         and     al,60H
  70.  
  71.         jz      L2
  72.         in      al,56H
  73.         and     al,8        ;is GDC still drawing ?
  74.  
  75.         jnz     L2
  76.  
  77.         pop     cx
  78.         ret                     ;ax = 1  ==  TRUE
  79.         P
  80. ROCEND gdc_nb_
  81.  
  82. ;This routine is in as a fast check that the GDC's
  83.  fifo is empty but does
  84. ;not check anything else.
  85.  
  86.         PROCDEF  
  87. fifo_mt_
  88.         mov     ax,40DH
  89.         out     57H,al
  90. L5:     in      al,56H
  91.  
  92.         test    al,ah
  93.         jz      L5
  94.         ret
  95.         PROCEND  fifo_mt_
  96.  
  97. ;
  98. ********************************************************************
  99. ;*                                                                  *
  100. ;*      f u n c t i o n      g_off_()                                *
  101. ;*                                                                  *
  102. ;*      p
  103. urpose:        disable graphics output                     *
  104. ;*                                                                  *
  105. ;********************************************************************
  106.  
  107.         PROCDE
  108. F  g_off_
  109. exit_graf_:
  110.         and    BYTE PTR gbmod_,7FH  ;disable graphi
  111. cs output in gbmod
  112.         call    a_mode_              ;assert new mode register
  113.         
  114. mov    al,83H
  115.         out    0AH,al               ;turn off graphics on monochrome line
  116.  
  117.         ret
  118.         PROCEND  g_off_
  119.  
  120. ;********************************************************************
  121. ;*                                                                  *
  122. ;*      f u n c t i o
  123.  n      g_on_()                                 *
  124. ;*                                                                  *
  125. ;*      purpose:        enable graphics output                      *
  126.  
  127. ;*                                                                  *
  128. ;********************************************************************
  129.  
  130.         PROCDEF  g_on_
  131. enter_graf_:
  132.         mov     
  133. al,BYTE PTR ws_number_   ;chk work_station loaded 
  134.         or      al,al
  135.         
  136. jz      Lam
  137.         mov    al,87H
  138.         out    0AH,al                   ;enable graphics on monoc
  139. hrome line
  140.         or    BYTE PTR gbmod_,80H      ;enable graphics output in gb
  141. mod
  142.         PROCEND  g_on_
  143.  
  144. ;********************************************************************
  145. ;*                                                                  *
  146. ;*      f u n c t i o n s
  147.      a_mode_()                             *
  148. ;*                                                                  *
  149. ;*      purpose:        set mode register to the v
  150. alue held in      *
  151. ;*                      gbmod                                       *
  152. ;*                                                                  *
  153. ;********************************************************************
  154.  
  155.         PROCDEF  
  156. a_mode_
  157.         mov     al,0BFH ;address the mode register through 
  158.         ou
  159. t     53H,al          ;the indirect register
  160.         mov     al,BYTE PTR gbmod_
  161.         
  162. out     51H,al          ;load the mode register
  163. Lam:    ret
  164.         PROCEND  a_mo
  165. de_
  166.  
  167. ;*****************************************************************************
  168. ;*                                                                           *
  169. ;*       f u n c t i o n     a_fgbg_()                                        *
  170. ;*                                                                           
  171. *
  172. ;*       purpose:        Load the Foreground;Background Register             *
  173. ;*                                                                           
  174. *
  175. ;*****************************************************************************
  176.  
  177.         PROCDEF  a_fgbg_
  178.         mov    al, 0F7H    ;select the Fo
  179. reground;Background Register
  180.         out    53H, al
  181.         mov    al, BYTE PTR 
  182. fgbg_
  183.         out    51H, al        ;load the Foreground;Background Register
  184.  
  185.         ret
  186.         PROCEND  a_fgbg_
  187.  
  188. ;*****************************************************************************
  189. ;*                                                                           *
  190. ;*       F U N C T I 
  191. O N    a_alups_()                                        *
  192. ;*                                                                           *
  193. ;*       purpose:        Set the ALU ; Plane Se
  194. lect Register                 *
  195. ;*                                                                           *
  196. ;*****************************************************************************
  197.  
  198.         PROCDEF  a_alups_
  199.         mo
  200. v    al,0EFH       ;select the ALU;PS Register
  201.         out    53H,al
  202.         mov    al
  203. , BYTE PTR alups_      ;move ALU;PS value to al
  204.         out    51H,al         ;load v
  205. alue into ALU;PS Register
  206.         ret
  207.         PROCEND  a_alups_
  208.  
  209. ;*****************************************************************************
  210.  
  211. ;*                                                                           *
  212. ;*       F U N C T I O N    a_gbmsk_()                                        *
  213. ;*                                                                           *
  214. ;*       purp
  215. ose:        Set the graphics board mask to values held          *
  216. ;*                       in gbmskl_
  217.  and gbmskh_                              *
  218. ;*                                                                           *
  219. ;*****************************************************************************
  220.  
  221.         PROCDEF  a_gbmsk_
  222.     mov    
  223. ax,WORD PTR gbmskl_      ;get the mask value to load
  224.     out    54H,al
  225.     
  226. mov    al, ah
  227.     out    55H,al
  228.     ret
  229.         PROCEND  a_gbmsk_
  230.  
  231. ;*****************************************************************************
  232.  
  233. ;*                                                                           *
  234. ;*       F U N C T I O N    a_wmode_()                         *
  235. ;*                                                                           *
  236. ;*       
  237. purpose:       Juggle fgbg reg. & alups reg. to make GDC            *
  238. ;*                      write t
  239. he correct colours in the correct             *
  240. ;*                      manner to the bit map.                               *
  241.  
  242. ;*                                                                           *
  243. ;*****************************************************************************
  244.  
  245.         PROCDEF  a_wmode_
  246.     push    bp
  247.     mov     
  248. bp,sp
  249.  
  250.     call    gdc_nb_
  251.     mov     al,BYTE PTR ws_wmo_      ;get the 
  252. write mode requested.
  253.     cmp     al,3            ;check for erase mode.
  254.     jz      
  255. La0
  256.     mov     cl,4
  257.     shl     al,cl
  258.     mov     ah,BYTE PTR alups_       ;ge
  259. t old alups
  260.     and     ah,0FH          ;mask off plane writes
  261.     or      al,ah           
  262. ;add to new write mode
  263.     mov     BYTE PTR alups_,al       ;and save.
  264.     c
  265. all    a_alups_
  266.     mov     al,0F0H         ;enable fore_ground writes in case t
  267. he last
  268.     jmp     La1             ;write mode was erase.
  269. La0:    mov     BYTE PTR
  270.  alups_,0  ;put alu into replace mode, all planes.
  271.         call    a_alups_
  272.  
  273.         xor     al,al           ;write zero's to all planes no matter what.
  274. La1:
  275.     mov     BYTE PTR fgbg_,al
  276.         call    a_fgbg_
  277.  
  278.         pop     bp
  279.         
  280. ret
  281.         PROCEND  a_wmode_
  282.  
  283.  
  284.  
  285. ;*****************************************************************************
  286. ;                                                                            *
  287. ;        f u n c 
  288. t i o n    a_patrn_()                                        *
  289. ;                                                                            *
  290. ;        purpose:       Load the Pattern Mul
  291. tiplier and Pattern Register     *
  292. ;                       for line drawing.                                    *
  293. ;                                                                            *
  294.  
  295. ;        caution:       You must load the Pattern Multiplier before          *
  296. ;                       
  297. loading the Pattern Register                         *
  298. ;                                                                            *
  299. ;*****************************************************************************
  300. ;
  301. ;The following
  302.  are some register values and the corresponding output patterns 
  303. ;whe
  304. n the repeat factor is:
  305. ;
  306. ;                 1            2                    3
  307. ;    0FFh         |--------|   |----------------
  308. |   |------------------------|
  309. ;    0AAh         |- - - - |   |--  --  --  --  |   |---   ---   ---
  310.    ---   |
  311. ;    0F0h         |----    |   |--------        |   |------------            |
  312. ;    0CDh         |-
  313. -  -- -|   |----    ----  --|   |------      ------   ---|
  314. ;
  315.     PROCDEF    a_patr
  316. n_
  317.         push    bx
  318.         push    cx
  319.  
  320.         mov     cl,BYTE PTR l_type_
  321.  
  322.         xor     ch,ch
  323.         add     cx,cx
  324.         lea     bx,  pattbl_
  325.         add     
  326. bx,cx
  327.         mov     al,0FDH         ;select the Pattern Multiplier
  328.         out    53
  329. H, al
  330.         mov     al, 1[bx]
  331.         dec    al              ;adjust bl to be zero-relati
  332. ve
  333.         not    al              ;invert it [remember Pattern Register is
  334.                                 ;multi
  335. plied by 16 minus multiplier value]
  336.         and     al,0FH          ;load the Patte
  337. rn Multiplier 
  338.         out    51H, al
  339.  
  340.         mov     al,0FBH ;select the Pa
  341. ttern Register
  342.         out     53H, al
  343.         mov     al, [bx]        ;get the patte
  344. rn data
  345.         out     51H, al ;load the Pattern Register
  346.  
  347.         pop     c
  348. x
  349.         pop     bx
  350.         ret
  351.     PROCEND    a_patrn_
  352.  
  353.     include epilo
  354. gue.h
  355.  
  356.     END
  357. 
  358.