~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ Amos Logo. ~ ~ By J.Rutherford ~ ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ One of the things that I always wanted to make was LOGO. I didn't know how to make it, then I thought; "Why not make it with Amos!!!" after all, Amos is the ideal language to use for creating other languages. O.K. it doesn't have a compiled speed anywhere as near as machine code or intuition commands as good as C, but it's easy to get work out and quick to write programs on it. Can anyone remeber DART on the BBC? You know, that program where you typed in things like "Forward 10" to make it move forwards and stuff like that. That was probably the best known example of the 'logo' programming language, it worked on set commands to do with moving a pointer around the screen, drawing lines and things like that. This month, we are going tostart creating a LOGO language in Amos that can load and save pictures, print pictures and draw shapes on the screen. All the above will take quite a long time to make so this can be the start of a multi part series. Who knows, when you've finished the program, you could add a graphical user interface and release it into P.D. Fame !!! The 1 command that will really be the basis of our logo programming language is: GR LOCATE. The usage of this command is:- Gr Locate x,y Where X is the x co-ordinate of the point you want to locate the cursor at and y is the y co-ordinate. Eg. If we wanted to locate the graphics cursor at x(100), y(150) we would type:- Gr Locate 100,150. We will use this command to enable us to draw from the current position on the screen to anywhere else without having to use lots of different drawing routines and complex stuff. Remember the best thing you can do when programming is keep it simple. Why make something more complicated than it really needs to be? We will use it to set the position of the cursor, or where where we are drawing the line from, when we type in forward 10. This way, we can even say the co-ordinates of the last drawn point when we save our drawing !!! If you're still confused by what the graphics cursor is, think of it as being the same as the text cursor. You can locate it where you want and then instead of typing some text we type a command to draw a line using the command "draw to". For usage of this command see the article in this beginners section. Right, down to the nitty gritty: Here's the source code. '***OPEN SCREEN*** Screen Open 0,320,200,2,Lowres ' '***Set Graphics Cursor Co-ordinates*** X=150 : Y=100 ' '***Start Main Loop*** Do Gr Locate X,Y '***Ask for an input Locate 0,0 : Input A$ ' '*** Convert input to uppercase. A$=Upper$(A$) ' ' '***Move forward routine If Left$(A$,1)="F" Input A Add Y,-A Draw Xgr,Ygr To X,Y End If ' ' '***Move down routine*** If Left$(A$,1)="D" Input B Add Y,B Draw Xgr,Ygr To X,Y End If ' ' '***Move left routine*** If Left$(A$,1)="L" Input C Add X,-C Draw Xgr,Ygr To X,Y End If ' ' '***Move right routine*** If Left$(A$,1)="R" Input D Add X,D Draw Xgr,Ygr To X,Y End If ' '***Go back to start*** Loop After we've loaded in this code from the disk, and ran the program we should type "Forward" or something resembeling "Forward" to make it draw a line forward, it's so intelligent we could even type "FurWald" or "Floppy rabbits" and it would still work. We are then confronted by another prompt. This time we have to type in a value that we want to move the cursor forward, in a straight line. Once we've typed in a value, BINGO!, we should see a line appear on the screen. The majority of this program, is just taking an input, setting the Graphics Cursor and moving the cursor in a different direction, according to the input. Next issue, a continuation of the series. Jonathan.