I've managed to read AMAL programs within a string.
example....
[Code]
; AMAL Demo (very early version)
;
; This example moves a sprite accros the screen changing its image. It then repeats.
;
Include "AMAL.bb" ; Always include the AMAL file first!
Graphics 640,480,32,2
SetBuffer BackBuffer()
Color 255,0,0:Rect 0,0,31,31 ; Create a sprite image
Sprite_Grab(1,0,0,31,31) ; Grab it to image Bank. (Image_No,x,y,w,h)
Color 0,255,0:Rect 0,0,31,31 ; create another sprite image (2)
Sprite_Grab(2,0,0,31,31)
Color 0,0,255:Rect 0,0,31,31 ; Create a third sprite image
Sprite_Grab(3,0,0,31,31)
Color 255,0,255:Rect 0,0,31,31 ; Create a forth sprite image
Sprite_Grab(4,0,0,31,31)
Color 0,255,255:Rect 0,0,31,31 ; Create a fifth sprite
Sprite_Grab(5,0,0,31,31)
a$="LA:" ; Label A
a$=a$+"X = 0000:" ; Start X Position at 0
a$=a$+"Y = 0000:" ; Start Y Position at 0
a$=a$+"A = 0001:" ; Change the image to Anim Frame 1 from the image bank
a$=a$+"P:" ; Pause. Stops execution. Resumes next time around.
a$=a$+"X + 0050:" ; Move it right 50 pixels relative to current X
a$=a$+"Y + 0000:" ; Leave the Y coordinate alone
a$=a$+"A = 0002:" ; Change Image to image No 2 from the Image bank
a$=a$+"P:" ; Pause
a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0003:" ; Change image to Image No 3
a$=a$+"P:" ; Pause
a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0004:" ; Change Image to Image No 4
a$=a$+"P:" ; Pause
a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0005:"
a$=a$+"P:" ; Pause
a$=a$+"JL LA:" ; Jump to Label LA
AMAL$(1)=a$ ; Assign the animation string to an AMAL channel.
Cls
Repeat
Synchro(1,1) ; Execute AMAL strings from S to E (range 1 to 255)
Sprite_Draw(1,1) ; Draw all sprites from S to E (range 1 to 255)
Flip:Cls
Until KeyHit(1)
End
[/Code]
If you try and run it, it wont work because I haven't included the AMAL.bb source.
To do.....
1. Local internal variables. Probably RA to RZ to remain compatible with AMOS.
2. Condition checking then branch. eg 'IF X = 640 JUMP LB:'
3. An 'EXIT' instrunction.
4. External commands to retrieve values from within an AMAL program.
5. Probably more.....
example....
[Code]
; AMAL Demo (very early version)
;
; This example moves a sprite accros the screen changing its image. It then repeats.
;
Include "AMAL.bb" ; Always include the AMAL file first!
Graphics 640,480,32,2
SetBuffer BackBuffer()
Color 255,0,0:Rect 0,0,31,31 ; Create a sprite image
Sprite_Grab(1,0,0,31,31) ; Grab it to image Bank. (Image_No,x,y,w,h)
Color 0,255,0:Rect 0,0,31,31 ; create another sprite image (2)
Sprite_Grab(2,0,0,31,31)
Color 0,0,255:Rect 0,0,31,31 ; Create a third sprite image
Sprite_Grab(3,0,0,31,31)
Color 255,0,255:Rect 0,0,31,31 ; Create a forth sprite image
Sprite_Grab(4,0,0,31,31)
Color 0,255,255:Rect 0,0,31,31 ; Create a fifth sprite
Sprite_Grab(5,0,0,31,31)
a$="LA:" ; Label A
a$=a$+"X = 0000:" ; Start X Position at 0
a$=a$+"Y = 0000:" ; Start Y Position at 0
a$=a$+"A = 0001:" ; Change the image to Anim Frame 1 from the image bank
a$=a$+"P:" ; Pause. Stops execution. Resumes next time around.
a$=a$+"X + 0050:" ; Move it right 50 pixels relative to current X
a$=a$+"Y + 0000:" ; Leave the Y coordinate alone
a$=a$+"A = 0002:" ; Change Image to image No 2 from the Image bank
a$=a$+"P:" ; Pause
a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0003:" ; Change image to Image No 3
a$=a$+"P:" ; Pause
a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0004:" ; Change Image to Image No 4
a$=a$+"P:" ; Pause
a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0005:"
a$=a$+"P:" ; Pause
a$=a$+"JL LA:" ; Jump to Label LA
AMAL$(1)=a$ ; Assign the animation string to an AMAL channel.
Cls
Repeat
Synchro(1,1) ; Execute AMAL strings from S to E (range 1 to 255)
Sprite_Draw(1,1) ; Draw all sprites from S to E (range 1 to 255)
Flip:Cls
Until KeyHit(1)
End
[/Code]
If you try and run it, it wont work because I haven't included the AMAL.bb source.
To do.....
1. Local internal variables. Probably RA to RZ to remain compatible with AMOS.
2. Condition checking then branch. eg 'IF X = 640 JUMP LB:'
3. An 'EXIT' instrunction.
4. External commands to retrieve values from within an AMAL program.
5. Probably more.....