Add README.md
[pdp8.git] / sw / adventure / src / SEED.RA
CommitLineData
84b5715c
PH
1 FIELD1 SETIDL\r
2/IDLE RANDOM NUMBER GENERATOR\r
3 EXTERN #IDLE\r
4\r
5 JA #RET\r
6 TEXT +SETIDL+\r
7SXR, SETX XR\r
8 SETB BP\r
9BP, F 0.0\r
10XR, ORG .+3\r
11EXP, 0\r
12IDLAD, ADDR #IDLE-1 / Pointer to idle routine in FRTS\r
13POINT,\r
14JOB, ADDR DOIT / Address of routine to run\r
15 ORG XR+10\r
16K0100, 100\r
17K0003, 3\r
18ROTWRD, 0017\r
19 #LBL=.\r
20 COMMON NUMCOM\r
21NUMBER, ORG .+3\r
22\r
23 COMMON TXTCOM\r
24RTEXT, ORG .+1147\r
25LINES, ORG .+0044\r
26ASCVAR, ORG .+0003\r
27TXTLOC, ORG .+0003\r
28DATA, ORG .+0352\r
29 ORG #LBL\r
30SEEDPT, ADDR NUMBER\r
31 0\r
32DATHAK, 7777\r
81e70d48 33 ADDR ASCVAR\r
84b5715c
PH
34DATABL, 1763-1 / Address of Direct Access table entry 8 in FRTS\r
35COUNT, 0 / Idle loop count\r
36COUNT2, 7774 / Outer counter\r
37RESET, 7774 / Outer counter value\r
38X4=14 / Autoindex reg\r
39 ORG 10*3+BP\r
40 FNOP\r
41 JA SXR\r
42 0\r
43RET, JA .\r
44\r
45 BASE 0\r
46#RET, STARTD\r
47 FLDA 10*3\r
48 FSTA RET\r
49 SETB BP\r
50 BASE BP\r
51 STARTF\r
52 TRAP4 SET8 /GO TO 8 MODE STUFF.\r
53 JA RET /DONE. ON IDLE QUEUE.\r
54\r
55SET8, 0\r
56/\r
57/ Horrible hackery. This sets up the FRTS direct access table\r
58/ to allow us to open the ADVENT.DA file without having to\r
59/ rebuild it each time. Open it using USR, and this lets us\r
60/ go use it later. (DEFINE FILE always creates a new one.)\r
61 TAD DATABL\r
62 DCAZ X4\r
63SCDF, CDF 0\r
64 TAD DATHAK\r
65 DCA% X4\r
66 TAD DATHAK+1\r
67 DCA% X4\r
68 TAD DATHAK+2\r
69 DCA% X4\r
70 TAD CDFIDL\r
71 SZA CLA\r
72 JMP SFIELD /ALREADY DONE\r
73 TAD IDLAD /FIELD OF IDLE ROUTINE\r
74 JMS MKCDF\r
75 DCA CDFIDL\r
76 TAD IDLAD+1 /ADDRESS OF #IDLE\r
77 DCAZ X4\r
78CDFIDL, 0 /GETS CDF\r
79 TAD SKPINS /SKP INSTRUCTION\r
80 DCAZ% X4 /STORE AT #IDLE\r
81 TAD JOB+1 /ADDRESS OF IDLE ROUTINE\r
82 DCAZ% X4 /STORE AT #IDLE+1\r
83 TAD JOB\r
84 JMS MKCDF\r
85 IAC / CDF -> CIF CDF\r
86 DCAZ% X4 /STORE AT #IDLE+2\r
87SFIELD, CIF CDF\r
88 JMP% SET8\r
89\r
90/\r
91/ Blinky lights\r
92/\r
93SKPINS,\r
94DOIT, SKP / Entry point, one-time use constant\r
95 TAD ROTWRD /GET WORD TO DISPLAY\r
96STALL, ISZ COUNT\r
97 JMP STALL\r
98 ISZ COUNT2\r
99 JMP STALL\r
100FLOP, RAL /Shift over\r
101 DCA ROTWRD /Save it\r
102 TAD RESET /Reset outer counter\r
103 DCA COUNT2\r
104 SNL\r
105 JMP DONE\r
106 TAD ROTWRD\r
107FLIP, RAR /Rotate back\r
108 DCA ROTWRD\r
109 TAD FLOP\r
110 DCA COUNT /Save old rotate\r
111 TAD FLIP /And flip 'em around\r
112 DCA FLOP\r
113 TAD COUNT\r
114 DCA FLIP\r
115 DCA COUNT\r
116DONE, TAD SEEDPT\r
117 JMS MKCDF\r
118 DCA .+1\r
119 0\r
120 TAD SEEDPT+1\r
121 DCA EXP\r
122 CLL IAC\r
123 TAD EXP\r
124 DCA POINT\r
125 TAD% POINT\r
126 TAD K0100\r
127 SPA\r
128 JMP OVRFLO\r
129 DCA% POINT\r
130 JMP DOIT+1\r
131\r
132OVRFLO, CLA CLL\r
133 DCA% POINT\r
134 TAD% EXP\r
135 IAC\r
136 AND K0003\r
137 DCA% EXP\r
138 JMP DOIT+1\r
139/ Change field number into CDF instruction\r
140MKCDF, 0\r
141 CLL RTL\r
142 RAL /INTO BITS 6-8\r
143 TAD SCDF /CDF TO #IDLE\r
144 JMP% MKCDF\r
145\r
146 END\r