[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

USR

TYPE: Floating-Point Function
FORMAT: USR (<numeric>)

Action: The USR function jumps to a User callable machine language SubRoutine which has its starting address pointed to by the contents of memory locations 785-786. The starting address is established before calling the USR function by using POKE statements to set up locations 785-786. Unless POKE statements are used, locations 785-786 will give you an ?ILLEGAL QUANTITY error message.

The value of the <numeric> argument is stored in the floating-point accumulator starting at location 97, for access by the Assembler code, and the result of the USR function is the value which ends up there when the subroutine returns to BASIC.

EXAMPLES of USR Function:
   10 B=T*SIN(Y)
   20 C=USR(B/2)
   30 D=USR(B/3)

VAL

TYPE: Numeric Function
FORMAT: VAL (<string>)

Action: Returns a numeric VALue representing the data in the <string> argument. If the first non-blank character of the string is not a plus sign (+), minus sign (-), or a digit the VALue returned is zero. String conversion is finished when the end of the string or any non-digit character is found (except decimal point or exponential e).

EXAMPLE of VAL Function:
   10 INPUT#1, NAM$, ZIP$
   20 IF VAL(ZIP$) < 19400 OR VAL(ZIP$) > 96699
      THEN PRINT NAM$ TAB(25) "GREATER PHILADELPHIA"

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated November 14, 1998.