---- ZBasic v4.20 - 128k Memory - Apple II - HELP MENU ----- 10. Commands 60. Machine Language 20. Line Editor 70. Screen, Printer, Input 30. String$ 80. Statements 40. Graphics 90. Math 50. Disk Files 100. Apple/ProDOS Appendix HELP will allow you to scroll through a section. Any other key will return you to the Ready prompt. 11. Append, Auto, CLS, Config 12. Del, Dir, Edit 13. Editor, Find, Help 14. List, Load 15. Mem 16. Merge, New, Online 17. Path, Quit 18. Rename, Renum 19. Run, Save More... Append a non-line#'d subroutine to the prgm in memory at line#. Increment of 1. AUTO [start line#] [incr] Automatically adds line #'s for you. CLS Clears screen. CONFIG Configure ZBasic More.... Delete prgm line(s) in memory [L] DIR [+] [pathname] Displays a directory of files for pathname EDIT line# Engage line editor for line#, (OR just E), will engage current line# for editing. More... Enters full screen editor. +=no line #'s FIND [* | "str] Finds text. #=line #'s, "=strings, ;=next HELP [num] to scroll through info More... List prgm lines to screen, [L] to printer. +=no line #'s, *=highlighted See WIDTH & PAGE. LOAD [*] Loads prgm, erases old prgm. *=condensed More.. 00000 Text Bytes used for source file 00000 Text Mem Bytes remaining for text 00000 Object Bytes for compiled program 00000 Variables Bytes used for variables 00000 Code Mem Bytes remaining for obj. More... Merge prgm into prgm in memory. Overwrite text w/same line #'s. *=condensed. NEW Clears prgm from memory. ONLINE Lists ProDOS devices currently on line. More ... No options returns currently logged prefix. [pathname] appends pathname to prefix - steps back one directory QUIT Exit ZBasic, run another ".SYSTEM" file More... Renames pathname1 to pathname2 RENUM [[new],[old],[inc]] Renumbers program in memory. More... Compile/execute program in memory. *=compile/save to disk. +=compile/save as CHAIN pathname=run from disk SAVE [*|+] pathname Saves program tokenized. *=save as ASCII +=save as ASCII, no line #'s 21. Introduction 22. Cursor Movement Keys 23. Change, Delete, Insert, Hack 24. Delete to character, Search More.... EDIT line# or label or E line# or label or E to edit last line or to edit last line The ZBasic Editor uses the same keys with all versions of ZBasic! Learn one, learn 'em all! More ... To move the cursor: LEFT: n or or <--- RIGHT n or ---> L Lists complete line being edited. Puts cursor on 1st char A Undo (abort) changes, start edit over. More.... n D Delete n char's under cursor. n is optional H Hack off line at cursor, enter Insert mode. I Insert mode. to exit insert mode. More.... n S Put cursor to nth occurence of . default=1 Exits I, K, S, C, H and X edit modes. Accept edit session. Abort session. (or ) READ PSTR$(var) Stores pointer of string data stmt RIGHT$(str$,len) Returns len char's from right of str$ SPACE$(expr) Returns expr spaces More.... STR$(expr) expr to string VAL(str$) Value of str$ TIME$ hh:mm:ss UCASE$(str$) Returns uppercase str$ UNS$(expr) Returns unsigned integer More.... Complex strings: Do not use complex strings in IF statements BAD: IF RIGHT$(A$)="S" ... GOOD: B$=RIGHT$(A$): IF B$="S"... ONE COMPLEX STRING PER STATEMENT BAD: A$=RIGHT$(LEFT$(C$,5),1) GOOD: A$=LEFT$(C$,5):A$=RIGHT$(A$,1) More-.. ZBasic strings default to 255 char lengths. 256 bytes are used for every string encountered unless YOU define the lengths!!! Use: DEFLEN OR DIM TO DEFINE STRING LENGTH See INDEX$ for special string array. More.... BIN$(expr) Returns 16 bit binary# CHR$(expr) Returns ASCII string. CHR$(65)= "A" DATE$ Returns system date: mm/dd/yy HEX$(expr) Returns 4 digit Hexidecimal of expr. More ... This is a special array for storing string information. Unlike other ZBasic strings, each element of this array uses only the amount of memory needed. ZBasic provides some VERY POWERFUL commands for INDEX$ More ... str$=INDEX$(n) Assigns str$ value INDEX$D(n) Deletes element n INDEX$I(n)=str$ Inserts str$ at element n x=INDEX$(str$,n) Find str$ in INDEX$ (n=opt strt) x=elmnt# or -1 if not fnd More ... Examples: DO: I$=INKEY$ : UNTIL LEN(I$)---> Waits for a key to be pressed IF INKEY$="S" THEN STOP -------> Stops program if you press "S" More.... returns pos# if found. Zero if not. LEN(str$) Returns number of char's in str$ including spaces. More.... X$=MID$(str$,pos,len) X$=portion of str$ from pos w/len length MID$(str$,pos,len)=X$ str$=len char's of X$ at str$ position pos OCT$(expr) OCTAL equiv. of expr More.... MKI$(expr) Stores integer number into cond. string format CVB(str$) Converts str$ made with MKB$ into a BCD number CVI(str$) Converts str$ made with MKI$ into an integer number More.... End of this section of strings. ALL ZBasic GRAPHIC commands use Device Independent Coordinates of 1024 across by 768 down, regardless of mode or computer! It is important to read the chapter "GRAPHICS" in the ZBasic manual if you do not understand this system. More.. BOXFILL x,yTOx1,y1 Draw a solid BOX w/corners x,y-x1,y1 Brads Positions on circumf. of CIRCLE from 0-255 0 is at 3 o'clock. Goes counter-clockwise CIRCLEFILL x,y,r SOLID circle CIRCLE x,y,r TO s,n Draw PIE. s=brad start pos. n=num of brads CIRCLE x,y,rPLOTs,n Draw ARC. "" ""... RATIO width,height Aspect of circle 0=black -1=white 1-15=others FILL(x,y) Fills area with color PRINT@(x,y) Print at text position PRINT%(x,y) Print at graphic position INPUT@(x,y) "" INPUT%(x,y) "" (0=off, 1=on) LOCATEx,y[,c] Cursor x,y c=0 Cursor OFF, c=-1 ON CLS Clear screen. Cursor to 0,0 CLSLINE Clear to end of line, cursor stays CLSPAGE Clear to end of page. "" PLOT x,y TO x,y Plot a line PLOT TO x,y Plot line from last point to x,y PLOT x,y TO x1,y1 TO x2, y2 TO... Lots of lines PLOT quality determined by MODE. SOUND frequency, duration Make sound 0,0-----512,0-----1023,0 - - 0,384--512,384--1023,384 - - 0,767-----------1023,767 Positions stay the same regardless of mode or system. ----- PIXELS versus POSITION ----- REMEMBER: ZBasic graphics are device independent! This means coordinates refer to POSITIONS ON THE SCREEN... NOT PIXELS. Positions are the same REGARDLESS OF MODE or SYSTEM being used. MODE=n Sets screen mode for text and graphics APPLE //'s: See HELP 105 for specific mode information. 1024 x 768 regardless of computer COLOR=0 Black COLOR=-1 White COLOR=n See apdx for more info SOUND frequency, duration 0,0 Upper left 1023,0 Upper right 0,767 Lower left 1023,767 Lower right ZBasic file commands are the same for all computers. Learn on this system and you will know all the others! For in depth information about disk files see "FILES" in the ZBasic manual. More.... ERROR Returns disk error code. See ERRMSG$ CLOSE#fnum,... Closes file by number. CLOSE# CLOSES all files END or STOP CLOSES all files More ... LINEINPUT#fnum, var$ Reads ASCII data from disk into string only KILL "filename" Erases file from disk LOC(fnum) Returns location in record LOF(fnum) Last record possible for fnum occurs (ERROR <> 0), line# is called. ON ERROR GOSUB 65535 User error trapping on. See ERROR ON ERROR RETURN Returns Disk Error trapping to ZBasic. More ... ftypes: "R"=Read/Write file Open if exists, else create "O"=Output only Write over existing, or create "I"=Input only Read if exists, else disk error More ... Prints ASCII to disk READ# fnum, var, var$;len, ... (variables only) Reads condensed numbers from disk. String variables MUST be followed by ;length. FASTER than INPUT# REC(fnum) Present record of filenumber More ... Positions the disk pointer to any position in a file. To point at the 14th position in record 9 of file 3--> RECORD #3, 9, 14 RENAME oldfile TO newfile Renames old to new More ... DEVICE -1,-2 Serial ports 1 or 2 (Use OPEN"C" to set port) 0 Screen (default) 1-99 Disk files (OPEN"O". Remember to CLOSE file.) 128 Printer (Turns PRINT into LPRINT). RUN fnum WRITE# fnum, var, var$;len,... Write numeric variables to disk in condensed format. String variables MUST be followed by ;length Faster than PRINT# More ... ERRMSG$ (error number) Returns the disk error message See "STRING VARIABLES" in ZBasic manual for more information.... ------Machine SPECIFIC Information ---- WARNING: USE OF MACHINE SPECIFIC COMMANDS PRESUPPOSES A KNOWLEDGE OF ASSEMBLY LANGUAGE PROGRAMMING AND A KNOWLEDGE OF THIS COMPUTER. PORTING MAY NOT BE POSSIBLE!! More ... CALL LINE n Call MACHLG subroutine at LINE line# or label DEFUSR digit=address Sets USR call address More ... PEEK(address) 8 bit (0-255) PEEKWORD(addr) 16 bit (0-65535) More.... POKEWORD addr, expr 16 bit MACHLG byte, word, var Create a line with machine lang data to CALL LINE or DEF USR More ... WARNING: Machine specific code may cause unpredictable results! --END-- This section deals with ways of presenting data on the screen, printer or other devices. Output will vary depending on the printer, screen hardware and other hardware. CLSLINE Clear to end of line CLSPAGE Clear to end of screen DEF TAB Define comma tab stops. (default=16) DELAY expr Delay system expr/1000ths sec DATE$ mm/dd/yy screenpos INPUT@(x,y) text position, INPUT%(x,y) graphic pos. maxlen, Maximum# char's to input ; Suppress cr "str" string message var, var, vars to inpt be input. Accepts quotes, commas, etc. terminate with . INKEY$ Reads keys on the fly. See STRINGS LPRINT Sends output to the printer. X=PAGE Returns present line on page of printer POS(n) Returns cursor position of: 0=scrn, 1=prt, 2=disk PAGE 1,2,3 1=Printed lines. 2=Actual lines. 3=Top margin (for printer only) PRINT%(x,y) Graphic position ; supress c/r , horizontal tab (see DEF TAB) TAB(expr) Insert tab 0-255 SPC(expr) Spaces=expr You may print variables or data separated by ; or , MOUSE(0) Initialize mouse MOUSE(1) Return X coordinate MOUSE(2) Return Y "" MOUSE(3) Button status NOTE: MOUSE is used for JOYSTICKS and other devices too. SOUND frequency, duration PRINT USING "$##,###.##";999.3212 = $999.32 PRINT USING "*##,###.##";32.598 =****32.60 PRINT USING "+##,###.##";32.598 = +32.60 PRINT USING "+##,###.##";-45.199 = -45.20 PRINT USING"##:##:##";12349 1:23:49 PRINT USING".#######";1.2E-5 .000012 PRINT USING"%###.##";123.355 %123.36 PRINT USING"@###,###";34.349 @ 34 A$="##":PRINT USING A$;89.9 90 More ... WIDTH LPRINT expr Set printer width. Excellent formatting. ROUTE See route in Disk Files TIME$ hh:mm:ss (IF system has clock) SOUND freq, duration ---END SCREEN, PRINTER, DEVICE I/O---- The following is a list of ZBasic statements in alpha- betical order. CLEAR Sets all variables to 0 or null CLEAR num Allocates INDEX$ memory CLEAR END Clears only following variables CLEAR INDEX$ Clears INDEX$ DEFINTvr,var-var Define letter range as integer DEFSNG "" "" Define letter range as single prec. DEFDBL "" "" Define letter range as Double prec. DEFSTR "" "" Define string DEF LEN= expr Following strings will have this length DELAY = expr Delay in expr/1000ths of second DIM (len) var(n,n) Dimension arrays --or-- Define a strings length More ... ELSE IF false do ELSE END CLOSE files, end END IF Ends a LONG IF construct END FN Ends a LONG FN construct FN name(expr's) Executes function by name FOR var=xTOx FOR LOOP: More ... GOTO line or label Jumps to that part of program IF cond THEN..ELSE Check for conditions INDEX$ See INDEX$ in STRINGS LET var=expr Optional assignment More ... LONG IF cond.... Multi-line IF. See END IF and XELSE MID$(v$,pos,len)= Insert string portion into s$ NEXT (var,var) End of FOR LOOP construct ON expr GOSUB1,2, GOSUBs to routine# expr. More ... PSTR$(v%)="const" Set PSTR$(v%) to point at string constant RANDOM expr Random num seed READ var Reads DATA into variables READ PSTR$(v%) Sets pointer to DATA$ RESTORE Sets DATA pointer to first item RESTORE expr Set pointer to item# expr RETURN Returns to statement after GOSUB RETURN line POPS last GOSUB SOUND freq, duration STEP expr SWAP var,var Swaps values of same var type. (NOT INDEX$) TRON Line# trace on TRONB Scan each line TRONS Set single step. TRONX Scan that line only UNTIL End of DO:UNTIL loop WEND End of WHILE loop WHILE WHILE/WEND LOOP XELSE LONG IF else. -----END OF STATEMENTS------ Number ranges: INTEGER -32768 TO 32767 (0-65535 unsigned) BCD(REAL) 9.999E+63 TO 9.999E+63 HEX &H0000 TO &HFFFF OCTAL &O000000 TO &O177777 BINARY 16 bit Overflow errors: INTEGER = NONE BCD(REAL)= 9.99999E+63 6 to 54 digits BCD: Set under onfigure. Single precision Double precision and Scientific accuracy may be set by the user. Operators in Order of Precedence: - Negation NOT ^,[ *,\,/, MOD unless #,!, a decimal point or scientific function is encountered in that expression. More ... Numeric Functions: ABS(expr) Returns Absolute Value (positive) ASC(str$) Returns ASCII code of 1st char of str$ ATN(expr) Returns ARCTAN of expr in Radians COS(expr) Returns COSINE of expr in Radians More ... CVI(str$) Returns integer value of 1st 2 chars or str$ EXP(expr) Returns e^expr in BCD FIX(expr) Truncates digits to left of decimal point FRAC(expr) FRAC(1233.9993) = .9993 More ... INT(expr) Truncates decimal value LOG(expr) Returns natural LOG of expr. LOG10= LOG(n)/LOG(10) MAYBE FAST 50/50 RND. Returns 0 or -1 MEM Memory left in INDEX$ POS(0,1,2) Position of cursor for Screen, Printer or Disk RND(expr) Returns a random number between 1 and expr SGN(expr) Returns sign of expr. Neg=-1, Zero=0, Positive=1 SQR(expr) Returns the Square Root of expr. TAN(expr) Returns the TANGENT of expr in Radians VAL(str$) Returns the numeric value of a sting More ... VARPTR(INTEGER) Points to 1st byte VARPTR(Sng/Dbl) Points to sign/exponent byte VARPTR(String) Points to Length byte, followed by char's VARPTR(Array) Points to element See "Variable Storage" It requires a minimum of 64k and 1 disk drive. An additional drive, /RAM drive and printer are recommended. ProDOS pathnames can be up to 15 characters long, and can consist of only alphanumeric characters and the period. Drives can only be accessed by use of the volume name. Slot and drive parms are not allowed. This statement is used to set the device read by the Mouse function. If the expression is zero, the device will be a mouse card in any slot. This is the default. Otherwise the mouse function will read the joystick port. Sets the slot for printer output. Be sure this is correct. At the present time, we support only the Apple Super Serial Card and compatible cards. The OPEN C statement should specify the negative slot in which the card is installed. ie. OPEN C,-2 for slot # 2 Text modes: 0 and 8 = 40x24 text 2 and 10 = 80x24 text 4 and 12 = 40x24 text 6 and 14 = 80x24 text More.... Graphics modes: 1 = 40x48 lo-res graphics 3 = 80x48 double lo-res graphics 5 = 280x192 hi-res graphics 7 = 560x192 double hi-res graphics 9,11,13,15 same as 1,3,5,7 except with 4 lines of text at bottom of screen. PATH [-] [pathname] PREFIX [-] [pathname] Sets or shows ProDOS Prefix ONLINE Shows all ProDOS volumes on line.