@C9BASIC-tunnel
------------
@C7
For those who are just about to learn BASIC a very simple tunnel done using
colourcycling (in BASIC). The assemblerpart is only used to set all pixels
that have been missed by the ELLIPSE commands. You may change the tunnel`s
colour by changing the variables R%, G% and B% (guess which one means red).
If you draw the tunnel more clever by altering the colour along every ellipse
you can even create a rotating tunnel. But this will probably take a lot of time
so you should have at least a RiscPC. For further details watch the comments.
Source code also is available in the Bits - directory.
                                                         fRISCo / Archiologics
@C3
MODE 12 : OFF
PROCass                     : REM init assemblercode
R% = 255                    : REM Red
G% = 255                    : REM Green
B% = 128                    : REM Blue
FOR C% = 1 TO 15
COLOUR C%,R%*SINRAD(C%*12),G%*SINRAD(C%*12),B%*SINRAD(C%*12)
NEXT                        : REM set gradation
C = 1
FOR I = 1 TO 450 STEP .25
ELLIPSE 640+I/5,2*I+200,((I^1.8)/45+12),((I^1.8)/45+6)
C+= .125
GCOL C
IF C > 15 THEN C = 1
NEXT                        : REM draw ellipses
CALL CODE%                  : REM 'clean' picture
GCOL 0:LINE0,1023,1280,1023 : REM delete bottom row
A% = 1
I% = 12
D% = 1                      : REM direction in tunnel
REPEAT
IF INKEY(-58) THEN D% = 1   : REM If  pressed, direction postive
IF INKEY(-42) THEN D% =-1   : REM If  pressed, direction negative
S = SINRADI%                : REM smooth gradation...
COLOUR A%,R%*S,G%*S,B%*S    : REM colourcycling according to the configs
A%+= D%                     : REM next colour
IF A% > 15 THEN A% = 1
IF A% < 1  THEN A% =15
I%+= 12                     : REM next colour position
IF I% > 168 THEN I% = 12
UNTIL 0
DEFPROCass
DIM CODE% 120
FOR I% = 0 TO 2 STEP 2
P% = CODE%
[ OPT I%
.main
ADR    R0,s
MOV    R1,R0
SWI    "OS_ReadVduVariables"    ; startaddress of screenmem
MOV    R7,#2                    ; 2 passes
.mainloop
LDR    R0,s                     ; read startaddress of screenmem
MOV    R1,R0
ADD    R0,R0,#320               ; 2nd pointer set to next line
MOV    R2,#81920
SUB    R2,R2,#320               ; number of pixels to do
.loop
LDRB   R3,[R0],#1               ; load 2 pixels from the first line
LDRB   R4,[R1],#1               ; load 2 appropr. pixels from 2nd line
ANDS   R5,R3,#&F                ; extract left pixel
ANDEQ  R5,R3,#&F0               ; if it`s black,
ANDEQ  R6,R4,#&F                ; replace pixel by
ORREQ  R5,R5,R6                 ; pixel from line below
STREQB R5,[R0,#-1]              ; and store
ANDS   R5,R3,#&F0               ; extract right pixel
ANDEQ  R5,R3,#&F                ; if it`s black,
ANDEQ  R6,R4,#&F0               ; replace pixel by
ORREQ  R5,R5,R6                 ; pixel from line below
STREQB R5,[R0,#-1]              ; and store
SUBS   R2,R2,#1                 ; all pixels checked?
BNE    loop                     ; if not => again
SUBS   R7,R7,#1                 ; 2 passes?
BNE    mainloop                 ; if not => again
MOV    PC,R14                   ; and jump home
.s     EQUD 149
       EQUD -1
]:NEXT I%
ENDPROC

