forked from RetroBattlestations/vectro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TI-99.txt
156 lines (156 loc) · 5.32 KB
/
TI-99.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
100 REM === Setup graphics and initialize some constants
110 CALL CLEAR
115 CI=33
120 DIM HX$(15)
121 HX$(0)="0"::HX$(1)="1"::HX$(2)="2"::HX$(3)="3"
122 HX$(4)="4"::HX$(5)="5"::HX$(6)="6"::HX$(7)="7"
123 HX$(8)="8"::HX$(9)="9"::HX$(10)="A"::HX$(11)="B"
124 HX$(12)="C"::HX$(13)="D"::HX$(14)="E"::HX$(15)="F"
125 FOR I=33 TO 143::CALL CHAR(I,"0000000000000000")::NEXT I
130 SW = 128::SH = 192::SC = SW / 1750::XF = SW / 2
140 IF SH / 1000 < SC THEN SC = SH / 1000
150 REM === Read the vector graphics from DATA and draw the picture
160 READ P$
170 IF P$ = "EOI" THEN GOTO 170
180 IF P$ = "C" OR P$ = "E" THEN GOSUB 1010
190 IF P$ = "L" THEN GOSUB 1510
200 GOTO 130
1000 REM === Draw circle or ellipse
1010 READ XC,YC,XR::YR = XR:: IF P$ = "E" THEN READ YR
1020 READ AS,AE
1030 XC=INT(XC*SC)::YC=INT(YC*SC)::XR=INT(XR*SC)::YR=INT(YR*SC)
1035 IF XR=0 OR YR=0 THEN RETURN
1040 A2 = XR * XR::B2 = YR * YR::F2 = 4 * A2
1050 X = 0::Y = YR::SI = 2 * B2 + A2 * (1 - 2 * YR)
1060 IF B2 * X > A2 * Y THEN GOTO 1110
1070 SP = X / Y::AN = ATN (SP)::DG = 90 - AN * 180 / PI:: GOSUB 1190
1080 IF SI >= 0 THEN SI = SI + F2 * (1 - Y)::Y = Y - 1
1090 SI = SI + B2 * (4 * X + 6)
1100 X = X + 1:: GOTO 1060
1110 F2 = 4 * B2
1120 X = XR::Y = 0::SI = 2 * A2 + B2 * (1 - 2 * XR)
1130 IF A2 * Y > B2 * X THEN RETURN
1140 SP = Y / X::AN = ATN (SP)::DG = AN * 180 / PI:: GOSUB 1190
1150 IF SI >= 0 THEN SI = SI + F2 * (1 - X)::X = X - 1
1160 SI = SI + A2 * (4 * Y + 6)
1170 Y = Y + 1:: GOTO 1130
1180 REM === Plot point on arc
1190 NS = AS::NE = AE:: IF AS < 0 THEN NS = AS + 360::NE = AE + 360
1200 IF DG >= AS AND DG <= AE THEN X1=XC+X+XF::Y1=YC-Y::GOSUB 2010
1210 IF 180 - DG >= AS AND 180 - DG <= AE THEN X1=XC-X+XF::Y1=YC-Y::GOSUB 2010
1220 IF DG >= NS - 180 AND DG <= NE - 180 THEN X1=XC-X+XF::Y1=YC+Y::GOSUB 2010
1230 IF 180-DG>=NS-180 AND 180-DG<=NE-180 THEN X1=XC+X+XF::Y1=YC+Y::GOSUB 2010
1240 RETURN
1500 REM === Draw a line
1510 READ X1,Y1,X2,Y2
1520 X1=INT(X1*SC)+XF::Y1=INT(Y1*SC)::X2=INT(X2*SC)+XF::Y2=INT(Y2*SC)
1530 DX=ABS(X2-X1)::SX=-1::IF X1 < X2 THEN SX=1
1540 DY=ABS(Y2-Y1)::SY=-1::IF Y1 < Y2 THEN SY=1
1550 ER=-DY::IF DX > DY THEN ER=DX
1560 ER=INT(ER/2)
1570 GOSUB 2010
1580 IF X1 = X2 AND Y1 = Y2 THEN RETURN
1590 E2 = ER
1600 IF E2 > -DX THEN ER=ER-DY::X1=X1+SX
1605 IF X1 = X2 AND Y1 = Y2 THEN RETURN
1610 IF E2 < DY THEN ER=ER+DX::Y1=Y1+SY
1615 IF X1 = X2 AND Y1 = Y2 THEN RETURN
1620 GOTO 1570
2000 REM === Plot a point
2010 CH = 8+INT(X1 / 8)::RO = 6+INT(Y1 / 8)::LN = 2*(Y1 AND 7)
2020 BI = X1 AND 7::IF BI>=4 THEN LN=LN+1::BI=BI-4
2030 CALL GCHAR(1+RO,1+CH,CC)
2040 IF CC=32 THEN CC=CI::CI=CI+1::CALL HCHAR(1+RO,1+CH,CC)
2050 CALL CHARPAT(CC,C$)
2060 CN$=SEG$(C$,1+LN,1)
2070 CN=(ASC(CN$) AND 15) + (ASC(CN$) AND 64) / 64 * 9
2080 CN=CN OR 2 ^ (3-BI)
2090 C$=SEG$(C$,1,LN)&HX$(CN)&SEG$(C$,1+LN+1,16)
2100 CALL CHAR(CC,C$)
2110 RETURN
5000 REM === This is the image data
5010 DATA L,-350,24,-45,0
5020 DATA L,-450,24,-89,38
5030 DATA L,-55,77,-88,499
5040 DATA L,-129,533,-365,514
5050 DATA L,-365,517,-88,560
5060 DATA L,-11,35,-48,528
5070 DATA L,23,30,-18,529
5080 DATA L,56,99,-18,530
5090 DATA L,124,111,56,99
5100 DATA L,38,24,124,111
5110 DATA L,-64,807,101,679
5120 DATA L,-140,983,101,679
5130 DATA L,-858,786,-185,998
5140 DATA L,-864,752,-197,911
5150 DATA L,-62,687,-158,892
5160 DATA L,-226,836,-138,667
5170 DATA L,-689,586,-150,645
5180 DATA L,-340,640,-689,586
5190 DATA L,-724,633,-354,685
5200 DATA L,-360,701,-724,633
5210 DATA L,-774,676,-375,747
5220 DATA L,-380,765,-774,676
5230 DATA L,-239,796,-328,776
5240 DATA L,-320,757,-230,773
5250 DATA L,-214,729,-295,713
5260 DATA L,-286,695,-206,706
5270 DATA L,-190,663,-263,652
5280 DATA L,-365,788,-367,801
5290 DATA L,-367,801,-359,789
5300 DATA L,-225,827,-226,836
5310 DATA L,-62,687,-64,807
5320 DATA C,-41,31,31,-7,94
5330 DATA C,-90,73,36,-6,87
5340 DATA C,-126,496,38,266,354
5350 DATA C,-82,526,34,261,356
5360 DATA C,32,30,9,44,175
5370 DATA C,-261,553,461,78,93
5380 DATA C,-177,151,50,6,78
5390 DATA C,-811,219,688,-19,6
5400 DATA C,-205,420,50,269,341
5410 DATA C,-190,-999,1469,259,269
5420 DATA C,-264,-1083,1539,262,271
5430 DATA C,-212,414,41,271,339
5440 DATA C,-710,226,573,-21,8
5450 DATA C,-184,148,41,8,78
5460 DATA C,-331,859,768,78,86
5470 DATA C,-49,293,495,163,188
5480 DATA C,-256,278,295,154,196
5490 DATA C,-191,874,38,261,331
5500 DATA C,-865,759,7,80,183
5510 DATA C,-849,764,24,170,246
5520 DATA C,-175,952,47,257,318
5530 DATA C,-150,659,15,-41,89
5540 DATA C,-342,659,19,-25,81
5550 DATA C,-351,657,28,263,342
5560 DATA C,-363,721,20,-26,78
5570 DATA C,-371,721,26,260,342
5580 DATA C,-384,784,20,-12,78
5590 DATA C,-267,686,34,84,155
5600 DATA C,-285,680,15,147,267
5610 DATA C,-199,683,24,254,341
5620 DATA C,-198,683,22,-19,68
5630 DATA C,-217,747,18,-16,80
5640 DATA C,-300,746,33,82,163
5650 DATA C,-317,742,15,159,255
5660 DATA C,-226,746,28,261,347
5670 DATA C,-333,807,31,80,147
5680 DATA C,-256,824,31,-6,77
5690 DATA C,772,75,53,0,360
5700 DATA L,718,64,584,32
5710 DATA L,584,32,535,188
5720 DATA E,531,390,302,197,0,360
5730 DATA C,260,298,67,40,246
5740 DATA C,806,298,67,-69,141
5750 DATA C,426,351,49,0,360
5760 DATA C,639,351,49,0,360
5770 DATA E,533,458,115,54,200,340
5780 DATA E,531,673,151,313,142,263
5790 DATA E,531,673,151,313,-82,37
5800 DATA E,419,708,109,132,104,263
5810 DATA E,644,708,109,132,-83,76
5820 DATA E,400,961,75,61,62,192
5830 DATA E,663,961,75,61,-11,118
5840 DATA L,327,976,736,976
5850 DATA EOI