moka.lang
Class System

java.lang.Object
  extended bymoka.lang.Object
      extended bymoka.lang.System

public final class System
extends Object

The System class contains several useful class fields and methods. It cannot be instantiated.

Among the facilities provided by the System class are input and output functions and most of the calc-dependent and AMS-dependent constants.

Since:
MDK1.0a

Field Summary
static short AMS
          The AMS version (AMS_1xx or AMS_2xx)
static short AMS_1
          Indicate that the AMS version is AMS_1xx.
static short AMS_2
          Indicate that the AMS version is AMS_2xx.
static short argCount
          The number of arguments passed to the program.
static short CALCULATOR
          The calculator model (TI-89, TI-92 or V200)
static short CALCULATOR_TI89
          Indicate that the calculator model is TI89.
static short CALCULATOR_TI92PLUS
          Indicate that the calculator model is TI92PLUS.
static short CALCULATOR_V200
          Indicate that the calculator model is V200.
static short ENTRIES
          Number of entries in TIOS jump table: may be used for determining actual AMS version (for example, it is 972 on AMS 1.05 and 1463 on AMS 2.03).
static short KEY_DIAMOND
          The number added to the key code if the Diamond key is pressed with it.
static short KEY_DOWN
          Key code for the down arrow key.
static short KEY_DOWNLEFT
          Key code for simultaneous pressing of the down and left arrow keys.
static short KEY_DOWNRIGHT
          Key code for simultaneous pressing on up and right arrow keys.
static short KEY_LEFT
          Key code for the left arrow key.
static short KEY_RIGHT
          Key code for the right arrow key.
static short KEY_SHIFT
          The number added to the key code if the Shift key is pressed with it.
static short KEY_UP
          Key code for the up arrow key.
static short KEY_UPLEFT
          Key code for simultaneous pressing of the up and left arrow keys.
static short KEY_UPRIGHT
          Key code for simultaneous pressing on up and right arrow keys.
static void_p ROM_BASE
          Base address of the ROM (0x200000 on TI-89 or V200, 0x400000 on TI-92 Plus).
 
Method Summary
static void clearEstack()
          Clears the expression stack.
static void clrscr()
          Clears the screen and moves the print position to the first character of the first line.
static void contrastDn()
          Decreases the display contrast.
static void contrastUp()
          Increases the display contrast.
static void exec(String command)
          Executes the specified string command.
static void exit()
          Terminates the current program returning 0 as return value.
static void exit(double ret)
          Terminates the current program returning a double as return value.
static void exit(int ret)
          Terminates the current program returning an int as return value.
static void exit(long ret)
          Terminates the current program returning a long as return value.
static void exit(short ret)
          Terminates the current program returning a short as return value.
static void exit(String ret)
          Terminates the current program returning a String as return value.
static void free(void_p ptr)
          Deallocates a memory block previously allocated by a call of System.malloc.
static void gcRAM()
          Calls the garbage collection of the RAM memory.
static int getAvailRAM()
          Returns the availlable RAM memory in bytes.
static double getDouble()
          Returns the next argument as a double.
static int getInt()
          Returns the next argument as a int.
static long getLong()
          Returns the next argument as a long.
static short getShort()
          Returns the next argument as a short.
static String getString()
          Returns the next argument as a String.
static void idle()
          Turns the calculator in "low-power" state until the next interrupt occurs then returns.
static void_p malloc(int size)
          Allocate a block of memory from the memory heap.
static void off()
          Turns off the calculator.
static void print(byte b)
          Prints a byte.
static void print(char c)
          Prints a char.
static void print(char[] s)
          Prints an ANSI string.
static void print(double d)
          Prints a double.
static void print(int i)
          Prints an int.
static void print(long l)
          Prints a long.
static void print(Object obj)
          Prints an object.
static void print(short s)
          Prints a short.
static void print(String s)
          Prints a String then finalize the String.
static void println()
          Terminates the line.
static void println(byte b)
          Prints a byte and then terminates the line.
static void println(char c)
          Prints a char and then terminates the line.
static void println(char[] s)
          Prints an ANSI string and then terminates the line.
static void println(double d)
          Prints a double and then terminates the line.
static void println(int i)
          Prints an int and then terminates the line.
static void println(long l)
          Prints a long and then terminates the line.
static void println(Object obj)
          Prints an object and then terminates the line.
static void println(short s)
          Prints a short and then terminates the line.
static void println(String s)
          Prints a String and then terminates the line and finalize the String.
static char read()
          Read a character from the keyboard.
static String readLine()
          Read a line of text.
static String readLine(boolean echo)
          Read a line of text.
static void reset()
          Resets the calculator.
static int setAPD(int time)
          Sets the device's "APD" time.
static void setStHelpMsg(String msg)
          Displays a message in the status line then finalizes the String argument.
static boolean stEraseHelp()
          If the status flags indicate that a help message is being displayed, this function redraws the status line, effectively removing the message.
 
Methods inherited from class moka.lang.Object
equals, finalize, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AMS_1

public static final short AMS_1
Indicate that the AMS version is AMS_1xx.

See Also:
Constant Field Values

AMS_2

public static final short AMS_2
Indicate that the AMS version is AMS_2xx.

See Also:
Constant Field Values

CALCULATOR_TI89

public static final short CALCULATOR_TI89
Indicate that the calculator model is TI89.

See Also:
Constant Field Values

CALCULATOR_TI92PLUS

public static final short CALCULATOR_TI92PLUS
Indicate that the calculator model is TI92PLUS.

See Also:
Constant Field Values

CALCULATOR_V200

public static final short CALCULATOR_V200
Indicate that the calculator model is V200.

See Also:
Constant Field Values

AMS

public static short AMS
The AMS version (AMS_1xx or AMS_2xx)


CALCULATOR

public static short CALCULATOR
The calculator model (TI-89, TI-92 or V200)


ROM_BASE

public static void_p ROM_BASE
Base address of the ROM (0x200000 on TI-89 or V200, 0x400000 on TI-92 Plus).


ENTRIES

public static short ENTRIES
Number of entries in TIOS jump table: may be used for determining actual AMS version (for example, it is 972 on AMS 1.05 and 1463 on AMS 2.03).


KEY_DIAMOND

public static short KEY_DIAMOND
The number added to the key code if the Diamond key is pressed with it.


KEY_DOWN

public static short KEY_DOWN
Key code for the down arrow key.


KEY_UPLEFT

public static short KEY_UPLEFT
Key code for simultaneous pressing of the up and left arrow keys.


KEY_DOWNLEFT

public static short KEY_DOWNLEFT
Key code for simultaneous pressing of the down and left arrow keys.


KEY_LEFT

public static short KEY_LEFT
Key code for the left arrow key.


KEY_RIGHT

public static short KEY_RIGHT
Key code for the right arrow key.


KEY_SHIFT

public static short KEY_SHIFT
The number added to the key code if the Shift key is pressed with it.


KEY_UP

public static short KEY_UP
Key code for the up arrow key.


KEY_UPRIGHT

public static short KEY_UPRIGHT
Key code for simultaneous pressing on up and right arrow keys.


KEY_DOWNRIGHT

public static short KEY_DOWNRIGHT
Key code for simultaneous pressing on up and right arrow keys.


argCount

public static short argCount
The number of arguments passed to the program. Should be only read.

Method Detail

stEraseHelp

public static boolean stEraseHelp()
If the status flags indicate that a help message is being displayed, this function redraws the status line, effectively removing the message.

Returns:
true if the drawing is performed, false otherwize
Since:
MDK1.01a

setStHelpMsg

public static void setStHelpMsg(String msg)
Displays a message in the status line then finalizes the String argument.

Parameters:
msg - The message to display in the status line
Since:
MDK1.01a

getAvailRAM

public static int getAvailRAM()
Returns the availlable RAM memory in bytes. To be accurate, this method call the garbage collection of the RAM memory then determines the total amount of free bytes.

Returns:
The availlable RAM memory in bytes
Since:
MDK1.01a

gcRAM

public static void gcRAM()
Calls the garbage collection of the RAM memory.

Since:
MDK1.01a

reset

public static void reset()
Resets the calculator.

Since:
MDK1.01a

contrastUp

public static void contrastUp()
Increases the display contrast.

Since:
MDK1.01a

contrastDn

public static void contrastDn()
Decreases the display contrast.

Since:
MDK1.01a

idle

public static void idle()
Turns the calculator in "low-power" state until the next interrupt occurs then returns.

Since:
MDK1.01a

off

public static void off()
Turns off the calculator.

Since:
MDK1.01a

clearEstack

public static void clearEstack()
Clears the expression stack.


exit

public static void exit()
Terminates the current program returning 0 as return value. Usualy the argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.


exit

public static void exit(short ret)
Terminates the current program returning a short as return value.

Parameters:
ret - The value to return

exit

public static void exit(int ret)
Terminates the current program returning an int as return value.

Parameters:
ret - The value to return

exit

public static void exit(long ret)
Terminates the current program returning a long as return value.

Parameters:
ret - The value to return

exit

public static void exit(double ret)
Terminates the current program returning a double as return value.

Parameters:
ret - The value to return

exit

public static void exit(String ret)
Terminates the current program returning a String as return value.

Parameters:
ret - The value to return

getShort

public static short getShort()
Returns the next argument as a short.

Returns:
the next argument as a short

getInt

public static int getInt()
Returns the next argument as a int.

Returns:
the next argument as a int

getLong

public static long getLong()
Returns the next argument as a long.

Returns:
the next argument as a long

getDouble

public static double getDouble()
Returns the next argument as a double.

Returns:
the next argument as a double

getString

public static String getString()
Returns the next argument as a String.

Returns:
the next argument as a String

clrscr

public static void clrscr()
Clears the screen and moves the print position to the first character of the first line.


println

public static void println()
Terminates the line.


print

public static void print(Object obj)
Prints an object. In fact, prints the string produced by the toString method.

Parameters:
obj - The Object to be printed

println

public static void println(Object obj)
Prints an object and then terminates the line. In fact, prints the string produced by the toString method.

Parameters:
obj - The Object to be printed

print

public static void print(String s)
Prints a String then finalize the String.

Parameters:
s - The String to be printed

println

public static void println(String s)
Prints a String and then terminates the line and finalize the String.

Parameters:
s - The String to be printed

print

public static void print(char[] s)
Prints an ANSI string.

Parameters:
s - The ANSI string to be printed

println

public static void println(char[] s)
Prints an ANSI string and then terminates the line.

Parameters:
s - The ANSI string to be printed

print

public static void print(char c)
Prints a char.

Parameters:
c - The char to be printed

println

public static void println(char c)
Prints a char and then terminates the line.

Parameters:
c - The char to be printed

print

public static void print(byte b)
Prints a byte.

Parameters:
b - The byte to be printed

println

public static void println(byte b)
Prints a byte and then terminates the line.


print

public static void print(short s)
Prints a short.

Parameters:
s - The short to be printed

println

public static void println(short s)
Prints a short and then terminates the line.

Parameters:
s - The short to be printed

print

public static void print(int i)
Prints an int.

Parameters:
i - The int to be printed

println

public static void println(int i)
Prints an int and then terminates the line.

Parameters:
i - The int to be printed

print

public static void print(long l)
Prints a long.

Parameters:
l - The long to be printed

println

public static void println(long l)
Prints a long and then terminates the line.

Parameters:
l - The long to be printed

print

public static void print(double d)
Prints a double.

Parameters:
d - The double to be printed

println

public static void println(double d)
Prints a double and then terminates the line.

Parameters:
d - The double to be printed

read

public static char read()
Read a character from the keyboard.

Returns:
The character read from the keyboard.

readLine

public static String readLine()
Read a line of text. A line is considered to be terminated by a carriage return or when the 255 character buffer is full.

Returns:
A String containing the contents of the line, not including any line-termination characters.

readLine

public static String readLine(boolean echo)
Read a line of text. A line is considered to be terminated by a carriage return or when the 255 character buffer is full.

Parameters:
echo - if true, echos the keys pressed on the screen.
Returns:
A String containing the contents of the line, not including any line-termination characters.

exec

public static void exec(String command)
Executes the specified string command. The string command object is finalized before this method returns.

Parameters:
command - a specified system command.

setAPD

public static int setAPD(int time)
Sets the device's "APD" time. This is the time in 1/20th seconds where, if no user interaction occurs with the device, it turns off.

Parameters:
time - the time in 1/20th seconds where, if no user interaction occurs with the device, it turns off.
Returns:
the previous device's "APD" time.

malloc

public static void_p malloc(int size)
Allocate a block of memory from the memory heap. If not enough space exists for the new block or the argument size is zero, it returns null. The memory allocated with this method can be freed by System.free method. This method supports the garbage collection feature (if the main class of the project implements Use_GarbageCollection) instead of the native C equivalent.

Parameters:
size - the size (in bytes) of the block.
Returns:
A pointer to a block of memory, or null if 0 is specified for size or if there is not enough memory.

free

public static void free(void_p ptr)
Deallocates a memory block previously allocated by a call of System.malloc.

Parameters:
ptr - pointer to the memory block.