Miscellaneous Routines
PTRGET DFE3
Read a variable name from CHRGET and find it in memory. On entry TXTPTR points to the first character of the variable name. On exit the address to the value of the variable is in VARPNT and Y,A. If PTRGET can't find a simple variable it creates one. If it can't find an array it creates one dimensioned from 0 to 10 and sets all elements equal to zero.
GETARYPT F7D9
Read a variable name from CHRGET and find it in memory. On entry TXTPTR points to the first character of the variable name. This routine leaves LOWTR pointing to the name of the variable array. If the array can't be found the result is an OUT OF DATA ERROR.
FNDLIN D61A
Searches the program for the line whose number is in LINNUM.
On exit:
C set LOWTR points to the link field of the desired line.
C clear then not found. LOWTR points to the next higher line.
DATA D995
Move TXTPTR to the end of the statement. Looks for the ":" or eol (0).
DATAN D9A3
Calculate the offset in Y from TXTPTR to the next ":" or eol (0).
REMN D9A6
Calculate the offset in Y from TXTPTR to the next eol (0).
ADDON D998
Add Y to TXTPTR.
SCRTCH D64B
The "NEW" command. Clears the program, variables, and stack.
CLEARC D66C
The "CLEAR" command. Clears the variables and stack.
STKINI D683
Clears the stack.
RESTOR D849
Sets the DATA pointer, DATPTR, to the beginning of the program.
STXTPT D697
Set TXTPTR to the beginning of the program.
BLTU D393
Block transfer makes room by moving everything forward.
On entry:
Y,A and HIGHDS = destination of high address + 1
LOWTR = lowest address to be moved
HIGHTR = highest address to be moved + 1
On exit:
LOWTR is unchanged
HIGHTR = LOWTR - $100
HIGHDS = lowest address transfered - $100
REASON D3E3
Makes sure there's enough room in memory for another variable. Checks to be sure that the address Y,A is less than FRETOP. May cause garbage collection. Causes "OUT OF MEMORY ERROR" if there's no room.
GARBAG E484
Move all currently used strings up in memory as far as possible. This maximizes the free memory area for more strings or numeric variables.
CONT D898
Moves OLDTXT and OLDLIN into TXTPTR and CURLIN.
NEWSTT D7D2
Execute a new statement. On entry TXTPTR points to the ":" preceding the statement or the zero at the end of the previous line. Use NEWSTT to restart the program with CONT. THIS ROUTINE DOES NOT RETURN.
RUN D566
Run the program in memory. THIS ROUTINE DOES NOT RETURN.
GOTO D93E
Uses LINGET and FNDLIN to update TXTPTR. GOTO assumes that the 6502 registers and A have been set up by the CHRGET that fetched the first digit.
LET DA46
Uses CHRGET to get address of the variable, "=", evaluate the formula, and store it. On entry TXTPTR points to the first character of the variable name.
High resolution graphics routines
NOTE: Regardless of which screen is being displayed, HPAG (location $E6) determines onto which screen the software draws graphics. ($20 for HGR, $40 for HGR2)
HGR2 F3D8
Initialize and clear page 2 High-Res.
HGR F3E2
Initialize and clear page 1 High-Res.
HCLR F3F2
Clear the current High-Res screen to black.
BKGND F3F6
Clear the current High-Res screen to last plotted color.
HPOSN F411
Positions the High-Res cursor without plotting. HPAG determines which page the cursor is pointed at.
On entry:
Horizontal = Y,X
Vertical = A
HPLOT F457
Call HPOSN then try to plot a dot at the High-Res cursor's position. The dot may not be plotted if plotting non-white at a complementary color X coordinate.
HLIN F53A
Draws a line from the last plotted point or line destination to the coordinate in the 6502 registers.
On entry:
Horizontal = X,A
Vertical = Y
HFIND F5CB
Convert the High-Res cursor's position to X-Y coordinates. HFIND allows the user to tell where on the screen the a shape table left the cursor.
On exit:
$E0 = horizontal lsb
$E1 = horizontal msb
$E2 = vertical
DRAW F601
Draw the shape pointed to by Y,X using the current HCOLOR starting at the current High-Res cursor position. On entry A = rotation factor.
XDRAW F65D
Draw the shape pointed to by Y,X by starting at the current High-Res cursor position inverting the existing color of the dots the shape draws over. On entry A = rotation factor.
SETHCOL F6EC
Set the High-Res color to X. X must be less than 8.
SHLOAD F775
Loads a shape table into memory from tape above MEMSIZ (HIMEM) and sets the pointer at $E8.
Error Processor Routines
ERROR D412
Checks ERRFLG and jumps to HNDLERR if ONERR is active. Otherwise it prints <cr> "?" <error message pointed to by X> "ERROR". If this is during program execution then it also prints" IN " and the CURLIN.
HANDLERR F2E9
Saves CURLIN in ERRLIN, TXTPTR in ERRPOS, X in ERRNUM, and REMSTK in ERRSTK. X contains the error code. See the Applesoft Reference Manual page 136 for the value of X for a given error.
RESUME F317
Restores CURLIN from ERRLIN and TXTPTR from ERRPOS and transfers ERRSTK into the 6502 stack pointer.
ISCNTC D858
Checks the Apple keyboard for a CTRL-C ($83). Executes the BREAK routine if there is a CTRL-C.
CHKNUM DD6A
Make sure FAC is numeric. See CHKVAL.
CHKSTR DD6C
Make sure FAC is a string. See CHKVAL.
CHKVAL DD6D
Takes the result of the most recent FAC operation and check this result for a string or numeric variable. A TYPE MISMATCH ERROR results if FAC and C don't agree.
On entry:
C set checks for strings
C clear checks for numerics.
ERRDIR E306
Causes ILLEGAL DIRECT ERROR if the program isn't running. X is modified.
ISLETC E07D
Checks A for an ASCII letter ("A" to "Z"). On exit C set if A is a letter.
PARCHK DEB2
Checks for "(", evaluates a formula, and checks for ")". Uses CHKOPN and FRMEVL then falls into CHKCLS.
CHKCLS DEB8
Checks at TXTPTR for ")". Uses SYNCHR.
CHKOPN DEBB
Checks at TXTPTR for "(". Uses SYNCHR.
CHKCOM DEBE
Checks at TXTPTR for ",". Uses SYNCHR.
SYNCHR DECO
Checks at TXTPTR for the character in A. TXTPTR is not modified. Normally exits through CHRGET. Exits with SYNTAX ERROR if they don't match.