Advertising Info
USUL
User's Guide
WHAT DOES USUL STAND FOR?
USUL stands for Usgard Super Utopian Language. It's also a character from
a book.
DEFINING VARIABLES
Before any commands are issued, if you want any variables, you must define
them. To do so, you must create a VAR block, like so:
VAR
[variable] [typecode]
...
[variable] [typecode]
END
When accessing variables, tack the code onto the end of the variable,
like in QBasic. For example, a one byte temporary variable would be accessed
as variable1.
Typecode Chart
1
|
One byte temporary storage, is constant through program length, but
is then erased |
2
|
Two bytes of temporary storage |
!
|
One byte, permenant, stored in the program, if you exit with this equal
to 20, next time your program is started, it will still be 20. |
@
|
Two bytes, permenant, stored in the program |
$
|
String variable, must also have the SIZE of the string after the $. Permenant. |
#
|
Header variable, such as K_UP. See below for more information. |
OTHER VARIABLES AVAILABLE
If you have already programmed for Usgard (or Z-Shell, for that matter),
there are many variables you can access. For example, CURSOR_X, CURSOR_Y,
et cetera. In order to access these variables, tack on a type code for
how many bytes the storage is. So if you want to access the value in CURSOR_Y,
access it as CURSOR_Y1.
If you haven't programmed before, some of these locations still may
be of interest to you. A listing of most of the variables available is
in the Other Variables Available file.
As for defined values, such as K_UP, K_DOWN, et cetera, you can access
these by adding the header '#' onto them. For example:
IF keypressed1 == K_UP# goto pressedup
This only works in IF for now, if you want it in anything else just ask.
COMMANDS IN BASIC DEVELOPMENT KIT:
Parameters in () marks are optional, whereas in [] marks are manditory.
The following is an alphabetical listing of all commands as of
this date.
To see a listing of categories these commands fall into, see the
category listing. (not available yet)
ASM
Marks a block of inline ASM code. End the block with the 'END' statement.
Example:
ASM
ld a, (num)
and %11100011
END
BREAKON
A powerful feature only in Usul - enables ON+F1 break support. This will
exit the current program and return to Usgard. The only ill effects of this
is your program may then have a bad check-sum (but hey, it crashed your
calculator anyway!).
See Also:
BREAKOFF
Turns off break control - IT IS VITAL THAT YOU DO THIS BEFORE EXITING,
and that you do NOT disable break control if you don't have it on! It will
not result in a crash, but may unload TSRs you don't want to unload. Note,
Break Support starts OFF, so don't call this unless you have already done
a BREAKON.
See Also:
CLEARLCD
Clears the display.
Example:
DEC [variable]
Decrements (subtracts 1) [variable]. Only works for 1 byte variables
currently, either '1' or '!'.
Example:
See Also:
DELAY (time)
Delays the selected amount, in approximately 20ths of a second.
END
Will stop program execution or return from a GOSUB block.
Example:
See Also:
GETKEY [variable]
Reads a keypress from the buffer. Returned as a SCANCODE, see SCANCODE.TXT
for more information. Stores the keypress into [variable], which must be
a 1 byte variable, either '1' or '!'. DOES NOT WAIT FOR KEYPRESS, returns
0 if no key was pressed.
Example:
GETKEY kpress1
IF kpress1 != 0 goto keypressed
See Also:
GOSUB [label name]
Jumps to specified label, and when a END is reached, returns to this
spot.
Example:
See Also:
GOTO [label name]
Goes to the specified location.
Example:
See Also:
IF [value] [operation] [value] [goto / gosub] [label]
The if statement compares two values, which may be immediate values
(ie: 23) or variables (ie: input1). Operations can be '==' for equal, '!='
for not equal, '>' for greater than, and '<' for less than. Then, enter
GOTO or GOSUB to determine whether
the procedure will GOTO or GOSUB
to an area, whose name is [label]. This will also soon allow a else parameter
as well.
Examples:
IF score2 > highscore@ goto getname
IF score1 > 10 goto morethan10
IF score1 == 10 goto equals10
IF score1 < 69 gosub less69
INC [variable]
Increments (adds 1) [variable]. Only works for 1 byte variables currently,
either '1' or '!'.
Example:
See Also:
INPUT [string] [length] [cursor] (goto/gosub) (label)
Inputs text to a string variable ($), with a maximum length of that
specified. CURSOR is either UPPER, LOWER, or NUM - and sets the default
input type (the user can change by hitting alpha). You can optionally
set where to GOTO or GOSUB if the EXIT key is pressed with the last
two parameters.
Example:
INPUT name$ 5 UPPER
INPUT name$ 5 UPPER GOTO NOINPUT
See Also:
LABEL [label name]
Creates a label for GOTOing or GOSUBing. This does not take any space
in a program, so you could label every line of your program if you really
wanted to.
Example:
See Also:
LET [variable] [variable / immediate value]
Sets the value of variable to either another variable's value or an
immediate value (such as, say, 69).
Examples:
LET score1 0
LET highscore! score1
MENU [text to print] [where to jump] (text) (jump) (text) (jump) (text) (jump) (text) (jump)
Exactly like a normal TI menu, lets you specify up to 5 commands
and descriptions for them. If you don't want anything to be displayed, or
to have a key not jump anywhere, specify NIL for the value. If you don't want
to use the last three though, you can just not specify those parameters at
all. If at least one value does not have a place to jump to, you will get
an endless loop on your calculator.
Examples:
MENU "Continue" continue "Exit" quit
MENU "Continue" continue nil secret "Exit" quit
MENU_INV [text/variable] (x position) (y position)
Exactly like MENU_PRINT, except it's printed WHITE on BLACK. It is vital
to this procedure that MENU_XOR is set, otherwise it will look wrong.
Example:
MENU_INV "Hello, I'm naked!"
MENU_INV "Hello, I'm naked!" 0 0
See Also:
MENU_OVR
Sets menu text to overwrite whatever you display it over (usually looks
the best).
Example:
See Also:
MENU_PRINT [text/variable] (x position) (y position)
Text must be contained in quotation marks, otherwise it is assumed
to be a variable. Also, if you wish, specify the X and Y position for the
text to be displayed at. Menu text coordinates are what PIXEL to display
the text at, starting from the upper left of the screen.
Examples:
MENU_PRINT "Hello, I'm naked!"
MENU_PRINT "Hello, I'm naked!" 0 0
See Also:
MENU_XOR
Sets any menu text to XOR onto the screen
Example:
See Also:
PAUSE
Pauses your program until a key is pressed.
Example:
See Also:
RANDOM [variable]
Stores a random number into [variable]. Any type variable is allowed.
Examples:
RANDOM counter1
RANDOM deadguy@
SPRITENASR [sprite] [x-position, leftmost = 0]
[y-position, bottom of screen = 0]
Draws a NASR formatted sprite. NASR sprites are slower than PutSprite
sprites, but can be of larger size. Sprite definitions must be contained
in (filename).SPR.
Example:
SPRITENASR character 10 10
See Also:
SPRITEPUT [sprite] [x-position, leftmost = 0] [y-position,
uppermost = 0]
Draws a PutSprite formatted sprite. PutSprite is faster than NASR but
is of limited size. Sprite definitions must be contained in (filename).SPR.
Example:
SPRITEPUT character 10 10
See Also:
SCROLL_ON
Screen display will scroll when you print normal text on the 7th line.
See Also:
SCROLL_OFF
Screen display will NOT scroll when you print normal text on the 7th line.
See Also:
TEXT_INV
Text is displayed inverted (WHITE on BLACK)
Example:
See Also:
TEXT_NRM
Text is displayed normally (BLACK on WHITE)
Example:
See Also:
TEXT_PRINT [text/variable] (x position) (y position)
Text must be contained in quotation marks, otherwise it is assumed
to be a variable. Also, if you wish, specify the X and Y position for the
text to be displayed at. Standard text is baised on lines, the screen is
7x21 lines.
Examples:
TEXT_PRINT "Hello, I'm naked!"
TEXT_PRINT "Hello, I'm naked!" 0 0
See Also:
VAL [string variable] [numerical variable]
Converts the string specified into a number. This works with any
type of number variable, one or two bytes. If you try to store a number
over 255 into one byte, you will get some crazy values, but program execution
will not falter and you will not experience any ill effects. The string
variable is left unaltered.
Example:
WAITKEY [variable]
Reads a keypress from the buffer or waits for one if none has been
pressed since last check. Stores the keypress into [variable], which must
be a 1 byte variable, either '1' or '!'.
Example:
See Also:


Questions? Comments? Command Ideas?
Email me!
eviljim@writeme.com
Copyright © 1996, 1997 Jim Reardon