CLS |
CONSOLE Statement |
Windows/Unix |
|
|
Clears console screen of all text, and fills the console with the currect background color. CLS also returns the cursor to the home position in the top left corner of the screen.
Syntax: CLS
CLS
Details:
Under Windows, CLS is a CONSOLE statement, under Linux/Unix, CLS is implemented as a system call to clear, so you can safely call CLS without compiling as CONSOLE under Linux/Unix. |
|
COLOR |
CONSOLE Statement |
Windows/Unix |
|
|
Sets the current display colors for the console screen.
- Foreground is the text color (range = 0-31)
- Background is the screen color (range = 0-7)
0 = black 4 = red 8 = grey 12 = light red
1 = blue 5 = magenta 9 = light blue 13 = light magenta
2 = green 6 = brown 10 = light green 14 = yellow
3 = cyan 7 = white 11 = light cyan 15 = bright white
Syntax: COLOR [foreground][,background]
COLOR 15
COLOR 10, 3
COLOR ,1
COLOR
|
|
CONSOLE.INPUTHANDLE |
CONSOLE Statement |
Windows |
|
|
Returns the console input handle for use in API calls.
Syntax: CONSOLE.INPUTHANDLE
hnd = CONSOLE.INPUTHANDLE
|
|
CONSOLE.OUTPUTHANDLE |
CONSOLE Statement |
Windows |
|
|
Returns the console output handle for use in API calls.
Syntax: CONSOLE.OUTPUTHANDLE
hnd = CONSOLE.OUTPUTHANDLE
|
|
CSRLIN |
CONSOLE Function |
Windows/Unix |
|
|
Returns the current line (row) position of the cursor.
Syntax: CSRLIN
Row% = CSRLIN
|
|
GET$ |
CONSOLE Function |
Windows/Unix |
|
|
This function is mainly used in CGI programs, but can be used as a general purpose read function. It will read the STDIN.
Syntax: GET$(numeric-expression)
A$ = GET$(10)
Details:
GET$ under Linux/Unix is not a console function. To use GET$, compile your application as CONSOLE or CGI under Windows. |
|
INKEY$ |
CONSOLE Function |
Windows/Unix |
|
|
Returns a one- or two-byte string containing a character read from standard input (console). An empty string is returned if no character is waiting there.
Syntax: INKEY$
A$ = INKEY$
Details:
Extended keys start with CHR$(27) and are 2 bytes in length. Extended keys are arrow keys, page up/down, home, end, insert, delete, and F1-F12 keys. You can also trap the shift, ctrl, alt, caps/num/scroll lock keys under Windows. |
|
INPUT |
CONSOLE Statement |
Windows/Unix |
|
|
Reads a whole line of input from the. This statement causes the program to pause and wait for data until a carriage return is pressed.
Syntax: INPUT ["Prompt string"{;|,}] variable
INPUT A$
INPUT "Enter name: "; A$
Details:
INPUT for Rapid-Q is not exactly compatible with QBasic's INPUT. It is more like LINE INPUT. The return variable can be a string or numeric variable. Under Windows, INPUT is implemented as a CONSOLE function. Under Linux/Unix INPUT is not considered a CONSOLE function so there's no need to compile as CONSOLE. |
|
LOCATE |
CONSOLE Statement |
Windows/Unix |
|
|
Moves cursor to specified position.
Syntax: LOCATE [row][,column][,cursor]
LOCATE 10, 1
LOCATE ,10
LOCATE 5
LOCATE 1,,80
Details:
Under Windows you can assume that Row 25 is the last row and Column 80 as the last column. Under Linux/Unix this is dependent on your terminal, but you can use the internal variables Screen.ConsoleX and Screen.ConsoleY to determine the max column and row respectively. The first row and first column always starts at (1,1). The cursor argument is optional, and can take a range of values from 0 to 100 indicating the percentage of the character cell that is filled by the cursor. ie. specifying a value of 0 completely hides the cursor. The default cursor value is 1. |
|
PCOPY |
CONSOLE Statement |
Windows |
|
|
Copies one screen page to another.
Syntax: PCOPY sourcepage, destinationpage
PCOPY 0, 1
PCOPY 1, 5
Details:
The visible (on-screen) page is always 0. There are 7 off-screen pages (1 to 7). You can copy from any page onto any other page. |
|
PEEK |
CONSOLE Function |
Windows |
|
|
Returns the current character/attribute pair stored at a specified location on the console screen.
Syntax: PEEK([#pagenum,] address)
A% = PEEK(2000) '-- Peek location 2000 on current page
A% = PEEK(1, 2000) '-- Peek location 2000 on page 1
Details:
To understand how to compute the address, use this handy function:
Char$ = CHR$(PEEK((Row%-1)*160+(Col%-1)*2))
Attr = PEEK((Row%-1)*160+(Col%-1)*2+1) As you may notice, all the even memory addresses contain the character, and all the odd numbered addresses contain the attribute. The attribute contains information about the foreground and background color.
ForeGround% = Attr AND &HF
BackGround% = Attr SHR 4 Why all the trouble? This is implemented for compatibility with QBasic. The only difference is that you don't use DEF SEG under Rapid-Q, and PEEK only works at the console level.
|
|
POKE |
CONSOLE Statement |
Windows |
|
|
Writes a byte to the console page.
Syntax: POKE [#pagenum,] address, byte
POKE 2000, ASC("A") '-- Pokes an "A" character at location 2000
POKE 2001, 95 '-- Pokes attribute 95 to location 2000
POKE 1, 2001, 95 '-- Same as above but pokes to page 1
Details:
To understand how to compute the address, use this handy function:
ChAddress = (Row%-1)*160+(Col%-1)*2
AttrAddress = (Row%-1)*160+(Col%-1)*2+1 As you may notice, all the even memory addresses contain the character, and all the odd numbered addresses contain the attribute. The attribute contains information about the foreground and background color. To calculate the attribute, try this:
Attr = (BackGround% SHL 4) OR ForeGround% Why all the trouble? This is implemented for compatibility with QBasic. The only difference is that you don't use DEF SEG under Rapid-Q, and POKE only works at the console level.
|
|
POS |
CONSOLE Function |
Windows/Unix |
|
|
Returns the current horizontal (column) position of the cursor.
Syntax: POS(0)
Column% = POS(0)
Details:
Please note that I did not make this function up (ie. its weird syntax), it's implemented for compatibility with QBasic. |
|
PRINT |
CONSOLE Statement |
Windows/Unix |
|
|
PRINT outputs data to the screen (or standard output).
Syntax: PRINT [#pagenum,][expressions][{;|,}]
PRINT "Number: "; 45
PRINT A$
PRINT #1, "This prints to screen page 1"
Details:
Expressions can be any string, number, or function. You can optionally use ; or , to print out more expressions. Under QBasic, PRINT can format your data if you use the comma, however, under Rapid-Q the comma and semi-colon have the same effect. Again, under Windows, PRINT is implemented as a CONSOLE function. Under Linux/Unix you do not need to compile as CONSOLE. |
|
SCREEN |
CONSOLE Function |
Windows |
|
|
Returns the ASCII character or attribute at (row, col) on the current console screen.
Syntax: SCREEN(row, col [, colorflag])
A% = SCREEN(1, 1) '-- Get character located on the first row and column
A% = SCREEN(5, 3, 1) '-- Get attribute of character located at (5,3)
Details:
The SCREEN function is very similar to the PEEK function, except that it's much easier to use. If you supply the function with a colorflag parameter, the function returns the attribute (ie. color), otherwise it returns the ASCII character. The SCREEN function only works on the current console screen and not on any hidden pages. |
|
SETCONSOLETITLE |
CONSOLE Statement |
Windows |
|
|
SetConsoleTitle is implemented as a WinAPI call to SetConsoleTitle but is called as a statement rather than a function (ie. no return value). If you would like a return value, you'll have to call the API function directly.
Syntax: SETCONSOLETITLE string-expression
SETCONSOLETITLE "Hello World!"
|
|
SLEEP |
CONSOLE Statement |
Windows/Unix |
|
|
Suspends execution of the application for a specified amount of time.
Syntax: SLEEP seconds
SLEEP .5 '-- Delay for half a second
Details:
SLEEP requires a parameter, unlike QBasic. SLEEP waits until the number of seconds specified has elasped. You cannot break out of it by pressing a key (unlike QBasic). Under Windows, SLEEP is implemented as a console function. Under Linux/Unix, you do not need to compile as CONSOLE. |
|