Swift Turtle V1.1 by Arjun Nair (C) 2008 ---------------------------------------- Welcome to the world of Turtle Graphics on Sinclair BASIC! :) Despite the name ST is actually quite slow (unless you're using the compiled version) :P, so you might want to bump up the emulation speed just a bit you know. Right. Without further beating around the bush, on to the boring bits then - commands in ST: The turtle can be manipulated with the following commands:- ht - Hide turtle. This hides the turtle on the screen but you can still perform all the other usual comands. st - Shows turtle (if it's hidden) on the screen. rt d - rotates the turtle clockwise by d degrees. lt d - rotates the turtle anti-clockwise by d degrees pu - pen up. You can move the turtle around but nothing will be drawn on screen. pd - pen down. This reverts to drawing mode. fd n - moves the turtle forward by n pixels. You'll have to ensure that the turtle is within screen boundaries, or crap *will* happen! The turtle isn't so clever I'm afraid. bk n - moves the turtle back by n pixels. You'll have to ensure that the turtle is within screen boundaries, or crap *will* happen! The turtle isn't so clever I'm afraid. cs - clears the screen. This will wipe out whatever you've drawn on the screen and restore the turtle to home position. hm - puts the turtle back home - namely the center of the screen facing up. pe - pen erase. This basically is the eraser mode and the turtle will wipe out whatever it's moving over. pp - pen paint. Back to drawing mode from eraser mode. ic n - Ink Colour. Sets the current drawing colour to n. pc n - Paper Colour. Sets the current paper colour to n. bc n - Border Colour. Sets the current border colour to n. sp x,y - Sets the turtle to x and y co-ordinates. You'll have to ensure the turtle is within screen boundaries, or crap *will* happen! The turtle isn't so clever I'm afraid. eh - The help page. ms - Macro start. See the notes below for explanation of Macros me - Macro end. cm - Clear Macro. This will wipeout the previously entered macro. Make sure you save the macro if you want to preserve it! lm - List macro. This will display the commands stored in the macro. sv - Save Macro. This will save the currently entered macro to tape. ld - Load Macro. This will load a macro from tape. rm - Run Macro. This will execute the currently entered macro. rp n - This will repeat the currently entered macro n times. NOTES: 1) Some of the above commands are non-standard turtle commands (i.e I made them up.). You won't find them in any logo/turtle manual or something. ;) 2) Each turtle command should be entered on its own line. No multiple command enteries in one line please! It won't work. :P 3) If you BREAK out of the program in the compiled version for some reason, use GO TO 1 to restart the program. Do *NOT* use RUN!!! MACROS ------- A macro is a container for a specific set of commands. The macro name can then be substitued for that set of commands whenever required. For eg, consider the command to draw a square: rt 90 fd 10 rt 90 fd 10 rt 90 fd 10 rt 90 fd 10 You could put rt 90 fd 10 into a macro, like so (don't enter the stuff in brackets - those are my comments!): ms (this starts the macro listener) rt 90 fd 10 me (this stops the macro listener) You now have a macro with the commands rt 90 fd. You can view the macro listing by entering lm (this lists the macro) Right. So you have a macro, but now what you ask? Well to draw the same above square you can do so: cs (this clears the screen) rm rm rm rm The above runs the macro four times and therefore draws a square! If you run it only twice, you'll get an inverted L shape. Try it! There is another way to draw the square by using the above macro. Instead of entering "rm" four times you can do so: cs (this clears the screen) rp 4 The above command repeats the macro 4 times, which is the same as running the macro four times but the difference is that ST does this for you automatically! I suppose you could come up with some really clever macros once you get the hang of it. EXAMPLE PROGRAM -------------------------------------------- As a parting shot, here is a listing that draws a circle: sm (starts the macro mode) rt 10 fd 10 se (ends the macro mode) cs (clears the screen so that we start with a clean slate) rp 36 That's it! Experiment and enjoy! Pls report all bugs on the World of Spectrum Forums. I'm usually lurking in there. :) Ver 1.1 change log ------------------ * Changed some colours here and there * Changed placement of HUD to the bottom of the screen * Used a fancy hack to use input on line 23 without having to wipeout line 22 first (thx to Bob Stains). This doesn't work in the compiled version however so I had to resort to some fancy INKEY$ handling to simulate INPUT. Thus, the .bas version and the compiled version source differ from lines 50 to 55. * Fixed a bug in Load Macro which would load the macro but not allow the user to use it. Duh! * Fixed heading information which would go below 0 and over 360 otherwise. * Added commands to change ink, paper and border colours. * Added some sanity checks to the sp command to ensure user doesn't set turtle to beyond screen boundaries. ------------------------------------------------- (c) Arjun Nair 2008-2009. All rights reserved (yes, really!). Developed on BASin by Paul Dunn.