Table of Contents

DRAWS

Table Of Contents

  • [00008] DRAWS OVERLAYS FOR COMMAND EXECUTION
  • [00027] DRAWOV -DRAW- -RDRAW- -GDRAW-
  • [00358] -RORIGIN-
  • [00418] -RAT- -RATNM- -RDOT-
  • [00546] CIRCLE ROUTINE

Source Code

DRAWS.txt
  1. DRAWS
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK DRAWS 00 000 77/07/19 19.16
  4. IDENT PLAT18$
  5. LCC OVERLAY(PLATO,1,0)
  6. END
  7. IDENT DRAWS
  8. TITLE DRAWS OVERLAYS FOR COMMAND EXECUTION
  9. *
  10. *
  11. CST
  12. *
  13. *
  14. DRAWS$ OVFILE
  15. *
  16. *
  17. EXT PROC,PROCO
  18. EXT ERROROF
  19. EXT ILOC,VARCNT,VARADD
  20. EXT GETCODX
  21. EXT XDATA,YDATA,SCALXY
  22. EXT WINDBUF
  23. EXT XSLICE,SIMPLOT
  24. *
  25. *
  26. * /--- BLOCK DRAWOV 00 000 79/10/04 04.05
  27. TITLE DRAWOV -DRAW- -RDRAW- -GDRAW-
  28. *** DRAWOV -- OVERLAY FOR SLOW DRAW COMMANDS
  29. * ORIGINALLY WRITTEN BY B SHERWOOD
  30. * MODIFIED 6/74 FOR GDRAW/RDRAW D. SHIRER
  31. * REWRITTEN 10/10/75 L.A.WHITE
  32. *
  33. * IF -DRAW- COMMAND IS WINDOWED, WILL COME HERE.
  34. * -RDRAW- AND -GDRAW- BOTH COME HERE.
  35. *
  36. * ON ENTRY---
  37. * THERE IS AT LEAST 70 WORDS LEFT IN MOUT BUFFER.
  38. * OVARG1= -1 RDRAW
  39. * 0 DRAW
  40. * 1 GDRAW
  41. *
  42. * X5 = COMMAND WORD
  43. * BIT 59=CONTINUED DRAW FLAG
  44. * BIT 58=PACKED UP DRAW FLAG
  45. * (IGNORED BY THIS ROUTINE)
  46. * BITS 40-57=COUNT OF GETVAR CODES
  47. * BITS 20-39=FIRST GETVAR CODE
  48. * BITS 0-19=XSTOR OFFSET + COMMAND NUMBER
  49. *
  50. * THE TOP TWO BITS OF EACH GETVAR CODE ARE
  51. * USED AS FOLLOWS---
  52. * 00 = COARSE GRID GETVAR CODE
  53. * 01 = X-COORD FINE GRID GETVAR CODE
  54. * (FOLLOWING GETVAR CODE IS Y-COORD)
  55. * 10 = PACKED UP FINE GRID, 9BITS X, 9BITS Y
  56. * 11 = SKIP INDICATOR
  57. *
  58. * ROUTINE PROCEDURE---
  59. * GETVAR CODES PLACED IN VARBUF
  60. * CODES EVALUATED ONE AT A TIME,
  61. * PLACING RESULTS IN TEMPORARY BUFFER
  62. * RDRAW MAY THEN SCAN THE TEMPORARY BUFFER,
  63. * RELOCATING POINTS
  64. * THEN POINTS ARE OUTPUT INTO *MOUT* BUFFER,
  65. * WINDOWED IF NECESSARY.
  66. *
  67. * TEMPORARY BUFFER --
  68. DRWBUF EQU INFO MAY USE 64*2+EPSILON WORDS
  69. *
  70. * /--- BLOCK DRAW 00 000 78/05/05 01.16
  71. EJECT
  72. NDRAWOV OVRLAY
  73. BX6 X5
  74. AX6 60-XCODEL GET NO. OF VARS TO DECODE
  75. SX6 X6+1 ADD 1 TO INCLUDE COUNT ITSELF
  76. RJ GETCODX GETVAR CODES IN VARBUF
  77. MX6 -1 MARK *INFO* BUFFER USED
  78. SA6 JJSTORE
  79. SX6 DRWBUF BUFFER FOR X,Y
  80. SA6 ILOC ILOC->CURRENT BUFFER LOCATION
  81. SX6 VARBUF+1 X6 -> FIRST VARIABLE
  82. SA2 VARCNT
  83. SX7 X2-1 X7 = COUNT OF POINTS REMAINING
  84. *
  85. * GET NEXT GETVAR CODE ---
  86. * X7= COUNT OF POINTS LEFT
  87. * A2=ADDRESS OF VARCNT
  88. * X6->NEXT GETVAR CODE
  89. DRAWX5 ZR X7,DRAWEM IF DONE
  90. SA7 A2 UPDATE VARCNT
  91. SA2 X6 X2 = THIS GETVAR CODE
  92. SA6 VARADD UPDATE ->GETVAR CODES
  93. MX0 2
  94. BX5 -X0*X2 GETVAR CODE IN TOP OF X5
  95. BX2 X0*X2 TYPE OF CODE BITS IN X2
  96. LX2 2
  97. SB2 X2 00=COARSE, 01=FINE,
  98. JP *+1+B2 10=PACKED FINE, 11=SKIP
  99. + EQ CGDRAW COARSE GRID VERTEX
  100. + EQ FGDRAW FINE GRID VERTEX
  101. + EQ PKDRAW PACKED FINE GRID
  102. + MX6 2 -SKIP- TAG INDICATORS
  103. MX7 2
  104. DRAWX6 SX3 1 SINGLE GETVAR CODE USED
  105. EQ DRAWX8
  106. *
  107. DRAWX7 SX3 2 TWO GETVAR CODES USED
  108. * X6=X-COORD, X7=Y-COORD
  109. * X3=NUMBER OF GETVAR CODES USED
  110. DRAWX8 SA1 ILOC CURRENT -DRWBUF- POINTER
  111. SA6 X1 STORE -X-
  112. SA7 X1+1 STORE -Y-
  113. SX7 X1+2 UPDATE -DRWBUF- POINTER
  114. SA7 A1
  115. SA1 VARADD
  116. IX6 X1+X3 X6 -> NEXT GETVAR CODE
  117. SA2 VARCNT
  118. IX7 X2-X3 X7 = NEW COUNT OF TAGS LEFT
  119. EQ DRAWX5 AND GET NEXT GETVAR CODE
  120. * /--- BLOCK DRAW 00 000 76/08/21 22.23
  121. *
  122. * COARSE GRID VERTEX --- DRAW AND RDRAW ONLY
  123. CGDRAW NGETVAR ROW-COLUMN ARGUMENT IN X1
  124. CALL RCTOXY (X,Y) IN X6,X7
  125. SA2 OVARG1
  126. ZR X2,DRAWX6 JUMP IF DRAW
  127. SX1 8 CORRECT X FOR RDRAW
  128. IX6 X6+X1
  129. LX7 51 KEEP ONLY 9 BITS OF Y
  130. AX7 51
  131. EQ DRAWX6
  132. *
  133. * FINE GRID VERTEX ---
  134. FGDRAW SA2 OVARG1
  135. ZR X2,FGDRAWA IF -DRAW-
  136. NG X2,FGDRAWA IF -RDRAW-
  137. * FINE GRID -GDRAW-
  138. FGETVAR X OR R VALUE FOR -GDRAW-
  139. BX7 X1
  140. SA7 XDATA READY TO CONVERT SCALED X
  141. SA1 VARADD X1 = CURRENT VARBUF ADDRESS
  142. SA1 X1+1 X1 = NEXT -GETVAR- CODE
  143. BX5 X1
  144. FGETVAR -Y- OR -ANGLE- VALUE FOR GDRAW
  145. BX7 X1
  146. SA7 YDATA READY TO CONVERT Y
  147. CALL SCALXY CONVERT TO DOTS
  148. EQ DRAWX7
  149. *
  150. * FINE GRID -DRAW-
  151. * FINE GRID -RDRAW-
  152. FGDRAWA NGETVAR GET X VALUE FOR DRAW OR RDRAW
  153. BX6 X1
  154. SA6 ILOC+1 SAVE X VALUE
  155. SA1 VARADD X1 = CURRENT *VARBUF* ADDRESS
  156. SA1 X1+1 X1 = NEXT -GETVAR- CODE
  157. BX5 X1
  158. NGETVAR GET Y VALUE
  159. BX7 X1
  160. SA1 ILOC+1
  161. BX6 X1
  162. EQ DRAWX7
  163. *
  164. * PACKED DRAW COORDINATES, CAN ONLY BE -DRAW- COMMAND
  165. PKDRAW MX0 -9
  166. LX5 XCODEL POSITION LOWER
  167. BX7 -X0*X5 Y-COORDINATE
  168. LX5 -9
  169. BX6 -X0*X5 X-COORDINATE
  170. EQ DRAWX6
  171. * /--- BLOCK DRAWEM 00 000 75/12/09 21.30
  172. *
  173. * -GETVAR- CODES HAVE BEEN EVALUATED AND ARE ALL IN
  174. * FINE GRID NOW. -GDRAW- TAGS HAVE BEEN RELOCATED,
  175. * BUT -RDRAW- TAGS HAVE NOT BEEN YET. FIRST RELOCATE
  176. * -RDRAW- TAGS, AND THEN OUTPUT THE POINTS INTO THE
  177. * MOUT BUFFER. IF WINDOWING IS OFF, OUTPUTING THE
  178. * POINTS IS FAST AND EASY. IF NOT, OUTPUTING USES
  179. * THE -WINDOW- ROUTINE WHICH OUTPUTS THE POINTS
  180. * IN A VERY SLOW WAY.
  181. *
  182. *
  183. DRAWEM SA1 ILOC CALC NUMBER OF ARGS
  184. SX6 DRWBUF
  185. IX7 X1-X6
  186. SA7 VARCNT VARCNT = NO. OF ARGUMENTS
  187. SA6 A1 ILOC -> START OF BUFFER
  188. SA1 OVARG1
  189. PL X1,DRAWEM1 IF -GDRAW- OR -DRAW-
  190. *
  191. * * * DO -RDRAW- SIZING, ROTATING, RELOCATING
  192. * *
  193. * * X1 = X*SIZEX*COS - Y*SIZEY*SIN + X-ORIGIN
  194. * * Y1 = Y*SIZEY*COS + X*SIZEX*SIN + Y-ORIGIN
  195. *
  196. SA1 RORG RELOCATION ORIGIN
  197. SB2 X1 B2 = Y-ORIGIN
  198. AX1 18
  199. SB1 X1 B1 = X-ORIGIN
  200. *
  201. SA1 RSIZE LOAD SIZE FACTORS (*256)
  202. NZ X1,RDRAW1 IF SPECIFIED
  203. SX1 256 IF NOT SPECIFIED, USE SIZE 1
  204. SX2 256
  205. EQ RDRAW2
  206. RDRAW1 SX2 X1 SIGN EXTENSION ON SIZEY*256
  207. AX1 18 POSITION SIZEX
  208. SX1 X1 SIGN EXTENSION ON SIZEX*256
  209. RDRAW2 SA4 ROTATE LOAD SIN AND COS
  210. ZR X4,RDRAW3 IF NO ROTATION
  211. SX5 X4 SIGN EXTENSION ON COSINE*256
  212. AX4 18 POSITION SINE
  213. SX4 X4 SIGN EXTENSION ON SINE*256
  214. IX0 X1*X5 SIZEX*COS (*256*256)
  215. IX3 X2*X4 SIZEY*SIN (*256*256)
  216. IX5 X2*X5 SIZEY*COS (*256*256)
  217. IX4 X1*X4 SIZEX*SIN (*256*256)
  218. SB3 B0 INDICATE ROTATION
  219. EQ RDRAW4
  220. *
  221. RDRAW3 BX0 X1 SIZEX* COS=1
  222. LX0 8
  223. * MX3 0 SIZEY* SIN=0
  224. * MX4 0 SIZEX* SIN=0
  225. BX5 X2 SIZEY* COS=1
  226. LX5 8
  227. SB3 1 DONT HAVE TO MPY BY X3 OR X4
  228. * /--- BLOCK DRAWEM 00 000 78/01/07 19.32
  229. *
  230. RDRAW4 SA1 VARCNT NUMBER OF X AND Y COORDINATES
  231. SB4 X1 WILL RESET B4 LATER
  232. SA1 DRWBUF-2 ADDRESS OF COORDINATES
  233. *
  234. RDRAW5 SB4 B4-2 END TEST
  235. NG B4,RDRAW9 DONE WITH RELOCATION
  236. SA1 A1+2 X1 = X-COORDINATE
  237. PL X1,RDRAW6
  238. MX6 2 CHECK FOR -SKIP- OPTION
  239. BX6 X1-X6
  240. ZR X6,RDRAW5 GO TO NEXT COORD IF -SKIP-
  241. *
  242. * * X1 = X*SIZEX*COS - Y*SIZEY*SIN + X-ORIGIN
  243. * X1 * (X0) - X2 * (X3) + B1
  244. *
  245. * * Y1 = Y*SIZEY*COS + X*SIZEX*SIN + Y-ORIGIN
  246. * X2 * (X5) + X1 * (X4) + B2
  247. *
  248. RDRAW6 SA2 A1+1 X2 = Y-COORDINATE
  249. IX6 X1*X0 X * (SIZEX*COS)
  250. IX7 X2*X5 Y * (SIZEY*COS)
  251. NZ B3,RDRAW7 IF SINES ARE ZERO
  252. IX2 X2*X3 Y * (SIZEY*SIN)
  253. IX1 X1*X4 X * (SIZEX*SIN)
  254. IX6 X6-X2 X1 = X*SIZEX*COS - Y*SIZEY*SIN
  255. IX7 X7+X1 Y1 = Y*SIZEY*COS + X*SIZEX*SIN
  256. * ROUNDING ISN'7T NECESSARY FOR MOST APPLICATIONS,
  257. * BUT IS DONE HERE FOR THOSE FEW THAT IT IMPROVES.
  258. RDRAW7 MX1 1 ROUND POINTS
  259. LX1 16 CREATE POSITIVE .5*256*256
  260. BX2 X6 ROUND X WITH +.5 OR -.5
  261. AX2 60
  262. BX2 X2-X1
  263. IX6 X6+X2
  264. BX2 X7 SIMILARLY, ROUND Y
  265. AX2 60
  266. BX2 X2-X1
  267. IX7 X7+X2
  268. AX6 16 REMOVE 256*256 BIAS
  269. AX7 16
  270. SX6 X6+B1 ADD X-ORIGIN
  271. SX7 X7+B2 ADD Y-ORIGIN
  272. SA6 A1 SAVE RELOCATED X
  273. SA7 A2 SAVE RELOCATED Y
  274. EQ RDRAW5
  275. *
  276. *
  277. *
  278. RDRAW9 EQ DRAWEM1 DONE WITH -RDRAW- RELOCATION
  279. *
  280. * /--- BLOCK DRAWEM 00 000 76/06/13 19.59
  281. EJECT
  282. *
  283. * *ILOC* -> DRWBUF
  284. * THE POINTS ARE NOW IN *DRWBUF*, TWO WORDS PER
  285. * POINT WITH (X,Y). -SKIP- IS INDICATED BY THE
  286. * TOP TWO BITS OF EACH (X,Y) BEING SET, REST OF
  287. * WORD 0. THE TOP BIT OF THE COMMAND WORD IS
  288. * SET IF IT IS A CONTINUED DRAW. *VARCNT* HOLDS
  289. * THE NUMBER OF WORDS OF *DRWBUF* THAT ARE USED.
  290. *
  291. * NOW PLACE THE POINTS IN THE *MOUT* BUFFER.
  292. *
  293. DRAWEM1 SA1 TBWNDOW CAN USE FAST OUTPUT CODE
  294. ZR X1,DRAWEM2 IF NOT WINDOWED
  295. SA5 A5 CHECK FOR NEEDED -AT-
  296. SA1 ILOC X1 -> BUFFER
  297. SA2 VARCNT X2 = NO. WORDS IN BUFFER
  298. RJ WINDBUF OUTPUT WINDOWED LINES
  299. EQ PROCO DONE WITH COMMAND
  300. *
  301. * DRAW POINTS IN *DRWBUF*
  302. * NOT WINDOWED
  303. * USE FAST OUTPUT -DRWCODE-
  304. *
  305. DRAWEM2 SA1 VARCNT
  306. SB1 1 B1 = CONSTANT 1
  307. SB2 B1+B1 B2 = CONSTANT 2
  308. AX1 1 NUMBER OF (X,Y) PAIRS
  309. SB3 X1 B3 = NUMBER OF (X,Y) PAIRS
  310. SA2 MOUTLOC CURRENT OUTPUT POINTER
  311. SX3 X1+B1 NO. WORDS TO BE PUT IN MOUT
  312. IX6 X2+X3
  313. SX7 X6-MOUTLTH CHECK FOR OVERFLOW
  314. PL X7,ERROROF OUTPUT BUFFER OVERFLOW
  315. SA6 A2 UPDATE MOUT POINTER
  316. SX6 SKPCODE ASSUME NOT CONTINUED DRAW
  317. SA5 A5 CHECK CONTINUED FLAG
  318. + PL X5,*+1
  319. SX6 CDWCODE MARK CONTINUED DRAW
  320. + LX3 12
  321. LX1 24
  322. BX6 X6+X3 WITH COUNT OF WORDS
  323. BX6 X6+X1 AND COUNT OF POINTS
  324. SA6 MOUT+X2 OUTPUT HEADER
  325. SA1 DRWBUF-2 PREPARE FOR LOOP
  326. MX3 2 SKIP INDICATOR
  327. MX0 -9 ON SCREEN MASK
  328. *
  329. * NOW OUTPUT THE POINTS INTO MOUT BUFFER
  330. DRWLOOP SB3 B3-B1 LOOP COUNTER
  331. NG B3,DRWEND END TEST
  332. SA1 A1+B2 GET NEXT X-COORDINATE
  333. BX4 X1-X3 CHECK FOR SKIP
  334. ZR X4,DRWLOOP1 IF SKIP
  335. SA2 A1+B1 GET Y-COORDINATE
  336. BX6 -X0*X1 MASK (X,Y) ON SCREEN
  337. BX7 -X0*X2
  338. LX6 9 FORM (X,Y) FOR OUTPUT
  339. BX6 X6+X7
  340. SA6 A6+B1 OUTPUT COMPLETED (X,Y)
  341. EQ DRWLOOP
  342. *
  343. * -SKIP- COORDINATE
  344. DRWLOOP1 MX6 2 OUTPUT SKIP INDICATOR
  345. LX6 20
  346. SA6 A6+B1
  347. EQ DRWLOOP
  348. *
  349. * END OF OUTPUT LOOP -- UPDATE (NX,NY) FROM LAST POINT
  350. DRWEND BX6 X1
  351. BX7 X2
  352. SA6 NX
  353. SA7 NY
  354. EQ PROCO DONE WITH COMMAND
  355. *
  356. ENDOV
  357. * /--- BLOCK RORIGIN 00 000 77/10/20 18.41
  358. TITLE -RORIGIN-
  359. *** RORIGIN - SPECIFY ORIGIN FOR RELOCATABLE COMMANDS
  360. * WRITTEN 11/15/75 L.A.WHITE
  361. * MADE RORIGIN DO IMPLICIT -RAT- 0,0 7/22/76 DLS
  362. *
  363. * -RORIGIN-
  364. * ZERO TAGS - ORIGIN AT CURRENT WHEREX,WHEREY
  365. * ONE TAG - COARSE GRID ORIGIN
  366. * TWO TAGS - FINE GRID ORIGIN
  367. * EXECUTION CONSISTS OF STORING ORIGIN
  368. * SPECIFICATION IN *RORG* IN THE STUDENT BANK.
  369. *
  370. * OVARG1 /0 RORIGIN, /1 RAT, /2 RATNM, 3/ RDOT
  371. *
  372. RORGOV OVRLAY
  373. SA1 OVARG1 SEE IF -RORIGIN-
  374. NZ X1,RATOV IF -RAT- OR -RATNM- (1,2)
  375. *
  376. * EXECUTE -RORIGIN-
  377. NG X5,RORG0 IF NO TAGS
  378. NGETVAR RETURN X1 = FIRST TAG
  379. SA5 A5 RETREIVE COMMAND WORD
  380. LX5 XCODEL
  381. NG X5,RORG1 IF ONLY ONE TAG
  382. BX6 X1 SAVE X-ORIGIN
  383. SA6 ILOC
  384. NGETVAR RETURN X1 = Y-ORIGIN
  385. BX7 X1 Y-ORIGIN
  386. SA1 ILOC
  387. BX6 X1 X-ORIGIN
  388. EQ RORG2
  389. *
  390. RORG0 SA1 NX SET ORIGIN TO WHEREX,WHEREY
  391. SA2 NY
  392. MX0 -18
  393. BX6 -X0*X1 MASK X-ORIGIN
  394. BX7 -X0*X2 MASK Y-ORIGIN
  395. LX6 18
  396. BX6 X6+X7
  397. SA6 RORG 24/0, 18/XORG, 18/YORG
  398. EQ PROC NO NEED TO RESET NX,NY
  399. *
  400. RORG1 CALL RCTOXY
  401. RORG2 MX0 -18
  402. BX6 -X0*X6 MASK X-ORIGIN
  403. BX7 -X0*X7 MASK Y-ORIGIN
  404. SA6 NX
  405. SA7 NY UPDATE SCREEN -WHERE-
  406. LX6 18
  407. BX6 X6+X7
  408. SA6 RORG 24/0, 18/XORG, 18/YORG
  409. SA1 NX GET BACK NX
  410. MX0 -9
  411. BX6 -X0*X1 MASK TO 9 BIT SCREEN VALUE
  412. BX7 -X0*X7
  413. LX6 9
  414. BX1 X6+X7
  415. EQ RAT9 SET MARGINS
  416. *
  417. * /--- BLOCK RAT RDOT 00 000 77/10/20 18.42
  418. TITLE -RAT- -RATNM- -RDOT-
  419. *** RAT - RELOCATABLE -AT-
  420. *** RATNM - RELOCATABLE -AT- WITHOUT SETTING MARGINS
  421. *** RDOT - RELOCATABLE -DOT-
  422. * WRITTEN 11/15/75 L.A.WHITE
  423. * MODIFIED 06/28/76 L.A.WHITE
  424. *
  425. * -RAT- OVARG1 = 1
  426. * -RATNM- = 2
  427. * -RDOT- = 3
  428. * ZERO TAGS - TO CURRENT RORIGIN
  429. * ONE TAG - COARSE GRID LOCATION
  430. * TWO TAGS - FINE GRID LOCATION
  431. * EXECUTION CONSISTS OF DOING AN -AT- OR -DOT- TO
  432. * THE GIVEN POSITION AFTER RELOCATING FROM *RORG*
  433. *
  434. RATOV NG X5,RAT0 IF BLANK TAG
  435. NGETVAR RETURN X1 = FIRST TAG
  436. SA5 A5 RETRIEVE COMMAND WORD
  437. LX5 XCODEL
  438. NG X5,RAT1 IF ONLY ONE TAG
  439. BX6 X1 SAVE X-COORDINATE
  440. SA6 ILOC
  441. NGETVAR RETURN X1 = Y-COORDINATE
  442. BX7 X1 Y-COORDINATE
  443. SA1 ILOC
  444. BX6 X1 X-COORDINATE
  445. EQ RAT2
  446. *
  447. RAT0 MX6 0 BLANK TAG HAS
  448. MX7 0 ZERO OFFSET
  449. EQ RAT7 FROM ORIGIN
  450. *
  451. RAT1 CALL RCTOXY
  452. SX1 8 FIX UP X
  453. IX6 X6+X1
  454. LX7 51 KEEP ONLY 9 BITS OF Y
  455. AX7 51
  456. *
  457. * SIZE THE OFFSETS
  458. RAT2 SA1 RSIZE
  459. NZ X1,RAT3 IF SIZE NON ZERO
  460. LX6 8 IF ZERO, MAKE SIZE ONE
  461. LX7 8 DITTO
  462. EQ RAT4
  463. RAT3 SX2 X1 SIGN EXTENSION ON SIZEY*256
  464. AX1 18 POSITION SIZEX
  465. SX1 X1 SIGN EXTENSION ON SIZEX*256
  466. IX6 X6*X1 SIZE X-OFFSET
  467. IX7 X7*X2 SIZE Y-OFFSET
  468. * /--- BLOCK RAT 00 000 77/10/20 18.42
  469. *
  470. * ROTATE THE OFFSETS
  471. RAT4 SA1 ROTATE
  472. NZ X1,RAT5 IF ROTATE SPECIFIED
  473. LX6 8 IF NOT, LEAVE ALONE
  474. LX7 8
  475. EQ RAT6
  476. RAT5 SX2 X1 SIGN EXTENSION ON COSINE*256
  477. AX1 18 POSITION SINE
  478. SX1 X1 SIGN EXTENSION ON SINE*256
  479. IX3 X6*X1 X*SIN
  480. IX4 X7*X1 Y*SIN
  481. IX6 X6*X2 X*COS
  482. IX7 X7*X2 Y*COS
  483. IX6 X6-X4 X1 = X*COS - Y*SIN
  484. IX7 X7+X3 Y1 = Y*COS + X*SIN
  485. RAT6 MX1 1 ROUND THE POINTS
  486. LX1 8+8 .5 (*256*256)
  487. BX2 X6 NEED +-.5 ACCORDING TO SIGN
  488. AX2 60
  489. BX2 X2-X1 + OR - .5
  490. IX6 X6+X2 ROUNDED X OFFSET (*256*256)
  491. BX3 X7
  492. AX3 60
  493. BX3 X3-X1
  494. IX7 X7+X3 ROUNDED Y OFFSET (*256*256)
  495. AX6 8+8 CORRECT FOR FACTOR OF 256*256
  496. AX7 8+8 DITTO
  497. *
  498. * RELOCATE THE OFFSETS (X6,X7 = OFFSETS)
  499. RAT7 SA1 RORG GET ORIGIN LOCATION
  500. SX2 X1 SIGN EXTENSION ON Y-ORIGIN
  501. AX1 18 POSITION X-ORIGIN
  502. SX1 X1 SIGN EXTENSION ON X-ORIGIN
  503. IX6 X1+X6 X-POSITION
  504. IX7 X2+X7 Y-POSITION
  505. *
  506. MX0 -18 CUT DOWN TO 18 BITS,
  507. BX6 -X0*X6 LIKE -ATNM- COMMAND.
  508. BX7 -X0*X7 'I DON'7T KNOW WHY.
  509. *
  510. SA6 NX UPDATE X-POSITION
  511. SA7 NY UPDATE Y-POSITION
  512. MX0 -9 POSITION SO ON-SCREEN
  513. BX6 -X0*X6
  514. BX7 -X0*X7
  515. LX6 9 PREPARE FOR -AT-
  516. BX1 X6+X7 -AT- LOCATION
  517. SA2 OVARG1
  518. SX2 X2-2
  519. ZR X2,RATED IF -RATNM-, DONT SET MARGINS
  520. PL X2,RDOTED IF -RDOT-
  521. *
  522. RAT9 AX6 9
  523. SA6 TBMARG SET X-MARGIN
  524. BX4 X1
  525. LX4 7+3 POSITION X/Y MARGIN FOR SIZE
  526. MX0 -18
  527. LX0 7+3 POSITION MASK
  528. SA2 TBWRITE
  529. BX2 X0*X2 CLEAR OUT OLD X/Y MARGIN
  530. BX4 -X0*X4 LIMIT TO 18 BITS -- BIF 8/27/76
  531. BX6 X2+X4
  532. SA6 A2 SET NEW X/Y MARGIN
  533. *
  534. OUTCODE WFMCODE FINE WHERE THAT SETS MARGIN
  535. EQ PROCO
  536. *
  537. RATED OUTCODE WFCODE FINE WHERE WITHOUT MARGINS
  538. EQ PROCO
  539. *
  540. RDOTED OUTCODE DFCODE -DOT-
  541. EQ PROCO
  542. *
  543. ENDOV
  544. *
  545. * /--- BLOCK CIRCLE 00 000 76/05/08 02.49
  546. TITLE CIRCLE ROUTINE
  547. *** CIRCLE - GENERATE CIRCLES BY DRAWING LINES
  548. * WRITTEN BY B.A.SHERWOOD
  549. *
  550. * MODIFIED 02/15/72 P.J.TENCZAR
  551. * PUT OUTPUT IN-LINE AND USE REGISTERS
  552. * (GAVE SPEED-UP BY A FACTOR OF ABOUT 2)
  553. * (A CIRCLE WITH RADIUS OF 64 TAKES ABOUT
  554. * 2 MILLISECONDS AND HAS 28 CHORDS)
  555. * THE WINDOWING COULD BE IMPROVED IF DESIRED.
  556. *
  557. * MODIFIED 11/15/75 L.A.WHITE
  558. * USES CURRENT *WHERE* POSITION FOR CENTER OF
  559. * CIRCLE. ADDED -RCIRCLE- COMMAND (SIZED,
  560. * RELOCATABLE, ROTATED ARCS). ADDED -GCIRCLE-
  561. * COMMAND (SCALED, RELOCATABLE). BOTH NEW
  562. * COMMANDS CAN DO ELLIPSES IF THE SCALES SO
  563. * SPECIFY.
  564. *
  565. *
  566. * -CIRCLE-
  567. * CIRCLE R OR
  568. * CIRCLE R,THETA1,THETA2
  569. * CIRCLEB R OR
  570. * CIRCLEB R,THETA1,THETA2
  571. * RCIRCLE R OR
  572. * RCIRCLE R,THETA1,THETA2
  573. * GCIRCLE R OR
  574. * GCIRCLE R,THETA1,THETA2
  575. *
  576. * DRAW A FULL OR PARTIAL CIRCLE, MAYBE DASHED.
  577. * R IS RADIUS, *WHEREX,WHEREY* IS THE CENTER,
  578. * THETA1 AND THETA2 THE INITIAL AND FINAL
  579. * ANGLES, MEASURED CCW FROM THE X-AXIS.
  580. *
  581. * ON ENTRY *OVARG1* IS
  582. * -1 CIRCLEB
  583. * 0 CIRCLE
  584. * 1 RCIRCLE
  585. * 2 GCIRCLE
  586. *
  587. * /--- BLOCK CIRCOV 00 000 76/08/16 16.29
  588. EJECT
  589. NCIRCOV OVRLAY
  590. MX6 -1 MARK *INFO* BUFFER USED
  591. SA6 JJSTORE
  592. *
  593. * GET RADIUS
  594. FGETVAR RETURN X1 = RADIUS
  595. BX7 X1 SAVE RADIUS
  596. *** KLUDGE FOR THE WEEK OF 7/18/76 TILL FIXED RIGHT LAW
  597. SA1 OVARG1
  598. SX1 X1-1
  599. PL X1,KDKD2 IF GCIRCLE/RCIRCLE, NO ROUNDING
  600. SA1 CHALF
  601. BX2 X7 .5 OF SAME SIGN AS RADIUS
  602. AX2 60
  603. BX1 X1-X2
  604. FX7 X7+X1 ADD .5 TO RADIUS
  605. NX7 X7
  606. KDKD2 BSS 0
  607. *** END KLUDGE
  608. SA7 INITX FULL CIRCLE INITX = RADIUS
  609. BX6 X7 STORE ABS(RADIUS)
  610. AX6 60
  611. BX6 X6-X7
  612. SA6 RADIUS
  613. MX7 0
  614. SA7 INITY FULL CIRCLE INITY = 0
  615. SA7 PCIRCLE NOT PARTIAL CIRCLE
  616. SA1 TWOPI
  617. BX7 X1
  618. SA7 ARC FULL CIRCLE ARC = 2*PI
  619. *
  620. * CHECK FULL CIRCLE ASSUMPTION
  621. SA5 A5 RETRIEVE COMMAND WORD
  622. LX5 XCODEL TOP BIT OF 2ND GETVAR CODE
  623. NG X5,CIRCOV1 IF FULL CIRCLE
  624. *
  625. * IS PARTIAL CIRCLE -- GET ANGLES
  626. SX7 1 INDICATE PARTIAL CIRCLE
  627. SA7 PCIRCLE
  628. FGETVAR RETURN X1 = INITIAL ANGLE
  629. SA2 RADDEG RADIANS PER DEGREE
  630. RX6 X1*X2 CONVERT TO RADIANS
  631. SA6 ARC SAVE INITIAL ANGLE TEMPORARILY
  632. CALL SINCOS GET SIN AND COS OF X6
  633. SA1 INITX COMPUTE INITIAL (X,Y)
  634. RX6 X6*X1 Y = SIN*RADIUS
  635. RX7 X7*X1 X = COS*RADIUS
  636. SA6 INITY
  637. SA7 A1
  638. *
  639. SA5 A5 RETREIVE COMMAND WORD
  640. AX5 XCMNDL
  641. MX0 2*XCODEL+XCMNDL
  642. BX5 -X0*X5
  643. SA1 X5+B5 GET EXTRA ARGUMENT WORD
  644. BX5 X1 GETVAR CODE TO TOP
  645. FGETVAR RETURN X1 = FINAL ANGLE
  646. SA2 RADDEG RADIANS PER DEGREE
  647. SA3 ARC STARTING ANGLE
  648. RX7 X1*X2 CONVERT TO RADIANS
  649. RX7 X7-X3 FINAL ANGLE - INITIAL ANGLE
  650. NX7 X7
  651. SA2 TWOPI MAXIMUM OF TWO PI
  652. BX6 X7 ABS(ARC) FOR TWOPI TEST
  653. AX6 60
  654. BX1 X7-X6 ABS(ARC)
  655. RX1 X2-X1 POSITIVE IF TWOPI>ABS(ARC)
  656. + PL X1,*+1 COMPARE ABS(ARC) WITH TWOPI
  657. BX7 X6-X2 USE TWOPI WITH SIGN OF ARC
  658. + SA7 ARC STORE LENGTH OF ARC TO DRAW
  659. *
  660. * /--- BLOCK CIRCOV1 00 000 77/10/20 18.25
  661. EJECT
  662. *
  663. * PROCESS ACCORDING TO COMMAND
  664. CIRCOV1 SA1 OVARG1
  665. SB1 X1
  666. JP *+1+B1
  667. + EQ CIRCL 0 = CIRCLE
  668. + EQ RCIRCL 1 = RCIRCLE
  669. + EQ GCIRCL 2 = GCIRCLE
  670. + EQ CIRCLB 3 = CIRCLEB
  671. SPACE 4
  672. *
  673. * * * CIRCLE B
  674. *
  675. CIRCLB SX6 CIRBCK ADDRESS OF PROCESSING ROUTINE
  676. SA6 ROUTINE
  677. SA1 RADIUS AVERAGE RADIUS
  678. EQ CIRCOV2
  679. *
  680. * * * CIRCLE
  681. *
  682. CIRCL SX6 CIRLP ADDRESS OF PROCESSING ROUTINE
  683. SA6 ROUTINE
  684. SA1 RADIUS AVERAGE RADIUS
  685. EQ CIRCOV2
  686. *
  687. * * * GCIRCLE
  688. *
  689. GCIRCL SA1 GDATA GET AXES INFO
  690. BX0 X1 SAVE IT FOR NEXT FEW LINES
  691. LX1 60-2*PFIELD
  692. AX1 60-PFIELD EXTEND SIGN OF (X+)
  693. NZ X1,GCIRCL1 USUALLY X+ IS NONZERO
  694. BX1 X0 IF NOT, USE X-
  695. LX1 60-4*PFIELD
  696. AX1 60-PFIELD
  697. GCIRCL1 PX1 X1
  698. NX1 X1 FLOAT (X+)
  699. SA2 GXMAX
  700. SA3 XOFFSET
  701. RX2 X2-X3 XMAX-XOFFSET
  702. NX2 X2
  703. RX3 X1/X2 (X+)/(XMAX-XOFFSET) (',SIZEX',)
  704. *
  705. BX1 X0 GET (Y+)
  706. LX1 60-PFIELD
  707. AX1 60-PFIELD EXTEND SIGN
  708. NZ X1,GCIRCL2 USUALLY Y+ IS NONZERO
  709. BX1 X0 IF NOT, USE Y-
  710. LX1 60-3*PFIELD
  711. AX1 60-PFIELD
  712. GCIRCL2 PX1 X1
  713. NX1 X1 FLOAT (Y+)
  714. SA2 GYMAX
  715. SA4 YOFFSET
  716. FX2 X2-X4 YMAX-YOFFSET
  717. NX2 X2
  718. RX6 X1/X2 (Y+)/(YMAX-YOFFSET) (',SIZEY',)
  719. *
  720. SA4 C256 X4 = 256. NEEDED BY RCIRCL
  721.  
  722. *** SAME CODE AS AT RCIRCL1 ***
  723. SB1 1 ASSUME SIZES EQUAL
  724. IX7 X3-X6 TEST SIZES EQUAL
  725. ZR X7,RCIRCL6 IF EQUAL
  726. SB1 -B1 INDICATE SIZES UNEQUAL
  727. *
  728. * IF SIZE=0, B1=0
  729. * SIZEX=SIZEY B1=1
  730. * SIZEX^=SIZEY B1=-1
  731. * X3 = FLOATING SIZE X
  732. * X6 = FLOATING SIZE Y
  733. *
  734. *
  735. EQ RCIRCL6 CONTINUE AS RCIRCLE
  736. * /--- BLOCK RCIRCL 00 000 76/09/05 14.31
  737. *
  738. * * * RCIRCLE
  739. *
  740. RCIRCL SA4 C256 X4 = 256.
  741. SA2 RSIZE --- SET UP SIZE ---
  742. SA3 C1 SET TO SIZE 1.
  743. BX6 X3
  744. SB1 B0 INDICATE SIZE ZERO
  745. ZR X2,RCIRCL2 IF SIZE=0, USE SIZE 1
  746. SX6 X2 256*SIZEY
  747. AX2 18
  748. SX3 X2 256*SIZEX
  749. PX3 X3
  750. NX3 X3
  751. PX6 X6
  752. NX6 X6
  753. RX3 X3/X4 X3 = FLOATING SIZE X
  754. RX6 X6/X4 X6 = FLOATING SIZE Y
  755. RCIRCL1 SB1 1 ASSUME SIZES EQUAL
  756. IX7 X3-X6 TEST SIZES EQUAL
  757. ZR X7,RCIRCL2 IF EQUAL
  758. SB1 -B1 INDICATE SIZES UNEQUAL
  759. *
  760. * IF SIZE=0, B1=0
  761. * SIZEX=SIZEY B1=1
  762. * SIZEX^=SIZEY B1=-1
  763. * X3 = FLOATING SIZE X
  764. * X6 = FLOATING SIZE Y
  765. *
  766. *
  767. RCIRCL2 SA2 ROTATE --- SET UP ROTATE ---
  768. ZR X2,RCIRCL6 IF ROTATE=0
  769. SX5 X2 256*COSINE OF ROTATION
  770. AX2 18
  771. SX0 X2 256*SINE OF ROTATION
  772. PX0 X0
  773. NX0 X0
  774. PX5 X5
  775. NX5 X5
  776. RX0 X0/X4 X0 = SIN
  777. RX5 X5/X4 X5 = COS
  778. GE B1,B0,RCIRCL4 IF SIZEX=SIZEY
  779. * SIZEX^=SIZEY, ROTATE^=0
  780. SX7 RCIRLP ADDRESS OF PROCESSSING ROUTINE
  781. SA7 ROUTINE
  782. RX7 X3*X0 SIZEX*SINE
  783. SA7 XSIN
  784. RX7 X3*X5 SIZEX*COSINE
  785. SA7 XCOS
  786. RX7 X6*X0 SIZEY*SINE
  787. SA7 YSIN
  788. RX7 X6*X5 SIZEY*COSINE
  789. SA7 YCOS
  790. RCIRCL3 BX2 X3
  791. BX4 X6
  792. AX2 60
  793. AX4 60
  794. BX2 X2-X3 ABS(SIZEX)
  795. BX4 X4-X6 ABS(SIZEY)
  796. RX4 X2+X4
  797. NX4 X4
  798. SA2 C2 =2.
  799. RX4 X4/X2 AVERAGE SIZE
  800. SA1 RADIUS
  801. RX1 X1*X4 AVERAGE RADIUS
  802. EQ CIRCOV2
  803. * /--- BLOCK RCIRCL4 00 000 76/01/24 13.29
  804. *
  805. * SIZEX=SIZEY, ROTATE^=0
  806. * PERFORM INITIAL ROTATION, SIZE THE RADIUS,
  807. * THEN IS A SIMPLE CIRCLE
  808. RCIRCL4 SA1 INITX
  809. SA2 INITY
  810. RX1 X1*X3 SIZE STARTING POINTS
  811. RX2 X2*X3
  812. RX6 X1*X5 X*COS
  813. RX7 X2*X0 Y*SIN
  814. RX6 X6-X7
  815. NX6 X6
  816. SA6 A1 NEW X = X*COS - Y*SIN
  817. RX6 X2*X5 Y*COS
  818. RX7 X1*X0 X*SIN
  819. RX6 X6+X7
  820. NX6 X6
  821. SA6 A2 NEW Y = Y*COS + X*SIN
  822. RCIRCL5 SA1 RADIUS
  823. BX2 X3
  824. AX2 60
  825. BX2 X2-X3 ABS(SIZE)
  826. RX6 X1*X2 RADIUS*ABS(SIZE)
  827. SA6 A1 NEW RADIUS
  828. EQ CIRCL NOW, IS A SIMPLE CIRCLE
  829. *
  830. * ROTATE=0
  831. RCIRCL6 ZR B1,CIRCL IF SIZE=0 IS SIMPLE CIRCLE
  832. NG B1,RCIRCL7 IF SIZEX^=SIZEY
  833. * ROTATE=0, SIZEX=SIZEY
  834. SA1 INITX SIZE INITIAL POINTS
  835. SA2 INITY
  836. RX6 X1*X3
  837. RX7 X2*X3
  838. SA6 A1
  839. SA7 A2
  840. EQ RCIRCL5
  841. *
  842. * ROTATE=0, SIZEX^=SIZEY
  843. RCIRCL7 SX7 GCIRLP ADDRESS OF PROCESSING ROUTINE
  844. SA7 ROUTINE
  845. SA6 YCOS SAVE SIZEY
  846. BX7 X3
  847. SA7 XCOS SAVE SIZEX
  848. EQ RCIRCL3
  849. *
  850. * /--- BLOCK CIRCOV2 00 000 77/10/20 18.31
  851. *
  852. * COMPUTE NUMBER OF CHORDS WANTED
  853. * ENTRY X1 = AVERAGE RADIUS
  854. *
  855. * IF THE NUMBER OF CHORDS WOULD OVERFLOW THE
  856. * OUTPUT BUFFER (OR TAKE TOO LONG TO COMPUTE),
  857. * IT IS REDUCED TO WHAT WILL FIT IN THE OUTPUT BUFFER.
  858. * THE ONLY DRAWBACK IS A SLIGHT REDUCTION IN
  859. * THE ',FINENESS', OF LARGE CIRCLES THAT ARE
  860. * ONLY PARTLY (OR NOT AT ALL) ON THE SCREEN.
  861. *
  862. CIRCOV2 SA2 C40 CHORDS/RADIAN = (3+RADIUS/40)
  863. RX7 X1/X2 (EMPIRICAL CRITERION)
  864. SA2 C3 =3.
  865. RX7 X2+X7
  866. SA4 ARC X4 = TOTAL ANGLE TO DRAW
  867. RX7 X4*X7 RADIANS * CHORDS PER RADIAN
  868. UX7 X7,B1 X7 = NUMBER OF CHORDS
  869. LX7 X7,B1
  870. BX0 X7 SET X7=ABS(X7)
  871. AX0 60
  872. BX7 X7-X0 X7 = POSITIVE NUMBER OF CHORDS
  873. SA3 OVARG1 X3 = TYPE OF CIRCLE FLAG
  874. SX1 X3-3 CHECK FOR BROKEN CIRCLE TYPE
  875. NZ X1,CIRTYPE 0,1,2 MEANS NORMAL CIRCLES
  876. MX3 -1 -1 MEANS BROKEN CIRCLES
  877. CIRTYPE BSS 0
  878. **
  879. SA1 MOUTLOC COMPUTE MAXIMUM CHORDS TO FIT
  880. SX2 MOUTLTH-10 LITTLE EXTRA ROOM
  881. IX2 X2-X1 X2 = ROOM LEFT
  882. NG X2,ERROROF .WOWWIE. ALREADY OVERFLOW
  883. IX6 X2-X7
  884. + PL X6,*+1 JUMP IF CIRCLE WILL FIT
  885. BX7 X2 USE ROOM LEFT IF WONT FIT
  886. + SA1 TBWNDOW IF WINDOWED, MAKE SURE
  887. ZR X1,CIRCOV3 ..INFO BUFFER WILL HOLD
  888. SX2 INFOLTH/2-10 ..ALL INTERMEDIATE POINTS
  889. + PL X3,*+1 IF NORMAL CIRCLES
  890. SX2 INFOLTH/3-10 ..CIRCLEB NEEDS MORE ROOM
  891. + IX6 X2-X7
  892. PL X6,*+1 JUMP IF CIRCLE WILL FIT
  893. BX7 X2 USE ROOM LEFT IF WONT FIT
  894. **
  895. CIRCOV3 PL X3,CIRCOV4 IF NOT CIRCLEB
  896. SA1 PCIRCLE REPLACE ODD/EVEN BIT
  897. MX6 59
  898. BX7 X6*X7
  899. BX7 X7+X1 WITH PARTIAL CIRCLE FLAG
  900. CIRCOV4 NZ X7,*+1 AT LEAST ONE ARC
  901. SX7 1
  902. + SA7 CHORDS STORE NUMBER OF CHORDS
  903. PX7 X7 DURN, BACK TO FLOATING AGAIN
  904. NX7 X7
  905. RX6 X4/X7 RADIANS PER CHORD
  906. CALL SINCOS TAKE SIN AND COS OF X6
  907. BX0 X6 X0 = SINE OF CHORD ANGLE
  908. BX5 X7 X5 = COSINE OF CHORD ANGLE
  909. *
  910. SA3 INITX X3 = INITIAL X OFFSET
  911. SA4 INITY X4 = INITIAL Y OFFSET
  912. *
  913. SX7 B5 SAVE B5
  914. SA7 SAVB5
  915. SX7 B7 SAVE B7
  916. SA7 SAVB7
  917. *
  918. * /--- BLOCK CIRCOV3 00 000 76/07/30 22.48
  919. *** IT SHOULD BE IMPOSSIBLE TO GET AN OUTPUT
  920. *** BUFFER OVERFLOW NOW... CHECKS LEFT IN
  921. *** HERE JUST TO MAKE SURE. LAW 7/30/76
  922. *
  923. SA2 CHORDS
  924. SB2 X2 B2 = NUMBER OF CHORDS TO OUTPUT
  925. SA1 MOUTLOC
  926. SX6 X1+B2
  927. SX6 X6+3-MOUTLTH
  928. PL X6,ERROROF
  929. *
  930. SA2 TBWNDOW
  931. NZ X2,CIRCOV5 IF WINDOWED
  932. MX6 0 CLEAR HEADER WORD FOR NOW
  933. SA6 MOUT+X1 A6 = MOUT LOCATION
  934. SB1 1 INDICATE NOT WINDOWED
  935. EQ CIRCOV6
  936. *
  937. CIRCOV5 SX6 B2+3-2*INFOLTH/3
  938. PL X6,ERROROF
  939. SB1 -1 INDICATE WINDOWED
  940. SA6 INFO START AT INFO+1
  941. *
  942. CIRCOV6 SA1 NX CENTER OF CIRCLE
  943. SA2 NY
  944. SB3 X1 B3 = X-CENTER
  945. SB4 X2 B4 = Y-CENTER
  946. *
  947. SA0 B3 LAST X POS
  948. SB7 B4 LAST Y POS
  949. *
  950. * GO TO THE CORRECT ROUTINE
  951. SA2 ROUTINE
  952. SB5 X2 TYPE OF CIRCLE TO DO
  953. JP B5 GO TO CORRECT ROUTINE
  954. *
  955. * /--- BLOCK CIRLP 00 000 76/09/11 17.01
  956. *
  957. * THE FOLLOWING ROUTINES PERFORM THE CALCULATIONS
  958. * FOR COMPUTING EACH END-CHORD POSITION AROUND THE
  959. * CIRCLE. ALL REGISTERS ARE USED.
  960. *
  961. * A B X
  962. *
  963. * 0 FINAL X - SIN OF CHORD ANGLE
  964. * 1 SCRATCH MULTI FLAG SCRATCH
  965. * 2 SCRATCH LOOP COUNT SCRATCH
  966. * 3 - X-CENTER CURRENT X
  967. * 4 - Y-CENTER CURRENT Y
  968. * 5 - ROUTINE ADR COS OF CHORD ANGLE
  969. * 6 OUTPUT LOC SCRATCH SCRATCH
  970. * 7 SCRATCH FINAL Y SCRATCH
  971. *
  972. * CIRCLES
  973. CIRLP BX6 X3 PLAIN CIRCLE
  974. BX7 X4
  975. CIRLP1 UX6 X6,B6 INTEGER X,Y
  976. LX6 X6,B6
  977. UX7 X7,B6
  978. LX7 X7,B6
  979. SX6 X6+B3 OFFSET X,Y FROM CENTER
  980. SX7 X7+B4
  981. NG B1,CIRLP4 IF WINDOWED
  982. BX1 X6+X7 SEE IF ON SCREEN
  983. AX1 9
  984. NZ X1,CIRLP3 IF OFF SCREEN
  985. NG X1,CIRLP3 IF OFF SCREEN
  986. SA0 X6 LAST X,Y
  987. SB7 X7
  988. LX6 9
  989. BX6 X6+X7 COMBINE (X,Y)
  990. SB1 1 INDICATE NO SKIPS IN PROGRESS
  991. SA6 A6+B1 OUTPUT POINT
  992. CIRLP2 SB2 B2-1
  993. LT B2,CIRDONE EXIT CONDITION
  994. RJ INCXY GET NEXT (X,Y) IN (X3,X4)
  995. JP B5 DO STUFF WITH (X,Y)
  996. *
  997. CIRLP3 ZR B1,CIRLP2 IF ALREADY SKIPPING
  998. MX6 2 OUTPUT SKIP
  999. LX6 20
  1000. SA6 A6+B1
  1001. SB1 B0 INDICATE SKIPPING
  1002. EQ CIRLP2
  1003. *
  1004. * WINDOWED CHORDS
  1005. CIRLP4 SA0 X6 LAST X,Y
  1006. SB7 X7
  1007. SA6 A6-B1 OUTPUT X,Y INTO TEMP BUFFER
  1008. BX6 X7
  1009. SA6 A6-B1
  1010. EQ CIRLP2
  1011. *
  1012. * DO RCIRCLE TYPE OPERATIONS
  1013. * ROTATED AND SIZEX^=SIZEY
  1014. RCIRLP SA1 XCOS SIZEX*COS
  1015. SA2 YSIN SIZEY*SIN
  1016. RX6 X3*X1 X*SIZEX*COS
  1017. RX7 X4*X2 Y*SIZEY*XIN
  1018. RX6 X6-X7 SIZED, ROTATED X
  1019. SA1 YCOS SIZEY*COS
  1020. SA2 XSIN SIZEX*SIN
  1021. RX7 X4*X1 Y*SIZEY*COS
  1022. RX2 X3*X2 X*SIZEX*SIN
  1023. RX7 X7+X2 SIZED, ROTATED Y
  1024. EQ CIRLP1
  1025. *
  1026. * DO GCIRCLE TYPE OPERATION
  1027. * NO ROTATION, SIZEX^=SIZEY
  1028. GCIRLP SA1 XCOS SIZEX*COS (COS=1)
  1029. SA2 YCOS SIZEY*COS
  1030. RX6 X3*X1 SIZED X
  1031. RX7 X4*X2 SIZED Y
  1032. EQ CIRLP1
  1033. * /--- BLOCK INCXY 00 000 76/01/13 00.21
  1034. *
  1035. * X1,X2,X6,X7 SCRATCH FOR COMPUTATION
  1036. * X3,X4 = CURRENT (X,Y) FLOATING POINT
  1037. * X0,X5 = (SIN,COS) OF CHORD ANGLE
  1038. *
  1039. * GET NEXT POINT FOR CIRCLE ROUTINES
  1040. INCXY EQ *
  1041. RX6 X3*X5 X*COS
  1042. RX7 X4*X0 Y*SIN
  1043. RX1 X4*X5 Y*COS
  1044. RX2 X3*X0 X*SIN
  1045. RX3 X6-X7 NEW X = X*COS-Y*SIN
  1046. NX3 X3
  1047. RX4 X1+X2 NEW Y = Y*COS+X*SIN
  1048. NX4 X4
  1049. EQ INCXY
  1050. * /--- BLOCK CIRBLP 00 000 76/05/13 20.35
  1051. *
  1052. *
  1053. CIRBCK NG B1,WCIRBLP IF WINDOWED
  1054. *
  1055. * NON-WINDOWED CIRCLEB
  1056. * OUTPUT THE POINTS
  1057. CIRBLP UX7 X3,B6 START (X,Y) IN (X3,X4)
  1058. LX7 X7,B6 INTEGER X
  1059. SX7 X7+B3 OFFSET X
  1060. SA7 INITX SAVE FIRST X
  1061. UX7 X4,B6
  1062. LX7 X7,B6 INTEGER Y
  1063. SX7 X7+B4 OFFSET Y
  1064. SA7 INITY SAVE FIRST Y
  1065. RJ INCXY GET NEXT (X,Y)
  1066. UX6 X3,B6
  1067. LX6 X6,B6 INTEGER X
  1068. SX6 X6+B3 OFFSET X
  1069. UX7 X4,B6
  1070. LX7 X7,B6 INTEGER Y
  1071. SX7 X7+B4 OFFSET Y
  1072. SA1 INITX RETRIEVE FIRST X
  1073. SA2 INITY RETRIEVE FIRST Y
  1074. BX1 X1+X2 SEE IF OFF SCREEN
  1075. BX1 X1+X6
  1076. BX1 X1+X7
  1077. AX1 9
  1078. NZ X1,CIRBLP1 IF OFF SCREEN
  1079. NG X1,CIRBLP1 IF OFF SCREEN
  1080. SA0 X6 LAST X
  1081. SB7 X7 LAST Y
  1082. LX6 9 NOT OFF SCREEN, COMBINE
  1083. BX6 X6+X7
  1084. LX2 20
  1085. BX6 X6+X2
  1086. SA1 A1 RETRIEVE FIRST X
  1087. LX1 20+9
  1088. BX6 X6+X1
  1089. MX7 2 INDICATE SKIP;X,Y;X,Y
  1090. BX6 X6+X7 ALL IN ONE WORD
  1091. SA6 A6+1 OUTPUT POINTS
  1092. CIRBLP1 SB2 B2-2
  1093. LE B2,CIRDONE EXIT CONDITION
  1094. RJ INCXY GET NEXT (X,Y) IN (X3,X4)
  1095. EQ CIRBLP
  1096. *
  1097. *
  1098. * WINDOWED CIRCLEB
  1099. * GENERATE THE POINTS IN AN INTERMEDIATE BUFFER
  1100. * IN THE FORM SKIP;X,Y;X,Y
  1101. WCIRBLP SB1 1
  1102. WCIRB1 UX6 X3,B6
  1103. LX6 X6,B6 INTEGER FIRST X
  1104. SX6 X6+B3 OFFSET X
  1105. SA6 A6+B1
  1106. UX6 X4,B6
  1107. LX6 X6,B6 INTEGER FIRST Y
  1108. SX6 X6+B4 OFFSET Y
  1109. SA6 A6+B1
  1110. RJ INCXY GET NEXT (X,Y) IN (X3,X4)
  1111. UX6 X3,B6
  1112. LX6 X6,B6 INTEGER SECOND X
  1113. SX6 X6+B3 OFFSET X
  1114. SA6 A6+B1
  1115. UX6 X4,B6
  1116. LX6 X6,B6 INTEGER SECOND Y
  1117. SX6 X6+B4 OFFSET Y
  1118. SA6 A6+B1
  1119. SB2 B2-2
  1120. LE B2,CIRDONE END TEST
  1121. RJ INCXY GET NEXT (X,Y) IN (X3,X4)
  1122. MX6 2 OUTPUT SKIP
  1123. SA6 A6+B1
  1124. SA6 A6+B1 TAKES TWO WORDS
  1125. EQ WCIRB1 CONTINUE LOOPING
  1126. *
  1127. * /--- BLOCK CIRDONE 00 000 78/01/07 19.32
  1128. *
  1129. * DONE WITH CIRCLE GENERATION
  1130. CIRDONE SA1 NX SAVE END SCREEN LOCATION
  1131. SA2 NY
  1132. SA3 PCIRCLE
  1133. ZR X3,CIRDONE1 IF SHOULD BE CENTER POSITION
  1134. SX1 A0 SHOULD BE LAST POINT DRAWN
  1135. SX2 B7
  1136. CIRDONE1 MX0 -18
  1137. BX7 -X0*X1
  1138. SA7 SAVNX SAVE POSITIONS
  1139. BX7 -X0*X2
  1140. SA7 SAVNY
  1141. *
  1142. SA1 SAVB5 RESTORE REGISTERS
  1143. SB5 X1 RESTORE B5
  1144. SA1 SAVB7
  1145. SB7 X1 RESTORE B7
  1146. SA1 TBWNDOW
  1147. NZ X1,WCIRDONE IF WINDOWED
  1148. *
  1149. * CREATE MOUT HEADER
  1150. SA2 MOUTLOC
  1151. SX5 MOUT+X2 -> FIRST WORD FOLLOWING HEADER
  1152. SX0 A6 -> LAST WORD OF OUTPUT
  1153. IX0 X0-X5 NUMBER OF POINTS OUTPUT
  1154. BX6 X0
  1155. LX6 24 SHIFT TO POSITION
  1156. SX0 X0+1 NUMBER OF WORDS IN GROUP
  1157. BX1 X0
  1158. LX1 12
  1159. BX6 X6+X1
  1160. SX1 SKPCODE
  1161. BX6 X6+X1 COMPLETED HEADER WORD
  1162. SA6 MOUT+X2 OUTPUT IT
  1163. IX6 X2+X0 UPDATE MOUT POINTER
  1164. SA6 A2
  1165. *
  1166. * OUTPUT -ATNM- TO FINAL LOCATION
  1167. CIRDONE2 SA1 SAVNX X-FINAL
  1168. SA2 SAVNY Y-FINAL
  1169. BX6 X1
  1170. BX7 X2
  1171. SA6 NX
  1172. SA7 NY
  1173. MX0 -9
  1174. BX1 -X0*X1 ON SCREEN
  1175. BX2 -X0*X2
  1176. LX1 9
  1177. BX1 X1+X2
  1178. OUTCODE WFCODE
  1179. EQ PROCO
  1180. *
  1181. * WINDOWED CIRCLE DONE
  1182. WCIRDONE SB3 INFO
  1183. SX2 A6-B3 NUMBER OF WORDS IN INFO BUFFER
  1184. SX1 INFO+1 -> BUFFER
  1185. MX5 0 NOT CONTINUED DRAW
  1186. RJ WINDBUF OUTPUT THE LINES
  1187. EQ CIRDONE2
  1188. *
  1189. * /--- BLOCK VARIABLES 00 000 76/07/18 21.08
  1190. *
  1191. CHALF DATA .5
  1192. C1 DATA 1.
  1193. C2 DATA 2.
  1194. C3 DATA 3.
  1195. C40 DATA 40.
  1196. C256 DATA 256.
  1197. TWOPI DATA 6.28318 2*PI
  1198. RADDEG DATA 0.0174533 RADIANS PER DEGREE (PI/180)
  1199. *
  1200. * THE FOLLOWING VARIABLES ARE NOT KEPT IN THE OVERLAY
  1201. * WHEN ECS RESIDENT, BUT FOLLOW THE OVERLAY IN CM.
  1202. * THE -ENDOV- MACRO SHOULD BE CHANGED TO ACCEPT A PARAMETER,
  1203. * INDICATING THE LAST WORD IN CM THAT WOULD BE REFERENCED
  1204. * BY THE OVERLAY, SO IT CAN DO ITS RANGE CHECK CORRECTLY.
  1205. * IN THIS TIME, THE FOLLOWING VARIABLES WILL FIT IN THE
  1206. * CM BUFFER, SO IT ISN'7T WORTH IT TO PUT THE CHECK IN.
  1207. *
  1208. RADIUS BSS 0 RADIUS OF CIRCLE
  1209. ARC EQU RADIUS+1 ARC OF CIRCLE
  1210. CHORDS EQU ARC+1 NUMBER OF CHORDS IN THIS CIRCLE
  1211. PCIRCLE EQU CHORDS+1 1 IF PARTIAL CIRCLE, 0 IF FULL
  1212. XSIN EQU PCIRCLE+1 SIZEX*SINE(ROTATE)
  1213. YSIN EQU XSIN+1 SIZEY*SINE(ROTATE)
  1214. XCOS EQU YSIN+1 SIZEX*COSINE(ROTATE)
  1215. YCOS EQU XCOS+1 SIZEY*COSINE(ROTATE)
  1216. INITX EQU YCOS+1 INITIAL X-COORDINATE
  1217. INITY EQU INITX+1 INITIAL Y-COORDINATE
  1218. ROUTINE EQU INITY+1 PROCESSING ROUTINE ADDRESS
  1219. SAVB5 EQU ROUTINE+1 LOCATION TO SAVE B5
  1220. SAVB7 EQU SAVB5+1 LOCATION TO SAVE B7
  1221. SAVNX EQU SAVB7+1
  1222. SAVNY EQU SAVNX+1
  1223. *
  1224. ENDOV
  1225. * /--- BLOCK END 00 000 76/07/30 19.45
  1226. *
  1227. *
  1228. OVTABLE
  1229. *
  1230. *
  1231. END DRAWS$