home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / DRI-archive / roche / NCRGRAF.ASM < prev    next >
Assembly Source File  |  2009-12-11  |  61KB  |  3,019 lines

  1. ; NCRGRAF.ASM
  2. ; -----------
  3. ;
  4. ; NCR Decision Mate V - NCRGRAF.REL
  5. ;
  6. ; Disassembled by:
  7. ;
  8. ; ROCHE Emmanuel
  9. ; 8 rue HERLUISON
  10. ; 10000 TROYES
  11. ; FRANCE
  12. ; ------
  13. ;
  14. ;--------------------------------
  15. ;
  16. ; Summary of graphics routines
  17. ; ----------------------------
  18. ;
  19. ; NAME    BASIC FORMAT    PARAMETERS    DESCRIPTION
  20. ; ----    ------------    ----------    -----------
  21. ;
  22. ; GARC    GARC (R,S,E)    R = 1:255    Arc with radius R,
  23. ;            S = -360:360    starting angle S,
  24. ;            E = -360:360    and ending angle E.
  25. ;
  26. ; GBOX    GBOX (H,V,D)    H = 1:640    Filled rectangle with
  27. ;            V = 1:640    sides of length H and V,
  28. ;            D = 0:7        drawn in direction D.
  29. ;
  30. ; GCIRCL  GCIRCL (R)    R = 1:255    Circle with radius R.
  31. ;
  32. ; GCLEAR  GCLEAR            Erase screen.
  33. ;
  34. ; GEXIT   GEXIT                Leave graphics mode.
  35. ;
  36. ; GINIT   GINIT                Initialize graphics mode.
  37. ;
  38. ; GLINE   GLINE (X,Y)    X = 0:639    Line from cursor to (X,Y).
  39. ;            Y = 0:399
  40. ;
  41. ; GMODE   GMODE (M)    M = 0:3        Drawing mode.
  42. ;
  43. ; GPATT   GPATT (P)    P = 0:15    Pattern to fill box or line.
  44. ;
  45. ; GPOINT  GPOINT (X,Y)    X = 0:639    Set cursor at (X,Y).
  46. ;            Y = 0:399
  47. ;
  48. ; GPRINT  GPRINT (P,L)    P = 0,1,2,4,5    Output screen image to printer P
  49. ;            L = 0:99    with linefeed L.
  50. ;
  51. ; GRECT  GRECT (H,V,D)  H = 2:640    Rectangle with sides
  52. ;            V = 2:640    of length H and V,
  53. ;            D = 0:7        drawn in direction D.
  54. ;
  55. ; GTEXT  GTEXT (A$,D)    A$ = ASCII string  Draw A$
  56. ;            D  = 0:7           in direction D.
  57. ;
  58. ; GZOOM  GZOOM (Z)    Z = 0:15    Zoom parameter for text and boxes.
  59. ;
  60. ;--------------------------------
  61. ;
  62. ; NCRGRAF and assembler programs
  63. ; ------------------------------
  64. ;
  65. ;    To program graphics on the NCR DECISION MATE V with an
  66. ; assembler program, all graphics routines must be declared as
  67. ; externals in your program. The address of the first parameter
  68. ; for a routine must be in register pair HL; the address of the
  69. ; second parameter must be in register pair DE; and the address
  70. ; of the third parameter must be in register pair BC.
  71. ;
  72. ;    The integer parameters are always stored with 2 bytes,
  73. ; low-order first. The string parameters are stored with 3
  74. ; bytes. The first byte is the length of the string and the
  75. ; second and third bytes contain the address of the actual
  76. ; text.
  77. ;
  78. ;    The program should be assembled with the MACRO-80
  79. ; assembler from MICROSOFT (or any other relocatable assembler)
  80. ; and then linked with NCRGRAF.REL.
  81. ;
  82. ;--------------------------------
  83. ;
  84.     PAGE    0        ; Listing without page breaks
  85. ;
  86. ;--------------------------------
  87. ;
  88.     NAME    'NCR11R'    ; REL module name
  89. ;
  90.     PUBLIC    GSTAT        ; Error status byte
  91.     PUBLIC    GINIT        ; Erase screen and init graphics memory
  92.     PUBLIC    GPOINT        ; Set cursor at (X,Y) on screen
  93.     PUBLIC    GZOOM        ; Select param for text and boxes
  94.     PUBLIC    GCIRCL        ; Draw a circle with radius R
  95.     PUBLIC    GLINE        ; Draw a line from cur pos to (X,Y)
  96.     PUBLIC    GBOX        ; Draw a filled rectangle (H,V,D)
  97.     PUBLIC    GRECT        ; Draw a rectangle (H,V,D)
  98.     PUBLIC    GPATT        ; Select a pattern for a box/line
  99.     PUBLIC    GMODE        ; Select the drawing mode
  100.     PUBLIC    GTEXT        ; Draw a string in a given direction
  101.     PUBLIC    GEXIT        ; Era screen, leaves graph mode and exit
  102.     PUBLIC    GPRINT        ; Outputs screen image to printer
  103.     PUBLIC    GARC        ; Draw an arc with radius, start/end angle
  104.     PUBLIC    GCLEAR        ; Era screen but don't reset some values
  105. ;
  106. ;--------------------------------
  107. ; CP/M-related equates  (used only one time: in GEXIT)
  108. ;
  109. conout    equ    2        ; Console output
  110. ctrlZ    equ    1AH        ; = CLS (CLear Screen)
  111. bdos    equ    0005H        ; Basic Disk Operating System
  112. ;
  113. ;--------------------------------
  114. ; NEC uPD7220 GDC commands  (Cf. "Data Sheet", p.3-8-14)
  115. ;
  116. status    equ    0A0H        ; Status register
  117. FIFO    equ    0A1H        ; FIFO buffer
  118. ;
  119. ; Video control commands:
  120. ;
  121. RESET1    equ     00H        ; 0000 0000
  122. RESET2    equ     01H        ; 0000 0001
  123. RESET3    equ     09H        ; 0000 1001
  124. SYNC    equ     0EH        ; 0000 111 DE  (0EH or 0FH)
  125. VSYNC    equ     6EH        ; 0110 111 M   (6EH or 6FH)
  126. CCHAR    equ     4BH        ; 0100 1011
  127. ;
  128. ; Display control commands:
  129. ;
  130. START    equ     6BH        ; 0110 1011
  131. BCTRL1    equ     0CH        ; 0000 110 DE  (0CH or 0DH)
  132. BCTRL2    equ     05H        ; 0000 0101
  133. ZOOM    equ     46H        ; 0100 0110
  134. CURS    equ     49H        ; 0100 1001
  135. PRAM    equ     70H        ; 0111 SA      (70H to 7FH)
  136. PITCH    equ     47H        ; 0100 0111
  137. ;
  138. ; Drawing control commands:
  139. ;
  140. WDAT    equ     20H        ; 001 TYPE 0 MOD
  141. MASK    equ     4AH        ; 0100 1010
  142. FIGS    equ     4CH        ; 0100 1100
  143. FIGD    equ     6CH        ; 0110 1100
  144. GCHRD    equ     68H        ; 0110 1000
  145. ;
  146. ; Data read commands:
  147. ;
  148. RDAT    equ    0A0H        ; 101 TYPE 0 MOD
  149. CURD    equ    0E0H        ; 1110 0000
  150. LPRD    equ    0C0H        ; 1100 0000
  151. ;
  152. ; DMA control commands:
  153. ;
  154. DMAR    equ    0A4H        ; 101 TYPE 1 MOD
  155. DMAW    equ     24H        ; 001 TYPE 1 MOD
  156. ;
  157. ; DE bits:
  158. ;
  159. DE0    equ    0        ; Display blanked
  160. DE1    equ    1        ; Display enabled
  161. ;
  162. ; M bits:
  163. ;
  164. M0    equ    0        ; Slave Mode
  165. M1    equ    1        ; Master Mode
  166. ;
  167. ; SA bits:  SA means  "Starting Address in Parameter RAM"
  168. ; 1 to 16 (zero-based) bytes to be loaded into the Parameter
  169. ; RAM, starting at the RAM address specified by SA.
  170. ;
  171. ; TYPE bits:
  172. ;
  173. TYPE00    equ    0        ; Word: Low then High Byte
  174. TYPE01    equ    1        ; Invalid
  175. TYPE10    equ    2        ; Low  Byte of the Word only
  176. TYPE11    equ    3        ; High Byte of the Word only
  177. ;
  178. ; MOD bits:
  179. ;
  180. MOD00    equ    0        ; REPLACE with pattern
  181. MOD01    equ    1        ; COMPLEMENT
  182. MOD10    equ    2        ; RESET to zero
  183. MOD11    equ    3        ; SET to one
  184. ;
  185. ;--------------------------------
  186. ; Error status byte
  187. ;
  188. GSTAT:    DB    00H
  189. ;
  190. ;
  191. ;     The routine GINIT sets this status byte to 00H and,
  192. ; when an error occurs, drawing stops and this byte is changed
  193. ; to a number greater than 00H.
  194. ;
  195. ;
  196. ;   Error code     Routine      Description
  197. ;   ----------     -------      -----------
  198. ;
  199. ;      1       GPOINT    The X coordinate is less than 0.
  200. ;     2       GPOINT    The X coordinate is greater than 639.
  201. ;     3       GPOINT    The Y coordinate is less than 0.
  202. ;     4       GPOINT    The Y coordinate is greater than 399.
  203. ;     5       GLINE    The X coordinate is less than 0.
  204. ;     6       GLINE    The X coordinate is greater than 639.
  205. ;     7       GLINE    The Y coordinate is less than 0.
  206. ;     8       GLINE    The Y coordinate is greater than 399.
  207. ;    10       GZOOM    The zomm parameter is out of range.
  208. ;    20       GCIRCL    The radius parameter is out of range.
  209. ;    21       GARC        The radius parameter is out of range.
  210. ;    22       GARC        The starting angle is less than -360.
  211. ;    23       GARC        The starting angle is greater than 360.
  212. ;    24       GARC        The ending angle is less than -360.
  213. ;    25       GARC        The ending angle is greater than 360.
  214. ;    30       GBOX        The direction parameter is out of range.
  215. ;           GRECT
  216. ;    40       GPATT    The pattern parameter is out of range.
  217. ;    50       GMODE    The mode parameter is out of range.
  218. ;    60       GTEXT    The direction parameter is out of range.
  219. ;    70       GPRINT    The printer selector is out of range.
  220. ;    71       GPRINT    The linefeed parameter is out of range.
  221. ;    80       GRECT    The H parameter is less than 2.
  222. ;           GBOX        The H parameter is less than 1.
  223. ;    81       GRECT    The H parameter is greater than 640.
  224. ;           GBOX        The H parameter for a zoomed box is greater than 640.
  225. ;    82       GRECT    The V parameter is less than 2.
  226. ;           GBOX        The V parameter is less than 1.
  227. ;    83       GRECT    The V parameter is greater than 640.
  228. ;           GBOX        The V parameter for a zoomed box is greater than 640.
  229. ;
  230. ; NOTE: If a picture is drawn over the edges of the CRT screen,
  231. ; it will extend over the other parts of the screen and no error
  232. ; status byte is set.
  233. ;
  234. ;--------------------------------
  235. ;
  236. noerr:    LDA    GSTAT
  237.     CPI    00H        ; No error ?
  238.     JNZ    finis        ; Go back to calling routine
  239.     RET
  240. ;
  241. ;--------------------------------
  242. ;
  243. noerH:    MOV    A,H
  244.     CPI    00H        ; No error ?
  245.     JM    noerB
  246.     CMP    D
  247.     JNC    noerC
  248.     DCR    D
  249.     CMP    D
  250.     JZ    noerL
  251.     RET
  252. ;
  253. ;--------------------------------
  254. ;
  255. noerL:    MOV    A,L
  256.     CMP    E
  257.     JNC    noerC
  258.     RET
  259. ;
  260. ;--------------------------------
  261. ;
  262. noerB:    MOV    A,B
  263.     STA    GSTAT
  264.     JMP    noerr
  265. ;
  266. ;--------------------------------
  267. ;
  268. noerC:    MOV    A,C
  269.     STA    GSTAT
  270.     JMP    noerr
  271. ;
  272. ;--------------------------------
  273. ;
  274. errH:    MOV    A,H
  275.     CPI    00H        ; No error ?
  276.     JNZ    errD
  277.     MOV    A,L
  278.     CMP    E
  279.     JNC    errD
  280.     RET
  281. ;
  282. ;--------------------------------
  283. ;
  284. errD:    MOV    A,D
  285.     STA    GSTAT
  286.     JMP    noerr
  287. ;
  288. ;--------------------------------
  289. ;
  290. param1:    DB    00H        ; ZOOM param (no zoom)
  291.     DB    00H        ; CCHAR param (no cursor)
  292.     DB    00H        ; PRAM params: P1
  293.     DB    00H        ; P2
  294.     DB    00H        ; P3
  295.     DB    59H        ; P4
  296.     DB    00H        ; P5
  297.     DB    00H        ; P6
  298.     DB    00H        ; P7
  299.     DB    59H        ; P8
  300.     DB    0FFH        ; P9
  301.     DB    0FFH        ; P10
  302.     DB    0FFH        ; P11
  303.     DB    0FFH        ; P12
  304.     DB    0FFH        ; P13
  305.     DB    0FFH        ; P14
  306.     DB    0FFH        ; P15
  307.     DB    0FFH        ; P16
  308.     DB    00H        ; CURS params: P1
  309. Do0154:    DB    00H        ; P2 
  310.     DB    00H        ; P3
  311.     DB    0FFH        ; MASK params: P1: 0FFFFH
  312.     DB    0FFH        ; P2
  313.     DB    02H        ; FIGS params: P1: 02H: DIR (right)
  314.     DB    0FFH        ; P2: 7FFFH
  315.     DB    7FH        ; P3
  316.     DB    08H        ; P4: 0008H
  317.     DB    00H        ; P5
  318.     DB    08H        ; P6: 0008H
  319.     DB    00H        ; P7
  320.     DB    0FFH        ; P8: 3FFFH
  321.     DB    3FH        ; P9
  322.     DB    0FFH        ; P10: 3FFFH
  323.     DB    3FH        ; P11
  324.     DB    0FFH        ; WDAT params: P1
  325.     DB    0FFH        ; P2
  326. ;
  327. param2:    DB    8FH        ; CHAR param: (display cursor)
  328.     DB    00H        ; ZOOM param: (no zoom)
  329.     DB    00H        ; PRAM params: P1
  330.     DB    00H        ; P2
  331.     DB    00H        ; P3
  332.     DB    19H        ; P4
  333.     DB    00H        ; P5
  334.     DB    00H        ; P6
  335.     DB    00H        ; P7
  336.     DB    19H        ; P8
  337.     DB    0FFH        ; P9
  338.     DB    0FFH        ; P10
  339.     DB    0FFH        ; P11
  340.     DB    0FFH        ; P12
  341.     DB    0FFH        ; P13
  342.     DB    0FFH        ; P14
  343.     DB    0FFH        ; P15
  344.     DB    0FFH        ; P16
  345. ;
  346. ;--------------------------------
  347. ; Transfer parameters from memory to register pair HL.
  348. ;
  349. loadHL:    MOV    E,M        ; HL = M(HL)
  350.     INX    H
  351.     MOV    D,M
  352.     XCHG
  353.     RET
  354. ;
  355. ;--------------------------------
  356. ; Save area for register pairs HL, DE and BC.
  357. ;
  358. saveHL:    DW    0000H        ; BASIC First  parameter
  359. saveDE:    DW    0000H        ; BASIC Second parameter
  360. saveBC:    DW    0000H        ; BASIC Third  parameter
  361. ;
  362. ;--------------------------------
  363. ; Erase the screen and initialize the graphics memory.
  364. ; Sets default values for GPATT (P = 0), GZOOM (Z = 0),
  365. ; GMODE (M = 0) and GSTAT (0).
  366. ; GINIT (or GCLEAR) must be the first graphics statement
  367. ; in a program.
  368. ; If a special terminal function, for example: reverse video,
  369. ; is set before starting graphics, GINIT will reset this.
  370. ;
  371. GINIT:    LXI    H,0000H
  372.     DAD    SP
  373.     SHLD    oldSP
  374.     LXI    SP,stack
  375.     NOP            ; ???
  376.     SUB    A        ; Why not XOR A ??? (complement Carry)
  377.     STA    GSTAT        ; GSTAT = 00H
  378.     STA    valueP        ; P = 00H
  379.     STA    valueZ        ; Z = 00H
  380.     MVI    A,20H        ; (WDAT command with MOD: REPLACE)
  381.     STA    valueM        ; M = 20H (WDAT command...)
  382.     CALL    init        ; CLS and init graphics memory
  383.     JMP    finis        ; Go back to calling routine
  384. ;
  385. ;--------------------------------
  386. ; Erase the screen and initialize the graphics memory
  387. ; WITHOUT resetting the values for GPATT, GZOOM,
  388. ; GMODE and GSTAT.
  389. ;
  390. GCLEAR:    LXI    H,0000H
  391.     DAD    SP
  392.     SHLD    oldSP
  393.     LXI    SP,stack
  394.     CALL    init        ; CLS and init graphics memory
  395.     JMP    finis        ; Go back to calling routine
  396. ;
  397. ;---------------------------------
  398. ; Erase the screen and initialize the graphics memory.
  399. ;
  400. init:    CALL    noerr
  401.     MVI    A,0CH        ; BCTRL1: display blanked
  402.     CALL    outA
  403.     LXI    H,param1    ; String of GDC bytes
  404.     CALL    outzom        ; (no zoom)
  405.     CALL    outCHR        ; (no cursor)
  406.     CALL    outPRM        ; (load Parameter RAM)
  407.     XRA    A
  408.     STA    Do0154        ; ???
  409.  
  410.     MVI    B,03H        ; 4 times init2 (4 banks of RAM ?)
  411. init2:    CALL    outCRS
  412.     CALL    outMSK
  413.     CALL    outFGS
  414.     MVI    A,22H        ; WDAT (type: word, mod: reset to zero)
  415.     CALL    outA
  416.     MVI    C,02H        ; 2 bytes follow
  417.     CALL    outC
  418.     LXI    H,Do0154    ; ???
  419.     MOV    A,M
  420.     ADI    40H        ; ???
  421.     MOV    M,A
  422.     DCX    H
  423.     DCR    B
  424.     JNZ    init2
  425.  
  426.     LDA    valueM        ; Outputs Mode value
  427.     CALL    outA
  428.     CALL    gpat2        ; Outputs Pattern bytes
  429.     LXI    H,valueZ    ; Outputs Zoom value
  430.     CALL    outzom
  431.     MVI    A,0DH        ; BCTRL1: display enabled
  432.     CALL    outA
  433.  
  434.     LXI    H,0001H
  435.     SHLD    startX        ; Position cursor at lower
  436.     SHLD    startY        ;   left corner of screen
  437.     CALL    point2        ; Position cursor at (startX,startY)
  438.     RET
  439. ;
  440. ;--------------------------------
  441. ; Erase the screen, leave the graphics mode
  442. ; and return to the alpha mode.
  443. ; GEXIT should always be used to leave the graphics mode.
  444. ; After GEXIT is called, the next graphics routine must
  445. ; begin with GINIT.
  446. ;
  447. GEXIT:    NOP            ; ???
  448.     LXI    H,0000H
  449.     DAD    SP
  450.     SHLD    oldSP
  451.     LXI    SP,stack
  452.     LXI    H,param2    ; String of GDC bytes
  453.     CALL    outCHR        ; (display cursor)
  454.     CALL    outzom        ; (no zoom)
  455.     CALL    outPRM        ; ???
  456.     MVI    E,ctrlZ        ; = CLS (CLear Screen)
  457.     MVI    C,conout    ; Console output
  458.     CALL    BDOS
  459.     JMP    finis        ; Go back to calling routine
  460. ;
  461. ;--------------------------------
  462. ; Set the cursor at a specific point (X,Y) on the screen.
  463. ; The valid range of values for X is 0:639.
  464. ; The valid range of values for Y is 0:399.
  465. ; The coordinates (0,0) set the cursor at the lower left
  466. ; corner of the screen.
  467. ; GPOINT should be used in conjunction with GCIRCL,
  468. ; GRECT, GBOX, GLINE and GTEXT to define the starting
  469. ; point of these routines.
  470. ; Calling GPOINT sets the cursor at a specific point
  471. ; on the screen, but the point remains invisible.
  472. ; To see the point, call GLINE using the same X and Y
  473. ; coordinates as GPOINT.
  474. ;
  475. GPOINT:    SHLD    saveHL        ; X value
  476.     XCHG
  477.     SHLD    saveDE        ; Y value
  478.     LXI    H,0000H
  479.     DAD    SP
  480.     SHLD    oldSP
  481.     LXI    SP,stack
  482.     CALL    noerr
  483.  
  484.     LHLD    saveHL        ; Load X value
  485.     CALL    loadHL
  486.     LXI    D,0380H        ; 0280H = 640 (check for 0:639)
  487.     LXI    B,0102H        ; 01H = error 1, 02H = error 2
  488.     CALL    noerH
  489.     INX    H
  490.     SHLD    startX        ; X = X + 1  (so 0 = first pixel)
  491.  
  492.     LHLD    saveDE        ; Load Y value
  493.     CALL    loadHL
  494.     LXI    D,0290H        ; 0190H = 400 (check for 0:399)
  495.     LXI    B,0304H        ; 03H = error 3, 04H = error 4
  496.     CALL    noerH
  497.     INX    H
  498.     SHLD    startY        ; Y = Y + 1  (so 0 = first pixel)
  499.  
  500.     CALL    point2        ; Position cursor at (X,Y)
  501.     JMP    finis        ; Go back to calling routine
  502. ;
  503. ;--------------------------------
  504. ; Position cursor at (X,Y) (contained in startX, startY)
  505. ;
  506. point2:    CALL    EADdAD        ; Compute EAD and dAD
  507.     LXI    H,Do0995    ; save a 2 bytes value
  508.     CALL    outCRS        ; CURSor position
  509.     RET
  510. ;
  511. ;--------------------------------
  512. ; Select a zoom parameter for text and boxes.
  513. ; The valid range of values for Z is 0:15 (default = 0).
  514. ; (Refer to GBOX and GTEXT for the specific zoom formulas.)
  515. ; Once a specific zoom parameter is set, it remains so
  516. ; until another GZOOM or GINIT routine is called.
  517. ;
  518. GZOOM:    SHLD    saveHL        ; Zoom value
  519.     LXI    H,0000H
  520.     DAD    SP
  521.     SHLD    oldSP
  522.     LXI    SP,stack
  523.     CALL    noerr
  524.     LHLD    saveHL        ; Load zoom value
  525.     CALL    loadHL
  526.     LXI    D,0A10H        ; Check for 0:15  (0AH = error 10)
  527. gzoom2:    CALL    errH
  528.     XCHG
  529.     LXI    H,valueZ    ; Zoom value
  530.     MOV    M,E
  531.     CALL    outzom        ; Outputs zoom parameter
  532.     JMP    finis        ; Go back to calling routine
  533. ;
  534. ;--------------------------------
  535. ; Draw a circle with the radius R.
  536. ; The valid range of values for R is 1:255.
  537. ; The center of the circle is defined with GPOINT.
  538. ;
  539. GCIRCL:    SHLD    saveHL        ; Radius R
  540.     LXI    H,0000H
  541.     DAD    SP
  542.     SHLD    oldSP
  543.     LXI    SP,stack
  544.     CALL    noerr
  545.     LXI    H,0000H        ; Starting angle = 0 degrees
  546.     SHLD    angleS
  547.     LXI    H,0168H        ; Ending angle = 360 degrees
  548.     SHLD    angleE
  549.     LXI    D,14FFH        ; Check for 1:255  (14H = error 20)
  550.     JMP    garc3        ; End of GARC routine below
  551. ;
  552. ;--------------------------------
  553. ; Draw an arc with radius R, starting angle S
  554. ; and ending angle E.
  555. ; The valid range of values for R is 1:255.
  556. ; The valid range of values for S and E is -360 to +360.
  557. ; (A starting angle S of +360 is equal to 0.)
  558. ; GPOINT defines the center and the arc is drawn
  559. ; starting at angle S and ending at angle E.
  560. ; Arcs are always drawn counterclockwise.
  561. ;
  562. GARC:    SHLD    saveHL        ; Radius R
  563.     XCHG
  564.     SHLD    saveDE        ; Starting angle S
  565.     LXI    H,0000H
  566.     DAD    SP
  567.     SHLD    oldSP
  568.     LXI    SP,stack
  569.     CALL    noerr
  570.     MOV    L,C
  571.     MOV    H,B
  572.     SHLD    saveBC        ; Ending angle E
  573.  
  574.     LHLD    saveDE        ; Load starting angle S
  575.     CALL    loadHL
  576.     SHLD    angleS
  577.     LXI    D,0168H        ; = 360 degrees ?
  578.     DAD    D
  579.     LXI    D,03D1H        ; 02D1H = 721     (360+360+1)
  580.     LXI    B,1617H        ; 16H = error 22, 17H = error 23
  581.     CALL    noerH
  582.     LHLD    angleS
  583.     LXI    B,0168H        ; = 360 degrees
  584.     CALL    garc8
  585.     SHLD    angleS
  586.  
  587.     LHLD    saveBC        ; Load ending angle E
  588.     CALL    loadHL
  589.     SHLD    angleE
  590. garc2:    LXI    D,0168H        ; = 360 degrees ?
  591.     DAD    D
  592.     LXI    D,03D1H        ; 02D1H = 721     (360+360+1)
  593.     LXI    B,1819H        ; 18H = error 24, 19H = error 25
  594.     CALL    noerH
  595.     LHLD    angleE
  596.     LXI    B,0169H        ; = 0169H = 361
  597.     CALL    garc8
  598.     SHLD    angleE
  599.  
  600.     LXI    D,15FFH        ; Check for 1:255  (15H = error 21)
  601. garc3:    PUSH    D
  602.  
  603.     LHLD    saveHL        ; Load radius R
  604.     CALL    loadHL
  605.     DCX    H        ; R = R - 1  (because overflow with 255)
  606.     POP    D
  607.     CALL    errH        ; (Check for 1:255)
  608.     INX    H        ; R = R + 1
  609.     SHLD    radius
  610.  
  611.     CALL    garc31
  612.     CALL    garc32
  613.     CALL    garc33
  614.     CALL    garc34
  615.     CALL    garc35
  616.     CALL    garc36
  617.     LDA    Do0AEB
  618.     STA    Do0AE6
  619.     LXI    H,Io0AEC
  620.     SUB    M
  621.     JNZ    garc4
  622.     CALL    garc37
  623.     JMP    garc7
  624. ;
  625. ;--------------------------------
  626. ;
  627. garc4:    CALL    garc41
  628.     CALL    garc42
  629. garc5:    CALL    garc51
  630.     CALL    garc52
  631.     LHLD    Do0AE7
  632.     LXI    B,0FFD3H    ; 211
  633.     DAD    B
  634.     JNC    garc6
  635.     CALL    garc53
  636.     MVI    A,2DH        ; "-"  (2DH = 45)
  637.     STA    Do0AE9
  638.     JMP    garc5
  639. ;
  640. ;--------------------------------
  641. ;
  642. garc6:    CALL    C$0C3F
  643. garc7:    JMP    finis        ; Go back to calling routine
  644. ;
  645. ;--------------------------------
  646. ;
  647. garc8:    LXI    D,0168H        ; = 360 degrees ?
  648.     MOV    A,H
  649.     CPI    00H
  650.     JP    garc9
  651.     DAD    D
  652.     JMP    garcA
  653. ;
  654. ;--------------------------------
  655. ;
  656. garc9:    LXI    D,0FE98H    ; 98H = 152
  657.     CMP    B
  658.     JNZ    garcA
  659.     MOV    A,L
  660.     CMP    C
  661.     JNZ    garcA
  662.     DAD    D
  663. garcA:    RET
  664. ;
  665. ;--------------------------------
  666. ; Draw a line from the current cursor position to the point (X,Y).
  667. ; The valid range of values for X is 0:639.
  668. ; The valid range of values for Y is 0:399.
  669. ; Call GPOINT to define the starting point for the GLINE routine.
  670. ; Calling subsequent GLINE routines without defining a new
  671. ; starting point causes the end point of one line to be
  672. ; the starting point of the next line.
  673. ; (The cursor is positioned one point ahead of the end point
  674. ; after drawing a line. Use GPOINT for exact cursor positioning
  675. ; each time GLINE is called.)
  676. ; GPATT may be used in conjunction with GLINE to draw different
  677. ; line patterns (see GPATT).
  678. ;
  679. GLINE:    SHLD    saveHL        ; X value
  680.     XCHG
  681.     SHLD    saveDE        ; Y value
  682.     LXI    H,0000H
  683.     DAD    SP
  684.     SHLD    oldSP
  685.     LXI    SP,stack
  686.     CALL    noerr
  687.  
  688.     LHLD    saveHL        ; Load X value
  689.     CALL    loadHL
  690.     LXI    D,0380H        ; 0280H = 640
  691.     LXI    B,0506H        ; 05H = error 5, 06H = error 6
  692.     CALL    noerH
  693.     INX    H        ; X = X + 1  (so 0 = first pixel)
  694.     SHLD    endX
  695.  
  696.     LHLD    saveDE        ; Load Y value
  697.     CALL    loadHL
  698.     LXI    D,0290H        ; 0190H = 400
  699.     LXI    B,0708H        ; 07H = error 7, 08H = error 8
  700.     CALL    noerH
  701.     INX    H        ; Y = Y + 1  (so 0 = first pixel)
  702.     SHLD    endY
  703.  
  704.     CALL    line2        ; Compute everything
  705.     LXI    H,FIGSP1    ; Specify line to draw
  706.     CALL    outFG2        ; Outputs line specification
  707.     MVI    A,6CH        ; FIGD: draw the line
  708.     CALL    outA
  709.     JMP    finis        ; Go back to calling routine
  710. ;
  711. ;--------------------------------
  712. ;
  713. gboxz:    DB    00H        ; GBOX Zoom value
  714. gboxp:    DW    0000H        ; GBOX Pattern value
  715. ;
  716. ;--------------------------------
  717. ; Draw a filled rectangle with sides of length H and V
  718. ; in direction D. (H is the number of pixels in the
  719. ; horizontal line and V is the number of pixels in the
  720. ; vertical line.)
  721. ; The valid range of values for H and V is 1:640.
  722. ; The valid range of values for D is 0:7 (see GRECT).
  723. ; GPOINT defines the lower left corner of the box.
  724. ; The pattern that fills the box is selected with the
  725. ; GPATT routine and the size of the box is affected
  726. ; by the GZOOM routine. Assuming the zoom parameter
  727. ; is Z, then the actual length of the sides of the
  728. ; box are H=H*(Z+1) and V=V*(Z+1). Make sure the
  729. ; results of these calculations do not exceed 640 for H and V.
  730. ;
  731. GBOX:    SHLD    saveHL        ; H value
  732.     LXI    H,0000H
  733.     DAD    SP
  734.     SHLD    oldSP
  735.     LXI    SP,stack
  736.     MVI    A,01H
  737.     STA    valueD        ; Direction = 01H (45 degrees ?)
  738.     LXI    H,0FFFFH
  739.     SHLD    gboxp        ; GBOX Pattern value = 0FFFFH
  740.     LHLD    saveHL
  741.     PUSH    H
  742.     LHLD    valueZ        ; Zoom value
  743.     MOV    A,L
  744.     ADI    01H
  745.     STA    gboxz        ; GBOX Zoom value
  746.     POP    H
  747.     JMP    grect2        ; End of GRECT routine below
  748. ;
  749. ;--------------------------------
  750. ; Draw a rectangle with sides of length H and V in direction D.
  751. ; (H is the number of pixels in the horizontal line
  752. ; and V is the number of pixels in the vertical line.)
  753. ; The valid range of values for H is 2:640.
  754. ; The valid range of values for V is 2:640.
  755. ; The valid range of values for D is 0:7.
  756. ; GPOINT defines the lower left corner of the rectangle.
  757. ; The direction D rotates the rectangle counterclockwise
  758. ; in steps of 45 degrees around the cursor.
  759. ;
  760. GRECT:    SHLD    saveHL        ; H value
  761.     LXI    H,0000H
  762.     DAD    SP
  763.     SHLD    oldSP
  764.     LXI    SP,stack
  765.     MVI    A,00H
  766.     STA    valueD        ; Direction = 00H (0 degrees)
  767.     ADI    01H
  768.     STA    gboxz        ; GBOX Zoom value = 01H
  769.     LXI    H,0FFFEH
  770.     SHLD    gboxp        ; GBOX Pattern value = 0FFFEH
  771. grect2:    CALL    noerr
  772.     XCHG
  773.     SHLD    saveDE        ; V value
  774.     MOV    L,C
  775.     MOV    H,B
  776.     SHLD    saveBC        ; D value
  777.     CALL    loadHL
  778.     LXI    D,1E08H        ; Check for 0:7  (1EH = error 30)
  779.     CALL    errH
  780.     MOV    A,L
  781.     STA    rectD
  782.  
  783.     LHLD    saveHL        ; Load H value
  784.     CALL    loadHL
  785.     SHLD    rectH
  786.     LXI    B,5051H        ; 50H = error 80, 51H = error 81
  787.     CALL    grect4
  788.  
  789.     LHLD    saveDE        ; Load V value
  790.     CALL    loadHL
  791.     SHLD    rectV
  792.     LXI    B,5253H        ; 52H = error 82, 53H = error 83
  793.     CALL    grect4
  794.  
  795.     LHLD    rectD        ; Load D value
  796.     MOV    A,H
  797.     ANI    0FH        ; 15 
  798.     JNZ    grect3
  799.     CALL    grect9
  800.     LXI    H,FIGSP1    ; Specify rectangle
  801.     CALL    outFG2
  802.     MVI    A,6CH        ; FIGD: draw the rectangle
  803.     CALL    outA
  804.     JMP    finis        ; Go back to calling routine
  805. ;
  806. ;--------------------------------
  807. ;
  808. grect3:    CALL    grec31
  809.     LXI    H,FIGSP1    ; Specify rectangle
  810.     CALL    outFG2
  811.     MVI    A,68H        ; GCHRD: area filling
  812.     CALL    outA
  813.     JMP    finis        ; Go back to calling routine
  814. ;
  815. ;--------------------------------
  816. ;
  817. grect4:    XCHG
  818.     MVI    H,00H
  819.     MVI    L,00H
  820.     LDA    gboxz        ; GBOX Zoom value
  821. grect5:    DAD    D
  822.     DCR    A
  823.     JNZ    grect5
  824.     XCHG
  825.     LHLD    gboxp        ; GBOX Pattern value
  826.     XCHG
  827.     DAD    D
  828.     PUSH    H
  829.     LXI    H,0381H        ; 0281H = 641
  830.     DAD    D
  831.     XCHG
  832.     POP    H
  833.     CALL    noerH        ; (check for 2:640)
  834.     RET
  835. ;
  836. ;--------------------------------
  837. ; Select a pattern that fills a box or a line.
  838. ; The valid range of values for P is 0:15 (defaut = 0).
  839. ; Once a specific pattern is set, it remains so until
  840. ; another GPATT or GINIT routine is called.
  841. ; NOTE: Arcs, circles, and rectangles are drawn with
  842. ; the selected line pattern.
  843. ;
  844. GPATT:    SHLD    saveHL        ; Pattern value
  845.     LXI    H,0000H
  846.     DAD    SP
  847.     SHLD    oldSP
  848.     LXI    SP,stack
  849.     CALL    noerr
  850.     LHLD    saveHL        ; Load pattern
  851.     CALL    loadHL
  852.     LXI    D,2810H        ; Check for 0:15  (28H = error 40)
  853.     CALL    errH
  854.     MOV    A,L
  855.     STA    valueP        ; Pattern value
  856.     CALL    gpat2        ; Outputs pattern bytes
  857.     JMP    finis        ; Go back to calling routine
  858. ;
  859. ;--------------------------------
  860. ;
  861. gpat2:    LDA    valueP        ; Pattern value
  862.     MVI    H,00H
  863.     MOV    L,A
  864.     DAD    H
  865.     DAD    H        ; Each pattern is 8 bytes long
  866.     DAD    H
  867.     LXI    D,tablin    ; Table of line patterns
  868.     DAD    D
  869.     CALL    outpat        ; Outputs pattern bytes
  870.     RET
  871. ;
  872. ;--------------------------------
  873. ; Select the drawing mode.
  874. ; The valid range of values for M is 0:3 (default = 0).
  875. ; Once the drawing mode is set, it remains so until
  876. ; another GMODE or GINIT routine is called.
  877. ; The following table explains these 4 modes:
  878. ;
  879. ; Parameter    Name        Description
  880. ; ---------    ----        -----------
  881. ;
  882. ;     0        Replace        Draws white character fields
  883. ;                on a black background.
  884. ;                (The black parts of a dashed line
  885. ;                or box pattern are drawn black.)
  886. ;
  887. ;     1        Complement    Draws white characters on a
  888. ;                black background and black
  889. ;                characters on a white background.
  890. ;
  891. ;     2        Draw Black    Draws black characters.
  892. ;                (Printing is visible only on a
  893. ;                white background.)
  894. ;
  895. ;     3        Draw White    Draws white characters.
  896. ;                (Printing is visible only on a
  897. ;                black background.)
  898. ;
  899. GMODE:    SHLD    saveHL        ; Drawing mode value
  900.     LXI    H,0000H
  901.     DAD    SP
  902.     SHLD    oldSP
  903.     LXI    SP,stack
  904.     CALL    noerr
  905.     LHLD    saveHL        ; Load drawing mode value
  906.     CALL    loadHL
  907.     LXI    D,3204H        ; Check for 0:3  (32H = error 50)
  908.     CALL    errH
  909.     MOV    A,L
  910.     ORI    20H        ; 0 (replace) becomes 20H (GINIT)
  911.     STA    valueM        ; Mode value
  912.     CALL    outA        ; WDAT, with MOD = drawing mode ...
  913.     JMP    finis        ; Go back to calling routine
  914. ;
  915. ;--------------------------------
  916. ;
  917. valueM:    DB    00H        ; Drawing mode value
  918. ;
  919. ;--------------------------------
  920. ;
  921. tablin:                ; Table of line patterns in Hex
  922.                 ;   and in Symbolic Binary:
  923.                 ;       0 = ".", 1 = "O"
  924. ;--------------------------------
  925. ;
  926.     DB    0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
  927. ;
  928. ; Line pattern 0:
  929. ;
  930. ; OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
  931. ;
  932. ;--------------------------------
  933. ;
  934.     DB    0AAH,55H,0AAH,55H,0AAH,55H,0AAH,55H
  935. ;
  936. ; Line pattern 1:
  937. ;
  938. ; O.O.O.O..O.O.O.OO.O.O.O..O.O.O.OO.O.O.O..O.O.O.OO.O.O.O..O.O.O.O
  939. ;
  940. ;--------------------------------
  941. ;
  942.     DB    88H,44H,22H,11H,88H,44H,22H,11H
  943. ;
  944. ; Line pattern 2:
  945. ;
  946. ; O...O....O...O....O...O....O...OO...O....O...O....O...O....O...O
  947. ;
  948. ;--------------------------------
  949. ;
  950.     DB    11H,22H,44H,88H,11H,22H,44H,88H
  951. ;
  952. ; Line pattern 3:
  953. ;
  954. ; ...O...O..O...O..O...O..O...O......O...O..O...O..O...O..O...O...
  955. ;
  956. ;--------------------------------
  957. ;
  958.     DB    00H,0AAH,00H,0AAH,00H,0AAH,00H,0AAH
  959. ;
  960. ; Line pattern 4:
  961. ;
  962. ; ........O.O.O.O.........O.O.O.O.........O.O.O.O.........O.O.O.O.
  963. ;
  964. ;--------------------------------
  965. ;
  966.     DB    00H,0FFH,00H,0FFH,00H,0FFH,00H,0FFH
  967. ;
  968. ; Line pattern 5:
  969. ;
  970. ; ........OOOOOOOO........OOOOOOOO........OOOOOOOO........OOOOOOOO
  971. ;
  972. ;--------------------------------
  973. ;
  974.     DB    0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH
  975. ;
  976. ; Line pattern 6:
  977. ;
  978. ; O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.
  979. ;
  980. ;--------------------------------
  981. ;
  982.     DB    81H,42H,24H,18H,18H,24H,42H,81H
  983. ;
  984. ; Line pattern 7:
  985. ;
  986. ; O......O.O....O...O..O.....OO......OO.....O..O...O....O.O......O
  987. ;
  988. ;--------------------------------
  989. ;
  990.     DB    0F0H,0FH,0F0H,0FH,0F0H,0FH,0F0H,0FH
  991. ;
  992. ; Line pattern 8:
  993. ;
  994. ; OOOO........OOOOOOOO........OOOOOOOO........OOOOOOOO........OOOO
  995. ;
  996. ;--------------------------------
  997. ;
  998.     DB    55H,55H,55H,55H,0AAH,0AAH,0AAH,0AAH
  999. ;
  1000. ; Line pattern 9:
  1001. ;
  1002. ; .O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.OO.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.
  1003. ;
  1004. ;--------------------------------
  1005. ;
  1006.     DB    33H,0CCH,33H,0CCH,33H,0CCH,33H,0CCH
  1007. ;
  1008. ; Line pattern 10:
  1009. ;
  1010. ; ..OO..OOOO..OO....OO..OOOO..OO....OO..OOOO..OO....OO..OOOO..OO..
  1011. ;
  1012. ;--------------------------------
  1013. ;
  1014.     DB    55H,55H,0AAH,0AAH,55H,55H,0AAH,0AAH
  1015. ;
  1016. ; Line pattern 11:
  1017. ;
  1018. ; .O.O.O.O.O.O.O.OO.O.O.O.O.O.O.O..O.O.O.O.O.O.O.OO.O.O.O.O.O.O.O.
  1019. ;
  1020. ;--------------------------------
  1021. ;
  1022.     DB    52H,0A5H,4AH,94H,29H,52H,0A5H,4AH
  1023. ;
  1024. ; Line pattern 12:
  1025. ;
  1026. ; .O.O..O.O.O..O.O.O..O.O.O..O.O....O.O..O.O.O..O.O.O..O.O.O..O.O.
  1027. ;
  1028. ;--------------------------------
  1029. ;
  1030.     DB    4AH,0A5H,52H,29H,94H,4AH,0A5H,52H
  1031. ;
  1032. ; Line pattern 13:
  1033. ;
  1034. ; .O..O.O.O.O..O.O.O.O..O...O.O..OO..O.O...O..O.O.O.O..O.O.O.O..O.
  1035. ;
  1036. ;--------------------------------
  1037. ;
  1038.     DB    73H,0E7H,0CEH,9CH,39H,73H,0E7H,0CEH
  1039. ;
  1040. ; Line pattern 14:
  1041. ;
  1042. ; .OOO..OOOOO..OOOOO..OOO.O..OOO....OOO..O.OOO..OOOOO..OOOOO..OOO.
  1043. ;
  1044. ;--------------------------------
  1045. ;
  1046.     DB    0FH,0FH,0FH,0FH,0F0H,0F0H,0F0H,0F0H
  1047. ;
  1048. ; Line pattern 15:
  1049. ;
  1050. ; ....OOOO....OOOO....OOOO....OOOO....OOOO....OOOO....OOOO....OOOO
  1051. ;
  1052. ;--------------------------------
  1053. ;
  1054. ; P.S.
  1055. ;       The doc (Appendix J, "NCR Graphics Extension for MS-BASIC")
  1056. ; shows the following fill patterns for boxes:
  1057. ;
  1058. ; tabbox:            ; Table of fill patterns for boxes
  1059. ;                ;   in Hex and Symbolic Binary:
  1060. ;                ;      0 = ".", 1 = "O"
  1061. ;
  1062. ;-------------------------------; Box pattern O:
  1063. ;
  1064. ;    DB    0FFH        ; OOOOOOOO    
  1065. ;    DB    0FFH        ; OOOOOOOO
  1066. ;    DB    0FFH        ; OOOOOOOO
  1067. ;    DB    0FFH        ; OOOOOOOO
  1068. ;    DB    0FFH        ; OOOOOOOO
  1069. ;    DB    0FFH        ; OOOOOOOO
  1070. ;    DB    0FFH        ; OOOOOOOO
  1071. ;    DB    0FFH        ; OOOOOOOO
  1072. ;
  1073. ;-------------------------------; Box pattern 1:
  1074. ;
  1075. ;    DB     55H        ; .O.O.O.O
  1076. ;    DB    0AAH        ; O.O.O.O.
  1077. ;    DB     55H        ; .O.O.O.O
  1078. ;    DB    0AAH        ; O.O.O.O.
  1079. ;    DB     55H        ; .O.O.O.O
  1080. ;    DB    0AAH        ; O.O.O.O.
  1081. ;    DB     55H        ; .O.O.O.O
  1082. ;    DB    0AAH        ; O.O.O.O.
  1083. ;
  1084. ;-------------------------------; Box pattern 2:
  1085. ;
  1086. ;    DB     11H        ; ...O...O
  1087. ;    DB     22H        ; ..O...O.
  1088. ;    DB     44H        ; .O...O..
  1089. ;    DB     88H        ; O...O...
  1090. ;    DB     11H        ; ...O...O
  1091. ;    DB     22H        ; ..O...O.
  1092. ;    DB     44H        ; .O...O..
  1093. ;    DB     88H        ; O...O...
  1094. ;
  1095. ;-------------------------------; Box pattern 3:
  1096. ;
  1097. ;    DB     88H        ; O...O...
  1098. ;    DB     44H        ; .O...O..
  1099. ;    DB     22H        ; ..O...O.
  1100. ;    DB     11H        ; ...O...O
  1101. ;    DB     88H        ; O...O...
  1102. ;    DB     44H        ; .O...O..
  1103. ;    DB     22H        ; ..O...O.
  1104. ;    DB     11H        ; ...O...O
  1105. ;
  1106. ;-------------------------------; Box pattern 4:
  1107. ;
  1108. ;    DB     00H        ; ........
  1109. ;    DB     55H        ; .O.O.O.O
  1110. ;    DB     00H        ; ........
  1111. ;    DB     55H        ; .O.O.O.O
  1112. ;    DB     00H        ; ........
  1113. ;    DB     55H        ; .O.O.O.O
  1114. ;    DB     00H        ; ........
  1115. ;    DB     55H        ; .O.O.O.O
  1116. ;
  1117. ;-------------------------------; Box pattern 5:
  1118. ;
  1119. ;    DB     00H        ; ........
  1120. ;    DB    0FFH        ; OOOOOOOO
  1121. ;    DB     00H        ; ........
  1122. ;    DB    0FFH        ; OOOOOOOO
  1123. ;    DB     00H        ; ........
  1124. ;    DB    0FFH        ; OOOOOOOO
  1125. ;    DB     00H        ; ........
  1126. ;    DB    0FFH        ; OOOOOOOO
  1127. ;
  1128. ;-------------------------------; Box pattern 6:
  1129. ;
  1130. ;    DB     55H        ; .O.O.O.O
  1131. ;    DB     55H        ; .O.O.O.O
  1132. ;    DB     55H        ; .O.O.O.O
  1133. ;    DB     55H        ; .O.O.O.O
  1134. ;    DB     55H        ; .O.O.O.O
  1135. ;    DB     55H        ; .O.O.O.O
  1136. ;    DB     55H        ; .O.O.O.O
  1137. ;    DB     55H        ; .O.O.O.O
  1138. ;
  1139. ;-------------------------------; Box pattern 7:
  1140. ;
  1141. ;    DB     81H        ; O......O
  1142. ;    DB     42H        ; .O....O.
  1143. ;    DB     24H        ; ..O..O..
  1144. ;    DB     18H        ; ...OO...
  1145. ;    DB     18H        ; ...OO...
  1146. ;    DB     24H        ; ..O..O..
  1147. ;    DB     42H        ; .O....O.
  1148. ;    DB     81H        ; O......O
  1149. ;
  1150. ;-------------------------------; Box pattern 8:
  1151. ;
  1152. ;    DB     0FH        ; ....OOOO
  1153. ;    DB    0F0H        ; OOOO....
  1154. ;    DB     0FH        ; ....OOOO
  1155. ;    DB    0F0H        ; OOOO....
  1156. ;    DB     0FH        ; ....OOOO
  1157. ;    DB    0F0H        ; OOOO....
  1158. ;    DB     0FH        ; ....OOOO
  1159. ;    DB    0F0H        ; OOOO....
  1160. ;
  1161. ;-------------------------------; Box pattern 9:
  1162. ;
  1163. ;    DB    0AAH        ; O.O.O.O.
  1164. ;    DB    0AAH        ; O.O.O.O.
  1165. ;    DB    0AAH        ; O.O.O.O.
  1166. ;    DB    0AAH        ; O.O.O.O.
  1167. ;    DB    0AAH        ; .O.O.O.O
  1168. ;    DB    0AAH        ; .O.O.O.O
  1169. ;    DB    0AAH        ; .O.O.O.O
  1170. ;    DB    0AAH        ; .O.O.O.O
  1171. ;
  1172. ;-------------------------------; Box pattern 10:
  1173. ;
  1174. ;    DB    0CCH        ; OO..OO..
  1175. ;    DB     33H        ; ..OO..OO
  1176. ;    DB    0CCH        ; OO..OO..
  1177. ;    DB     33H        ; ..OO..OO
  1178. ;    DB    0CCH        ; OO..OO..
  1179. ;    DB     33H        ; ..OO..OO
  1180. ;    DB    0CCH        ; OO..OO..
  1181. ;    DB     33H        ; ..OO..OO
  1182. ;
  1183. ;-------------------------------; Box pattern 11:
  1184. ;
  1185. ;    DB    0AAH        ; O.O.O.O.
  1186. ;    DB    0AAH        ; O.O.O.O.
  1187. ;    DB     55H        ; .O.O.O.O
  1188. ;    DB     55H        ; .O.O.O.O
  1189. ;    DB    0AAH        ; O.O.O.O.
  1190. ;    DB    0AAH        ; O.O.O.O.
  1191. ;    DB     55H        ; .O.O.O.O
  1192. ;    DB     55H        ; .O.O.O.O
  1193. ;
  1194. ;-------------------------------; Box pattern 12:
  1195. ;
  1196. ;    DB     4AH        ; .O..O.O.
  1197. ;    DB    0A5H        ; O.O..O.O
  1198. ;    DB     52H        ; .O.O..O.
  1199. ;    DB     29H        ; ..O.O..O
  1200. ;    DB     94H        ; O..O.O..
  1201. ;    DB     4AH        ; .O..O.O.
  1202. ;    DB    0A5H        ; O.O..O.O
  1203. ;    DB     52H        ; .O.O..O.
  1204. ;
  1205. ;-------------------------------; Box pattern 13:
  1206. ;
  1207. ;    DB     52H        ; .O.O..O.
  1208. ;    DB    0A5H        ; O.O..O.O
  1209. ;    DB     4AH        ; .O..O.O.
  1210. ;    DB     94H        ; O..O.O..
  1211. ;    DB     29H        ; ..O.O..O
  1212. ;    DB     52H        ; .O.O..O.
  1213. ;    DB    0A5H        ; O.O..O.O
  1214. ;    DB     4AH        ; .O..O.O.
  1215. ;
  1216. ;-------------------------------; Box pattern 14:
  1217. ;
  1218. ;    DB    0CEH        ; OO..OOO.
  1219. ;    DB    0E7H        ; OOO..OOO
  1220. ;    DB     73H        ; .OOO..OO
  1221. ;    DB     39H        ; ..OOO..O
  1222. ;    DB     9CH        ; O..OOO..
  1223. ;    DB    0CEH        ; OO..OOO.
  1224. ;    DB    0E7H        ; OOO..OOO
  1225. ;    DB     73H        ; .OOO..OO
  1226. ;
  1227. ;-------------------------------; Box pattern 15:
  1228. ;
  1229. ;    DB    0F0H        ; OOOO....
  1230. ;    DB    0F0H        ; OOOO....
  1231. ;    DB    0F0H        ; OOOO....
  1232. ;    DB    0F0H        ; OOOO....
  1233. ;    DB     0FH        ; ....OOOO
  1234. ;    DB     0FH        ; ....OOOO
  1235. ;    DB     0FH        ; ....OOOO
  1236. ;    DB     0FH        ; ....OOOO
  1237. ;
  1238. ;--------------------------------
  1239. ;
  1240. valueP:    DB    00H        ; Pattern value
  1241. ;
  1242.     DB    00H,00H        ; ???
  1243.     DB    00H,00H        ; ???
  1244.     DB    00H,00H        ; ???
  1245. ;
  1246. startX:    DW    0000H        ; Starting point X
  1247. ;
  1248.     DB    00H,00H        ; ???
  1249. ;
  1250. startY:    DW    0000H        ; Starting point Y
  1251. ;
  1252.     DB    00H,00H        ; ???
  1253.     DB    00H,00H        ; ???
  1254. ;
  1255. ;--------------------------------
  1256. ; Draw a string A$ in a specific direction D.
  1257. ; The valid range of values for D is 0:7.
  1258. ; A$ may be any alphanumeric string defined in the program
  1259. ; (ASCII characters only).
  1260. ; GPOINT defines the lower left corner of the text string.
  1261. ; The direction D rotates the text counterclockwise in
  1262. ; steps of 45 degrees around the cursor.
  1263. ; GZOOM affects the size of the text. For a zoom factor of 0,
  1264. ; the maximum size of the character field is 16 pixels high
  1265. ; and 8 pixels wide. The maximum size of the character
  1266. ; itself is 9 pixels high and 6 pixels wide. Assuming the
  1267. ; zoom parameter is Z, the actual size of a character field
  1268. ; is height = 16*(Z+1) pixels by width = 8*(Z+1) pixels.
  1269. ; For example, a text 3 characters long with a zoom parameter
  1270. ; of 4 is height = 3*(16*(4+1)) by width = 3*(8*(4+1)) pixels.
  1271. ; There is no error checking done on these calculations,
  1272. ; so make sure the results do not exceed the height and width
  1273. ; of the screen.
  1274. ;
  1275. GTEXT:    SHLD    saveHL        ; Length of string A$ (one byte)
  1276.     XCHG
  1277.     SHLD    saveDE        ; Direction D
  1278.  
  1279.     LXI    H,0000H
  1280.     DAD    SP
  1281.     SHLD    oldSP
  1282.     LXI    SP,stack
  1283.     CALL    noerr
  1284.  
  1285.     LHLD    saveDE        ; Direction D
  1286.     SHLD    saveBC
  1287.     CALL    loadHL
  1288.     LXI    D,3C08H        ; Check for 0:7  (3CH = error 60)
  1289.     CALL    errH
  1290.     MOV    A,L
  1291.     STA    gtextD
  1292.  
  1293.     ADI    02H        ; 2 
  1294.     ANI    07H        ; 7 
  1295.     ORI    10H        ; 16 
  1296.     STA    gtextX        ; GTEXT unknown...
  1297.  
  1298.     LHLD    saveHL        ; Load length of string A$
  1299.     MOV    C,M
  1300.     MVI    A,00H        ; Empty string ?
  1301.     CMP    C
  1302.     JZ    finis        ; Go back to calling routine
  1303.     INX    H
  1304.     CALL    loadHL        ; Load first char of string A$
  1305.  
  1306. gtext2:    MOV    B,M
  1307.     INX    H
  1308.     PUSH    H
  1309.     PUSH    B
  1310.     MOV    A,B
  1311.     CALL    gtext3
  1312.     LXI    H,I$0F0F    ; Pattern ?
  1313.     CALL    gtext5
  1314.     LXI    H,Io0F07    ; Pattern ?
  1315.     CALL    gtext5
  1316.     CALL    gtext6
  1317.     CALL    point2        ; Position cursor at (X,Y)
  1318.     POP    B
  1319.     POP    H
  1320.     DCR    C
  1321.     JNZ    gtext2
  1322.  
  1323.     CALL    gpat2        ; Outputs pattern bytes
  1324.     JMP    finis        ; Go back to calling routine
  1325. ;
  1326. ;--------------------------------
  1327. ;
  1328. gtextD:    DB     00H        ; GTEXT direction D
  1329. ;
  1330. gtextX:    DB     10H        ; FIGS params: P1: Graphics Character (ON)
  1331.     DB     07H        ; P2
  1332.     DB     40H        ; P3
  1333.     DB     08H        ; P4
  1334.     DB     00H        ; P5
  1335.     DB     08H        ; P6
  1336.     DB     00H        ; P7
  1337.     DB    0FFH        ; P8
  1338.     DB     3FH        ; P9
  1339.     DB    0FFH        ; P10
  1340.     DB     3FH        ; P11
  1341. ;
  1342. ;--------------------------------
  1343. ; Output a screen image to a printer.
  1344. ; GPRINT outputs an entire screen image to a printer.
  1345. ; All white areas on the screen are output as black
  1346. ; on the printer, and black areas are output as white.
  1347. ; When the output is finished, one additional linefeed
  1348. ; is printed. (Printing a screen can be interrupted
  1349. ; only by switching off the NCR DECISION MATE V.)
  1350. ; The valid range of values for a Printer is 0,1,2,4,5.
  1351. ; The following printers can be used with GPRINT:
  1352. ;     EPSON MX-80
  1353. ;     EPSON MX-82
  1354. ;     EPSON MX-110
  1355. ;     EPSON FX-80
  1356. ;     NCR 6411-8510  (C-ITOH M8510A)
  1357. ; The Printer parameters are assigned as follows:
  1358. ;     0  EPSON MX-80, MX-82, MX-100;
  1359. ;     single density, one directional
  1360. ;     1  EPSON MX-80, MX-82, MX-100;
  1361. ;     Double density, one directional
  1362. ;     2  EPSON FX-80; single density, one directional
  1363. ;     4  NCR 6411-8510  (C-ITOH M8510A);
  1364. ;     single density, bi-directional
  1365. ;     5  NCR 6411-8510  (C-ITOH M8510A);
  1366. ;     single density, one directional
  1367. ;     (When the graphics output is completed,
  1368. ;      bi-directional printing is automatically restored.)
  1369. ; Some of the above printers are not capable of printing
  1370. ; the whole screen image horizontally. Below is a list of the
  1371. ; maximum horizontal width for each printer:
  1372. ;     480 pixels - EPSON MX-80
  1373. ;     576 pixels - EPSON MX-82
  1374. ;     640 pixels - EPSON MX-100
  1375. ;     640 pixels - EPSON FX-80
  1376. ;     640 pixels - NCR 6411-8510  (C-ITOH M8510A)
  1377. ; Using the recommended Linefeeds, the EPSON MX-82 does not
  1378. ; distort the screen image on paper; the EPSON FX-80, MX-80
  1379. ; and MX-100 distort horizontally; The NCR (C-ITOH) printer
  1380. ; distorts vertically.
  1381. ; The valid range of values for the Linefeed parameter is 0:99.
  1382. ; The recommended Linefeed for the EPSON MX-80, MX-82, and
  1383. ; MX-100 printers is 8; EPSON FX-80 is 7; and NCR 6411-8510
  1384. ; (C-ITOH M8510A) is 16. These recommended values produce
  1385. ; the best output. Smaller values produce overlapped lines
  1386. ; and larger values produce lines with a visible distance
  1387. ; between them. When the graphics output is completed,
  1388. ; the normal linefeed value is automatically restored.
  1389. ;
  1390. GPRINT:    SHLD    saveHL        ; Printer P
  1391.     XCHG
  1392.     SHLD    saveDE        ; Linefeed L
  1393.     LXI    H,0000H
  1394.     DAD    SP
  1395.     SHLD    oldSP
  1396.     LXI    SP,stack
  1397.     CALL    noerr
  1398.  
  1399.     LHLD    saveHL        ; Load printer value
  1400.     CALL    loadHL
  1401.     LXI    D,4606H        ; Check for 0:5  (46H = error 70)
  1402.     CALL    errH
  1403.     MOV    A,L
  1404.     STA    printr
  1405.  
  1406.     LXI    H,tabESC    ; Table of ESCape codes
  1407.     RLC
  1408.     RLC
  1409.     RLC
  1410.     MVI    D,00H
  1411.     MOV    E,A        ; A-reg = printer number
  1412.     DAD    D
  1413.     SHLD    ESCod        ; ESCape code to send
  1414.  
  1415.     LDA    printr
  1416.     CPI    03H        ; Not valid ?
  1417.     JNZ    validP
  1418.     MVI    A,46H        ; = error 70 (Printer out of range)
  1419.     STA    GSTAT
  1420.     JMP    finis        ; Go back to calling routine
  1421. ;
  1422. ;--------------------------------
  1423. ; Valid printer numbers
  1424. ;
  1425. validP:    CPI    04H        ; 5
  1426.     JNC    J$0674
  1427.     CPI    01H        ; 2
  1428.     JZ    valid2
  1429.     SUB    A
  1430. valid2:    STA    Do0820        ; 1
  1431.     SUB    A
  1432.     STA    Do081F        ; 0
  1433.     CALL    chkLF        ; Check number of linefeeds L
  1434.     STA    valueL
  1435.     LXI    H,I$083C
  1436.     SHLD    Do0824
  1437.     LXI    H,I$087E
  1438.     SHLD    Do0828
  1439.     JMP    Jo06C3
  1440. ;
  1441. ;--------------------------------
  1442. ;
  1443. J$0674:    MVI    A,01H        ; 1 
  1444.     STA    Do081F
  1445.     SUB    A
  1446.     STA    D$081E        ; 0
  1447.     STA    Do0820
  1448.     MOV    B,A
  1449.     CALL    chkLF        ; Check number of linefeeds L
  1450. J$0684:    CPI    0AH        ; 10 
  1451.     JC    J$068F
  1452.     SUI    0AH        ; 10 
  1453.     INR    B
  1454.     JMP    J$0684
  1455. ;
  1456. ;--------------------------------
  1457. ;
  1458. J$068F:    ADI    30H        ; "0"
  1459.     STA    D$0845
  1460.     STA    D$084B
  1461.     MOV    A,B
  1462.     ADI    30H        ; "0"
  1463.     STA    D$0844
  1464.     STA    D$084A
  1465.     LDA    printr
  1466.     CPI    04H        ; NCR single density bidirect
  1467.     JZ    J$06B7
  1468.     LXI    H,I$0848
  1469.     SHLD    Do0824
  1470.     LXI    H,I$0888
  1471.     SHLD    Do0828
  1472.     JMP    Jo06C3
  1473. ;
  1474. ;--------------------------------
  1475. ;
  1476. J$06B7:    LXI    H,I$0842
  1477.     SHLD    Do0824
  1478.     LXI    H,I$0883
  1479.     SHLD    Do0828
  1480. Jo06C3:    LHLD    Do0824
  1481.     LXI    B,0605H
  1482.     CALL    Co088F
  1483. J$06CC:    LHLD    ESCod        ; ESCape code to send
  1484.     LXI    B,0805H
  1485.     CALL    Co088F
  1486. J$06D5:    LXI    H,Io082C
  1487.     SHLD    Do082A
  1488.     LDA    Do0817
  1489.     ORA    A
  1490.     JNZ    J$06F6
  1491.     LXI    H,0000H
  1492.     SHLD    Do0818
  1493.     SHLD    Do081B
  1494.     MVI    A,32H        ; "2"
  1495.     STA    Do0817
  1496.     LDA    Do0821
  1497.     STA    Do0816
  1498. J$06F6:    LXI    H,I$07F6
  1499.     MVI    A,78H        ; PRAM: 2 bytes follow
  1500.     CALL    outA
  1501.     MVI    C,02H        ; 2 bytes follow
  1502.     CALL    outC
  1503.     LXI    H,Do0818
  1504.     CALL    outCRS        ; CURS
  1505.     LXI    H,I$07F8
  1506.     CALL    outMSK        ; MASK
  1507.     LXI    H,I$07FA
  1508.     CALL    outFGS
  1509.     MVI    A,0A0H        ; RDAT
  1510.     CALL    outA
  1511.     LXI    H,0805H
  1512.     LXI    D,Io080D
  1513.     MVI    C,08H        ; 8 
  1514.     CALL    Co07E2
  1515.     LHLD    Do082A
  1516.     XCHG
  1517.     CALL    C$0799
  1518.     XCHG
  1519.     SHLD    Do082A
  1520.     LHLD    Do0818
  1521.     INX    H
  1522.     SHLD    Do0818
  1523.     LDA    Do0820
  1524.     STA    Do0822
  1525.     LXI    H,Io082C
  1526.     LXI    B,1005H
  1527.     CALL    Co088F
  1528.     MVI    A,00H
  1529.     STA    Do0822
  1530.     LDA    Do0816
  1531.     DCR    A
  1532.     STA    Do0816
  1533.     JNZ    J$06D5
  1534.     LXI    B,0205H
  1535.     LXI    H,I$088D
  1536.     CALL    Co088F
  1537.     LXI    H,0028H
  1538.     DAD    H
  1539.     DAD    H
  1540.     DAD    H
  1541.     XCHG
  1542.     LHLD    Do081B
  1543.     DAD    D
  1544.     SHLD    Do0818
  1545.     SHLD    Do081B
  1546.     LDA    Do0821
  1547.     STA    Do0816
  1548.     LDA    Do0817
  1549.     DCR    A
  1550.     STA    Do0817
  1551.     JNZ    J$06CC
  1552.     LHLD    Do0828
  1553.     LXI    B,0505H
  1554.     CALL    Co088F
  1555.     JMP    finis        ; Go back to calling routine
  1556. ;
  1557. ;--------------------------------
  1558. ;
  1559. chkLF:    LHLD    saveDE        ; Load Linefeed value
  1560.     CALL    loadHL
  1561.     LXI    D,4764H        ; Check for 0:99  (47H = error 71)
  1562.     CALL    errH
  1563.     MOV    A,L
  1564.     RET
  1565. ;
  1566. ;--------------------------------
  1567. ;
  1568. C$0799:    MVI    A,01H        ; 1 
  1569.     STA    Do0815
  1570. J$079E:    LXI    B,0808H
  1571. ;
  1572. J$07A1:    DB    21H        ; ?
  1573. ;
  1574. ;    LXI    H,0805H
  1575. ;
  1576. Do07A2:    DW    0805H        ; ?
  1577. ;
  1578. J$07A4:    LDA    Do081F
  1579.     CPI    00H
  1580.     JZ    J$07B4
  1581.     MOV    A,M
  1582.     RAR
  1583.     MOV    M,A
  1584.     LDAX    D
  1585.     RAR
  1586.     JMP    J$07B9
  1587. ;
  1588. ;--------------------------------
  1589. ;
  1590. J$07B4:    MOV    A,M
  1591.     RAR
  1592.     MOV    M,A
  1593.     LDAX    D
  1594.     RAL
  1595. J$07B9:    INX    H
  1596.     STAX    D
  1597.     DCR    B
  1598.     JNZ    J$07A4
  1599.     INX    D
  1600.     MVI    B,08H        ; 8 
  1601.     DCR    C
  1602.     JNZ    J$07A1
  1603.     LDA    Do0815
  1604.     ANI    01H        ; 1 
  1605.     JZ    J$07DB
  1606.     LXI    H,Io080D
  1607.     SHLD    Do07A2        ; ?
  1608.     DCR    A
  1609.     STA    Do0815
  1610.     JMP    J$079E
  1611. ;
  1612. ;--------------------------------
  1613. ;
  1614. J$07DB:    LXI    H,0805H
  1615.     SHLD    Do07A2        ; ?
  1616.     RET
  1617. ;
  1618. ;--------------------------------
  1619. ; Probably outputs screen dump to RAM ?
  1620. ;
  1621. Co07E2:    IN    status        ; Read status register
  1622.     ANI    00000001B      ; Status register flags:
  1623. ;        ::::::::
  1624. ;        :::::::+-> Bit 0: Data Ready
  1625. ;        ::::::+--> Bit 1: 
  1626. ;        :::::+---> Bit 2: 
  1627. ;        ::::+----> Bit 3: 
  1628. ;        :::+-----> Bit 4: 
  1629. ;        ::+------> Bit 5: 
  1630. ;        :+-------> Bit 6: 
  1631. ;        +--------> Bit 7: 
  1632.     JZ    Co07E2
  1633.     IN    FIFO        ; FIFO write a byte ?
  1634.     MOV    M,A
  1635.     INX    H
  1636.     IN    FIFO        ; FIFO write a byte ?
  1637.     STAX    D
  1638.     INX    D
  1639.     DCR    C
  1640.     JNZ    Co07E2
  1641.     RET
  1642. ;
  1643. ;--------------------------------
  1644. ;
  1645. I$07F6:    DB    0FFH,0FFH
  1646. ;
  1647. I$07F8:    DB    0FFH,0FFH
  1648. ;
  1649. I$07FA:    DB     00H        ; P1
  1650.     DB     08H        ; P2
  1651.     DB     40H        ; P3
  1652.     DB     08H        ; P4
  1653.     DB     00H        ; P5
  1654.     DB     08H        ; P6
  1655.     DB     00H        ; P7
  1656.     DB    0FFH        ; P8
  1657.     DB     3FH        ; P9
  1658.     DB    0FFH        ; P10
  1659.     DB     3FH        ; P11
  1660. ;
  1661. ; Set program counter P070D
  1662. ;
  1663.     DB    00H,00H,00H
  1664.     DB    00H,00H,00H,00H,00H
  1665. Io080D:    DB    00H
  1666.     DB    00H,00H,00H,00H,00H,00H,00H
  1667. ;
  1668. ; Set program counter P0715
  1669. ;
  1670. Do0815:    DB    00H
  1671. Do0816:    DB    00H
  1672. Do0817:    DB    00H
  1673. Do0818:    DB    00H,00H,00H
  1674. Do081B:    DB    00H,00H,00H
  1675. D$081E:    DB    00H
  1676. Do081F:    DB    00H
  1677. Do0820:    DB    00H
  1678. Do0821:    DB    28H
  1679. Do0822:    DB    00H
  1680. ;
  1681. printr:    DB    00H        ; Printer number
  1682. ;
  1683. Do0824:    DB    00H,00H
  1684. ;
  1685. ESCod:    DW    0000H        ; Address of ESCape code to send
  1686. ;
  1687. Do0828:    DB    00H,00H
  1688. ;
  1689. Do082A:    DW    2C07H        ; ?
  1690. ;
  1691. ; 16 octets en trop...
  1692. ;
  1693. Io082C:    DB    00H,00H,00H,00H,00H,00H,00H,00H
  1694.     DB    00H,00H,00H,00H,00H,00H,00H,00H
  1695. ;
  1696. ; Set program counter P073C
  1697. ;
  1698. I$083C:    DB    1BH,41H
  1699. ;
  1700. valueL:    DB    00H,00H,00H,00H
  1701. ;
  1702. I$0842:    DB    1BH,54H
  1703. D$0844:    DB    00H
  1704. D$0845:    DB    00H,00H,00H
  1705. I$0848:    DB    1BH,54H
  1706. D$084A:    DB    00H
  1707. D$084B:    DB    00H,1BH,3EH
  1708. ;
  1709. tabESC:    DB    00H,00H,00H,00H,1BH,4BH,80H,02H  ; Printer 0: MX-80
  1710.     DB    00H,00H,00H,00H,1BH,4CH,00H,05H     ; Printer 1: MX-82
  1711.     DB    00H,00H,00H,1BH,2AH,04H,80H,02H  ; Printer 2: MX-100
  1712.     DB    00H,00H,00H,00H,00H,00H,00H,00H  ; Printer 3: (none)
  1713.     DB    00H,00H,1BH,53H,30H,36H,34H,30H  ; Printer 4: FX-80
  1714.     DB    00H,00H,1BH,53H,30H,36H,34H,30H  ; Printer 5: 8510
  1715. ;
  1716. I$087E:    DB    1BH,41H,0CH,00H,0AH
  1717. I$0883:    DB    1BH,41H,00H
  1718.     DB    00H,0AH
  1719. I$0888:    DB    1BH,41H,1BH,3CH,0AH
  1720. I$088D:    DB    0DH,0AH
  1721. ;
  1722. ;--------------------------------
  1723. ;
  1724. Co088F:    LDA    Do0822
  1725.     MOV    D,A
  1726. J$0893:    MOV    E,M
  1727.     PUSH    H
  1728.     PUSH    B
  1729.     PUSH    D
  1730.     CALL    BDOS
  1731.     POP    D
  1732.     POP    B
  1733.     POP    H
  1734.     DCR    D
  1735.     JZ    J$0893
  1736.     INX    H
  1737.     DCR    B
  1738.     JNZ    Co088F
  1739.     RET
  1740. ;
  1741. ;--------------------------------
  1742. ; Outputs GDC command in A-reg
  1743. ;
  1744. outA:    PUSH    H        ; HL used by following outC
  1745.     PUSH    PSW
  1746. outA2:    IN    status        ; Read Status register
  1747.     ANI    00001010B      ; Status register flags:
  1748. ;        ::::::::
  1749. ;        :::::::+-> Bit 0: 
  1750. ;        ::::::+--> Bit 1: FIFO Full
  1751. ;        :::::+---> Bit 2: 
  1752. ;        ::::+----> Bit 3: Drawing in Progress
  1753. ;        :::+-----> Bit 4: 
  1754. ;        ::+------> Bit 5: 
  1755. ;        :+-------> Bit 6: 
  1756. ;        +--------> Bit 7: 
  1757.     JNZ    outA2
  1758.     POP    PSW        ; GDC command in A-reg
  1759.     OUT    FIFO        ; FIFO read GDC command
  1760.     POP    H
  1761.     RET
  1762. ;
  1763. ;--------------------------------
  1764. ; Outputs GDC parameters in M(HL)  (length in C-reg)
  1765. ;
  1766. outC:    IN    status        ; Read Status register
  1767.     ANI    00001010B      ; Status register flags:
  1768. ;        ::::::::
  1769. ;        :::::::+-> Bit 0: 
  1770. ;        ::::::+--> Bit 1: FIFO Full
  1771. ;        :::::+---> Bit 2: 
  1772. ;        ::::+----> Bit 3: Drawing in Progress
  1773. ;        :::+-----> Bit 4: 
  1774. ;        ::+------> Bit 5: 
  1775. ;        :+-------> Bit 6: 
  1776. ;        +--------> Bit 7: 
  1777.     JNZ    outC
  1778.     MOV    A,M        ; Get GDC parameter
  1779.     OUT    status        ; Write Parameter into FIFO
  1780.     INX    H        ; Next GDC parameter
  1781.     DCR    C        ; Decrements Counter
  1782.     JNZ    outC
  1783.     RET
  1784. ;
  1785. ;--------------------------------
  1786. ; Outputs ZOOM parameter
  1787. ;
  1788. outzom:    MVI    A,ZOOM        ; GDC command
  1789.     CALL    outA
  1790.     MVI    C,01H        ; 1 byte follows
  1791.     CALL    outC
  1792.     RET
  1793. ;
  1794. ;--------------------------------
  1795. ; Outputs CCHAR parameter
  1796. ;
  1797. outCHR:    MVI    A,CCHAR        ; GDC command
  1798.     CALL    outA
  1799.     MVI    C,01H        ; 1 byte follows
  1800.     CALL    outC
  1801.     RET
  1802. ;
  1803. ;--------------------------------
  1804. ; Outputs PRAM parameters
  1805. ;
  1806. outPRM:    MVI    A,PRAM        ; GDC command
  1807.     CALL    outA
  1808.     MVI    C,10H        ; 16 byte follow
  1809.     CALL    outC
  1810.     RET
  1811. ;
  1812. ;--------------------------------
  1813. ; Outputs CURS parameters
  1814. ;
  1815. outCRS:    MVI    A,CURS        ; GDC command
  1816.     CALL    outA
  1817.     MVI    C,03H        ; 3 bytes follow
  1818.     CALL    outC
  1819.     RET
  1820. ;
  1821. ;--------------------------------
  1822. ; Outputs MASK parameters
  1823. ;
  1824. outMSK:    MVI    A,MASK        ; GDC command
  1825.     CALL    outA
  1826.     MVI    C,02H        ; 2 bytes follow
  1827.     CALL    outC
  1828.     RET
  1829. ;
  1830. ;--------------------------------
  1831. ; Outputs FIGS parameters
  1832. ;
  1833. outFGS:    MVI    A,FIGS        ; GDC command
  1834.     CALL    outA
  1835.     MVI    C,0BH        ; 11 bytes follow
  1836.     CALL    outC
  1837.     RET
  1838. ;
  1839. ;--------------------------------
  1840. ; Outputs FIGS command and switch Graphics Drawing flag
  1841. ;
  1842. outFG2:    MVI    A,FIGS        ; GDC command
  1843.     CALL    outA
  1844.     CALL    SGDflg        ; Switch Graphics Drawing flag
  1845.     MVI    C,0BH        ; 11 bytes follow
  1846.     CALL    outC
  1847.     RET
  1848. ;
  1849. ;--------------------------------
  1850. ; Outputs PRAM command (8 bytes version)
  1851. ;
  1852. outpat:    MVI    A,78H        ; PRAM GDC command
  1853.     CALL    outA
  1854.     MVI    C,08H        ; 8 bytes follow
  1855.     CALL    outC
  1856.     RET
  1857. ;
  1858. ;--------------------------------
  1859. ; Switch Graphics Drawing flag
  1860. ;
  1861. SGDflg:    LDA    FIGSP3        ; FIGS P3
  1862.     ORI    40H        ; 0100 0000B: Graphics Drawing flag
  1863.     STA    FIGSP3
  1864.     RET
  1865. ;
  1866. ;--------------------------------
  1867. ; Compute EAD and dAD for CURS
  1868. ;
  1869. EADdAD:    PUSH    H
  1870.     PUSH    B
  1871.     PUSH    D
  1872.     PUSH    PSW
  1873.     LHLD    startY        ; Starting point Y
  1874.     SHLD    strtY2
  1875.     CALL    Co0977
  1876.     SHLD    startY        ; Starting point Y
  1877.     LXI    B,0000H
  1878.     LHLD    startX        ; Starting point X
  1879.     DCX    H
  1880.     MOV    A,L
  1881.     ANI    0FH        ; 15 
  1882.     STA    Do099A
  1883.     RLC
  1884.     RLC
  1885.     RLC
  1886.     RLC
  1887.     STA    Do0997
  1888.     MOV    A,L
  1889.     ANI    0F0H
  1890.     MOV    L,A
  1891.     LXI    D,0FFF0H
  1892.     CALL    Co0A48
  1893.     MOV    A,C
  1894.     STA    Do0998
  1895.     LHLD    startY        ; Starting point Y
  1896.     DCX    H
  1897.     XCHG
  1898.     LXI    H,0000H
  1899.     LXI    B,0028H
  1900.     CALL    Co0982
  1901.     XCHG
  1902.     LDA    Do0998
  1903.     MOV    L,A
  1904.     DAD    D
  1905.     SHLD    Do0995
  1906.     POP    PSW
  1907.     POP    D
  1908.     POP    B
  1909.     POP    H
  1910.     RET
  1911. ;
  1912. ;--------------------------------
  1913. ;
  1914. Co0977:    CALL    Co1002
  1915.     XCHG
  1916.     MVI    H,01H        ; 1 
  1917.     MVI    L,90H
  1918.     INX    H
  1919.     DAD    D
  1920.     RET
  1921. ;
  1922. ;--------------------------------
  1923. ;
  1924. Co0982:    MVI    A,00H
  1925.     CMP    E
  1926.     JZ    J$098D
  1927.     DAD    B
  1928.     DCR    E
  1929.     JMP    Co0982
  1930. ;
  1931. ;--------------------------------
  1932. ;
  1933. J$098D:    CMP    D
  1934.     RZ
  1935.     DAD    B
  1936.     DCR    E
  1937.     DCR    D
  1938.     JMP    Co0982
  1939. ;
  1940. ;--------------------------------
  1941. ;
  1942. Do0995:    DB    00H,00H
  1943. ;
  1944. Do0997:    DB    00H
  1945. ;
  1946. Do0998:    DB    00H,00H
  1947. ;
  1948. Do099A:    DB    00H,00H
  1949. ;
  1950. ;--------------------------------
  1951. ;
  1952. garc31:    PUSH    H
  1953.     PUSH    B
  1954.     PUSH    D
  1955.     PUSH    PSW
  1956.  
  1957.     MVI    A,20H
  1958.     STA    FIGSP1        ; 20H = Arc
  1959.  
  1960.     LHLD    radius
  1961.     XCHG
  1962.     LHLD    Do0995
  1963.     LXI    B,0028H
  1964.     CALL    Co0A40
  1965.     CALL    Co0982
  1966.     SHLD    Do0A51
  1967.     SHLD    D$0A60
  1968.  
  1969.     LHLD    radius
  1970.     XCHG
  1971.     LHLD    Do0995
  1972.     LXI    B,0028H
  1973.     CALL    Co0982
  1974.     SHLD    D$0A54
  1975.     SHLD    D$0A5D
  1976.  
  1977.     LDA    Do0997
  1978.     STA    D$0A53
  1979.     STA    D$0A62
  1980.     STA    D$0A56
  1981.     STA    D$0A5F
  1982.  
  1983.     LHLD    radius
  1984.     MOV    A,L
  1985.     STA    Do0A69
  1986.     ANI    0F0H
  1987.     MOV    L,A
  1988.  
  1989.     LXI    D,0FFF0H
  1990.     LXI    B,0000H
  1991.     CALL    Co0A48
  1992.     PUSH    B
  1993.  
  1994.     LDA    Do0A69
  1995.     ANI    0FH        ; 15 
  1996.     CALL    Co0A2C
  1997.     STA    D$0A5C
  1998.     STA    D$0A65
  1999.  
  2000.     LHLD    Do0995
  2001.     DAD    B
  2002.     SHLD    D$0A5A
  2003.     SHLD    D$0A63
  2004.     POP    B
  2005.  
  2006.     LDA    Do0A69
  2007.     ANI    0FH        ; 15 
  2008.     CMA
  2009.     INR    A
  2010.     CALL    Co0A2C
  2011.     STA    D$0A59
  2012.     STA    D$0A68
  2013.     CALL    Co0A40
  2014.  
  2015.     LHLD    Do0995
  2016.     DAD    B
  2017.     SHLD    D$0A57
  2018.     SHLD    D$0A66
  2019.  
  2020.     POP    PSW
  2021.     POP    D
  2022.     POP    B
  2023.     POP    H
  2024.     RET
  2025. ;
  2026. ;--------------------------------
  2027. ;
  2028. Co0A2C:    MOV    E,A
  2029.     LDA    Do099A
  2030.     ADD    E
  2031.     MOV    E,A
  2032.     ANI    0F0H
  2033.     JZ    J$0A38
  2034.     INX    B
  2035. J$0A38:    MOV    A,E
  2036.     RLC
  2037.     RLC
  2038.     RLC
  2039.     RLC
  2040.     ANI    0F0H
  2041.     RET
  2042. ;
  2043. ;--------------------------------
  2044. ;
  2045. Co0A40:    MOV    A,C
  2046.     CMA
  2047.     MOV    C,A
  2048.     MOV    A,B
  2049.     CMA
  2050.     MOV    B,A
  2051.     INX    B
  2052.     RET
  2053. ;
  2054. ;--------------------------------
  2055. ;
  2056. Co0A48:    DAD    D
  2057.     INR    C
  2058.     JC    Co0A48
  2059.     DCR    C
  2060.     RET
  2061. ;
  2062. ;--------------------------------
  2063. ;
  2064. radius:    DB    00H,00H
  2065. Do0A51:    DB    00H,00H
  2066. D$0A53:    DB    00H
  2067. D$0A54:    DB    00H,00H
  2068. D$0A56:    DB    00H
  2069. D$0A57:    DB    00H,00H
  2070. D$0A59:    DB    00H
  2071. D$0A5A:    DB    00H,00H
  2072. D$0A5C:    DB    00H
  2073. D$0A5D:    DB    00H,00H
  2074. D$0A5F:    DB    00H
  2075. D$0A60:    DB    00H,00H
  2076. D$0A62:    DB    00H
  2077. D$0A63:    DB    00H,00H
  2078. D$0A65:    DB    00H
  2079. D$0A66:    DB    00H
  2080.     DB    00H
  2081. D$0A68:    DB    00H
  2082. Do0A69:    DB    00H
  2083. ;
  2084. ;--------------------------------
  2085. ;
  2086. garc32:    LHLD    radius
  2087.     DCX    H
  2088.     SHLD    FIGSP4
  2089.     DAD    H
  2090.     SHLD    FIGSP6
  2091.     LXI    H,3FFFH
  2092.     SHLD    FIGSP8
  2093.     LXI    H,0000H
  2094.     SHLD    FIGSPA
  2095.     RET
  2096. ;
  2097. ;--------------------------------
  2098. ;
  2099. garc41:    LDA    Do0AE6
  2100.     ANI    01H        ; 1 
  2101.     JZ    J$0AAA
  2102.     LDA    Do0AE9
  2103.     CPI    2DH        ; "-"
  2104.     JNZ    J$0A95
  2105.     CALL    Co0CAA
  2106. J$0A95:    LDA    Do0AE9
  2107.     MOV    L,A
  2108.     MVI    H,00H
  2109.     CALL    Co0D09
  2110.     LXI    B,0001H
  2111.     LXI    H,FIGSPA
  2112.     CALL    Co0CA6
  2113.     JMP    J$0AC5
  2114. ;
  2115. ;--------------------------------
  2116. ;
  2117. J$0AAA:    CALL    Co0CAA
  2118.     LDA    Do0AED
  2119.     ANI    01H        ; 1 
  2120.     JZ    J$0AB9
  2121.     LXI    H,FIGSP2
  2122.     INR    M
  2123. J$0AB9:    MVI    A,2DH        ; "-"
  2124.     LXI    H,Do0AE9
  2125.     SUB    M
  2126.     MOV    L,A
  2127.     MVI    H,00H
  2128.     CALL    Co0D13
  2129. J$0AC5:    RET
  2130. ;
  2131. ;--------------------------------
  2132. ;
  2133. garc33:    MVI    B,0FFH
  2134.     LHLD    angleS
  2135.     LXI    D,0FFD3H
  2136. J$0ACE:    DAD    D
  2137.     INR    B
  2138.     JC    J$0ACE
  2139.     LXI    H,Do0AEB
  2140.     MOV    M,B
  2141.     MVI    B,0FFH
  2142.     LHLD    angleE
  2143. J$0ADC:    DAD    D
  2144.     INR    B
  2145.     JC    J$0ADC
  2146.     LXI    H,Io0AEC
  2147.     MOV    M,B
  2148.     RET
  2149. ;
  2150. ;--------------------------------
  2151. ;
  2152. Do0AE6:    DB    00H
  2153. Do0AE7:    DB    00H,00H
  2154. Do0AE9:    DB    00H,00H
  2155. Do0AEB:    DB    00H
  2156. Io0AEC:    DB    00H
  2157. Do0AED:    DB    00H
  2158. ;
  2159. ;--------------------------------
  2160. ;
  2161. garc35:    LHLD    angleS
  2162.     MOV    C,L
  2163.     MOV    B,H
  2164.     CALL    Co0A40
  2165.     LHLD    angleE
  2166.     DAD    B
  2167.     MOV    A,H
  2168.     ANI    80H
  2169.     JZ    J$0B09
  2170.     LXI    H,0168H        ; = 360
  2171.     DAD    B
  2172.     XCHG
  2173.     LHLD    angleE
  2174.     DAD    D
  2175. J$0B09:    SHLD    Do0AE7
  2176.     RET
  2177. ;
  2178. ;--------------------------------
  2179. ;
  2180. garc36:    LDA    Do0AEB
  2181.     RLC
  2182.     MVI    D,00H
  2183.     MOV    E,A
  2184.     LXI    H,table1
  2185.     DAD    D
  2186.     MOV    E,M
  2187.     INX    H
  2188.     MOV    D,M
  2189.     XCHG
  2190.     PUSH    H
  2191.     LHLD    angleS
  2192.     MOV    B,H
  2193.     MOV    C,L
  2194.     CALL    Co0A40
  2195.     POP    H
  2196.     DAD    B
  2197.     MOV    A,L
  2198.     STA    Do0AE9
  2199.     RET
  2200. ;
  2201. ;--------------------------------
  2202. ; Error: table angleS/octants ? (8 datas)
  2203. ;
  2204. table1:    DW     2D00H        ; ?
  2205.     DW     5A00H        ; ?
  2206.     DW     8700H        ; ?
  2207.     DW    0B400H        ; ?
  2208.     DW    0E100H        ; ?
  2209.     DW     0E01H        ; ?
  2210.     DW     3B01H        ; ?
  2211.     DW     6801H        ; ?
  2212. ;
  2213. ;--------------------------------
  2214. ;
  2215. garc42:    LDA    Do0AE6
  2216.     RLC
  2217.     LXI    H,Do0AE6
  2218.     ADD    M
  2219.     MOV    C,A
  2220.     MVI    B,00H
  2221.     LXI    H,table2
  2222.     DAD    B
  2223.     PUSH    H
  2224.     MOV    A,M
  2225.     MOV    E,A
  2226.     INX    H
  2227.     MOV    A,M
  2228.     MOV    D,A
  2229.     XCHG
  2230.     CALL    outCRS        ; CURS: position cursor
  2231.     POP    H
  2232.     INX    H
  2233.     INX    H
  2234.     MOV    A,M
  2235.     LXI    H,FIGSP1    ; Get FIGS P1 (first param)
  2236.     ORI    20H        ; Reset Arc bit
  2237.     MOV    M,A
  2238.     CALL    outFG2        ; FIGS and switch Graphics Drawing flag
  2239.     MVI    A,6CH        ; FIGD: Draw the Arc
  2240.     CALL    outA
  2241.     RET
  2242. ;
  2243. ;--------------------------------
  2244. ;
  2245. ; Table of addr + byte (between 00H and 07H)
  2246. ;
  2247. table2:    DW    D$0A5A        ; ?
  2248.     DB    04H        ; ?
  2249.  
  2250.     DW    Do0A51        ; ?
  2251.     DB    01H        ; ?
  2252.  
  2253.     DW    Do0A51        ; ?
  2254.     DB    06H        ; ?
  2255.  
  2256.     DW    D$0A57        ; ?
  2257.     DB    03H        ; ?
  2258.  
  2259.     DW    D$0A57        ; ?
  2260.     DB    00H        ; ?
  2261.  
  2262.     DW    D$0A54        ; ?
  2263.     DB    05H        ; ?
  2264.  
  2265.     DW    D$0A54        ; ?
  2266.     DB    02H        ; ?
  2267.  
  2268.     DW    D$0A5A        ; ?
  2269.     DB    07H        ; ?
  2270. ;
  2271. ;--------------------------------
  2272. ;
  2273. garc51:    LDA    Do0AE9
  2274.     MOV    C,A
  2275.     MVI    B,00H
  2276.     CALL    Co0A40
  2277.     LHLD    Do0AE7
  2278.     DAD    B
  2279.     SHLD    Do0AE7
  2280.     RET
  2281. ;
  2282. ;--------------------------------
  2283. ;
  2284. garc52:    LDA    Do0AE6
  2285.     INR    A
  2286.     ANI    07H        ; 7 
  2287.     STA    Do0AE6
  2288.     RET
  2289. ;
  2290. ;--------------------------------
  2291. ;
  2292. garc53:    CALL    Co0CAA
  2293.     LDA    Do0AE6
  2294.     LXI    H,0001H
  2295.     SHLD    FIGSPA
  2296.     ANI    01H        ; 1 
  2297.     JNZ    Jo0BBE
  2298.     LXI    H,0000H
  2299.     SHLD    FIGSPA
  2300.     LDA    Do0AED
  2301.     ANI    01H        ; 1 
  2302.     JZ    Jo0BBE
  2303.     LXI    H,FIGSP2
  2304.     INR    M
  2305. Jo0BBE:    CALL    garc42
  2306.     RET
  2307. ;
  2308. ;--------------------------------
  2309. ;
  2310. garc37:    LDA    Do0AEB
  2311.     ANI    01H        ; 1 
  2312.     JZ    J$0BE5
  2313.  
  2314.     LHLD    angleS
  2315.     SHLD    Do0D24
  2316.     CALL    Co0C01
  2317.     CALL    Co0D09
  2318.  
  2319.     LHLD    angleE
  2320.     SHLD    Do0D24
  2321.     CALL    Co0C01
  2322.     CALL    Co0D13
  2323.     JMP    J$0BFD
  2324. ;
  2325. ;--------------------------------
  2326. ;
  2327. J$0BE5:    LHLD    angleE
  2328.     SHLD    Do0D24
  2329.     CALL    Co0C1C
  2330.     CALL    Co0D09
  2331.  
  2332.     LHLD    angleS
  2333.     SHLD    Do0D24
  2334.     CALL    Co0C1C
  2335.     CALL    Co0D13
  2336. J$0BFD:    CALL    garc42
  2337.     RET
  2338. ;
  2339. ;--------------------------------
  2340. ;
  2341. Co0C01:    LDA    Do0AEB
  2342.     RLC
  2343.     MVI    D,00H
  2344.     MOV    E,A
  2345.     LXI    H,table1
  2346.     DAD    D
  2347.     MOV    E,M
  2348.     INX    H
  2349.     MOV    D,M
  2350.     XCHG
  2351.     PUSH    H
  2352.     LHLD    Do0D24
  2353.     MOV    B,H
  2354.     MOV    C,L
  2355.     CALL    Co0A40
  2356.     POP    H
  2357.     DAD    B
  2358.     RET
  2359. ;
  2360. ;--------------------------------
  2361. ;
  2362. Co0C1C:    LDA    Do0AEB
  2363.     RLC
  2364.     MVI    D,00H
  2365.     MOV    E,A        ; DE = 00 + Do0AEB
  2366.     LXI    H,table3    ; HL = 0000
  2367.     DAD    D        ; HL = HL + DE
  2368.     MOV    E,M
  2369.     INX    H
  2370.     MOV    D,M        ; DE = M(HL)
  2371.     LHLD    Do0D24        ; HL = Do0D24
  2372.     DAD    D        ; HL = HL + DE
  2373.     RET
  2374. ;
  2375. ;--------------------------------
  2376. ;
  2377. ; Table ?
  2378. ;
  2379. table3:    DW     0000H        ; ?
  2380.     DW    0D3FFH        ; ?
  2381.     DW    0A6FFH        ; ?
  2382.     DW     79FFH        ; ?
  2383.     DW     4CFFH        ; ?
  2384.     DW     1FFFH        ; ?
  2385.     DW    0F2FEH        ; ?
  2386.     DW    0C5FEH        ; ?
  2387. ;
  2388. ;--------------------------------
  2389. ;
  2390. C$0C3F:    LDA    Do0AE7
  2391.     STA    Do0AE9
  2392.     CPI    00H
  2393.     RZ
  2394.     LDA    Do0AE6
  2395.     ANI    01H        ; 1 
  2396.     JZ    J$0C62
  2397.     CALL    Co0CAA
  2398.     MVI    A,2DH        ; "-"
  2399.     LXI    H,Do0AE9
  2400.     SUB    M
  2401.     MOV    L,A
  2402.     MVI    H,00H
  2403.     CALL    Co0D13
  2404.     JMP    J$0C71
  2405. ;
  2406. ;--------------------------------
  2407. ;
  2408. J$0C62:    LDA    Do0AE9
  2409.     MOV    L,A
  2410.     MVI    H,00H
  2411.     CALL    Co0D09
  2412.     LXI    H,0000H
  2413.     SHLD    FIGSPA
  2414. J$0C71:    CALL    garc42
  2415.     RET
  2416. ;
  2417. ;--------------------------------
  2418. ;
  2419. Co0C75:    MOV    A,L
  2420.     ORI    00H
  2421.     JNZ    J$0C81
  2422.     LXI    B,0000H
  2423.     JMP    Jo0CA5
  2424. ;
  2425. ;--------------------------------
  2426. ;
  2427. J$0C81:    LXI    B,table4
  2428.     DAD    B
  2429.     MOV    B,M
  2430.     LHLD    radius
  2431.     XCHG
  2432.     LHLD    radius
  2433. J$0C8D:    DAD    D
  2434.     MVI    C,00H
  2435.     JNC    J$0C95
  2436.     MVI    C,01H        ; 1 
  2437. J$0C95:    DCR    B
  2438.     MVI    A,00H
  2439.     CMP    B
  2440.     JNZ    J$0C8D
  2441.     MOV    B,C
  2442.     MOV    C,H
  2443.     MOV    A,L
  2444.     ANI    80H
  2445.     JZ    Jo0CA5
  2446.     INR    C
  2447. Jo0CA5:    RET
  2448. ;
  2449. ;--------------------------------
  2450. ;
  2451. Co0CA6:    MOV    M,C
  2452.     INX    H
  2453.     MOV    M,B
  2454.     RET
  2455. ;
  2456. ;--------------------------------
  2457. ;
  2458. Co0CAA:    LHLD    radius
  2459.     LXI    B,table5
  2460.     DAD    B
  2461.     MOV    C,M
  2462.     LDA    Do0AED
  2463.     ANI    01H        ; 1 
  2464.     JZ    J$0CCD
  2465.     MOV    A,C
  2466.     CMA
  2467.     INR    A
  2468.     ADI    7FH
  2469.     MOV    C,A
  2470.     LHLD    radius
  2471.     MVI    A,0B5H
  2472.     CMP    L
  2473.     JNZ    Jo0CD1
  2474.     DCR    C
  2475.     JMP    Jo0CD1
  2476. ;
  2477. ;--------------------------------
  2478. ;
  2479. J$0CCD:    MOV    A,C
  2480.     ADI    7FH
  2481.     MOV    C,A
  2482. Jo0CD1:    MVI    B,00H
  2483.     LXI    H,FIGSP2
  2484.     CALL    Co0CA6
  2485.     RET
  2486. ;
  2487. ;--------------------------------
  2488. ;
  2489. garc34:    MVI    A,00H
  2490.     STA    Do0AED
  2491.     LHLD    radius
  2492.     LXI    B,table5
  2493.     DAD    B
  2494.     MOV    B,M
  2495.     LDA    radius
  2496.     CPI    0B4H        ; = 180
  2497.     JNC    J$0CFD
  2498.     MOV    A,B
  2499.     ANI    80H
  2500.     JNZ    Jo0D08
  2501.     MVI    A,01H        ; 1 
  2502.     STA    Do0AED
  2503.     JMP    Jo0D08
  2504. ;
  2505. ;--------------------------------
  2506. ;
  2507. J$0CFD:    MOV    A,B
  2508.     ANI    80H
  2509.     JZ    Jo0D08
  2510.     MVI    A,01H        ; 1 
  2511.     STA    Do0AED
  2512. Jo0D08:    RET
  2513. ;
  2514. ;--------------------------------
  2515. ;
  2516. Co0D09:    CALL    Co0C75
  2517.     LXI    H,FIGSP2
  2518.     CALL    Co0CA6
  2519.     RET
  2520. ;
  2521. ;--------------------------------
  2522. ;
  2523. Co0D13:    CALL    Co0C75
  2524.     LXI    H,FIGSPA
  2525.     CALL    Co0CA6
  2526.     RET
  2527. ;
  2528. ;--------------------------------
  2529. ;
  2530. ?o0D1D:    DB    00H,00H,00H
  2531. ;
  2532. angleS:    DW    0000H        ; GCIRCL sets this to 0.
  2533. ;
  2534. angleE:    DW    0000H        ; GCIRCL sets this to 360.
  2535. ;
  2536. Do0D24:    DB    00H,00H
  2537. ;
  2538. ; Tables ?
  2539. ;
  2540. table4:    DB    00H,04H,09H,0DH,11H,16H,1AH,1FH
  2541.     DB    23H,28H,2CH,30H,35H,39H,3DH
  2542.     DB    42H,46H,4AH,4FH,53H,57H,5BH,5FH
  2543.     DB    64H,68H,6CH,70H,74H,78H,7CH,80H
  2544.     DB    83H,87H,8BH,8FH,92H,96H,9AH,9DH
  2545.     DB    0A1H,0A4H,0A7H,0ABH,0AEH,0B1H,0B4H
  2546. ;
  2547. table5:    DB    81H,82H,82H,7EH,83H,84H,7CH,7BH
  2548.     DB    86H,87H,79H,88H,89H,77H,76H,8BH
  2549.     DB    8CH
  2550.     DB    74H,8DH,8EH,72H,71H,90H,91H,6FH
  2551.     DB    92H,93H,6DH,6CH,95H,6BH,6AH,97H
  2552.     DB    98H,68H,99H,9AH,66H,65H,9CH,9DH
  2553.     DB    63H,9EH,9FH,61H,60H,0A1H,5FH,5EH
  2554.     DB    0A3H,0A4H,5CH,5BH,0A6H,5AH,59H,0A8H
  2555.     DB    0A9H,57H,0AAH,0ABH,55H,54H,0ADH,0AEH
  2556.     DB    52H,0AFH,0B0H,50H,4FH,0B2H,4EH,4DH
  2557.     DB    0B4H,0B5H,4BH,0B6H,0B7H,49H,48H,0B9H
  2558.     DB    0BAH,46H,0BBH,0BCH,44H,43H,0BEH,42H
  2559.     DB    41H,0C0H,0C1H,3FH,3EH,0C3H,3DH,3CH
  2560.     DB    0C5H,0C6H,3AH,0C7H,0C8H,38H,37H,0CAH
  2561.     DB    36H,35H,0CCH,0CDH,33H,32H,0CFH,31H
  2562.     DB    30H,0D1H,0D2H,2EH,0D3H,0D4H,2CH,2BH
  2563.     DB    0D6H,0D7H,29H,0D8H,0D9H,27H,26H,0DBH
  2564.     DB    25H,24H,0DDH,0DEH,22H,0DFH,0E0H,20H
  2565.     DB    1FH,0E2H,0E3H,1DH,0E4H,0E5H,1BH,1AH
  2566.     DB    0E7H,19H,18H,0E9H,0EAH,16H,15H,0ECH
  2567.     DB    14H,13H,0EEH,0EFH,11H,0F0H,0F1H,0FH
  2568.     DB    0EH,0F3H,0F4H,0CH,0F5H,0F6H,0AH,09H
  2569.     DB    0F8H,08H,07H,0FAH,0FBH,05H,0FCH,0FDH
  2570.     DB    03H,02H,0FFH,00H,0FFH,01H,02H,0FEH
  2571.     DB    0FDH,04H,0FCH,0FBH,06H,07H,0F9H,0F8H
  2572.     DB    09H,0F7H,0F6H,0BH,0CH,0F4H,0DH,0EH
  2573.     DB    0F2H,0F1H,10H,0F0H,0EFH,12H,13H,0EDH
  2574.     DB    0ECH,15H,0EBH,0EAH,17H,18H,0E8H,19H
  2575.     DB    1AH,0E6H,0E5H,1CH,1DH,0E3H,1EH,1FH
  2576.     DB    0E1H,0E0H,21H,0DFH,0DEH,23H,24H,0DCH
  2577.     DB    0DBH,26H,0DAH,0D9H,28H,29H,0D7H,2AH
  2578.     DB    2BH,0D5H,0D4H,2DH,0D3H,0D2H,2FH,30H
  2579.     DB    0D0H,0CFH,32H,0CEH,0CDH,34H,35H
  2580. ;
  2581. ;--------------------------------
  2582. ; Outputs a char on graphics screen
  2583. ;
  2584. gtext3:    PUSH    B
  2585.     PUSH    D
  2586.     PUSH    H
  2587.     ANI    7FH        ; ASCII chars only
  2588.     MOV    L,A
  2589.     MVI    H,00H        ; HL = ?
  2590.     DAD    H
  2591.     DAD    H
  2592.     DAD    H        ; 8 bytes
  2593.     DAD    H
  2594.     LXI    D,1000H        ; DE = ?
  2595.     DAD    D
  2596.     LXI    D,Io0F07    ; ?
  2597.     MVI    B,10H        ; 16 
  2598.     OUT    11H        ; ?
  2599. gtext4:    MOV    A,M
  2600.     STAX    D
  2601.     INX    H
  2602.     INX    D
  2603.     DCR    B
  2604.     JNZ    gtext4
  2605.     OUT    10H        ; ?
  2606.     POP    H
  2607.     POP    D
  2608.     POP    B
  2609.     RET
  2610. ;
  2611. ;--------------------------------
  2612. ; Initiates the drawing of the graphics character
  2613. ; (or area filling pattern) stored in Parameter RAM.
  2614. ;
  2615. gtext5:    CALL    outpat        ; Outputs pattern value
  2616.     LXI    H,gtextX    ; GTEXT unknown...
  2617.     CALL    outFGS
  2618.     MVI    A,GCHRD        ; GDC command
  2619.     CALL    outA
  2620.     RET
  2621. ;
  2622. ;--------------------------------
  2623. ;
  2624. gtext6:    LDA    valueZ        ; Zoom value ?
  2625.     INR    A
  2626.     MOV    B,A
  2627.     ADD    A
  2628.     ADD    A
  2629.     ADD    A
  2630.     MOV    L,A
  2631.     MVI    H,00H
  2632.     SHLD    Do0F19
  2633.  
  2634.     CALL    Co1002
  2635.     SHLD    Do0F1B
  2636.  
  2637.     LHLD    strtY2        ; Temporary startY
  2638.     SHLD    startY        ; Starting point Y
  2639.  
  2640.     LDA    gtextD        ; Test Direction D of text
  2641.  
  2642.     CPI    00H        ; 0
  2643.     JZ    Co0ED7
  2644.  
  2645.     CPI    01H        ; 1 
  2646.     CZ    Co0ED7
  2647.     JZ    Jo0EEF
  2648.  
  2649.     CPI    02H        ; 2 
  2650.     JZ    Jo0EEF
  2651.  
  2652.     CPI    03H        ; 3 
  2653.     CZ    Co0EE3
  2654.     JZ    Jo0EEF
  2655.  
  2656.     CPI    04H        ; 4 
  2657.     JZ    Co0EE3
  2658.  
  2659.     CPI    05H        ; 5 
  2660.     CZ    Co0EE3
  2661.     JZ    Jo0EFB
  2662.  
  2663.     CPI    06H        ; 6 
  2664.     JZ    Jo0EFB
  2665.     CALL    Co0ED7        ; 7
  2666.     JMP    Jo0EFB
  2667. ;
  2668. ;--------------------------------
  2669. ;
  2670. Co0ED7:    LHLD    startX        ; Starting point X
  2671.     XCHG
  2672.     LHLD    Do0F19        ; ?
  2673.     DAD    D
  2674.     SHLD    startX        ; Starting point X
  2675.     RET
  2676. ;
  2677. ;--------------------------------
  2678. ;
  2679. Co0EE3:    LHLD    startX        ; Starting point X
  2680.     XCHG
  2681.     LHLD    Do0F1B        ; ?
  2682.     DAD    D
  2683.     SHLD    startX        ; Starting point X
  2684.     RET
  2685. ;
  2686. ;--------------------------------
  2687. ;
  2688. Jo0EEF:    LHLD    strtY2        ; Temporary startY
  2689.     XCHG
  2690.     LHLD    Do0F19        ; ?
  2691.     DAD    D
  2692.     SHLD    startY        ; Starting point Y
  2693.     RET
  2694. ;
  2695. ;--------------------------------
  2696. ;
  2697. Jo0EFB:    LHLD    strtY2        ; Temporary startY
  2698.     XCHG
  2699.     LHLD    Do0F1B        ; ?
  2700.     DAD    D
  2701.     SHLD    startY        ; Starting point Y
  2702.     RET
  2703. ;
  2704. ;--------------------------------
  2705. ;
  2706. ; 16 octets en trop...
  2707. ;
  2708. Io0F07:    DB    00H,00H,00H,00H,00H,00H,00H,00H
  2709. ;
  2710. I$0F0F:    DB    00H,00H,00H,00H,00H,00H,00H,00H
  2711. ;
  2712. ; Set program counter P0E17
  2713. ;
  2714. strtY2:    DW    0000H        ; Temporary startY
  2715. ;
  2716. Do0F19:    DB    00H,00H
  2717. ;
  2718. Do0F1B:    DB    00H,00H
  2719. ;
  2720. I$0F1D:    DB    0DH,0EH
  2721.     DB    0AH,09H,0CH,0FH,0BH,08H,0AH,0EH
  2722.     DB    0CH,08H,0DH,0FH,0BH,09H
  2723. ;
  2724. ;--------------------------------
  2725. ;
  2726. line2:    PUSH    H
  2727.     PUSH    D
  2728.     PUSH    B
  2729.     PUSH    PSW
  2730.  
  2731.     XRA    A
  2732.     STA    Do1020
  2733.  
  2734.     LHLD    endX        ; Ending point X
  2735.     XCHG
  2736.     LHLD    startX        ; Starting point X
  2737.     MOV    C,L
  2738.     MOV    B,H
  2739.     CALL    Co0A40
  2740.     XCHG
  2741.     DAD    B
  2742.     CNC    Co1002
  2743.     SHLD    Do101C
  2744.  
  2745.     MVI    A,02H        ; 2 
  2746.     CC    Co100C
  2747.     LHLD    endY        ; Ending point Y
  2748.     CALL    Co0977
  2749.     SHLD    endY        ; Ending point Y
  2750.     XCHG
  2751.     LHLD    startY        ; Starting point Y
  2752.     MOV    C,L
  2753.     MOV    B,H
  2754.     CALL    Co0A40
  2755.     XCHG
  2756.     DAD    B
  2757.     CNC    Co1002
  2758.     SHLD    Do101E
  2759.  
  2760.     MVI    A,01H        ; 1 
  2761.     CC    Co100C
  2762.     XCHG
  2763.     LHLD    Do101C
  2764.     MOV    C,L
  2765.     MOV    B,H
  2766.     CALL    Co0A40
  2767.     XCHG
  2768.     DAD    B
  2769.     MVI    A,04H        ; 4 
  2770.     CC    Co100C
  2771.     MOV    A,L
  2772.     ORA    H
  2773.  
  2774.     MVI    A,08H        ; 8 
  2775.     CZ    Co100C
  2776.     LHLD    Do101E
  2777.     MOV    A,L
  2778.     ORA    H
  2779.     CZ    C$0FDD
  2780.     MOV    A,E
  2781.     ORA    D
  2782.     CZ    C$0FF1
  2783.  
  2784.     LDA    Do1020
  2785.     ANI    04H        ; 4 
  2786.     CZ    exHLDE        ; Exchange HL with DE...
  2787.     SHLD    FIGSP2
  2788.     MOV    C,L
  2789.     MOV    B,H
  2790.     CALL    Co0A40
  2791.     MOV    L,E
  2792.     MOV    H,D
  2793.     DAD    H
  2794.     SHLD    FIGSP8
  2795.  
  2796.     DAD    B
  2797.     SHLD    FIGSP4
  2798.     XCHG
  2799.     DAD    B
  2800.     DAD    H
  2801.     SHLD    FIGSP6
  2802.  
  2803.     LXI    H,3FFFH
  2804.     SHLD    FIGSPA        ; ?
  2805.  
  2806.     LXI    H,I$0F1D
  2807.     LXI    D,0000H
  2808.     LDA    Do1020
  2809.     MOV    C,A
  2810.     ANI    10H        ; 16 
  2811.     CNZ    C$0FF9
  2812.     MOV    E,C
  2813.     DAD    D
  2814.     MOV    A,M
  2815.     STA    FIGSP1        ; ?
  2816.  
  2817.     LHLD    endX        ; Ending point X
  2818.     SHLD    startX        ; Starting point X
  2819.  
  2820.     LHLD    endY        ; Ending point Y
  2821.     SHLD    startY        ; Starting point Y
  2822.  
  2823.     POP    PSW
  2824.     POP    B
  2825.     POP    D
  2826.     POP    H
  2827.     RET
  2828. ;
  2829. ;--------------------------------
  2830. ;
  2831. C$0FDD:    MVI    A,10H        ; 16 
  2832.     CALL    Co100C
  2833.     LDA    Do1020
  2834.     ANI    02H        ; 2 
  2835.     RZ
  2836.     LDA    Do1020
  2837.     ANI    0FCH
  2838.     STA    Do1020
  2839.     RET
  2840. ;
  2841. ;--------------------------------
  2842. ;
  2843. C$0FF1:    MVI    A,14H        ; 20 
  2844.     CALL    Co100C
  2845.     RET
  2846. ;
  2847. ;--------------------------------
  2848. ;
  2849. exHLDE:    XCHG            ; Exchange HL with DE...
  2850.     RET
  2851. ;
  2852. ;--------------------------------
  2853. ;
  2854. C$0FF9:    LDA    Do1020
  2855.     ANI    03H        ; 3 
  2856.     ORI    08H        ; 8 
  2857.     MOV    C,A
  2858.     RET
  2859. ;
  2860. ;--------------------------------
  2861. ;
  2862. Co1002:    PUSH    PSW
  2863.     MOV    A,L
  2864.     CMA
  2865.     MOV    L,A
  2866.     MOV    A,H
  2867.     CMA
  2868.     MOV    H,A
  2869.     INX    H
  2870.     POP    PSW
  2871.     RET
  2872. ;
  2873. ;--------------------------------
  2874. ;
  2875. Co100C:    PUSH    H
  2876.     LXI    H,Do1020
  2877.     ORA    M
  2878.     MOV    M,A
  2879.     POP    H
  2880.     RET
  2881. ;
  2882. ;--------------------------------
  2883. ;
  2884. ?o1014:    DB    00H,00H,00H,00H
  2885. ;
  2886. endX:    DW    0000H        ; End X coord of line
  2887. ;
  2888. endY:    DW    0000H        ; End Y coord of line
  2889. ;
  2890. Do101C:    DB    00H,00H        ; ?
  2891. ;
  2892. Do101E:    DB    00H,00H        ; ?
  2893. ;
  2894. Do1020:    DB    00H        ; ?
  2895. ;
  2896. FIGSP1:    DB    00H        ; FIGS params: P1
  2897. FIGSP2:    DB    00H        ; P2
  2898. FIGSP3:    DB    00H        ; P3
  2899. FIGSP4:    DB    00H        ; P4
  2900.     DB    00H        ; P5
  2901. FIGSP6:    DB    00H        ; P6
  2902.     DB    00H        ; P7
  2903. FIGSP8:    DB    00H        ; P8
  2904.     DB    00H        ; P9
  2905. FIGSPA:    DB    00H        ; P10 (PA in Hex)
  2906.     DB    00H        ; P11
  2907. ;
  2908. valueZ:    DB    00H        ; Zoom value
  2909. ;
  2910.     DB    00H        ; ?
  2911. ;
  2912. ;--------------------------------
  2913. ;
  2914. grect9:    PUSH    H
  2915.     PUSH    D
  2916.     PUSH    B
  2917.     PUSH    PSW
  2918.  
  2919.     CALL    Co105E
  2920.     DCX    H
  2921.     DCX    D
  2922.     SHLD    FIGSP4
  2923.     SHLD    FIGSPA
  2924.     XCHG
  2925.     SHLD    FIGSP6
  2926.  
  2927.     LXI    H,0003H
  2928.     SHLD    FIGSP2        ; ?
  2929.  
  2930.     LXI    H,3FFFH
  2931.     SHLD    FIGSP8        ; ?
  2932.  
  2933.     LDA    rectD
  2934.     ADI    02H        ; 2 ???
  2935.     ANI    07H        ; 7 ???
  2936.     ORI    40H
  2937.     STA    FIGSP1        ; 40H = rectangle
  2938.  
  2939.     POP    PSW
  2940.     POP    B
  2941.     POP    D
  2942.     POP    H
  2943.     RET
  2944. ;
  2945. ;--------------------------------
  2946. ;
  2947. Co105E:    LHLD    rectV
  2948.     XCHG
  2949.     LHLD    rectH
  2950.     LDA    rectD
  2951.     ANI    07H        ; 7 
  2952.     ADI    04H        ; 4 
  2953.     RET
  2954. ;
  2955. ;--------------------------------
  2956. ;
  2957. grec31:    PUSH    H
  2958.     PUSH    D
  2959.     PUSH    B
  2960.     PUSH    PSW
  2961.  
  2962.     CALL    Co105E
  2963.     XCHG
  2964.     MOV    A,H
  2965.     ANI    3FH        ; "?"
  2966.     MOV    H,A
  2967.     DCX    H
  2968.     SHLD    FIGSP2
  2969.     XCHG
  2970.     SHLD    FIGSP4
  2971.     SHLD    FIGSP6
  2972.  
  2973.     LXI    H,3FFFH
  2974.     SHLD    FIGSP8        ; ?
  2975.     SHLD    FIGSPA        ; ?
  2976.  
  2977.     LDA    rectD
  2978.     ADI    02H        ; 2 
  2979.     ANI    07H        ; 7 
  2980.     ORI    10H
  2981.     STA    FIGSP1        ; 10H = Graphics Character
  2982.  
  2983.     POP    PSW
  2984.     POP    B
  2985.     POP    D
  2986.     POP    H
  2987.     RET
  2988. ;
  2989. ;--------------------------------
  2990. ;
  2991. rectD:    DB    00H        ; GRECT direction ?
  2992. ;
  2993. valueD:    DB    00H,00H,00H    ; GRECT direction ?
  2994. ;
  2995. rectH:    DB    00H,00H,00H,00H    ; GRECT Horizontal
  2996. ;
  2997. rectV:    DB    00H,00H        ; GRECT Vertical
  2998. ;
  2999. ;--------------------------------
  3000. ; See CP/M sample file DUMP...
  3001. ;
  3002. finis:    LHLD    oldSP        ; Go back to calling routine
  3003.     SPHL
  3004.     RET
  3005. ; P.S.
  3006. ;      This program is so much similar to those
  3007. ; published by Digital Research, that I am ready
  3008. ; to bet that NCR paid DRI to program this driver.
  3009. ;--------------------------------
  3010. ;
  3011. oldSP:    DS    2        ; Entry SP value
  3012.     DS    32        ; 16 level stack
  3013. stack:                ; Typical DRI code
  3014. ;
  3015. ;--------------------------------
  3016. ;
  3017. the    END            ; CP/M REL file
  3018.  
  3019.