Stos basic reference card-with ALL stos basic commands and their correct syntax. Parameters placed inside square brackets are optional and can be omitted. Written by --------------------------------- Sorcerer of The Digital Dictators --------------------------------- STOS is great! (sometimes...) STOS basic reference card Naming conventions All Stos basic variables must begin with a letter and they must not contain any of the following commands: TO,STEP,THEN,ELSE,XOR,OR,AND,GOTO,GOSUB,MOD,AS Maximum length of a variable is 31 characters. Types of variables Integers P,NUM,T1 - Stored in four bytes and range from:-214748348 to +214748348 Real numbers P#,NUM#,T1# - Stored in eight bytes and range from:-1.797692 E+308 to +1.797693 E+307 Strings P$,NUM$,T1$ - Always suffixed with a $ character and can range from 0-65500 characters long.They are not terminated with a chr$(0). Arrays P(10),NUM#(3),TI$(100,10) - Any of the above variables caen be incorporated into a table called array.These arrays can be created using the DIM statement. Variable and string commands =ASC(a$) - Get ascii code CHR$(n) - Return ascii character DEC var - Subtract one from an integer variable DIM var(size),... - Dimension an array =FLIP(n$) - Invert string INC var - Add one to an integer variable =INPUT list / "chars",delay - Input a number or some text into a string =INPUT$(n) - Function to input n characters into a string =INSTR(str1$,str2$<,p>) - Search for occurences of a string within another string KEY(x)=a$ - Function to assign a string to a funct.key =LEFT$(str1$,n)= - Return the leftmost character of a string =LEN(a$) - Get length of string LET x=y - Load some information into a variable =MATCH(var(0),value)- Find the closest match to a value in an array =MID$(v$,s,n)= - Return a string of characters from within a string expression =RIGHT$(str1$,n)= - Return the rightmost character of a string SORT A$(0) - Sorts all elements in an array =SPACE$(n) - Create a string full of spaces =STR$(n) - Convert a number to a string =STRING$(a$,n) - Create a string full of a$ =UPPER$(n$) - Convert n$ to upper case =VAL(x$) - Convert a string to a number Editor and system commands AUTO <,inc> - Automatic line numbering CHANGE a$ to b$ - Change all occurences of string in a program CLEAR - Clear all the program variables CONT - Restart a program exited by STOP or cntr+c DEFAULT - Reset the editor and redraw current windows DELETE first-last - Delete some or all of a program ENGLISH - Select English syntax (default) FLOAD path$ - Load a file using the file selector FOLLOW - Track through a STOS basic program FOLLOW OFF - Turns off any follow command FOLLOW first-last - Traces the lines between first-last FOLLOW variable list- Traces variables and prints to the screen FOLLOW variable list,first-last- Variables are traced and printed between lines first and last FRANCAIS - Select French syntax =FREE - Return the amount of free memory FREQUENCY - Change scan rate from 50 to 60 hertz FSAVE path$ - Save a basic file chosen with the file selector FULL - Expand current window into the full screen area GRAB n - Copy all or part of a program segment into the current program =LANGUAGE - Variable holding the language used for syntax KEYLIST - List the current function key assignment LIST - List the entire program LIST -last - List the start of the program to line last LIST first- - List lines from first onwards LIST first-last - List lines from first to last LOWER - Change editor mode to lower case MERGE file$ - Merge a file into the current program MULTI n - Display a number of programs simultaneously NEW - Erase the current program RENUM<,inc> - Renumber all of a program RENUM number,inc,start-end - Renumber part of a program RESET - Reset the editor RUN - Run the program starting from the first line RUN file$ - Load and run a basic file RUN line - Run the program starting from a specific line SEARCH s$ - Searches for a string between lines start and end SEARCH - Continue the search from last match SYSTEM - Exit back to Gem UNNEW - Attempt to recover from a NEW and restore the previous program UPPER - Change listing mode to upper case Program control commands BREAK ON/OFF - Turn on or off the control+c break key END - Exit from the program =ERRL - Variable holding the location of the last error =ERRN - Variable containing the number of the last error ERROR n - Generate an error and return to STOS editor FOR...NEXT - Repeat a section of code a specific number of times GOSUB line/expr. - Jump to a subroutine GOTO line/expr. - Jump to a new line number IF...THEN - Choose between alternative actions ON ERROR GOTO line - Trap an error within a basic program ON var GOSUB line1,line2... - GOSUB one of a list of routines depending on a variable ON var GOTO line1,line2... - Jump to one of a list of lines depending on a variable POP - Remove the return information after a GOSUB REPEAT...UNTIL - Repeat a section of code until a condition is true RESUME - Jump back to the statement which caused the error and try again RESUME NEXT - Jump to statement following the one which caused the error RESUME n - Resume the program at the line number n RETURN - Return from a subroutine and execute the next instruction STOP - Stop running the program and return to the editor WHILE...WEND - Repeat a section of code while a condition is true Loading and saving ACCLOAD file$ - Load an accessory ACCLOAD "*" - Load all accessories from the current disc BLOAD file$,addr/#bank - Load binary information into a specified address or bank BSAVE file$,start TO end - Save a block of memory between start and end in binary format LOAD file$ - Load part or all of a STOS basic program SAVE file$ - Save part or all of a STOS basic program Legal file extensions .BAS - Basic programs .ACB - Accessories (Use accload) .PI1,PI2,PI3 - Degas picture format .NEO - Neochrome format .MBK - One memory bank .MBS - All current banks .VAR - Currently defined variables .ASC - Ascii format .PRG - Executable from Gem Desktop Directories =DFREE - Variable containing the free space on the current disc =DIR FIRST$(path$,flag) - Get first file in directory satisfying pathname =DIR NEXT - Get the next file satisfying current pathname DIR - List out the directory of the current disc DIR$=path$ - Set the current directory DIR/W - List the directory across the screen =DRIVE= - Variable containing the current drive =DRIVE$= - String variable holding current drive =DRVMAP - Variable holding a list of the drives connected =FILESELECT$(path$>) - Select a file using the fileselector KILL file$ - Erase a file from the disc MKDIR folder$ - Create a new folder PREVIOUS - Sets the current path up one directory RENAME old$ TO new$ - Rename a file RMDIR folder$ - Delete a folder Filing commands CLOSE #channel - Close a file =EOF (#channel) - Test for end of file FIELD #channel,len1 as field1$,... - Define record structure GET #channel,r - Input a record from a random access file INPUT#channel,variable list - Input a list of variables from a file or device =INPUT$(#channel,count) - Inputs a number of characters from a device LINE INPUT #channel,separator$,variable list - Input a list with a different separator to "." LINE INPUT #channel,variable list - Inputs a list of variables not separated by "," =LOF(#channel) - Length of open file OPEN #channel,"AUX" - Open a channel to the RS232 port OPEN #channel,"MIDI"- Open a channel to the midi interface OPEN #channel,"PRT" - Open a channel to the printer OPEN #channel,"R",file$ - Open a random access file OPEN IN #channel,file$ - Open a file for input OPEN OUT #channel,file$<,attribute> - Open a file for output =POF(#channel)= - Variable holding current position of file pointer =PORT(#channel) - Function to test if channel waiting PRINT #channel,variable list - Print a list to a file or device PUT #channel,r - Output a record to a random access file Memory bank commands BCOPY #source TO #dest - Copy the contents of a bank to another bank BGRAB prgno<,b> - Copy some or all banks from a program to the current program ERASE b - Delete a bank HEXA ON/OFF - Toggle hexadecimal listing =LENGTH(b) - Get the length of a bank =LENGTH(prgno,b) - Get the length of a bank from another program LISTBANK - List the banks in use RESERVE AS DATA bank,length - Reserve a permanent bank as a workspace RESERVE AS DATASCREEN bank - Reserve a permanent bank of memory as a screen RESERVE AS SCREEN bank - Reserve a temporary bank as a screen RESERVE AS SET bank,length - Reserve a permanent bank of memory for use as a character set RESERVE AS WORK bank,length - Reserve a temporary bank as a workspace =START(b) - Get the start address of a bank =START(prgno,b) - Return the start address of a bank from a program Text commands CDOWN - Cursor down CENTRE a$ - Print a line of text centred on the screen CLEFT - Cursor left CRIGHT - Cursor right CUP - Cursor up CURS ON/OFF - Enable/disable text cursor HOME - Cursor home INVERSE ON/OFF - Switch the pen and ink values LOCATE x,y - Position the cursor PAPER index - Set colour of the background text PEN index - Set colour of the text =SCRN(x,y) - Return the character at the position x,y SET CURS top,base - Set text cursor size SHADE ON/OFF - Shade all subsequent text,or return to normal printing SQUARE wx,hy,border - Draw a rectangle at the current cursor position TAB(n) - Move the cursor to the right n places UNDER ON/OFF - Set underline mode on or off WRITING effect - Change text writing mode (1=replacement 2=OR(Default) 3=XOR) =XCURS - Variable holding the x coordinate of the text cursor =XGRAPHIC(x) - Convert x text to x graphic coordinate =XTEXT(x) - Convert x graphic to x text coordinate =YCURS - Variable holding the y coordinate of the text cursor =YGRAPHIC(y) - Convert y text to y graphic coordinate =YTEXT(y) - Convert y graphic to y text coordinate Window commands BORDER n - Set the border of the current window CLW - Clears the current window QWINDOW n - Activate window without redrawing it SCROLL DOWN - Scroll the current window down one line SCROLL ON/OFF - Switch window scrolling on and off SCROLL UP - Scroll the current window up TITLE a$ - Define a title for the current window WINDEL n - Delete a window WINDMOVE x1,y1 - Move a window =WINDON - Variable containing number of the current window WINDOPEN n,x1,y1,w,h<,border<,set>> - Create a window WINDOW n - Activate a window Graphics functions ARC x1,y1,r,start,end - Draw a circular arc BAR x1,y1 TO x2,y2 - Draw a filled rectangle BOX x1,y1 TO x2,y2 - Draw a hollow rectangle on the screen CIRCLE x1,y1,r - Draw a filled circle CLIP x1,y1 TO x2,y2 - Restrict all graphics to part of the screen COLOUR index,$RGB - Assign a colour to an index =COLOUR(index) - Read the colour assignment DIVX - Variable fraction for x axis plotting DIVY - Variable fraction for y axis plotting DRAW x1,y1 TO x2,y2 - Draw a line between x1,y1 and x2,y2 DRAW TO x3,y3 - Draw a line from the last point to x3,y3 EARC x1,y1,r1,r2,start,end - Draw an elliptical arc ELLIPSE x1,y1,r1,r2 - Draw a filled ellipse EPIE x1,y1,r1,r2,start,end - Draw an elliptical pie FLASH index,"(col,delay)(col2,delay)..."- Set flashing colour sequence GR WRITING x - Set method of drawing (1=replacement 2=transparent 3=XOR mode 4=inverse transparent) INK index - Set colour of graphic drawing operations =MODE n - Change the graphics mode PAINT x1,y1 - Contour fill PALETTE $RGB,$RGB...- Set the current screen colours PIE x1,y1,r,start,end - Produce a pie chart PLOT x,y<,index> - Plot a single point POINT(x1,y1) - Get the colour of a point POLYGON x1,y1 TO x2,y2 TO x3,y3... - Draw a filled polygon POLYLINE x1,y1 TO x2,y2 TO x3,y3... - Multiple line drawing POLYMARK x1,y1;x2,y2;x3,y3;...- Plot a list of polymarkers RBAR x1,y1 TO x2,y2 - Draw a filled rounded rectangle RBOX x1,y1 TO x2,y2 - Draw a rounded hollow box SET LINE mask,thick,start,end - Set the line styles SET MARK type,size - Set the marker used by polymark SET PAINT type,pattern,border - Select fill pattern SET PATTERN a$ - Set user defined pattern from data in a string SET PATTERN address of pattern- Set a user-defined fill pattern with data at address SHIFT delay<,start> - Colour rotation Screen commands APPEAR x<,y> - Fade between two pictures =BACK= - Address of the background screen CLS - Clear the whole screen CLS scr - Clears the screen at scr CLS scr,col - Fills the screen scr with colour col CLS scr,col,x1,y1 TO x2,y2 - Replaces the rectangle at scr at coordinates x1,y1,x2,y2 with a block of colour col DEF SCROLL n,x1,y1 TO x2,y2,dx,dy - Define a scrolling zone DEFAULT BACK - Return the intial value of BACK DEFAULT LOGIC - Return the initial value of LOGIC DEFAULT PHYSIC - Return the initial value of PHYSIC FADE speed - Fade all colours to black FADE speed TO sbank - Fade present colours to those of the screen in bank sbank FADE speed,col1,,,col4,... - FADE separate colours to new values GET PALETTE(n) - Set the palette from a screen bank =LOGIC= - Address of the logical screen PACK scr,bank - Pack a screen =PHYSIC= - Address of the physical screen REDUCE scr1 TO (scr2)x1,y1,x2,y2 -Reduce a screen to a smaller size RESERVE AS DATASCREEN n - Reserve a permanent screen RESERVE AS SCREEN n - Reserve a bank as a temporary screen SCREEN COPY scr1 TO scr2 - Copy screen scr1 to screen scr2 SCREEN COPY scr1,x1,y1,x2,y2 TO scr2,x3,y3 - Copies a section of a screen to a point in another screen SCREEN SWAP - Swaps the address of the logical and physical screens SCREEN$(scrn,x,y)=a$- Copy screen area in a$ to the screen scrn =SCREEN$(scrn,x1,y1 TO x2,y2) - Load an area of a screen into a string SCROLL n - Scroll a screen zone SYNCHRO - Execute all sprite movements once SYNCHRO OFF - Turn off normal sprite interrupt SYNCHRO ON - Revert the sprite movements to normal UNPACK bnk,scr - Unpack a screen WAIT VBL - Wait for a vertical blank ZOOM scr1,x1,y1,x2,y2 TO (scr2),x3,y3,x4,y4 - Magnify a section of the screen Sprite commands ANIM FREEZE (n) - Freeze an animation ANIM ON/OFF (n) - Start an animation ANIM n,a$ - Animate a sprite AUTOBACK ON/OFF - Set screen for graphics operation COLLIDE (n,w,h) - Detect collisions between two sprites =DETECT (n) - Find colour of pixel underneath sprite FREEZE - Pause a sprite and music operation GET SPRITE x,y,i,(mask) - Copy a section of the screen into the spritebank LIMIT SPRITE x1,y1 TO x2,y2 - Limit sprite to a specific area MOVE FREEZE - Temporarily suspend sprite movements MOVE ON/OFF (n) - Start/stop sprite movement MOVE X n,m$ - Move a sprite horizontally MOVE Y n,m$ - Move a sprite vertically MOVEON (n) - Return sprite state OFF - Turn off sprites PRIORITY ON/OFF - Change between priority modes PUT SPRITE n - Put a copy of a sprite on the screen REDRAW - Redraw the sprites RESET ZONE (n) - Erase a zone SET ZONE z,x1,y1 TO x2,y2 - Set a zone for testing SPRITE n,x,y,p - Displays a sprite on the screen UNFREEZE - Restart sprite and music operations UPDATE (ON/OFF) - Change automatic sprite updates =X SPRITE (n) - Get X coordinate of sprite =Y SPRITE (n) - Get Y coordinate of sprite ZONE (n) - Tests a sprite to see if it is in a zone Character and icon commands CHARCOPY s TO b - Copy a character set into a particular bank =CHARLEN(n) - Get length of a character ICON$(n) - Generate an icon at the current cursor position RESERVE AS SET n,len- Reserve a bank of memory for a character set Mouse and joystick commands CHANGE MOUSE m - Change the shape of the mouse pointer =FIRE - Test fire button state HIDE (ON) - Remove mouse pointer from the screen =JDOWN - Test joystick movement down =JLEFT - Test joystick movement left =JOY - Read joystick =JRIGHT - Test joystick movement right =JUP - Test joystick movement up LIMIT MOUSE x1,y1 TO x2,y2 - Limit mouse to a section of the screen =MOUSE KEY - Get status of the mouse keys SHOW (ON) - Activate the mouse pointer =X MOUSE - Get the X coordinate of the mouse pointer =Y MOUSE - Get the Y coordinate of the mouse pointer Music and sound commands BELL - Simple bell sound BOOM - Generate an explosion sound CLICK ON/OFF - Turn off keyboard click ENVEL type,speed- Activate an envelope MUSIC FREEZE - Temporarily stop a piece of music MUSIC OFF - Turn off music MUSIC ON - Restart a piece of music MUSIC n - Play tune number n NOISE v,p - Produce rushing wind effects PLAY (voice,)pitch,duration - Play a note =PVOICE(v) - Return position in music SHOOT - Create a noise like a gun firing TEMPO s - Change the speed of a sample of music TRANSPOSE df - Change the pitch of a piece of music VOICE (v) - Turn on/off a voice VOLUME (v,)intensity - Change the sound volume Menu commands MENU FREEZE - Freeze the actions of the menu MENU OFF - Switch off the entire menu MENU ON (border)(,mode) - Turn on the menu =MENU$(title,option)OFF - Turn off an option =MENU$(title,option)ON - Turn back on an option MENU$(x)=title$ (,paper,pen) - Set a menu title for a drop down menu MENU$(x,y)=option$ (,paper,pen) - Set up an option in a menu =MNBAR - Holds the menu title that has been selected =MNSELECT - Holds the option number which has been selected ON MENU GOTO lin1,lin2,... - Go to a line dictated by the option selected ON MENU OFF - Turn off on menu option ON MENU ON - Start on menu system Arithmetic operations (listed in order of priority) Power - Power (the symbol is over 6 in english keyboards) / and * - Divide and multiply MOD - Modulo operator (Produces remainder of a division) + and - - Plus and minus AND - Logical AND OR - Logical OR XOR - Logical XOR Mathematical functions =ABS(y) - Absolute value DEF FN name (variable list)=expression - Create a user-defined function =EXP(y#) - Exponential function =FN name(variable) - Call a user-defined function =INT(y#) - Convert floating point to an integer =LN(y#) - Natural logarithm =LOG(y#) - Logarithm =MAX(x,y) - Get the maximum of two values =MIN(x,y) - Return the minimum of two values =SGN(y) - Find the sign of a number =SQR(y) - Square root =SWAP(x,y) - Swap the contents of two variables Trigonometric functions =ACOS(number) - Arc cosine =ASIN(number) - Arc sine =ATAN(number) - Arc tangent =COS(angle) - Cosine =DEG(angle) - Convert an angle expressed in radians to degrees =HCOS(angle) - Hyperbolic cosine =HSIN(angle) - Hyperbolic sine =HTAN(angle) - Hyperbolic tangent =PI - A constant =RAD(angle) - Convert an angle expressed in degrees to radians =SIN(angle) - Sine =TAN(angle) - Tangent The printer HARDCOPY - Screen dump LDIR (path$) - List a directory to the printer LISTBANK - Prints a list of the banks used by your program on the printer LLIST (linestart(-line end)) - Print part or all of a program on a printer LPRINT variable list - Output a list of variables to the printer WINDCOPY - Window dump Other commands =ACCNB - Get accessory number ACCNEW - Remove all currently installed accessories =AREG(r)= - Variable used to pass information to the 68000šs address registers BCHG(x,y) - Change a bit BCLR(x,y) - Clear a bit =BIN$(x(,y)) - Convert number to binary string BSET(x,y) - Set a bit to 1 BTST(x,y) - Test a bit CALL address - Call a machine-code program-stored at address CLEAR KEY - Initialise the keyboard buffer COPY start,finish TO destination - Copy a memory block DATA variable list - Place a list of data items in a program =DATE$= - Get date =DEEK(address) - Get word at address DOKE address,value - Change word at address =DREG(r)= - Variable used to pass information to the 68000šs data registers =FALSE - Logical false 0 FILL start TO finish,longword - Fill memory block with a longword FIX(n) - Set precision =FKEY - Read the function keys directly =HEX$(x(,n)) - Convert number to hexadecimal =HUNT(start TO end,a$) - Find a string in memory =INKEY$ - Function to get a keypress KEY SPEED repeatspeed,delay - Change key repeat speed and initial delay response =LEEK(address) - Get longword at address LINE INPUT variable list - Input a list of variables separated by return LOKE address,number - Change long word at address LOWER$(n$) - Convert n$ to lower case =NOT(x) - Logical NOT operation =PEEK(address) - Get byte at address POKE address,x - Change byte at address PRINT or ? variable list- Print a list of variables to the screen =PSG(r)= - Access the programmable sound generator PUT KEY - Put a string into the keyboard buffer READ variable list - Read some data from a DATA statement into a variable REM - Remark RESTORE line/expression - Set the read pointer to a new line =RND(y) - Random number generator ROL x,y - Rotate left ROX x,y - Rotate right =SCANCODE - The scancode of the last key input with INKEY$ =TIME$= - Get time =TIMER= - Count in 50ths of a second TRAP n(,parameters) Call a 68000 trap function =TRUE - Logical true -1 USING format$;variable list - Formatted output Replacement character(beside Return in english keyboards) # Number of digits of a variable + Adds a plus to a positive number or a minus sign to a negative number - Produces only a minus sign if a value is negative . Places a decimal point in a number ; Centres a number but does not output a decimal point Power symbol Prints a number in exponential format =VARPTR(variable) - Get address of a variable WAIT KEY - Wait for a keypress WAIT x - Wait in 50ths of a second (c) Sorcerer January 24th 1991 Mandarin Software Europa House Adlington Park Adlington Macclesfield SK10 4NP