Special commands and functions for VDP (video display processor) SET VIDEO [mode], Specify superimposing. SET VDP 2 [brightness], [color bus], and other modes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
912 views24 pages
MSX-BASIC 2.0 Reference Chart (1985)
Special commands and functions for VDP (video display processor) SET VIDEO [mode], Specify superimposing. SET VDP 2 [brightness], [color bus], and other modes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24
SONY:
MSX-BASIC Version 2.0 REFERENCE CHART
HITBIT
r:;§J is a trademark of ASCII Corp.
CONSTANTS AND VARIABLES
String type Character string of 0 to 255 characters
(enclosed in quotation marks)
Integer type - 32768 to + 32767
Significant digits: 6 (single precision)
Constant Floating-point type or 14 (double precision)
Exponent part: - 64 to + 62
Hexadecimal expression Takes a prefix "&H"
Octal expression Takes prefix "&0" or "0"
Binary expression Takes a prefix "&B" Variable name First two characters are ettecttve.
Written after variable name
Variable % : Integer type
Type declarator ! : Single precision
# : Double precision
$ : String type SPECIAL VARIABLES
TIME: Retain a value in the timer. Can be rewritten. SPRITE$ (sprite number): Retain the sprite pattern.
• Special commands and functions for VDP (Video Display Processor) BASE (expression) : Used to read or write the base address of the VDP table. VDP (numeric value) : Used to read or write the contents of the VDP register.
21
SET VIDEO [mode], Specify superimposing SET VIDEO 2
[brightness], [color bus], and other modes. (used
[sync], [sound], [video input], only with computers that
[AV control] have the superimpose
function)
Mode
0: computer signal
(internal sync
only)
1: computer signal
2: superimpose
3: TV signal
Brightness
0: normal brightness
1: half-brightness
Color Bus
0: VDP color bus
input
1: VDP color bus
output
Simultaneous
0: internal sync
1: external sync
Sound
0: external sound
signal not mixed
1: right channel
external sound
signal mixed
2: left channel
external sound
signal mixed
3: both channels
external sound
signal mixed
Video Input
0: select RGB
multiconnector
input
1: select external
video input
connector input
AV Control
0: TV signal
1: External video 3
MEMORY SWITCH FUNCTION COMMANDS
format function example
SET ADJUST (X, Y) Change the location of SET ADJUST (- 4, 3)
the display on the screen
SET BEEP [sound], [volume] Select the BEEP sound. SET BEEP 2, 3
SET TITLE ["title"], [color] Set the title to be SET TITLE "SONY"
displayed on the initial
screen display.
SET PROMPT "prompt" Set the prompt statement SET PROMPT "Ready"
to be displayed when
BASIC is in a command-
wait status.
SET PASSWORD "password" Set the system password. SET PASSWORD
"BASIC"
SET SCREEN Set the current SCREEN
values as the initial start-
up values. COMMANDS FOR DATA INPUT/OUTPUT
format function example
DATA constant [, constant] Give data to be read with DATA 3, 4, 5, 6, ABC,
[, constant] ... a READ statement. "C, D"
INPUT ["prompt statement";] Give value of variable INPUT "A$=";A$
variable [, variable] from the keyboard.
[, variable] .
LINE INPUT ["prompt Give string of up to 254 LINE INPUT "C$=";C$
statement";] variable characters from the
keyboard to the string
type variable
[LET] vartabte e x Assign data to the LET A=A+5
variable.
MID$ (X$, M[, N]) Replace characters MID$ (A$, 2, 5)=B$
beginning with the Mth
character of the string X$
with characters from the
beginning to Nth
character of Y$.
PRINT [expression] [separator] Output data onto display PRINT A;B;C
[expression] [separator] ... screen. A separator is a
or semi-colon ( ; ), a comma
? [expression] [separator] ( , ) or a space.
[expression] [separator] ...
PRINT USING format symbol; Output data onto display
expression [, expression] ... screen in the specified 10 A$="ABCDEFG"
format. 20 PRINT USING
Format symbols: "!";A$
"!" Output the first 30 PRINT USING
character. "\ \";A$ 4
charac-
PRINT USING
"# # # -";100, 200
READ variable [, variable] [, variable] _
"\n spaces \" Outputs n+2
40 PRINT USING "SSS&TTT";A$
RESTORE [line number]
"&"
ters.
Output the entire string_
Specify the number of display digits of the numeric data.
Add + or before
(after) numeric data.
Add - after
SWAP variable, variable
"#"
PRINT USING
"# # #_ # #";123_45,10_5
PRINT USING
"+ # # #";100, 200
"+"
n<'lgative numeric data.
" * *" Fill space befor numeric data with *_
"££" Put £ in front of numeric data.
" * * £" Put £ in front of numeric data and fill space
in front of it with *_
Put, after every third digit to the left of the decimal
PRINT USING "**###";100,200
PRINT USING
"££ # # # ";100, - 200 PRINT USING "**£###";10,-20
PRINT USING
"# # # # #,_# #";1234_56
point.
"AAAA" Output with floating decimal points.
PRINT USING
"#_ # # AAAA";123_98
Read data in DATA statement.
READ A%
Specify the DATA statement to be read with a READ statement executed next.
RESTOREH,)0
SWAP A,S
Exchange values of two variables.
5
COMMANDS FOR CONTROLLING PROGRAM EXECUTION AND FLOW
format function example
RUN [line number] Start program execution. RUN 100
~ iii! RUN "[drive name] file Load program and RUN "PROG.BAS"
name [. type name]" [, R] execute it
STOP Interrupt program
execution.
CONT Restart program
execution.
END Terminate program
execution.
TRON Display line number that
was executed.
TROFF Cancel TRON.
FOR variable= initial value TO Repeat the program FOR 1=1 TO 10 STEP
end value execution between FOR 2
I [STEP increment] and NEXT. I
NEXT [variable] NEXT I
GOSUB line number Transfer control to the 100 GOSUB 100
I specified subroutine. I
RETURN [line number] Return to the main 1000
routine with RETURN. I
1100 RETURN
GOTO line number Transfer control to the GOTO 100
specified line.
I F expression Branch control according IF X=0 THEN 100
r THEN I statement I '1 to the expression value. ELSE 200
~ line number (
l GOTO line number J
[ELSE I statement I]
line number
ON expression GOTO line Branch control according ON A GOTO 100, 200,
number [, line number] ... to the expression value. 300
ON expression GOSUB line Branch control according ON SGN (A)+2
number [, line number] ... to the expression value. GOSUB 1000, 2000,
3000 6
COMMANDS FOR DISPLAY SCREEN
format function example
SCREEN [mode], [sprite size], Specify the screen SCREEN 2, 0,0
[key click switch], [baud rate], display mode.
[printer type], [interlace mode] Mode
0: 80 x 24 character
text mode
1: 32 x 24 text mode
2: 256 x 192 dot,
16-color graphic
mode
3: 64 x 48 dot, 16-color
multicolor mode
4: 256 x 192 dot,
16-color graphic
mode, sprite
enhanced
5: 256 x 212 dot,
16-color graphic
mode, sprite
enhanced
6: 512 x 212 dot, 4-color
graphic mode, sprite
enhanced
7· 512 x 212 dot,
16-color graphic
mode, sprite
enhanced
8: 256 x 212 dot,
256-color graphic
mode, sprite
enhanced
Sprite size
0: 8 x8 dot
unmagnified
1: 8 x 8 dot magnified
2: 16x 16 dot
unmagnified
3: 16x 16 dot
magnified
Key click switch
0: Supress key click
sounds.
1: Produce key click
sounds.
Baud rate
0: 1200 baud
1: 2400 baud
Printer type
0: MSX printer
1: Non-MSX printer
Interlace mode
0: non-interlace
1: interlace
2: interlace, even/odd
page change display
3: interlace, even/odd
page change display
SET PAGE [display page], Specify the display page SET PAGE 0, 1
[active page] and the active page. 7
WIDTH number of characters Specify the number of WIDTH 28
characters per line in the
text mode.
CLS Erase all displays on the
screen.
KEY {g~F} Display or erase the KEY OFF
contents of function
keys.
LOCATE [x-coordinate], Move the cursor. LOCATE 11'1, 12, 1
[y-coordinate], [cursor switch] Cursor switch
1'1: Not display the
cursor.
1: Display the cursor.
COLOR [foreground color], Specify colors of the COLOR 8, 15, 2
[background color], [border foreground, background
color] and the border.
COLOR=(palette number, red Assign colors to the COLOR=(2, 0, 3, 7)
brightness, green brightness, color palette
blue brightness)
COLOR = RESTORE Assign the content of the
color lookup table in the
video RAM to the VDP
color palette register.
COLOR[=NEW] Return color palette to
initial default settings
PUT SPRITE sprite plane Display the specified PUT SPRITE 1'1,
number, [[STEP] (x-coordinate, sprite pattern at the (11'11'1, 51'1), 7, 2
y-coordinatej], [color], [sprite specified position on the
number] specified sprite plane.
COLOR SPRITE$ (sprite plane Specify the color of each COLOR SPRITE$(0)
no.) ="character expression" line of a sprite. = CH R$(1) + CH R$(7)
Significance of each
character bit:
I B71 B61 B41 B31 B21 B1 I B9 I
87: For 1, moves sprite
32 dots to the left.
86: For 1, ignores sprite
priority position and
overlap, and displays
the color whose
code is the result of
OR of the
overlapping colors.
85: For 1, ignores sprite
overlap.
84: Not used.
83-80: color code
COLOR SPRITE (sprite plane Change the color of the COLOR SPRITE (1)=4
no.) = palette no. sprite on the specified
sprite plane.
Logical Operations PSET, PRESET, AND, OR, XOR, TPSET, TPRESET,
TAND, TOR, TXOR 8
COMMANDS FOR GRAPHIC DISPLAY
format function example
CIRCLE [STEP] (x-coordinate, Draw a circle, CIRCLE (80, 60), 15, 8
y-coordinate), radius, [color
code], [start angle], [end
angle], [aspect ratio]
DRAW "graphic Draw an arbitrary DRAW
subcommands" graphic_ "S40U5R5D5L5"
LINE [[STEP] (x-coordinate, Draw a line or a square. LINE -STEP (20,50)"
y-coordinate)]-[STEP] B
(x-coordinate, y-coordinate),
[color code] {I: ~~]}
[, logical operation]
PAINT [STEP] (x-coordinate, Color the area inside the PAINT (120, 100)
y-coordinate), [display color], border line.
[border line color code]
PSET [STEP] (x-coordinate, Mark a dot. PSET STEP (10, 10),
y-coordinate), [color code], 14
[logical operation]
PRESET [STEP] (x-coordinate, Mark or erase a dot. PRESET (100, 100)
y-coordinate), [color code],
[logical operation] 9
COMMANDS FOR SCREEN DATA PROCESSING
format function example
COPY (X1, Y1)~(X2, Y2) Transfer image data in COPY (20, 30)~
[, source page] TO (X3, Y3), the VRAM to other (70, 50), 1 TO (90, 60),
[destination page], [logical sectors in the VRAM 0, AND
operation]
COPY (X1, Y1)~(X2, Y2) Transfer image data in COPY (20~,30)~
[, source page] TO array the VRAM to an array (70,50), 0 TO S
variable name variable
COPY array variable name Transfer image data in an COPY S,1 TO
[, direction] TO (X3, Y3), array variable to the (100, 100), 1, XOR
[destination page], [logical VRAM
operation]
B COPY (X1, Y1)~(X2, Y2) Save the image data in COPY (10, 10)··
[, source page] TO "[drive the VRAM to the disk (120, 90) TO
name] file name [. type name]" file. "PORTRAIT PIC"
B COPY "[drive name] file Load image data in the COPY
name [. type name]" disk file to the VRAM "PORTRAIT PIC" TO
[, direction] TO (X3, Y3), (10, 10)
[destination page], [logical
operation]
B COPY "[drive name] file Load image data in the COPY
name [. type name]" TO array disk file to the array "PORTRAIT PIC" TO S
variable name variable
B COpy array variable name Save the image data in COPY S TO
TO "[drive name] file name an array variable to the "PORTRAIT PIC"
[. type name]" disk file.
COPY SCREEN [mode], [mask] Digitize an external video
signal and write it in the
VDP.
(used only with
computers that have the
digitize function)
Mode
0: the signal of 1 field
is digitized and
written on the
display page
1: signals of 2 fields (1
frame) are digitized:
one is written on
the display page,
and one is written
on the page whose
page number is
smaller than that of
the display page by
one. 10
Graphic subcommands
(When B is added, a subcommand changes the starting point only without drawing lines.
If N is added, it draws lines but does not move starting point.)
subcommand function initial subcommand function initial
value value
Mx, y To an absolute Fn Move down to the n=1
position (x, y) right.
M±x, ±y Move by ±x, ±y Gn Move down to the n=1
from current left.
position.
Un Move up. n=1 Hn Move up to the n=1
left.
Dn Move down. n=1 An Rotate the
coordinate system.
Rn Move to the right. n=1 en Specify a color. n=15
Ln Move to the left. n=1 Sn Specify the unit n=4
number of dots.
En Move up to the n=1 X string type Execute the
right. variable; subcommand
assigned to the
string type
variable. 11
COMMANDS FOR MUSIC PERFORMANCE
format function example
BEEP Generate a beep sound. BEEP: BEEP: BEEP
SOUND PSG register number, Write data into PSG SOUND 7,7
expression register.
PLAY "music subcommands" Play music. PLAY
[, "music subcommands"] "04L4CEGEL1C"
[, "music subcommands"] Music subcommands
subcommand function and range initial subcommand function and range initial
value value
# Music notes Tn Tempo 32:::;n :::; n=120
A + - 255
-
#
G +
-
On Octave 1:::;n:::;8 n=4 Vn Volume 0:::;n :::;15 n=8
Nn Pitch 0:::;n :::;96 Mn Envelope n=255
frequency 1:::;n:::;
65535
Ln Length 1:::;n :::;64 n=4 Sn Envelope pattern n=1
1:sn:s15
Rn Rest 1:::;n :::;64 n=4 Dot
X string type Execute the
variable; subcommand
assignee! to the
string type
variable. 12
I J
COMMANDS FOR PROGRAM AND DATA FILES
format function example
MAXFI LES = expression Set the number of files MAXFILES=3
that can be opened in a
program.
OPEN "[device name] [file Open a fi Ie and specify a OPEN "CRT: TEST"
name [. type name]]" [FOR mode. FOR OUTPUT AS # 1
mode] AS [#] file number Modes: OUTPUT .. Write
[LEN = record length] INPUT ..... Read
When the mode is
specified a sequential
file is opened. When the
mode is not specified, a
random access file is
opened.
PRINT # file number, Write data into PRINT #1, "ABC"
[expression] [separater] sequential file in
[expression] sequence.
PRINT # file number, USING Write data into PRINT #1, USING
format symbol; expression sequential file in "\ \";A$
[, expression] ... sequence in the specified
format. (See PRINT
USING.)
INPUT # file number, variable Read data from INPUT #1, A, B, C
[, variable] ... sequential file in
sequence and assign
them to variables.
LINE INPUT # file number, Read string up to 254 LINE INPUT #1, A$
string type variable characters from
sequential file and
assign them to variable.
CLOSE [#] [file number] [, file Close files, CLOSE #1,2
number] ."
SAVE "[device name] [file Save an ASCII format SAVE
name]" program (other than "CAS:PROGRAM"
disk),
B SAVE "[drive name] file Save a program on the SAVE "GAME1,BAS"
name [, type name]" [,A] disk, SAVE "GAME2.ASC",A
The program is saved in
the ASCII format when
the A option is specified,
and in intermediate
language when the A
option is omitted,
LOAD "[device name] [file Load an ASCII format LOAD
name]" program (other than "CAS:PROGRAM"
disk),
B LOAD "[drive name] file Load a program from the LOAD "GAME1,BAS",R
name [, type name]" [,R] disk,
MERGE "[device name] [file Load an ASCII format MERGE "CAS:PROG2"
name]" program and merge it
with the program in
memory, 13
~ MERGE "[drive name] [file Load a program from the MERGE
name [. type name]]" disk saved in the ASCII "GAME2.ASC"
format and merge it with
BSAVE "[device name] [file-- iii iJrogram !n memory.
Save the contents of BSAVE "CAS:GAME",
name]", start address, end memory within the &H3000, &H3FFF
address [, execution starting specified range (other
address] than disk).
~ BSAVE "[drive name] [file Save the content of the BSAVE "PROG.BIN",
name [. type name]]", start main memory (without S &HE000, &HE8000
address, end address option) or the video RAM BSAVE "CHARr', 0,
I [, execution start address] I on the disk (with S &H3FFF,S
[,S] option).
BLOAD "[device name] [file Load machine language BLOAD "CAS:GAME",
name]" [, R] [, offset] program (other than R
disk). Load and execute
program when, R is
added. The offset is one
for the memory address
at the time of loading.
~ BLOAD "[drive name] [file Load a machine language BLOAD "PROG.BIN",R
name [. type name]]" program from the disk. BLOAD "CHART",S
I [:~i I [, offset] When the R option is
specified, loads the
program and executes it.
When the S option is
specified, loads the file
data to the video RAM.
CSAVE "file name" [, baud Save a program onto CSAVE "STAR"
rate] cassette tape in
intermediate language.
Baud rate: 1. 1200 baud
2.2400 baud
CLOAD ["file name"] Load program from CLOAD "STAR"
cassette tape.
CLOAD? ["file name"] Compare program saved CLOAD? "STAR"
on cassette tape and
program in memory.
~ FIELD [#] file number, Define 1 random access FIELD # 1, 12,
character length AS string file record. AS NAM$, 14 AS TEL$
variable [,character length AS
string variable] ....
~ LSET string variable= Write the content of a LSET TEL$= B$
string expression string expression to the RSET NAM$="TOM"
RSET string variable= string variable defined in
string expression the record. (LSET
provides left justification;
RSET provides right
justification)
~ PUT [#] file number Write the content of a PUT #1,1
[, record number] record to a random
access file on the disk.
~ GET [#] file number Read 1 record from a GET #1, 10
[, record number] random access file on
the disk. 14
Device name
CAS: Cassette tape
CRT: Text mode screen
GRP: Graphic mode screen
LPT: Printer
MEM: Memory disk
A Floppy disk drive names
B: Floppy disk drive names
C: Floppy disk drive names
D:.. . Floppy disk drive names
E: Floppy disk drive names
F: Floppy disk drive names
G: Floppy disk drive names
H: Floppy disk drive names
COMMANDS FOR FLOPPY DISK AND MEMORY DISK MANAGEMENT
formal function example
CALL FORMAT Format a disk.
~ FILES ["[drive name] [file Display file names saved FILES
name [. type name]]"J on the disk. FILES" * .BAS"
~ KILL "[drive name] file Erase a file on the disk. KILL "TEST.BAS"
name [. type name]"
~ NAME "[drive nameJ old Change the name of a NAME "OLD.DAT" AS
file name [. old type file on the disk. "NEW.DAT"
name]" AS "new file name
[. new type name]"
~ COPY "[drive name 1J file Copy a file on the disk to COpy "ABC.BAS" TO
name [.type name]" the same disk or to "XYZ.BAS"
[TO "[drive name 2J file another disk. COPY "A:ABC.BAS"
name [.type name]"] TO "B:"
CALL MEMINI [(size)J Allocate a section of CALL MEMINI (20000)
memory to be used as a
memory disk, and
initialize it.
CALL MFILES Display file names on the
memory disk.
CALL MKILL ("file name [.type Erase a file on the CALL MKILL
name]") memory disk. ("ADRS.DAT")
CALL MNAME ("old file name Change a file name on CALL MFILES
[. old type name]" AS "new file the memory disk. ("OLD.DAT" AS
name [. new type name]") "NEW.DAT") 15
COMMANDS FOR INTERRUPT
format function example
ON KEY GOSUB line number Interrupt with a function ON KEY GOSUB 1000,
[, line number] ... key. 2000, 3000
KEY (function key number) ON Enable an interrupt with KEY (1) ON
a function key.
KEY (function key number) Disable an interrupt with KEY (2) OFF
OFF a function key.
KEY (function key number) Hold an interrupt with a KEY (3) STOP
STOP function key.
ON STRIG GOSUB line Interrupt with a trigger ON STRIG GOSUB
number [, line number] . button of the joystick. 1000" 2000
STRIG (pointing device Enable an interrupt with STRIG (1) ON
number) ON a joystick.
Joystick number:
0 ......... space bar
1 .......... joystick 1
2 .......... joystick 2
STRIG (pointing device Disable an interrupt with STRIG (2) OFF
number) OFF a joystick.
STRIG (pointing device Hold an interrupt with a STIRG (0) STOP
number) STOP joystick.
ON STOP GOSUB line number Interrupt with the CTRL ON STOP GOSUB
and STOP keys. 1000
STOP ON Enable an interrupt with
the CTRL and STOP keys.
STOP OFF Disable an interrupt with
the CTRL and STOP keys.
STOP STOP Hold an interrupt with
the CTRL and STOP keys.
ON SPRITE GOSUB line Interrupt with an overlap ON SPRITE GOSUB
number of sprite patterns. 1000
SPRITE ON Enable an interrupt with
an overlap of sprite
patterns.
SPRITE OFF Disable an interrupt with
an overlap of sprite
patterns.
SPRITE STOP Hold an interrupt with an
overlap of sprite patterns.
ON I NTERVAl= interval time Interrupt after an interval. ON INTERVAl=120
GOSUB line number Time between interrupts GOSUB 1000
is the interval x 1/50
second.
INTERVAL ON Enable intervalled
interrupts.
INTERVAL OFF Disable interval led
i nterru pts.
INTERVAL STOP Hold interval led
interrupts. 16
COMMANDS FOR CONNECTED DEVICES
format function example
LPRINT [expression] Output data on the LPRINT A, B, C
[separator] [expression] printer.
[separator] [expression] ...
LPRINT USING format symbol; Output data on the LPRINT USING
expression [separater] printer in the specified "# # #"; A, B
[expression] [separater] ... format. (See PRINT
USING.)
LLiST [starting line number] Print program list on a LLiST 100-200
[ - ] [end line number] connected printer.
MOTOR {gFNF}l Turn the tape recorder MOTOR OFF
motor on or off. COMMANDS FOR INTERNAL CLOCK
format function example
SET DATE "DD/MMIYY" LA] Set the date on the SET DATE "05/10/85"
internal clock.
GET DATE D$ LA] Assign the current date GET DATE D$
to a variable.
SET TIME "HH:MM:SS" LA] Set the time on the SET TIME "14:05:00
internal clock.
GET TIME T$ LA] Assign the current time GET TIME T$
to a variable. COMMANDS FOR ERROR PROCESSING
format function example
ERROR error number Generate an error of the ERROR 3
specified error code. IF A>100 THEN
Define error codes. ERROR 250
ON ERROR GOTO line number Transfer control to the ON ERROR GOTO
specified line when an 1000
error occurs.
r 0 "I Return control to the RESUME 10
RESUME [1 line number j ] main program after
l NEXT J executing an error
processing routine. COMMANDS FOR MACHINE LANGUAGE SUBROUTINES
format function example
DEFUSR [integers] = starting Define the starting DEFUSR0=53248
address address of user
subroutine.
POKE address, expression Write data into memory. POKE &HA400, &HFF 17
COMMANDS FOR 1/0 PORT AND MEMORY
format function example
OUT port number, expression Output data to the 1/0 OUT &H90, 3
port.
WAIT port number, Hold program execution WAIT &H90, 255
expression 1 [, expression 2J until the input data form
the 1/0 port reaches a
certain value.
VPOKE address, expression Write one bit of data to VPOKE 263, 01
the video RAM. COMMANDS FOR EXTENDED COMMANDS
lormat function example
CALL subroutine name Transfer control to the CALL SUB
or machine language
- subroutine name subroutine, or transfer
CALL extended command control to an extended
[argument, argument ... J command of the ROM
or cartridge.
_extended command
[argument, argument ... J COMMAND FOR SHIFTING CONTROL TO MSX·DOS
: Convert to the integer type. (- 32768;::;X;::;32767) : Give cosine of X radians.
: Convert to the single precision type.
: Give the number of the line with an error. : Give the error code.
: Give e-.
: Give the integer part of X
: Give the maximum integer less than or equal to X : Give natural logarithm.
: Give random number.
:Give1 ifX>0,0ifX=0and -1 u x ce : Give sine of X radians.
: Give square root.
: Give tangent of X radians.
: Give N characters from the left of X$.
: Give N characters beginning with the Mth character
from the left of X$.
: Give N characters from the right of X$. : Give N spaces.
: Give N characters whose character code is J. : Give N times the first character of X$.
: Move the cursor to the Nth position.
: Give N spaces.
FUNCTION FOR CONVERSION BETWEEN NUMERICAL AND STRING TYPES
ASC (X$) BIN$ (X)
CHR$ (X) HEX$ (X)
INSTR ([N,] X$, Y$) LEN (X$)
OCT$ (X)
STR$ (X)
VAL (X$)
~ CVI, CVS, CVD
El MKI$, MKS$, MKD$
OTHER FUNCTION
PLAY (N)
: Give the character code of the first character of X$. : Give a binary expression of X as a strin-g type data. ( - 32768;::; X;::; 65535)
: Give a character whose character code is X.
: Give a hexadecimal expression of X as a string type
data. (- 32768;::; X;::; 65535)
: Give the position of Y$ after the Nth character of X$. : Give a number of characters of X$.
: Give an octal expression of X as a string type data.
( - 32768 ;::; X ;::; 65535)
: Convert to the string type.
: Convert to the numeric type.
: Change character string data in a random access file to numeric data.
: Change numeric data into string data to write in a random access file.
: Check if music is playing.
When N=1, 2 or 3 it gives -1 when music is playing; otherwise it gives 0. When N = 0, the status (- 1 or 0) of each music subcommand are ORed and the result is given.
19
: Give y-coordinate of the cursor. : Give x-coordinate of the cursor. : Give color code at point (X, V).
FUNCTIONS FOR DATA INPUT
From the screen CSRLlN
pas (X)
POINT (X, Y)
From data file
EOF (file number) : Give -1 when last data in file is read; otherwise give 0.
INPUT$ (N, [#] file number): Input and give N characters from the file.
~ LOF (file number) : Give the file length (bytes).
LaC (file number) : Give the current location in the file.
From the printer LPOS (X)
From memory FRE (0)
FRE ("")
PEEK (address) VARPTR (variable)
~ VARPTR
(# file number) VPEEK (address)
From the keyboard INKEY$
INPUT$ (X)
~ From the disk DSKF (drive number)
From 1/0 port
INP (port number)
: Give the position of the print head in the printer buffer.
: Give unused area in memory.
: Give unused part or string area.
: Give the memory contents of the address.
: Give the starting address of the memory area storing the variable.
: Give the first address of the file control block to which the specified file is assigned.
: Give the video RAM contents of the address.
: Give the character corresponding to the pressed key. : Input X characters from the keyboard.
: Give the space remaining in the disk in cluster units.
: Input data from the 1/0 port.
From machine language subroutine
( 01
USR ~ to ~ (X) : Give the value from the user subroutine.
l 9 J
From joystick, paddle or touch pad
STICK (N) : Give the direction of the joystick. (N = 0 for cursor move
keys)
(Center e e, Up=1, Right up c Z, Right=3, Right down e a, Down e S, Left down e B, Left=7, Left up=8)
: Give -1 when the joystick trigger button is pressed; otherwise, give 0. (N = 0 for the space bar)
: Input data from the paddle.
: Give status of the touch pad, light pen, mouse, or track
ball.
When N = 0 or 4: Give -1 if the touch pad is touched; otherwise, give 0.
When N =1 or 5: Give the x-coordinate of the position where the touch pad is touched.
When N=2 or 6: Give the y-coordinate of the position where the touch pad is touched.
When N=3 or 7: Give -1 if the touch pad switch is touched; otherwise, give 0.
N =8: -1 if light pen data is valid; 0 if invalid N =9: light pen X-coordinate
N=10: light pen.Ycoordinate
N =11: - 1 if light pen switch is pressed; 0 if not pressed N =12 or 16: request mouse or track ball input (-1 is always returned)
N =13 or 17: mouse or track ball X-coordinate N =14 or 18: mouse or track ball V-coordinate
STRIG (N)
POL (N) PAD (N)
20
N =15 or 19: 0 is always returned
COMMANDS FOR PROGRAMMING
COMMANDS AND STATEMENTS
format function example
AUTO [starting line number] Generate line numbers AUTO 100, 10
[, increment] automatically.
DELETE [line number] [-line Delete lines in a DELETE 30-60
number] program.
LIST [starting line number] Display program list. LIST
[ - ] [end line number]
NEW Erase program.
RENUM [new starting line Renumber lines. RENUM 100, 10, 10
number], [old starting line
number], [increment]
REM or' Insert a comment. REM---PROGRAM 1---
KEY LIST Display the function key
contents. COMMANDS FOR DEFINITION AND SETTING
format function example
CLEAR [size of character area] Initialize all variables and CLEAR 400, 55296
[, highest address] set the size of the
character string area and
the highest memory to be
used by BASIC.
DIM variable name (maximum Declare the name, type, DIM A$ (100)
value of a subscript size and dimension of
[, maximum value of a array.
subscri pt] ... ) [, variable name
( ),]
1'"T1 Define matching between DEFINT I-N
SNG the first character of a
DEF DBL J character variable name and the
STR type of variable. (I NT:
[ - character] [, character integer, SNG: single
[ - character]] . precision, DBL: double
precision, STR: string)
DEF FN function name Define user functions. DEF FNA (X)=A * X"
[(parameter [, parameter] ... )] 2+B*X+C
= expression
ERASE [array variable name] Erase arrays ERASE A, B, C
[, array variable name] .
KEY function key number, Define strings for KEY 1,
character string function keys. "LLlST"+CHR$ (13) 2
ERROR MESSAGES
: No FOR statement corresponding to NEXT
statement.
2 Syntax error : Syntax error in the statement.
3 RETURN without GOSUB : No GOSUB statement corresponding to RETURN
statement.
: No more data to be read.
: Illegal specification in function or command. : Too big or too small data.
: No more memory.
: Undefined line number was specified. : Array subscript outside defined range.
: Array in DIM statement was already specified. : Divided by zero.
: The command can not be used in direct command
mode.
13 Type mismatch : Data type mismatch.
14 Out of string space : No more string variable area.
15 String too long : String is too long.
16 String formula too complex: String is too complex.
17 Can't CONTINUE : Impossible to continue program execution.
18 Undefined user function : A function which is not defined by DEF FN
statement was used.
NEXT without FOR
4 Out of DATA
5 Illegal function call 6 Overflow
7 Out of memory
8 Undefined line number 9 Subscript out of range
10 Redimensioned array 11 Division by zero
12 Illegal direct
19 Device I/O error
20 Verify error
21 No RESUME
22 RESUME without error
23 Unprintable error
24 Missing operand
25 Line buffer overflow
50 ~ FIELD overflow
51 I nternal error
52 Bad file number
53 File not found
54 File already open
55 Input past end
56 Bad file name
57 Direct statement in file
58 Sequential I/O only
59 Fine not OPEN
60 ~ Bad FAT
61 Bad file mode
62 ~ Bad drive name
63 ~ Bad sector number
64 File still open
65 File already exists 66 ~ Disk full
[RAM] disk full 67 Too many files
68 ~ Disk write protected 69 ~ Disk I/O error
22
: Error in connected equipment.
: Program in cassette tape and program in memory differ.
: No RESUME statement that corresponds to ON ERROR statement.
: No ON ERROR statement that corresponds to
RESUME statement.
: An error without an error message has occurred. : Operand is missing.
: The entered program exceeds the buffer size. : The specified area of a FIELD statement has
exceeded the length of the record.
: Memory content or text is not normal. : Incorrect file number.
: The specified file does not exist. : The file is already open.
: Last data has been already read. : Incorrect file specification.
: Command in direct command mode was entered during file loading.
: When a GET statement or PUT statement is
attempted for a sequential file. : The file needs to be opened.
: The disk has not been formaited.
: Sequential file, random access file command or function mistake.
: Disk drive not in use was specified.
: Record specified in PUT or GET statement is 0 or larger than 32767.
: File has not been closed.
: New file name specified in a NAME, CALL MNAME
statement already exists.
: No more space on the disk.
: No space on the memory disk.
: The number of files has exceeded 255.
: Writing was performed on a write-protected disk.
: An error occurred which makes recovery impossible at the time of disk input or output.
70 B Disk offline [RAM] disk offline
71 B Rename across disk
: Disk drive is not connected.
: Memory disk use was attempted without executing CALL MEMINI.
: NAME statement was attempted between different disk drives.
COLOR CODE
code color code color
0 Transparent 8 Medium red
1 Black 9 Light red
2 Medium green 10 Dark yellow
3 Light green 11 Light yellow
4 Dark blue 12 Dark green
5 Light blue 13 Magenta
6 Dark red 14 Gray
7 Sky blue 15 White OPERATORS
/\ power
- change signs
*,1 multiplication, division
Arithmetic operators \ integral division
MOD integral residue
+,- addition, subtraction
(Priority increases from bottom to up)
Relational operators <>= comparison
NOT negation
AND logical product
Logical operators OR logical sum
XOR exclusive logical sum
EQV negation of exclusive logical sum
IMP implication 23