forked from historicalsource/asteroids
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VECMAC.XX
161 lines (159 loc) · 4 KB
/
VECMAC.XX
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
157
158
159
160
161
.TITLE VECMAC - VECTOR MACROS
.SBTTL **************************
.SBTTL *
.SBTTL * PROGRAMMER: DOWNEND & MOORE
.SBTTL *
.SBTTL **************************
.REPT 0
DATE: 8/14/78
PROJECT:6W000
DISK: 49
DESCRIPTION:
GENERAL PURPOSE MACROS TO FACILITATE PROGRAMMING THE VECTOR GENERATOR
BEWARE: CODE REFERENCING THESE MACROS MUST BE ASECT IF THE "JSRL"
OR "JMPL" MACRO IS USED
.ENDR
;
; VCTR - DRAW VECTOR INSTRUCTION
; THIS INSTRUCTION DRAWS A VECTOR ON THE DISPLAY AREA
; RELATIVE TO THE PREVIOUS BEAM POSITION BEFORE THE
; INSTRUCTION IS EXECUTED. DX IS THE CHANGE IN BEAM X
; POSITION; DY IS THE CHANGE IN BEAM Y POSITION; ZZ
; SPECIFIES THE BEAM INTENSITY (0 THROUGH 15., 0 IS
; NO INTENSITY, 15. IS BRIGHTEST INTENSITY). THE OPCODE
; IS 1 TO 9 WHICH SPECIFIES THE RATE WITH WHICH THE BEAM
; IS DRAWN.
;
.SBTTL VCTR
.MACRO VCTR DX,DY,ZZ
..1=DX
..2=DY
..3=0 ;SET SIGNS
..4=0
.IF LT,..1 ;IF NEGATIVE X
..3=4
..1=-DX
.ENDC
.IF LT,..2 ;IF NEGATIVE Y
..4=^H400
..2=-DY
.ENDC
..5=..1!..2
.IF EQ,..5&^H0FFCF
.WORD ^H0F808+<..2*^H10>+<..1/^H10>+..3+..4+<ZZ*^H10>
.MEXIT
.ENDC
.IF EQ,..5&^H0FFE7
.WORD ^H0F008+<..2*^H20>+<..1/8>+..3+..4+<ZZ*^H10>
.MEXIT
.ENDC
.IF EQ,..5&^H0FFF3
.WORD ^H0F800+<..2*^H40>+<..1/4>+..3+..4+<ZZ*^H10>
.MEXIT
.ENDC
.IF EQ,..5&^H0FFF9
.WORD ^H0F000+<..2*^H80>+<..1/2>+..3+..4+<ZZ*^H10>
.MEXIT
.ENDC
..6=^H9000
.REPT 9.
.IF LT,..5-^H200
..5=..5*2
..1=..1*2
..2=..2*2
..6=..6-^H1000
.ENDC
.ENDR
.WORD ..6+..4+..2,<ZZ*^H1000>+..1+<..3*^H100>
.ENDM
;
; JSRL - JUMP SUBROUTINE INSTRUCTION
; THE LOWER THREE BYTES SPECIFY AN ADDRESS RELATIVE
; TO THE BEGINNING OF THE VECTOR GENERATOR ADDRESSABLE
; INSTRUCTION SPACE DIVIDED BY 2. THE TOTAL ADDRESS
; AREA IS 6K BYTES. OPCODE IS 'C'.
;
.SBTTL JSRL
.MACRO JSRL LABL
.WORD <LABL&^H1FFF>/2.+^H0C000
.ENDM
;
; LABS - LOAD ABSOLUTE BEAM POSITION FOR VG
; ASSUMES DISPLAYED AREA LOWER LEFT CORNER IS ADDRESS
; 0,0 THE SIZE DETERMINES THE SCALING SIZE
; FOR ALL FOLLOWING VECTORS. A NULL PARAMETER
; MEANS 0 AND THE VALID RANGE IS 0 TO F.
;
.SBTTL LABS
.MACRO LABS DSTX,DSTY,SIZE
..1=0
.IIF NB,SIZE,..1=SIZE
.WORD ^H0A000+<DSTY&^H0FFF>,^H1000*..1+<DSTX&^H0FFF>
.ENDM
;
; WAIT - BEAM WAIT INSTRUCTION
; THIS INSTRUCTION ALLOWS THE BEAM TO COME TO REST AT
; ITS CURRENT POSITION. T IS THE TIME FOR THE WAIT
; (1 TO 9, 1 IS SHORTEST, 9 IS LONGEST); Z IS THE INTENSITY
; OF THE BEAM, AS IN THE VCTR INSTRUCTION. A WAIT INSTRUCTION
; SHOULD BE USED AFTER EVERY LABS & ALABS INSTRUCTION TO ALLOW
; THE BEAM TO REACH THE SPECIFIED POSITION. THE OPCODE IS
; 1 TO 9.
;
.SBTTL WAIT
.MACRO WAIT .T,.Z
..1=0
..2=7.
.IIF NB,.Z,..1=.Z
.IIF NB,.T,..2=.T
.WORD ..2*^H1000,..1*^H1000
.ENDM
;
; HALT - HALT THE VECTOR GENERATOR INSTRUCTION
; WHEN EXECUTED BY VG SETS THE VG HALT FLAG.
; OPCODE IS 'B'
;
.SBTTL HALT
.MACRO HALT
.WORD ^H0B000
.ENDM
;
; RTSL - RETURN FROM SUBROUTINE
; THIS INSTRUCTION IS ANALOGOUS TO AN RTS INSTRUCTION FOR
; A MICROPROCESSOR. THE VG IS CAPABLE OF FIVE LEVELS OF
; SUBROUTINE CALLS (JSRL). THE OPCODE IS 'D'.
;
.SBTTL RTSL
.MACRO RTSL
.WORD ^H0D000
.ENDM
;
; JMPL - JUMP TO ROUTINE
; THE LOWER THREE BYTES REFERENCES AN ADDRESS JUST AS
; THE LOWER THREE BYTES OF AN JSRL INSTRUCTION. THE
; INSTRUCTION OPERATES JUST AS A JMP INSTRUCTION DOES
; FOR A 650X OR 6800 MICRO. THE OPCODE IS 'E'.
;
.SBTTL JMPL
.MACRO JMPL LABL
.WORD <LABL&^H1FFF>/2.+^H0E000
.ENDM
;
; ALPHA - ALPHANUMERIC JSRL LIST INSTRUCTION
; THIS INSTRUCTION CONSTRUCTS A JSRL INSTRUCTION
; FOR EVERY CHARACTER IN THE CALLING PARAMETER
; STRING, THUS A LABEL CHAR.X MUST EXIST FOR EVERY
; UNIQUE CHARACTER X IN THE PARAMETER STRING.
; RESERVED CHARACTERS USED BY THE PDP SYSTEMS
; (IE @ : ; ETC.) SHOULD NOT BE USED.
;
.SBTTL ALPHANUMERICS
.MACRO ALPHA STRING
.IRPC ..X,<STRING>
JSRL CHAR.'..X
.ENDR
.ENDM
.LIST MEB
.NLIST BYT
.PAGE