home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-09-28 | 8.4 KB | 234 lines |
- '***************************
- '* AMOS Professional *
- '* *
- '* AMAL_7 * Autotest
- '* *
- '* (c) Europress Software *
- '* *
- '* Ronnie Simpson *
- '***************************
- '
- '-------------------------------------------
- 'General
- '-------------------------------------------
- 'The Amal autotest system allows certain tests to be performed each 1/50th
- 'of a second side-stepping some of the problems that can arise with say a
- 'set of move instructions which may take several seconds to complete.
- 'Only certain instructions can be used with these routines and there is also
- 'a couple of others that are solely for use with AUtotest.
- '
- 'The following is a complete list of instructions that can be used with
- 'AUtotest:-
- '-------------------------------------------
- 'AUtotest
- '-------------------------------------------
- 'keyword AU
- '
- 'This is the command which defines which tests have to be performed and the
- 'action to be taken.
- 'The tests are placed within a pair of brackets following the instruction:-
- '
- ' AUtotest (list of tests)
- '-------------------------------------------
- 'Let
- '-------------------------------------------
- 'Keyword L
- '
- 'This is the standard Amal Let instruction for assigning a value to a
- 'register:-
- ' Let X=R0
- '-------------------------------------------
- 'Jump
- '-------------------------------------------
- 'keyword J
- '
- 'This again is the standard Amal Jump instruction which jumps program
- 'control to a label, this label must be within the Autotest brackets.
- '
- ' If R0>XM Jump Label
- '-------------------------------------------
- 'eXit
- '-------------------------------------------
- 'keyword X
- '
- 'The eXit instruction is used to quit the AUtotest and rejoin the Amal
- 'program at the point it was left.
- '
- ' If A=10 eXit
- '-------------------------------------------
- 'Wait
- '-------------------------------------------
- 'keyword W
- '
- 'The Wait command turns off the rest of the Amal program and only executes
- 'the AUtotest routine. This instruction should be issued outside the Autotest
- 'brackets.
- '
- ' Let X=XM;Let Y=YM;Wait
- '
- '-------------------------------------------
- 'If
- '-------------------------------------------
- 'keyword I
- '
- 'This is an extended form of the Amal If instruction which allows three
- 'alternative outcomes to the test.
- '
- ' If....Jump Label (jump to another part of the AUtotest)
- ' If....Direct label (jump to main Amal program label)
- ' If....eXit (quit AUtotest and rejoin program)
- '
- '-------------------------------------------
- 'On
- '-------------------------------------------
- 'keyword O
- '
- 'The On instruction will restart an Amal program after a previous Wait.
- '
- ' label: On; Pause Jump Start
- '
- '-------------------------------------------
- 'Direct
- '-------------------------------------------
- 'keyword D
- '
- 'The Direct instruction will quit the Autotest at the next Vbl and rejoin
- 'the main Amal program at the given label. this label must be outside the
- 'Autotest barckets.
- '
- ' Direct Loop
- '
- '-------------------------------------------
- 'A small example of an Amal AUtotest
- '-------------------------------------------
- '
- ' A$=AUtotest(If R0>320 Jump Reverse; Rem *** start of AUtotest(
- ' A$=A$+"If R0<0 Jump Forward; else eXit"
- ' A$=A$+"Reverse: Let R1=-1; Direct label"
- ' A$=A$+"Forward: Let R1=1; Direct label)" Rem *** end of AUtotest)
- ' A$=A$+"label: Let X=X+R1; Wait"
- '
- '-------------------------------------------
- 'End
- '-------------------------------------------
- 'Keyword E
- '
- 'The final instruction to complete the Amal list of commands is End, this
- 'will terminate an entire Amal program and turn off the AUtotest if it is in
- 'operation:-
- '
- ' Quit: End
- '
- '-------------------------------------------
- 'complete Amal example
- '-------------------------------------------
- INIT
- Dim C$(6)
- Auto View Off
- Rem *** load some objects to work with and clear the screen
- '
- Load "AmosPro_Tutorial:Objects/Amal_Bobs.abk"
- Screen Open 1,320,200,4,Lowres : Curs Off : Flash Off : Cls 0
- Screen Open 0,320,200,16,Lowres : Flash Off
- Get Sprite Palette : Colour Back $77 : Curs Off : Cls 0 : Hide
- Ink 4 : Box 0,0 To 319,199 : Set Paint 1 : Ink 12,1,4 : Bar 45,7 To 300,15
- Limit Mouse 130, To 430, : Make Mask
- Global HITS,F$
- '
- Rem *** Amal program for moving gun
- A$="Label:If RB=1 Jump Image;Let A=11;Let X=XM;Pause Jump Label;Image: Let A=12;Let X=XM;Pause Jump Lable"
- Rem *** Amal program for bullet
- B$="Anim 0,(9,2)(10,2);LetX=XM;LetY=208;LetRA=1;LetRB=1;Move0,-40,4;LetRB=0;Move0,-160,16;Let RA=0"
- Rem *** Amal programs for moving birds
- X$=";LR0=Z(50)+80;FR1=1TR0;P;NR1"
- C$(1)=X$+"A 0,(1,2)(2,2)(3,2)(4,2);L X=330;LY=Z(120)+20;M -360,0,120"
- C$(2)=X$+"A 0,(5,1)(6,1)(7,1)(8,1);L X=-30;LY=Z(120)+20;M 360,0,90"
- C$(3)=X$+"A 0,(1,1)(2,1)(3,1)(4,1);L X=330;LY=Z(80)+95;M -360,-75,90"
- C$(4)=X$+"A 0,(5,3)(6,3)(7,3)(8,3);L X=-30;LY=Z(80)+95;M 360,-75,180"
- C$(5)=X$+"A 0,(1,3)(2,3)(3,3)(4,3);L X=330;LY=Z(110)+65;M -360,-45,180"
- C$(6)=X$+"A 0,(5,2)(6,2)(7,2)(8,2);L X=-30;LY=Z(110)+65;M 360,-45,120"
- Rem *** Amal program for timer
- D$="L RZ=0;L X=400;M -230,0,2300;L RZ=1"
- Rem *** Amal program for guano
- E$="A 0,(13,6)(14,6)(15,6)(14,6);L X=RX;L Y=RY: L: L Y=Y+2;P;If Y>242 JS JL;S:A0,(17,2)(18,2);FR0=1T75;NR0 LY=300"
- Rem *** Amal program for bird death
- F$="LA=4;M0,240,20"
- '
- LEVEL=0 : Paper 0 : Pen 12 : Locate 1,1 : Print "TIME"
- Auto View On : Double Buffer
- '
- Rem *** start of the main game loop
- Do
- Screen To Front 0 : Screen 0 : Bob Off : Wait Vbl
- Pen 8 : Inc LEVEL : Locate 1,23 : Print "LEVEL";LEVEL : TARGET=15+LEVEL*5
- Locate 23,23 : Print "Target ";TARGET;" hits"
- Rem *** assign sprites and bobs to the correct amal channels
- Sprite 8,128,217,11 : Sprite 10,0,218,9 : Sprite 11,400,58,16 : Sprite 14,0,260,14
- For N=1 To 6 : Bob N,0,300,1 : Channel N To Bob N : Next
- Amal 8,A$ : Amal On 8 : Amal 11,D$ : Amal On 11 : Wait 2
- Rem *** start of level loop
- Amreg(0)=0 : HITS=0
- Repeat
- Rem *** restart birds if they are not moving
- Add N,1,1 To 6
- If Not Chanmv(N)
- Amal N,C$(N) : Amal On N
- Rem *** drop guano if there is none
- Else
- If Y Sprite(14)>250 and X Bob(N)>0 and X Bob(N)<300
- Amreg(24)=Y Hard(Y Bob(N)) : Amreg(23)=X Hard(X Bob(N))
- Amal 14,E$ : Amal On 14
- End If
- End If
- Rem *** fire bullet
- If Amreg(0)=0 and Mouse Key=1
- Amal 10,B$ : Amal On 10 : Shoot
- End If
- Rem *** collision routines
- If Sprite Col(8,14 To 15) Then Flash 27,"(000,2)(FF0,2)(F00,2)" : Amal Freeze 8 : Wait 50 : Flash Off : Colour 27,0 : Amal On 8
- If Spritebob Col(10,1 To 6) Then Proc HIT
- Rem *** end of level loop
- Until Amreg(25)=1
- '
- Rem *** mark up results
- For N=30 To 60 : Bell N : Wait Vbl : Next
- Amal Off : Sprite Off : Screen To Front 1 : Screen 1 : Cls 0 : Paper 0 : Pen 1
- Locate 0,7 : Centre "***LEVEL"+Str$(LEVEL)+" RESULT***"
- Locate 0,9 : Centre "Target number of hits"+Str$(TARGET)
- Locate 0,11 : Centre "Actual number of hits"+Str$(HITS)
- BONUS=(HITS-TARGET)*(100+LEVEL) : If BONUS<0 Then BONUS=0
- Locate 0,13 : Centre "Bonus points for this round="+Str$(BONUS)
- Repeat : Until Mouse Key=0
- Fade 4,$20,$BB0,
- If HITS=>TARGET
- SCORE=SCORE+BONUS
- Locate 0,15 : Centre "Total score so far"+Str$(SCORE)
- Locate 0,20 : Centre "Press right mouse button to continue"
- Repeat : Until Mouse Key=2
- Fade 2 : Wait 30
- Else
- Locate 0,15 : Centre "G A M E O V E R"
- Locate 0,17 : Centre "Final score "+Str$(SCORE)
- Locate 0,22 : Centre "Press right mouse to quit"
- Repeat : Until Mouse Key=2
- Edit
- End If
- Loop
- '
- Procedure HIT
- For N=1 To 6
- If Col(N) Then Sprite 10,500,, : Amal N,F$ : Amal On N : Sam Play 15,1,Rnd(7000)+2000
- Next
- Inc HITS
- End Proc
- Procedure INIT
- Curs Off : Cls 6 : Paper 6 : Pen 2
- Locate 0,3 : Centre "CANARY OPEN SEASON"
- Pen 5 : Locate 0,7 : Centre "It's time for some target practice with"
- Locate 0,9 : Centre "the canaries, but these little birdies"
- Locate 0,11 : Centre "have been feeding at the local nuclear"
- Locate 0,13 : Centre "power plant-- so look out for the"
- Locate 0,15 : Centre "radioactive guano!"
- Pen 4 : Locate 0,20 : Centre "Press any mouse key to play."
- Repeat : Until Mouse Key
- End Proc