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