home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 7
/
AU_CD7.iso
/
aujun99
/
regulars
/
starinfo
/
adcock
/
_parallax2
/
_runimage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1999-02-07
|
7KB
|
243 lines
Parallax ][ (The sine table's revenge)
A doodle by Mark Adcock (aka casma)
Customisations
==============
speed%=15
The Speed of the whole effect. Keep between 10 and 20
high%=1
If high=1 the plotting routine will use 1x2 blocks (slow risc pc users
might want to take the WAIT out)
If high=0 2x2 blocks will be used (Recommeded for pre risc pc machines)
cls%=1
If low, the routine will only plot non zero pixels. These leaves some interesting trails behind.
---- Mess Below here ----
13+128:
$;" at line ";
fp%=8
ba%(2)
bank%=1
6,113,1
6,112,1
ba%(1)=
FindBaseAddress+32
6,113,2
6,112,2
ba%(2)=
FindBaseAddress+32
Tables
B%=sin%
twopi=2*
/5120
fpbig%=(2^fp%-1)
cls%
.
A%=ba%(bank%)
C%=(a%
5120)
1! D%=128+128*
(twopi*a%*2)
2! E%=128+128*
(twopi*a%*2)
3) silly!0=fpbig%*(1+
(twopi*a%/3))
4) silly!4=fpbig%*(1+
(twopi*a%/2))
5) silly!8=fpbig%*(1+
(twopi*a%/4))
7# a%=(a%+speed%)
(5120*3*4*2)
6,113,bank%
bank%=3-bank%
A%=ba%(1)
C%=(a%
5120)
@! D%=128+128*
(twopi*a%*2)
A! E%=128+128*
(twopi*a%*2)
B) silly!0=fpbig%*(1+
(twopi*a%/3))
C) silly!4=fpbig%*(1+
(twopi*a%/2))
D) silly!8=fpbig%*(1+
(twopi*a%/4))
F# a%=(a%+speed%)
(5120*3*4*2)
Rot(RX%,RY%,ang%)
L:NX%=RX%*(cos%!(4*ang%))-RY%*(sin%!(4*ang%))+(160<<fp%)
M:NY%=RX%*(sin%!(4*ang%))+RY%*(cos%!(4*ang%))+(128<<fp%)
FindBaseAddress
i% 8
i%!0 = 149
i%!4 = -1
"OS_ReadVduVariables",i%,i%
U =i%!0
code% 1024
P%=code%
[ OPT 2
.silly equd 1<<fp%
equd 1<<fp%
equd 1<<fp%
.go mov r6,#255
a .loop2 rsb r5,r3,#0
b sub r9,r6,r4
d" add r10,r1,r2,lsl#2
e# ldr r11,[r10,#128]
f# mul r7,r11,r5
g" ldr r12,[r10]
h# mul r8,r12,r9
i# sub r7,r7,r8
j# add r7,r7,#128<<fp%
l" mul r8,r5,r12
m# mla r8,r9,r11,r8
n# add r8,r8,#128<<fp%
p" rsb r5,r3,#320
r$ mul r10,r12,r5
s$ mla r10,r11,r9,r10
t$ mul r9,r12,r9
u$ rsb r9,r9,#0
v$ mla r9,r5,r11,r9
w$ add r10,r10,#128<<fp%
adr r5,silly
y# ldmia r5,{r5,r11,r12}
z( mla r9,r5,r9,r9
{ mla r9,r10,r11,r9
mov r5,#256
mla r9,r5,r12,r9
~ mov r9,r9,lsr#fp%
& sub r9,r9,r7
mov r9,r9,lsr#8
sub r10,r10,r8
! mov r10,r10,lsr#8
Line(high%)
subs r6,r6,#2
" bge loop2
movs pc,r14
Store(cls%)
cls%=0
[ OPT 2
cmp r5,#0
strne r5,[r0],#4
strne r5,[r0,#316]
addeq r0,r0,#4
[ OPT 2
str r5,[r0],#4
str r5,[r0,#316]
Line(high%)
high%=1
[ OPT 2
stmfd r13!,{r2}
.line
mov r11,#255
- add r2,r1,#(sprite%-sin%)
.loop ;
+ and r1,r8,#127<<(fp%+1)
, and r12,r7,#127<<(fp%+1)
' add r1,r12,r1,lsl#7
8 ldrb r5,[r2,r1,lsr#(fp%+1)]
add r7,r7,r9
2 add r8,r8,r10
;
+ and r1,r8,#127<<(fp%+1)
, and r12,r7,#127<<(fp%+1)
' add r1,r12,r1,lsl#7
. ldrb r1,[r2,r1,lsr#(fp%+1)]
& orr r5,r5,r1,lsl#8
add r7,r7,r9
& add r8,r8,r10
;
+ and r1,r8,#127<<(fp%+1)
, and r12,r7,#127<<(fp%+1)
' add r1,r12,r1,lsl#7
. ldrb r1,[r2,r1,lsr#(fp%+1)]
' orr r5,r5,r1,lsl#16
add r7,r7,r9
! add r8,r8,r10
;
+ and r1,r8,#127<<(fp%+1)
, and r12,r7,#127<<(fp%+1)
' add r1,r12,r1,lsl#7
. ldrb r1,[r2,r1,lsr#(fp%+1)]
2 orr r5,r5,r1,lsl#24
add r7,r7,r9
& add r8,r8,r10
;
"
Store(cls%)
;
! subs r11,r11,#4
bge loop
;
% add r0,r0,#640-256
, sub r1,r2,#(sprite%-sin%)
! ldmfd r13!,{r2}
[ OPT 2
! stmfd r13!,{r2}
.line
mov r11,#255
- add r2,r1,#(sprite%-sin%)
.loop ;
+ and r1,r8,#127<<(fp%+1)
, and r12,r7,#127<<(fp%+1)
' add r1,r12,r1,lsl#7
. ldrb r1,[r2,r1,lsr#(fp%+1)]
1 orr r5,r1,r1,lsl#8
& add r7,r7,r9,lsl#1
8 add r8,r8,r10,lsl#1
;
+ and r1,r8,#127<<(fp%+1)
, and r12,r7,#127<<(fp%+1)
1 add r1,r12,r1,lsl#7
. ldrb r1,[r2,r1,lsr#(fp%+1)]
& orr r1,r1,r1,lsl#8
' orr r5,r5,r1,lsl#16
& add r7,r7,r9,lsl#1
' add r8,r8,r10,lsl#1
;
&
Store(cls%)
;
! subs r11,r11,#4
bge loop
;
% add r0,r0,#640-256
, sub r1,r2,#(sprite%-sin%)
! ldmfd r13!,{r2}
Tables
memory% 1024*4+128*128
'sin%=memory%:sprite%=memory%+1024*4
l%=0
1023
'sin%!(l%*4)=
(360*l%/512)*(2^fp%)
6,112,1
6,113,1
"OS_File",5,"<parallax2$dir>.spr"
,,,,spr_len%
spr% spr_len%+4
!spr%=spr_len%+4
"OS_File",255,"<parallax2$dir>.spr",spr%+4
"OS_SpriteOp",47+256,spr%,"big"
"OS_SpriteOp",34+256,spr%,"big",0,0,&08
y%=0
x%=0
O sprite%?(127-((x%+64)
128)+((y%+64)
128)*128)=ba%(1)?(x%-32+(255-y%)*320)
FindBaseAddress
i% 8
i%!0 = 149
i%!4 = -1
"OS_ReadVduVariables",i%,i%
& =i%!0
---- Mess above here ----
As the wise man once said - "Don't code under pressure..."
the only reply to the above is - "...or your head might implode"