File tree 1 file changed +41
-5
lines changed 1 file changed +41
-5
lines changed Original file line number Diff line number Diff line change 6
6
;
7
7
; starfield
8
8
9
- nb_stars equ 220
9
+ ;nb_stars equ 220
10
+ nb_stars equ 160
10
11
raster_dbg equ 0
12
+ enable_rotate equ 1
11
13
12
14
; MACRO(S) DEFINITION(S)
13
15
macro supexec ; 1 argument : subroutine address
@@ -98,6 +100,14 @@ raster_dbg equ 0
98
100
;subi.w #512,d0
99
101
move.w d0 ,(a1 )+ ; X
100
102
move.w d1 ,(a1 )+ ; Y
103
+ muls .w d0 ,d0
104
+ muls .w d1 ,d1
105
+ add.l d1 ,d0 ; X^2+Y^2
106
+ cmp.l #$40000000 ,d0
107
+ blt.s .ok
108
+ subq #4 ,a1
109
+ bra.s .loopr
110
+ .ok
101
111
bsr rand
102
112
andi.w #1023 ,d0
103
113
add.w #1 ,d0
@@ -150,14 +160,40 @@ mainloop:
150
160
endif
151
161
move.w #nb_stars-1 ,d7
152
162
.starloop
153
- move.w (a1 )+,d0 ; X
154
- move.w (a1 )+,d1 ; Y
163
+ if enable_rotate
164
+ ; rotation : (x+iy)(cost+isint) = xcost-ysint + i(ycost+xsint)
165
+ ; cost = 32751 / 32768 (15bits)
166
+ ; sint = 1055 / 32768 (15bits)
167
+ move.w (a1 ),d0
168
+ move.w d0 ,d2
169
+ move.w 2 (a1 ),d1
170
+ move.w d1 ,d3
171
+ muls .w #32751 ,d0 ; xcost
172
+ muls .w #1055 ,d3 ; ysint
173
+ muls .w #1055 ,d2 ; xsint
174
+ muls .w #32751 ,d1 ; ycost
175
+ ;sub.l d3,d0 ; xcost-ysint
176
+ add.l d3 ,d0 ; xcost+ysint (-t as angle)
177
+ add.l d0 ,d0
178
+ swap d0
179
+ move.w d0 ,(a1 )+
180
+ ;add.l d2,d1 ; ycost+xsint
181
+ sub.l d2 ,d1 ; ycost-xsint (-t as angle)
182
+ add.l d1 ,d1
183
+ swap d1
184
+ move.w d1 ,(a1 )+
185
+ else ; enable_rotate
186
+ ;move.w (a1)+,d0 ; X
187
+ ;move.w (a1)+,d1 ; Y
188
+ movem .w (a1 )+,d0 -d1 ; X-Y
189
+ endif
190
+
155
191
move.w (a1 ),d3 ; Z
156
192
ext.l d0
157
193
ext.l d1
158
194
159
- divs .w d3 ,d0
160
- divs .w d3 ,d1
195
+ divs .w d3 ,d0 ; Xproj = X/Z
196
+ divs .w d3 ,d1 ; Yproj = Y/Z
161
197
162
198
; decrement Z
163
199
subq.w #7 ,d3
You can’t perform that action at this time.
0 commit comments