home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
351-375
/
apd375
/
progs
/
dual_play.amos
/
dual_play.amosSourceCode
Wrap
AMOS Source Code
|
1992-05-23
|
12KB
|
303 lines
'DATE: 07/01/92
'TIME: 22:07
'NAME: DUAL_PLAY.AMOS
'CODE: UNCLE SIME
'NOTE: YOU NEED THE CTEXT EXTENSIONS TO RUN THIS UN-COMPILED!
'THOUGHT FOR THE DAY: Life Is Like A Barbequed Sausage --
' Small, Burnt 'n Crispy 'n Not Very Tasty At All!
' I really enjoyed doing this one!
' Wotcher One and all,
' Once again if you are a beginner this piece of code may be on the
' side of complex but try reading through it, if only to get a feel for
' what is going on.
' "I Have Seen Things You People Wouldn't believe.
' Attack Ships On Fire Off The Shoulder Of Orion.
' I've Watched Sea Beams Glitter In The Darkness At
' Ten Hauser Gate. All Those Moments Will Be Lost
' In Time Like Tears In Rain."
' Time To Die...
' If any AMOS coders (beginners in particular) need help then drop me a line
' and I'll try to help - After all thats what the TOTALLY AMOS disk is all about.
' IF YOU WANT A REPLY INCLUDE POSTAGE ETC OTHERWISE I WON'T REPLY SO THERE!
' The Address: Uncle Simes
' The Warehouse,
' 118 Hiltingbury Rd,
' Chandlers Ford,
' Eastleigh,
' Hants.
' S05 1NT
' * MODULE LEVEL CODE *
' 1] Set the correct disk path / Directory
' 2] Kill system environment
' 3] Setup our environment
' 4] Do the main thing
' 5] Quit back to editor
Dir$="SIMES_PROGS1:"
Close Workbench
Close Editor
Screen Close 0
INITIALISE
MAIN
End
' * PROCEDURE LEVEL CODE *
Procedure MAIN
' This is the main procedure. First I set up all the scroll text stuff
' then I call the rainbow procedures. I then initialise the scroll text
' variables, these variables do the following.
' LOCATION - The position where we are in TTEXT$ i.e if location = 1 we
' would be on the character H. 2 and we would be on character O etc
' SCRCOUNT - Keeps a track of how far the screen has scrolled so we know when
' to place the next character on the screen.
' SCRSPEED - The speed at which we wish to scroll the text e.g 1or 2 or 4 or 8 etc pixels
' at a time (the larger the number the jerkier the movement)
' COUNT - Controls the update of the dual playfield. Works in conjunction with the
' Screen Offset command. (AMOS manual page 126) In this case I am updating
' the X position (left / right) where a +ve number causes a right to left
' scroll and a -ve number a left to right scroll.
' Next I define a scroll zone for the scrolly text. (AMOS manual page 133)
' The screens are then displayed one after the other (could have neater).
' Then were into the Repeat loop which constantly scrolls the text and playfields
' until the left mouse button is pressed. Note the line Ctext 349,44,Mid$(TTEXT$,LOCATION,1),
' this is the piece of code that places the correct letter on the screen . Try typing
' the following in DIRECT mode NOTE: <Rtn> means press the return key!
' Default <Rtn>
' A$="ZARDOZ" <Rtn>
' PRINT Mid$(A$,1,1) <Rtn> System Should reply - Z i.e 1st character of string is a Z
' PRINT Mid$(A$,3,1) <Rtn> System Should reply - R i.e 3rd character of string is an R
' See AMOS manual page 54 for full example of Mid$
' Once the left mouse button has been pressed I delete all rainbows, close all screens
' erase all memory banks, Call the MUZAK_DOWN procedure to fade out the music and then
' return to the MAIN MODULE level code were an end statement is encountered.
' This instruction kills multitasking!
Dreg(0)=Execall(-132)
TTEXT$=" 10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - ID - AMOS STATUS - BONKERS! "
TTEXT$=TTEXT$+" HOLY ZARDOZ! AND SINGING FISH! - - - - UNCLE SIMES IS BACK ON LINE! - - - - AND "
TTEXT$=TTEXT$+"WOW! COP A LOAD OF THIS THEN! IF YOU HAVE BEEN HAVING A BIT OF BOTHER "
TTEXT$=TTEXT$+"WITH YOUR DUAL PLAYFIELDS THEN THIS COULD BE YOUR LUCKY DAY BECAUSE THIS CODE "
TTEXT$=TTEXT$+"IS A DEMONSTRATION OF HOW TO SET UP AND SCROLL A DUAL PLAYFIELD USING "
TTEXT$=TTEXT$+"HARDWARE SCROLLING RATHER THAN AMAL! - - - - THE MUSIC YOU "
TTEXT$=TTEXT$+"CAN HEAR IS FROM BENSON DEMO II (APD 125) AN EXCELLENT EXAMPLE OF HOW "
TTEXT$=TTEXT$+"TO CODE PROPERLY! - BENSON HOPE YOU DONT MIND ME USING "
TTEXT$=TTEXT$+"YOUR MUSIC AS ITS ALL I HAVE AT PRESENT (ANY BUDDING MUSICIANS "
TTEXT$=TTEXT$+"OUT THERE TAKE NOTE!) ANYWAY WHEN ARE WE GOING TO SEE ANOTHER BENSON DEMO? "
TTEXT$=TTEXT$+"SOON I HOPE - - - - SQUEEZE YOUR LEFT BUTTOCK TO GET OUT OF HERE! - - - - "
TTEXT$=TTEXT$+"THANKS FOR THE PHONE CALL AND THE COMMENTS LEN HOPE YOU LIKE THIS ONE! - - - - "
TTEXT$=TTEXT$+"GREETINGS TO ALL AMOS PROGRAMMERS OUT THERE - - - - SYNTEX TELL ME IS THE RUMOR "
TTEXT$=TTEXT$+"TRUE THAT YOU ARE NOT GOING TO DO ANY MORE DEMOS? - - - - IF SO ITS A GREAT LOSS!!!! - - - - "
TTEXT$=TTEXT$+"- - - - HAVE FUN WITH THE CODE PEPS - - - - FINALLY GREETINGS TO - AARON (THANKS FOR THE HELP "
TTEXT$=TTEXT$+" WITH THE COMPILER PROBLEM) - LEN AND ANNE - FRANCOIS AND DAISY! (WOOF! RUFF! WOOF!) - "
TTEXT$=TTEXT$+"PHIL SOUTH (LIKE THE NEW LOOK COLUMN - 4 PAGES WOW!) - SANDRA (MY DISKS ARRIVED IN 24 HRS - BRILLIANT! - ) "
TTEXT$=TTEXT$+"PETER HICKMAN (GREAT NEW MAG MR EDITOR SIR - GROVEL! GROVEL!) - AND ANY BOUNCERS THAT HAVE TO WEAR PINK THESE DAYS! - "
TTEXT$=TTEXT$+"- - - - SIMES OUT - - - - - - - - REPEATING - - - - "
SKY_RBOW
Wait Vbl
WATER_RBOW
Wait Vbl
Screen 3
LOCATION=0
SCRCOUNT=0
SCRSPEED=4
COUNT=0
Def Scroll 1,0,0 To 382,45,-SCRSPEED,0
For LOP=1 To 2
Screen Show LOP
Wait Vbl
Next LOP
Wait Vbl
Repeat
Scroll 1
Add SCRCOUNT,SCRSPEED
If SCRCOUNT>16
Inc LOCATION
SCRCOUNT=0
If LOCATION>Len(TTEXT$)
LOCATION=1
End If
Extension_8_0006 349,44,Mid$(TTEXT$,LOCATION,1)
End If
Inc COUNT
If COUNT>159 Then COUNT=0
Screen Offset 2,320-COUNT*2,0
Screen Offset 1,COUNT*2,0
Wait Vbl
Until Mouse Key=1
Rainbow Del
For LOP=0 To 3
Screen Close LOP
Next LOP
Erase 10
MUZAK_DOWN
Wait 100
' Restore multitasking
Dreg(0)=Execall(-138)
End Proc
Procedure INITIALISE
' This procedure sets everything up. Does the following...
' 1] Calls FONT_SET procedure to grab CTEXT font
' 2] Calls MUZAK_UP procedure to fade in music
' 3] Opens screen 1 and 2, positions them in the Y axis (up and down)
' and declares them to be a dual playfield.
' 4] I then Set the correct screen to work with and call the procedures
' that draw the foreground (procedure PILLARS) and the background
' (procedure MOUNTAINS) images.
' 5] Next I set the palette. I obtained the colour settings from Delux Paint
' as I was drawing each of the images. All you need to do is decide
' on your resolutions (see AMOS manual pages 127-129) and remember
' that colour 0 is transparent (i.e if you draw in colour 0 on the
' image that is going to be in the foreground you will see through to
' the background image). I always set colour 0 of both pictures to $000
' (black) in this way I always remember what's happening. Finally to
' get a copy of the colours I use the palette requester from the colour
' control menu option in Delux Paint and write them down.
' 6] Finally I open screen 3 and position it in the y axis again. This screen
' is used to display the bottom scroll text and has only 2 colours. I then
' create a clone of screen 3 (screen 0 see AMOS manual page 127) and position
' it at the top of the screen.
FONT_SET
MUZAK_UP
Wait Vbl
Screen Open 1,640,104,8,Lowres
Screen Hide 1
SET_SCREEN
Screen Open 2,640,104,8,Lowres
SET_SCREEN
Screen Display 1,,135,,
Screen Display 2,,135,,
Wait Vbl
Dual Playfield 1,2
Screen 1
MOUNTAINS
Screen 2
PILLARS
Screen 1
Palette $0,$FFF,$DDD,$BBB,$AAA,$888,$666,$80,$0,$FFF,$DDF,$AAF,$88F,$55F,$33F,$F
Wait Vbl
Screen Open 3,384,45,2,Lowres
SET_SCREEN
Screen Display 3,,251,,
Palette $0,$F00
Screen Clone 0
Screen Display 0,,60,,
Wait Vbl
End Proc
Procedure PILLARS
' This little procedure loads the picture of the pillars (foreground
' screen on the dual playfield) into memory bank 14 and is then unpacked
' to screen 3 (which dosen't need to be set up as AMOS does this). I
' then hide the screen and switch to screen 1.
' Next I copy the picture twice to screen 1 (screen 1 is a 640 * 104
' bitmap but screen 3 is a 320 * 104 bitmap therefore we need to get the same
' image twice from screen 3 to fill screen 1. i.e 2 * 320 = 640 ). I then erase
' the memory bank (14) and close screen 3 as I won't need the image again
' and chip memory should be used carefully.
Load Dir$+"PICS/ARCHES.ABK",14
Unpack 14 To 3
Screen Hide 3
Screen Copy 3,0,0,320,104 To 1,0,0
Wait 10
Screen Copy 3,0,0,320,104 To 1,320,0
Wait 10
Erase 14
Screen Close 3
End Proc
Procedure MOUNTAINS
' Same as PILLARS procedure except this time we are working with the
' background dual playfield screen.
Load Dir$+"PICS/MNT_REFLECT.ABK",13
Unpack 13 To 4
Screen Hide 4
Screen Copy 4,0,0,320,102 To 2,0,0
Wait 10
Screen Copy 4,0,0,320,102 To 2,320,0
Wait 10
Erase 13
Screen Close 4
End Proc
Procedure SET_SCREEN
' The old screen set procedure. Every disk of ascii procedures should
' have one.
Curs Off
Flash Off
Hide On
Cls 0
End Proc
Procedure FONT_SET
' This procedure sets up the system so it can use CTEXT fonts. If you
' want to know more about CTEXT get a copy of Feburary 1992's Amiga
' Shopper, turn to page 109 and read Phil South's AMOS ACTION collum.
' Nice review Phil.
Load Dir$+"FONTS/TRANS_DOUB_FNT.ABK"
No Icon Mask
Wait 1
Bank Swap 2,10
Wait 1
Bload Dir$+"FONTS/TRANS_DOUB_FNT.ABK.CFNT", Extension_8_0044
Extension_8_0016 0,0
Erase 2
Wait 1
End Proc
Procedure MUZAK_UP
' This one fades in the music slowly. Thanks Benson Hope its ok to
' use the music.
Load Dir$+"MUSIC/BENSON.ABK"
Wait 1
Mvolume 0
Music 1
Tempo 18
Led Off
For M=0 To 63 Step 1
Wait 5
Mvolume M
Next M
End Proc
Procedure MUZAK_DOWN
' Guess what this procedure does....
For M=63 To 0 Step -1
Wait 5
Mvolume M
Next M
Music Off
Erase 3
End Proc
Procedure SKY_RBOW
' This is the rainbow that appears behind the mountains. Was created
' using good old Spages Rainbow Warrior. Available from Sandra at the
' AMOS PD Library (APD 77 & every copy includes a free limpet mine)
Set Rainbow 0,0,65,"","",""
Rainbow 0,0,114,65
Colour Back 0
Restore RDATA
For C=0 To 64
Read CVA
Rain(0,C)=CVA
Next C
View
RDATA:
Data $0,$16,$16,$16,$27,$27,$27,$27
Data $38,$38,$38,$38,$49,$49,$5A,$49
Data $5A,$6B,$5A,$6B,$7C,$6B,$7C,$7C
Data $8D,$8D,$8D,$8D,$9E,$9E,$AF,$AF
Data $AF,$AF,$AF,$1BF,$1BF,$2CF,$2CF,$3DF
Data $3DF,$4EF,$4EF,$5EF,$5EF,$6EF,$6EF,$7EF
Data $7EF,$8EF,$8EF,$9EF,$9EF,$AEF,$AEF,$BEF
Data $BEF,$CEF,$CEF,$DEF,$DEF,$EEF,$EEF,$EEF
Data $EEF,$0,$0,$0,$0,$0,$0,$0
End Proc
Procedure WATER_RBOW
' See SKY_RBOW for details. Draws rainbow that acts as water reflection.
Set Rainbow 1,0,39,"","",""
Rainbow 1,0,188,39
Colour Back 0
Restore RDATA
For C=0 To 38
Read CVA
Rain(1,C)=CVA
Next C
View
RDATA:
Data $8D,$8D,$8D,$8D,$9E,$9E,$AF,$AF
Data $AF,$AF,$AF,$1BF,$1BF,$2CF,$2CF,$3DF
Data $3DF,$4EF,$4EF,$5EF,$5EF,$6EF,$6EF,$7EF
Data $7EF,$8EF,$8EF,$9EF,$9EF,$AEF,$AEF,$BEF
Data $BEF,$CEF,$CEF,$DEF,$DEF,$EEF,$EEF,$EEF
End Proc