Rem *    The Awesome, Incredible.. the bug-ridden.. the useless... 
Rem *
Rem *             -= R A I N B O W  W A R R I O R !!!! =-  
Rem *
Rem *            (Even the French couldn't sink this one..)    
Rem *
Rem * Spadge (The little tinker) presents: COPPER DESIGNER!
Rem * This AMOS listing is TUPPERWARE (of course) and was first
Rem * featured on NEWSFLASH disk-magazine (#15)... watch out for Amos
Rem * programs every month.... by us, our readers and F.Lionet!
Rem *
Rem * Scruf-ee programming and sloppy idle routines rule ok... 
Rem *
Rem * Lonely blondes (female.. ahem) with outrageous assests should  
Rem * contact the willing and so often disapointed Spadge at...  
Rem * Newsflash UK, Po Box 13, Ossett, W.Yorks WF5 OXA. Tel 0924 265593
Rem * By the way, ya can also get Newsflash from there too.. :-) 
Rem *
Rem * Feel free to send criticisms, comments and any additional bits that
Rem * you may care to add... but do NOT remove anything from this file, the or 
Rem * documentation or fiddle with my graphics to a large extent.... 
Rem * or else I'll be a bit pig-sick and won't release anything  
Rem * else, not that you'ld be very worried about that of course...
Rem *
Rem * Ever look at the copper (Rainbow) command and think, yes, well,
Rem * erm - no thanks.. well! Now's the chance to REALLY use it!! Just 
Rem * run this and marvel and the taste of Newcastle Brown Ale... 8^)
Rem *
Rem * I hope you don't expect me to fully comment this appalling program 
Rem * I am NOT the neatest, most schematic programming person.. sorry... 
Rem * Just enjoy the results because, it does actually work.. a bit..
Rem *
Break Off 
On Error Goto TUTTUT : Rem Ah-haaa.. most errors banished to the dustbin!! :-)
Hide On 
Limit Mouse 130,40 To 440,300
W1Y=40 : R=7 : G=7 : B=7 : CP=1 : MR=R : MG=G : MB=B : PB=0 : Dim BUFFER(300) : BL=0
Dim TEMP(300) : Dim T2(300) : Dim PC(20,2) : For F=1 To 20 : Read PC(F,0) : Read PC(F,1) : Read PC(F,2) : Next F
Data 0,0,0,$F,$F,$F,$F,$0,$0,$0,$F,$0,0,0,$F,0,$F,$F,$F,$F,$0,$F,0,$F,$A,0,0,$D,8,0,$8,$F,0,0,$8,$0,$B,$6,0,$0,$C,$C
Data 0,$A,$F,0,$7,$C,$7,0,$F,$C,0,$E,$C,0,8,$6,$2,0,$D,5,1
Auto View Off 
Screen Open 2,640,10,2,Hires : Curs Off : Cls 0 : Palette 0,$FFF : Screen Display 2,,120,,
Screen Open 0,320,256,4,LORES : Cls 0 : Curs Off : Palette 0,0,0,0 : Cls 0 : Flash Off 
Screen Open 1,640,256,8,Hires : Cls 0 : Curs Off 
Unpack 5 To 1 : Screen Display 1,,W1Y,,60 : Gosub IN : Screen To Back 1 : Screen Display 1,,W1Y,,60 : Gosub S2 : Screen To Front 1
Randomize Timer
Set Rainbow 0,0,290,"","",""
Rainbow 0,0,0,290
Gosub GCOL : Change Mouse 2
Show On 
View 
Screen 0 : Ink 3 : Box 130,100 To 180,150
Ink 1 : Bar 131,101 To 179,149
Key Speed 25,2
II:
Do 
I$=Inkey$
S=Scancode
Clear Key 
Screen 0
K=Mouse Key : If K>0 Then Y=Y Mouse : Gosub MBIT
If S=0 Then Loop 
If S=76 and W1Y>0 Then W1Y=W1Y-32 : Screen Display 1,,W1Y,, : Wait Vbl 
If S=77 and W1Y<280 Then W1Y=W1Y+32 : Screen Display 1,,W1Y,, : Wait Vbl 
If Upper$(I$)="X" Then Key Speed 8,8 : Edit 
If I$="?" Then Gosub S1 : Wait Key : Gosub S3 : Wait Key : Gosub S2
If I$="C" Then Change Mouse 3 : BC=IDX : For F=0 To 280 : Rain(0,F)=IDX : Next F : Change Mouse 2 : View 
If I$="c" Then Change Mouse 3 : BC=0 : For F=0 To 280 : Rain(0,F)=0 : Next F : Change Mouse 2 : View 
If I$="4" and R<15 Then Inc R : Gosub GCOL
If I$="1" and R>1 Then Dec R : Gosub GCOL
If I$="5" and G<15 Then Inc G : Gosub GCOL
If I$="2" and G>1 Then Dec G : Gosub GCOL
If I$="6" and B<15 Then Inc B : Gosub GCOL
If I$="3" and B>1 Then Dec B : Gosub GCOL
If I$="n" Then K=1 : Y=Y Mouse : Gosub MBIT : YUP=Y Mouse : Inc YUP : Y Mouse=YUP : Gosub DARK
If I$="N" Then K=1 : Y=Y Mouse : Gosub MBIT : YUP=Y Mouse : Dec YUP : Y Mouse=YUP : Gosub DARK
If Upper$(I$)="G" Then MR=R : MG=G : MB=B : S$="Colour Put in Memory" : Gosub DT : Wait 50 : Screen To Back 2
If Upper$(I$)="R" Then R=MR : G=MG : B=MB : S$="Colour Grabbed from Memory" : Gosub DT : Wait 50 : Screen To Back 2 : Gosub GCOL
If I$="-" Then Gosub DARK
If I$="+" Then Gosub BRIGHT
If Upper$(I$)="D" Then Gosub DARK
If Upper$(I$)="B" Then Gosub BRIGHT
If I$="*" Then Gosub RANDC
If I$="/" Then Gosub POC
If Upper$(I$)="M" Then Gosub MIRROR
If I$="k" Then Gosub CUT
If I$="K" Then Gosub CUT2
If Upper$(I$)="P" Then Gosub PASTE
If Upper$(I$)="F" Then Gosub FID
If Upper$(I$)="U" Then Gosub UNDO
If Upper$(I$)="Z" Then Gosub SAV
If Upper$(I$)="E" Then Gosub EX
If Upper$(I$)="H" Then Gosub SNATCH
If Upper$(I$)="S" Then Gosub SAVIT
If I$="l" Then Gosub LSCR
If I$="L" Then Gosub LBUF
Goto II
GCOL:
IDX=(256*R)+(16*G)+B : Screen 0 : Palette 0,IDX : Return 
MBIT:
If K=2 Then Goto SCRUBBIT
Y1=Y Screen(Y)
Rain(0,Y1+2)=IDX : View 
Return 
SCRUBBIT:
Y1=Y Screen(Y Mouse)
Rain(0,Y1+2)=BC : View 
Return 
DARK:
If R>0 Then Dec R
If G>0 Then Dec G
If B>0 Then Dec B
Gosub GCOL : Return 
BRIGHT:
If R<14 Then Inc R
If G<14 Then Inc G
If B<14 Then Inc B
Gosub GCOL : Return 
RANDC:
R=Rnd(15) : G=Rnd(15) : B=Rnd(15) : Gosub GCOL : Return 
S1:
Screen Offset 1,,3 : Wait Vbl : Return 
S2:
Screen Offset 1,,62 : Wait Vbl : Return 
S3:
Screen Offset 1,,121 : Wait Vbl : Return 
S4:
Screen Offset 1,,181 : Wait Vbl : Return 
POC:
Inc CP
If CP=21 Then CP=1
R=PC(CP,0)
G=PC(CP,1)
B=PC(CP,2) : Gosub GCOL
Return 
MIRROR:
S$="Select region to mirror..." : Gosub DT
GROWBOX
YA=GY1
YB=GY2
S$="Press T: Mirror on the top, B: Mirror on bottom or E: Exit" : Gosub DT
Do 
KK$=Upper$(Inkey$)
Exit If KK$="T"
Exit If KK$="B"
Exit If KK$="E"
Loop 
Screen To Back 2
If KK$<>"T" Then Goto SKIP
For F=2 To(GY2+1)-(GY1-1)
If GY1+F>280 Then Goto MS
Rain(0,GY1-F+3)=Rain(0,GY1+F)
View 
MS:
Next F
Return 
SKIP:
If KK$="A" Then Return 
For F=0 To(GY2+1)-(GY1-1)
If GY2+F+2>280 Then Goto MS2
Rain(0,GY2+F+2)=Rain(0,GY2-F)
View 
MS2:
Next F : Return 
Procedure GROWBOX
DT:
Screen 2 : Cls : Ink 1 : Writing 1,2 : Centre S$ : Screen To Front 2 : Screen 0 : Return 
CUT:
S$="Cut Now..." : Gosub DT
GROWBOX
YA=GY1
YB=GY2 : PB=1
S$="Colours now in paste buffer !" : Gosub DT
For F=2 To(GY2+1)-(GY1-1)
BUFFER(F-1)=Rain(0,GY1+F)
Next F
BL=GY2-GY1 : Wait 50 : Screen To Back 2
Return 
CUT2:
S$="Cut now..." : Gosub DT
GROWBOX
YA=GY1
YB=GY2 : PB=1
S$="Colours now in paste buffer !" : Gosub DT
For F=2 To(GY2+1)-(GY1-1)
BUFFER(F-1)=Rain(0,GY1+F)
Rain(0,GY1+F)=BC : View 
Next F
BL=GY2-GY1 : Wait 50 : Screen To Back 2
Return 
FID:
S$="Select region to fill.." : Gosub DT
GROWBOX
YA=GY1
YB=GY2
For F=GY1+2 To GY2+2
Rain(0,F)=IDX : View : Next F : Screen To Back 2
Return 
PASTE:
If PB=0 Then S$="Nothing in buffer! Cut something first!!" : Gosub DT : Wait 75 : Screen To Back 2 : Return 
Y1=Y Screen(Y Mouse)
For F=1 To BL
If Y1-1+F+2>280 Then Goto PS
Rain(0,Y1-1+F+2)=BUFFER(F) : View 
PS:
Next F
Return 
UNDO:
S$="Really Refresh ? Y/N" : Gosub DT
Do 
K$=Upper$(Inkey$)
Exit If K$="Y"
Exit If K$="N"
Loop 
Screen To Back 2
If K$="N" Then Return 
For F=0 To 280 : Rain(0,F)=BUFFER(F) : Next F : View : Return 
SAV:
For F=0 To 280 : BUFFER(F)=Rain(0,F) : Next F
S$="Colour contents saved! (U to refresh)" : Gosub DT : Wait 50 : Screen To Back 2
Return 
IN: Screen Display 1,,132,, : Gosub S1 : Auto View On : View : Gosub GM : Gosub S3 : Gosub GM : Return 
TUTTUT:
S$="There's been a cock-up, but I don't think it's anything to worry about!" : Gosub DT : Wait 150 : Screen To Back 2 : Resume II
EX:
S$="Select region to expand" : Gosub DT
GROWBOX
Change Mouse 3 : Screen To Back 2
ER=2 : Screen 0
For F=1 To(GY2-GY1)+4
T2(F)=Rain(0,F+GY1+1)
Next F
TBL=(GY2-GY1)*ER
For F=1 To(TBL+4)/ER
If GY1+(F*ER)-1>280 Then Goto EXS
Rain(0,GY1+1+(F*ER))=T2(F) : View 
For H=1 To ER-1
Rain(0,GY1+1+(F*ER)+H)=T2(F) : View : Next H
EXS:
Next F
Change Mouse 2
Return 
SNATCH:
Y=Y Screen(Y Mouse)
CL=Rain(0,Y+2)
R=Int(CL/256) : CL=CL-(R*256)
G=Int(CL/16) : CL=CL-(G*16)
B=CL : Gosub GCOL
Return 
SAVIT:
Gosub S4
AGH:
Change Mouse 2
Do 
K$=Upper$(Inkey$)
Exit If K$<>""
Loop 
If K$="E" Then Gosub S2 : Return 
If K$="0" Then Gosub SCRIN : Goto AGH
If K$<"0" Then Goto AGH
If Val(K$)>9 Then Goto AGH
K=Val(K$)
On K Gosub AMOS,SEKA,DEVPAC,BIN,DE1,DE2,HEX1,HEX2,BUFF,SCRIN
Goto AGH
AMOS:
Gosub SOB : Screen To Back 2
D$="*.asc" : T1$="Type name of the Amos" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
Print #1,"Rem"
Print #1,"Rem  * Created with RAINBOW WARRIOR - Amos Copper Generator *"
Print #1,"Rem  *  Yup, you can blame good ol' Spadge for this one...  *"
Print #1,"Rem"
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,"Set Rainbow 0,0,";L$;",";
Print #1,Chr$(34);Chr$(34); : Print #1,",";
Print #1,Chr$(34);Chr$(34); : Print #1,",";
Print #1,Chr$(34);Chr$(34)
Print #1,"Rainbow 0,0,";Y0;",";L$;" "
Print #1,"Restore RDATA"
Print #1,"For C=0 To ";L2$;" : Read CVA : Rain(0,C)=CVA"
Print #1,"Next C : View"
Print #1,"RDATA:"
For F=1 To Val(L$)+3 Step 8
Print #1,"Data ";Hex$(Rain(0,Y0+F-1));",";Hex$(Rain(0,Y0+F));",";
Print #1,Hex$(Rain(0,Y0+F+1));",";Hex$(Rain(0,Y0+F+2));",";
Print #1,Hex$(Rain(0,Y0+F+3));",";Hex$(Rain(0,Y0+F+4));",";
Print #1,Hex$(Rain(0,Y0+F+5));",";Hex$(Rain(0,Y0+F+6))
Next F
Print #1,"Rem"
Print #1,"Rem  * Alter the values in the RAINBOW and SET RAINBOW *"
Print #1,"Rem  * to position and control the rainbows. See the   *"
Print #1,"Rem  * manual to check on Y positioning, Length and    *"
Print #1,"Rem  * which colour it is to effect.. Have fun!        *"
Print #1,""
Change Mouse 2
Close 1 : Return 
SEKA:
Gosub SOB : Screen To Back 2
D$="*.s" : T1$="Type name of the Seka" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,";"
Print #1,";  * Created with RAINBOW WARRIOR - Amos Copper Generator"
Print #1,";  *  Yup, you can blame good ol' Spadge for this one... "
Print #1,";  * Holds the data for";L$;" lines of Copper-bar info !!"
Print #1,";"
Print #1,"RDATA:"
For F=1 To Val(L$)+3 Step 8
Print #1,"        Dc.w        ";Hex$(Rain(0,Y0+F-1));",";Hex$(Rain(0,Y0+F));",";
Print #1,Hex$(Rain(0,Y0+F+1));",";Hex$(Rain(0,Y0+F+2));",";
Print #1,Hex$(Rain(0,Y0+F+3));",";Hex$(Rain(0,Y0+F+4));",";
Print #1,Hex$(Rain(0,Y0+F+5));",";Hex$(Rain(0,Y0+F+6))
Next F
Print #1,";"
Print #1,"; * Read Newsflash Disk-Magazine!! *"
Print #1,""
Change Mouse 2
Close 1 : Return 
DEVPAC:
Gosub SOB : Screen To Back 2
D$="*.asm" : T1$="Type name of the Devpac" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,";"
Print #1,";  * Created with RAINBOW WARRIOR - Amos Copper Generator"
Print #1,";  *  Yup, you can blame good ol' Spadge for this one... "
Print #1,";  * Holds the data for";L$;" lines of Copper-bar info !!"
Print #1,";"
Print #1,"RDATA"
For F=1 To Val(L$)+3 Step 8
Print #1,"        Dc.w        ";Hex$(Rain(0,Y0+F-1));",";Hex$(Rain(0,Y0+F));",";
Print #1,Hex$(Rain(0,Y0+F+1));",";Hex$(Rain(0,Y0+F+2));",";
Print #1,Hex$(Rain(0,Y0+F+3));",";Hex$(Rain(0,Y0+F+4));",";
Print #1,Hex$(Rain(0,Y0+F+5));",";Hex$(Rain(0,Y0+F+6))
Next F
Print #1,";"
Print #1,"; * Read Newsflash Disk-Magazine!! *"
Print #1,""
Change Mouse 2
Close 1 : Return 
BIN:
Reserve As Work 10,1000 : Fill Start(10) To Start(10)+800,0
Gosub SOB : Screen To Back 2
D$="*.bin" : T1$="Type name of the Binary" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
XZ=Start(10)
For F=1 To Val(L$)+3
Doke XZ,Rain(0,Y0+F)
Inc XZ : Inc XZ
Next F
Change Mouse 3
Bsave F$,Start(10) To Start(10)+(Y1-Y0)
Change Mouse 2 : Return 
DE1:
Gosub SOB : Screen To Back 2
D$="*.dec" : T1$="Type name of the Decimal" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,";"
Print #1,";  * Created with RAINBOW WARRIOR - Amos Copper Generator"
Print #1,";  *  Yup, you can blame good ol' Spadge for this one... "
Print #1,";  * Holds the data for";L$;" lines of Copper-bar info !!"
Print #1,";"
For F=1 To Val(L$)+3 Step 8
Print #1,(Rain(0,Y0+F-1));",";(Rain(0,Y0+F));",";
Print #1,(Rain(0,Y0+F+1));",";(Rain(0,Y0+F+2));",";
Print #1,(Rain(0,Y0+F+3));",";(Rain(0,Y0+F+4));",";
Print #1,(Rain(0,Y0+F+5));",";(Rain(0,Y0+F+6))
Next F
Print #1,";"
Print #1,"; * Read Newsflash Disk-Magazine!! *"
Print #1,""
Change Mouse 2
Close 1 : Return 
DE2:
Gosub SOB : Screen To Back 2
D$="*.dec" : T1$="Type name of the Decimal" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,";"
Print #1,";  * Created with RAINBOW WARRIOR - Amos Copper Generator"
Print #1,";  *  Yup, you can blame good ol' Spadge for this one... "
Print #1,";  * Holds the data for";L$;" lines of Copper-bar info !!"
Print #1,";"
For F=1 To Val(L$)+3
Print #1,(Rain(0,Y0+F-1))
Next F
Print #1,";"
Print #1,"; * Read Newsflash Disk-Magazine!! *"
Print #1,""
HEX1:
Gosub SOB : Screen To Back 2
D$="*.hex" : T1$="Type name of the Hex" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,";"
Print #1,";  * Created with RAINBOW WARRIOR - Amos Copper Generator"
Print #1,";  *  Yup, you can blame good ol' Spadge for this one... "
Print #1,";  * Holds the data for";L$;" lines of Copper-bar info !!"
Print #1,";"
For F=1 To Val(L$)+3 Step 8
Print #1,Hex$(Rain(0,Y0+F-1));",";Hex$(Rain(0,Y0+F));",";
Print #1,Hex$(Rain(0,Y0+F+1));",";Hex$(Rain(0,Y0+F+2));",";
Print #1,Hex$(Rain(0,Y0+F+3));",";Hex$(Rain(0,Y0+F+4));",";
Print #1,Hex$(Rain(0,Y0+F+5));",";Hex$(Rain(0,Y0+F+6))
Next F
Print #1,";"
Print #1,"; * Read Newsflash Disk-Magazine!! *"
Print #1,""
Change Mouse 2
Close 1 : Return 
HEX2:
Gosub SOB : Screen To Back 2
D$="*.hex" : T1$="Type name of the Hex" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,";"
Print #1,";  * Created with RAINBOW WARRIOR - Amos Copper Generator"
Print #1,";  *  Yup, you can blame good ol' Spadge for this one... "
Print #1,";  * Holds the data for";L$;" lines of Copper-bar info !!"
Print #1,";"
For F=1 To Val(L$)+3
Print #1,Hex$(Rain(0,Y0+F-1))
Next F
Print #1,";"
Print #1,"; * Read Newsflash Disk-Magazine!! *"
Print #1,""
Change Mouse 2
Close 1 : Return 
BUFF:
If PB=0 Then S$="Oi! There isn't a buffer!! Create one first!!" : Gosub DT : Wait 75 : Screen To Back 2 : Return 
D$="*.buf" : T1$="Type name of Buffer" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,"RW.BUF"
Print #1,BL
For F=1 To BL
Print #1,BUFFER(F)
Next F
Print #1,"EOF"
Change Mouse 2
Close 1 : Return 
SCRIN:
D$="*.rws" : T1$="Type name of Screen" : T2$="block-file to be created" : Gosub OPFILE : If F$="" Then Return 
Open Out 1,F$
Change Mouse 3
L$=Str$(Y1-Y0) : L2$=Str$(Y1-Y0-1)
Print #1,"RW.SCN"
For F=0 To 280
Print #1,Rain(0,F)
Next F
Print #1,"EOF"
Change Mouse 2
Close 1 : Return 
LBUF:
D$="*.buf" : T1$="Type name of Buffer" : T2$="block-file to be loaded.." : Gosub OPFILE : If F$="" Then Return 
Screen 0
Open In 1,F$
Change Mouse 3
Input #1,A$ : If A$<>"RW.BUF" Then S$="This is not a Rainbow Warrior Buffer file!!" : Gosub DT : Close 1 : Wait 50 : Screen To Back 2 : Return 
Input #1,BL : PB=1 : For F=1 To BL
Input #1,BUFFER(F)
Next F
Change Mouse 2
Close 1 : Return 
LSCR:
D$="*.rws" : T1$="Type name of Screen" : T2$="block-file to be loaded.." : Gosub OPFILE : If F$="" Then Return 
Screen 0
Open In 1,F$
Change Mouse 3
Input #1,A$ : If A$<>"RW.SCN" Then S$="This is not a Rainbow Warrior Screen file!!" : Gosub DT : Close 1 : Wait 50 : Screen To Back 2 : Return 
For F=0 To 280
Input #1,CVV : Rain(0,F)=CVV : View 
Next F
Change Mouse 2
Close 1 : Return 
OPFILE:
F$=Fsel$(D$,"",T1$,T2$)
Screen 0
Return 
SOB:
S$="Save details of Entire screen or a clip ? S/C" : Gosub DT
PP:
Do 
KK$=Upper$(Inkey$)
Exit If KK$<>""
Loop 
If KK$="S" Then Y0=0 : Y1=280 : Return 
If KK$="C" Then S$="Grab Clip Now !" : Gosub DT : GROWBOX : Y0=GY1-1 : Y1=GY2+1 : Return 
Goto PP
GM:
Do 
Exit If Mouse Click=1
Loop 
