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 / grlib03b.arj / GRLIB.ARC
Text File  |  1988-06-28  |  233KB  |  7,477 lines

  1. +ARCHIVE+ asmc.h        1496 12/05/1984 13:46:38
  2. ;    **********************************************
  3. ;    *           CI86 MODEL.H simulation          *
  4. ;    *          define big or small model         *
  5. ;    *          for library assembly code         *
  6. ;    **********************************************
  7.  
  8.  
  9. FALSE    equ    0    ;for small model
  10. TRUE    equ    1    ;for big model
  11.  
  12. @bigmodel equ FALSE    ;Small model for Graphics library
  13.  
  14. .XLIST
  15.  
  16. ;    **********************************************
  17. ;    *      PROCEDURE ENVELOPE DEFINITION         *
  18. ;    **********************************************
  19.  
  20.  
  21. PROCDEF    macro    name
  22.  IF @bigmodel
  23. name    PROC    FAR
  24.  ELSE
  25. name    PROC    NEAR
  26.  ENDIF
  27.     endm
  28.  
  29. PROCEND    macro    name
  30. name    ENDP
  31.     endm
  32.  
  33. ;    **********************************************
  34. ;    *        SEGMENT ENVELOPE DEFINITION         *
  35. ;    **********************************************
  36.  
  37.  
  38. SEGDEF    macro    name
  39.  
  40.     IFIDN <name>,<CODE>
  41.        IF @bigmodel
  42. @CODE    SEGMENT
  43.         ELSE
  44. @CODE    SEGMENT
  45.        ENDIF
  46.     ASSUME  CS:@CODE,DS:DGROUP,ES:DGROUP,SS:NOTHING
  47.     ENDIF
  48.  
  49.     IFIDN <name>,<DATA>
  50. @DATAB    SEGMENT
  51.     ENDIF
  52.  
  53.     IFIDN <name>,<CONST>
  54. @DATAI    SEGMENT
  55.     ENDIF
  56.  
  57.     endm
  58.  
  59. SEGEND    macro    name
  60.  
  61.     IFIDN <name>,<CODE>
  62.        IF @bigmodel
  63. @CODE    ENDS
  64.         ELSE
  65. @CODE    ENDS
  66.        ENDIF
  67.     ENDIF
  68.  
  69.     IFIDN <name>,<DATA>
  70. @DATAB    ENDS
  71.     ENDIF
  72.  
  73.     IFIDN <name>,<CONST>
  74. @DATAI    ENDS
  75.     ENDIF
  76.  
  77.     endm
  78.  
  79.  
  80. ;    **********************************************
  81. ;    *      C86 REQUIRED PROLOGUE DONE HERE       *
  82. ;    **********************************************
  83.  
  84.     include    prologue.h
  85. .LIST
  86. +ARCHIVE+ asmd.h        4033 12/13/1984 15:53:54
  87. ;asmd.h
  88. ;******************************************************************
  89. ;   REFERENCES TO GRAPHICS DATA FIELDS IN openws.asm              *
  90. ;******************************************************************
  91. .XLIST
  92. EXTRN  ws_data_:BYTE        ;All the bytes needed to initialise
  93.                 ;the work station. DO NOT CHANGE.
  94. EXTRN  p1_:BYTE            ;param table for PRAM & FIGS cmnds.
  95. EXTRN  ws_number_:BYTE        ;work station ident. 1 to 6
  96. EXTRN  ws_wmo_:BYTE        ;write mode. 0 to 3
  97. EXTRN  gbmod_:BYTE        ;GO's mode register.
  98. EXTRN  fgbg_:BYTE        ;defines fore_grnd/back_grnd colour.
  99. EXTRN  alups_:BYTE        ;defines the writing mode.
  100. EXTRN  gbmskl_:BYTE        ;GO's write mask, split into low and
  101. EXTRN  gbmskh_:BYTE        ;high bytes.
  102. EXTRN  gdcml_:BYTE        ;GDC's write mask, as above.
  103. EXTRN  gdcmh_:BYTE
  104. EXTRN  curl0_:BYTE        ;three bytes which define the GDC's
  105. EXTRN  curl1_:BYTE        ;cursor position.
  106. EXTRN  curl2_:BYTE        ;curl2 only uses it's high nibble.
  107. EXTRN  ymax_:WORD        ;max pixels on 'y' axis. 0 to ymax
  108. EXTRN  xmax_:WORD        ;max pixels on 'x' axis. 0 to xmax
  109. EXTRN  twdir_:BYTE        ;direct'n for word & vector drawing.
  110. EXTRN  nmritl_:BYTE        ;# words to write. used by FIGS
  111. EXTRN  nmrith_:BYTE
  112. EXTRN  sh_p_lin_:WORD        ;number of shifts to do to convert a
  113.                 ;line number to an absolute address.
  114. EXTRN  wd_p_lin_:WORD        ;number of words per line.
  115. EXTRN  x_start_:WORD        ;four gen. purpose variables, mainly
  116. EXTRN  y_start_:WORD        ;used for line drawing to defined the
  117. EXTRN  x_stop_:WORD        ;start and stop vectors.
  118. EXTRN  y_stop_:WORD
  119. EXTRN  g_strtx_:WORD        ;defines current 'x' offset from the
  120.                 ;start of line to 1st pix. displayed
  121. EXTRN  scr_top_:BYTE        ;define the top & bottom lines for
  122. EXTRN  scr_bot_:BYTE        ;vertical scrolling.
  123. EXTRN  scrltb_:BYTE        ;mirror of line number sequence.
  124. EXTRN  clmpda_:BYTE        ;defines the colour intensities.
  125. EXTRN  pattbl_:BYTE        ;defines patterns & repeat factors
  126.                 ; for drawing lines.
  127.  
  128. ;***** LINE VARIABLES *****
  129. EXTRN  l_col_:BYTE        ;line colour.
  130. EXTRN  l_type_:BYTE        ;line type, indexes "pattbl".
  131. EXTRN  l_wid_:BYTE        ;line width. (not used currently).
  132.  
  133. ;***** FILL VARIABLES *******
  134. EXTRN  f_col_:BYTE        ;fill colour.
  135. EXTRN  f_type_:BYTE        ;fill type. 0 to 3
  136. EXTRN  f_style_:BYTE        ;fill style. 0 to 7
  137. EXTRN  f_patrn_:BYTE        ;table of patterns for filling:
  138.                 ;f_patrn[0]    solid.    f_type = 1.
  139.                 ;f_patrn[1-8]  patterns. f_type = 2.
  140.                 ;f_patrn[9-16] hatches.  f_type = 3.
  141. ;***** TEXT VARIABLES *****
  142. EXTRN  t_col_:BYTE        ;text colour.affects "text"&"gtext."
  143. EXTRN  t_font_:BYTE        ;text font.   affects "gtext" only.
  144. EXTRN  t_sca_:BYTE        ;text scale.  affects "text" only.
  145. EXTRN  t_dir_:BYTE        ;direction that text is written.
  146.                 ;             affects "text" only.
  147. EXTRN  t_x_:WORD        ;define the bottom left of the char.
  148. EXTRN  t_y_:WORD        ;cell in which char. is displayed.
  149.  
  150. ;***** MARKER VARIABLES *****
  151. EXTRN  m_col_:BYTE        ;marker colour.
  152. EXTRN  m_type_:BYTE        ;marker type. 0 to 15
  153. EXTRN  m_sca_:BYTE        ;marker scale.
  154. EXTRN  m_tab_:BYTE        ;vector table for markers.
  155.  
  156. ;***** TEXT FONT TABLES *****
  157. EXTRN  tfonts_:BYTE         ;table of 4 user definable fonts for
  158.                 ;may be changed.
  159. ;***** WORK AREAS *****
  160. EXTRN   old_int_off:WORD    ;saved Graphics board int vector offset
  161. EXTRN   old_int_seg:WORD    ;saved Graphics board int vector segment
  162. EXTRN   int_done:BYTE
  163. EXTRN   gintvect_:WORD        ;Graphics board interrupt vector location
  164.  
  165. ;***** SWITCHES *****
  166. EXTRN   swisg_:BYTE        ;1= graphics option present
  167. EXTRN   sw100a_:BYTE        ;1= 100a, 0= 100b
  168. EXTRN   swgopen_:BYTE        ;1= workstation opened
  169. EXTRN   swgon_:BYTE        ;1= graphics open for business
  170.  
  171. ;***** GP Work area ****
  172. EXTRN  gp_buff_:WORD        ;4k gen. purpose array for 'xy' points.
  173.                 ;gives max 1024 'xy'points for polylines.
  174.                 ;Used heavily by "circle","segment",
  175.                 ;"arc" and "rectangle", therefore
  176.                 ;don't use it for these functions.
  177.  
  178.     SEGEND  DATA
  179.     SEGDEF  CODE
  180. EXTRN  dseg_sav:WORD        ;Save of DS for later use
  181. EXTRN  eseg_sav:WORD        ;Save of ES for later use
  182.     SEGEND  CODE
  183.     SEGDEF  DATA
  184. .LIST
  185. +ARCHIVE+ asmk.h        1718 11/16/1984 13:27:16
  186. ;/*------------------------------------------------------------------------
  187. ;
  188. ;    K E Y B O A R D    D E F I N I T I O N S
  189. ;
  190. ;--------------------------------------------------------------------------*/
  191.  
  192. FUNCTION    equ    100h    ;/* pertinent bit in 16-bit key return */
  193.  
  194. ;#define FUNKEY(keyval)        (keyval & FUNCTION ? TRUE : FALSE)
  195.  
  196. ;/* important function keys */
  197.  
  198. K_PSCR    equ    (FUNCTION OR   2)
  199. K_F4    equ    (FUNCTION OR   4)
  200. K_BRK    equ     (FUNCTION OR   5)
  201. K_INT     equ    (FUNCTION OR   6)
  202. K_RES     equ    (FUNCTION OR   7)
  203. K_CANC    equ    (FUNCTION OR   8)
  204. BS    equ    8
  205. K_MAIN    equ    (FUNCTION OR   9)
  206. TAB    equ    9
  207. K_EXIT    equ    (FUNCTION OR  10)
  208. LF    equ    10
  209. RET    equ    13
  210. K_ADDO    equ    (FUNCTION OR  14)
  211. K_HELP    equ    (FUNCTION OR  15)
  212. K_DO      equ    (FUNCTION OR  16)
  213. K_F17     equ    (FUNCTION OR  17)
  214. K_F18    equ     (FUNCTION OR  18)
  215. K_F19     equ    (FUNCTION OR  19)
  216. K_F20     equ    (FUNCTION OR  20)
  217. K_FIND    equ    (FUNCTION OR  21)
  218. K_INS     equ    (FUNCTION OR  22)
  219. K_REM     equ    (FUNCTION OR  23)
  220. K_SEL     equ    (FUNCTION OR  24)
  221. K_PREV    equ    (FUNCTION OR  25)
  222. K_NEXT    equ    (FUNCTION OR  26)
  223. K_UP      equ    (FUNCTION OR  27)
  224. ESC    equ    27
  225. K_LEFT    equ    (FUNCTION OR  28)
  226. K_DOWN    equ    (FUNCTION OR  29)
  227. K_RGHT    equ    (FUNCTION OR  30)
  228. K_K0    equ    (FUNCTION OR  31)
  229. K_KP1    equ    (FUNCTION OR  32)
  230. K_KP2    equ    (FUNCTION OR  33)
  231. K_KP3    equ    (FUNCTION OR  34)
  232. K_KP4    equ    (FUNCTION OR  35)
  233. K_KP5    equ    (FUNCTION OR  36)
  234. K_KP6    equ    (FUNCTION OR  37)
  235. K_KP7    equ    (FUNCTION OR  38)
  236. K_KP8    equ    (FUNCTION OR  39)
  237. K_KP9    equ    (FUNCTION OR  40)
  238. K_KQUO    equ    (FUNCTION OR  41)
  239. K_KMIN    equ    (FUNCTION OR  42)
  240. K_KDOT    equ    (FUNCTION OR  43)
  241. K_PF1     equ    (FUNCTION OR  44)
  242. K_PF2     equ    (FUNCTION OR  45)
  243. K_PF3     equ    (FUNCTION OR  46)
  244. K_PF4     equ    (FUNCTION OR  47)
  245. K_ENTER    equ    (FUNCTION OR  48)
  246. DEL    equ    0x7f
  247.  
  248. +ARCHIVE+ asmms.h       2630 11/24/1984 21:36:46
  249.  
  250.  
  251. ;***************************************************************************
  252. ;                                                                          *
  253. ;   Copyright (C) 1983,1984 by Microsoft Inc.                              *
  254. ;                                                                          *
  255. ;***************************************************************************
  256.  
  257. ;***************************************************************************
  258. ;                                                                          *
  259. ;   Header file for Microsoft mouse device driver.  Contains all machine   *
  260. ;   specific constant and data structure definitions.                      *
  261. ;                                                                          *
  262. ;***************************************************************************
  263.  
  264.  
  265.  
  266. ;-----------------------------------------------------------------------;
  267. ;
  268. ; Mouse equates
  269.  
  270.  
  271. mbfr struc            ;local buffer for comm input
  272.  
  273. count    dw    0
  274. size    dw    128-16
  275. ipntr    dw    ?
  276. opntr    dw    ?
  277. highw    dw    ?
  278. loww    dw    ?
  279. head    dw    ?
  280. tail    dw    ?
  281. mdata    dw    128-16 dup (?)
  282. mbfr ends
  283.  
  284. ctl_head struc        ;packet for IOCTL calls
  285.  
  286. funct    db    ?    ;function
  287. stat    db    ?    ;returned status
  288. char    db    ?    ;character
  289. cstat    db    ?    ;character status
  290. ctl_head ends
  291.  
  292. cpkt      struc        ;MOUSE interrupt condition packet "CONDITION_PACKET"
  293.  
  294. Movement    dw    ?        ;TRUE = movement has occurred
  295. S_button_rel    dw    0        ;secondary button release count
  296. S_button_dep    dw    0        ;secondary button depress count
  297. P_button_rel    dw    0        ;primary button release count
  298. P_button_dep    dw    0        ;primary button depress count
  299. Delta_x            dw    0    ;x delta factor (horizontal)
  300. Delta_y            dw    0    ;y delta factor (vertical)
  301. Cpkt    ends            ;
  302.  
  303.  
  304. mpkt    struc        ;MOUSE control packet  "MOUSE_PACKET"
  305.  
  306. P_button        dw    ?    ;TRUE = left or primary button act
  307. S_button        dw    ?    ;TRUE = right or secondary button
  308. T_button        dw    ?    ;TRUE = middle or tertiary button 
  309. Deltax            dw    0    ;x delta factor (horizontal)
  310. X_ratio            dw    0    ;x magnification factor (OPEN)
  311. X_threshold        dw    0    ;x speed limit          (OPEN)
  312. Deltay            dw    0    ;y delta factor (vertical)
  313. Y_ratio            dw    0    ;y magnification factor (OPEN)
  314. Y_threshold        dw    0    ;y speed limit          (OPEN)
  315. Immediate        dw    ?    ;TRUE = wait for input
  316. Enabled            dw    ?    ;TRUE = mouse OK to use
  317. Type            dw    0    ;mouse type - see MOUSETYPE
  318. Device            dw    0    ;port number MDM, PRT or AUX
  319. Port_name        db    5 dup(0);port name
  320. Handle            dw    0    ;device handle
  321. Bstate            dw    0    ;button state storage
  322. Programmed        dw    ?    ;TRUE = port programmed for Mouse
  323. New_vectors        dw    ?    ;TRUE = RCI vectored in
  324. Trace            dw    ?    ;TRUE = trace mode
  325. Mpkt    ends
  326.  
  327. +ARCHIVE+ assert.asm   11047 12/27/1984 16:19:58
  328. PAGE ,132
  329. TITLE ASSERT.ASM
  330. ;UPDATE HISTORY:
  331. ;===============
  332. ;14/11/84  convert to v2 ci86
  333. ;29/11/84  fix bug in repl mode
  334. ; 4 dec 84 move PATTERN.ASM into this program
  335. ;27 Dec 84 move delay loop from gdc_nb_ to fifo_mt_
  336.     include    asmc.h
  337.  
  338.     SEGEND    CODE
  339.  
  340.     SEGDEF    DATA
  341. include asmd.h
  342.     SEGEND    DATA
  343.  
  344.     SEGDEF    CODE
  345.  
  346. PUBLIC    gdc_nb_, fifo_mt_, g_off_, g_on_, a_mode_
  347. PUBLIC    a_fgbg_, a_alups_, a_gbmsk_, a_wmode_
  348. PUBLIC    a_patrn_
  349.  
  350.  
  351. ;********************************************************************
  352. ;*                                                                  *
  353. ;*      f u n c t i o n     gdc_nb()                                *
  354. ;*                                                                  *
  355. ;*      gdc_not_busy will put a harmless command into the GDC and   *
  356. ;*      wait for the command to be read out of the command FIFO.    *
  357. ;*      This means that the GDC is not busy doing a write or read   *
  358. ;*      operation.                                                  *
  359. ;*                                                                  *
  360. ;*      entry:          none                                        *
  361. ;*      exit:           ax = 0 if more than approx 74ms elapsed     *
  362. ;*                      without "gdc not busy"                      *
  363. ;********************************************************************
  364.  
  365.         PROCDEF gdc_nb_
  366.         call    fifo_mt_        ;wait for fifo to empty
  367. L2:     in      al,56H         ;wait for vert. or horiz. sync
  368.         and     al,60H
  369.         jz      L2
  370.         in      al,56H
  371.         and     al,8        ;is GDC still drawing ?
  372.         jnz     L2
  373.  
  374.         ret                     ;ax = 1  ==  TRUE
  375.         PROCEND gdc_nb_
  376.  
  377. ;This routine is in as a fast check that the GDC's fifo is empty but does
  378. ;not check anything else.
  379.  
  380.         PROCDEF  fifo_mt_
  381.         push    cx              ;use cx as a time-out loop counter.
  382.         mov     cx,8000H       ;wait for FIFO not full or reasonable time.
  383. L0:     in    al,56H        ;first check if the FIFO is full.
  384.         and     al,2
  385.         loopnz  L0
  386.  
  387.         mov     ax,40DH
  388.         out     57H,al
  389. L5:     in      al,56H
  390.         test    al,ah
  391.         jz      L5
  392.         pop     cx
  393.         ret
  394.         PROCEND  fifo_mt_
  395.  
  396. ;********************************************************************
  397. ;*                                                                  *
  398. ;*      f u n c t i o n      g_off_()                                *
  399. ;*                                                                  *
  400. ;*      purpose:        disable graphics output                     *
  401. ;*                                                                  *
  402. ;********************************************************************
  403.  
  404.         PROCDEF  g_off_
  405. exit_graf_:
  406.         and    BYTE PTR gbmod_,7FH  ;disable graphics output in gbmod
  407.         call    a_mode_              ;assert new mode register
  408.         mov    al,83H
  409.         out    0AH,al               ;turn off graphics on monochrome line
  410.         ret
  411.         PROCEND  g_off_
  412.  
  413. ;********************************************************************
  414. ;*                                                                  *
  415. ;*      f u n c t i o n      g_on_()                                 *
  416. ;*                                                                  *
  417. ;*      purpose:        enable graphics output                      *
  418. ;*                                                                  *
  419. ;********************************************************************
  420.  
  421.         PROCDEF  g_on_
  422. enter_graf_:
  423.         mov     al,BYTE PTR ws_number_   ;chk work_station loaded 
  424.         or      al,al
  425.         jz      Lam
  426.         mov    al,87H
  427.         out    0AH,al                   ;enable graphics on monochrome line
  428.         or    BYTE PTR gbmod_,80H      ;enable graphics output in gbmod
  429.         PROCEND  g_on_
  430.  
  431. ;********************************************************************
  432. ;*                                                                  *
  433. ;*      f u n c t i o n s     a_mode_()                             *
  434. ;*                                                                  *
  435. ;*      purpose:        set mode register to the value held in      *
  436. ;*                      gbmod                                       *
  437. ;*                                                                  *
  438. ;********************************************************************
  439.  
  440.         PROCDEF  a_mode_
  441.         mov     al,0BFH ;address the mode register through 
  442.         out     53H,al          ;the indirect register
  443.         mov     al,BYTE PTR gbmod_
  444.         out     51H,al          ;load the mode register
  445. Lam:    ret
  446.         PROCEND  a_mode_
  447.  
  448. ;*****************************************************************************
  449. ;*                                                                           *
  450. ;*       f u n c t i o n     a_fgbg_()                                        *
  451. ;*                                                                           *
  452. ;*       purpose:        Load the Foreground;Background Register             *
  453. ;*                                                                           *
  454. ;*****************************************************************************
  455.  
  456.         PROCDEF  a_fgbg_
  457.         mov    al, 0F7H    ;select the Foreground;Background Register
  458.         out    53H, al
  459.         mov    al, BYTE PTR fgbg_
  460.         out    51H, al        ;load the Foreground;Background Register
  461.         ret
  462.         PROCEND  a_fgbg_
  463.  
  464. ;*****************************************************************************
  465. ;*                                                                           *
  466. ;*       F U N C T I O N    a_alups_()                                        *
  467. ;*                                                                           *
  468. ;*       purpose:        Set the ALU ; Plane Select Register                 *
  469. ;*                                                                           *
  470. ;*****************************************************************************
  471.  
  472.         PROCDEF  a_alups_
  473.         mov    al,0EFH       ;select the ALU;PS Register
  474.         out    53H,al
  475.         mov    al, BYTE PTR alups_      ;move ALU;PS value to al
  476.         out    51H,al         ;load value into ALU;PS Register
  477.         ret
  478.         PROCEND  a_alups_
  479.  
  480. ;*****************************************************************************
  481. ;*                                                                           *
  482. ;*       F U N C T I O N    a_gbmsk_()                                        *
  483. ;*                                                                           *
  484. ;*       purpose:        Set the graphics board mask to values held          *
  485. ;*                       in gbmskl_ and gbmskh_                              *
  486. ;*                                                                           *
  487. ;*****************************************************************************
  488.  
  489.         PROCDEF  a_gbmsk_
  490.     mov    ax,WORD PTR gbmskl_      ;get the mask value to load
  491.     out    54H,al
  492.     mov    al, ah
  493.     out    55H,al
  494.     ret
  495.         PROCEND  a_gbmsk_
  496.  
  497. ;*****************************************************************************
  498. ;*                                                                           *
  499. ;*       F U N C T I O N    a_wmode_()                         *
  500. ;*                                                                           *
  501. ;*       purpose:       Juggle fgbg reg. & alups reg. to make GDC            *
  502. ;*                      write the correct colours in the correct             *
  503. ;*                      manner to the bit map.                               *
  504. ;*                                                                           *
  505. ;*****************************************************************************
  506.  
  507.         PROCDEF  a_wmode_
  508.     push    bp
  509.     mov     bp,sp
  510.  
  511.     call    gdc_nb_
  512.     mov     al,BYTE PTR ws_wmo_      ;get the write mode requested.
  513.     cmp     al,3            ;check for erase mode.
  514.     jz      La0
  515.     mov     cl,4
  516.     shl     al,cl
  517.     mov     ah,BYTE PTR alups_       ;get old alups
  518.     and     ah,0FH          ;mask off plane writes
  519.     or      al,ah           ;add to new write mode
  520.     mov     BYTE PTR alups_,al       ;and save.
  521.     call    a_alups_
  522.     mov     al,0F0H         ;enable fore_ground writes in case the last
  523.     jmp     La1             ;write mode was erase.
  524. La0:    mov     BYTE PTR alups_,0  ;put alu into replace mode, all planes.
  525.         call    a_alups_
  526.         xor     al,al           ;write zero's to all planes no matter what.
  527. La1:    mov     BYTE PTR fgbg_,al
  528.         call    a_fgbg_
  529.  
  530.         pop     bp
  531.         ret
  532.         PROCEND  a_wmode_
  533.  
  534.  
  535.  
  536. ;*****************************************************************************
  537. ;                                                                            *
  538. ;        f u n c t i o n    a_patrn_()                                        *
  539. ;                                                                            *
  540. ;        purpose:       Load the Pattern Multiplier and Pattern Register     *
  541. ;                       for line drawing.                                    *
  542. ;                                                                            *
  543. ;        caution:       You must load the Pattern Multiplier before          *
  544. ;                       loading the Pattern Register                         *
  545. ;                                                                            *
  546. ;*****************************************************************************
  547. ;
  548. ;The following are some register values and the corresponding output patterns 
  549. ;when the repeat factor is:
  550. ;
  551. ;                 1            2                    3
  552. ;    0FFh         |--------|   |----------------|   |------------------------|
  553. ;    0AAh         |- - - - |   |--  --  --  --  |   |---   ---   ---   ---   |
  554. ;    0F0h         |----    |   |--------        |   |------------            |
  555. ;    0CDh         |--  -- -|   |----    ----  --|   |------      ------   ---|
  556. ;
  557.     PROCDEF    a_patrn_
  558.         push    bx
  559.         push    cx
  560.  
  561.         mov     cl,BYTE PTR l_type_
  562.         xor     ch,ch
  563.         add     cx,cx
  564.         lea     bx,  pattbl_
  565.         add     bx,cx
  566.         mov     al,0FDH         ;select the Pattern Multiplier
  567.         out    53H, al
  568.         mov     al, 1[bx]
  569.         dec    al              ;adjust bl to be zero-relative
  570.         not    al              ;invert it [remember Pattern Register is
  571.                                 ;multiplied by 16 minus multiplier value]
  572.         and     al,0FH          ;load the Pattern Multiplier 
  573.         out    51H, al
  574.  
  575.         mov     al,0FBH ;select the Pattern Register
  576.         out     53H, al
  577.         mov     al, [bx]        ;get the pattern data
  578.         out     51H, al ;load the Pattern Register
  579.  
  580.         pop     cx
  581.         pop     bx
  582.         ret
  583.     PROCEND    a_patrn_
  584.  
  585.     include epilogue.h
  586.  
  587.     END
  588. +ARCHIVE+ cio.asm       1239 10/01/1983  0:01:30
  589. TITLE Comms port interrupt handler
  590. PAGE ,132
  591. ;***********************************************
  592. ;CIO.ASM      character processor for Mioctl
  593. ;***********************************************
  594.  
  595.  
  596. MBFR    STRUC            ;local buffer header for comm input
  597. count    dw    0
  598. size    dw    ?
  599. ipntr    dw    ?
  600. opntr    dw    ?
  601. highw    dw    ?
  602. loww    dw    ?
  603. head    dw    ?
  604. tail    dw    ?
  605. MBFR    ENDS
  606.  
  607. CTL_HEAD STRUC        ;packet for IOCTL calls
  608. funct    db    ?    ;function
  609. stat    db    ?    ;returned status
  610. char    db    ?    ;character
  611. cstat    db    ?    ;character status
  612. CTL_HEAD ENDS
  613.  
  614. include asmc.h                ;***V2***
  615.  
  616.  
  617.     PUBLIC    _Chaddr,_Chint
  618.     ASSUME    ES:NOTHING
  619.  
  620. ;***********************************************
  621. ; Receive Character Interrupt handler 
  622. ;***********************************************
  623.  
  624. _Chint    PROC    FAR
  625.     Cld            ;preserve machine state
  626.     Push    DS
  627.     Push    ES
  628.     Push    AX
  629.     Push    BX
  630.     Push    CX
  631.     Push    DX
  632.     Push    DI
  633.     Push    SI
  634.     Nop            ;NOWT
  635.     Pop    SI        ;restore state
  636.     Pop    DI
  637.     Pop    DX
  638.     Pop    CX
  639.     Pop    BX
  640.     Pop    AX
  641.     Pop    ES
  642.     Pop    DS
  643.     Ret
  644. _Chint    ENDP
  645.  
  646. ;***********************************************
  647. ;Return Address for C program
  648. ;***********************************************
  649.  
  650.     PROCDEF    _Chaddr
  651.     Mov    AX, CS:Cloc
  652.     Ret
  653. Cloc    Dw    _Chint
  654.     PROCEND    _Chaddr
  655.  
  656. include epilogue.h                ;***V2***
  657.  
  658.  
  659.     end
  660. +ARCHIVE+ circle.asm   14456 10/01/1983  0:46:58
  661. PAGE ,132
  662. ;CIRCLE.ASM
  663. ;14/11/84 convert to CI86 V2.2
  664.  
  665.     include    asmc.h
  666.  
  667.     SEGEND    CODE
  668.  
  669.     SEGDEF    DATA
  670.  
  671. EXTRN    gp_buff_:BYTE, gbmod_:BYTE
  672.  
  673. Lsin_cos_table    DW    0
  674.         DW             0FFFFH,  00477H,0FFF5H,  008EFH,0FFD7H,  00D65H,0FFA5H
  675.         DW      011DBH,0FF5FH,  0164FH,0FF05H,  01AC2H,0FE97H,  01F32H,0FE16H
  676.         DW      023A0H,0FD81H,  0280BH,0FCD8H,  02C74H,0FC1BH,  030D8H,0FB4AH
  677.         DW      03539H,0FA66H,  03996H,0F96FH,  03DEEH,0F864H,  04241H,0F745H
  678.         DW      0468FH,0F614H,  04AD8H,0F4CFH,  04F1BH,0F377H,  05358H,0F20CH
  679.         DW      0578EH,0F08EH,  05BBDH,0EEFEH,  05FE5H,0ED5AH,  06406H,0EBA5H
  680.         DW      0681FH,0E9DDH,  06C30H,0E802H,  07038H,0E616H,  07438H,0E418H
  681.         DW      0782EH,0E207H,  07C1BH,0DFE6H,  07FFFH,0DDB2H,  083D9H,0DB6EH
  682.         DW      087A8H,0D918H,  08B6CH,0D6B2H,  08F26H,0D43AH,  092D5H,0D1B3H
  683.         DW      09678H,0CF1AH,  09A0FH,0CC72H,  09D9BH,0C9BAH,  0A11AH,0C6F2H
  684.         DW      0A48DH,0C41AH,  0A7F2H,0C133H,  0AB4BH,0BE3EH,  0AE96H,0BB39H
  685.         DW      0B1D4H,0B825H,  0B504H,0B504H
  686.  
  687.                 ;enough room for 91 'xy' co-ordinates.
  688. Lpnts   DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  689.         DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  690.         DQ      0,0,0,0,0,0,0,0,0,0,0,0,0
  691.         DD      0
  692. Lc_flag DB      1               ;set to '1' for circles & '0' for arcs & segs.
  693.  
  694.     SEGEND    DATA
  695.  
  696.     SEGDEF    CODE
  697.  
  698. PUBLIC    circle_, arc_, segment_
  699.  
  700.     IF @bigmodel
  701. EXTRN    polyfill_:FAR
  702.     ELSE
  703. EXTRN    polyfill_:NEAR
  704.     ENDIF
  705.  
  706.  
  707. ;************************************************************************
  708. ;*                                                                      *
  709. ;*      F U N C T I O N    circle_(centre_x, centre_y, radius)           *
  710. ;*                                                                      *
  711. ;*      purpose:        draw a circle in either high or medium res      *
  712. ;*                      by computing 'xy' points and then use           *
  713. ;*                      polyfill[] to join them all up.                 *
  714. ;*                                                                      *
  715. ;*      entry:          8[bp] 'x' centre co-ordinate.                   *
  716. ;*                      10[bp] 'y' centre co-ordinate.                  *
  717. ;*                      12[bp] radius of circle on the 'y' axis.        *
  718. ;*                                                                      *
  719. ;************************************************************************
  720.  
  721.     PROCDEF    circle_
  722.         push    si
  723.         push    di
  724.         push    bp
  725.         mov     bp,sp
  726.         sub     sp,6            ;make working space
  727.  
  728.         mov     Lc_flag,1
  729.         call    Lmake_seg
  730.         lea     di, gp_buff_
  731.         mov     bx,8[bp]      ;'x' centre.
  732.         mov     dx,10[bp]      ;'y' centre.
  733.         call    Lquad0
  734.         call    Lquad1
  735.         call    Lquad2
  736.         call    Lquad3
  737.         lea     si, gp_buff_
  738.         lodsw
  739.         stosw
  740.         lodsw
  741.         stosw
  742.  
  743.         lea     ax, gp_buff_
  744.         push    ax
  745.         mov     ax,-2[bp]       ;number of 'xy' points in a segment.
  746.         shl     ax,1
  747.         shl     ax,1
  748.         inc     ax
  749.         push    ax
  750.         call    polyfill_
  751.         
  752.         mov     sp,bp
  753.         pop     bp
  754.         pop     di
  755.         pop     si
  756.         ret
  757.  
  758. Lquad0: lea     si, Lpnts
  759.         mov     cx,-2[bp]
  760. Lq0:    lodsw
  761.         add     ax,bx
  762.         stosw
  763.         lodsw
  764.         add     ax,dx
  765.         stosw
  766.         loop    Lq0
  767.         ret
  768.  
  769. Lquad1:
  770.         mov     cx,-2[bp]
  771.         mov     ax,cx
  772.         shl     ax,1
  773.         shl     ax,1
  774.         lea     si, Lpnts-4
  775.         add     si,ax
  776. Lq1:    lodsw
  777.         add     ax,bx
  778.         stosw
  779.         mov     ax,dx
  780.         sub     ax,[si]
  781.         stosw
  782.         sub     si,6
  783.         loop    Lq1
  784.         ret
  785.  
  786. Lquad2: lea     si, Lpnts
  787.         mov     cx,-2[bp]
  788. Lq2:    mov     ax,bx
  789.         sub     ax,[si]
  790.         stosw
  791.         add     si,2
  792.         mov     ax,dx
  793.         sub     ax,[si]
  794.         stosw
  795.         add     si,2
  796.         loop    Lq2
  797.         ret
  798.  
  799. Lquad3:
  800.         mov     cx,-2[bp]
  801.         mov     ax,cx
  802.         shl     ax,1
  803.         shl     ax,1
  804.         lea     si, Lpnts-4
  805.         add     si,ax
  806. Lq3:    mov     ax,bx
  807.         sub     ax,[si]
  808.         stosw
  809.         mov     ax,dx
  810.         add     ax,2[si]
  811.         stosw
  812.         sub     si,4
  813.         loop    Lq3
  814.         ret
  815.     PROCEND    circle_
  816.  
  817. ;************************************************************************
  818. ;*                                                                      *
  819. ;*      F U N C T I O N    arc_(x, y, radius, start_deg, end_deg)        *
  820. ;*                                                                      *
  821. ;*      purpose:        draw the ARC specified. Start & end degrees     *
  822. ;*                      are specified as integers in the range:         *
  823. ;*                              0 to 359                                *
  824. ;*                                                                      *
  825. ;*      entry:           8[bp]  centre 'x'                              *
  826. ;*                      10[bp]  centre 'y'                              *
  827. ;*                      12[bp]  radius                                  *
  828. ;*                      14[bp]  arc starting vector                     *
  829. ;*                      16[bp]  arc ending vector                       *
  830. ;*                                                                      *
  831. ;************************************************************************
  832.  
  833.     PROCDEF    arc_
  834.         push    si
  835.         push    di
  836.         push    bp
  837.         mov     bp,sp
  838.         sub     sp,6
  839.  
  840.         call    Larc
  841.  
  842.         push    di
  843.         push    bx
  844.         call    polyfill_
  845.  
  846.         mov     sp,bp
  847.         pop     bp
  848.         pop     di
  849.         pop     si
  850.         ret
  851.     PROCEND    arc_
  852.  
  853. ;************************************************************************
  854. ;*                                                                      *
  855. ;*      F U N C T I O N    segment_(x, y, radius, start_deg, end_deg)    *
  856. ;*                                                                      *
  857. ;*      purpose:        draw the SEGMENT as in arc() above but join     *
  858. ;*                      the ends of the arc to the centre point.        *
  859. ;*                                                                      *
  860. ;************************************************************************
  861.  
  862.     PROCDEF    segment_
  863.         push    si
  864.         push    di
  865.         push    bp
  866.         mov     bp,sp
  867.         sub     sp,6
  868.  
  869.         call    Larc
  870.  
  871.         mov     cx,bx           ;CX = # of points to plot.
  872.         add     cx,2
  873.         mov     si,di           ;DI points to the start of the array, so
  874.         shl     bx,1            ;make SI point to the end of the array.
  875.         shl     bx,1
  876.         add     si,bx
  877.         sub     di,4
  878.         mov     ax,8[bp]        ;get centre 'x'.
  879.         mov     [di],ax         ;put at start & end of array.
  880.         mov     [si],ax
  881.         mov     ax,10[bp]       ;get centre 'y'.
  882.         mov     2[di],ax        ;put at start & end of array.
  883.         mov     2[si],ax
  884.  
  885.         push    di
  886.         push    cx
  887.         call    polyfill_
  888.  
  889.         mov     sp,bp
  890.         pop     bp
  891.         pop     di
  892.         pop     si
  893.         ret
  894.     PROCEND    segment_
  895.  
  896.  
  897. ;************************************************************************
  898. ;*                                                                      *
  899. ;*      The following are the various common subroutines used by        *
  900. ;*      circle(), arc() and segment().                                  *
  901. ;*                                                                      *
  902. ;************************************************************************
  903.  
  904. ; Subroutine to fill 'Lpnts' with a 0,0 origined segment.
  905. ; This allows for aspect ratio differences between high & medium res.
  906.  
  907.     PROCDEF    Lmake_seg
  908.         mov     cx,46           ;length of sin_cos_table
  909.         inc     WORD PTR 12[bp]
  910.         mov     bx,12[bp]       ;get radius.
  911.         lea     di, Lpnts ;set destination as 'Lpnts' array.
  912.         lea     si, Lsin_cos_table        ;set source as look-up table.
  913.         cld
  914.  
  915. Lm0:    lodsw                   ;get look-up table 'x' value.    16
  916.         mul     bx              ;multiply by radius.            133  max
  917.         mov     ax,dx           ;get integer part                 2
  918.         stosw                   ;and place in 'Lpnts' array.     15
  919.         lodsw                   ;get look-up table 'y' value.    16
  920.         mul     bx              ;multiply by radius.            133  max
  921.         mov     ax,dx           ;get integer part                 2
  922.         stosw                   ;and place in 'Lpnts' array.     15
  923.         loop    Lm0             ;                                17
  924. ;                                                            ------------------
  925. ;       TOTAL LOOP TIME = 3.280ms max                        [351 x 45] ; 4.815
  926. ;
  927.  
  928. ; Juggle the octant to make a quadrant.
  929.  
  930.         mov     cx,90           ;number of 'x' and 'y' co-ords. in 2nd. octant.
  931.         mov     si,di
  932.         sub     si,2
  933. Lm3:    sub     si,4             ;point SI to 44 deg. entry in 'Lpnts'.
  934.         lodsw                   ;'shadow image' octant 0 into octant 1.
  935.         stosw
  936.         loop    Lm3
  937.  
  938.         test    Lc_flag,1       ;are we drawing a circle 0
  939.         jnz     Lm1             ;remove common points if we are.
  940.         mov     bx,91
  941.         jmp     Lm2             ;number of 'xy' points in 'Lpnts'.
  942.  
  943. ; We now have the first octant computed with an origin at 0,0 so
  944. ; now remove any common points in the 'Lpnts' array
  945.  
  946. Lm1:    lea     si, Lpnts
  947.         mov     di,si           ;point di to start of 'Lpnts' array.
  948.         add     si,4            ;point si to second 'xy' pair.
  949.         mov     cx,90           ;number of pairs in one quadrant minus 1.
  950.         mov     bx,1            ;take account of first pair.
  951.         call    Lreduce
  952.  
  953. Lm2:    mov     -2[bp],bx
  954.         test    BYTE PTR gbmod_,1        ;are we in high res. mode 0
  955.         jz      Lm5                      ;skip if in medium res.
  956.         mov     cx,bx
  957.         lea     si, Lpnts          ;point to begining of 'xy' array.
  958. Lm4:    shl     WORD PTR [si],1          ;multiply 'x' value by 2.
  959.         add     si,4
  960.         loop    Lm4
  961.  
  962. Lm5:    ret
  963.     PROCEND    Lmake_seg
  964.  
  965. ; Common subroutine for segment[] & arc[] to generate the specified arc using
  966. ; the circle drawing routines. Nothing set up on entry. Leaves with the arc
  967. ; reduced to a minimum number of points & BX = #points, DI = start_offset  in
  968. ; gp_buff.
  969.  
  970.     PROCDEF    Larc
  971.         mov     Lc_flag,0
  972.         call    Lmake_seg
  973.         call    Lgen_arc
  974.         xor     dx,dx           ;set up for division.
  975.         mov     ax,14[bp]
  976.         mov     bx,90
  977.         div     bx
  978.         mov     ax,dx           ;AX = start_deg % 90
  979.         lea     di, gp_buff_+4
  980.         shl     ax,1
  981.         shl     ax,1
  982.         add     di,ax           ;DI now points at the starting deg.
  983.  
  984.         mov     ax,16[bp]       ;get end deg.
  985.         cmp     ax,14[bp]
  986.         jns     La0             ;skip if end is > start.
  987.         mov     ax,14[bp]
  988.         sub     ax,360
  989.         neg     ax
  990.         add     ax,16[bp]
  991.         jmp     La1
  992. La0:    sub     ax,14[bp]
  993. La1:    mov     cx,ax           ;CX now has the absolute number of points to
  994.                                 ;plot for the arc.
  995.  
  996. ; Having done all the hard parts, we can now reduce the number of points to
  997. ; a minimum.
  998.  
  999.         push    di              ;save the starting offset .
  1000.         mov     si,di
  1001.         add     si,4
  1002.         mov     bx,1
  1003.         call    Lreduce         ;reduce bp_buff array. BX returns the number
  1004.                                 ;of points in the array.
  1005.         pop     di
  1006.         ret
  1007.     PROCEND    Larc
  1008.  
  1009.  
  1010. ; This subroutine enters with the destination for the 'xy' points in DI
  1011. ; and leaves with DI pointing past the end of the array.
  1012.  
  1013.     PROCDEF    Lgen_arc
  1014.         lea     di, gp_buff_+4
  1015.         mov     ax,16[bp]       ;get end deg.
  1016.         cmp     ax,14[bp]
  1017.         jns     Lg0             ;skip if end is > start.
  1018.         mov     ax,14[bp]
  1019.         sub     ax,360
  1020.         neg     ax
  1021.         add     ax,16[bp]
  1022.         jmp     Lg1
  1023.  
  1024. Lg0:    sub     ax,14[bp]       ;find the number of segments to plot.
  1025. Lg1:    xor     dx,dx
  1026.         mov     bx,90
  1027.         div     bx
  1028.         inc     ax
  1029.         mov     cx,ax
  1030.  
  1031.         mov     ax,14[bp]       ;where do we start ?
  1032.         mov     bx,8[bp]        ;'x' centre.
  1033.         mov     dx,10[bp]       ;'y' centre.
  1034. Lg2:    push    ax
  1035.         push    cx
  1036.         cmp     ax,90
  1037.         jns     Lg3
  1038.         call    Lquad0          ;do the first quadrant points.
  1039.         jmp     Lg6
  1040. Lg3:    cmp     ax,180
  1041.         jns     Lg4
  1042.         call    Lquad1          ;do the second quadrant.
  1043.         jmp     Lg6
  1044. Lg4:    cmp     ax,270
  1045.         jns     Lg5
  1046.         call    Lquad2          ;do the third quadrant.
  1047.         jmp     Lg6
  1048. Lg5:    call    Lquad3          ;do the last quadrant.
  1049. Lg6:    pop     cx
  1050.         pop     ax
  1051.         add     ax,90
  1052.         cmp     ax,360
  1053.         js      Lg7
  1054.         neg     ax
  1055. Lg7:    loop    Lg2
  1056.         ret
  1057.     PROCEND    Lgen_arc
  1058.  
  1059. ; Subroutine to take an array of 'xy' points and remove any common points.
  1060. ; Enters with:  DI = first 'x' co-ordinate
  1061. ;               SI = second 'x' co-ordinate
  1062. ; Exits with:   BX = number of points left in the array
  1063.  
  1064.     PROCDEF    Lreduce
  1065.         mov     ax,[si]         ;get second 'x' value.
  1066.         cmp     ax,[di]         ;compare it with first 'x' value.
  1067.         jnz     Lr0             ;skip if not the same.
  1068.         mov     ax,2[si]                ;get second 'y' value.
  1069.         cmp     ax,2[di]        ;compare it with first 'y' value.
  1070.         jnz     Lr0             ;skip if not the same.
  1071.  
  1072.         add     si,4            ;advance si to next 'xy' pair.
  1073.         loop    Lreduce
  1074.         ret
  1075.  
  1076. Lr0:    add     di,4
  1077.         lodsw
  1078.         stosw
  1079.         lodsw
  1080.         stosw
  1081.         sub     di,4
  1082.         inc     bx              ;once more into the array dear friends!
  1083.         loop    Lreduce
  1084.     ret
  1085.     PROCEND    Lreduce
  1086.  
  1087.     include    epilogue.h
  1088.  
  1089.     END
  1090. +ARCHIVE+ color.asm    12977 10/01/1983  1:13:02
  1091. PAGE ,132
  1092. ;COLOR.ASM
  1093. ;UPDATE HISTORY
  1094. ;==============
  1095. ; 27-sep-84    add 100a support                    [1]
  1096. ; 14-NOV-84    Convert to CI86 V2.2
  1097.  
  1098.     include    asmc.h
  1099.  
  1100.     SEGEND    CODE
  1101.  
  1102.     SEGDEF    DATA
  1103.  
  1104. EXTRN    clmpda_:BYTE, gbmod_:BYTE, ws_number_:BYTE, ws_wmo_:BYTE, fgbg_:BYTE
  1105. EXTRN    gintvect_:WORD                            ;[1]
  1106. EXTRN    old_int_off:WORD, old_int_seg:WORD, int_done:BYTE
  1107.  
  1108. L0      DW      L1, L2, L3, L4, L5, L6, L7, L8
  1109.         DW      L9, L10, L11, L12, L13, L14, L15, L16
  1110.  
  1111.     SEGEND    DATA
  1112.  
  1113.     SEGDEF    CODE
  1114.  
  1115. PUBLIC    color_, grey_, a_cmap_, chk_col_
  1116.  
  1117.     IF    @bigmodel
  1118. EXTRN    gdc_nb_:FAR, a_mode_:FAR, a_fgbg_:FAR
  1119. EXTRN    dseg_sav:FAR, eseg_sav:FAR
  1120.     ELSE
  1121. EXTRN    gdc_nb_:NEAR, a_mode_:NEAR, a_fgbg_:NEAR
  1122. EXTRN    dseg_sav:NEAR, eseg_sav:NEAR
  1123.     ENDIF
  1124.  
  1125.  
  1126. ;************************************************************************
  1127. ;*                                                                      *
  1128. ;*              f u n c t i o n   color_(index, red, green, blue)        *
  1129. ;*                                                                      *
  1130. ;*  purpose: change a color in the colormap.                            *
  1131. ;*  entry:     8[bp] colour index -- 0 to 15                            *
  1132. ;*            10[bp] red value       0 to 15                            *
  1133. ;*            12[bp] green value     0 to 15                            *
  1134. ;*            14[bp] blue value      0 to 15                            *
  1135. ;*                                                                      *
  1136. ;*  exit:    none                                                       *
  1137. ;*                                                                      *
  1138. ;************************************************************************
  1139.  
  1140.     PROCDEF    color_
  1141.         push    si
  1142.         push    di
  1143.         push    bp
  1144.         mov     bp,sp
  1145.  
  1146.         mov     ax,cs:WORD PTR eseg_sav
  1147.         mov     es,ax
  1148.         lea     di,  clmpda_              ;colormap shadow.
  1149.         mov     bx,8[bp]    ;get colour number.
  1150.         test    BYTE PTR gbmod_,1        ;high res?
  1151.         jz      L17a            ;jump if not.
  1152.         and     bx,3          ;only allow colours 0 - 3 in high res.
  1153. L17a:   add     di, bx          ;get offset 
  1154.         lea     bx, L0
  1155.         mov     al,BYTE PTR ws_number_   ;make ws_number zero relative.
  1156.         dec     al
  1157.        and    al,7
  1158.         shl     al,1            ;convert to WORD offset.
  1159.         xor     ah,ah
  1160.         add     bx,ax           ;make offset  into jump table.
  1161.         jmp     [bx]            ;returns with red;green in cl - grey;blue in ch
  1162.  
  1163. L17:    cld
  1164.         mov     al,cl
  1165.         stosb
  1166.         add     di,15                   ;adjust pointer
  1167.         mov     al,ch
  1168.         stosb
  1169.         call    a_cmap_
  1170.  
  1171. L18:    pop     bp
  1172.         pop     di
  1173.         pop     si
  1174.         ret
  1175.  
  1176. ;************************************************************************
  1177. ;*                                                                      *
  1178. ;*      MEDIUM & HIGH RES. MONOCHROME                                   *
  1179. ;*                                                                      *
  1180. ;*      Monochrome value becomes the logical OR of red, green & blue    *
  1181. ;*                                                                      *
  1182. ;************************************************************************
  1183.  
  1184. L1:
  1185. L2:     mov     ax,10[bp]      ;get red value
  1186.         or      al,BYTE PTR 12[bp]      ;add in green value
  1187.         or      al,BYTE PTR 14[bp]      ;and then blue value
  1188.         mov     cx,08[bp]      ;get grey index
  1189.         push    ax
  1190.         push    cx
  1191.         call    grey_
  1192.         add     sp,4
  1193.         jmp     L18
  1194.  
  1195. ;************************************************************************
  1196. ;*                                                                      *
  1197. ;*      MEDIUM & HIGH RES. COLOUR                                       *
  1198. ;*                                                                      *
  1199. ;*      Green value is mapped into grey slot. Grey scale is unused.     *
  1200. ;*                                                                      *
  1201. ;************************************************************************
  1202.  
  1203. L3:
  1204. L4:     mov     al,BYTE PTR 12[bp]      ;get green value
  1205.         xor     al,0FFH
  1206.         add     al,16
  1207.         mov     cl,4            ;move it to color_maps grey position.
  1208.         shl     al,cl
  1209.         mov     ah,BYTE PTR 14[bp]      ;get blue value.
  1210.         xor     ah,0FFH
  1211.         add     ah,16
  1212.         or      al,ah
  1213.         mov     ch,al
  1214.  
  1215.         mov     al,BYTE PTR 10[bp]      ;get red value
  1216.         xor     al,0FFH
  1217.         add     al,16
  1218.         mov     cl,4
  1219.         shl     al,cl
  1220.         or      al,0FH  ;fill grey scale to reduce RFI.
  1221.         mov     cl,al
  1222.         jmp     L17             ;return with values adjusted.
  1223.  
  1224. ;************************************************************************
  1225. ;*                                                                      *
  1226. ;*      MEDIUM & HIGH RES. DUAL MONITOR                                 *
  1227. ;*                                                                      *
  1228. ;*      All colours are mapped to their correct slots but grey scale    *
  1229. ;*      needs to be set independently. offset  see grey() }             *
  1230. ;*                                                                      *
  1231. ;************************************************************************
  1232.  
  1233. L5:
  1234. L6:     mov     al,BYTE PTR 10[bp]      ;get red value
  1235.         xor     al,0FFH
  1236.         add     al,16
  1237.         mov     cl,4
  1238.         shl     al,cl
  1239.         mov     ah,BYTE PTR 12[bp]      ;get green value.
  1240.         xor     ah,0FFH
  1241.         add     ah,16
  1242.         or      al,ah
  1243.         mov     cl,al
  1244.  
  1245.         mov     ch,BYTE PTR 14[bp]      ;get blue value
  1246.         xor     ch,0FFH
  1247.         add     ch,16
  1248.         mov     al,BYTE PTR 16[di]       ;get old grey;blue data
  1249.         and     al,0F0H     ;remove old blue
  1250.         or      ch,al           ;mix grey & new blue
  1251.         jmp     L17             ;return with values adjusted.
  1252.  
  1253. ;************************************************************************
  1254. ;*                                                                      *
  1255. ;*      EXPANSION SLOTS FOR PRINTER AND PLOTTER DRIVERS                 *
  1256. ;*                                                                      *
  1257. ;************************************************************************
  1258.  
  1259. L7:
  1260. L8:
  1261. L9:
  1262. L10:
  1263. L11:
  1264. L12:
  1265. L13:
  1266. L14:
  1267. L15:
  1268. L16:    jmp     L17
  1269.  
  1270.     PROCEND    color_
  1271.  
  1272. ;************************************************************************
  1273. ;*                                                                      *
  1274. ;*              f u n c t i o n   grey_(index, value)                    *
  1275. ;*                                                                      *
  1276. ;*  purpose: Change the colour maps grey scale. This is provided for    *
  1277. ;*           dual monitor systems which need to vary the grey scale     *
  1278. ;*           independently from the colour scales.                      *
  1279. ;*           Also used to set grey levels on monochrome only systems.   *
  1280. ;*                                                                      *
  1281. ;*  entry:   08[bp] colour index....0 to 15                             *
  1282. ;*           10[bp] grey value......0 to 15                             *
  1283. ;*                                                                      *
  1284. ;************************************************************************
  1285.  
  1286.     PROCDEF    grey_
  1287.         push    di
  1288.         push    bp
  1289.         mov     bp,sp
  1290.  
  1291.         mov     ax,cs:WORD PTR eseg_sav
  1292.         mov     es,ax
  1293.         cld
  1294.         lea     di,  clmpda_              ;colormap shadow.
  1295.         add     di, 16
  1296.         add     di, 6[bp]             ;get index offset 
  1297.         mov     ax, 8[bp]             ;get new grey value
  1298.         xor     al,0FFH
  1299.         add     al,16
  1300.         mov     cl,4
  1301.         shl     al, cl                  ;mov to upper nibble.
  1302.         mov     ah,BYTE PTR [di]                 ;get old grey;blue values.
  1303.         and     ah,0FH          ;remove grey value
  1304.         or      al,ah                   ;and replace with the new value.
  1305.         stosb
  1306.         call    a_cmap_
  1307.  
  1308.         pop     bp
  1309.         pop     di
  1310.         ret
  1311.     PROCEND    grey_
  1312.  
  1313. ;********************************************************************
  1314. ;                                                                   *
  1315. ;       s u b r o u t i n e    a s s e r t _ c o l o r m a p        *
  1316. ;                                                                   *
  1317. ;       colormap is located at clmpda which is defined in           *
  1318. ;       openws()                                                    *
  1319. ;                                                                   *
  1320. ;       entry:          clmpda holds new colour data to be loaded   *
  1321. ;       exit:           none                                        *
  1322. ;                                                                   *
  1323. ;********************************************************************
  1324.  
  1325.     PROCDEF    a_cmap_
  1326.         cld
  1327.  
  1328.         push    es
  1329.         xor     ax,ax
  1330.         mov     es,ax
  1331.         mov     bx,WORD PTR gintvect_   ;fetch address of "giv"        [1]
  1332.         cli                             ;temp. disable interrupts
  1333.         mov     ax,es:[bx]              ;read the old offset 
  1334.         mov     WORD PTR old_int_off,ax
  1335.         mov     ax,es:2[bx]             ;read the old segment
  1336.         mov     WORD PTR old_int_seg,ax
  1337.         mov     es:WORD PTR [bx],OFFSET color_int        ;load new offset.
  1338.         mov     ax,cs
  1339.         mov     es:WORD PTR 2[bx],ax    ;load new int segment
  1340.         sti                             ;re-enable interrupts
  1341.         pop     es
  1342.         mov    BYTE PTR int_done,0              ;clear interrupt flag
  1343.         or    BYTE PTR gbmod_,40H              ;enable graphics interrupt
  1344.         call    gdc_nb_
  1345.         call    a_mode_
  1346. L20:    test    BYTE PTR int_done,0FFH           ;has interrupt routine run?
  1347.         jz      L20
  1348.         push    es                      ;restore interrupt vectors
  1349.         xor     ax,ax
  1350.         mov     es,ax
  1351.         mov     bx,WORD PTR gintvect_   ;fetch graphics vector offset    [1]
  1352.         cli
  1353.         mov     ax,WORD PTR old_int_off ;restore old interrupt vector
  1354.         mov     es:WORD PTR [bx],ax
  1355.         mov     ax,WORD PTR old_int_seg
  1356.         mov     es:WORD PTR 2[bx],ax
  1357.         sti
  1358.         pop     es
  1359.         cld                             ;make lods inc si
  1360.         ret
  1361.     PROCEND    a_cmap_
  1362.  
  1363. ;************************************************************************
  1364. ;*                                    *
  1365. ;*            colour interupt handler                *
  1366. ;*                                    *
  1367. ;************************************************************************
  1368.  
  1369. colourint PROC  FAR
  1370. color_int:
  1371.         push    es
  1372.         push    ds
  1373.         push    si
  1374.         push    cx
  1375.         push    ax
  1376.         mov     ax,cs:WORD PTR dseg_sav ;can't depend on es or ds 
  1377.         mov     ds,ax                   ;reload segment registers
  1378.         mov     ax,cs:WORD PTR eseg_sav
  1379.         mov     es,ax
  1380.         cld
  1381.         and    BYTE PTR gbmod_,0BFH             ;disable graphics interrupts
  1382.         call    a_mode_
  1383.         lea     si, clmpda_               ;fetch color source
  1384.         mov    al,0DFH         ;get the color map's attention
  1385.         out    53H,al
  1386.         mov     cx,16           ;32 color map entries
  1387. L21:    lodsw                           ;fetch current color map data
  1388.         out    51H,al          ;load color map
  1389.         mov     al,ah
  1390.         out     51H,al
  1391.         loop    L21                     ;loop until all color map data loaded
  1392.         mov    BYTE PTR int_done,0FFH           ;set "interrupt done" flag
  1393.         pop     ax
  1394.         pop     cx
  1395.         pop     si
  1396.         pop     ds
  1397.         pop     es
  1398.         iret
  1399. colourint ENDP
  1400.  
  1401. ;************************************************************************
  1402. ;*                                                                      *
  1403. ;*      s u b r o u t i n e     chk_col_                                 *
  1404. ;*                                                                      *
  1405. ;*      purpose:        check and set line, text, fill or marker        *
  1406. ;*                      colours.                                        *
  1407. ;*                                                                      *
  1408. ;*      entry:          al contains colour to be set to.                *
  1409. ;*                                                                      *
  1410. ;************************************************************************
  1411.  
  1412.     PROCDEF    chk_col_
  1413.         cmp     BYTE PTR ws_wmo_,3       ;check to see if we are in ERASE mode.
  1414.         jz      L30             ;quit if yes.
  1415.         mov     cl,4
  1416.         shl     al,cl
  1417.         mov     BYTE PTR fgbg_,al
  1418.         call    a_fgbg_
  1419. L30:    ret
  1420.     PROCEND    chk_col_
  1421.  
  1422.     include    epilogue.h
  1423.     END
  1424. +ARCHIVE+ creq.c        6641 12/13/1984 17:25:56
  1425. /***********************************************************/
  1426. /*                                                         */
  1427. /*  I/O requests - use host language                       */
  1428. /*                                                         */
  1429. /***********************************************************/
  1430. #include <stdio.h>
  1431. #include <graph.h>
  1432.  
  1433. static char *notice =
  1434.  
  1435.     "MSDOS Graphics Library 2.10 13-Dec-84 (c) Digital Equipment Co. Ltd.\n";
  1436.  
  1437. static char *wsdrivers[] = {
  1438.     /*01*/    "SMIDMON.GRA",
  1439.     /*02*/    "SHIGHMON.GRA",
  1440.     /*03*/    "SMIDCOL.GRA",
  1441.     /*04*/    "SHIGHCOL.GRA",
  1442.     /*05*/    "DMID.GRA",
  1443.     /*06*/    "DHIGH.GRA"
  1444.     };
  1445.  
  1446. /************************************************************************/
  1447. /*                                                                      */
  1448. /*      F U N C T I O N    ld_font_(font_fn, font_number)                */
  1449. /*                         char *font_fn;                                */
  1450. /*                         int  font_number;                            */
  1451. /*                                                                      */
  1452. /*      purpose:        load data in a file into one of the graphics    */
  1453. /*                      font arrays.                                    */
  1454. /*                                                                      */
  1455. /*      entry:          font_fn is the name of the file.                */
  1456. /*                      font_number number to be loaded. [0 to 3]       */
  1457. /*                                                                      */
  1458. /*      exit:           NULL if font loaded OK.                         */
  1459. /*                      EOF if font data file could not be found.       */
  1460. /*                                                                      */
  1461. /************************************************************************/
  1462. ld_font_(font_fn,font_number)
  1463. char *font_fn;
  1464. int   font_number;
  1465.  
  1466. {  FILE *ffile;
  1467.    int i;
  1468.    fprintf(stderr,"LD_FONT #%-d %s\n",font_fn);
  1469.    if( (ffile = fopen(font_fn,"rb")) == NULL) {
  1470.     fprintf(stderr,"cannot open font file %s\n",font_fn);
  1471.     return(EOF);
  1472.     }
  1473.    if ( (i = fread(tfonts_[font_number][0][0],96,10,ffile)) == NULL
  1474.       || i < 10) {
  1475.     fprintf(stderr,"Incomplete read %2d font file %s\n",i,font_fn);
  1476.     return(EOF);
  1477.     }
  1478.    fclose(ffile);
  1479.    return(NULL);
  1480. }
  1481.  
  1482. /************************************************************************/
  1483. /*                                                                      */
  1484. /*      F U N C T I O N    ld_wsdets_()                                  */
  1485. /*                                                                      */
  1486. /*      purpose:        load workstation data from file                 */
  1487. /*                                                                      */
  1488. /*      entry:          <ws_number_> number to be loaded. [1 to 6]      */
  1489. /*                                                                      */
  1490. /*      exit:           NULL workstation loaded OK.                     */
  1491. /*                      EOF if workstation file could not be found.     */
  1492. /*                                                                      */
  1493. /************************************************************************/
  1494. ld_wsdets_()
  1495. {  FILE *wfile;
  1496.    int i,ws;
  1497.  
  1498.    fprintf(stderr,notice);
  1499.    if ( (ws = ws_number_) ==0 || ws > 6) {
  1500.     fprintf(stderr,"Workstation %d out of range\n",ws);
  1501.     return(EOF);
  1502.     }
  1503.    if ( (wfile = fopen(wsdrivers[--ws],"rb")) == NULL) {
  1504.     fprintf(stderr,"Cannot open Workstation file %s\n",wsdrivers[ws]);
  1505.     return(EOF);
  1506.     }
  1507.    i = fread(ws_data_,1792,1,wfile);
  1508.    fclose(wfile);
  1509.    return(NULL);
  1510.  
  1511. }
  1512.  
  1513. /************************************************************************/
  1514. /*                                                                      */
  1515. /*      F U N C T I O N    malloc_(bytes)                               */
  1516. /*                         int bytes;                                   */
  1517. /*                                                                      */
  1518. /*      purpose:        allocate temp memory in stack space             */
  1519. /*                                                                      */
  1520. /*      entry:          bytes  #bytes to alloc                          */
  1521. /*                                                                      */
  1522. /*      exit:           NULL no core.                                   */
  1523. /*                      offset (in DS) of allocated memory.             */
  1524. /*                                                                      */
  1525. /************************************************************************/
  1526.  
  1527. char *malloc_(bytes)
  1528. unsigned int bytes;
  1529. { char *temp;
  1530.    if( (temp = malloc(bytes)) == NULL)
  1531.     fprintf(stderr,"Cannot allocate memory\n");
  1532.    return(temp);
  1533. }
  1534.  
  1535. /************************************************************************/
  1536. /*                                                                      */
  1537. /*      F U N C T I O N    free_(area)                                  */
  1538. /*                                                                      */
  1539. /*      purpose:        release stack space memory after malloc_ call   */
  1540. /*                                                                      */
  1541. /*      entry:          area  mem pointer of area given by malloc_      */
  1542. /*                                                                      */
  1543. /*      exit:           none.                                           */
  1544. /*                                                                      */
  1545. /************************************************************************/
  1546.  
  1547. free_(area)
  1548. unsigned char *area;
  1549. {
  1550.        free(area);
  1551. }
  1552.  
  1553. /************************************************************************/
  1554. /*                                                                      */
  1555. /*      F U N C T I O N    conout_(char)                                */
  1556. /*                                                                      */
  1557. /*      purpose:        output character to console                     */
  1558. /*                                                                      */
  1559. /*      entry:          char to be output                               */
  1560. /*                                                                      */
  1561. /*      exit:           none.                                           */
  1562. /*                                                                      */
  1563. /************************************************************************/
  1564.  
  1565. conout_(c)
  1566. unsigned char c;
  1567. {
  1568.        fprintf(stderr,"%c",c);
  1569. }
  1570. +ARCHIVE+ cxy2cp.asm    2899 12/27/1984 15:56:38
  1571. PAGE ,132
  1572. title CXY2CP.ASM
  1573. ;UPDATE HISTORY
  1574. ;==============
  1575. ;14 nov 84    Convert to CI86 V2.2
  1576. ;29 nov 84    adjust list format to 132 width
  1577. ;27 dec 84    clear DX for big maths
  1578.     include    asmc.h
  1579.  
  1580.     SEGEND    CODE
  1581.  
  1582.     SEGDEF    DATA
  1583. include asmd.h
  1584.     SEGEND    DATA
  1585.  
  1586.     SEGDEF    CODE
  1587.  
  1588. PUBLIC    cxy2cp_, a_cur_
  1589.  
  1590.     IF    @bigmodel
  1591. EXTRN    fifo_mt_:FAR
  1592.     ELSE
  1593. EXTRN    fifo_mt_:NEAR
  1594.     ENDIF
  1595.  
  1596. ;********************************************************************
  1597. ;*                                                                  *
  1598. ;*      f u n c t i o n s    cxy2cp_()  a_cur_()                      *
  1599. ;*                                                                  *
  1600. ;*      CXY2CP takes the x_start and y_start values and converts    *
  1601. ;*      them to a GDC cursor position and sends it to the GDC.      *
  1602. ;*      The computed values are stored at curl0 to curl2.           *
  1603. ;*                                                                  *
  1604. ;*      A_CUR takes the values at curl0 to curl2 and sends them     *
  1605. ;*      to the GDC.                                                 *
  1606. ;*                                                                  *
  1607. ;*      entry:          x_start = x pixel location                  *
  1608. ;*                      y_start = y pixel location                  *
  1609. ;*      exit:           curl0 to curl2 set to GDC cursor values     *
  1610. ;*                                                                  *
  1611. ;********************************************************************
  1612.  
  1613.  
  1614.     PROCDEF    cxy2cp_
  1615.         push    bx
  1616.         push    cx
  1617.         push    dx
  1618.  
  1619.         mov    cl, BYTE PTR sh_p_lin_
  1620.         mov     bx, WORD PTR y_start_    ;get line number
  1621.         shl     bx, cl                   ;and convert to a start of line offset
  1622.     xor    dx,dx                    ;clear DX for 16/32 bit maths
  1623.         mov     ax, WORD PTR x_start_
  1624.         mov     cl,4
  1625.         sar     ax, cl                  ;convert x_start to a WORD offset in ax
  1626.         add     ax, bx                  ;and leave pixel position in dl.
  1627.         mov     WORD PTR curl0_, ax
  1628.         mov     ax, WORD PTR x_start_
  1629.         and     ax, 0FH
  1630.         mov     cl,4
  1631.         shl     al, cl                  ;move pixel value to high nibble.
  1632.         mov     BYTE PTR curl2_, al
  1633.         call    a_cur_
  1634.  
  1635.         pop     dx
  1636.         pop     cx
  1637.         pop     bx
  1638.         ret
  1639.     PROCEND    cxy2cp_
  1640.  
  1641.     PROCDEF    a_cur_
  1642.         call    fifo_mt_
  1643.         mov    al,49H               ;set cursor location to that in curl0,1,2
  1644.         out    57H,al               ;issue the GDC cursor location command
  1645.         mov     ax,WORD PTR curl0_   ;fetch WORD low address
  1646.         out    56H,al
  1647.         mov    al,ah                ;middle address
  1648.         out    56H,al
  1649.         mov    al,BYTE PTR curl2_   ;dot address [top 4 bits] and highDW addr
  1650.         out    56H,al
  1651.         ret
  1652.     PROCEND    a_cur_
  1653.  
  1654.     include    epilogue.h
  1655.     END
  1656. +ARCHIVE+ fglib.asm    17049 12/10/1984 13:10:42
  1657. PAGE ,132
  1658. TITLE FGLIB.ASM
  1659. ;*************************************************************
  1660. ;       Microsoft fortran interface into GRLIB               *
  1661. ;      (Computer Innovations C Graphics library)             *
  1662. ;*************************************************************
  1663. ;
  1664. ; This is really a interface between the LARGE Fortran and 
  1665. ; small C model.
  1666. ;
  1667. ; Fortran Parameters are passed by far reference, left to right
  1668. ;
  1669. ; C parameters are passed right to left; arrays & strings by
  1670. ; near reference, integers & chars by value.
  1671. ;
  1672. include asmc.h
  1673.  
  1674.     SEGEND    CODE
  1675.     SEGDEF    DATA
  1676.     EXTRN     f_col_:BYTE,     f_style_:BYTE,   f_type_:BYTE
  1677.     EXTRN     l_col_:BYTE,     l_type_:BYTE,    l_wid_:BYTE
  1678.     EXTRN     m_col_:BYTE,     m_sca_:BYTE,     m_type_:BYTE
  1679.     EXTRN     t_col_:BYTE,     t_dir_:BYTE,     t_font_:BYTE
  1680.     EXTRN     t_sca_:BYTE,     ws_number_:BYTE, ws_wmo_:BYTE
  1681.  
  1682.     public    F_WORK_BUF_
  1683.  
  1684. ARRAY    DW        ?
  1685. ARRAY4    DW        ?
  1686. BLUE    DW        ?
  1687. CENTRX    DW        ?
  1688. CENTRY    DW        ?
  1689. CHAR    DW        ?
  1690. COUNT    DW        ?
  1691. ENDDEG    DW        ?
  1692. GREEN    DW        ?
  1693. INDEX    DW        ?
  1694. RADIUS    DW        ?
  1695. RED    DW        ?
  1696. STARTD    DW        ?
  1697. X    DW        ?
  1698. XEND    DW        ?
  1699. XSTART    DW        ?
  1700. Y    DW        ?
  1701. YEND    DW        ?
  1702. YSTART    DW        ?
  1703. ZERO    DW        0
  1704.  
  1705. F_WORK_BUF_ LABEL BYTE                ;external name
  1706. STRING        LABEL BYTE                ;ASCIZ local copy 
  1707. WORK    DW        2048 DUP(?)            ;for circles etc
  1708.  
  1709.     SEGEND    DATA
  1710.  
  1711.     SEGDEF    CODE
  1712.     Extrn     a_wmode_:NEAR, arc_:NEAR, bar_:NEAR, circle_:NEAR
  1713.     Extrn     color_:NEAR, ltext_:NEAR, g_off_:NEAR, g_on_:NEAR
  1714.     Extrn     openws_:NEAR, point_:NEAR, polyfill_:NEAR 
  1715.     Extrn     polyline_:NEAR, polymark_:NEAR, rectangle_:NEAR
  1716.     Extrn     rq_locator_:NEAR, segment_:NEAR, gtext_:NEAR
  1717.  
  1718.     PUBLIC    GRARC,  GRBAR,  GRCIRC, GRCLOS, GRCOLR, GRFCOL
  1719.     PUBLIC    GRFSTY, GRFTYP, GRGON,  GRGOFF, GRGTXT, GRHSCR
  1720.     PUBLIC    GRLCOL, GRLTYP, GRLWID, GRMCOL, GRMSCA, GRMTYP
  1721.     PUBLIC    GROPEN, GRPFIL, GRPLIN, GRPMAR, GRPOIN, GRRECT
  1722.     PUBLIC    GRRQLO, GRSEGM, GRTCOL, GRTDIR, GRTEXT, GRTFON
  1723.     PUBLIC    GRTSCA, GRVSCR, GRWMOD
  1724.  
  1725.  
  1726. ;make a local ASCIZ copy of string
  1727. ;ES:SI must point to source
  1728. ;CX must contain count
  1729. movc    PROC      NEAR
  1730.     PUSH      DS
  1731.     PUSH      ES
  1732.     POP       DS            ;DS=ES
  1733.     POP       ES            ;ES=DS
  1734.     LEA       DI, STRING
  1735.     REP MOVSB
  1736.     MOV       AL,0            ;add ASCIZ terminator
  1737.     STOSB
  1738.     PUSH      DS
  1739.     PUSH      ES
  1740.     POP       DS            ;DS=ES
  1741.     POP       ES            ;ES=DS
  1742.     RET
  1743. movc    ENDP
  1744.  
  1745. ;***********************************
  1746. ;*   SUBROUTINE GROPEN()
  1747. ;***********************************
  1748.  
  1749. GROPEN    PROC      FAR
  1750.     PUSH      BP
  1751.     MOV       BP,SP
  1752.     LES       BX,[BP].06H
  1753.     MOV       AX,ES:[BX]
  1754.     PUSH      AX
  1755.     PUSH      DS            ;call with ES set to DS
  1756.     POP       ES
  1757.     CALL      openws_        ;open workstation
  1758.     ADD       SP,2            ;C convention remove params from stack
  1759.     MOV       SP,BP
  1760.     POP       BP
  1761.     RET
  1762. GROPEN    ENDP
  1763.  
  1764. ;***********************************
  1765. ;*   SUBROUTINE GRGON()
  1766. ;***********************************
  1767.  
  1768. GRGON    PROC      FAR
  1769.     PUSH      BP
  1770.     MOV       BP,SP
  1771.     PUSH      DS            ;call with ES set to DS
  1772.     POP       ES
  1773.     CALL      g_on_            ;turn Graphics ON
  1774.     MOV       SP,BP
  1775.     POP       BP
  1776.     RET
  1777. GRGON    ENDP
  1778.  
  1779.  
  1780. ;***********************************
  1781. ;*   SUBROUTINE GRCIRC()
  1782. ;***********************************
  1783.  
  1784. GRCIRC    PROC      FAR
  1785.     PUSH      BP
  1786.     MOV       BP,SP
  1787.     LES       BX,[BP].0EH        ;p1
  1788.     MOV       AX,ES:[BX]
  1789.     MOV       CENTRX,AX
  1790.     LES       BX,[BP].0AH        ;p2
  1791.     MOV       AX,ES:[BX]
  1792.     MOV       CENTRY,AX
  1793.     LES       BX,[BP].06H        ;p3
  1794.     MOV       AX,ES:[BX]
  1795.     MOV       RADIUS,AX
  1796.  
  1797.     MOV       AX,RADIUS
  1798.     PUSH      AX
  1799.     MOV       AX,CENTRY
  1800.     PUSH      AX
  1801.     MOV       AX,CENTRX
  1802.     PUSH      AX
  1803.     PUSH      DS            ;call with ES set to DS
  1804.     POP       ES
  1805.     CALL      circle_
  1806.     ADD       SP,6            ;C convention remove params from stack
  1807.     MOV       SP,BP
  1808.     POP       BP
  1809.     RET
  1810. GRCIRC    ENDP
  1811.  
  1812. ;***********************************
  1813. ;*   SUBROUTINE GRARC()
  1814. ;***********************************
  1815.  
  1816. GRARC    PROC      FAR
  1817.     PUSH      BP
  1818.     MOV       BP,SP
  1819.     LES       BX,[BP].16H
  1820.     MOV       AX,ES:[BX]
  1821.     MOV       CENTRX,AX
  1822.     LES       BX,[BP].12H
  1823.     MOV       AX,ES:[BX]
  1824.     MOV       CENTRY,AX
  1825.     LES       BX,[BP].0EH
  1826.     MOV       AX,ES:[BX]
  1827.     MOV       RADIUS,AX
  1828.     LES       BX,[BP].0AH
  1829.     MOV       AX,ES:[BX]
  1830.     MOV       STARTD,AX
  1831.     LES       BX,[BP].06H
  1832.     MOV       AX,ES:[BX]
  1833.     MOV       ENDDEG,AX
  1834.     MOV       AX,ENDDEG
  1835.     PUSH      AX
  1836.     MOV       AX,STARTD
  1837.     PUSH      AX
  1838.     MOV       AX,RADIUS
  1839.     PUSH      AX
  1840.     MOV       AX,CENTRY
  1841.     PUSH      AX
  1842.     MOV       AX,CENTRX
  1843.     PUSH      AX
  1844.     PUSH      DS            ;call with ES set to DS
  1845.     POP       ES
  1846.     CALL      arc_
  1847.     ADD       SP,10            ;C convention remove params from stack
  1848.     MOV       SP,BP
  1849.     POP       BP
  1850.     RET
  1851. GRARC    ENDP
  1852.  
  1853. ;***********************************
  1854. ;*   SUBROUTINE GRSEGM()
  1855. ;***********************************
  1856.  
  1857. GRSEGM    PROC      FAR
  1858.     PUSH      BP
  1859.     MOV       BP,SP
  1860.     LES       BX,[BP].16H
  1861.     MOV       AX,ES:[BX]
  1862.     MOV       CENTRX,AX
  1863.     LES       BX,[BP].12H
  1864.     MOV       AX,ES:[BX]
  1865.     MOV       CENTRY,AX
  1866.     LES       BX,[BP].0EH
  1867.     MOV       AX,ES:[BX]
  1868.     MOV       RADIUS,AX
  1869.     LES       BX,[BP].0AH
  1870.     MOV       AX,ES:[BX]
  1871.     MOV       STARTD,AX
  1872.     LES       BX,[BP].06H
  1873.     MOV       AX,ES:[BX]
  1874.     MOV       ENDDEG,AX
  1875.     MOV       AX,ENDDEG
  1876.     PUSH      AX
  1877.     MOV       AX,STARTD
  1878.     PUSH      AX
  1879.     MOV       AX,RADIUS
  1880.     PUSH      AX
  1881.     MOV       AX,CENTRY
  1882.     PUSH      AX
  1883.     MOV       AX,CENTRX
  1884.     PUSH      AX
  1885.     PUSH      DS            ;call with ES set to DS
  1886.     POP       ES
  1887.     CALL      segment_
  1888.     ADD       SP,10            ;C convention remove params from stack
  1889.     MOV       SP,BP
  1890.     POP       BP
  1891.     RET
  1892. GRSEGM    ENDP
  1893.  
  1894. ;***********************************
  1895. ;*   SUBROUTINE GRCOLR()
  1896. ;***********************************
  1897.  
  1898. GRCOLR    PROC      FAR
  1899.     PUSH      BP
  1900.     MOV       BP,SP
  1901.     LES       BX,[BP].12H
  1902.     MOV       AX,ES:[BX]
  1903.     MOV       INDEX,AX
  1904.     LES       BX,[BP].0EH
  1905.     MOV       AX,ES:[BX]
  1906.     MOV       RED,AX
  1907.     LES       BX,[BP].0AH
  1908.     MOV       AX,ES:[BX]
  1909.     MOV       GREEN,AX
  1910.     LES       BX,[BP].06H
  1911.     MOV       AX,ES:[BX]
  1912.     MOV       BLUE,AX
  1913.     MOV       AX,BLUE
  1914.     PUSH      AX
  1915.     MOV       AX,GREEN
  1916.     PUSH      AX
  1917.     MOV       AX,RED
  1918.     PUSH      AX
  1919.     MOV       AX,INDEX
  1920.     PUSH      AX
  1921.     PUSH      DS            ;call with ES set to DS
  1922.     POP       ES
  1923.     CALL      color_
  1924.     ADD       SP,8            ;C convention remove params from stack
  1925.     MOV       SP,BP
  1926.     POP       BP
  1927.     RET
  1928. GRCOLR    ENDP
  1929.  
  1930. ;***********************************
  1931. ;*   SUBROUTINE GRBAR()
  1932. ;***********************************
  1933.  
  1934. GRBAR    PROC      FAR
  1935.     PUSH      BP
  1936.     MOV       BP,SP
  1937.     LES       BX,[BP].06H
  1938.     PUSH      BX
  1939.     PUSH      DS            ;call with ES set to DS
  1940.     POP       ES
  1941.     CALL      bar_
  1942.     ADD       SP,2            ;C convention remove params from stack
  1943.     MOV       SP,BP
  1944.     POP       BP
  1945.     RET
  1946. GRBAR    ENDP
  1947.  
  1948. ;***********************************
  1949. ;*   SUBROUTINE GRPLIN()
  1950. ;***********************************
  1951.  
  1952. GRPLIN    PROC      FAR
  1953.     PUSH      BP
  1954.     MOV       BP,SP
  1955.     LES       BX,[BP].0AH
  1956.     MOV       AX,ES:[BX]
  1957.     MOV       COUNT,AX
  1958.     LES       BX,[BP].06H
  1959.     MOV       ARRAY,BX
  1960.     MOV       AX,ARRAY
  1961.     PUSH      AX
  1962.     MOV       AX,COUNT
  1963.     PUSH      AX
  1964.     PUSH      DS            ;call with ES set to DS
  1965.     POP       ES
  1966.     CALL      polyline_
  1967.     ADD       SP,4            ;C convention remove params from stack
  1968.     MOV       SP,BP
  1969.     POP       BP
  1970.     RET
  1971. GRPLIN    ENDP
  1972.  
  1973. ;***********************************
  1974. ;*   SUBROUTINE GRPMAR()
  1975. ;***********************************
  1976.  
  1977. GRPMAR    PROC      FAR
  1978.     PUSH      BP
  1979.     MOV       BP,SP
  1980.     LES       BX,[BP].0AH
  1981.     MOV       AX,ES:[BX]
  1982.     MOV       COUNT,AX
  1983.     LES       BX,[BP].06H
  1984.     MOV       ARRAY,BX
  1985.     MOV       AX,ARRAY
  1986.     PUSH      AX
  1987.     MOV       AX,COUNT
  1988.     PUSH      AX
  1989.     PUSH      DS            ;call with ES set to DS
  1990.     POP       ES
  1991.     CALL      polymark_
  1992.     ADD       SP,4            ;C convention remove params from stack
  1993.     MOV       SP,BP
  1994.     POP       BP
  1995.     RET
  1996. GRPMAR    ENDP
  1997.  
  1998. ;***********************************
  1999. ;*   SUBROUTINE GRPFIL()
  2000. ;***********************************
  2001.  
  2002. GRPFIL    PROC      FAR
  2003.     PUSH      BP
  2004.     MOV       BP,SP
  2005.     LES       BX,[BP].0AH
  2006.     MOV       AX,ES:[BX]
  2007.     MOV       COUNT,AX
  2008.     LES       BX,[BP].06H
  2009.     MOV       ARRAY,BX
  2010.     MOV       AX,ARRAY
  2011.     PUSH      AX
  2012.     MOV       AX,COUNT
  2013.     PUSH      AX
  2014.     PUSH      DS            ;call with ES set to DS
  2015.     POP       ES
  2016.     CALL      polyfill_
  2017.     ADD       SP,4            ;C convention remove params from stack
  2018.     MOV       SP,BP
  2019.     POP       BP
  2020.     RET
  2021. GRPFIL    ENDP
  2022.  
  2023. ;***********************************
  2024. ;*   SUBROUTINE GRGTXT()
  2025. ;***********************************
  2026.  
  2027. GRGTXT    PROC      FAR
  2028.     PUSH      BP
  2029.     MOV       BP,SP
  2030.     LES       BX,[BP].12H
  2031.     MOV       AX,ES:[BX]
  2032.     MOV       X,AX
  2033.     LES       BX,[BP].0EH
  2034.     MOV       AX,ES:[BX]
  2035.     MOV       Y,AX
  2036.  
  2037.     LES       SI,[BP].0AH        ;character string addr
  2038.     LES       BX,[BP].06H        ;count
  2039.     MOV       CX,ES:[BX]
  2040.     CALL      movc
  2041.  
  2042.     LEA       AX, STRING
  2043.     PUSH      AX
  2044.     MOV       AX,Y
  2045.     PUSH      AX
  2046.     MOV       AX,X
  2047.     PUSH      AX
  2048.     PUSH      DS            ;call with ES set to DS
  2049.     POP       ES
  2050.     CALL      gtext_
  2051.     ADD       SP,6            ;C convention remove params from stack
  2052.     MOV       SP,BP
  2053.     POP       BP
  2054.     RET
  2055. GRGTXT    ENDP
  2056.  
  2057. ;***********************************
  2058. ;*   SUBROUTINE GRTEXT()
  2059. ;***********************************
  2060.  
  2061. GRTEXT    PROC      FAR
  2062.     PUSH      BP
  2063.     MOV       BP,SP
  2064.     LES       BX,[BP].12H
  2065.     MOV       AX,ES:[BX]
  2066.     MOV       X,AX
  2067.     LES       BX,[BP].0EH
  2068.     MOV       AX,ES:[BX]
  2069.     MOV       Y,AX
  2070.     LES       SI,[BP].0AH
  2071.     LES       BX,[BP].06H
  2072.     MOV       CX,ES:[BX]
  2073.     CALL      movc
  2074.     LEA       AX, STRING
  2075.     PUSH      AX
  2076.     MOV       AX,Y
  2077.     PUSH      AX
  2078.     MOV       AX,X
  2079.     PUSH      AX
  2080.     PUSH      DS            ;call with ES set to DS
  2081.     POP       ES
  2082.     CALL      ltext_
  2083.     ADD       SP,6            ;C convention remove params from stack
  2084.     MOV       SP,BP
  2085.     POP       BP
  2086.     RET
  2087. GRTEXT    ENDP
  2088.  
  2089. ;***********************************
  2090. ;*   SUBROUTINE GRRQLO()
  2091. ;***********************************
  2092.  
  2093. GRRQLO    PROC      FAR
  2094.     PUSH      BP
  2095.     MOV       BP,SP
  2096.     LES       BX,[BP].16H
  2097.     MOV       AX,ES:[BX]
  2098.     MOV       XSTART,AX
  2099.     LES       BX,[BP].12H
  2100.     MOV       AX,ES:[BX]
  2101.     MOV       YSTART,AX
  2102.     LES       BX,[BP].0EH
  2103.     MOV       AX,ES:[BX]
  2104.     MOV       CHAR,AX
  2105.     LES       BX,[BP].0AH
  2106.     MOV       AX,ES:[BX]
  2107.     MOV       XEND,AX
  2108.     LES       BX,[BP].06H
  2109.     MOV       AX,ES:[BX]
  2110.     MOV       YEND,AX
  2111.     MOV       AX,YEND
  2112.     PUSH      AX
  2113.     MOV       AX,XEND
  2114.     PUSH      AX
  2115.     MOV       AX,CHAR
  2116.     PUSH      AX
  2117.     MOV       AX,YSTART
  2118.     PUSH      AX
  2119.     MOV       AX,XSTART
  2120.     PUSH      AX
  2121.     MOV       AX,ZERO
  2122.     PUSH      AX
  2123.     PUSH      DS            ;call with ES set to DS
  2124.     POP       ES
  2125.     CALL      rq_locator_
  2126.     ADD       SP,12            ;C convention remove params from stack
  2127.     LES       BX,[BP].0EH
  2128.     MOV       AX,CHAR
  2129.     MOV       ES:[BX],AL
  2130.     LES       BX,[BP].0AH
  2131.     MOV       AX,XEND
  2132.     MOV       ES:[BX],AX
  2133.     LES       BX,[BP].06H
  2134.     MOV       AX,YEND
  2135.     MOV       ES:[BX],AX
  2136.     MOV       SP,BP
  2137.     POP       BP
  2138.     RET
  2139. GRRQLO    ENDP
  2140.  
  2141. ;***********************************
  2142. ;*   SUBROUTINE GRVSCR()
  2143. ;***********************************
  2144.  
  2145. GRVSCR    PROC      FAR
  2146. ;    PUSH      BP
  2147. ;    MOV       BP,SP
  2148. ;    MOV       SP,BP
  2149. ;    POP       BP
  2150.     RET
  2151. GRVSCR    ENDP
  2152.  
  2153. ;***********************************
  2154. ;*   SUBROUTINE GRHSCR()
  2155. ;***********************************
  2156.  
  2157. GRHSCR    PROC      FAR
  2158. ;    PUSH      BP
  2159. ;    MOV       BP,SP
  2160. ;    MOV       SP,BP
  2161. ;    POP       BP
  2162.     RET
  2163. GRHSCR    ENDP
  2164.  
  2165. ;***********************************
  2166. ;*   SUBROUTINE GRPOIN()
  2167. ;***********************************
  2168.  
  2169. GRPOIN    PROC      FAR
  2170.     PUSH      BP
  2171.     MOV       BP,SP
  2172.     LES       BX,[BP].0AH
  2173.     MOV       AX,ES:[BX]
  2174.     MOV       X,AX
  2175.     LES       BX,[BP].06H
  2176.     MOV       AX,ES:[BX]
  2177.     MOV       Y,AX
  2178.     MOV       AX,Y
  2179.     PUSH      AX
  2180.     MOV       AX,X
  2181.     PUSH      AX
  2182.     PUSH      DS            ;call with ES set to DS
  2183.     POP       ES
  2184.     CALL      point_
  2185.     ADD       SP,4            ;C convention remove params from stack
  2186.     MOV       SP,BP
  2187.     POP       BP
  2188.     RET
  2189. GRPOIN    ENDP
  2190.  
  2191. ;***********************************
  2192. ;*   SUBROUTINE GRRECT()
  2193. ;***********************************
  2194.  
  2195. GRRECT    PROC      FAR
  2196.     PUSH      BP
  2197.     MOV       BP,SP
  2198.     LES       AX,[BP].06H
  2199.     MOV       ARRAY4,AX
  2200.     MOV       AX,ARRAY4
  2201.     PUSH      AX
  2202.     PUSH      DS            ;call with ES set to DS
  2203.     POP       ES
  2204.     CALL      rectangle_
  2205.     ADD       SP,2            ;C convention remove params from stack
  2206.     MOV       SP,BP
  2207.     POP       BP
  2208.     RET
  2209. GRRECT    ENDP
  2210.  
  2211. ;***********************************
  2212. ;*   SUBROUTINE GRTSCA()
  2213. ;***********************************
  2214.  
  2215. GRTSCA    PROC      FAR
  2216.     PUSH      BP
  2217.     MOV       BP,SP
  2218.     LES       BX,[BP].06H
  2219.     MOV       AX,ES:[BX]
  2220.     MOV       BYTE PTR t_sca_,AL
  2221.     MOV       SP,BP
  2222.     POP       BP
  2223.     RET
  2224. GRTSCA    ENDP
  2225.  
  2226. ;***********************************
  2227. ;*   SUBROUTINE GRCLOS()
  2228. ;***********************************
  2229.  
  2230. GRCLOS    PROC      FAR
  2231.     PUSH      BP
  2232.     MOV       BP,SP
  2233.     MOV       BYTE PTR ws_number_,0
  2234.     PUSH      DS            ;call with ES set to DS
  2235.     POP       ES
  2236.     CALL      g_off_
  2237.     MOV       SP,BP
  2238.     POP       BP
  2239.     RET
  2240. GRCLOS    ENDP
  2241.  
  2242. ;***********************************
  2243. ;*   SUBROUTINE GRGOFF()
  2244. ;***********************************
  2245.  
  2246. GRGOFF    PROC      FAR
  2247.     PUSH      BP
  2248.     MOV       BP,SP
  2249.     PUSH      DS            ;call with ES set to DS
  2250.     POP       ES
  2251.     CALL      g_off_
  2252.     MOV       SP,BP
  2253.     POP       BP
  2254.     RET
  2255. GRGOFF    ENDP
  2256.  
  2257. ;***********************************
  2258. ;*   SUBROUTINE GRTDIR()
  2259. ;***********************************
  2260.  
  2261. GRTDIR    PROC      FAR
  2262.     PUSH      BP
  2263.     MOV       BP,SP
  2264.     LES       BX,[BP].06H
  2265.     MOV       AX,ES:[BX]
  2266.     MOV       BYTE PTR t_dir_,AL
  2267.     MOV       SP,BP
  2268.     POP       BP
  2269.     RET
  2270. GRTDIR    ENDP
  2271.  
  2272. ;***********************************
  2273. ;*   SUBROUTINE GRFCOL()
  2274. ;***********************************
  2275.  
  2276. GRFCOL    PROC      FAR
  2277.     PUSH      BP
  2278.     MOV       BP,SP
  2279.     LES       BX,[BP].06H
  2280.     MOV       AX,ES:[BX]
  2281.     MOV       BYTE PTR f_col_,AL
  2282.     MOV       SP,BP
  2283.     POP       BP
  2284.     RET
  2285. GRFCOL    ENDP
  2286.  
  2287. ;***********************************
  2288. ;*   SUBROUTINE GRFSTY()
  2289. ;***********************************
  2290.  
  2291. GRFSTY    PROC      FAR
  2292.     PUSH      BP
  2293.     MOV       BP,SP
  2294.     LES       BX,[BP].06H
  2295.     MOV       AX,ES:[BX]
  2296.     MOV       BYTE PTR f_style_,AL
  2297.     MOV       SP,BP
  2298.     POP       BP
  2299.     RET
  2300. GRFSTY    ENDP
  2301.  
  2302. ;***********************************
  2303. ;*   SUBROUTINE GRFTYP()
  2304. ;***********************************
  2305.  
  2306. GRFTYP    PROC      FAR
  2307.     PUSH      BP
  2308.     MOV       BP,SP
  2309.     LES       BX,[BP].06H
  2310.     MOV       AX,ES:[BX]
  2311.     MOV       BYTE PTR f_type_,AL
  2312.     MOV       SP,BP
  2313.     POP       BP
  2314.     RET
  2315. GRFTYP    ENDP
  2316.  
  2317. ;***********************************
  2318. ;*   SUBROUTINE GRLCOL()
  2319. ;***********************************
  2320.  
  2321. GRLCOL    PROC      FAR
  2322.     PUSH      BP
  2323.     MOV       BP,SP
  2324.     LES       BX,[BP].06H
  2325.     MOV       AX,ES:[BX]
  2326.     MOV       BYTE PTR l_col_,AL
  2327.     MOV       SP,BP
  2328.     POP       BP
  2329.     RET
  2330. GRLCOL    ENDP
  2331.  
  2332. ;***********************************
  2333. ;*   SUBROUTINE GRLTYP()
  2334. ;***********************************
  2335.  
  2336. GRLTYP    PROC      FAR
  2337.     PUSH      BP
  2338.     MOV       BP,SP
  2339.     LES       BX,[BP].06H
  2340.     MOV       AX,ES:[BX]
  2341.     MOV       BYTE PTR l_type_,AL
  2342.     MOV       SP,BP
  2343.     POP       BP
  2344.     RET
  2345. GRLTYP    ENDP
  2346.  
  2347. ;***********************************
  2348. ;*   SUBROUTINE GRLWID()
  2349. ;***********************************
  2350.  
  2351. GRLWID    PROC      FAR
  2352.     PUSH      BP
  2353.     MOV       BP,SP
  2354.     LES       BX,[BP].06H
  2355.     MOV       AX,ES:[BX]
  2356.     MOV       BYTE PTR l_wid_,AL
  2357.     MOV       SP,BP
  2358.     POP       BP
  2359.     RET
  2360. GRLWID    ENDP
  2361.  
  2362. ;***********************************
  2363. ;*   SUBROUTINE GRMCOL()
  2364. ;***********************************
  2365.  
  2366. GRMCOL    PROC      FAR
  2367.     PUSH      BP
  2368.     MOV       BP,SP
  2369.     LES       BX,[BP].06H
  2370.     MOV       AX,ES:[BX]
  2371.     MOV       BYTE PTR m_col_,AL
  2372.     MOV       SP,BP
  2373.     POP       BP
  2374.     RET
  2375. GRMCOL    ENDP
  2376.  
  2377. ;***********************************
  2378. ;*   SUBROUTINE GRMSCA()
  2379. ;***********************************
  2380.  
  2381. GRMSCA    PROC      FAR
  2382.     PUSH      BP
  2383.     MOV       BP,SP
  2384.     LES       BX,[BP].06H
  2385.     MOV       AX,ES:[BX]
  2386.     MOV       BYTE PTR m_sca_,AL
  2387.     MOV       SP,BP
  2388.     POP       BP
  2389.     RET
  2390. GRMSCA    ENDP
  2391.  
  2392. ;***********************************
  2393. ;*   SUBROUTINE GRMTYP()
  2394. ;***********************************
  2395.  
  2396. GRMTYP    PROC      FAR
  2397.     PUSH      BP
  2398.     MOV       BP,SP
  2399.     LES       BX,[BP].06H
  2400.     MOV       AX,ES:[BX]
  2401.     MOV       BYTE PTR m_type_,AL
  2402.     MOV       SP,BP
  2403.     POP       BP
  2404.     RET
  2405. GRMTYP    ENDP
  2406.  
  2407. ;***********************************
  2408. ;*   SUBROUTINE GRWMOD()
  2409. ;***********************************
  2410.  
  2411. GRWMOD    PROC      FAR
  2412.     PUSH      BP
  2413.     MOV       BP,SP
  2414.     LES       BX,[BP].06H
  2415.     MOV       AX,ES:[BX]
  2416.     MOV       BYTE PTR ws_wmo_,AL
  2417.     PUSH      DS            ;call with ES set to DS
  2418.     POP       ES
  2419.     CALL      a_wmode_
  2420.     MOV       SP,BP
  2421.     POP       BP
  2422.     RET
  2423. GRWMOD    ENDP
  2424.  
  2425. ;***********************************
  2426. ;*   SUBROUTINE GRTCOL()
  2427. ;***********************************
  2428.  
  2429. GRTCOL    PROC      FAR
  2430.     PUSH      BP
  2431.     MOV       BP,SP
  2432.     LES       BX,[BP].06H
  2433.     MOV       AX,ES:[BX]
  2434.     MOV       BYTE PTR t_col_,AL
  2435.     MOV       SP,BP
  2436.     POP       BP
  2437.     RET
  2438. GRTCOL    ENDP
  2439.  
  2440. ;***********************************
  2441. ;*   SUBROUTINE GRTFON()
  2442. ;***********************************
  2443.  
  2444. GRTFON    PROC      FAR
  2445.     PUSH      BP
  2446.     MOV       BP,SP
  2447.     LES       BX,[BP].06H
  2448.     MOV       AX,ES:[BX]
  2449.     MOV       BYTE PTR t_font_,AL
  2450.     MOV       SP,BP
  2451.     POP       BP
  2452.     RET
  2453. GRTFON    ENDP
  2454.  
  2455.  
  2456. include epilogue.h
  2457.     END
  2458. +ARCHIVE+ fill.asm     10815 10/01/1983  0:12:10
  2459. PAGE ,132
  2460. title FILL.ASM
  2461. ;UPDATE HISTORY
  2462. ;==============
  2463. ; 14 nov 84    Convert to CI86 V2.2
  2464. ;  4 Dec 84     New version to correct idiosyncrosy in graphics option
  2465. ;               in which REPlace & COMPlement modes didn't work properly.
  2466. ;               The pattern write is now done external to the Graphics option.
  2467. ; 11 Dec 84     Bugfix - free memory after single point or hollow fill.
  2468.     include    asmc.h
  2469.  
  2470.     SEGEND    CODE
  2471.  
  2472. RELEASE MACRO   addr
  2473.     mov    ax,addr
  2474.     push    ax
  2475.     call    free_
  2476.     add    sp,2
  2477.     ENDM
  2478.  
  2479.     SEGDEF    DATA
  2480.  
  2481. EXTRN    f_col_:BYTE, f_type_:BYTE, f_patrn_:BYTE, f_style_:BYTE
  2482. EXTRN    gbmod_:BYTE, ymax_:WORD, gp_buff_:WORD, y_start_:WORD
  2483. EXTRN    x_start_:WORD, x_stop_:WORD, y_stop_:WORD, l_type_:BYTE
  2484. EXTRN    l_col_:BYTE, sh_p_lin_:BYTE, curl0_:BYTE, nmritl_:BYTE, gbmskl_:BYTE
  2485.  
  2486. Lymin    DW      0
  2487. Lymin1    DW      0
  2488. Lymax    DW      0
  2489. Lydif    DW      0
  2490. Lcntr    DW      0
  2491. Lcnt1    DW      0
  2492. Lnpnt    DW      0
  2493. Lfpat    DW      0
  2494. Lbuff    DW      0
  2495.  
  2496.     SEGEND    DATA
  2497.  
  2498.     SEGDEF    CODE
  2499.  
  2500. PUBLIC    polyfill_, bar_
  2501.  
  2502.     IF    @bigmodel
  2503. EXTRN    gdc_nb_:FAR, a_mode_:FAR, malloc_:FAR, cxy2cp_:FAR, fifo_mt_:FAR
  2504. EXTRN    free_:FAR, polyline_:FAR, line_:FAR, a_gbmsk_:FAR, a_cur_:FAR
  2505. EXTRN    chk_col_:FAR, a_patrn_:FAR, eseg_sav:FAR
  2506.     ELSE
  2507. EXTRN    gdc_nb_:NEAR, a_mode_:NEAR, malloc_:NEAR, cxy2cp_:NEAR, fifo_mt_:NEAR
  2508. EXTRN    free_:NEAR, polyline_:NEAR, line_:NEAR, a_gbmsk_:NEAR, a_cur_:NEAR
  2509. EXTRN    chk_col_:NEAR, a_patrn_:NEAR, eseg_sav:NEAR
  2510.     ENDIF
  2511.  
  2512. ;************************************************************************
  2513. ;*                                    *
  2514. ;*    F U N C T I O N     polyfill(count, array)            *
  2515. ;*                int count, *array;                *
  2516. ;*                                    *
  2517. ;*    purpose:    Fill an area with a pattern specified by    *
  2518. ;*            f_type and f_style which is defined as a    *
  2519. ;*            series of 'xy' points [array] whose length    *
  2520. ;*            is 'count' 'xy' pairs.                *
  2521. ;*                                    *
  2522. ;*    entry:        8[bp] number of 'xy' pairs in 'array'.        *
  2523. ;*            A[bp] pointer to the 'xy' pairs.        *
  2524. ;*                                    *
  2525. ;************************************************************************
  2526.  
  2527.     PROCDEF    polyfill_
  2528.     push    si
  2529.     push    di
  2530.     push    bp
  2531.     mov    bp,sp
  2532.  
  2533.     mov    ax,cs:WORD PTR eseg_sav
  2534.     mov    es,ax
  2535.  
  2536.     mov    ax,0400H    ;allocate a 1k area for temporary storage.
  2537.     push    ax
  2538.     call    malloc_
  2539.     add    sp,2
  2540.     or    ax,ax
  2541.     jnz    Lv
  2542.     jmp    Lexit1
  2543. Lv:
  2544.     mov    Lbuff,ax
  2545.  
  2546.     call    gdc_nb_
  2547.     mov    al,BYTE PTR f_col_  ;change the colour to that specified for
  2548.     call    chk_col_        ;area filling.
  2549.  
  2550.     test    BYTE PTR gbmod_,2    ;are we in vector mode ?
  2551.     jnz    Lv1
  2552.     or    BYTE PTR gbmod_,12H
  2553.     call    a_mode_
  2554.  
  2555. Lv1:    mov    cx,8[bp]
  2556.     dec    cx
  2557.     jnz    L0a        ;finished if it is a single point.
  2558.     RELEASE Lbuff
  2559.     jmp    Lexit
  2560. L0a:    mov    Lnpnt,cx
  2561.  
  2562.     mov    al,BYTE PTR f_type_    ;get the fill type.
  2563.     xor    ah,ah
  2564.     cmp    ax,0        ;is it HOLLOW ?
  2565.     jnz    L0b
  2566.     RELEASE Lbuff
  2567.     jmp    L9        ;finished if yes.
  2568. L0b:    lea    dx, f_patrn_
  2569.     mov    bx,0
  2570.     cmp    ax,1        ;fill_type solid ?
  2571.     jz    L0c
  2572.     add    dx,8
  2573.     mov    bl,BYTE PTR f_style_
  2574.     cmp    ax,2        ;fill_type PATTERN ?
  2575.     jz    L0c
  2576.     add    bx,8        ;offset f_style for HATCH.
  2577. L0c:    mov    cl,3
  2578.     shl    bx,cl
  2579.     add    dx,bx
  2580.     mov    Lfpat,dx
  2581.  
  2582.     mov    bx,WORD PTR ymax_
  2583.     mov    si,10[bp]
  2584.     lea    di, gp_buff_
  2585.     mov    cx,8[bp]
  2586. L0d:    lodsw            ;move all the 'xy' pairs to temporary storage
  2587.     stosw            ;in 'gp_buff_' and convert all 'y' values to a
  2588.     mov    ax,bx        ;bottom left origin.
  2589.     sub    ax,[si]
  2590.     stosw
  2591.     add    si,2
  2592.     loop    L0d
  2593.  
  2594.     mov    Lymin,3E8H
  2595.     mov    Lymax,0
  2596.     lea    si, gp_buff_
  2597.     mov    cx,8[bp]
  2598. L1:    add    si,2
  2599.     lodsw
  2600.     cmp    ax,Lymin
  2601.     jnl    L2
  2602.     mov    Lymin,ax
  2603. L2:    cmp    ax,Lymax
  2604.     jle    L2a
  2605.     mov    Lymax,ax
  2606. L2a:    loop    L1
  2607.  
  2608.     mov    ax,Lymin
  2609.     mov    Lymin1,ax
  2610.     mov    bx,Lymax
  2611.     sub    bx,ax
  2612.     mov    Lydif,bx
  2613.     jnz    L2b
  2614.     jmp    L7
  2615.  
  2616. L2b:    mov    al,78H
  2617.     out    57H,al
  2618.     mov    al,0ffH
  2619.     out    56H,al
  2620.     out    56H,al
  2621.  
  2622. L3:    mov    Lcntr,0
  2623.     mov    cx,Lnpnt
  2624.     lea    si, gp_buff_
  2625. L4:    push    cx
  2626.     mov    di,si
  2627.     add    di,4
  2628.     push    si
  2629.     call    L10
  2630.     pop    si
  2631.     add    si,4
  2632.     pop    cx
  2633.     loop    L4
  2634.  
  2635.     lea    di, gp_buff_
  2636.     call    L10
  2637.     mov    ax,Lcntr
  2638.     shr    ax,1
  2639.     jnz    L4a
  2640.     jmp    L6
  2641. L4a:    mov    Lcnt1,ax
  2642.     mov    si,Lymin1
  2643.     mov    WORD PTR y_start_,si
  2644.     and    si,7
  2645.     neg    si
  2646.     add    si,7
  2647.     add    si,Lfpat
  2648.     mov    al,BYTE PTR [si]
  2649.     mov    ah,al
  2650.     mov    bx,Lbuff
  2651. L5:    push    ax
  2652.     push    bx
  2653.     mov    cx,[bx]
  2654.     mov    WORD PTR x_start_,cx
  2655.     push    cx
  2656.     push    ax
  2657.     call    gdc_nb_
  2658.     call    cxy2cp_
  2659.     mov    al,0fdH        ;select the PATTERN MULTIPLIER.
  2660.     out    53H,al
  2661.     mov    al,0fH        ;x1 pattern.
  2662.     out    51H,al
  2663.     mov    al,0fbH    ;select the PATTERN REGISTER.
  2664.     out    53H,al
  2665.     pop    ax
  2666.     pop    cx
  2667.     and    cx,000fH
  2668.     ror    ax,cl
  2669.     out    51H,al
  2670.  
  2671.     mov    al,4CH        ;issue the FIGS command.
  2672.     out    57H,al
  2673.     mov    al,02H
  2674.     out    56H,al
  2675.     mov    ax,2[bx]
  2676.     sub    ax,WORD PTR x_start_
  2677.     out    56H,al
  2678.     xchg    al,ah
  2679.     out    56H,al
  2680.     xchg    al,ah
  2681.     neg    ax
  2682.     out    56H,al
  2683.     xchg    al,ah
  2684.     out    56H,al
  2685.     xchg    al,ah
  2686.     shl    ax,1
  2687.     out    56H,al
  2688.     xchg    al,ah
  2689.     out    56H,al
  2690.  
  2691.     mov    al,6CH        ;issue the DRAW command.
  2692.     out    57H,al
  2693.  
  2694.     pop    bx
  2695.     pop    ax
  2696.     add    bx,4
  2697.     dec    Lcnt1
  2698.     jz    L6
  2699.     jmp    L5
  2700.  
  2701. L6:    inc    Lymin1
  2702.     dec    Lydif
  2703.     jz    L7
  2704.     jmp    L3
  2705.  
  2706. L7:    RELEASE Lbuff
  2707.  
  2708.     mov    bx,WORD PTR ymax_
  2709.     lea    di, gp_buff_+2
  2710.     mov    si,di
  2711.     mov    cx,8[bp]
  2712. L8:    mov    ax,bx
  2713.     sub    ax,[si]
  2714.     stosw
  2715.     add    si,4
  2716.     add    di,2
  2717.     loop    L8
  2718.  
  2719. L9:    call    gdc_nb_
  2720.     mov    al,BYTE PTR l_type_    ;get current line type.
  2721.     push    ax
  2722.     mov    BYTE PTR l_type_,0    ;make it a solid line.
  2723.     call    a_patrn_        ;assert it.
  2724.     mov    al,BYTE PTR l_col_
  2725.     call    chk_col_
  2726.     pop    ax
  2727.     mov    BYTE PTR l_type_,al    ;restore the old line type.
  2728.  
  2729.     mov    ax,10[bp]    ;join all the points with a polyline.
  2730.     push    ax
  2731.     mov    ax,8[bp]
  2732.     push    ax
  2733.     call    polyline_
  2734.     pop    cx
  2735.     pop    si
  2736.  
  2737.     lodsw            ;now join the first point to the last point.
  2738.     mov    WORD PTR x_start_,ax
  2739.     lodsw
  2740.     mov    WORD PTR y_start_,ax
  2741.     sub    cx,2
  2742.     jz    Lexit        ;finished if it was a straight line.
  2743.     shl    cx,1
  2744.     shl    cx,1
  2745.     add    si,cx
  2746.     lodsw
  2747.     mov    WORD PTR x_stop_,ax
  2748.     lodsw
  2749.     mov    WORD PTR y_stop_,ax
  2750.     lea    ax, x_start_
  2751.     push    ax
  2752.     call    line_
  2753.     add    sp,2
  2754.  
  2755. Lexit:    mov    ax,0001H
  2756. Lexit1:    pop    bp
  2757.     pop    di
  2758.     pop    si
  2759.     ret
  2760.  
  2761. L10:    mov    bx,2[di]
  2762.     sub    bx,2[si]
  2763.     jz    L17
  2764.     mov    ax,Lymin1
  2765.     mov    cx,ax
  2766.     sub    cx,2[si]
  2767.     sub    ax,2[di]
  2768.     xor    ax,cx
  2769.     jns    L17
  2770.     mov    ax,[di]
  2771.     sub    ax,[si]
  2772.     shl    cx,1
  2773.     imul    cx
  2774.     idiv    bx
  2775.     inc    ax
  2776.     sar    ax,1
  2777.     add    ax,[si]
  2778.     
  2779.     mov    bx,[si]
  2780.     mov    cx,[di]
  2781.     cmp    bx,cx
  2782.     jle    L11
  2783.     xchg    bx,cx
  2784. L11:    cmp    ax,bx
  2785.     jnl    L12
  2786.     mov    ax,bx
  2787. L12:    cmp    ax,cx
  2788.     jle    L13
  2789.     mov    ax,cx
  2790. L13:    mov    di,Lbuff
  2791.     mov    cx,Lcntr
  2792.     jcxz    L16
  2793. L14:    scasw
  2794.     jl    L15
  2795.     loop    L14
  2796.     jmp    L16
  2797. L15:    mov    di,Lcntr
  2798.     shl    di,1
  2799.     add    di,Lbuff
  2800.     mov    si,di
  2801.     sub    si,2
  2802.     std
  2803.     rep movsw
  2804.     cld
  2805. L16:    stosw
  2806.     inc    Lcntr
  2807. L17:    ret
  2808.     PROCEND    polyfill_
  2809.  
  2810. ;************************************************************************
  2811. ;*                                                                      *
  2812. ;*              F U N C T I O N    bar[array]  int *array;              *
  2813. ;*                                                                      *
  2814. ;*  purpose:    set a user defined screen rectangle to a user           *
  2815. ;*              defined color.                                          *
  2816. ;*  entry:      0x06[bp] has the pointer to the 'xy' array              *
  2817. ;*                                    *
  2818. ;*        0[array] has the start x in pixels            *
  2819. ;*              6[array] has the start y in scan lines                  *
  2820. ;*              4[array] has the stop x in pixels                       *
  2821. ;*              2[array] has the stop y in scan lines                   *
  2822. ;*              f_col is the color to fill the bar with.                *
  2823. ;*                                                                      *
  2824. ;*    NOTE:    both 'y' values are relative to a bottom left origin    *
  2825. ;*                                    *
  2826. ;************************************************************************
  2827.  
  2828.     PROCDEF    bar_
  2829.     push    si
  2830.     push    bp
  2831.     mov    bp,sp
  2832.     sub    sp,4    ;make room for local y start and y stop
  2833.  
  2834.     mov    si,6[bp]    ;get the array pointer
  2835.     mov    ax,WORD PTR ymax_ ;adjust both 'y' values for top left origin
  2836.     sub    ax,2[si]
  2837.     mov    -2[bp],ax
  2838.  
  2839.     mov    ax,WORD PTR ymax_
  2840.     sub    ax,6[si]
  2841.     mov    -4[bp],ax
  2842.  
  2843.     mov     ax,[si]     ;turn bl_x address into word address.
  2844.         mov    cl,4
  2845.         shr     ax,cl
  2846.         mov     dx,-4[bp]     ;turn tr_y into words per line * y.
  2847.     mov    cx,WORD PTR sh_p_lin_    ;high res = 6,  medium res = 5.
  2848.     shl     dx,cl
  2849.         add     dx,ax           ;combine x and y word addresses.
  2850.         mov     WORD PTR curl0_,dx       ;first curl0.
  2851.         mov     ax,-2[bp]     ;find number of lines to write by:
  2852.         sub     ax,-4[bp]    ;   bl_y - tr_y
  2853.         mov     WORD PTR nmritl_,ax
  2854.  
  2855.     call    gdc_nb_
  2856.         mov    al,BYTE PTR f_col_       ;check for correct colour.
  2857.     call    chk_col_
  2858.     test    BYTE PTR gbmod_,2
  2859.     jz    Lb0
  2860.     and     BYTE PTR gbmod_,0fdH    ;put into word mode.
  2861.         or      BYTE PTR gbmod_,010H    ;put into write-enable mode.
  2862.     call    a_mode_
  2863.  
  2864. Lb0:    mov    al,0FEH    ;reset write buffer counter.
  2865.     out    53H,al
  2866.     out    51H,al
  2867.     mov    cx,10H
  2868.     xor    al,al
  2869. Lba:    out    52H,al        ;fill buffer with zero's.
  2870.     loop    Lba
  2871. ;
  2872. ;program the text mask:
  2873. ;there are four possible write conditions: 
  2874. ;a]partially write disabled to theleft 
  2875. ;b]completely write enabled 
  2876. ;c]partially write disabled to the right 
  2877. ;d]partially write disabled to both left and right
  2878.  
  2879. Lb1:    mov     bx,0ffffH      ;calculate the current write mask.
  2880.         mov     cx,[si]        ;get bl_x
  2881.         and     cx,0fH        ;eliminate all but pixel information.
  2882.         shr     bx,cl           ;shift in a 0 for each left pixel to disable.
  2883.  
  2884.         mov     ax,[si]        ;test to see if word tr_x is equal
  2885.         and     ax,0fff0H      ;to word bl_x.
  2886.         mov     cx,4[si]
  2887.         and     cx,0fff0H
  2888.         cmp     ax,cx           ;below?
  2889.     jb    Lb3        ;jump if yes.
  2890.     je    Lb2        ;jump if equal. do last write.
  2891.  
  2892.     add    sp,4
  2893.     pop    bp        ;exit.
  2894.     pop    si
  2895.     ret
  2896.  
  2897. Lb2:    mov     cx,4[si]     ;get pixel info out of tr_x.
  2898.         and     cx,0fH
  2899.         inc     cx              ;make endpoint inclusive of write.
  2900.         mov     ax,0ffffH      ;shift the disable mask.
  2901.         shr     ax,cl           ;wherever there is a one, we want to
  2902.         xor     ax,0ffffH      ;enable writes.
  2903.     and    bx,ax           ;combine right and left masks.
  2904.  
  2905. Lb3:    xor     bx,0ffffH      ;invert so where there is a 1 we write disable.
  2906.     mov    WORD PTR gbmskl_,bx      ;make sure that the GDC isn't busy
  2907.     call    gdc_nb_
  2908.     call    a_gbmsk_        ;and assert the write mask.
  2909.     call    a_cur_        ;assert the GDC cursor address.
  2910.  
  2911.         mov    al,4cH        ;assert figs to GDC.
  2912.         out    57H,al
  2913.         xor    al,al           ;direction is down.
  2914.         out    56H,al
  2915.         mov    ax,WORD PTR nmritl_
  2916.         out    56H,al         ;assert number of write operations to perform.
  2917.         mov    al,ah
  2918.         out    56H,al
  2919.         mov    al,22H        ;assert write data command.
  2920.         out    57H,al
  2921.         mov    al,0ffH
  2922.         out    56H,al
  2923.         out    56H,al
  2924.  
  2925.         and     [si],0fff0H  ;strip off pixel info.
  2926.         add     WORD PTR [si],16    ;address the next word.
  2927.         inc     WORD PTR curl0_
  2928.     jmp    Lb1        ;check for another column to clear.
  2929.     PROCEND    bar_
  2930.  
  2931. include epilogue.h
  2932.     END
  2933. +ARCHIVE+ getkey.asm    3162 12/03/1984 13:47:46
  2934. PAGE ,132
  2935. TITLE GETKEY.ASM
  2936. ;UPDATE HISTORY
  2937. ;==============
  2938. ; 3-dec-1984     convert from c to assembler
  2939.  
  2940. include asmc.h
  2941. include asmk.h
  2942.  
  2943.     public    CAPITAL
  2944.     public    INKEY
  2945.     public    GETKEY
  2946.     extrn    KBD16:near, KBDIN:near
  2947. ; convert character to uppercase if lower case */
  2948. ;  if('a'<=c && c<='z')c+=('A'-'a');
  2949. ;  return c;
  2950. ucase    PROC    NEAR
  2951.     push    BP
  2952.     mov    BP,SP
  2953.     mov    AL,+4[BP]
  2954.     cbw
  2955.     cmp    AX,97
  2956.     jl    ucasex
  2957.     mov    AL,+4[BP]
  2958.     cbw
  2959.     cmp    AX,122
  2960.     jg    ucasex
  2961.     mov    AX,-32
  2962.     push    AX
  2963.     pop    DX
  2964.     mov    AL,+4[BP]
  2965.     cbw
  2966.     add    AX,DX
  2967.     mov    +4[BP],AL
  2968. ucasex:
  2969.     mov    AL,+4[BP]
  2970.     cbw
  2971.     mov    SP,BP
  2972.     pop    BP
  2973.     ret
  2974. ucase    ENDP
  2975.  
  2976.  
  2977. ;******************************************************
  2978. ;convert non-function key to upper case               *
  2979. ;capital(key_pressed)                                 *
  2980. ;unsigned int key_pressed;                            *
  2981. ;******************************************************
  2982.     PROCDEF CAPITAL
  2983.     push    BP
  2984.     mov    BP,SP
  2985.  
  2986. ;    if ( !FUNKEY(key_pressed) )
  2987.     mov    AX,+4[BP]
  2988.     and    AX,256
  2989.     or    AX,AX
  2990.     je    .012
  2991.     mov    AX,1
  2992.     jmp    SHORT .014
  2993. .012:            ;11
  2994.     xor    AX,AX
  2995. .014:            ;11
  2996.     or    AX,AX
  2997.     je    .01A
  2998.     jmp    SHORT .027
  2999.  
  3000. ;    return(toupper(key_pressed));
  3001. .01A:            ;11
  3002.     push    WORD PTR +4[BP]
  3003.     call    ucase
  3004.     add    SP,2
  3005.  
  3006.     mov    SP,BP
  3007.     pop    BP
  3008.     ret
  3009.  
  3010. ;     else
  3011. ;    return(key_pressed);
  3012. .027:            ;13
  3013.     mov    AX,+4[BP]
  3014.     mov    SP,BP
  3015.     pop    BP
  3016.     ret
  3017.     PROCEND CAPITAL
  3018.  
  3019. ;******************************************************
  3020. ;wait for a key to be pressed and return it to caller *
  3021. ; inkey()                                             *
  3022. ;******************************************************
  3023.  
  3024.  
  3025. INKEY    PROC    NEAR
  3026. .032:            ;19
  3027.     push    BP
  3028.     mov    BP,SP
  3029.     sub    SP,2
  3030.  
  3031. ;    while ((key = getkey()) == 0);
  3032. .038:            ;22
  3033.     call    GETKEY
  3034.     mov    -2[BP],AX
  3035.     cmp    AX,0
  3036.     jne    .045
  3037.     jmp    SHORT .038
  3038.  
  3039. ;    return(key);
  3040. .045:            ;22
  3041.     mov    AX,-2[BP]
  3042.     mov    SP,BP
  3043.     pop    BP
  3044.     ret
  3045. INKEY    ENDP
  3046.  
  3047. ;***********************************************************
  3048. ;see if a key was pressed and return 16-bit char to caller *
  3049. ;if function key, bit 0x0100 = 1                           *
  3050. ;           else, bit 0x0100 = 0                           *
  3051. ;return 0 if no key pressed                                *
  3052. ;getkey()                                                  *
  3053. ;***********************************************************
  3054. ;    };
  3055. ;}
  3056. GETKEY    PROC    NEAR
  3057. .04C:            ;27
  3058.     push    BP
  3059.     mov    BP,SP
  3060.     sub    SP,6
  3061.  
  3062. ;    j = kbd16(&i);
  3063.     lea    SI,-6[BP]
  3064.     push    SI
  3065.     call    KBD16
  3066.     add    SP,2
  3067.  
  3068. ;    while (j == LEV2) {            /* lose L2 chars */
  3069. ;    j = kbdin(k);
  3070. ;    j = kbd16(&i);
  3071.     mov    -4[BP],AX
  3072. .05F:            ;31
  3073.     cmp    WORD PTR -4[BP],1
  3074.     jne    .081
  3075.     push    WORD PTR -2[BP]
  3076.     call    KBDIN
  3077.     add    SP,2
  3078.     mov    -4[BP],AX
  3079.     lea    SI,-6[BP]
  3080.     push    SI
  3081.     call    KBD16
  3082.     add    SP,2
  3083.     mov    -4[BP],AX
  3084.     jmp    SHORT .05F
  3085.  
  3086. ;    if (j == AKEY) return(i & FUNCTION ? i & FUNMASK : i & 0xFF);
  3087. .081:            ;34
  3088.     cmp    WORD PTR -4[BP],-1
  3089.     jne    .0A4
  3090.     mov    AX,-6[BP]
  3091.     and    AX,256
  3092.     or    AX,AX
  3093.     je    .09A
  3094.     mov    AX,-6[BP]
  3095.     and    AX,319
  3096.     jmp    SHORT .0A0
  3097. .09A:            ;35
  3098.     mov    AX,-6[BP]
  3099.     and    AX,255
  3100. .0A0:            ;35
  3101.     mov    SP,BP
  3102.     pop    BP
  3103.     ret
  3104.  
  3105. ;    return(0);
  3106. .0A4:            ;36
  3107.     xor    AX,AX
  3108.     mov    SP,BP
  3109.     pop    BP
  3110.     ret
  3111. GETKEY    ENDP
  3112.  
  3113.  
  3114. include epilogue.h
  3115.     END
  3116. +ARCHIVE+ gopt.asm      2875 10/01/1983  0:52:00
  3117. PAGE ,132
  3118. ;GOPT.ASM
  3119. ;UPDATE HISTORY
  3120. ;==============
  3121. ; 15 nov 1984       Convert to CI86 V2.2
  3122.  
  3123.     include    asmc.h
  3124.     SEGEND    CODE
  3125.  
  3126.     SEGDEF    DATA
  3127.     EXTRN    swisg_:BYTE, sw100a_:BYTE, gintvect_:WORD
  3128.     SEGEND    DATA
  3129.  
  3130.     SEGDEF    CODE
  3131.  
  3132. PUBLIC  gropt_
  3133.  
  3134. ;********************************************************************
  3135. ;                                                                   *
  3136. ;       p r o c e d u r e   gropt_()                                *
  3137. ;                                                                   *
  3138. ;       purpose:        test if Graphics Option is present.         *
  3139. ;       entry:          none.                                       *
  3140. ;       exit:           ax = 0          option present.             *
  3141. ;                       dax = -1        option not present.         *
  3142. ;       register usage: ax                                          *
  3143. ;       the following globals are set:-                             *
  3144. ;           swisg_      1 = graphics option present                 *
  3145. ;                       0 = no                                      *
  3146. ;           sw100a_     1 = this is Rainbow model 100a              *
  3147. ;                       0 = no, 100b                                *
  3148. ;           gintvect_   = appropriate hardware interrupt vector     *
  3149. ;********************************************************************
  3150.  
  3151.     PROCDEF    gropt_
  3152.     mov    byte ptr swisg_,0    ;flag graphics board not present
  3153.         in      al,8            ;input from port 8
  3154.         test    al,04h          ;test bit 2 to see if option present
  3155.         jz      opt1            ;if option is present, continue
  3156.         mov     ax,-1           ;else, set AX for option not present
  3157.         jmp     optx        ;& exit
  3158. ;===============
  3159. ;option present
  3160. ;===============
  3161. opt1:    mov    byte ptr swisg_,1    ;flag graphics board present
  3162. ;
  3163. ;Find out what the interupt vector is for the graphics option & set gintvect_.
  3164. ; For a Model 100-A, the graphics interrupt vector is 22 Hexadecimal.
  3165. ; For a Model 100-B, the interrupt vector is relocated up to A2H.
  3166. ; If EE00:0F44h and 04<>0, we have the relocated vectors of a Model 100-B
  3167. ;  and need to OR the msb of our vector.
  3168. ;
  3169.         push    es              ;save valid es
  3170.         mov     ax,0ee00h       ;test if vectors are relocated
  3171.         mov     es,ax
  3172.         mov     ax,88h               ;100-A int. vector base addr
  3173.     mov     byte ptr sw100a_,0    ; & set provisional flag
  3174.         test    es:byte ptr 0f44h,4  ;relocated vectors?
  3175.         jz      g0                   ;jump if yes
  3176.         mov     ax,288h              ;100-B int. vector base addr
  3177.     mov     byte ptr sw100a_,1    ; & reset 100b flag
  3178. g0:     mov     word ptr gintvect_,ax
  3179.         pop     es
  3180.         xor     ax,ax           ;set AX for option present
  3181.  
  3182. optx:   ret
  3183.  
  3184.     PROCEND    gropt_
  3185.  
  3186.     include    epilogue.h
  3187.         END
  3188. +ARCHIVE+ graph.h       6994  9/01/1984  0:20:56
  3189. #define HIRES         (gbmod_ & 0x01 ? TRUE  : FALSE)
  3190. #define MEDRES         (gbmod_ & 0x01 ? FALSE : TRUE )
  3191.  
  3192. #define F_HOLLOW  0        /* Interior Fill Types */
  3193. #define F_SOLID   1
  3194. #define F_PATTERN 2
  3195. #define F_HATCH   3
  3196.  
  3197. #define REPLACE    0        /* Write Modes */
  3198. #define COMPLIMENT 1
  3199. #define OVERLAY    2
  3200. #define ERASE      3
  3201.  
  3202. /***** WORK STATION VARIABLES *****/
  3203.  
  3204.  
  3205. #define ws_data   ws_data_
  3206. #define p1        p1_
  3207. #define ws_number ws_number_
  3208. #define ws_wmo    ws_wmo_
  3209. #define gbmod     gbmod_
  3210. #define fgbg      fgbg_
  3211. #define alups     alups_
  3212. #define gbmskl    gbmskl_
  3213. #define gbmskh    gbmskh_
  3214. #define gdcml     gdcml_
  3215. #define gdcmh     gdcmh_
  3216. #define curl0     curl0_
  3217. #define curl1     curl1_
  3218. #define curl2     curl2_
  3219. #define ymax      ymax_
  3220. #define xmax      xmax_
  3221. #define twdir     twdir_
  3222. #define nmritl    nmritl_
  3223. #define nmrith    nmrith_
  3224. #define sh_p_lin  sh_p_lin_
  3225. #define wd_p_lin  wd_p_lin_
  3226. #define x_start   x_start_
  3227. #define y_start   y_start_
  3228. #define x_stop    x_stop_
  3229. #define y_stop    y_stop_
  3230. #define g_strtx   g_strtx_
  3231. #define scr_top   scr_top_
  3232. #define scr_bot   scr_bot_
  3233. #define scrltb    scrltb_
  3234. #define clmpda    clmpda_
  3235.  
  3236. extern unsigned char ws_data_[28];    /*All the bytes needed to initialise*/
  3237.                     /*the work station. DO NOT CHANGE.*/
  3238. extern unsigned char p1_[16];        /*param table for PRAM & FIGS cmnds.*/
  3239. extern unsigned char ws_number_;    /*work station ident. 1 to 6*/
  3240. extern unsigned char ws_wmo_;        /*write mode. 0 to 3*/
  3241. extern unsigned char gbmod_;        /*GO's mode register.*/
  3242. extern unsigned char fgbg_;        /*defines fore_grnd/back_grnd colour.*/
  3243. extern unsigned char alups_;        /*defines the writing mode.*/
  3244. extern unsigned char gbmskl_;        /*GO's write mask, split into low and*/
  3245. extern unsigned char gbmskh_;        /*high bytes.*/
  3246. extern unsigned char gdcml_;        /*GDC's write mask, as above.*/
  3247. extern unsigned char gdcmh_;
  3248. extern unsigned char curl0_;        /*three bytes which define the GDC's*/
  3249. extern unsigned char curl1_;        /*cursor position.*/
  3250. extern unsigned char curl2_;        /*curl2 only uses it's high nibble.*/
  3251. extern unsigned int  ymax_;        /*max pixels on 'y' axis. 0 to ymax*/
  3252. extern unsigned int  xmax_;        /*max pixels on 'x' axis. 0 to xmax*/
  3253. extern unsigned char twdir_;        /*direct'n for word & vector drawing.*/
  3254. extern unsigned char nmritl_;        /*# words to write. used by FIGS*/
  3255. extern unsigned char nmrith_;
  3256. extern unsigned int  sh_p_lin_;        /*number of shifts to do to convert a*/
  3257.                     /*line number to an absolute address.*/
  3258. extern unsigned int  wd_p_lin_;        /*number of words per line.*/
  3259. extern unsigned int  x_start_;        /*four gen. purpose variables, mainly*/
  3260. extern unsigned int  y_start_;        /*used for line drawing to defined the*/extern unsigned int  x_stop_;        /*start and stop vectors.*/
  3261. extern unsigned int  y_stop_;
  3262. extern unsigned char g_strtx_;        /*defines current 'x' offset from the*/
  3263.                     /*start of line to 1st pix. displayed*/
  3264. extern unsigned char scr_top_;        /*define the top & bottom lines for*/
  3265. extern unsigned char scr_bot_;        /*vertical scrolling.*/
  3266. extern unsigned char scrltb_[256];    /*mirror of line number sequence.*/
  3267. extern unsigned char clmpda_[32];    /*defines the colour intensities.*/
  3268.  
  3269. /****** TEXT VARIABLES ******/
  3270. #define t_col    t_col_
  3271. extern unsigned char t_col_;        /*text colour.affects "text"&"gtext."*/
  3272. #define t_font   t_font_
  3273. extern unsigned char t_font_;        /*text font.   affects "gtext" only.*/
  3274. #define t_sca    t_sca_
  3275. extern unsigned char t_sca_;        /*text scale.  affects "text" only.*/
  3276. #define t_dir    t_dir_
  3277. extern unsigned char t_dir_;        /*direction that text is written.*/
  3278.                     /*             affects "text" only.*/
  3279. #define t_x      t_x_
  3280. extern unsigned int  t_x_;        /*define the bottom left of the char.*/
  3281. #define t_y      t_y_
  3282. extern unsigned int  t_y_;        /*cell in which char. is displayed.*/
  3283. #define tfonts   tfonts_
  3284. extern unsigned char tfonts_[4][256][10]; /*table of 4 user definable fonts*/
  3285.                       /*for gtext characters.*/
  3286. /****** LINE VARIABLES ******/
  3287. #define l_col    l_col_
  3288. extern unsigned char l_col_;        /*line colour.*/
  3289. #define l_type   l_type_
  3290. extern unsigned char l_type_;        /*line type, indexes "pattbl".*/
  3291. #define l_wid    l_wid_
  3292. extern unsigned char l_wid_;        /*line width. (not used currently).*/
  3293. #define pattbl   pattbl_
  3294. extern unsigned char pattbl_[16][2];    /*defines patterns & repeat factors*/
  3295.                     /* for drawing lines.*/
  3296.  
  3297. /****** FILL VARIABLES ********/
  3298. #define f_col    f_col_
  3299. extern unsigned char f_col_;        /*fill colour.*/
  3300. #define f_type   f_type_
  3301. extern unsigned char f_type_;        /*fill type. 0 to 3*/
  3302. #define f_style  f_style_
  3303. extern unsigned char f_style_;        /*fill style. 0 to 7*/
  3304. #define f_patrn  f_patrn_
  3305. extern unsigned char f_patrn_[17][8];    /*table of patterns for filling:*/
  3306.                     /*f_patrn[0]    solid.    f_type = 1.*/
  3307.                     /*f_patrn[1-8]  patterns. f_type = 2.*/
  3308.                     /*f_patrn[9-16] hatches.  f_type = 3.*/
  3309. /****** MARKER VARIABLES ******/
  3310. #define m_col    m_col_
  3311. extern unsigned char m_col_;        /*marker colour.*/
  3312. #define m_type   m_type_
  3313. extern unsigned char m_type_;        /*marker type. 0 to 15*/
  3314. #define m_sca    m_sca_
  3315. extern unsigned char m_sca_;        /*marker scale.*/
  3316. #define m_tab    m_tab_
  3317. extern unsigned char m_tab_[16][16];    /*vector table for markers.*/
  3318.  
  3319. #define gp_buff  gp_buff_
  3320. extern unsigned int  gp_buff_[2048];    /*gen. purpose array for 'xy' points.*/
  3321.                     /*Used heavily by "circle","segment",*/
  3322.                     /*"arc" and "rectangle", therefore*/
  3323.                     /*don't use it for these functions.*/
  3324.  
  3325. /***************************************************************/
  3326. /*          FUNCTION CALLS                                 */
  3327. /***************************************************************/
  3328. #define arc        arc_
  3329. #define bar        bar_
  3330. #define chk_col        chk_col_
  3331. #define circle        circle_
  3332. #define clearws        clearws_
  3333. #define color        color_
  3334. #define g_off()        g_off_()
  3335. #define g_on()        g_on_()
  3336. #define gchar        gchar_
  3337. #define grey        grey_                /*INTERNAL CALL*/
  3338. #define gtext        gtext_
  3339. #define hscroll        hscroll_
  3340. #define init_scrol    init_scrol_
  3341. #define int_done    int_done_
  3342. #define line        line_
  3343. #define openws        openws_
  3344. #define point        point_
  3345. #define polyfill    polyfill_
  3346. #define polyline    polyline_
  3347. #define polymark    polymark_
  3348. #define rd_cell        rd_cell_    /*read bitmap*/
  3349. #define rectangle    rectangle_
  3350. #define rq_locator    rq_locator_
  3351. #define segment        segment_
  3352. #define st_locator    st_locator_
  3353. #define text        ltext_
  3354. #define vscroll        vscroll_
  3355. #define wr_cell        wr_cell_    /*write bitmap*/
  3356. /***************************************************************/
  3357. /*      Read/write bitmap cell structure                       */
  3358. /***************************************************************/
  3359.  
  3360. struct g_cell {
  3361.     int c_corner[4];        /*defines bottom-left & top right*/
  3362.     int c_plane;            /*plane number read*/
  3363.     int c_rows;            /*#rows read*/
  3364.     int c_bytes;            /*#bytelength of each row element*/
  3365.     unsigned char *c_segment;    /*opt segment addr of temp area*/
  3366.     unsigned char *c_offset;    /*opt offset addr of temp area*/
  3367. };
  3368. +ARCHIVE+ greq.asm      7552 10/01/1983  0:04:16
  3369. PAGE ,132
  3370. TITLE GREQ.ASM
  3371. ;***********************************************************
  3372. ;*                                                         *
  3373. ;*  I/O requests - use host language                       *
  3374. ;*                                                         *
  3375. ;***********************************************************
  3376. ;UPDATE HISTORY
  3377. ;==============
  3378. ; 3-dec-84     Make general purpose host requirements program 
  3379. ;              convert CREQ.C to assembler
  3380.  
  3381. include asmc.h
  3382.     SEGEND CODE
  3383.  
  3384.     SEGDEF    DATA
  3385.     extrn    WS_NUMBER_:byte, WS_DATA_:byte, TFONTS_:byte, _CARRY:word
  3386.     extrn    F_WORK_BUF_:byte
  3387. m1    db    'MSDOS FORTRAN Graphics Library 2.00.2 29-nov-84'
  3388.     db    ' (c) Digital Equipment Co. Ltd.',0AH,0
  3389. m2    db    'SMIDMON.GRA',0
  3390. m3    db    'SHIGHMON.GRA',0
  3391. m4    db    'SMIDCOL.GRA',0
  3392. m5    db    'SHIGHCOL.GRA',0
  3393. m6    db    'DMID.GRA',0
  3394. m7    db    'DHIGH.GRA',0
  3395.  
  3396. el    db    0AH,0Dh,0
  3397.  
  3398. Wsdrivers LABEL WORD        ;static char *wsdrivers[]
  3399.     dw    DGROUP:m2
  3400.     dw    DGROUP:m3
  3401.     dw    DGROUP:m4
  3402.     dw    DGROUP:m5
  3403.     dw    DGROUP:m6
  3404.     dw    DGROUP:m7
  3405. Handle    dw    0        ;Msdos file handle
  3406.     SEGEND  DATA
  3407.  
  3408.  
  3409.     SEGDEF    CODE
  3410.  
  3411.     public    LD_FONT_, LD_WSDETS_, MALLOC_, FREE_, CONOUT_
  3412.  
  3413.     EXTRN    msdos:NEAR
  3414.  
  3415. ; print ASCIZ message in DS:SI
  3416. pmsg_    PROC    NEAR
  3417.     cld            ;left->right
  3418. pmsg1:    lodsb            ;get next char
  3419.     and    ax,255        ;ensure char only
  3420.     or    al,al
  3421.     jz    pmsgx        ;Q. all dun
  3422.     push    SI        ;save pointer
  3423.     push    AX
  3424.     call    conout_        ;write char
  3425.     add    sp,2
  3426.     pop    SI
  3427.     jmp    SHORT pmsg1
  3428. pmsgx:    ret
  3429. pmsg_    ENDP
  3430.  
  3431. ;***************************************
  3432. ;* Process a file into a named area    *
  3433. ;***************************************
  3434. ;*ld_file_(fn,where,cnt)               *
  3435. ;*char *fn,*where;                     *
  3436. ;*unsigned int  cnt;                   *
  3437. ;***************************************
  3438. ;{  unsigned int handle, chk;
  3439.  
  3440. ld_file_ PROC    NEAR
  3441.     push    BP
  3442.     mov    BP,SP
  3443.     sub    SP,4
  3444. ;   handle = msdos(0x3D00,0,0,fn);        /*open fn*/
  3445.     push    WORD PTR +4[BP]
  3446.     xor    AX,AX
  3447.     push    AX
  3448.     push    AX
  3449.     mov    AX,15616
  3450.     push    AX
  3451.     call    MSDOS
  3452.     add    SP,8
  3453.     mov    -4[BP],AX
  3454. ;   if(_carry) {return(handle);}
  3455.     mov    AX,_CARRY
  3456.     or    AX,AX
  3457.     je    .07C5
  3458.     mov    AX,-4[BP]
  3459.     mov    SP,BP
  3460.     pop    BP
  3461.     ret
  3462. ;   chk = msdos(0x3F00,handle,cnt,where);    /*read fn cnt bytes*/
  3463. .07C5:            ;192
  3464.     push    WORD PTR +6[BP]
  3465.     push    WORD PTR +8[BP]
  3466.     push    WORD PTR -4[BP]
  3467.     mov    AX,16128
  3468.     push    AX
  3469.     call    MSDOS
  3470.     add    SP,8
  3471.     mov    -2[BP],AX
  3472. ;   if (_carry) {return(chk);}
  3473.     mov    AX,_CARRY
  3474.     or    AX,AX
  3475.     je    .07EA
  3476.     mov    AX,-2[BP]
  3477.     mov    SP,BP
  3478.     pop    BP
  3479.     ret
  3480. ;   if (chk < cnt) {return(EOF);}
  3481. .07EA:            ;194
  3482.     mov    AX,-2[BP]
  3483.     cmp    AX,+8[BP]
  3484.     jae    .07F9
  3485.     mov    AX,-1
  3486.     mov    SP,BP
  3487.     pop    BP
  3488.     ret
  3489. ;   chk = msdos(0x3E00,handle,0,0);            /* close fn*/
  3490. .07F9:            ;195
  3491.     xor    AX,AX
  3492.     push    AX
  3493.     push    AX
  3494.     push    WORD PTR -4[BP]
  3495.     mov    AX,15872
  3496.     push    AX
  3497.     call    MSDOS
  3498.     add    SP,8
  3499.     mov    -2[BP],AX
  3500. ;   if (_carry) {return(chk);}
  3501.     mov    AX,_CARRY
  3502.     or    AX,AX
  3503.     je    .081C
  3504.     mov    AX,-2[BP]
  3505.     mov    SP,BP
  3506.     pop    BP
  3507.     ret
  3508. ;   return(NULL);
  3509. .081C:            ;197
  3510.     xor    AX,AX
  3511.     mov    SP,BP
  3512.     pop    BP
  3513.     ret
  3514. ld_file_ ENDP
  3515.  
  3516. ;************************************************************************
  3517. ;*      F U N C T I O N    ld_font_(font_fn, font_number)                *
  3518. ;*                         char *font_fn;                                *
  3519. ;*                         int  font_number;                            *
  3520. ;*      purpose:        load data in a file into one of the graphics    *
  3521. ;*                      font arrays.                                    *
  3522. ;*      entry:          font_fn is the name of the file.                *
  3523. ;*                      font_number number to be loaded. [0 to 3]       *
  3524. ;*      exit:           NULL if font loaded OK.                         *
  3525. ;*                      EOF if font data file could not be found.       *
  3526. ;************************************************************************
  3527.  
  3528. ;ld_font_(font_fn,font_number)
  3529. ;char *font_fn;
  3530. ;int   font_number;
  3531.  
  3532.  
  3533.  
  3534.     PROCDEF    LD_FONT_
  3535.     push    BP
  3536.     mov    BP,SP
  3537.     sub    SP,4
  3538.             ;i = ld_file_(font_fn,960,tfonts_[font_number][0][0]);
  3539.     lea    SI,TFONTS_          ;calc base addr of tfonts_
  3540.     mov    BX,960
  3541.     mov    AX,+6[BP]           ;indexed by font_number
  3542.     imul    BX
  3543.     add    SI,AX
  3544.     add    SI,0
  3545.     add    SI,0
  3546.     mov    AL,[SI]
  3547.     and    AX,255
  3548.     push    AX            ;P3 = buffer address addr
  3549.     mov    AX,960
  3550.     push    AX            ;P2 = text font length
  3551.     push    WORD PTR +4[BP]        ;P1 = pathname
  3552.     call    ld_file_
  3553.     add    SP,6
  3554.     mov    SP,BP            ;return(i);
  3555.     pop    BP
  3556.     ret
  3557.     PROCEND  LD_FONT_
  3558.  
  3559. ;************************************************************************
  3560. ;*      F U N C T I O N    ld_wsdets_()                                  *
  3561. ;*      purpose:        load workstation data from file                 *
  3562. ;*      entry:          <ws_number_> number to be loaded. [1 to 6]      *
  3563. ;*      exit:           NULL workstation loaded OK.                     *
  3564. ;*                      EOF if workstation file could not be found.     *
  3565. ;************************************************************************
  3566.  
  3567.  
  3568. ;ld_wsdets_()
  3569.     PROCDEF LD_WSDETS_
  3570.     push    BP
  3571.     mov    BP,SP
  3572.     sub    SP,6
  3573.     lea    SI,WORD PTR m1        ;fprintf(stderr,notice);
  3574.     call    pmsg_
  3575.     lea    SI,el
  3576.     call    pmsg_
  3577.     mov    AL,BYTE PTR WS_NUMBER_    ;if ( (ws = ws_number_) == 0
  3578.     and    AX,255
  3579.     mov    -2[BP],AX
  3580.     cmp    AX,0
  3581.     jne    .0D2
  3582.     jmp    SHORT .0D9
  3583. .0D2:            ;75
  3584.     cmp    WORD PTR -2[BP],6    ;... or  ws > 6)
  3585.     jle    .0F2
  3586. .0D9:
  3587.     mov    AX,-1            ;...return(EOF);
  3588.     mov    SP,BP
  3589.     pop    BP
  3590.     ret
  3591. .0F2:                ;i = ld_file_(Wsdrivers[ws],ws_data_,1792)
  3592.     mov    AX,1792
  3593.     push    AX
  3594.     lea    AX,WS_DATA_
  3595.     push    AX
  3596.     lea    SI,Wsdrivers        ;get pointer to pathname
  3597.     dec    WORD PTR -2[BP]
  3598.     mov    AX,-2[BP]
  3599.     shl    AX,1
  3600.     add    SI,AX
  3601.     push    WORD PTR [SI]        ;P1 = *pathname
  3602.     call    ld_file_
  3603.     add    SP,6
  3604.     mov    SP,BP            ;return(i);
  3605.     pop    BP
  3606.     ret
  3607.     PROCEND    LD_WSDETS_
  3608.  
  3609. ;************************************************************************
  3610. ;*      F U N C T I O N    malloc_(bytes)                               *
  3611. ;*                         int bytes;                                   *
  3612. ;*      purpose:        allocate temp memory in stack space             *
  3613. ;*      entry:          bytes  #bytes to alloc                          *
  3614. ;*      exit:           NULL no core.                                   *
  3615. ;*                      offset (in DS) of allocated memory.             *
  3616. ;************************************************************************
  3617.  
  3618.     PROCDEF    MALLOC_
  3619.     lea    AX,F_WORK_BUF_
  3620.     ret
  3621.     PROCEND    MALLOC_
  3622.  
  3623. ;************************************************************************
  3624. ;*      F U N C T I O N    free_(area)                                  *
  3625. ;*      purpose:        release stack space memory after malloc_ call   *
  3626. ;*      entry:          area  mem pointer of area given by malloc_      *
  3627. ;*      exit:           none.                                           *
  3628. ;************************************************************************
  3629.  
  3630.     PROCDEF    FREE_
  3631.     ret
  3632.     PROCEND    FREE_
  3633.  
  3634. ;************************************************************************
  3635. ;*      F U N C T I O N    conout_(char)                                *
  3636. ;*      purpose:        output character to console                     *
  3637. ;*      entry:          char to be output                               *
  3638. ;*      exit:           none.                                           *
  3639. ;************************************************************************
  3640.  
  3641.     PROCDEF    CONOUT_
  3642.     push    BP
  3643.     mov    BP,SP
  3644.     mov    DL,+4[BP]
  3645.     and    DX,255
  3646.     push    DX        ;DX = char
  3647.     push    DX        ;CX = dummy
  3648.     push    DX        ;BX = dummy
  3649.     mov    ah,06H
  3650.     push    AX        ;AX = direct console I/O
  3651.     call    msdos
  3652.     add    SP,8
  3653.     mov    SP,BP
  3654.     pop    BP
  3655.     ret
  3656.     PROCEND    CONOUT_
  3657.  
  3658.     include    epilogue.h
  3659.     end
  3660. +ARCHIVE+ gsx86.c       1228 11/16/1984 12:31:28
  3661. /***************************************************************/
  3662. /*      GSX86MWC COMPATABLE FUNCTION CALLS                     */
  3663. /***************************************************************/
  3664. #include "graph.h"
  3665.  
  3666. charht(tscale)
  3667. unsigned char tscale;
  3668. { t_sca_ = tscale;  }
  3669.  
  3670. closews()
  3671. { ws_number_ = 0; g_off_(); }
  3672.  
  3673. direction(tdir)
  3674. unsigned char tdir;
  3675. { t_dir_ = tdir;    }
  3676.  
  3677. fillcolor(fcol)
  3678. unsigned char fcol;
  3679. { f_col_ = fcol;    }
  3680.  
  3681. fillstyle(fstyle)
  3682. unsigned char fstyle;
  3683. { f_style_ = fstyle;}
  3684.  
  3685. filltype(ftype)
  3686. unsigned char ftype;
  3687. { f_type_  = ftype; }
  3688.  
  3689. linecolor(lcolor)
  3690. unsigned char lcolor;
  3691.  { l_col_  = lcolor; }
  3692.  
  3693. linetype(ltype)
  3694. unsigned char ltype;
  3695.  { l_type_ = ltype;  }
  3696.  
  3697. linewidth(lwidth)
  3698. unsigned char lwidth;
  3699.  { l_wid_  = lwidth; }
  3700.  
  3701. markercolor(mcolor)
  3702. unsigned char mcolor;
  3703.  { m_col_  = mcolor; }
  3704.  
  3705. markerscale(mscale)
  3706. unsigned char mscale;
  3707.  { m_sca_  = mscale; }
  3708.  
  3709. markertype(mtype)
  3710. unsigned char mtype;
  3711.  { m_type_ = mtype;  }
  3712.  
  3713. setwmode(mode)
  3714. unsigned char mode;
  3715.  { ws_wmo_ = mode; a_wmode_(); }
  3716.  
  3717. textcolor(tcolor)
  3718. unsigned char tcolor;
  3719.  { t_col_ = tcolor;  }
  3720.  
  3721. textfont(tfont)
  3722. unsigned char tfont;
  3723.   { t_font_ = tfont;  }
  3724.  
  3725. updatews()
  3726. { return; }
  3727. +ARCHIVE+ gtext.asm     9872 12/21/1984 17:19:22
  3728. PAGE ,132
  3729. TITLE GTEXT.ASM
  3730. ;UPDATE HISTORY
  3731. ;==============
  3732. ;15 nov 84    Convert to C86 V2.2
  3733. ;21-dec-84    fix some things
  3734.  
  3735.     include    asmc.h
  3736.  
  3737.     SEGEND    CODE
  3738.  
  3739.     SEGDEF    DATA
  3740.  
  3741. EXTRN    t_x_:WORD, t_y_:WORD, t_col_:BYTE, gbmod_:BYTE, sh_p_lin_:BYTE
  3742. EXTRN    ymax_:WORD, xmax_:WORD, curl0_:BYTE, curl2_:BYTE
  3743. EXTRN    y_start_:WORD,x_start_:WORD
  3744. EXTRN    tfonts_:BYTE, t_font_:BYTE, gbmskl_:BYTE
  3745.  
  3746.     SEGEND    DATA
  3747.  
  3748.     SEGDEF    CODE
  3749.  
  3750. PUBLIC    gtext_, gchar_
  3751.  
  3752.     IF    @bigmodel
  3753. EXTRN    gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, a_gbmsk_:FAR, a_cur_:FAR
  3754. EXTRN    fifo_mt_:FAR, cxy2cp_:FAR
  3755.     ELSE
  3756. EXTRN    gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, a_gbmsk_:NEAR, a_cur_:NEAR
  3757. EXTRN    fifo_mt_:NEAR, cxy2cp_:NEAR
  3758.     ENDIF
  3759.  
  3760.  
  3761. ;************************************************************************
  3762. ;*                                                                      *
  3763. ;*      F U N C T I O N    gtext_(x, y, string)                          *
  3764. ;*                         int x, y;                                    *
  3765. ;*                         char *string;                                *
  3766. ;*                                                                      *
  3767. ;*      purpose:        print a string of text at a specific 'xy'       *
  3768. ;*                      position. X & Y are defined as pixel locations  *
  3769. ;*                      at the bottom left of the character cell.       *
  3770. ;*                                                                      *
  3771. ;*      entry:            6[bp] 'x' position                            *
  3772. ;*                        8[bp] 'y' position                            *
  3773. ;*                       10[bp] pointer to NULL terminated string       *
  3774. ;*                                                                      *
  3775. ;************************************************************************
  3776.  
  3777.     PROCDEF    gtext_
  3778.         push    si
  3779.         push    bp
  3780.         mov     bp,sp
  3781.  
  3782.         mov     ax,6[bp]                ;get 'x' position
  3783.         mov     WORD PTR t_x_,ax        ;and save.
  3784.         mov     ax,8[bp]                ;get 'y' position
  3785.         mov     WORD PTR t_y_,ax        ;and save.
  3786.  
  3787.         call    gdc_nb_
  3788.         mov     al,BYTE PTR t_col_
  3789.         call    chk_col_
  3790.         mov     si,10[bp]               ;point to start of string
  3791.         cld                             ;make sure we inc 'si'.
  3792.         test    BYTE PTR gbmod_,2
  3793.         jz      Lt0                     ;jump if already in text mode else
  3794.         and     BYTE PTR gbmod_,0FDH    ;assert text mode.
  3795.         call    a_mode_
  3796. Lt0:    lodsb
  3797.         or      al,al                   ;check for the end of string.
  3798.         jz      Lt1                     ;quit if it is.
  3799.         push    ax
  3800.         call    gchar_
  3801.         add     sp,2
  3802.         jmp     Lt0
  3803.  
  3804. Lt1:    pop     bp
  3805.         pop     si
  3806.         ret
  3807.     PROCEND    gtext_
  3808.  
  3809. ;************************************************************************
  3810. ;*                                                                      *
  3811. ;*        f u n c t i o n   gchar_(char)                                 *
  3812. ;*                                                                      *
  3813. ;*  purpose:    write graphics text                                     *
  3814. ;*  entry:      6[bp] character to be written                           *
  3815. ;*                                                                      *
  3816. ;*  conditions: 1) text cursor is correctly placed                      *
  3817. ;*              2) fgbg and alups already defined                       *
  3818. ;*              3) text font has been selected                          *
  3819. ;************************************************************************
  3820.  
  3821.     PROCDEF    gchar_
  3822.         push    si
  3823.         push    bp
  3824.         mov     bp,sp
  3825.  
  3826.         mov     ax,6[bp]
  3827.         cmp    al,1FH                  ;unprintable character0
  3828.         ja      L0                      ;jump if not.
  3829.         call    L20                     ;see if it's one of the control chars
  3830.         jmp    L11                     ; we can handle, then exit.
  3831. L0:     test    al,80H                  ;is character within table0
  3832.         jz      L1                      ;jump if not.
  3833.         jmp    L11                     ;if yes just exit.
  3834.  
  3835. ;adjust co-ordinates in t_x_ & t_y_ and assert the cursor.
  3836.  
  3837. L1:     mov     ax,WORD PTR t_x_         ;get column number
  3838.         and     ax,0FFF0H
  3839.     mov    WORD PTR x_start_,ax
  3840.         mov     ax,WORD PTR ymax_
  3841.         sub     ax,WORD PTR t_y_      ;t_y_ specified as bot_left of ch cell.
  3842.         sub     ax,9                 ;move 'y' to top left of character cell.
  3843.         jns     L1a
  3844.         xor     ax,ax
  3845. L1a:    mov    WORD PTR y_start_,ax
  3846.         call    cxy2cp_
  3847.  
  3848.         mov     ax, 6[bp]
  3849.         sub    al,20H                  ;table starts with a space at 0.
  3850.         xor    ah,ah
  3851.         shl     ax,1
  3852.         mov     bx,ax                   ;bx = al * 2
  3853.         shl     ax,1
  3854.         shl     ax,1                    ;ax = al * 8
  3855.         add     bx,ax                   ;bx = al * 10
  3856.         lea     si, tfonts_       ;point to start of font table
  3857.         mov     al,BYTE PTR t_font_     ;get font type
  3858.         inc     al
  3859. L4:     dec     al
  3860.         jz      L5
  3861.         add     si,960          ;add font table size to table offset
  3862.         jmp     L4
  3863. L5:     add     si,bx           ;si now points to the 10DB table entry
  3864.  
  3865.         test    WORD PTR t_x_,8
  3866.         jnz     L3a
  3867.         mov     WORD PTR gbmskl_,000FFH
  3868.         jmp     L3b
  3869. L3a:    mov     WORD PTR gbmskl_,0FF00H
  3870. L3b:    call    gdc_nb_
  3871.         call    a_gbmsk_                ;assert the graf board mask
  3872.  
  3873.         cld                             ;make sure lodsb incs si.
  3874.         mov    al,0FEH                 ;reset the char ram counter.
  3875.         out    53H,al
  3876.         out    51H,al
  3877.         lodsw                           ;fetch both bytes.
  3878.         out    52H,al         ;put the byte into both 1 and 2 char ram bytes.
  3879.         out    52H, al
  3880.         mov    al,ah
  3881.         out    52H, al        ;put theDB into both 1 and 2 char ram bytes.
  3882.         out    52H, al
  3883.         mov    al,0FEH                 ;reset the char ram counter.
  3884.         out    53H,al
  3885.         out    51H,al
  3886.  
  3887.         call    a_cur_                  ;assert the cursor command.
  3888.         mov    al,4CH                  ;assert the {04c command.
  3889.         out    57H,al
  3890.         xor     al,al                   ;assert the down directinon to write.
  3891.         out    56H,al
  3892.         inc    al                      ;do it 2 write cycles.
  3893.         out    56H,al
  3894.         dec     al
  3895.         out    56H,al
  3896.         mov    al,22H                    ;assert the wdat command.
  3897.         out    57H,al
  3898.         mov    al,0FFH
  3899.         out    56H,al
  3900.         out    56H,al
  3901.  
  3902.         call    gdc_nb_
  3903.  
  3904.         mov     cx,8                    ;eight scan lines.
  3905. L8:     lodsb                           ;fetch theDB.
  3906.         out    52H, al            ;put theDB into both 1 and 2 char ram bytes.
  3907.         out    52H, al
  3908.         loop    L8
  3909.  
  3910.         mov    al,4CH                  ;assert the figs command.
  3911.         out    57H,al
  3912.         mov     al,00                   ;assert the down directinon to write.
  3913.         out    56H,al
  3914.         mov     ax,7                    ;do 8 write cycles.
  3915.         out    56H,al
  3916.         mov    al,ah
  3917.         out    56H,al
  3918.         mov    al,22H                  ;assert the wdat command.
  3919.         out    57H,al
  3920.         mov    al,0FFH
  3921.         out    56H,al
  3922.         out    56H,al
  3923.  
  3924. ;Now adjust the text character position & test for word wrapping
  3925.  
  3926.         mov     ax, WORD PTR t_x_
  3927.         add     ax,8                    ;character width
  3928.         cmp     WORD PTR xmax_,ax       ;have we gone past the end of the line0
  3929.         jns     L9
  3930.         xor     ax,ax                   ;back to start of line
  3931. L9:     mov     WORD PTR t_x_,ax
  3932.         jnz     L11                 ;exit if we don't have to go to a new line.
  3933.         mov     ax,WORD PTR t_y_
  3934.         sub     ax,10                   ;move to next character line
  3935.         or      ax,ax                   ;are we on last line already0
  3936.         jns     L10
  3937.         xor     ax,ax
  3938. L10:    mov     WORD PTR t_y_,ax
  3939.  
  3940. L11:    pop     bp
  3941.         pop     si
  3942.         ret
  3943.  
  3944. ;Control character handler [ax contains the character]:
  3945. ;       007     bell
  3946. ;       008     back_space
  3947. ;       009     tab
  3948. ;       00a     line_feed       [also does a carriage_return]
  3949. ;       00c     clear_screen    [********* not yet *********]
  3950. ;       00d     carriage_return
  3951.  
  3952. L20:    cmp     al,7                    ;is it a bell ?
  3953.         jnz     L30
  3954. L21:    mov     cl,2
  3955.         mov     dl, al
  3956.         int     0E0H
  3957.         ret
  3958.  
  3959. L30:    cmp     al,8                    ;is it back_space ?
  3960.         jnz     L40
  3961.         cmp     WORD PTR t_x_, 0
  3962.         jnz     L31
  3963.         mov     ax,7
  3964.         jmp     L21
  3965. L31:    sub     WORD PTR t_x_,8
  3966.         ret
  3967.  
  3968. L40:    cmp     al,9                    ;is it tab ?
  3969.         jnz     L50
  3970.         mov     ax, WORD PTR t_x_
  3971.         and     ax, 0FFC0H              ;go back to last multiple of 64
  3972.         add     ax,64                   ;next tab position
  3973.         cmp     WORD PTR xmax_,ax
  3974.         jns     L41
  3975.         mov     ax,7
  3976.         jmp     L21
  3977. L41:    mov     WORD PTR t_x_,ax
  3978.         ret
  3979.  
  3980. L50:    cmp     al,0AH  ;is it line_feed ?
  3981.         jnz     L60
  3982. L51:    mov     ax,WORD PTR t_y_
  3983.         sub     ax, 10
  3984.         or      ax,ax
  3985.         jns     L52
  3986.         mov     ax,7
  3987.         jmp     L21
  3988. L52:    mov     WORD PTR t_y_, ax
  3989.         ret
  3990.  
  3991. L60:    cmp     al,0CH  ;is it clear_screen ?
  3992.         jnz     L70
  3993.         mov     WORD PTR t_y_,10        ;for now, just home cursor.
  3994.         mov     WORD PTR t_x_,10
  3995. L61:    ret
  3996.  
  3997. L70:    cmp     al,0DH                  ;is it carriage_return ?
  3998.         jnz     L61                     ;exit if not.
  3999.         mov     WORD PTR t_x_,0
  4000.         jmp     L51
  4001.  
  4002.     PROCEND    gchar_
  4003.  
  4004.     include    epilogue.h
  4005.     END
  4006. +ARCHIVE+ key.h         1850 11/16/1984 13:01:28
  4007. /*************************************************/
  4008. /*           K E Y . H                     */
  4009. /*    G L O B A L    D E F I N I T I O N S     */
  4010. /*************************************************/
  4011.  
  4012. #define TRUE        1    /* truth value */
  4013. #define FALSE        0    /* falsehood */
  4014.  
  4015. #define FUNCTION    0x100    /* pertinent bit in 16-bit key return */
  4016.  
  4017. #define FUNKEY(keyval)        (keyval & FUNCTION ? TRUE : FALSE)
  4018.  
  4019. /* important function keys */
  4020.  
  4021. #define PSCR    (FUNCTION |   2)
  4022. #define F4      (FUNCTION |   4)
  4023. #define BRK     (FUNCTION |   5)
  4024. #define INT     (FUNCTION |   6)
  4025. #define RES     (FUNCTION |   7)
  4026. #define CANC    (FUNCTION |   8)
  4027. #define BS   8
  4028. #define MAIN    (FUNCTION |   9)
  4029. #define TAB  9
  4030. #define EXIT    (FUNCTION |  10)
  4031. #define LF   10
  4032. #define RET  13
  4033. #define ADDO    (FUNCTION |  14)
  4034. #define HELP    (FUNCTION |  15)
  4035. #define DO      (FUNCTION |  16)
  4036. #define F17     (FUNCTION |  17)
  4037. #define F18     (FUNCTION |  18)
  4038. #define F19     (FUNCTION |  19)
  4039. #define F20     (FUNCTION |  20)
  4040. #define FIND    (FUNCTION |  21)
  4041. #define INS     (FUNCTION |  22)
  4042. #define REM     (FUNCTION |  23)
  4043. #define SEL     (FUNCTION |  24)
  4044. #define PREV    (FUNCTION |  25)
  4045. #define NEXT    (FUNCTION |  26)
  4046. #define UP      (FUNCTION |  27)
  4047. #define ESC  27
  4048. #define LEFT    (FUNCTION |  28)
  4049. #define DOWN    (FUNCTION |  29)
  4050. #define RGHT    (FUNCTION |  30)
  4051. #define K0    (FUNCTION |  31)
  4052. #define K1    (FUNCTION |  32)
  4053. #define K2    (FUNCTION |  33)
  4054. #define K3    (FUNCTION |  34)
  4055. #define K4    (FUNCTION |  35)
  4056. #define K5    (FUNCTION |  36)
  4057. #define K6    (FUNCTION |  37)
  4058. #define K7    (FUNCTION |  38)
  4059. #define K8    (FUNCTION |  39)
  4060. #define K9    (FUNCTION |  40)
  4061. #define KQUO    (FUNCTION |  41)
  4062. #define KMIN    (FUNCTION |  42)
  4063. #define KDOT    (FUNCTION |  43)
  4064. #define PF1     (FUNCTION |  44)
  4065. #define PF2     (FUNCTION |  45)
  4066. #define PF3     (FUNCTION |  46)
  4067. #define PF4     (FUNCTION |  47)
  4068. #define KENT    (FUNCTION |  48)
  4069. #define DEL  0x7f
  4070.  
  4071. +ARCHIVE+ ltext.asm    13316 10/01/1983  0:53:44
  4072. PAGE ,132
  4073. ;LTEXT.ASM
  4074. ;UPDATE HISTORY
  4075. ;==============
  4076. ; 15 nov 84    Convert to CI86 V2.2
  4077.  
  4078.     include    asmc.h
  4079.  
  4080.     SEGEND    CODE
  4081.  
  4082.     SEGDEF    DATA
  4083.  
  4084. EXTRN    l_type_:BYTE, t_col_:BYTE, gbmod_:BYTE, t_sca_:BYTE
  4085.  
  4086. Lflag    DB      1
  4087. Lxs    DW      1
  4088. Lys    DW      1
  4089. Lxf    DW      1
  4090. Lyf    DW      1
  4091.  
  4092. ;******************************************************************
  4093. ;*                                                                *
  4094. ;*                      stroke font character set                 *
  4095. ;*                                                                *
  4096. ;******************************************************************
  4097. ;
  4098. ;the following tables are vertice information for a stroked character
  4099. ;set the x,y coordinate information is represented by 4 bit 2's 
  4100. ;complement numbers in the range of +-7 x, +-7 y. end of character
  4101. ;is represented by -8 x, -8 y and dark vector is represented by -8 x,
  4102. ; 0 y.
  4103. ;
  4104. ;       bit     7 6 5 4 3 2 1 0
  4105. ;               |     | |     |
  4106. ;                \   ;   \   ;
  4107. ;                  x       y
  4108. ;
  4109. ;characters are currently mapped into the positive quadrant,
  4110. ;with the origin at the lower left corner of an upper case character,
  4111. ;therfore, lowercase characters will descend below the line specified
  4112. ;for the character.
  4113.  
  4114. Lf_20  DB  88H
  4115. Lf_21  DB  20H,21H,80H,23H,26H,88H
  4116. Lf_22  DB  24H,26H,80H,54H,56H,88H
  4117. Lf_23  DB  20H,26H,80H,40H,46H,80H,04H,64H,80H,02H,62H,88H
  4118. Lf_24  DB  2fH,27H,80H,01H,10H,30H,41H,42H,33H,13H,04H,05H
  4119.            DB  16H,36H,45H,88H
  4120. Lf_25  DB  11H,55H,80H,14H,15H,25H,24H,14H,80H,41H,51H,52H
  4121.            DB  42H,41H,88H
  4122. Lf_26  DB  50H,14H,15H,26H,36H,45H,44H,11H,10H,30H,52H,88H
  4123. Lf_27  DB  34H,36H,88H
  4124. Lf_28  DB  4eH,11H,14H,47H,88H
  4125. Lf_29  DB  0eH,31H,34H,07H,88H
  4126. Lf_2a  DB  30H,36H,80H,11H,55H,80H,15H,51H,80H,03H,63H,88H
  4127. Lf_2b  DB  30H,36H,80H,03H,63H,88H
  4128. Lf_2c  DB  11H,20H,2fH,0dH,88H
  4129. Lf_2d  DB  03H,63H,88H
  4130. Lf_2e  DB  00H,01H,11H,10H,00H,88H
  4131. Lf_2f  DB  00H,01H,45H,46H,88H
  4132. Lf_30  DB  01H,05H,16H,36H,45H,41H,30H,10H,01H,88H
  4133. Lf_31  DB  04H,26H,20H,80H,00H,40H,88H
  4134. Lf_32  DB  05H,16H,36H,45H,44H,00H,40H,41H,88H
  4135. Lf_33  DB  05H,16H,36H,45H,44H,33H,42H,41H,30H,10H,01H,80H
  4136.            DB  13H,33H,88H
  4137. Lf_34  DB  06H,03H,43H,80H,20H,26H,88H
  4138. Lf_35  DB  01H,10H,30H,41H,42H,33H,03H,06H,46H,88H
  4139. Lf_36  DB  02H,13H,33H,42H,41H,30H,10H,01H,05H,16H
  4140.            DB  36H,45H,88H
  4141. Lf_37  DB  06H,46H,44H,00H,88H
  4142. Lf_38  DB  01H,02H,13H,04H,05H,16H,36H,45H,44H,33H,42H,41H
  4143.            DB  30H,10H,01H,80H,13H,23H,88H
  4144. Lf_39  DB  01H,10H,30H,41H,45H,36H,16H
  4145.            DB  05H,04H,13H,33H,44H,88H
  4146. Lf_3a  DB  15H,25H,24H,14H,15H,80H,12H,22H,21H,11H,12H,88H
  4147. Lf_3b  DB  15H,25H,24H,14H,15H,80H
  4148.            DB  21H,11H,12H,22H,20H,1fH,88H
  4149. Lf_3c  DB  30H,03H,36H,88H
  4150. Lf_3d  DB  02H,42H,80H,04H,44H,88H
  4151. Lf_3e  DB  10H,43H,16H,88H
  4152. Lf_3f  DB  06H,17H,37H,46H,45H,34H,24H,22H,80H,21H,20H,88H
  4153. Lf_40  DB  50H,10H,01H,06H,17H,57H,66H,63H,52H,32H,23H,24H
  4154.            DB  35H,55H,64H,88H
  4155. Lf_41  DB  00H,04H,26H,44H,40H,80H,03H,43H,88H
  4156. Lf_42  DB  00H,06H,36H,45H,44H,33H,42H,41H,30H
  4157.            DB  00H,80H,03H,33H,88H
  4158. Lf_43  DB  45H,36H,16H,05H,01H,10H,30H,41H,88H
  4159. Lf_44  DB  00H,06H,36H,45H,41H,30H,00H,88H
  4160. Lf_45  DB  40H,00H,06H,46H,80H,03H,23H,88H
  4161. Lf_46  DB  00H,06H,46H,80H,03H,23H,88H
  4162. Lf_47  DB  45H,36H,16H,05H,01H,10H,30H,41H,43H,23H,88H
  4163. Lf_48  DB  00H,06H,80H,03H,43H,80H,40H,46H,88H
  4164. Lf_49  DB  10H,30H,80H,20H,26H,80H,16H,36H,88H
  4165. Lf_4a  DB  01H,10H,30H,41H,46H,88H
  4166. Lf_4b  DB  00H,06H,80H,02H,46H,80H,13H,40H,88H
  4167. Lf_4c  DB  40H,00H,06H,88H
  4168. Lf_4d  DB  00H,06H,24H,46H,40H,88H
  4169. Lf_4e  DB  00H,06H,80H,05H,41H,80H,40H,46H,88H
  4170. Lf_4f  DB  01H,05H,16H,36H,45H,41H,30H,10H,01H,88H
  4171. Lf_50  DB  00H,06H,36H,45H,44H,33H,03H,88H
  4172. Lf_51  DB  12H,30H,10H,01H,05H,16H,36H,45H,41H,30H,88H
  4173. Lf_52  DB  00H,06H,36H,45H,44H,33H,03H,80H,13H,40H,88H
  4174. Lf_53  DB  01H,10H,30H,41H,42H,33H,13H,04H,05H,16H,36H
  4175.            DB  45H,88H
  4176. Lf_54  DB  06H,46H,80H,20H,26H,88H
  4177. Lf_55  DB  06H,01H,10H,30H,41H,046H,88H
  4178. Lf_56  DB  06H,02H,20H,42H,46H,88H
  4179. Lf_57  DB  06H,00H,22H,40H,46H,88H
  4180. Lf_58  DB  00H,01H,45H,46H,80H,40H,41H,05H,06H,88H
  4181. Lf_59  DB  06H,24H,20H,80H,24H,46H,88H
  4182. Lf_5a  DB  06H,46H,45H,01H,00H,40H,88H
  4183. Lf_5b  DB  37H,17H,1fH,3fH,88H
  4184. Lf_5c  DB  06H,05H,41H,40H,88H
  4185. Lf_5d  DB  17H,37H,3fH,2fH,88H
  4186. Lf_5e  DB  04H,26H,44H,88H
  4187. Lf_5f  DB  0fH,7fH,88H
  4188. Lf_60  DB  54H,36H,88H
  4189. Lf_61  DB  40H,43H,34H,14H,03H,01H,10H,30H,41H,88H
  4190. Lf_62  DB  06H,01H,10H,30H,41H,43H,34H,14H,03H,88H
  4191. Lf_63  DB  41H,30H,10H,01H,03H,14H,34H,043H,88H
  4192. Lf_64  DB  46H,41H,30H,10H,01H,03H,14H,34H,43H,88H
  4193. Lf_65  DB  41H,30H,10H,01H,03H,14H,34H,43H,42H,02H,88H
  4194. Lf_66  DB  20H,25H,36H,46H,55H,80H,03H,43H,88H
  4195. Lf_67  DB  41H,30H,10H,01H,03H,14H,34H,43H,4fH
  4196.            DB  3eH,1eH,0fH,88H
  4197. Lf_68  DB  00H,06H,80H,03H,14H,34H,43H,40H,88H
  4198. Lf_69  DB  20H,23H,80H,25H,26H,88H
  4199. Lf_6a  DB  46H,45H,80H,43H,4fH,3eH,1eH,0fH,88H
  4200. Lf_6b  DB  00H,06H,80H,01H,34H,80H,12H,30H,88H
  4201. Lf_6c  DB  20H,26H,88H
  4202. Lf_6d  DB  00H,04H,80H,03H,14H,23H,34H,43H,40H,88H
  4203. Lf_6e  DB  00H,04H,80H,03H,14H,34H,43H,40H,88H
  4204. Lf_6f  DB  01H,03H,14H,34H,43H,41H,30H,10H,01H,88H
  4205. Lf_70  DB  04H,0eH,80H,01H,10H,30H,41H,43H,34H,14H,03H,88H
  4206. Lf_71  DB  41H,30H,10H,01H,03H,14H,34H,43H,80H,44H,4eH,88H
  4207. Lf_72  DB  00H,04H,80H,03H,14H,34H,88H
  4208. Lf_73  DB  01H,10H,30H,41H,32H,12H,03H,14H,34H,43H,88H
  4209. Lf_74  DB  04H,44H,80H,26H,21H,30H,40H,51H,88H
  4210. Lf_75  DB  04H,01H,10H,30H,41H,80H,44H,40H,88H
  4211. Lf_76  DB  04H,02H,20H,42H,44H,88H
  4212. Lf_77  DB  04H,00H,22H,40H,44H,88H
  4213. Lf_78  DB  00H,44H,80H,04H,40H,88H
  4214. Lf_79  DB  04H,01H,10H,30H,41H,80H,44H,4fH,3eH,1eH,0fH,88H
  4215. Lf_7a  DB  04H,44H,00H,40H,88H
  4216. Lf_7b  DB  40H,11H,32H,03H,34H,15H,46H,88H
  4217. Lf_7c  DB  20H,23H,80H,25H,27H,88H
  4218. Lf_7d  DB  00H,31H,12H,43H,14H,35H,06H,88H
  4219. Lf_7e  DB  06H,27H,46H,67H,88H
  4220. Lf_7f  DB  07H,77H,88H
  4221.  
  4222. Llf_tabl equ  $
  4223.       DW  Lf_20, Lf_21, Lf_22, Lf_23, Lf_24, Lf_25, Lf_26, Lf_27, Lf_28, Lf_29
  4224.       DW  Lf_2a, Lf_2b, Lf_2c, Lf_2d, Lf_2e, Lf_2f, Lf_30, Lf_31, Lf_32, Lf_33
  4225.       DW  Lf_34, Lf_35, Lf_36, Lf_37, Lf_38, Lf_39, Lf_3a, Lf_3b, Lf_3c, Lf_3d
  4226.       DW  Lf_3e, Lf_3f, Lf_40, Lf_41, Lf_42, Lf_43, Lf_44, Lf_45, Lf_46, Lf_47
  4227.       DW  Lf_48, Lf_49, Lf_4a, Lf_4b, Lf_4c, Lf_4d, Lf_4e, Lf_4f, Lf_50, Lf_51
  4228.       DW  Lf_52, Lf_53, Lf_54, Lf_55, Lf_56, Lf_57, Lf_58, Lf_59, Lf_5a, Lf_5b
  4229.       DW  Lf_5c, Lf_5d, Lf_5e, Lf_5f, Lf_60, Lf_61, Lf_62, Lf_63, Lf_64, Lf_65
  4230.       DW  Lf_66, Lf_67, Lf_68, Lf_69, Lf_6a, Lf_6b, Lf_6c, Lf_6d, Lf_6e, Lf_6f
  4231.       DW  Lf_70, Lf_71, Lf_72, Lf_73, Lf_74, Lf_75, Lf_76, Lf_77, Lf_78, Lf_79
  4232.       DW  Lf_7a, Lf_7b, Lf_7c, Lf_7d, Lf_7e, Lf_7f
  4233.  
  4234.     SEGEND    DATA
  4235.  
  4236.     SEGDEF    CODE
  4237.  
  4238. PUBLIC    ltext_
  4239.  
  4240.     IF    @bigmodel
  4241. EXTRN    gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, line_:FAR, a_patrn_:FAR
  4242. EXTRN    eseg_sav:FAR
  4243.     ELSE
  4244. EXTRN    gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, line_:NEAR, a_patrn_:NEAR
  4245. EXTRN    eseg_sav:NEAR
  4246.     ENDIF
  4247.  
  4248. ;************************************************************************
  4249. ;*                                                                      *
  4250. ;*      F U N C T I O N     ltext_(x, y, string)                          *
  4251. ;*                          int x, y;  char *string;                    *
  4252. ;*                                                                      *
  4253. ;*      entry:            8[bp] 'x' co-ordinate                         *
  4254. ;*                       10[bp] 'y' co-ordinate                         *
  4255. ;*                       12[bp] pointer to string array.                *
  4256. ;*                                                                      *
  4257. ;************************************************************************
  4258.  
  4259.  
  4260.     PROCDEF    ltext_
  4261.         push    si
  4262.         push    di                  ;-2[bp] temp x.
  4263.         push    bp                  ;-4[bp] temp y.
  4264.         mov     bp,sp               ;-6[bp] loop constant.
  4265.         sub     sp,0AH          ;-8[bp] 'x' loop counter.
  4266.                                     ;-10[bp] 'y' loop counter.
  4267.         mov     ax,cs:WORD PTR eseg_sav
  4268.         mov     es,ax
  4269.  
  4270.         call    gdc_nb_
  4271.         mov     al,BYTE PTR l_type_     ;get and save old line type.
  4272.         push    ax
  4273.         mov     BYTE PTR l_type_,0      ;set up line type for solid lines.
  4274.         call    a_patrn_            ;set pattern multiplier.
  4275.         pop     ax                  ;restore old line type.
  4276.         mov     BYTE PTR l_type_,al
  4277.         mov     al,BYTE PTR t_col_      ;check for correct colour.
  4278.         call    chk_col_
  4279.         test    BYTE PTR gbmod_,2       ;are we in vector mode.
  4280.         jnz     L0a
  4281.         or      BYTE PTR gbmod_,12H
  4282.         call    a_mode_
  4283. L0a:    mov     al,BYTE PTR t_sca_
  4284.         xor     ah,ah
  4285.         dec     ax
  4286.         shr     ax,1
  4287.         mov     -6[bp],ax           ;set up loop counters.
  4288.         mov     -8[bp],ax
  4289.         mov     -10[bp],ax
  4290.         cld
  4291.  
  4292. Lstrg:  mov     ax,08[bp]
  4293.         mov     -2[bp],ax
  4294.         mov     ax,10[bp]
  4295.         mov     -4[bp],ax
  4296.         mov     si,12[bp]           ;point to string array.
  4297. Ldo_strg:
  4298.         lodsb                       ;get character.
  4299.         or      al,al
  4300.         jz      L0                  ;exit if end of string.
  4301.         cmp     al,1FH
  4302.         ja      Ldo_1               ;loop if control character.
  4303.         cmp     al,7FH
  4304.         jbe     Ldo_1               ;loop if > DEL.
  4305.         jmp     Ldo_strg
  4306. Ldo_1:  push    si
  4307.         call    Lsho_char           ;display it
  4308.         pop     si
  4309.         mov     cl,BYTE PTR t_sca_       ;adjust 'x' position by scale factor.
  4310.         xor     ch,ch
  4311.         inc     cx
  4312.         test    BYTE PTR gbmod_,1        ;are we in high res ?
  4313.         jnz     Ldo_2
  4314.         shr     cx,1
  4315. Ldo_2:  mov     ax,8
  4316.         imul    cx
  4317.         add     -2[bp],ax
  4318.         jmp     Ldo_strg            ;loop until done
  4319.  
  4320. L0:     inc     WORD PTR 8[bp]         ;add 1 to the x axis.
  4321.         dec     WORD PTR -8[bp]         ;and decrement the x count.
  4322.         jns     Lstrg
  4323.         mov     ax,-6[bp]           ;get loop constant
  4324.         mov     -8[bp],ax           ;and reset 'x' loop counter.
  4325.         mov     ax,8[bp]            ;get current x position
  4326.         sub     ax,-6[bp]           ;and reset to start position.
  4327.         dec     ax
  4328.         mov     8[bp],ax
  4329.         inc     WORD PTR 10[bp]     ;add 1 to the y axis
  4330.         dec     WORD PTR -10[bp]        ;and decrement the y count.
  4331.         jns     Lstrg
  4332.  
  4333.         add     sp,10
  4334.         pop     bp
  4335.         pop     di
  4336.         pop     si
  4337.         ret
  4338.  
  4339. Lsho_char:
  4340.         mov     BYTE PTR Lflag,0        ;set FLAG to first vector.
  4341.         xor     ah,ah
  4342.         sub     al,20H                  ;make character zero relative.
  4343.         shl     ax,1
  4344.         mov     si,ax
  4345.         mov     si,WORD PTR Llf_tabl[si] ;point into font vectors.
  4346. L1:     mov     al,[si]                 ;get vector.
  4347.         test    al,80H  ;is it an end ?
  4348.         jz      L3                      ;skip if not.
  4349.         mov     BYTE PTR Lflag,0
  4350.         test    al,8    ;is it END OF CHAR ?
  4351.         jz      L2      
  4352.         ret                             ;quit if yes.
  4353. L2:     inc     si                      ;point to next vector and start again.
  4354.         jmp     L1
  4355.  
  4356. L3:     test    BYTE PTR Lflag,1        ;is this the first vector ?
  4357.         jz      L4                      ;jump if it is.
  4358.         lea     di, Lxf
  4359.         jmp     L5
  4360. L4:     lea     di, Lxs
  4361. L5:     call    Llvect                  ;work out and add in the offset s.
  4362.         test    BYTE PTR Lflag,1        ;is it the first vector ?
  4363.         jnz     L6                      ;skip if not.
  4364.         mov     BYTE PTR Lflag,1        ;set FLAG to indicate first vector set
  4365.         jmp     L1                  ;and start again.
  4366. L6:     lea     ax, Lxs
  4367.         push    ax
  4368.         call    line_               ;at last the line can be drawn.
  4369.         add     sp,2
  4370.         mov     ax,Lxf              ;make the end of the last line
  4371.         mov     Lxs,ax              ;the start of the next line.
  4372.         mov     ax,Lyf
  4373.         mov     Lys,ax
  4374.         jmp     L1
  4375.  
  4376. Llvect:
  4377.         mov     ax,-2[bp]       ;get x value.
  4378.         mov     [di],ax
  4379.         mov     ax,-4[bp]       ;get y value.
  4380.         mov     2[di],ax
  4381.         lodsb                   ;get stroke info
  4382.         mov     bx,ax           ;and duplicate in bx for x offset .
  4383.         and     ax,0FH       ;mask to y value
  4384.         test    al,8         ;negative ?
  4385.         jz      L7
  4386.         or      ax,0FFF0H    ;sign extend
  4387. L7:     mov     cl,BYTE PTR t_sca_
  4388.         xor     ch,ch
  4389.         inc     cx
  4390.         push    cx
  4391.         imul    cx              ;multiply by scale value
  4392.         mov     cx,2
  4393.         idiv    cx              ;and divide by two.
  4394.         add     2[di],ax        ;subtract to y offset 
  4395.         and     bx,0F0H      ;mask to x value
  4396.         mov     cl,4           ;shift to 4 lsb
  4397.         shr     bx,cl
  4398.         test    bl,8         ;negative ?
  4399.         jz      L8
  4400.         or      bx,0FFF0H    ;sign extend
  4401. L8:     mov     ax,bx
  4402.         pop     cx
  4403.         imul    cx              ;multiply by scale value
  4404.         test    BYTE PTR gbmod_,1        ;are we in high res ?
  4405.         jnz     L9              ;skip if we are.
  4406.         mov     cx,2
  4407.         idiv    cx              ;and divide by two.
  4408. L9:     add     [di],ax         ;add to x offset 
  4409.         ret
  4410.     PROCEND    ltext_
  4411.  
  4412.     include    epilogue.h
  4413.  
  4414.  
  4415.     END
  4416. +ARCHIVE+ marker.asm   14450 10/01/1983  0:54:52
  4417. PAGE ,132
  4418. TITLE MARKER.ASM
  4419.  
  4420. ;UPDATE HISTORY
  4421. ;==============
  4422. ;
  4423. ; 10 sep 1984  FT1a  Fix bug in st_locator - getkey lost SI/DI
  4424. ;                       - return character lost
  4425. ; 14 sep 1984  FT1a  Allow Function keys to be passed back as well
  4426. ;             as characters in rq_locator, st_locator.
  4427. ;                    Arrow keys & SEL keys are still trapped out in 
  4428. ;             rq_locator cos they're used.
  4429. ; 15 nov 1984         Convert to C86 V2.2
  4430. ;  4 nov 1984 2.00.2 fix bug - pass function key bit back in rq-locator
  4431.  
  4432. ; Special key defines
  4433. ; ===================
  4434. SEL    equ    118h        ;Select Key        [10-sep-84]
  4435. UP    equ    11Bh        ;Up Arrow Key        [10-sep-84]
  4436. LEFT    equ    11Ch        ;Left Arrow Key        [10-sep-84]
  4437. DOWN    equ    11Dh        ;Down Arrow Key        [10-sep-84]
  4438. RIGHT    equ    11Eh        ;Right Arrow Key    [10-sep-84]
  4439.  
  4440.     include asmc.h
  4441.  
  4442.     SEGEND    CODE
  4443.  
  4444.     SEGDEF    DATA
  4445. ;The x,y coordinate information is represented by 3 bit 2's 
  4446. ;complement numbers in the range of +-3 x, +-3 y. end of character
  4447. ;is represented by bit 8 being set on the last vector byte.
  4448. ;
  4449. ;       bit     7 6 5 4 3 2 1 0 
  4450. ;               |   |   | |   | 
  4451. ;               |    \ /   \ /  
  4452. ;              end    x     y   
  4453.  
  4454.  
  4455. EXTRN    l_type_:BYTE, m_col_:BYTE, gbmod_:BYTE, m_type_:BYTE
  4456. EXTRN    m_tab_:BYTE, x_start_:WORD, x_stop_:WORD, m_sca_:BYTE, ws_wmo_:BYTE
  4457. EXTRN    y_start_:WORD, ymax_:WORD, xmax_:WORD
  4458.  
  4459. Lmmul     DW      1
  4460. Lmx       DW      0
  4461. Lmy       DW      0
  4462. fkey_flag DW      0    ;arrow key pressed        [10-sep-84]
  4463.  
  4464.     SEGEND    DATA
  4465.  
  4466.     SEGDEF    CODE
  4467.  
  4468. PUBLIC    polymark_, rq_locator_, st_locator_
  4469.  
  4470.     IF    @bigmodel
  4471. EXTRN    gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, line_:FAR, a_wmode_:FAR
  4472. EXTRN    getkey:FAR, conout_:FAR, a_patrn_:FAR, eseg_sav:FAR
  4473.     ELSE
  4474. EXTRN    gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, line_:NEAR, a_wmode_:NEAR
  4475. EXTRN    getkey:NEAR, conout_:NEAR, a_patrn_:NEAR, eseg_sav:NEAR
  4476.     ENDIF
  4477.  
  4478. ;************************************************************************
  4479. ;*                                                                      *
  4480. ;*      F U N C T I O N     polymark_(count, array)                     *
  4481. ;*                          int count, *array;                          *
  4482. ;*                                                                      *
  4483. ;*      entry:            8[bp] number of markers to show               *
  4484. ;*                       10[bp] pointer to array of 'xy' points at      *
  4485. ;*                               which to place markers.                *
  4486. ;*                                                                      *
  4487. ;************************************************************************
  4488. ;The x,y coordinate information is represented by 3 bit 2's 
  4489. ;complement numbers in the range of +-3 x, +-3 y. end of character
  4490. ;is represented by bit 8 being set on the last vector byte.
  4491. ;
  4492. ;       bit     7 6 5 4 3 2 1 0 
  4493. ;               |   |   | |   | 
  4494. ;               |    \ /   \ /  
  4495. ;              end    x     y   
  4496.  
  4497.  
  4498. Lsho_mark PROC  NEAR
  4499.         mov     al,BYTE PTR m_type_      ;get marker type and use to
  4500.         and     al,0FH  ;point into marker table.
  4501.         xor     ah,ah               ;clear highDB.
  4502.         mov     cl,4                ;table length.
  4503.         shl     ax,cl
  4504.         lea     si, m_tab_
  4505.         add     si,ax               ;point si to marker table.
  4506. L1:     lea     di, x_start_
  4507.         call    Lvect               ;find start of line.
  4508.         lea     di, x_stop_
  4509.         call    Lvect               ;find end of line.
  4510.         lea     ax, x_start_
  4511.         push    ax
  4512.         call    line_               ;draw stroke.
  4513.         add     sp,2
  4514.         test    BYTE PTR -1[si],80H     ;test for end of line bit.
  4515.         jz      L1
  4516.         ret
  4517. Lsho_mark ENDP
  4518.  
  4519. Lvect   PROC    NEAR
  4520.         mov     ax,-2[bp]           ;get x value.
  4521.         mov     [di],ax
  4522.         mov     ax,-4[bp]           ;get y value.
  4523.         mov     2[di],ax
  4524.         lodsb                       ;get stroke info
  4525.         mov     bx,ax
  4526.         and     ax,7                  ;mask to y value
  4527.         test    al,4                  ;negative ?
  4528.         jz      L2
  4529.         or      ax,0FFF8H             ;sign extend
  4530. L2:     mov     cl,BYTE PTR m_sca_
  4531.         xor     ch,ch
  4532.         push    cx
  4533.         imul    cx                  ;multiply by scale value
  4534.         mov     cx,2
  4535.         idiv    cx                  ;and divide by two.
  4536.         add     2[di],ax            ;subtract to y offset 
  4537.         and     bx,38H                ;mask to x value
  4538.         shr     bx,1                   ;shift to 3 lsb
  4539.         shr     bx,1
  4540.         shr     bx,1
  4541.         test    bl,4                  ;negative ?
  4542.         jz      L3
  4543.         or      bx,0FFF8H             ;sign extend
  4544. L3:     mov     ax,bx
  4545.         pop     cx                  ;recover scale
  4546.         imul    cx                  ;multiply by scale value
  4547.         test    BYTE PTR gbmod_,1       ;are we in high res ?
  4548.         jnz     L3a                 ;skip if we are.
  4549.         mov     cx,2
  4550.         idiv    cx                  ;and divide by two.
  4551. L3a:    add     [di],ax             ;add to x offset 
  4552.         ret
  4553. Lvect   ENDP
  4554. ;
  4555.     PROCDEF    polymark_
  4556.         push    si
  4557.         push    di
  4558.         push    bp
  4559.         mov     bp,sp
  4560.         sub     sp,4      ;reserve space for xad offset -2[bp]} & yad {-4[bp]}
  4561.  
  4562.         mov     ax,cs:WORD PTR eseg_sav
  4563.         mov     es,ax
  4564.  
  4565.         call    gdc_nb_
  4566.         mov     al,BYTE PTR l_type_     ;get and save old line type.
  4567.         push    ax
  4568.         mov     BYTE PTR l_type_,00     ;set up line type for solid lines.
  4569.         call    a_patrn_            ;set pattern multiplier.
  4570.         pop     ax                  ;restore old line type.
  4571.         mov     BYTE PTR l_type_,al
  4572.         mov     al,BYTE PTR m_col_      ;check for correct colour.
  4573.         call    chk_col_
  4574.         test    BYTE PTR gbmod_,2       ;are we in vector mode ?
  4575.         jnz     L0a
  4576.         or      BYTE PTR gbmod_,12H
  4577.         call    a_mode_
  4578. L0a:    mov     cx,8[bp]            ;get number of markers.
  4579.         mov     si,10[bp]           ;point to marker array elements.
  4580.         cld
  4581. Ldo_marks:
  4582.         lodsw                       ;get initial x
  4583.         mov     -2[bp],ax           ;save it.
  4584.         lodsw                       ;get initial y
  4585.         mov     -4[bp],ax           ;save it.
  4586.         push    cx
  4587.         push    si
  4588.         call    Lsho_mark           ;display it
  4589.         pop     si
  4590.         pop     cx
  4591.         loop    Ldo_marks           ;loop until done
  4592.  
  4593.         mov     sp,bp               ;restore stack position
  4594.         pop     bp
  4595.         pop     di
  4596.         pop     si
  4597.         ret
  4598.     PROCEND    polymark_
  4599.  
  4600.  
  4601. ;**************************************************************************
  4602. ;*                                                                        *
  4603. ;*  F U N C T I O N  rq_locator_(dev, x_strt, y_strt, char, x_end, y_end) *
  4604. ;*                   int  dev, x_strt, y_strt;                            *
  4605. ;*                   int  *char;                                          *
  4606. ;*                   int  *x_end, *y_end;                                 *
  4607. ;*                                                                        *
  4608. ;*      purpose:        Place a moveable cross_hair on the display at     *
  4609. ;*                      [x_strt, y_strt] and move it around with the      *
  4610. ;*                      arrow keys until a character is typed or a        *
  4611. ;*                      Function key pressed (not arrow or SEL).          *
  4612. ;*                      The keystroke and the final 'xy' positions are    *
  4613. ;*                      returned in 'char', 'x_end' & 'y_end'.            *
  4614. ;*                      The cross_hair is then removed.                   *
  4615. ;*                      The cross_hair is assumed to be marker type 1     *
  4616. ;*                                                                        *
  4617. ;*      entry:  8[bp]  included for GSX86MWC.OLB compatibility.           *
  4618. ;*              10[bp] starting 'x' co-ordinate                           *
  4619. ;*              12[bp] starting 'y' co-ordinate                           *
  4620. ;*              14[bp] pointer to returned character                      *
  4621. ;*              16[bp] pointer to ending 'x' co-ordinate                  *
  4622. ;*              18[bp] pointer to ending 'y' co-ordinate                  *
  4623. ;*                                                                        *
  4624. ;**************************************************************************
  4625. Lmsh_m    PROC    NEAR
  4626.     mov     ax,[si]             ;show the marker at 'xy' end.
  4627.         mov     WORD PTR x_start_,ax
  4628.         mov     ax,[di]
  4629.         mov     WORD PTR y_start_,ax
  4630.         lea     ax, x_start_
  4631.         push    ax
  4632.         mov     ax,1
  4633.         push    ax
  4634.         call    polymark_
  4635.         add     sp,4
  4636.         ret
  4637. Lmsh_m    ENDP
  4638.  
  4639.     PROCDEF    rq_locator_
  4640.         push    si
  4641.         push    di
  4642.         push    bp
  4643.         mov     bp,sp
  4644.         sub     sp,8                    ;make room to save the old marker info.
  4645.  
  4646.         mov     ax,cs:WORD PTR eseg_sav
  4647.         mov     es,ax
  4648.  
  4649.         mov     al,BYTE PTR m_type_      ;save all the marker info on the stack.
  4650.         mov     -2[bp],ax
  4651.         mov     al,BYTE PTR m_col_
  4652.         mov     -4[bp],ax
  4653.         mov     al,BYTE PTR m_sca_
  4654.         mov     -6[bp],ax
  4655.         mov     al,BYTE PTR ws_wmo_
  4656.         mov     -8[bp],ax
  4657.  
  4658.         mov     BYTE PTR m_type_,1       ; '+'
  4659.         mov     BYTE PTR m_col_,3
  4660.         mov     BYTE PTR m_sca_,3
  4661.         mov     BYTE PTR ws_wmo_,1       ;COMPLIMENT mode.
  4662.  
  4663.         mov     ax,10[bp]       ;get starting 'x' and copy to 'x_end' & 'Lmx'.
  4664.         mov     di,16[bp]
  4665.         mov     si,di
  4666.         mov     Lmx,ax
  4667.         stosw
  4668.  
  4669.         mov     ax,12[bp]       ;get starting 'y' and copy to 'y_end' & 'Lmy'.
  4670.         mov     di,18[bp]
  4671.         mov     [di],ax
  4672.         mov     Lmy,ax
  4673.  
  4674.         call    gdc_nb_
  4675.         call    a_wmode_
  4676.  
  4677. Lm0:    call    Lmsh_m              ;show marker at 'x_end', 'y_end'.
  4678. Lm1:    lea     ax, Lmy
  4679.         push    ax
  4680.         lea     ax, Lmx
  4681.         push    ax
  4682.         call    st_locator_
  4683.         add     sp,4
  4684.         or      ax,ax
  4685.         jz      Lm1
  4686.         test    fkey_flag,100H ;was an arrow key pressed ?  [10-sep-84]
  4687.         jnz     Lm2             ;yup                [14-sep-84]
  4688.         mov     bx,14[bp]       ;get character pointer and save character.
  4689.         mov     WORD PTR [bx],ax    ;allow function bit return ********
  4690.         call    Lmsh_m              ;remove marker and exit.
  4691.         jmp     Lmexit
  4692.  
  4693. Lm2:    call    Lmsh_m              ;remove old marker.
  4694.         mov     ax,Lmx              ;update x_end.
  4695.         mov     [si],ax
  4696.         mov     ax,Lmy              ;update y_end.
  4697.         mov     [di],ax
  4698.         jmp     Lm0
  4699.  
  4700.  
  4701. Lmexit: mov     ax,-8[bp]
  4702.         mov     BYTE PTR ws_wmo_,al
  4703.         call    a_wmode_
  4704.         mov     ax,-6[bp]       ;restore all the marker info from the stack.
  4705.         mov     BYTE PTR m_sca_,al
  4706.         mov     ax,-4[bp]
  4707.         mov     BYTE PTR m_col_,al
  4708.         mov     ax,-2[bp]
  4709.         mov     BYTE PTR m_type_,al
  4710.  
  4711.         mov     sp,bp
  4712.         pop     bp
  4713.         pop     di
  4714.         pop     si
  4715.         ret
  4716.  
  4717.     PROCEND    rq_locator_
  4718.  
  4719.  
  4720. ;************************************************************************
  4721. ;*                                                                      *
  4722. ;*      F U N C T I O N     st_locator_(x, y)                            *
  4723. ;*                          int  *x, *y;                                *
  4724. ;*                                                                      *
  4725. ;*      purpose:        Updates 'x' &;or 'y' if an arrow key was        *
  4726. ;*                      pressed. Updates Lmul if SELECT was pressed.    *
  4727. ;*                      Returns '\0' in AX if SELECT or no character    *
  4728. ;*                      was typed, otherwise, returns the character.    *
  4729. ;*                                                                      *
  4730. ;************************************************************************
  4731.  
  4732.     PROCDEF    st_locator_
  4733.         push    si
  4734.         push    di
  4735.         push    bp
  4736.         mov     bp,sp
  4737.  
  4738.         call    getkey            ;get keystroke (if any)    [10-sep-84]
  4739.  
  4740.         mov     di,10[bp]        ;addr of y coordinate
  4741.         mov     si,8[bp]        ;addr of x coordinate
  4742.         mov     bx,cs:WORD PTR eseg_sav
  4743.         mov     es,bx
  4744.     push    ax        ;save keystroke value for exit    [10-sep-84]
  4745.         or      ax,ax            ;was keystoke entered
  4746.         jnz     Ls1            ;yup
  4747.         jmp     Lsexit
  4748.  
  4749. Ls1:    mov     fkey_flag,ax     ;save in case function key    [10-sep-84]
  4750.     and    fkey_flag,100H
  4751.     test    fkey_flag,100H   ;q. function key
  4752.     jnz    ls2              ;yup
  4753.     jmp    lsexit1
  4754.  
  4755. Ls2:    cmp     ax,SEL           ;SELECT ?        [10-sep-84]
  4756.         jnz     Ls4
  4757.         mov     ax,Lmmul
  4758.         dec     ax
  4759.         jz      Ls3
  4760.         mov     Lmmul,1
  4761.         jmp     Lsexit
  4762. Ls3:    mov     Lmmul,10
  4763.         jmp     Lsexit
  4764.  
  4765. Ls4:    cmp     ax,UP            ;UP ?            [10-sep-84]
  4766.         jnz     Ls5
  4767.         mov     ax,[di]
  4768.         add     ax,Lmmul
  4769.         cmp     WORD PTR ymax_,ax
  4770.         jns     Ls4a
  4771.         mov     ax,WORD PTR ymax_
  4772. Ls4a:   mov     [di],ax
  4773.         jmp     Lsexit1
  4774.  
  4775. Ls5:    cmp     ax,DOWN          ;DOWN ?        [10-sep-84]
  4776.         jnz     Ls6
  4777.         mov     ax,[di]
  4778.         sub     ax,Lmmul
  4779.         or      ax,ax
  4780.         jns     Ls5a
  4781.         xor     ax,ax
  4782. Ls5a:   mov     [di],ax
  4783.         inc     ax
  4784.         jmp     Lsexit1
  4785.  
  4786. Ls6:    cmp     ax,LEFT            ;LEFT ?        [10-sep-84]
  4787.         jnz     Ls7
  4788.         mov     ax,[si]
  4789.         sub     ax,Lmmul
  4790.         or      ax,ax
  4791.         jns     Ls6a
  4792.         xor     ax,ax
  4793. Ls6a:   mov     [si],ax
  4794.         inc     ax
  4795.         jmp     Lsexit1
  4796.  
  4797. Ls7:    cmp     ax,RIGHT           ;RIGHT ?        [10-sep-84]
  4798.         jnz     Ls8
  4799.         mov     ax,[si]
  4800.         add     ax,Lmmul
  4801.         cmp     WORD PTR xmax_,ax
  4802.         jns     Ls7a
  4803.         mov     ax,WORD PTR xmax_
  4804. Ls7a:   mov     [si],ax
  4805.         jmp     Lsexit1
  4806.  
  4807. Ls8:    mov     fkey_flag,0    ;unknown function key pressed    [14-sep-84]
  4808.     jmp    Lsexit1        ;turn off flag & continue    [14-sep-84]
  4809.  
  4810. Lsexit: pop    ax        ;retrieve keystroke ...        [10-sep-84]
  4811.         xor     ax,ax        ;.. then lose it        [10-sep-84]
  4812.         mov     fkey_flag,0
  4813.     jmp    Lsexit2        ;continue            [10-sep-84]
  4814.  
  4815. Lsexit1:
  4816.         pop    ax        ;retrieve keystroke        [10-sep-84]
  4817. Lsexit2:            ;                [10-sep-84]
  4818.         pop     bp
  4819.         pop     di
  4820.         pop     si
  4821.         ret
  4822.     PROCEND    st_locator_
  4823.  
  4824.     include    epilogue.h
  4825.     END
  4826. +ARCHIVE+ mouse.h       4441 11/25/1984 22:14:32
  4827. /*********************************************************/
  4828. /*           MOUSE header file for Rainbow               */
  4829. /*********************************************************/
  4830.  
  4831. /*  You must #define MOUSETYPE with one of the following */
  4832. /*  before mouse.h to actually achieve anything          */
  4833.  
  4834. /* Mouse types */
  4835. #define  NOMOUSE    0
  4836. #define  MICROSOFT    1
  4837. #define  PCMOUSE    2
  4838.  
  4839. /* default is NO MOUSE*/
  4840. #ifndef MOUSETYPE
  4841. #define MOUSETYPE NOMOUSE
  4842. #endif
  4843.  
  4844. #if MOUSETYPE - MICROSOFT
  4845. #define MICROSOFTMOUSEIND
  4846. #endif
  4847. #if MOUSETYPE - PCMOUSE
  4848. #define PCMOUSEMOUSEIND
  4849. #endif
  4850.  
  4851. /* logical truthfulness */
  4852. #define TRUE         1
  4853. #define FALSE         0
  4854.  
  4855.  
  4856. /*Available Mouse port definitions */
  4857. #define MDM        1        /*Comms port*/
  4858. #define PRT        2        /*printer port*/
  4859. #define AUX        3        /*Aux. Comms port*/
  4860.  
  4861.  
  4862. /*MOUSE interrupt condition packet (why) */
  4863. typedef struct {
  4864.     unsigned int Movement;        /*TRUE movement occurred*/
  4865.     int S_button_rel;        /*secondary button release count*/
  4866.     int S_button_dep;        /*secondary button depress count*/
  4867.     int P_button_rel;        /*primary button release count*/
  4868.     int P_button_dep;        /*primary button depress count*/
  4869.     int Delta_x;            /*x delta factor (horizontal)*/
  4870.     int Delta_y;            /*y delta factor (vertical)*/
  4871.     } CONDITION_PACKET;
  4872.  
  4873.  CONDITION_PACKET  *msdecode();
  4874.  
  4875. /*MOUSE control packet */
  4876. typedef struct {
  4877.     int P_button,            /*TRUE = left or primary button act*/
  4878.         S_button,            /*TRUE = right or secondary button*/
  4879.         T_button,            /*TRUE = middle or tertiary button */
  4880.         Deltax,            /*x acc. delta factor (horizontal)*/
  4881.         X_ratio,            /*x magnification factor (OPEN)*/
  4882.         X_threshold,        /*x speed limit          (OPEN)*/
  4883.         Deltay,            /*y acc. delta factor (vertical)*/
  4884.         Y_ratio,            /*y magnification factor (OPEN)*/
  4885.         Y_threshold;        /*y speed limit          (OPEN)*/
  4886.     int Mouse_immediate;        /*TRUE = wait for input*/
  4887.     int Mouse_enabled;        /*TRUE = mouse OK to use*/
  4888.     int Mouse_type;            /*mouse type - see MOUSETYPE*/
  4889.     int Mouse_device;        /*port number MDM, PRT or AUX*/
  4890.     char Mouse_port_name[5];    /*port name*/
  4891.     unsigned int Mouse_handle;    /*device handle*/
  4892.     unsigned char Mouse_bstate;    /*button state storage*/
  4893.     int Mouse_programmed;        /*TRUE = port programmed for Mouse*/
  4894.     int Mouse_new_vectors;        /*TRUE = RCI vectored in*/
  4895.     int Trace;            /*TRUE = trace mode*/
  4896.     } MOUSE_PACKET;
  4897.  
  4898.  
  4899. /* Local buffer for port I/O (std Dos structure*/
  4900. typedef struct {
  4901.     int count, 
  4902.         size,
  4903.         ipntr,
  4904.         opntr,
  4905.         highw,
  4906.         loww,
  4907.         head,
  4908.         tail;
  4909.     unsigned char mdata[128-16];
  4910.     } MOUSE_PORT_BUFFER;
  4911.  
  4912. /*MOUSE control*/
  4913. #if MOUSETYPE
  4914. /*NOMOUSE*/
  4915. #define Mouse_x_threshold    0
  4916. #define Mouse_x_speed        0
  4917. #define Mouse_y_threshold    0
  4918. #define Mouse_y_speed        0
  4919. #define Mouse_num_buttons    0
  4920. #define Mouse_packet_size    0
  4921. #undef MICROSOFTMOUSEIND
  4922. #undef PCMOUSEMOUSEIND
  4923. #endif
  4924.  
  4925. #ifdef MICROSOFTMOUSEIND
  4926. /*MICROSOFT*/
  4927. #define Mouse_x_threshold    0x040    /* Threshold in Mickeys/sec */
  4928. #define Mouse_x_speed        2
  4929. #define Mouse_y_threshold    0x080    /* Threshold in Mickeys/sec */
  4930. #define Mouse_y_speed        2
  4931. #define Mouse_num_buttons    2
  4932. #define Mouse_packet_size    3
  4933. #undef MICROSOFTMOUSEIND
  4934. #endif
  4935.  
  4936. #ifdef PCMOUSEMOUSEIND
  4937. /*PCMOUSE*/
  4938. #define Mouse_x_threshold    0x040    /* Threshold in ??*/
  4939. #define Mouse_x_speed        2
  4940. #define Mouse_y_threshold    0x080    /* Threshold in ??*/
  4941. #define Mouse_y_speed        2
  4942. #define Mouse_num_buttons    3
  4943. #define Mouse_packet_size    5
  4944. #undef PCMOUSEMOUSEIND
  4945. #endif
  4946.  
  4947.  
  4948.  
  4949. /* PKT/CCB for Dos ioctl calls*/
  4950. struct    COMM_BLOCK {
  4951.     unsigned char cb_function;        /*PKT function */
  4952.     unsigned char cb_func_retc;        /*PKT return code*/
  4953.     unsigned char cb_character;        /*PKT character in/out*/
  4954.     unsigned char cb_char_stat;        /*PKT character status*/
  4955.     unsigned char    cb_device;        /*CCB device number */
  4956.     unsigned char    cb_control;        /*CCB mode */
  4957.     unsigned char    cb_stop_bits;        /*CCB stop bits*/
  4958.     unsigned char    cb_data_bits;        /*CCB data bits*/
  4959.     unsigned char    cb_parity_out;        /*CCB tx parity*/
  4960.     unsigned char    cb_rcv_baud;        /*CCB rx speed*/
  4961.     unsigned char    cb_xmit_baud;        /*CCB tx speed*/
  4962.     unsigned char    cb_xon_char;        /*CCB XON char*/
  4963.     unsigned char    cb_xoff_char;        /*CCB XOFF char*/
  4964.     unsigned char    cb_in_xon;        /*CCB rx XON/XOFF*/
  4965.     unsigned char    cb_out_xon;        /*CCB tx XON/XOFF*/
  4966.     unsigned int    cb_buffer_size;        /*CCB user buffer size*/
  4967.     unsigned char    *cb_buffer_offset;    /*CCB user buffer offset*/
  4968.     unsigned int    cb_buffer_segment;    /*CCB user buffer segment*/
  4969.     };
  4970.  
  4971. +ARCHIVE+ msdos.asm     8702 10/01/1983  0:31:50
  4972. PAGE 60,132
  4973. title MSDOS.ASM
  4974. ;UPDATE HISTORY
  4975. ;==============
  4976. ; 29-11-84  Preserve ES register across int 18 in kbd calls
  4977.  
  4978. ;---------------------------------------------------------------+
  4979. ;                                |
  4980. ;        Definitions for 'C' Modules            |
  4981. ;                                |
  4982. ;---------------------------------------------------------------+
  4983.  
  4984.     include asmc.h
  4985.     include asmk.h
  4986.     SEGEND    CODE
  4987.  
  4988.     .xlist
  4989.  
  4990. ;  Parameter offsets
  4991.  
  4992. param1    EQU    @ab+[BP]
  4993. param2    EQU    @ab+2[BP]
  4994. param3    EQU    @ab+4[BP]
  4995. param4    EQU    @ab+6[BP]
  4996. param5    EQU    @ab+8[BP]
  4997. param6    EQU    @ab+10[BP]
  4998. param7    EQU    @ab+12[BP]
  4999. param8    EQU    @ab+14[BP]
  5000. param9    EQU    @ab+16[BP]
  5001. param10    EQU    @ab+18[BP]
  5002.  
  5003. ;  macros
  5004.  
  5005. ldata    macro
  5006. ?dptr    =    -2
  5007.     endm
  5008.  
  5009. lvar    macro    nam
  5010. nam    equ    ?dptr
  5011. ?dptr    =    ?dptr-2
  5012.     endm
  5013.  
  5014. enter    macro    lvars
  5015.     push    bp
  5016.     mov    bp,sp
  5017.     ifnb    <lvars>
  5018.     sub    sp,(lvars+1)/2
  5019.     endif
  5020.     endm
  5021.  
  5022. leave    macro
  5023.     pop    bp
  5024.     ret
  5025.     endm
  5026.  
  5027. ?genp    macro    pnum
  5028.     ifnb    <p&pnum>
  5029.     push    p&pnum
  5030.     endif
  5031.     endm
  5032.  
  5033. ccall    macro    p1,p2,p3,p4,p5,p6,p7,p8,p9,p10
  5034. ?p    =    10
  5035.     rept    10
  5036.     ?genp    %?p
  5037. ?p    =    ?p-1
  5038.     endm
  5039.     endm
  5040.  
  5041.     .list
  5042.  
  5043. ;---------------------------------------------------------------
  5044. ;
  5045. ;    Interface to stranger MSDOS functions:
  5046. ;
  5047. ;        ax = msdos(ax, bx, cx, dx);
  5048. ;        if carry set: _carry = 1 else 0
  5049. ;
  5050. ;----------------------------------------------------------------
  5051.     SEGDEF    DATA
  5052.  
  5053.     PUBLIC    _carry        ;global carry flag
  5054.  
  5055. _carry    dw    0
  5056.  
  5057.     SEGEND    DATA
  5058.  
  5059.     SEGDEF    CODE
  5060.     PUBLIC    msdos    ;entry point
  5061.  
  5062.     PROCDEF    msdos
  5063.     enter
  5064.     mov    ax,param1
  5065.     mov    bx,param2
  5066.     mov    cx,param3
  5067.     mov    dx,param4
  5068.     mov    _carry,0
  5069.     Push    ES        ;save es
  5070.     int    21h        ;call msdos
  5071.     Pop    ES        ;save es
  5072.     jnc    nocarry
  5073.     mov    _carry,1
  5074. nocarry: leave
  5075.     PROCEND    msdos
  5076.     SEGEND    CODE
  5077.  
  5078. ;---------------------------------------------------------------+
  5079. ;                                |
  5080. ;        Fast Video Put Line and Attributes        |
  5081. ;                                |
  5082. ;    Vers. 1.0            9/13/83  A.F.        |
  5083. ;                                |
  5084. ;    History:                        |
  5085. ;                                |
  5086. ;    9/13/83        Created        AF            |
  5087. ;                                |
  5088. ;---------------------------------------------------------------+
  5089. ;
  5090. ;    putline (line, col, string)
  5091. ;    putattr (line, col, len, array)
  5092. ;
  5093. ;    int line,col;        /* place to put string or attribs */
  5094. ;    char *string;        /* string to write */
  5095. ;    char array[];        /* array of attributes */
  5096. ;    int len            /* length of attribute array */
  5097. ;
  5098.  
  5099.     SEGDEF    CODE
  5100.  
  5101.     public    putline,putattr
  5102.  
  5103.     PROCDEF    putline
  5104.     enter                ;initialize stack
  5105.     push    es            ;gets clobbered
  5106.     mov    si,param3        ;si=> string
  5107.  
  5108. ;    get the string length in cx
  5109.  
  5110.     push    ds            ;es=ds
  5111.     pop    es
  5112.     mov    di,si            ;set =>
  5113.     cld                ;going up!
  5114.     mov    cx,-1            ;set count
  5115.     xor    al,al            ;look for null
  5116.  
  5117. repne    scasb
  5118.     inc    cx
  5119.     not    cx            ;cx now has the length
  5120.     mov    ax,2            ;set move characters
  5121.  
  5122. ;    Putline and Putattr common code
  5123.  
  5124. put:
  5125.     mov    bl,param1        ;get line
  5126.     mov    bh,param2        ;and col
  5127.  
  5128.     cmp    bl,1            ;make sure line is in range 1-24
  5129.     jl    exit
  5130.     cmp    bl,24
  5131.     jg    exit
  5132.  
  5133.     push    ax            ;save 
  5134.     mov    al,bh            ;check to make sure we don't
  5135.     add    ax,cx            ;exceed the end of the line
  5136.     cmp    ax,81            ;assuming 80 chars single width
  5137.     pop    ax
  5138.     ja    exit
  5139.  
  5140.     mov    bp,ds            ;the call requires bp=ds
  5141.     mov    di,14h            ;function #
  5142.     int     18h            ;do it
  5143. exit:
  5144.     pop    es
  5145.     leave
  5146.     PROCEND    putline
  5147.  
  5148.     PROCDEF    putattr
  5149.     enter                ;initialize stack
  5150.     push    es
  5151.     mov    dx,param4        ;dx=> attributes
  5152.            mov    cx,param3        ;length
  5153.     mov    ax,1            ;set attributes
  5154.     jmp    put            ;go to common part of routines
  5155.     PROCEND    putattr
  5156.  
  5157.     SEGEND    CODE
  5158.  
  5159.  
  5160.     SEGDEF    DATA
  5161.  
  5162. ; TRANSLATION TabLE TO CONVERT FIRMWARE 16-BIT KEYCODES INTO 'FINAL' KEYCODES
  5163. ;
  5164. ;    FINAL KEYCODE        KEY ID        FIRMWARE    FINAL
  5165.  
  5166. keytbl    db    15        ;HELP        00    TO    15.
  5167.     db    16        ;DO        01    TO    16.
  5168.     db    0        ;COMPOSE    02    TO    0
  5169.     db    2        ;PRINT SCREEN    03    TO    2
  5170.     db    0FFh        ;        04
  5171.     db    4        ;F4        05    TO    4
  5172.     db    0FFh        ;        06
  5173.     db    6        ;INTERRUPT    07    TO    6
  5174.     db    0FFh        ;        08
  5175.     db    7        ;RESUME        09    TO    7
  5176.     db    0FFh        ;        0A
  5177.     db    8        ;CANCEL        0B    TO    8
  5178.     db    0FFh        ;        0C
  5179.     db    9        ;MAIN SCREEN    0D    TO    9
  5180.     db    0FFh        ;        0E
  5181.     db    10        ;EXIT        0F    TO    10.
  5182.     db    0FFh        ;        10
  5183.     db    14        ;ADDTNL OPTIONS    11    TO    14.
  5184.     db    0FFh        ;        12
  5185.     db    17        ;F17        13    TO    17.
  5186.     db    0FFh        ;        14
  5187.     db    18        ;F18        15    TO    18.
  5188.     db    0FFh        ;        16
  5189.     db    19        ;F19        17    TO    19.
  5190.     db    0FFh        ;        18
  5191.     db    20        ;F20        19    TO    20.
  5192.     db    0FFh        ;        1A
  5193.     db    21        ;FIND        1B    TO    21.
  5194.     db    0FFh        ;        1C
  5195.     db    22        ;INSERT HERE    1D    TO    22.
  5196.     db    0FFh        ;        1E
  5197.     db    23        ;REMOVE        1F    TO    23.
  5198.     db    0FFh        ;        20
  5199.     db    24        ;SELECT        21    TO    24.
  5200.     db    0FFh        ;        22
  5201.     db    25        ;PREV SCREEN    23    TO    25.
  5202.     db    0FFh        ;        24
  5203.     db    26        ;NEXT SCREEN    25    TO    26.
  5204.     db    0FFh        ;        26
  5205.     db    27        ;UP-ARROW    27    TO    27.
  5206.     db    0FFh        ;        28
  5207.     db    29        ;DOWN-ARROW    29    TO    29.
  5208.     db    0FFh        ;        2A
  5209.     db    30        ;RIGHT-ARROW    2B    TO    30.
  5210.     db    0FFh        ;        2C
  5211.     db    28        ;LEFT-ARROW    2D    TO    28.
  5212.     db    0FFh        ;        2E
  5213.     db    31        ;KEYPAD 0    2F    TO    31.
  5214.     db    0FFh        ;        30
  5215.     db    0FFh        ;        31
  5216.     db    32        ;KEYPAD 1    32    TO    32.
  5217.     db    0FFh        ;        33
  5218.     db    0FFh        ;        34
  5219.     db    33        ;KEYPAD 2    35    TO    33.
  5220.     db    0FFh        ;        36
  5221.     db    0FFh        ;        37
  5222.     db    34        ;KEYPAD 3    38    TO    34.
  5223.     db    0FFh        ;        39
  5224.     db    0FFh        ;        3A
  5225.     db    35        ;KEYPAD 4    3B    TO    35.
  5226.     db    0FFh        ;        3C
  5227.     db    0FFh        ;        3D
  5228.     db    36        ;KEYPAD 5    3E    TO    36.
  5229.     db    0FFh        ;        3F
  5230.     db    0FFh        ;        40
  5231.     db    37        ;KEYPAD 6    41    TO    37.
  5232.     db    0FFh        ;        42
  5233.     db    0FFh        ;        43
  5234.     db    38        ;KEYPAD 7    44    TO    38.
  5235.     db    0FFh        ;        45
  5236.     db    0FFh        ;        46
  5237.     db    39        ;KEYPAD 8    47    TO    39.
  5238.     db    0FFh        ;        48
  5239.     db    0FFh        ;        49
  5240.     db    40        ;KEYPAD 9    4A    TO    40.
  5241.     db    0FFh        ;        4B
  5242.     db    0FFh        ;        4C
  5243.     db    42        ;KEYPAD DASH    4D    TO    42.
  5244.     db    0FFh        ;        4E
  5245.     db    0FFh        ;        4F
  5246.     db    41        ;KEYPAD COMMA    50    TO    41.
  5247.     db    0FFh        ;        51
  5248.     db    0FFh        ;        52
  5249.     db    43        ;KEYPAD PERIOD    53    TO    43.
  5250.     db    0FFh        ;        54
  5251.     db    0FFh        ;        55
  5252.     db    48        ;KEYPAD ENTER    56    TO    48.
  5253.     db    0FFh        ;        57
  5254.     db    0FFh        ;        58
  5255.     db    44        ;KEYPAD PF1    59    TO    44.
  5256.     db    0FFh        ;        5A
  5257.     db    0FFh        ;        5B
  5258.     db    45        ;KEYPAD PF2    5C    TO    45.
  5259.     db    0FFh        ;        5D
  5260.     db    0FFh        ;        5E
  5261.     db    46        ;KEYPAD PF3    5F    TO    46.
  5262.     db    0FFh        ;        60
  5263.     db    0FFh        ;        61
  5264.     db    47        ;KEYPAD PF4    62    TO    47.
  5265.     db    0FFh        ;        63
  5266.     db    0FFh        ;        64
  5267.     db    5        ;BREAK        65    TO    5.
  5268.  
  5269.     SEGEND    DATA
  5270.  
  5271. ;******************************************************************
  5272. ;*    character I/O
  5273. ;*
  5274. ;    int kbd16(&i)        /* level 1 console in */
  5275. ;    int *i;
  5276. ;
  5277. ;    int kbdin(&i);        /* level 2 console in */
  5278. ;    int *i;
  5279. ;
  5280. ;    kbdout(c);            /* level 2 character out */
  5281. ;    unsigned char c;
  5282. ;
  5283.  
  5284.     SEGDEF    CODE
  5285.  
  5286.     public    kbd16,kbdin,kbdout
  5287.  
  5288.     PROCDEF    kbd16
  5289.  
  5290.     push    bp    ;Computer Innovations says ax,bc,cx,dx,si & di free
  5291.     mov    bp,sp        ; [bp+0] = old bp
  5292.                 ; [bp+2] = return address
  5293.                 ; [bp+4] = first (only) argument
  5294.  
  5295.     mov    di,06        ; 16 bit  console function
  5296.     Push    ES        ;save es
  5297.     int    18h        ; msdos equivalent of int 40
  5298.                 ; cl = 0, 1 or FF
  5299.                 ; ax = 16 bit character.
  5300.  
  5301.     pop    es
  5302.     xchg    ax,cx        ; al = 0, 1 or FF, cx = char.
  5303.     cbw            ; ax = 0, 1 or FFFF
  5304.     and    ax,ax        ; if ax != FFFF, don't translate...
  5305.     jns    nochar        ; ... just return status (in ax).
  5306.  
  5307.     test    ch,01        ; ch bit 0 is 1 for function keys.
  5308.     jz    nofunc        ; if not a function key, skip translation.
  5309.  
  5310.     lea    bx, keytbl    ; address of translate table.
  5311.     xchg    cx,ax        ; swap character and status (ax = character)
  5312.     xlat             ; translate char in al to one in table.
  5313.     xchg    ax,cx        ; swap character and status (ax = status)
  5314.  
  5315. nofunc:    mov    bx,param1    ; get parameter (address of buffer)
  5316.     mov    [bx],cx        ; put char in the buffer
  5317.  
  5318. nochar:    pop    bp        ; status is in ax
  5319.     ret
  5320.     PROCEND    kbd16
  5321.  
  5322.     PROCDEF    kbdin
  5323.  
  5324.     push    bp    ;Computer Innovations says ax,bc,cx,dx,si & di free
  5325.     mov    bp,sp        ; [bp+0] = old bp
  5326.                 ; [bp+2] = return address
  5327.                 ; [bp+4] = first (only) argument
  5328.  
  5329.     mov    di,02        ; 8 bit  console in function
  5330.     Push    ES        ;save es
  5331.     int    18h        ; msdos equivalent of int 40
  5332.                 ; cl = 0 or FF
  5333.                 ; al = 8 bit character.
  5334.     pop    es
  5335.  
  5336.     xchg    ax,cx        ; al = 0 or FF, cx = char.
  5337.     cbw            ; ax = 0 or FFFF
  5338.     and    ax,ax        ; if ax != FFFF ...
  5339.     jns    kin1        ; ... just return status (in ax).
  5340.  
  5341.     mov    bx,param1    ; get parameter (address of buffer)
  5342.     mov    [bx],cx        ; put char in the buffer
  5343.  
  5344. kin1:    pop    bp        ; status is in ax
  5345.     ret
  5346.     PROCEND    kbdin
  5347.  
  5348.     PROCDEF    kbdout
  5349.  
  5350.     push    bp    ;Computer Innovations says ax,bc,cx,dx,si & di free
  5351.     mov    bp,sp        ; [bp+0] = old bp
  5352.                 ; [bp+2] = return address
  5353.                 ; [bp+4] = first (only) argument
  5354.     mov    ax,param1    ; get char for output
  5355.     mov    di,02        ; 8 bit  console out function
  5356.     Push    ES        ;save es
  5357.     int    18h        ; msdos equivalent of int 40
  5358.     pop    es
  5359.     ret
  5360.     PROCEND    kbdout
  5361.  
  5362.  
  5363.     SEGEND    CODE
  5364.  
  5365. ;---------------------------------------------------------------+
  5366. ;                                |
  5367. ;            Enable and Disable Cursor            |
  5368. ;                                |
  5369. ;---------------------------------------------------------------+
  5370. ;
  5371. ;    enb_cur()
  5372. ;    dis_cur()
  5373. ;
  5374.  
  5375.     SEGDEF    CODE
  5376.  
  5377.     public    enb_cur,dis_cur
  5378.  
  5379.     PROCDEF    enb_cur
  5380.     enter                ;initialize stack
  5381.     push    es            ;gets clobbered
  5382.     mov    di,0Ah            ;function #
  5383.     int     18h            ;do it
  5384.     pop    es
  5385.     leave
  5386.     PROCEND    enb_cur
  5387.  
  5388.     PROCDEF    dis_cur
  5389.     enter                ;initialize stack
  5390.     push    es
  5391.     mov    di,08h
  5392.     int    18h
  5393.     pop    es
  5394.     leave
  5395.     PROCEND    dis_cur
  5396.  
  5397.     SEGEND    CODE
  5398.  
  5399.     END
  5400. +ARCHIVE+ msint.asm     7882 10/01/1983  1:09:16
  5401. TITLE MSINT.ASM Microsoft Mouse interrupt service
  5402. PAGE    ,132
  5403. ;***********************************************
  5404. ;                                              *
  5405. ;   Microuse Mouse hardware dependent code     *
  5406. ;   Copyright (C) 1983,1984 by Microsoft Inc.  *
  5407. ;   Copyright (C) 1984 by Digital Equipment Co.*
  5408. ;                                              *
  5409. ;***********************************************
  5410.  
  5411. include asmms.h
  5412. include asmc.h
  5413.  
  5414. ;**********************************************
  5415. ; Static data internal to interrupt handler   *
  5416. ;**********************************************
  5417. int_cond        DW  0               ; temp store - state check
  5418. tdelta_x        DB  0
  5419. tdelta_y        DB  0
  5420. mstate          DB  0               ; zero means looking for sync bit
  5421. m_buffer    DD  0               ; ADR Communications input circular buffer
  5422. Mpacket        DD  0               ; ADR MOUSE control packet  "MOUSE_PACKET"
  5423. Cpacket        DD  0               ; ADR MOUSE int. cond. "CONDITION_PACKET"
  5424.  
  5425. SUBTTL Comms Port Interrupt Handler
  5426. PAGE
  5427. ;**********************************************
  5428. ;   Serial Mouse hardware interrupt service   *
  5429. ;**********************************************
  5430.  
  5431.     PUBLIC    MSint_, _Chaddr
  5432.  
  5433. Msint_    PROC    FAR
  5434.  
  5435.     Cld                ;preserve machine state
  5436.     Push    DS
  5437.     Push    ES
  5438.     Push    AX
  5439.     Push    BX
  5440.     Push    CX
  5441.     Push    DX
  5442.     Push    DI
  5443.     Push    SI
  5444. ;
  5445. ;  get a delta x in bx, delta y in cx
  5446. ;
  5447.     call    getchar            ;get a character from ring buffer
  5448.     Lds    SI,CS:Mpacket        ;DS:SI = MOUSE_PACKET
  5449.     Les    DI,CS:Cpacket        ;ES:DI = CONDITION_PACKET
  5450.         test    al,01000000b            ;sync bit set?
  5451.         jnz     first_byte
  5452.         jmp     xory
  5453.  
  5454. ;------------------------------------
  5455. ; first byte of new 3 byte packet
  5456. ;  process button information
  5457. ;------------------------------------
  5458. ;
  5459. ;    first byte
  5460. ;
  5461. ;    +----+----+----+----+----+----+----+----+
  5462. ;    | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
  5463. ;    +----+----+----+----+----+----+----+----+
  5464. ;      |    |    |    |    |    |    |    |
  5465. ;      |    |    |    |    |    |    |    +---- X6
  5466. ;      |    |    |    |    |    |    +--------- X7
  5467. ;      |    |    |    |    |    +-------------- Y6
  5468. ;      |    |    |    |    +------------------- Y7
  5469. ;      |    |    |    +------------------------ RIGHT MOUSE BUTTON
  5470. ;      |    |    +----------------------------- LEFT MOUSE BUTTON
  5471. ;      |    +---------------------------------- 1 = FIRST BYTE (SYNCHRONIZE)
  5472. ;      +--------------------------------------- 7 BIT ASCII (MUST MASK)
  5473. ;
  5474. first_byte:
  5475.         xor     dx,dx               ; indicate primary button up
  5476.         mov     CS:[int_cond],dx       ; zero interrupt conditions
  5477.         mov     dl,al               ; get local copy of button state
  5478.         mov     cl,5            ; isolate the left mouse button 
  5479.         shr     dl,cl               ;    low bit has p button state
  5480.         mov     cx,1                ;    set up mask
  5481.         and     dx,cx            ;    mask off low bit
  5482.         not     cx                        ; invert
  5483.         and     cx,[SI].Bstate         ; get all other bits
  5484.         or      dx,cx                     ; dx = new button states
  5485.         xchg    [SI].Bstate,dx         ; move in current state get old state
  5486.         cmp     [SI].Bstate,dx         ; has it changed?
  5487.     sti                ;INTS OFF while we update
  5488.         jz      no_pb_change
  5489.         ja      pb_down
  5490. ;
  5491. ; primary button just released
  5492. ;
  5493.         or      CS:byte ptr [int_cond],00000100b
  5494.     inc    ES:WORD PTR [DI].P_button_rel
  5495.         jmp     short no_pb_change
  5496. ;
  5497. ; primary button just pressed
  5498. ;
  5499. pb_down:
  5500.         or      CS:byte ptr [int_cond],00000010b
  5501.     inc    ES:WORD PTR [DI].P_button_dep
  5502. no_pb_change:
  5503.     cli                ;INTS ON now done
  5504.         mov     dl,al               ; get local copy of button state
  5505.         mov     cl,3
  5506.         shr     dl,cl               ; low bit has s button state
  5507.         mov     cx,2                ; mask off low bit
  5508.         and     dx,cx
  5509.         not     cx                  ; invert
  5510.         and     cx,[SI].Bstate      ; get all other bits
  5511.         or      dx,cx               ; dx = new button states
  5512.         xchg    [SI].Bstate,dx      ; move in current state get old state
  5513.         cmp     [SI].Bstate,dx      ; has it changed
  5514.     sti                ;INTS OFF while we update
  5515.         jz      no_sb_change
  5516.         ja      sb_down
  5517. ;
  5518. ; secondary button just released
  5519. ;
  5520.         or      CS:byte ptr [int_cond],00010000b
  5521.     inc    ES:WORD PTR [DI].S_button_rel
  5522.         jmp     short no_sb_change
  5523. ;
  5524. ; secondary button just pressed
  5525. ;
  5526. sb_down:
  5527.         or      CS:byte ptr [int_cond],00001000b
  5528.     inc    ES:WORD PTR [DI].S_button_dep
  5529. no_sb_change:
  5530.     cli                ;INTS ON now done
  5531.         mov     bx,ax               ; save first byte info
  5532.         mov     cl,4
  5533.         shl     ax,cl
  5534.         and     al,11000000b
  5535.         mov     CS:[tdelta_y],al    ; save hibits of delta Y
  5536.         mov     cl,6
  5537.         shl     bx,cl
  5538.         and     bl,11000000b
  5539.         mov     CS:[tdelta_x],bl    ; save hibits of delta X
  5540.         mov     CS:[mstate],1      ; now we are looking for x...
  5541.         jmp     short ignore
  5542.  
  5543. ;------------------------------------
  5544. ;Process non SYNC byte
  5545. ;------------------------------------
  5546. xory:
  5547.         and     al,00111111b
  5548.         cmp     CS:[mstate],1              ; are we looking for x (byte 2)
  5549.         jb      ignore                  ; if zero, ignore, we want sync
  5550.         ja      do_tdelta_y              ; if above, must be for y (byte 3)
  5551.         or      CS:[tdelta_x],al
  5552.         mov     CS:[mstate],2          ; now we are looking for y...
  5553.  
  5554. ignore:
  5555.         xor     ax,ax
  5556.         jmp     short ack
  5557.  
  5558. ;------------------------------------
  5559. ;Process end of packet
  5560. ;------------------------------------
  5561. do_tdelta_y:
  5562.         or      al,CS:[tdelta_y]
  5563.         cbw
  5564.         mov     cx,ax            ;Delta Y in CX
  5565.         mov     al,CS:[tdelta_x]
  5566.         cbw
  5567.         mov     bx,ax            ;Delta X in BX
  5568.         mov     CS:[mstate],0
  5569.         mov     ax,bx                   ; get horizontal motion
  5570.         or      ax,cx                   ; or in vertical motion
  5571.         jz      nomove                  ; if zero, cursor didnt move
  5572.     sti                ;INTS OFF while we update
  5573.     add    [SI].Deltax,bx            ; update Delta X
  5574.     add    [SI].Deltay,cx            ; update delta Y
  5575.         or      CS:byte ptr [int_cond],00000001b   ; cursor moved..remember
  5576.     cli                ;INTS ON now done
  5577. nomove: mov     ax,CS:[int_cond]        ; ax=reason for calling MS-WIN
  5578.  
  5579. ack:
  5580.     Pop    SI        ;restore state
  5581.     Pop    DI
  5582.     Pop    DX
  5583.     Pop    CX
  5584.     Pop    BX
  5585.     Pop    AX
  5586.     Pop    ES
  5587.     Pop    DS
  5588.         ret
  5589.  
  5590. ;GETCHAR - routine to fetch next character out of m_buffer
  5591.  
  5592. getchar    PROC    NEAR
  5593.     Lds    SI,CS:m_buffer        ;DS:SI = M_buffer
  5594.     mov    ax,[SI].count        ;pick up char count
  5595.     and    ax,ax            ;any char avail?
  5596.     jz    getcha3
  5597.     sti                ;INTS OFF while we update
  5598.     dec    ax            ;decrement char count
  5599.     mov    [SI].count,ax        ;update buffer count
  5600.     mov    BX,[SI].opntr        ;character pntr
  5601.     mov    ax,[BX]
  5602.     cmp    BX,[SI].tail        ;at end?
  5603.     jnz    getcha1
  5604.     mov    BX,[SI].head        ;yes - point at head
  5605.     jmp short getcha2
  5606.  
  5607. getcha1:
  5608.     inc    BX            ;step to next char
  5609.     inc    BX
  5610. getcha2:
  5611.     mov    [SI].opntr,BX        ;save new pntr
  5612.     cli                ;INTS ON now done
  5613. getcha3:
  5614.     ret                ;return (char in AX)
  5615.  
  5616. getchar    ENDP
  5617.  
  5618. MSint_   ENDP
  5619.  
  5620. SUBTTL establish links with C program
  5621. PAGE
  5622.     ASSUME    ES:NOTHING
  5623. ;***********************************************
  5624. ;Return Address for C program
  5625. ;***********************************************
  5626.  
  5627. ; CS:OFFSET = _Chaddr(mptr,cptr,buffer);
  5628. ; CONDITION_PACKET *mptr;
  5629. ; MOUSE_PACKET *cptr
  5630. ; char *buffer;
  5631.  
  5632.     PROCDEF    _Chaddr
  5633.  
  5634.     Push    BP
  5635.     Mov    BP,SP
  5636.     Mov    AX,@AB[BP]        ;  Mpacket = mptr
  5637.     Mov    CS:WORD PTR Mpacket,AX
  5638.     Mov    CS:WORD PTR Mpacket+2, DS
  5639.     Mov    AX,@AB+2[BP]        ;  Cpacket = cptr
  5640.     Mov    CS:WORD PTR Cpacket,AX
  5641.     Mov    CS:WORD PTR Cpacket+2, DS
  5642.     Mov    AX,@AB+4[BP]        ;  m_buffer = buffer
  5643.     Mov    CS:WORD PTR m_buffer,AX
  5644.     Mov    CS:WORD PTR m_buffer+2, DS
  5645.     Mov    AX, CS:Cloc        ;  return interrupt offset
  5646.     Mov    SP,BP
  5647.     Pop    BP
  5648.     Ret
  5649. Cloc    Dw    MSint_
  5650.     PROCEND    _Chaddr
  5651.  
  5652. include epilogue.h
  5653.     END
  5654. +ARCHIVE+ msmouse.c    10884 12/18/1984 16:27:10
  5655. /***************************************************/
  5656. /*        MOUSE SUPPORT      mouse.c                 */
  5657. /***************************************************/
  5658.  
  5659. #include "stdio.h"
  5660. #include "mouse.h"
  5661.  
  5662. #define MODEM_OFF 0                /*drop dtr/rts*/
  5663. #define MODEM_ON  0x0C                /*raise dtr/rts*/
  5664.  
  5665. extern int _carry;                /*dos flag*/
  5666.  
  5667. struct  Rci_block {
  5668.     unsigned char rb_function;        /*PKT function */
  5669.     unsigned char rb_func_retc;        /*PKT return code*/
  5670.     unsigned char rb_character;        /*PKT character in/out*/
  5671.     unsigned char rb_char_stat;        /*PKT character status*/
  5672.     unsigned char  rb_device;        /*RCI device number*/
  5673.     unsigned int rb_offset,            /*RCI offset*/
  5674.              rb_segment;        /*RCI segment*/
  5675.     };
  5676.  
  5677. static char *Mouse_port[] = {
  5678.         "NUL",
  5679.         "AUX",                /* port = MDM */
  5680.         "PRN",                /* port = PRT */
  5681.         "AUX2"                /* port = AUX */
  5682.         };
  5683.  
  5684. static struct COMM_BLOCK save_config_;        /*save current values*/
  5685.  
  5686. static CONDITION_PACKET             /* action_ conditions*/
  5687.     action_   = {FALSE,0,0,0,0,0,0},
  5688.     noaction_ = {FALSE,0,0,0,0,0,0};
  5689.  
  5690. /*************************************************/
  5691. /* MSOPEN                                        */
  5692. /* msopen(device,control_packet,buffer,          */
  5693. /*        buffer_byte_size,mouse_type);          */
  5694. /* returns TRUE if mouse avail, else FALSE       */
  5695. /*************************************************/
  5696. msopen(device,mptr,bptr,bcnt,mtype)
  5697. int             device;            /*= port number*/
  5698. MOUSE_PACKET   *mptr;            /*= Mouse control block*/
  5699. unsigned char  *bptr;            /*= new circ. buffer for comms*/
  5700. int             bcnt;            /*= size of buffer in bytes*/
  5701. int             mtype;            /*= mouse type */
  5702.  
  5703. {   struct COMM_BLOCK config;
  5704.     int i, temp;
  5705.     unsigned int getds_(), getcs_();
  5706.     unsigned char c,  *testbyte_();
  5707.  
  5708.   if (mptr->Mouse_enabled == TRUE)
  5709.     msclose(mptr);
  5710.   mptr->Mouse_programmed = mptr->Mouse_enabled = FALSE;
  5711.   mptr->Mouse_type = mtype;
  5712.   mptr->Mouse_bstate = mptr->Deltax = mptr->Deltay = 0;
  5713.   mptr->X_ratio = Mouse_x_speed;
  5714.   mptr->X_threshold = Mouse_x_threshold;
  5715.   mptr->Y_ratio = Mouse_y_speed;
  5716.   mptr->Y_threshold = Mouse_y_threshold;
  5717.  
  5718.   mptr->Mouse_device = device;            /*see if port is there & open I/O*/
  5719.   strcpy(mptr->Mouse_port_name,Mouse_port[device]);
  5720.   mptr->Mouse_handle = msdos((0x3D02), 0, 0, mptr->Mouse_port_name);
  5721.   if (_carry)
  5722.     return FALSE;
  5723.  
  5724.   Msioctl_(mptr, 3,  &save_config_);        /*save what went on before*/
  5725.   config.cb_character = MODEM_OFF;        /*turn off DTR-RTS*/
  5726.   Msioctl_(mptr, 14,  &config);          /*drop modem lines & wait*/
  5727.   for (i=0; i<10000; i++);
  5728.  
  5729.   Msioctl_(mptr, 5,  &config);            /*disable rec interrupts*/
  5730.   config.cb_control = 1;                /*mode (data leads)*/
  5731.   config.cb_stop_bits = 1;                /*stop bits*/
  5732.   config.cb_data_bits = 3;                /*7 data bits*/
  5733.   config.cb_parity_out = 3;                /*no parity*/
  5734.   config.cb_rcv_baud = 9;                /*rx 1200 baud*/
  5735.   config.cb_xmit_baud = 9;                /*tx 1200 baud*/
  5736.   config.cb_xon_char = config.cb_xoff_char = 0;        /*XON/XOFF chars*/
  5737.   config.cb_in_xon = config.cb_out_xon = 2;        /*disable XON/XOFF*/
  5738.   config.cb_buffer_size = bcnt;                /*user buffer*/
  5739.   config.cb_buffer_offset = bptr;
  5740.   config.cb_buffer_segment = getds_();
  5741.  
  5742.   if(Msioctl_(mptr, 0, &config) != 0)               /*reprogram Mouse port*/
  5743.     mptr->Mouse_programmed = TRUE;
  5744.   Msioctl_(mptr, 4,  &config);            /*enable rec interrupts*/
  5745.  
  5746.   config.cb_character = MODEM_ON;        /*turn on DTR-RTS*/
  5747.   Msioctl_(mptr, 14,  &config);          /*raise modem lines & wait*/
  5748.   for (i=0; i<64; i++);
  5749.  
  5750.   if( (temp = msack(mptr)) == TRUE);
  5751.     rci_attach(mptr,&action_,bptr);
  5752.   return temp;
  5753. }
  5754.  
  5755. /***********************************************/
  5756. /*   Mouse close                               */
  5757. /***********************************************/
  5758. msclose(mptr)
  5759. MOUSE_PACKET      *mptr;
  5760.  
  5761. { struct COMM_BLOCK config;
  5762.   int ret=TRUE;
  5763.   Msioctl_(mptr, 5,  &config);            /*disable rec interrupts*/
  5764.   if (mptr->Mouse_new_vectors == TRUE)        /*reset system vectors*/
  5765.     rci_detach(mptr);
  5766.   Msioctl_(mptr, 2,  &config);            /*reset to defaults Buffer*/
  5767.   Msioctl_(mptr, 1,  &config);            /*reset to 'NVM'
  5768.                            & enable rec interrupts*/
  5769.   Msioctl_(mptr, 5,  &config);            /*disable rec interrupts*/
  5770.   if(!Msioctl_(mptr, 0, &save_config_))        /*reprogram Mouse port*/        ret=FALSE;
  5771.   Msioctl_(mptr, 4,  &config);            /*enable rec interrupts*/
  5772.   msdos((0x3E<<8), mptr->Mouse_handle, 0, 0);    /*close mouse port*/
  5773.   mptr->Mouse_programmed = mptr->Mouse_enabled = FALSE;
  5774.   return ret;
  5775. }
  5776.  
  5777. /***********************************************/
  5778. /*   see if a Mouse byte wants to come out     */
  5779. /*   of its hole, return if yes, FF if not     */
  5780. /***********************************************/
  5781. unsigned char *testbyte_(mptr)
  5782. MOUSE_PACKET      *mptr;
  5783. { struct COMM_BLOCK config;
  5784.  
  5785.   Msioctl_(mptr, 7, &config);            /*anyone home?*/
  5786.   if (config.cb_func_retc == 0xFF)
  5787.     return config.cb_character & 0x7F;
  5788.   return 0xFF;
  5789. }
  5790. /*************************************************/
  5791. /* Attach RCI vector to port                     */
  5792. /*************************************************/
  5793. rci_attach(mptr,cptr,buff)
  5794. MOUSE_PACKET      *mptr;
  5795. CONDITION_PACKET  *cptr;
  5796. char              *buff;
  5797. { struct Rci_block rci;
  5798.   unsigned int getcs_(),  _chaddr();
  5799.  
  5800.   rci.rb_offset = _chaddr(mptr,cptr,buff);    /*received char int vectors*/
  5801.   rci.rb_segment= getcs_();
  5802.   if(Msioctl_(mptr, 17, &rci) != 0)        /*set Mouse port int vector*/
  5803.     mptr->Mouse_new_vectors = TRUE;
  5804. }
  5805.  
  5806. /*************************************************/
  5807. /* Detach RCI vector from port                   */
  5808. /*************************************************/
  5809. rci_detach(mptr)
  5810. MOUSE_PACKET      *mptr;
  5811. { struct Rci_block rci;
  5812.  
  5813.   Msioctl_(mptr, 18, &rci);            /*reset to defaults RX int*/
  5814.   mptr->Mouse_new_vectors = FALSE;
  5815.  
  5816. }
  5817.  
  5818. /*************************************************/
  5819. /* MSIOCTL -- communicate with O.S.                */
  5820. /*    pass device#, function, and &command buff. */
  5821. /*************************************************/
  5822.  
  5823. int Msioctl_(mptr, function, ccb)
  5824. MOUSE_PACKET      *mptr;
  5825. unsigned int function;
  5826. struct COMM_BLOCK *ccb;
  5827. {
  5828.  
  5829.   ccb->cb_device = mptr->Mouse_device;
  5830.   ccb->cb_function = function;
  5831.   msdos((0x44<<8)+2, mptr->Mouse_handle, 0, ccb);
  5832.   return ccb->cb_func_retc;
  5833. }
  5834.  
  5835. /**************************************************/
  5836. /*     return current Data Segment register       */
  5837. /**************************************************/
  5838. unsigned int getds_()
  5839. {   struct {unsigned int rcs,rss,rds,res;} rregs;
  5840.  
  5841.   segread(&rregs);
  5842.   return rregs.rds;
  5843. }
  5844.  
  5845. /**************************************************/
  5846. /*     return current Code Segment register       */
  5847. /**************************************************/
  5848. unsigned int getcs_()
  5849. {   struct {unsigned int rcs,rss,rds,res;} rregs;
  5850.  
  5851.   segread(&rregs);
  5852.   return rregs.rcs;
  5853. }
  5854.  
  5855.  
  5856. /*****************************************************/
  5857. /* Serial Microsoft Mouse hardware dependent code    */
  5858. /*****************************************************/
  5859.  
  5860. /*-------------------------- Microsoft Mouse 3 byte packet
  5861. ;
  5862. ;
  5863. ;    First byte
  5864. ;
  5865. ;    +----+----+----+----+----+----+----+----+
  5866. ;    | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
  5867. ;    +----+----+----+----+----+----+----+----+
  5868. ;      |    |    |    |    |    |    |    |
  5869. ;      |    |    |    |    |    |    |    +---- X6  Delta X
  5870. ;      |    |    |    |    |    |    +--------- X7  Delta X
  5871. ;      |    |    |    |    |    +-------------- Y6  Delta Y
  5872. ;      |    |    |    |    +------------------- Y7  Delta Y
  5873. ;      |    |    |    +------------------------ Right Mouse Button
  5874. ;      |    |    +----------------------------- Left Mouse Button
  5875. ;      |    +---------------------------------- 1 = first byte (synchronize)
  5876. ;      +--------------------------------------- 7 bit ascii (MUST MASK)
  5877.  
  5878. ;    Second byte
  5879. ;
  5880. ;    +----+----+----+----+----+----+----+----+
  5881. ;    | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
  5882. ;    +----+----+----+----+----+----+----+----+
  5883. ;      |    |    |    |    |    |    |    |
  5884. ;      |    |    |    |    |    |    |    +---- X0  Delta X
  5885. ;      |    |    |    |    |    |    +--------- X1  Delta X
  5886. ;      |    |    |    |    |    +-------------- X2  Delta X
  5887. ;      |    |    |    |    +------------------- X3  Delta X
  5888. ;      |    |    |    +------------------------ X4  Delta X
  5889. ;      |    |    +----------------------------- X5  Delta X
  5890. ;      |    +---------------------------------- 0 = data byte (not first)
  5891. ;      +--------------------------------------- 7 bit ascii   (MUST MASK)
  5892.  
  5893. ;    Third byte
  5894. ;
  5895. ;    +----+----+----+----+----+----+----+----+
  5896. ;    | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
  5897. ;    +----+----+----+----+----+----+----+----+
  5898. ;      |    |    |    |    |    |    |    |
  5899. ;      |    |    |    |    |    |    |    +---- Y0  Delta Y
  5900. ;      |    |    |    |    |    |    +--------- Y1  Delta Y
  5901. ;      |    |    |    |    |    +-------------- Y2  Delta Y
  5902. ;      |    |    |    |    +------------------- Y3  Delta Y
  5903. ;      |    |    |    +------------------------ Y4  Delta Y
  5904. ;      |    |    +----------------------------- Y5  Delta Y
  5905.  ;      |    +---------------------------------- 0 = data byte (not first)
  5906.  ;      +--------------------------------------- 7 bit ascii   (MUST MASK)
  5907. ;
  5908.  */
  5909.  
  5910. /***********************************************/
  5911. /*   Microsoft Mouse acknowledge check         */
  5912. /***********************************************/
  5913. msack(mptr)
  5914. MOUSE_PACKET      *mptr;
  5915.  
  5916. {
  5917.   int i;
  5918.   unsigned char c;
  5919.   for (i=0; i<64; i++)             /*wait for ACK*/
  5920.     if ( (c = testbyte_(mptr)) == 'M')
  5921.         return (mptr->Mouse_enabled = TRUE);
  5922.   return FALSE;
  5923. }
  5924.  
  5925. /***********************************************/
  5926. /*   Microsoft Mouse packet decode             */
  5927. /***********************************************/
  5928. CONDITION_PACKET *msdecode(mptr)
  5929. MOUSE_PACKET *mptr;
  5930.  
  5931. {
  5932.   action_.Delta_x = action_.Delta_y = 0;    /*reset delta return*/
  5933.   action_.Movement = FALSE;        /*reset interrupt conditions*/
  5934.   if (mptr->Mouse_enabled != TRUE)
  5935.     return &action_;
  5936.  
  5937.   switch (mptr->P_button) {
  5938.     case TRUE:  if (action_.P_button_rel) {
  5939.             action_.P_button_rel--;
  5940.             mptr->P_button = FALSE;
  5941.             }
  5942.         break;
  5943.     case FALSE: if (action_.P_button_dep) {
  5944.             action_.P_button_dep--;
  5945.             mptr->P_button = TRUE;
  5946.             }
  5947.         break;
  5948.     }
  5949.   switch (mptr->S_button) {
  5950.     case TRUE:  if (action_.S_button_rel) {
  5951.             action_.S_button_rel--;
  5952.             mptr->S_button = FALSE;
  5953.             }
  5954.         break;
  5955.     case FALSE: if (action_.S_button_dep) {
  5956.             action_.S_button_dep--;
  5957.             mptr->S_button = TRUE;
  5958.             }
  5959.         break;
  5960.     }
  5961.   if (mptr->Deltax | mptr->Deltay) {         /*if movement ... */
  5962.     action_.Movement = TRUE;             /*flag "mouse moved"*/
  5963.     action_.Delta_x = mptr->Deltax * mptr->X_ratio;  /*add in delta_x*/
  5964.     action_.Delta_y = mptr->Deltay * mptr->Y_ratio;  /*add in delta_y*/
  5965.     mptr->Deltax = mptr->Deltay = 0;
  5966.     }
  5967.   return &action_;
  5968. }
  5969. testbit_(b,mask)            /*test bit, ret != 0 if yes*/
  5970. unsigned b,mask;
  5971. { return (b &= mask); }
  5972.  
  5973. +ARCHIVE+ openws.asm   14324 10/01/1983  0:32:58
  5974. PAGE ,132
  5975. ;OPENWS.ASM
  5976. ;
  5977. ;UPDATE HISTORY
  5978. ;==============
  5979. ;  27-9-84    add 100a support                    [1]
  5980.  
  5981.     include    asmc.h
  5982.     SEGEND    CODE
  5983.  
  5984.     SEGDEF    DATA
  5985.  
  5986. PUBLIC  ws_data_, p1_, ws_number_, ws_wmo_, gbmod_, fgbg_, alups_
  5987. PUBLIC  gbmskl_, gbmskh_, gdcml_, gdcmh_, curl0_, curl1_, curl2_
  5988. PUBLIC  ymax_, xmax_, twdir_, nmritl_, nmrith_, sh_p_lin_, wd_p_lin_
  5989. PUBLIC  x_start_, y_start_, x_stop_, y_stop_, g_strtx_
  5990. PUBLIC  scr_top_, scr_bot_, scrltb_, clmpda_
  5991. PUBLIC  pattbl_, l_col_, l_type_, l_wid_, f_col_, f_type_, f_style_
  5992. PUBLIC  f_patrn_, t_col_, t_font_, t_sca_, t_dir_, t_x_, t_y_
  5993. PUBLIC  m_col_, m_type_, m_sca_, m_tab_
  5994. PUBLIC  tfonts_, old_int_off, old_int_seg, int_done, gp_buff_
  5995. PUBLIC  gintvect_, swisg_, sw100a_,  swgopen_, swgon_            ;[1]
  5996. ;****************************************************************    [1]
  5997. ;*                                *    [1]
  5998. ;*        Workstation definitions                *    [1]
  5999. ;*                                *    [1]
  6000. ;****************************************************************    [1]
  6001.  
  6002.  
  6003. ;  PRESERVE ORDER - SEE LD_WSDETS_                    [1]
  6004. ;  ===============================                    [1]
  6005.  
  6006. ws_data_   DQ      0,0,0
  6007.            DD      0
  6008. p1_        DQ      0,0
  6009. ws_number_ DB      1        ;workstation number (see ld_wsdets_)    [1]
  6010. ws_wmo_    DB      1        ;write mode                [1]
  6011. gbmod_     DB      1        ;graphics bd mode register        [1]
  6012. fgbg_      DB      1
  6013. alups_     DB      1
  6014. gbmskl_    DB      1        ;graphics bd mask register -  low byte    [1]
  6015. gbmskh_    DB      1        ;    "    "    "  - high byte    [1]
  6016. gdcml_     DB      1        ;GDC mask register bits -  low byte    [1]
  6017. gdcmh_     DB      1        ;    "    "    - high byte    [1]
  6018. curl0_     DB      1        ;cursor        -  low byte        [1]
  6019. curl1_     DB      1        ;  location    - middle byte        [1]
  6020. curl2_     DB      1        ;     storage    - high bytes & dot addr    [1]
  6021. ymax_      DW      1
  6022. xmax_      DW      1
  6023. twdir_     DB      1        ;direction for text mode writing    [1]
  6024. nmritl_    DB      1        ;number of GDC writes -  low byte    [1]
  6025. nmrith_    DB      1        ;    "    "     - high byte    [1]
  6026. sh_p_lin_  DW      1        ;shift factor for one line of words    [1]
  6027. wd_p_lin_  DW      1        ;words/scan line for curr resolution    [1]
  6028. x_start_   DW      1
  6029. y_start_   DW      1
  6030. x_stop_    DW      1
  6031. y_stop_    DW      1
  6032. g_strtx_   DW      1
  6033. scr_top_   DB      1
  6034. scr_bot_   DB      1
  6035.                 ;scroll map shadow area            [1]
  6036. scrltb_    DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6037.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6038. clmpda_    DQ      0,0,0,0
  6039. pattbl_    DQ      0,0,0,0
  6040. ;------------------------                        [1]
  6041. ; LINE DRAWING CONSTANTS                        [1]
  6042. ;------------------------                        [1]
  6043. l_col_     DB      1        ;colour                    [1]
  6044. l_type_    DB      1        ;line type                [1]
  6045. l_wid_     DB      1        ;line width                [1]
  6046. ;------------------------                        [1]
  6047. ;  AREA FILL CONSTANTS                            [1]
  6048. ;------------------------                        [1]
  6049. f_col_     DB      1        ;colour                    [1]
  6050. f_type_    DB      1        ;fill type                [1]
  6051. f_style_   DB      1        ;fill style                [1]
  6052. f_patrn_   DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6053. ;------------------------                        [1]
  6054. ;  TEXT WRITE CONSTANTS                            [1]
  6055. ;------------------------                        [1]
  6056. t_col_     DB      1        ;colour                    [1]
  6057. t_font_    DB      1        ;font index                [1]
  6058. t_sca_     DB      1        ;sizing scale                [1]
  6059. t_dir_     DB      1        ;writing direction            [1]
  6060. t_x_       DW      1
  6061. t_y_       DW      1
  6062. ;------------------------                        [1]
  6063. ;  MARKER CONSTANTS                            [1]
  6064. ;------------------------                        [1]
  6065. m_col_     DB      1        ;colour                    [1]
  6066. m_type_    DB      1        ;marker type (index 0-14 to m_tab_)    [1]
  6067. m_sca_     DB      1        ;marker sizing scale            [1]
  6068. m_tab_     DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6069.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6070. ;------------------------                        [1]
  6071. ;  TEXT FONT TABLES                            [1]
  6072. ;------------------------                        [1]
  6073.  
  6074. tfonts_    DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6075.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6076.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6077.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6078.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6079.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6080.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6081.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6082.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6083.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6084.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6085.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6086.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6087.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6088.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6089.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6090.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6091.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6092.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6093.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6094.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6095.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6096.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6097.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6098.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6099.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6100.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6101.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6102.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6103.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6104. ;------------------------                        [1]
  6105. ;  WORK AREAS                                [1]
  6106. ;------------------------                        [1]
  6107. old_int_off  DW    1
  6108. old_int_seg  DW    1
  6109. int_done     DB    1
  6110. gintvect_    DW    288h        ;graphics hardware int vector location    [1]
  6111. ;------------------------                        [1]
  6112. ; SWITCHES                                [1]
  6113. ;------------------------                        [1]
  6114. swisg_        DB    0        ;1 = graphics option present    [1]
  6115. sw100a_     DB    0        ;1 = 100a, 0 = 100b        [1]
  6116. swgopen_    DB    0        ;1 = workstation opened        [1]
  6117. swgon_        DB    0        ;1 = graphics open for business    [1]
  6118.  
  6119. ;------------------------                        [1]
  6120. ;4k general purpose storage for xy points etc.,
  6121. ;gives a max of 1024 'xy' points for polylines.
  6122. ;[Why not, we've got lots of room in the D seg]
  6123. ;------------------------                        [1]
  6124. gp_buff_   DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6125.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6126.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6127.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6128.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6129.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6130.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6131.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6132.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6133.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6134.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6135.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6136.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6137.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6138.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6139.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6140.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6141.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6142.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6143.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6144.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6145.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6146.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6147.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6148.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6149.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6150.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6151.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6152.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6153.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6154.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6155.            DQ      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  6156.     SEGEND    DATA
  6157.  
  6158.     SEGDEF    CODE
  6159.  
  6160.     IF    @bigmodel
  6161. EXTRN    ld_wsdets_:FAR, gropt_:FAR                    ;[1]
  6162.  
  6163. EXTRN    a_mode_:FAR, fifo_mt_:FAR, a_wmode_:FAR, a_cmap_:FAR, a_patrn_:FAR
  6164. EXTRN    a_scrmap_:FAR, a_gbmsk_:FAR, gdc_nb_:FAR, bar_:FAR
  6165.     ELSE
  6166. EXTRN    ld_wsdets_:NEAR, gropt_:NEAR                    ;[1]
  6167.  
  6168. EXTRN    a_mode_:NEAR, fifo_mt_:NEAR, a_wmode_:NEAR, a_cmap_:NEAR, a_patrn_:NEAR
  6169. EXTRN    a_scrmap_:NEAR, a_gbmsk_:NEAR, gdc_nb_:NEAR, bar_:NEAR
  6170.     ENDIF
  6171.  
  6172. PUBLIC    openws_, clearws_
  6173. PUBLIC    dseg_sav, eseg_sav
  6174.  
  6175. ;********************************************************************
  6176. ;*                                                                  *
  6177. ;*      f u n c t i o n      openws_(number)                         *
  6178. ;*                                                                  *
  6179. ;*      purpose:        initialize the graphics option              *
  6180. ;*                                                                  *
  6181. ;*      entry:          8[bp]  graphics display type                *
  6182. ;*                      1 medium res monochrome                     *
  6183. ;*                      2 high res monochrome                       *
  6184. ;*                      3 medium res colour                        *
  6185. ;*                      4 high res colour                        *
  6186. ;*                      5 medium res dual monitor                   *
  6187. ;*                      6 high res dual monitor                     *
  6188. ;*                                                                  *
  6189. ;*      exit:           all shadow bytes initialized                *
  6190. ;*                      NULL if work_station open                   *
  6191. ;*                      otherwise EOF                               *
  6192. ;*                                                                  *
  6193. ;********************************************************************
  6194.  
  6195.     PROCDEF    openws_
  6196.  
  6197.         push    si
  6198.         push    di
  6199.         push    bp
  6200.         mov     bp, sp
  6201.  
  6202.     mov    swgopen_,1        ;ensure not open
  6203.     call    gropt_            ;check opt & test motherboard      [1]
  6204.         or      ax, ax            ;test return                   [1]
  6205.         je      L3            ;if not NULL exit with EOF as ...  [1]
  6206.         mov     ax,-1                   ;...no Graphics option installed.  [1]
  6207.         jmp     L1
  6208.  
  6209.  
  6210. L3:     mov     ax, 8[bp]
  6211.         mov     ws_number_,al           ;set ws number & make ...
  6212.         call    ld_wsdets_               ;call on higher level to process
  6213.         or      ax, ax
  6214.         je      L3a            ;if not NULL ...
  6215.         jmp     L1                      ;... exit with DOS return code.
  6216.  
  6217.  
  6218. L3a:    cld                     ;make sure that lods incs.
  6219.         mov     ax,ds
  6220.         mov     cs:dseg_sav, ax
  6221.         mov     ax,es
  6222.         mov     cs:eseg_sav, ax
  6223.  
  6224.         lea     si,  ws_data_     ;point to wrk_station data
  6225.  
  6226.         lodsb                    ;reset command
  6227.         out    57H,al
  6228.         call    a_mode_           ;turn off graphics output 
  6229.         mov     cx, 8
  6230. L21:    lodsb                    ;get and send reset parameters
  6231.         out    56H,al
  6232.         loop    L21
  6233.  
  6234.         lodsb                    ;pitch command
  6235.         out    57H,al
  6236.         lodsb                    ;memory width for vert. pitch
  6237.         out    56H,al
  6238.         lodsb                    ;start command
  6239.         out    57H,al         ;start the video signals going
  6240.         lodsb                    ;zoom command
  6241.         out    57H,al
  6242.         lodsb                    ;magnification assumed to be 0
  6243.         out    56H,al
  6244.         lodsb                    ;setup R;M;W memory cycles for 
  6245.         out    57H,al          ;figure drawing
  6246. ;
  6247. ;Initialize PRAM command. Start window at the address in startl,
  6248. ;starth.  Set the window length for 256 lines. Fill PRAM parameters 
  6249. ;8 and 9 with all ones so GDC can do graphics draw commands withoutb
  6250. ;altering the data we want drawn.
  6251. ;
  6252.         lodsb                    ;issue the pram command, setup
  6253.         out    57H,al         ;GDC display
  6254.         mov     cx, 4
  6255. L22:    lodsb                    ;get and send pram parameters
  6256.         out    56H,al
  6257.         loop    L22
  6258.  
  6259.         lodsb                    ;issue pram command pointing to p8
  6260.         out    57H,al
  6261.         lodsb                    ;fill pram with ones pattern
  6262.         out    56H,al
  6263.         out    56H,al
  6264.         call    fifo_mt_
  6265.         lodsb                    ;issue the cchar command
  6266.         out    57H,al
  6267.         xor    al,al           ;initialize cchar parameterDBs
  6268.         out    56H,al          ;graphics cursor is one line, not
  6269.         out    56H,al         ;displayed, non-blinking
  6270.         out    56H,al
  6271.         lodsb                    ;vsync command
  6272.         out    57H,al
  6273.         out    50H,al          ;reset the graphics board
  6274.         lodsb
  6275.         out    53H,al
  6276.         mov    al, gbmod_      ;enable, then disable interrupts
  6277.         or    al,40H        ;to flush the interrupt hardware
  6278.         out    51H,al         ;latches
  6279.         mov     cx,4920        ;wait for a vert sync to happen
  6280. L23:    loop    L23
  6281.         mov    al,0BFH       ;disable the interrupts
  6282.         out    53H,al
  6283.         mov    al,gbmod_
  6284.         out    51H,al
  6285.  
  6286.         call    a_wmode_        ;set up fgbg & alups
  6287.         call    a_cmap_         ;load colormap
  6288.         call    a_scrmap_       ;load scroll map
  6289.         call    a_patrn_        ;set up pattern_mult & reg.
  6290.         call    a_gbmsk_        ;fetch and issue the GO mask.
  6291.         call    clearws_         ;fill the bitmap with the background colour.
  6292.         call    gdc_nb_         ;wait for a bit.
  6293.         mov    al,0DH
  6294.         out    57H,al         ;enable the display
  6295.  
  6296.         xor     ax,ax           ;good exit with NULL.
  6297.     mov    swgopen_,1    ;tell the world
  6298.  
  6299. L1:     mov     sp, bp
  6300.         pop     bp
  6301.         pop     di
  6302.         pop     si
  6303.         ret
  6304.  
  6305.     PROCEND    openws_
  6306.  
  6307.     PROCDEF    clearws_
  6308.  
  6309.         push    di
  6310.         push    bp
  6311.  
  6312.         mov     ax,cs:eseg_sav
  6313.         mov     es,ax
  6314.         call    gdc_nb_
  6315.         mov     al,ws_wmo_
  6316.         push    ax
  6317.         mov     ws_wmo_,3
  6318.         call    a_wmode_
  6319.         lea     di, gp_buff_
  6320.         xor     ax,ax
  6321.         cld
  6322.         stosw
  6323.         stosw
  6324.         mov     ax,xmax_
  6325.         stosw
  6326.         mov     ax,ymax_
  6327.         stosw
  6328.         mov     al,f_col_
  6329.         mov     f_col_,0
  6330.         push    ax
  6331.         lea     ax, gp_buff_
  6332.         push    ax
  6333.         call    bar_
  6334.         add     sp,2
  6335.         pop     ax
  6336.         mov     f_col_,al
  6337.         call    gdc_nb_
  6338.         pop     ax
  6339.         mov     ws_wmo_,0
  6340.         call    a_wmode_
  6341.         pop     bp
  6342.         pop     di
  6343.         ret
  6344.  
  6345. dseg_sav        DW      0
  6346. eseg_sav        DW      0
  6347.  
  6348.     PROCEND    clearws_
  6349.  
  6350.     include    epilogue.h
  6351.  
  6352.     END
  6353. +ARCHIVE+ rwcell.asm   12266  9/01/1984  2:59:42
  6354. TITLE RWCELL.ASM
  6355. PAGE ,132
  6356.  
  6357. include asmc.h
  6358.  
  6359.     SEGEND  CODE
  6360.     SEGDEF  DATA
  6361. include asmd.h
  6362.     SEGEND  DATA
  6363.     SEGDEF  CODE
  6364.  
  6365.     PUBLIC    rd_cell_
  6366.     PUBLIC    wr_cell_
  6367.  
  6368.     IF    @BIGMODEL
  6369.     EXTRN    a_fgbg_:FAR, a_alups_:FAR, a_gbmsk_:FAR, a_mode_:FAR
  6370.     EXTRN    cxy2cp_:FAR, free_:FAR, gdc_nb_:FAR, malloc_:FAR
  6371.     ELSE
  6372.     EXTRN    a_fgbg_:NEAR, a_alups_:NEAR, a_gbmsk_:NEAR, a_mode_:NEAR
  6373.     EXTRN    cxy2cp_:NEAR, free_:NEAR, gdc_nb_:NEAR, malloc_:NEAR
  6374.     ENDIF
  6375.  
  6376. ;******************************************************************************
  6377. ;*                                                                            *
  6378. ;*    F U N C T I O N   rd_cell(strctr)                          *
  6379. ;*            struct g_cell *strctr;                      *
  6380. ;*                                          *
  6381. ;*    purpose:    Read one plane of the 'cell' (specified as 'bottom left'      *
  6382. ;*        'top right') into an array. The structure will be filled      *
  6383. ;*        in appropriately if successful and a value of '1' will be     *
  6384. ;*        returned. If memory could not be allocated, a 'NULL' is          *
  6385. ;*        returned.                              *
  6386. ;*        'strctr' is defined in graph.h and is of the form:          *
  6387. ;*                                          *
  6388. ;*        struct g_cell {                              *
  6389. ;*            int c_corner[4],                      *
  6390. ;*                c_plane,                          *
  6391. ;*                c_rows,                          *
  6392. ;*                c_bytes;                          *
  6393. ;*            unsigned char *c_segment,                  *
  6394. ;*                      c_offset[];                  *
  6395. ;*        };                                  *
  6396. ;*                                          *
  6397. ;*        Before calling rw_cell(), fill in the c_corner[] array with   *
  6398. ;*        the bottom-right & top-left 'xy' co-ordinates and set c_plane *
  6399. ;*        to the plane number you want to read. (0 to 1 or 3, depending *
  6400. ;*        on high or medium resolution workstation type.)              *
  6401. ;*        'c_segment' would not normally be used explicitly by the user *
  6402. ;*        unless the whole bitmap needs to be read. If the function is  *
  6403. ;*        called with 'c_segment' = 0, memory will be automatically     *
  6404. ;*        requested and the current data seg will be used.          *
  6405. ;*                                          *
  6406. ;*    ******************************************************************    *
  6407. ;*    *******    REMEMBER TO 'free(strctr->c_offset)' IT AFTERWARDS *******    *
  6408. ;*    ******************************************************************    *
  6409. ;*                                          *
  6410. ;*        To set up an external area, use the msdos get memory function *
  6411. ;*                                          *
  6412. ;*        The bytes in the array at c_offset will be bit aligned.       *
  6413. ;*        Any particular bit may then be accessed/changed eg.          *
  6414. ;*                                          *
  6415. ;*            r = strctr->c_rows - 1;                      *
  6416. ;*            b = strctr->c_bytes;                      *
  6417. ;*            strctr->c_offset[(r * b) + b] |= 128;              *
  6418. ;*                                          *
  6419. ;*        Will set the first bit in the last byte of the last row of    *
  6420. ;*        the plane read, as long as the array is in your current data  *
  6421. ;*        segment. If not, you will need to play around moving chunks   *
  6422. ;*        into your DS, change it, then move it back again.          *
  6423. ;*                                          *
  6424. ;******************************************************************************
  6425.  
  6426. ;LOCAL READ SUBROUTINE
  6427. Lrd_bytes PROC  NEAR
  6428.     in    al,56H            ;byte ready to be read?
  6429.         test    al,01H
  6430.         jz      Lrd_bytes       ;jump if not.
  6431.         in    al,57H            ;read the byte.
  6432.         stosb
  6433.         loop    Lrd_bytes
  6434.     ret
  6435. Lrd_bytes ENDP
  6436.  
  6437.  
  6438.     PROCDEF rd_cell_
  6439.     push    si
  6440.     push    di
  6441.     push    bp
  6442.     mov    bp,sp
  6443.     sub    sp,8            ; -2[bp] alups reg.
  6444.                     ; -4[bp] No. of pixels.
  6445.                     ; -6[bp] No. of bytes per row.
  6446.                     ; -8[bp] No. of rows.
  6447.  
  6448.     mov    ax,cs:eseg_sav    ;just in case!
  6449.     mov    es,ax
  6450.     cld                     ;make the coming stosb instruction increment di.
  6451.     mov    si,WORD PTR 8[bp]    ;get pointer to the structure.
  6452.     mov    ax,WORD PTR 4[si]    ;top right 'x'
  6453.     sub    ax,WORD PTR [si]    ;minus bottom left 'x'
  6454.     inc    ax            ;equals No. of pixels.
  6455.     mov    WORD PTR -4[bp],ax
  6456.     add    ax,7
  6457.     mov    cl,3
  6458.     shr    ax,cl            ;number of bytes in one array element.
  6459.     mov    WORD PTR -6[bp],ax
  6460.     mov    cx,ax
  6461.     mov    ax,WORD PTR 6[si]    ;top right 'y'
  6462.     sub    ax,WORD PTR 2[si]    ;minus bottom left 'y'
  6463.     inc    ax            ;equals No. of rows.
  6464.     mov    WORD PTR -8[bp],ax
  6465.     mul    cx            ;bytes * rows.
  6466.     cmp    WORD PTR 14[si],0000H    ;any segment defined ?
  6467.     jnz    L2
  6468.     push    si
  6469.     push    ax
  6470.     call    malloc_            ;allocate space in our Data seg.
  6471.     add    sp,2
  6472.     pop    si
  6473.     or    ax,ax            ;did it work ?
  6474.     jnz    L1a
  6475.     jmp    Lexit            ;quit on failure.
  6476.  
  6477. L1a:    mov    WORD PTR 16[si],ax    ;update the structure's c_offset
  6478.     mov    ax,ds            ;and c_seg info.
  6479.     mov    WORD PTR 14[si],ax
  6480. L2:    mov    di,si            ;point DI to strctr.c_rows.
  6481.     add    di,000AH
  6482.     mov    ax,WORD PTR -8[bp]
  6483.     stosw                ;number of rows.
  6484.     mov    ax,WORD PTR -6[bp]
  6485.     stosw                ;number of bytes per row.
  6486.  
  6487.     mov    al,alups_        ;save old alups on the stack.
  6488.     mov    WORD PTR -2[bp],ax
  6489.     mov    alups_,0fH        ;disable all writes.
  6490.     call    gdc_nb_
  6491.     call    a_alups_
  6492.  
  6493.     mov    ax,WORD PTR 8[si]    ;juggle mode for the specified plane.
  6494.     and    al,3
  6495.     shl    al,1
  6496.     shl    al,1
  6497.     and    gbmod_,0a1H
  6498.     or    gbmod_,al
  6499.     call    a_mode_
  6500.  
  6501.     mov    ax,ymax_        ;convert 'y' co-ord to top left origin.
  6502.     sub    ax,WORD PTR 2[si]
  6503.     mov    y_start_,ax
  6504.     mov    ax,WORD PTR [si]    ;set up the starting 'x' co-ordinate.
  6505.     mov    bx,ax
  6506.     and    ax,0fff0H        ;make 'x' a word address.
  6507.     mov    x_start_,ax
  6508.  
  6509.     mov    ax,bx            ;get 'x' address
  6510.     and    ax,07H            ;x % 8
  6511.     add    ax,WORD PTR -4[bp]    ;add the number of pixels.
  6512.     add    ax,7            ;is last byte an odd address?
  6513. Lrd1:    mov    cl,03H
  6514.     shr    ax,cl
  6515.     mov    cx,ax            ;CX = total bytes to read.
  6516.  
  6517.     mov    dl,0            ;if first byte is on an odd address
  6518.     test    bl,08H            ; DL = 1 and we need to throw away the
  6519.     jz    Lrd2            ; first byte read in.
  6520.     inc    dl
  6521.     inc    ax
  6522. Lrd2:    test    al,01H            ;still an odd number of bytes ?
  6523.     jz    Lrd3            ;jump if not.
  6524.     inc    ax
  6525. Lrd3:    shr    ax,1            ;AX = number of words to read.
  6526.     mov    WORD PTR nmritl_,ax
  6527.  
  6528.     mov    ax,WORD PTR [di]    ;get the es seg
  6529.     mov    di,WORD PTR 2[di]    ;and offset.
  6530. Lrd4:    push    dx
  6531.     push    cx
  6532.     push    di
  6533.     push    ax
  6534.  
  6535.     call    cxy2cp_
  6536.         lea     di,gp_buff_            ;DI register points to gp_buff_.
  6537.  
  6538.     mov    al,4aH                ;set all bits in gdc mask.
  6539.         out    57H,al
  6540.         mov    al,0ffH
  6541.         out    56H,al
  6542.         out    56H,al
  6543.         mov    al,4cH            ;assert the figs command.
  6544.         out    57H,al
  6545.         mov    al,2            ;direction is to the right.
  6546.         out    56H,al
  6547.     mov    ax,WORD PTR nmritl_
  6548.         out    56H,al
  6549.         mov    al,ah
  6550.         out    56H,al
  6551.         mov    al,0a0H            ;start the read operation now.
  6552.         out    57H,al
  6553.  
  6554.     or    dl,dl            ;is first byte on an odd address ?
  6555.     jz    Lrd5
  6556.     push    cx            ;read first byte and throw it away.
  6557.     mov    cx,1
  6558.     call    Lrd_bytes
  6559.     pop    cx
  6560.     dec    di
  6561. Lrd5:    call    Lrd_bytes
  6562.  
  6563.     pop    ax
  6564.     mov    es,ax
  6565.     pop    di
  6566.     lea    si,gp_buff_        ;point SI to the bytes read.
  6567.     mov    ax,bx            ;'x' start
  6568.     and    al,07
  6569.     mov    cl,08
  6570.     sub    cl,al
  6571.     mov    dx,WORD PTR -6[BP]    ;get bytes/row
  6572. Lrd6:    lodsw
  6573.     xchg    ah,al
  6574.     shr    ax,cl
  6575.     stosb
  6576.     dec    si
  6577.     dec    dx
  6578.     jnz    Lrd6
  6579.  
  6580.     push    es
  6581.     mov    ax,ds
  6582.     mov    es,ax
  6583.     pop    ax
  6584.     pop    cx
  6585.     pop    dx
  6586.     dec    WORD PTR -8[bp]        ;decrement 'row' count
  6587.     jz    Lrd7
  6588.     dec    y_start_        ;point to next screen line.
  6589.     jmp    Lrd4
  6590.  
  6591. Lrd7:    mov    al,0dH             ;send a 'do nothing' to turn the fifo round.
  6592.     out    57H,al
  6593.  
  6594.     or    gbmod_,10H    ;The following chunk of code is included
  6595.     call    a_mode_        ;because the GDC has a problem writing to
  6596.     mov    al,4cH        ;the bitmap after a read sequence has been
  6597.     out    57H,al        ;completed.
  6598.     xor    al,al
  6599.     out    56H,al
  6600.     out    56H,al
  6601.     out    56H,al
  6602.     mov    al,22H
  6603.     out    57H,al
  6604.     mov    al,0ffH
  6605.     out    56H,al
  6606.     out    56H,al
  6607.  
  6608.     mov    ax,WORD PTR -2[bp]
  6609.     mov    alups_,al
  6610.     call    gdc_nb_
  6611.     call    a_alups_
  6612.  
  6613.     mov    ax,1
  6614. Lexit:    mov    sp,bp
  6615.     pop    bp
  6616.     pop    di
  6617.     pop    si
  6618.         ret
  6619.  
  6620.     PROCEND rd_cell_
  6621. ;******************************************************************************
  6622. ;*                                                                            *
  6623. ;*    F U N C T I O N   wr_cell(strctr)                          *
  6624. ;*            struct g_cell *strctr;                      *
  6625. ;*                                          *
  6626. ;******************************************************************************
  6627.  
  6628. ;LOCAL WRITE SUBROUTINE
  6629. ; Enters with :    BX = number of bytes to write.
  6630. ;        CH = number of bits displayed in left-hand byte.
  6631. ;        DH = number of bits in the right-hand byte.
  6632. ;        DL = 0 - first byte is EVEN, last byte is ODD.
  6633. ;             1 - first byte is ODD.
  6634. ;             2 - last byte is EVEN.
  6635. ;             3 - first byte is ODD, last byte is EVEN.
  6636.  
  6637. Lwrite  PROC    NEAR
  6638.     call    cxy2cp_
  6639.     lea    si,gp_buff_
  6640.     mov    ax,0ffffH
  6641.     test    dl,01H            ;is first byte ODD ?
  6642.     jnz    Lwr4            ;jump if it is.
  6643.     inc    al            ;AX = 0xff00
  6644. Lwr4:
  6645.     xchg    cl,ch            ;make the left hand mask.
  6646.     shl    ax,cl
  6647.     mov    WORD PTR gbmskl_,ax
  6648.     mov    WORD PTR nmritl_,0000H    ;one word to be written.
  6649.     mov    cx,0002H         ;first bytes always on a word boundary.
  6650.     sub    bx,cx
  6651.     jnz    Lwr4b
  6652.     push    bx
  6653.     mov    bx,0ffffH
  6654.     mov    cl,dh
  6655.     test    dl,02H
  6656.     jnz    Lwr4a
  6657.     inc    bh
  6658. Lwr4a:    shr    bx,cl
  6659.     or    ax,bx
  6660.     pop    bx
  6661. Lwr4b:    mov    WORD PTR gbmskl_,ax
  6662.     call    Lrit
  6663.     or    bx,bx
  6664.     jnz    Lwr4c
  6665.     ret
  6666. Lwr4c:
  6667.     mov    WORD PTR gbmskl_,0000H    ;set mask and count for 'words'.
  6668.     mov    WORD PTR nmritl_,0007H
  6669. Lwr5:                    ;Loop to write 16 bytes at a time.
  6670.     mov    cx,0010H
  6671.     sub    bx,cx
  6672.     js    Lwr6
  6673.     call    Lrit
  6674.     jmp    Lwr5
  6675. Lwr6:
  6676.     add    bx,0010H
  6677.     cmp    bx,02H
  6678.     jz    Lwr8
  6679.     sub    bx,02H
  6680.  
  6681.     mov    cl,bl
  6682.     shr    bx,01
  6683.     dec    bx
  6684.     mov    WORD PTR nmritl_,bx
  6685.     call    Lrit
  6686. Lwr8:                    ;Write the last byte[s].
  6687.     mov    WORD PTR nmritl_,0000H
  6688.     mov    ax,0ffffH
  6689.     mov    cl,dh
  6690.     test    dl,02H
  6691.     jnz    Lwr9
  6692.     mov    ah,00H
  6693. Lwr9:    shr    ax,cl
  6694.     mov    WORD PTR gbmskl_,ax
  6695.     mov    cl,02H
  6696.  
  6697. Lrit:
  6698.     call    gdc_nb_
  6699.     mov    al,0feH            ;select the write buffer.
  6700.     out    53H,al
  6701.     out    51H,al            ;zero the counter.
  6702.  
  6703. Lrit0:
  6704.     lodsb
  6705.     out    52H,al
  6706.     loop    Lrit0
  6707.  
  6708.     mov    al,0feH            ;reset the counter to zero.
  6709.     out    53H,al
  6710.     out    51H,al
  6711.  
  6712.     call    a_gbmsk_
  6713.     mov    al,4aH            ;set the GDC mask to enable:
  6714.     out    57H,al
  6715.     mov    al,0FFH
  6716.     out    56H,al
  6717.     out    56H,al
  6718.  
  6719.         mov    al,4cH            ;assert the figs command.
  6720.         out    57H,al
  6721.         mov    al,02H            ;direction is to the right.
  6722.         out    56H,al
  6723.     mov    ax,WORD PTR nmritl_    ;number of words to write.
  6724.         out    56H,al
  6725.     mov    al,ah
  6726.         out    56H,al
  6727.  
  6728.     mov    al,22H            ;start the write operation now.
  6729.     out    57H,al
  6730.     mov    al,0ffH
  6731.     out    56H,al
  6732.     out    56H,al
  6733.  
  6734.     ret
  6735. Lwrite  ENDP
  6736.  
  6737.     PROCDEF wr_cell_
  6738.     push    si
  6739.     push    di
  6740.     push    bp
  6741.     mov    bp,sp
  6742.     sub    sp,6            ; -2[bp] alups reg.
  6743.                     ; -4[bp] number of rows.
  6744.                     ; -6[bp] number of bytes per row.
  6745.  
  6746.     mov    ax,cs:eseg_sav        ;just in case!
  6747.     mov    es,ax
  6748.     cld                         ;make the coming stosb instruction
  6749.                     ;increment di.
  6750.     mov    al,alups_        ;save old alups on the stack.
  6751.     mov    WORD PTR -2[bp],ax
  6752.  
  6753.     mov    si,WORD PTR 8[bp]    ;get structure pointer.
  6754.     mov    ax,ymax_        ;convert 'y' co-ord to top left origin.
  6755.     sub    ax,WORD PTR 2[si]
  6756.     mov    y_start_,ax
  6757.     mov    ax,WORD PTR [si]    ;set up the starting 'x' co-ordinate.
  6758.     mov    bx,ax
  6759.     and    ax,0fff0H        ;make 'x' a word address.
  6760.     mov    x_start_,ax
  6761.  
  6762.     mov    dx,WORD PTR 4[si]
  6763.     sub    dx,WORD PTR [si]    ;number of pixels to write.
  6764.     inc    dx
  6765.     mov    ax,bx
  6766.     and    bx,000fH
  6767.     add    bx,dx
  6768.     push    dx
  6769.     mov    cl,03H
  6770.     test    bx,0007H
  6771.     jz    Lw1
  6772.     add    bx,0008H
  6773. Lw1:    shr    bx,cl
  6774.     test    bx,0001H
  6775.     jz    Lw1a
  6776.     inc    bx
  6777. Lw1a:
  6778.     mov    ch,al
  6779.     xor    dl,dl
  6780.     test    ch,08H
  6781.     jz    Lw2
  6782.     inc    dl
  6783. Lw2:    and    ch,07H
  6784.  
  6785.     pop    di
  6786.     add    ax,di
  6787.     dec    ax
  6788.     mov    dh,al
  6789.     test    ax,08H
  6790.     jnz    Lw3
  6791.     or    dl,02H
  6792. Lw3:    and    dh,07H
  6793.     inc    dh
  6794.     mov    cl,08H
  6795.     sub    cl,ch
  6796.     xchg    cl,ch
  6797.  
  6798.         add     si,0008H        ;SI register points to the stucture.
  6799.     push    cx
  6800.     mov    cx,WORD PTR [si]    ;get plane # and adjust alups to only
  6801.     mov    al,01H            ; write to this one.
  6802.     shl    al,cl
  6803.     xor    al,0fH
  6804.     mov    alups_,al
  6805.     mov    fgbg_,0FH        ;enable foreground writes.
  6806.     call    gdc_nb_
  6807.     call    a_fgbg_
  6808.     call    a_alups_
  6809.     pop    cx
  6810.  
  6811.     mov    ax,WORD PTR 2[si]    ;number of rows.
  6812.     mov    WORD PTR -4[bp],ax
  6813.     mov    ax,WORD PTR 4[si]    ;bytes per row.
  6814.     mov    WORD PTR -6[bp],ax
  6815.     mov    si,WORD PTR 8[si]    ;array offset.
  6816. Lw4:    push    si
  6817.     lea    di,gp_buff_    ;gp_buff will hold the word aligned bit pattern
  6818.     test    dl,1
  6819.     jz    Lw4a
  6820.     inc    di
  6821. Lw4a:    push    ds
  6822.     push    bx
  6823.     mov    bx,WORD PTR 8[bp]
  6824.     mov    ax,WORD PTR 14[bx]
  6825.     mov    ds,ax
  6826.     pop    bx
  6827.     push    bx
  6828. Lw5:                ;loop to bit align 'array' on a word boundary
  6829.     lodsb            ;at gp_buff_.
  6830.     ror    ax,cl
  6831.     stosb
  6832.     xchg    cl,ch
  6833.     ror    ax,cl
  6834.     xchg    cl,ch
  6835.     dec    bx
  6836.     jnz    Lw5
  6837.     pop    bx
  6838.     pop    ds
  6839.  
  6840.     push    bx
  6841.     push    cx
  6842.     call    Lwrite        ;WRITE one line.
  6843.     pop    cx
  6844.     pop    bx
  6845.     pop    si
  6846.     add    si,WORD PTR -6[bp]
  6847.  
  6848.     dec    WORD PTR -4[bp]
  6849.     jz    Lw6
  6850.     dec    y_start_
  6851.     jmp    Lw4
  6852. Lw6:
  6853.     mov    ax,WORD PTR -2[bp]
  6854.     mov    alups_,al
  6855.     call    gdc_nb_
  6856.     call    a_alups_
  6857.  
  6858.     mov    sp,bp
  6859.     pop    bp
  6860.     pop    di
  6861.     pop    si
  6862.         ret
  6863.     PROCEND wr_cell_
  6864. include epilogue.h
  6865.     END
  6866. +ARCHIVE+ scroll.asm   11780 10/01/1983  1:12:28
  6867. PAGE ,132
  6868. ;SCROLL.ASM
  6869. ; UPDATE HISTORY
  6870. ; ==============
  6871. ; 29-sep-84    add 100a support                    [1]
  6872. ; 15 nov 1984   Convert to CI86 V2.2
  6873.  
  6874.     include asmc.h
  6875.  
  6876.     SEGEND    CODE
  6877.  
  6878.     SEGDEF    DATA
  6879.  
  6880. EXTRN    gintvect_:WORD, old_int_off:WORD, old_int_seg:WORD, int_done:BYTE ;[1]
  6881. EXTRN    scrltb_:BYTE, gbmod_:BYTE, g_strtx_:WORD, scr_top_:BYTE, scr_bot_:BYTE
  6882.  
  6883.     SEGEND    DATA
  6884.  
  6885.     SEGDEF    CODE
  6886.  
  6887. PUBLIC     init_scrol_, a_scrmap_, hscroll_, vscroll_
  6888.  
  6889.     IF    @bigmodel
  6890. EXTRN    gdc_nb_:FAR, a_mode_:FAR, fifo_mt_:FAR, dseg_sav:NEAR, eseg_sav:NEAR
  6891.     ELSE
  6892. EXTRN    gdc_nb_:NEAR, a_mode_:NEAR, fifo_mt_:NEAR, dseg_sav:NEAR, eseg_sav:NEAR
  6893.     ENDIF
  6894.  
  6895.  
  6896. ;********************************************************************
  6897. ;*                                                                  *
  6898. ;*      f u n c t i o n s     init_scrol_(),  a_scrmap_()             *
  6899. ;*                                                                  *
  6900. ;*      purpose:        initialize the scroll map                   *
  6901. ;*                      assert scroll map as defined in scrltb      *
  6902. ;*                                                                  *
  6903. ;********************************************************************
  6904.  
  6905.  
  6906.     PROCDEF    init_scrol_
  6907.         push    di
  6908.         push    cx
  6909.  
  6910.         mov     ax,cs:WORD PTR eseg_sav
  6911.         mov     es,ax
  6912.         cld
  6913.         mov     cx,256          ;initialize all 256 locations of the 
  6914.         xor    al,al           ;shadow area to desired values
  6915.         lea     di,  scrltb_
  6916. L0:     stosb
  6917.         inc    al
  6918.         loop    L0
  6919.         pop     cx
  6920.         pop     di
  6921.                 ;**FALLS THRU**
  6922.     PROCDEF    a_scrmap_
  6923.         push    bx
  6924.         push    es
  6925.         xor     ax,ax
  6926.         mov     es,ax
  6927.         mov     bx,WORD PTR gintvect_    ;INTVECT        [1]
  6928.         cli                             ;temp disable interrupts
  6929.         mov     ax,es:[bx]              ;read the old offset 
  6930.         mov     WORD PTR old_int_off,ax
  6931.         mov     ax,es:2[bx]          ;read the old segment
  6932.         mov     WORD PTR old_int_seg,ax
  6933.         mov     es:WORD PTR [bx],OFFSET scrol_int_     ;load new offset
  6934.         mov     ax,cs
  6935.         mov     es:2[bx], ax         ;load new interrupt segment
  6936.         sti                             ;re-enable interrupts
  6937.         pop     es
  6938.         mov     BYTE PTR int_done,0              ;clear interrupt flag
  6939.         or      BYTE PTR gbmod_,40H              ;enable graphics interrupt
  6940.         call    gdc_nb_
  6941.         call    a_mode_
  6942. L1:     test    BYTE PTR int_done,0FFH           ;has interrupt routine run?
  6943.         jz      L1
  6944.         push    es                      ;restore the interrupt vectors
  6945.         xor     ax,ax
  6946.         mov     es,ax
  6947.         mov     bx,WORD PTR gintvect_   ;fetch graphics vector offset    [1]
  6948.         cli
  6949.         mov     ax,WORD PTR old_int_off ;restore old interrupt vector
  6950.         mov     es:[bx],ax
  6951.         mov     ax,WORD PTR old_int_seg 
  6952.         mov     es:2[bx], ax
  6953.         sti
  6954.         pop     es
  6955.         pop     bx
  6956.         ret
  6957.     PROCEND    a_scrmap_
  6958.     PROCEND    init_scrol_
  6959. ;
  6960. ;Scrollmap loading during interrupt routine.
  6961. ;Fetch the current mode BYTE and enable scroll map addressing.
  6962. ;
  6963. scrol_int_ PROC    FAR
  6964.         push    es
  6965.         push    ds
  6966.         push    si
  6967.         push    dx
  6968.         push    cx
  6969.         push    ax
  6970.         cld
  6971.         mov     ax,cs:WORD PTR dseg_sav ;can't depend on ds or es
  6972.         mov     ds,ax                   ;reload them
  6973.         mov     ax,cs:WORD PTR eseg_sav
  6974.         mov     es,ax
  6975.         and     BYTE PTR gbmod_,0BFH             ;disable graphics interupts
  6976.         mov    al,BYTE PTR gbmod_               ;prepare to access scroll map 
  6977.         push    ax                      ;first save current gbmod
  6978.         and    BYTE PTR gbmod_,0DFH     ;enable writing to scroll map
  6979.         call    a_mode_                 ;do it
  6980.         mov    al,7FH          ;select scroll map and reset scroll
  6981.         out    53H,al                  ;map address counter
  6982.         mov    dl,51H          ;output port destination.
  6983.         xor    dh,dh
  6984.         lea     si,  scrltb_              ;first line's highDB address=0
  6985.         mov     cx,16                   ;256 lines to write to
  6986.         test    BYTE PTR gbmod_,1                ;high resolution?
  6987.         jnz     L2                      ;jump if yes 
  6988.         shr     cx,1            ;only 128 lines if medium resolution
  6989. L2:     lodsw                           ;fetch two scrollmap locations
  6990.         out    dx,al                   ;assert the evenDB
  6991.         mov    al,ah
  6992.         out    dx,al                   ;assert the oddDB
  6993.         lodsw                           ;fetch two scrollmap locations
  6994.         out    dx,al                   ;assert the evenDB
  6995.         mov    al,ah
  6996.         out    dx,al                   ;assert the oddDB
  6997.         lodsw                           ;fetch two scrollmap locations
  6998.         out    dx,al                   ;assert the evenDB
  6999.         mov    al,ah
  7000.         out    dx,al                   ;assert the oddDB
  7001.         lodsw                           ;fetch two scrollmap locations
  7002.         out    dx,al                   ;assert the evenDB
  7003.         mov    al,ah
  7004.         out    dx,al                   ;assert the oddDB
  7005.         lodsw                           ;fetch two scrollmap locations
  7006.         out    dx,al                   ;assert the evenDB
  7007.         mov    al,ah
  7008.         out    dx,al                   ;assert the oddDB
  7009.         lodsw                           ;fetch two scrollmap locations
  7010.         out    dx,al                   ;assert the evenDB
  7011.         mov    al,ah
  7012.         out    dx,al                   ;assert the oddDB
  7013.         lodsw                           ;fetch two scrollmap locations
  7014.         out    dx,al                   ;assert the evenDB
  7015.         mov    al,ah
  7016.         out    dx,al                   ;assert the oddDB
  7017.         lodsw                           ;fetch two scrollmap locations
  7018.         out    dx,al                   ;assert the evenDB
  7019.         mov    al,ah
  7020.         out    dx,al                   ;assert the oddDB
  7021.         loop    L2
  7022.         pop     ax                      ;restore previous mode register 
  7023.         mov    BYTE PTR gbmod_,al
  7024.         call    a_mode_
  7025.         mov    BYTE PTR int_done,0FFH           ;set interrupt-done flag
  7026.  
  7027.         pop     ax
  7028.         pop     cx
  7029.         pop     dx
  7030.         pop     si
  7031.         pop     ds
  7032.         pop     es
  7033.         iret                            ;return from interrupt
  7034. scrol_int_ ENDP
  7035.  
  7036. ;******************************************************************************
  7037. ;                                                                             *
  7038. ;               f u n c t i o n    hscroll_(direction, count)                 *
  7039. ;                                                                             *
  7040. ;       move the current entire screen to right or left a WORD address.       *
  7041. ;                                                                             *
  7042. ;       entry:  4[bp] = direction [0 = left, anything else = right]           *
  7043. ;               6[bp] = count inDWs [16 pixels]                               *
  7044. ;       exit:   g_strtx updated to new start position WORD boundary           *
  7045. ;                                                                             *
  7046. ;******************************************************************************
  7047.  
  7048.     PROCDEF    hscroll_
  7049.         push    bp
  7050.         mov     bp, sp
  7051.  
  7052.         mov     bx,6[bp]                 ;get count
  7053. L3:     mov     ax,4[bp]                 ;get direction
  7054.         or    al,al                    ;move screen to left?
  7055.         jnz     L4                       ;jump if not.
  7056.         add     WORD PTR g_strtx_,100H     ;move screen to right.
  7057.         jmp     L5
  7058. L4:     sub     WORD PTR g_strtx_,100H     ;move screen to left.
  7059. L5:     test    BYTE PTR gbmod_,1                ;high res?
  7060.         jnz     L6                       ;jump if yes.
  7061.         and     WORD PTR g_strtx_,1F00H  ;limit rotate to first mid res scan.
  7062.         jmp     L7
  7063. L6:     and     WORD PTR g_strtx_,3F00H  ;limit rotate to first high res scan.
  7064. L7:     call    fifo_mt_                 ;wait for gdc to finish last command
  7065.         mov    al,70H                   ;issue the gdc parameter command.
  7066.         out    57H, al
  7067.         mov     ax,WORD PTR g_strtx_     ;fetch lowDB of starting address.
  7068.         out    56H, al
  7069.         mov     al,ah
  7070.         out    56H, al
  7071.         dec     bx
  7072.         jnz     L3
  7073.         
  7074.         pop     bp
  7075.         ret
  7076.     PROCEND    hscroll_
  7077.  
  7078. ;******************************************************************************
  7079. ;*                                                                            *
  7080. ;*              f u n c t i o n    vscroll_(direction, count)                 *
  7081. ;*                                                                            *
  7082. ;*      entry:    8[bp] direction  0 = DOWN  anything else = UP               *
  7083. ;*               10[bp] number of times to scroll the region                  *
  7084. ;*                                                                            *
  7085. ;******************************************************************************
  7086. ;*****************************************
  7087. ;si = scrltb   cx = no. of lines to scroll
  7088. ;*****************************************
  7089. ;UP SCROLL
  7090. L20    PROC    NEAR
  7091.         cld                     ;make sure we inc si & di
  7092.         mov     al,BYTE PTR scr_top_
  7093.         xor     ah,ah
  7094.         test    BYTE PTR gbmod_, 1       ;Hi res ?
  7095.         jnz     L21             ;jump if YES
  7096.         shr     ax, 1           ;medium res scrolls 2 lines at a time
  7097.         shr     cx, 1
  7098. L21:    add     si,ax           ;point to first line to scroll
  7099.         mov     al,BYTE PTR [si]         ;get first line
  7100.         push    ax              ;and save it
  7101.         mov     di,si
  7102.         inc     si
  7103.         rep     movsb           ;move all lines up 1
  7104.         pop     ax
  7105.         stosb                   ;put first line at end of scroll region
  7106.         ret
  7107. L20    ENDP
  7108.  
  7109. ;DOWN SCROLL
  7110. L30    PROC    NEAR
  7111.         std                     ;make sure we dec si & di
  7112.         mov     al,BYTE PTR scr_bot_
  7113.         xor     ah,ah
  7114.         test    BYTE PTR gbmod_, 1       ;Hi res ?
  7115.         jnz     L31             ;jump if YES
  7116.         shr     ax, 1           ;medium res scrolls 2 lines at a time
  7117.         shr     cx, 1
  7118. L31:    add     si,ax           ;point to last line to scroll
  7119.         mov     al,BYTE PTR [si]         ;get last line
  7120.         push    ax              ;and save it
  7121.         mov     di,si
  7122.         dec     si
  7123.         rep     movsb           ;move all lines down 1
  7124.         pop     ax
  7125.         stosb                   ;put last line at top of scroll region
  7126.         ret
  7127. L30    ENDP
  7128.  
  7129.     PROCDEF    vscroll_
  7130.         push    si
  7131.         push    di
  7132.         push    bp
  7133.         mov     bp,sp
  7134.  
  7135.         mov     ax,cs:WORD PTR eseg_sav
  7136.         mov     es,ax
  7137.         mov     dx,10[bp]    ;get # of times to scroll
  7138.         mov     cl,BYTE PTR scr_bot_    ;get bottom line # of scroll region
  7139.         mov     al,BYTE PTR  scr_top_    ;get top line # of scroll region
  7140.         sub     cl,al           ;cx = # of lines to scroll
  7141.         xor     ch,ch
  7142. L8:     push    cx
  7143.         lea     si,  scrltb_      ;setup the source of the data.
  7144.         mov     ax,8[bp]     ;which direction? 0 = DOWN, else UP
  7145.         or      ax, ax
  7146.         jz      L9
  7147.         call    L20             ;do an UP scroll
  7148.         jmp     L10
  7149. L9:     call    L30
  7150. L10:    call    a_scrmap_       ;assert new scrolltable to scrollmap.
  7151.         pop     cx
  7152.         dec     dx
  7153.         jnz     L8
  7154.  
  7155.         cld                     ;inc si & di -- for safety only
  7156.         mov     sp, bp
  7157.         pop     bp
  7158.         pop     di
  7159.         pop     si
  7160.         ret
  7161.     PROCEND    vscroll_
  7162.  
  7163.     include    epilogue.h
  7164.     END
  7165. +ARCHIVE+ vect.asm     12814 10/01/1983  0:58:02
  7166. PAGE ,132
  7167. ;VECT.ASM
  7168. ;UPDATE HISTORY
  7169. ;==============
  7170. ; 15 nov 1984       Convert to CI86 V2.2
  7171.  
  7172.     include    asmc.h
  7173.     SEGEND    CODE
  7174.     SEGDEF    DATA
  7175.  
  7176. EXTRN    l_col_:BYTE, gbmod_:BYTE, ymax_:WORD
  7177. EXTRN    x_start_:WORD, y_start_:WORD, p1_:BYTE, gp_buff_:BYTE
  7178.  
  7179. Lx_st   DW      1
  7180. Ly_st   DW      1
  7181. Lx_sp   DW      1
  7182. Ly_sp   DW      1
  7183. Lflag   DB      1
  7184.  
  7185.     SEGEND    DATA
  7186.  
  7187.     SEGDEF    CODE
  7188.  
  7189. PUBLIC     polyline_, line_, point_, rectangle_
  7190.  
  7191.     IF    @bigmodel
  7192. EXTRN    gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, cxy2cp_:FAR
  7193. EXTRN    a_patrn_:FAR, fifo_mt_:FAR, eseg_sav:NEAR
  7194.     ELSE
  7195. EXTRN    gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, cxy2cp_:NEAR
  7196. EXTRN    a_patrn_:NEAR, fifo_mt_:NEAR, eseg_sav:NEAR
  7197.     ENDIF
  7198.  
  7199. ;******************************************************************************
  7200. ;*                                                                            *
  7201. ;*      F U N C T I O N     polyline_(pnts, array)                            *
  7202. ;*                          int pnts, *array;                                 *
  7203. ;*                                                                            *
  7204. ;*      purpose:        Draw a line joining the points defined in 'array'     *
  7205. ;*                                                                            *
  7206. ;*      entry:            4[bp] number of points to join                      *
  7207. ;*                        6[bp] array containing 'xy' points                  *
  7208. ;*                                                                            *
  7209. ;******************************************************************************
  7210.  
  7211.  
  7212.     PROCDEF    polyline_
  7213.         push    bp
  7214.         mov     bp,sp
  7215.  
  7216.         call    gdc_nb_
  7217.         call    a_patrn_        ;set up pat_reg & pat_mult for current line
  7218.                                 ;type as held in l_type.
  7219.  
  7220.         mov     al,BYTE PTR l_col_       ;check for correct colour.
  7221.         call    chk_col_
  7222.  
  7223.         test    BYTE PTR gbmod_,2
  7224.         jnz     L11             ;skip if already in vector mode.
  7225.         or      BYTE PTR gbmod_,12H      ;enable vector mode and writes.
  7226.         call    a_mode_
  7227. L11:    mov    al,78H
  7228.         out    57H,al          ;set pramDBs 8 and 9
  7229.         mov    al,0FFH
  7230.         out    56H,al
  7231.         out    56H,al
  7232.  
  7233. L0:     mov     cx,4[bp]      ;get count - 1.
  7234.         dec     cx
  7235.         js      L2
  7236.         mov     ax,6[bp]      ;get pointer to array
  7237.  
  7238. L1:     push    cx              ;we don't want it corupted
  7239.         push    ax              ;send array pointer to line_
  7240.         call    line_
  7241.         pop     ax              ;retrieve variables
  7242.         pop     cx
  7243.         add     ax,4    ;point to last point plotted
  7244.         loop    L1              ;keep going until array is exhausted
  7245.  
  7246. L2:     pop     bp
  7247.         ret
  7248.     PROCEND    polyline_
  7249.  
  7250. ;******************************************************************************
  7251. ;                                                                             *
  7252. ;        F U N C T I O N    line_(array)    int *array;                       *
  7253. ;                                                                             *
  7254. ;        purpose:        Draw a vector                                        *
  7255. ;                                                                             *
  7256. ;        entry:          8[bp] points to xy array layed out as:               *
  7257. ;                                                                             *
  7258. ;                        Lx_st = starting x location                          *
  7259. ;                        Ly_st = starting y location                          *
  7260. ;                        Lx_sp= ending x location                             *
  7261. ;                        Ly_sp= ending y location                             *
  7262. ;                                                                             *
  7263. ;******************************************************************************
  7264.  
  7265.     PROCDEF    line_
  7266.         push    di
  7267.         push    si
  7268.         push    bp
  7269.         mov     bp,sp
  7270.  
  7271.         mov     ax,cs:WORD PTR eseg_sav  ;reclaim ES just in case !!!!!
  7272.         mov     es,ax
  7273.         mov     si,8[bp]      ;get the array pointer
  7274.         lea     di, Lx_st
  7275.         cld
  7276.         mov     cx,4
  7277.         rep     movsw           ;move to the local variable area.
  7278.  
  7279. ;Convert the starting x,y coordinate pair into a cursor positionDW value.
  7280.  
  7281.         mov     ax,WORD PTR ymax_  ;convert 'y' values from bottom left origin
  7282.         sub     ax,Ly_sp        ;to top left origin.
  7283.         mov     Ly_sp,ax
  7284.  
  7285.         mov     ax,WORD PTR ymax_
  7286.         sub     ax,Ly_st        ;upper 16 bits
  7287.         mov     Ly_st,ax
  7288.  
  7289.         mov     ax,Lx_st       ;is this a single point draw?
  7290.         cmp     Lx_sp,ax      ;if yes then start=stop coordinates.
  7291.         jnz     L12                     ;jump if definitely not.
  7292.         mov     ax,Ly_st       ;maybe. check y coordinates.
  7293.         cmp     Ly_sp,ax
  7294.         jnz     L12                     ;jump if definitely not.
  7295.         jmp     L14
  7296.  
  7297. L12:    mov     ax,Lx_st
  7298.         mov     WORD PTR x_start_,ax
  7299.         mov     ax,Ly_st
  7300.         mov     WORD PTR y_start_,ax
  7301.         call    cxy2cp_
  7302.  
  7303.         mov     bx,Ly_sp        ;compute delta y
  7304.         sub     bx,Ly_st        ;delta y negative now?
  7305.         jns     Lquad34         ;jump if not [must be either quad 3 or 4]
  7306. Lquad12:
  7307.         neg     bx              ;delta y is negative, make absolute
  7308.         mov     ax,Lx_sp        ;compute delta x
  7309.         sub     ax,Lx_st        ;delta x negative?
  7310.         js      Lquad2          ;jump if yes
  7311. Lquad1:
  7312.         cmp     ax,bx           ;octant 2?
  7313.         jbe     Loct3           ;jump if not
  7314. Loct2:  mov    BYTE PTR p1_,2           ;direction of write
  7315.         jmp     Lvxind   ;abs[deltax]>abs[deltay], independent axis=x-axis
  7316. Loct3:  mov    BYTE PTR p1_,3           ;direction of write
  7317.         jmp     Lvyind   ;abs[deltax]=<abs[deltay], independent axis=y-axis
  7318. Lquad2:
  7319.         neg     ax              ;delta x is negative, make absolute
  7320.         cmp     ax,bx           ;octant 4?
  7321.         jae     Loct5           ;jump if not
  7322. Loct4:  mov    BYTE PTR p1_,4           ;direction of write
  7323.         jmp     Lvyind   ;abs[deltax]=<abs[deltay], independent axis=y-axis
  7324. Loct5:  mov    BYTE PTR p1_,5           ;direction of write
  7325.         jmp     Lvxind   ;abs[deltax]>abs[deltay], independent axis=x-axis
  7326. Lquad34:
  7327.         mov     ax,Lx_sp        ;compute delta x
  7328.         sub     ax,Lx_st
  7329.         jns     Lquad4          ;jump if delta x is positive
  7330. Lquad3:
  7331.         neg     ax              ;make delta x absolute instead of negative
  7332.         cmp     ax,bx           ;octant 6?
  7333.         jbe     Loct7           ;jump if not
  7334. Loct6:  mov    BYTE PTR p1_,6           ;direction of write
  7335.         jmp     Lvxind   ;abs[deltax]>abs[deltay], independent axis=x-axis
  7336. Loct7:  mov    BYTE PTR p1_,7           ;direction of write
  7337.         jmp     Lvyind   ;abs[deltax]<=abs[deltay], independent axis=y-axis
  7338. Lquad4:
  7339.         cmp     ax,bx           ;octant 0?
  7340.         jae     Loct1           ;jump if not
  7341. Loct0:  mov    BYTE PTR p1_,0           ;direction of write
  7342.         jmp     Lvyind   ;abs[deltax]<abs[deltay], independent axis=y-axis
  7343. Loct1:  mov    BYTE PTR p1_,1           ;direction of write
  7344.         jmp     Lvxind   ;abs[deltax]=>[deltay], independent axis=x-axis
  7345.  
  7346. Lvyind: xchg    ax,bx           ;put independent axis in ax, dependent in bx
  7347. Lvxind: and     ax,03FFFH       ;limit to 14 bits
  7348.         mov     dx,bx
  7349.         mov     WORD PTR p1_+1,ax        ;DC=abs[delta x]-1
  7350.         shl     bx,1            ;multiply delta y by two
  7351.         sub     bx,ax
  7352.         and     bx,03FFFH       ;limit to 14 bits
  7353.         mov     WORD PTR p1_+3,bx        ;D=2*abs[delta y]-abs[delta x]
  7354.         mov     bx,dx           ;restore [abs[delta y]
  7355.         sub     bx,ax
  7356.         shl     bx,1
  7357.         and     bx,03FFFH       ;limit to 14 bits
  7358.         mov     WORD PTR p1_+5,bx        ;D2=2*[abs[delta y]-abs[delta x]]
  7359.         mov     bx,dx
  7360.         shl     bx,1
  7361.         dec     bx
  7362.         and     bx,03FFFH       ;limit to 14 bits
  7363.         mov     WORD PTR p1_+7,bx        ;D1=2*abs[delta y]-1
  7364.         call    fifo_mt_        ;check the FIFO just in case we're too quick.
  7365.         mov    al,4CH  ;issue the FIGS command
  7366.         out    57H,al
  7367.         lea     si,  p1_
  7368.         lodsb                   ;send p1_ parameter.
  7369.         or      al,8
  7370.         out    56H,al          ;issue a parameterDB
  7371.         mov     cx,8            ;issue the 8DBs of DC,D,D2,D1
  7372. L13:    lodsb                   ;fetchDB
  7373.         out    56H,al          ;issue to the GDC
  7374.         loop    L13             ;loop until all 8 done
  7375.         mov    al,6CH  ;start the drawing process in motion
  7376.         out    57H,al          ;by issuing FIGD
  7377.  
  7378. L14:    pop     bp
  7379.         pop     si
  7380.         pop     di
  7381.         ret
  7382.     PROCEND    line_
  7383.  
  7384. ;*****************************************************************************
  7385. ;*                                                                           *
  7386. ;*      F U N C T I O N    point_(x, y)                                       *
  7387. ;*                                                                           *
  7388. ;*      purpose:        Draw a pixel                                         *
  7389. ;*                                                                           *
  7390. ;*      entry:          4[bp] x location                                     *
  7391. ;*                      6[bp] y location                                     *
  7392. ;*                                                                           *
  7393. ;*****************************************************************************
  7394.  
  7395.     PROCDEF    point_
  7396.         push    bp
  7397.         mov     bp,sp
  7398.  
  7399.         call    gdc_nb_
  7400.         mov     al,BYTE PTR l_col_       ;check that colour is OK
  7401.         call    chk_col_
  7402.  
  7403.         test    BYTE PTR gbmod_,2
  7404.         jnz     Lp0
  7405.         or      BYTE PTR gbmod_,12H
  7406.         call    a_mode_
  7407. Lp0:    mov     ax,4[bp]
  7408.         mov     WORD PTR x_start_,ax
  7409.         mov     ax,WORD PTR ymax_
  7410.         sub     ax,6[bp]
  7411.         mov     WORD PTR y_start_,ax
  7412.         call    cxy2cp_         ;convert 'xy' to cursor pos. & send to GDC.
  7413.  
  7414.         mov    al,4CH        ;assert the FIGS command
  7415.         out    57H,al
  7416.         mov    al,2            ;line drawn to the right.
  7417.         out    56H,al
  7418.         mov    al,6CH        ;tell the GDC to draw the pixel when ready.
  7419.         out    57H,al
  7420.  
  7421.         pop     bp
  7422.         ret
  7423.     PROCEND    point_
  7424.  
  7425. ;************************************************************************
  7426. ;*                                                                      *
  7427. ;*              F U N C T I O N    rectangle_(array)  int *array;        *
  7428. ;*                                                                      *
  7429. ;*  purpose:    draw a rectangle by defining the top right and          *
  7430. ;*              bottom left points.                                     *
  7431. ;*  entry:      6[bp] has the pointer to the 'xy' array                 *
  7432. ;*                                                                      *
  7433. ;*              0[array] bottom left 'x'                                *
  7434. ;*              2[array] bottom left 'y'                                *
  7435. ;*              4[array] top right 'x'                                  *
  7436. ;*              6[array] top right 'y'                                  *
  7437. ;*                                                                      *
  7438. ;*      NOTE:   both 'y' values are relative to a bottom left origin    *
  7439. ;*                                                                      *
  7440. ;************************************************************************
  7441.  
  7442.     PROCDEF    rectangle_
  7443.         push    si
  7444.         push    bp
  7445.         mov     bp,sp
  7446.  
  7447.         mov     si,6[bp]        ;point SI to the source array.
  7448.         lea     bx, gp_buff_      ;point BX to gen. purpose buffer area.
  7449.         lodsw                   ;get X1
  7450.         mov     [bx],ax             ;bot_lft 'x'
  7451.         mov     12[bx],ax           ;top_lft 'x'
  7452.         mov     16[bx],ax           ;bot_lft 'x'
  7453.         lodsw                   ;get Y1
  7454.         mov     2[bx],ax            ;bot_lft 'y'
  7455.         mov     6[bx],ax            ;bot_rgt 'y'
  7456.         mov     18[bx],ax           ;bot_lft 'y'
  7457.         lodsw                   ;get X2
  7458.         mov     4[bx],ax            ;bot_rgt 'x'
  7459.         mov     8[bx],ax            ;top_rgt 'x'
  7460.         lodsw                   ;get Y2
  7461.         mov     10[bx],ax           ;top_rgt 'y'
  7462.         mov     14[bx],ax           ;top_lft 'y'
  7463.  
  7464.         push    bx
  7465.         mov     ax,5
  7466.         push    ax
  7467.         call    polyline_
  7468.         add     sp,4
  7469.  
  7470.         pop     bp
  7471.         pop     si
  7472.         ret
  7473.     PROCEND    rectangle_
  7474.  
  7475.     include    epilogue.h
  7476.     END
  7477.