Up one Language reference. By Lee Davison. Up to top

Introduction

This language reference will only refer to those commands which differ from, or are in addition to, those in the main EhBASIC68 language reference.

Notes on graphic commands

Co-ordinates

In all instances X and Y co-ordinate values may vary from -32768 to +32767. Attempting to use values outside this range will cause a function call error. Only parts of a structure that appear within the visible window, (0,0) to (639,479), will be drawn.

Colour values

Colour values are longword integers and are interpreted as follows ..

Bits 31 to 24 Bits 23 to 16 Bits 15 to 8 Bits 7 to 0
Ignored Blue value Green value Red value

As bits 31 to 24 are ignored -ve values may be used where convenient. E.g. you could use -1 instead of $FFFFFF for white.

BASIC Keywords

Here is a list of EASy68k BASIC keywords. Keywords are only valid when entered in upper case as shown, spaces may not be included in them. So, for example, GOTO would be a valid keyword but GO TO would not.

BUFFER CLS CURSOR ELLIPSE ELLIPSEF FILL KEYS()
LINE LOAD MODE MOVE POINT POINT() RECT
RECTF SAVE SIZE TI

BASIC Commands

BUFFER

Copies the screen buffer to the visible screen when double buffered mode is enabled. Has no effect if double buffered mode is not enabled. See MODE for how to set double buffered mode.

CLS

Clears the screen. When double buffered mode is enabled it clears the screen buffer.

CURSOR <exprX>,<exprY>

Sets the position of the text cursor as defined by exprX and exprY.

Values must be 0 <= exprX <= 79 and 0 <= exprY <= 31. If either is outside this range it will cause a Function Call error.

ELLIPSE [<exprX1>,<exprY1>,<exprX2>,<exprY2>][,][<exprLC>[,<exprFC>]]

Draws an unfilled ellipse bounded by the rectangle defined by exprX1 and exprX2, for the X axis, and exprY1 and exprY2, for the Y axis, of colour exprLC. The width of the line used to draw the ellipse is set by the SIZE command.

If exprLC is present then the line colour will be set before the ellipse is drawn.

If exprFC is present then the fill colour will be set before the ellipse is drawn. If you want to set the fill colour then the line colour must also be set.

If the co-ordinates are omitted then only the line colour, and the fill colour if given, will be set without drawing.

ELLIPSEF [<exprX1>,<exprY1>,<exprX2>,<exprY2>][,][<exprLC>[,<exprFC>]]

The same as ELLIPSE except the ellipse is filled with the current fill colour.

FILL [<exprX>,<exprY>][,][<exprFC>]

Flood fill the area starting from <exprX>,<exprY>. The fill will continue until it reaches the screen edge or a pixel of a different colour to that originally at <exprX>,<exprY>.

If <exprFC> is specified then the current fill colour is set before the fill starts. If <exprX>,<exprY> is omitted and just <exprFC> is specified then the fill colour is set without drawing.

LINE [<exprX1>,<exprY1>[,<exprX2>,<exprY2>]][,][<exprLC>]

Draws a line from <exprX1>,<exprY1> to <exprX2>,<exprY2>. If <exprX2>,<exprY2> is omitted then the line is drawn from the current graphics position to <exprX1>,<exprY1>.

If <exprLC> is specified then the line colour will be set to that value before the line is drawn. Also just giving <exprLC> will set the line colour without drawing.

LOAD <expression$>

Attempts to load the file expression$. It will recognise the file format (binary or ASCII) and invoke the necessary routines.

During an ASCII load you will see the program as it is being read from the file. This file is merged with any program lines currently in the memory so to completely replace a program in memory NEW should be performed before LOAD.

Binary files load much faster and over write any program currently in memory but may not be readable by future versions.

MODE <expression>

Set the draw mode to <expression>. Valid values are 0 to 17.

Mode Function Effect
0False Drawing is always black
1True Drawing is always white
2Null Nothing is drawn but the cursor is moved
3Inverse The inverse of the background is drawn
4Colour The colour is drawn (default)
5Inverse colour The inverse of the colour is drawn
6Inverse OR The inverse of the background OR the colour is drawn
7Inverse AND The inverse of the background AND the colour is drawn
8OR Inverse The background OR the inverse of the colour is drawn
9AND Inverse The background AND the inverse of the colour is drawn
10OR The background OR the colour is drawn
11NOR The background NOR the colour is drawn
12AND The background AND the colour is drawn
13NAND The background NAND the colour is drawn
14EOR The background ExclusiveOR the colour is drawn
15ENOR The background ExclusiveNOR the colour is drawn
16Single Turn off double buffer mode (default)
17Double Turn on double buffer mode
MOVE <exprX>,<exprY>

Move the current graphics point to <exprX>,<exprY>. Nothing is drawn.

POINT [<exprX>,<exprY>][,][<exprLC>]

Set the colour of the point <exprX>,<exprY> to the current line colour.

If <exprLC> is specified then the current line colour is set before the point is plotted. If <exprX>,<exprY> is omitted and just <exprLC> is specified then the line colour is set without drawing.

RECT [<exprX1>,<exprY1>,<exprX2>,<exprY2>][,][<exprLC>[,<exprFC>]]

The same as ELLIPSE except the bounding rectangle itself is drawn.

RECTF [<exprX1>,<exprY1>,<exprX2>,<exprY2>][,][<exprLC>[,<exprFC>]]

The same as RECT except the bounding rectangle is filled with the current fill colour.

SAVE <expression$>[,a[n1][-n2]]

Attempts to save the program memory to the file expression$. If the command has the ,a appended then the program will be saved in ASCII format. If saving in ASCII format then the range of the save can be specified as with the LIST command.

A program saved as binary loads much faster however, it is not recomended for archiving as binary programs may not be readable by different versions of EhBASIC.

SIZE <expression>

Sets the width of lines drawn using the LINE command and the width of the outlines drawn using any of the shape commands.

The valid range of <expression> is from 0 to 255 but setting a value of zero will actually give a width of one.

BASIC Functions

KEYS(<expression>)

Returns the current state of up to four specified keys. <expression> can be either string or numeric, if it is numeric then each byte of it's value as a longword is one key code and the flag for that code is returned in the corresponding byte of the returned value.

If <expression> is string then the first four characters of the string are used to form a right justified test string and the flag for that code is returned in the corresponding byte of the returned value. Characters beyond the fourth character are ignored.

If <expression> is numeric zero or a null string then the scan code of the last key pressed is returned.

All letter keys correspond to the upper case form of that letter, all numeric keys on the top row correspond to their number. Other key codes are given in the table below.

KeyCode KeyCode
Backspace$08 keypad 5$0C
Keypad Enter or Enter$0DShift$10
Control$11Alt$12
Pause$13Caps Lock$14
Esc$1BSpace$20
Keypad 9 or Page Up$21Keypad 3 or Page Down$22
Keypad 1 or End$23Keypad 7 or Home$24
Keypad 4 or Left Arrow$25Keypad 8 or Up Arrow$26
Keypad 6 or Right Arrow$27Keypad 2 or Down Arrow$28
Keypad 0 or Insert$2DKeypad . or Delete$2E
Keypad *$6AKeypad +$6B
Keypad -$6DKeypad /$6F
F2$71F3$73
F4$74F5$75
F11$7AF12$7B
Num Lock$90Scroll Lock$91
;$BA=$BB
,$BC-$BD
.$BE/$BF
`$C0[$DB
\$DC]$DD
'$DE  

POINT(<exprX>,<exprY>)

Returns the pixel colour value at point <exprX>,<exprY>.

TI

Returns the time since midnight in 1/100ths of seconds.


Last page update: 17th August, 2005. e-mail me e-mail