Sony MSX-BASIC Programming Reference Manual

Table of contents :
1 : Preface
2 : Table of Contents

Chapter 1 - Commands, functions, special variables and functions, and error messages

6 : 1-1 Commands and functions
134 : 1-2 Special variables and functions
141 : 1-3 Error messages

Chapter 2 - MSX-BASIC utilization

146 : 2-1 Operation mode
147 : 2-2 Full screen editor
149 : 2-3 Special keys
150 : 2-4 Screen configuration and graphics
162 : 2-5 Sound
168 : 2-6 File processing
176 : 2-7 Interrupts
182 : 2-8 Machine language subroutines

Chapter 3 - Tables

186 : 1. Characters
186 Characters handled by MSX-BASIC
189 : 2. Constants and variables
189 Constants
190 Variables
192 : 3. Expressions and their operation
192 Parts of expressions
192 Evaluation of arithmetic expressions
192 Relational expressions
193 Logical expressions
193 Character expressions
194 : 4. Color codes
194 : 5. Memory map
195 User area configuration
196 : 6. I/O port allocation

Citation preview

BONY.

H IT BiT

• • • • • • • • • • • • • • • • •

• • • •







• •



• • •





P R E FAC E

The u t i l izat ion of each M SX-BASIC comm and and f u nction is exp l ai ned i n this man ua l. A lso, ad d i t ional exp l anations that cover several g roups of com m ands are provi ded in a sep arate chapter with act ual examp l es. P lease use this manua l to l earn M SX-BAS IC or for actual M SX-BAS IC pro gra m m i n g . Th is manual i s i ntended for use w i th Sony M SX system on l y.







• •



• •



11

..



TA B L E O F C O N T E N TS

• C h a pter 1 Comma nds, fu nctions, special variables a n d fu nctions, a n d error messages

Com m ands and functions A BS ASC ATN AUTO BEEP B IN$ B LOAD BSAVE CALL C D BL C H R$ CINT . Ci RC LE CLEAR C LOA D C LOA D? C LOSE C LS COLOR CONT COS CSNG CSAVE . CSR LlN DATA . . D E F FN 1·1

6 8 8 9 10 11 11 12 13 14 14 15 15 16 17 18 18 . 19 19 20 21 21 22 22 23 24 25

. . . . . . . ........................

.............................. ................. ........ .. ............... ......................

........................ . . . . . . . . . . . . . . . . . ......

........... . .. .............................

...... .............. . . . . . . . ................

............ . . . . ............................

........................................

. . . . . . . . . . . . .. . . .. . . . . . . . . . . . . . . . . . . . . . .

.............. ...... . . . .. . . . . . . . . . ......... . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .

..........................................

.......

. .......... ........................

.......................................

.......... ............

.................

. . . .....................................

......................................

. . . ..................... ....... ......

..

............................................. . . .....................................

ERL ERR ERROR EXP FIX FOR-N EXT FRE GOSU B - R ETU RN GOTO H EX$ . . I F-TH EN - E LS E.. I N K EY$ .. ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . INP . I N P UT I N P UT$ I N P UT # INSTR I NT . ON INTERVA L ................. ......... ....................................

............. ..................... ........ ...

.......................................

.............................................

. .............................................

. . . ...........................

....... ......................................

....................

.......... ................................

. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . .

......................

......................................... ........ ...............

... .............

..................... .................

[fir}

.............

..........

..................

......................................

DEF

D E FUS R D E LETE DIM D RAW EOF EN D ERASE

...............................

.......................................

{�;�p}

.............................. ........

.........................................

.........

.....

................ ..............

.....................................

.

.............................

.........................

.

..................

............................................ ........................ . . . . . ...........

27 28 29 30 35 36 37

37 38 39 40 40 41 43 44 46 46 47 49 49 50 51 52 53 54

• • • • • • • •

54



KEY 55 KEY L l ST.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56



.............................................

K EY

{g� F}

KEYlo)

{�;6p }

..............................

57



.......................

57



58 59 60 61 62 63 64 65 65 66



LE FT$ LEN L ET LINE LINE INPUT LINE I N P UH LIST LLlST LOA D LOCATE

........................

.

................

.............................................

.............. ...........................

..

....... ................

......................... ....................

......................................

...............

26

.......

............................. ............

..........................................

........................... . ................

. .

. . . . ................



............................ .... ............ ............................... ................... .........

............................................ ..........................................

.......................................... ...... ................................

• • • • 11

• • • • • • • • • • • •

LOG LPOS LPR I NT L P R I N T USi N G M ERGE M I D$ M I D$ =Y$ M OTO R N EW OCT$ O N ERROR GOTO ON - G O S U B O N - G OTO ON I N T E RVAL GOSU B O N KEY GOS' U B ON S P R I T E GOS U B ON STO P G OSU B ON ST R I G G OS UB OPEN OUT PAD PA I NT POL P E EK P LAY P LAY (funct i on) PO I N T POKE POS P R ES ET PRINT P R I N T USi N G PRI NT # P R I NT # U S I N G PSET PUT S P R ITE READ REM RENUM R ESTO R E R ES U M E R I GHT$ RND RUN

67 67 68 68 69 70 71 72 72 73 74 75 76 77 78 79 80 81 82 83 83 84 86 86 87 91 92 93 93 94 94 96 99 1 00 100 10 1 103 104 105 106 107 1 08 1 08 110

.............. ...............................

..........................................

.......................................

............. . . . . . . .......

.......................................

........... ................................

. ...................................

• • • • • • • •

........... ..............................

........... ................................

. . . . . ................

.............................

......... .......................

..........................................

....... . . . . . . . . . . . . . . . . . . . . ..........

S P R IT E SO R STI CK STO P

...................

........... .... ...........................

............................................

. .. . . . . . .. . . . . . . . . . ..........................

..................... ....................

.............................................

..........................................

...........................................

. . . ......................................

.................. ........................

.... ...... ..................................

......................................

........... ..............................

............................

...................................... .......................

......................................... .............................

........................................

.......................................... ..................................... .................................

...................................

.....................................

.......................................... . . .........................................

....................

......................... . . . ...............

{�;6p} m6p}

.......................................

................. ................. . . . . . . .

STO P

. . . . . . . ..........

.......... ...........

{�;6p

.....................................

.................................. .........

. . . . . . . . . . . . .

........... ............

. . . . . . ........ .......... . . . . . . . . . . .

........................ . . . . . . . . . . ..........

.......................................

...........................................

....... . .................



SAV E SCR E E N SGN SIN SOU N D S PACE$ SPC

ST R I G STR I G

111 112 1 14 1 15 116 1 18 1 18 1 19 1 19 1 20 121 121

.......................................

1 22

........ ..............

123

STR$ ST R I N G$ SWA P TA B TA N TROFF TRON USR VA L VA R PT R V P EEK V POKE WA I T W I DTH

......................................... ......... .........................

.................................... . . . .

........................................... ............... .............. .............. ............... . ......................

........................................

...........................................

. . .......................................... ........... . . . . .....................

......................................

......... .............................

......................................... ......................................

1 24 1 25 1 26 126 1 27 1 28 1 28 129 130 131 1 32 1 32 1 33 1 33

1 ·2 Spec i al variables and

functions BAS E M AXF I LES S P R I T E$ TI M E VDP

...........................

......................................... ................................

................ ...................

.........................................

...........................................

1 ·3 Error messages

................

134 134 1 36 1 37 137 1 38 141

/

..

..

• •

Cbapter 2 M SX·BASI C u t i l ization 2·1 2·2 2-3 2-4 2-5 2-6 2-7 2-8

Operati o n mode Fu l l screen editor Special keys Screen conf i g urat i o n and graph i c s Sound File proces s i n g I n terr u pts M ac h i n e la ng uage s u b ro u t i nes

. . . . . . ..................... .......... .............................................. . . . . .. . . . . . . . . . . . . . .. ...........................................................

. . . . . . . . . . . . . .. . . . . . . . ................................................................... . . . . . . . ...... .....................................

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... . . . . . . . . . . .. . .. . . . . . . . . . . . . . . . ................................... . . . . . . ..............................................................................

................ ..............................................................................

....................... . . . . . . . . . . . . . ....................

146 1 47 1 49 1 50 162 168 176 182

C hapter 3 Ta bles 1. Characte rs

. . . . . . . . . . . . .............................................. . . ..................................

Characters handled by M SX-BAS I C 2. Constants and variables

. . . . . . . . . . . . . . . . . . ..... . . . . . . . . . ....... .............

. . . . . . . . . . . . . . . . . . . . . . . . . . ............................................

Constants Variables Expressions and t he i r operat i o n Parts of ex pressions Eval uat i o n of ari t h m e t i c ex pres s i o n s R e l at i o n a l ex p res s i o n s Log i cal ex press i o n s Character expressions Color codes Memory map User area conf i g urat i o n 1/0 port a l locat i o n

. . . . . . . . . . . . . . . .......... . . . . . . . ...............................................................

....................................................................... . . . . . . . . . . . . . .............

3.

........................................................

.... . . . ..................................... ................................. ............ ....................................

.................................... . . .............. .....................

. ........................................... . . . . ............... ............... ..........................................................................

4. 5.

.................. ...... ........................... . . . . . ........ ............................ ...... ..................................... . . . . . . . .. . . ........... ......................... .......................................................................

6.

........................................... . .....................................

186 186 189 189 190 192 192 192 192 1 93 1 93 194 1 94 195 196

• • • • • • • • • • • • • • • • • • •









• •





• •

I

I I I

I

I I

I

I � , I

I

1 CHAPTER 11

COMMANDS, FUNCTIONS, SPECIAL VARIABLES . AND FUN>CTIONS, AND ERROR MESSAGES

..

1 ·1 C O M M A N DS A N D F U N CT I O N S

• •

In t h i s chapter, M SX-BAS I C com mands and functions are ex p l ained in an a l p habetical seq uence.

• •

I N T R O D U CTORY R E M A R KS

�com mand, function name � (point set)

• • • •

FO R M AT

j'-::-: (X-=[ S=T=E=P-=-) -::: S = P ::-: T =-= E: =-

Form at � =

:ina-:-t

o -::-1 r 11

X-coord i nate, Y-coord i nate «!mm)

N u merica l con stants, vari a b l es, array vari a b l es and t h e i r expres s i o n s from - 32768 to 32767.

Color «!mm) I ntegers f rom 0 to 15.

I!llmI C u rre n t foregro u n d co l o r

'-----I n pu t

con dition

W h e n i n p u t i s omitted

F U N CT I O N A N D UTI L I ZATI O N

S u p p l e m entary c o mmand and f unction ex p l anati ons, and exec u­ tion exa m ples in w h i c h commands and functions are u t i l ized.

• • • • • • • • • • • • •

• • • •

i s wri tten in front of t he f unction

In regard to a function, name. (exa m p le)



'i"Mm ABS (a bsol ute)



An input item inside [



I Example I

• • • • • • • •

I n put item om ission

] in the FO R M AT sect ion can be om itted.

For S C R E E N [M ode], [Sprite s i ze] , [Key c l i c k switch], [Baud rate], [Printer type], when only the mode and s pr i te si ze are specified, i t is as fo l l ows. SCREEN 2 , 3

� Items after this, including commas, can be omitted.

W h en on ly the printer type is spec ified, i t i s as fo l l ows. SCR EEN

" , ---IL----Co mmas cannot be omitted. ,1

I nput item repetition

I Examp l e I

DATA Constant [, Constant] . . . . . As m any constants as d es ired can b e repeated after DATA w i t h in t he in­ p u t range per line.

• • • • • •

..



""MD ABS (abso l u te)



G i ves the absol ute val u e for n u meri c d ata.

• •

FO R M AT

A BS(X)

X C!llm!) N u m b e r i c constants, variables, array vari a b l es, and t h e i r e x p res­ s i ons. Given value: N u me r i c type

• • •

F U N CT I O N A N D U T I L I ZATI O N

G ives X when X



0 and -X when X < o.

• •

Execution exa mple P R I N T ABS(2)



2 PRINT ABS(3-10)



7



ASC (as c i i ) G ives the ch aracter c o d e for t h e f irst character of str i n g d ata.

• •

FO R M AT

ASC(X$)

X$ C!llm!) S t r i n g con stants, var i a b l es, array variables, and t h e i r expres­ si ons. G iven val ue : S i n g l e- p rec i s i o n i n teg ers, deci m a l expressi o n s .

• • •

F U N CT I O N A N D UTI L IZAT I O N

Execution example PRINT ASC("d")

100

..

PRINT ASC("data")

100

Character code of "d". Character code of "d".

• • • •

• • •

ATN

(arc tangent)

G i ves th e arc tangent va l ue for n u meric d ata.

• • • • • • •

FO R M AT

ATN (X) X C!mmB N u m eric constants, varia b l es, array vari ables, and t h e i r expres· sions. Given v a l u e : N u me r i c type

F U N CT I O N A N D UTI L I ZATI O N

The ATN f u n c t i o n g ives a f l oati ng-point t y p e n u m er i c val u e w h i c h i n d i · cates a n a n g l e i n w h i c h t h e va l u e o f t h e tri g onometr i c func t i on , t a n , i s X. I ts unit i s a rad i a n . eTa o btain the resu l t i n d egree units, m u lt i p l y by 1 8017r. Execution example



PR INT ATN Cl) .785398 1 6339745

Unit is radians.



PR INT ATN ( 1 ) * 1 80/3 . 1 4159 45 . 000038009905

Unit is degrees.

• • • • • • • • •

..

• •

_ AUTO L ine n u m bers are automat i c a l l y g enerated from a specified l ine n u m ber w i t h a spec i f ied increm ent.

• • •

FO R M AT

AUTO [starting l ine n u m be r] [, increm ent] Start i n g l ine n u m ber Increment

ca:J An integer f ro m 0 to 65529. (!lil1lJ O. H owever if ", in c re m e n t " cm:J I ntegers f ro m 1 to 65529. (!lil1lJ 10.



is om itted , it is 10.

• •

F U N CT I ON A N D UTI L I ZATI O N

Used t o e l i m inate t h e keying i n of l ine n u m bers wh i l e entering a p rogram. e When a p rogram statement ex i sts for a g enerated l ine n u m ber, " * " ap­ pears on th e right of t h e l ine n u m ber. To mod ify this p rogram statement, move the cursor to " * ttien input a new state m ent after d e l et ing " * w i t h a space. When no mod i f i cat i on i s req u ired, p ress 1 RETURN I. e To stop automat i c l ine n u m ber generat ion, press 1 STOP 1 w h i l e press­ ing ICTRL 1 or press � w h i l e press ing ICTRL I. ",

Execution exa m p l e AUTO 1 00 , 5 0

1 00 PR I N T - 1 2345 " 150*

I'----- Indicates that line number 150 exists.

"

• • • • • • • • • • • • •

• • •

_ B E EP (beep) A beep sound occurs.

• • • • • • •

FO R M AT

BEEP FU N CT I O N A N D UTI L I ZAT I O N

Execution example 10 FOR

ro 9

T h i s program generates a beep so un d 1 0 t i mes cont i nuously.

• •

1=0

20 BEEP 30 NEXT I

B I N $ (bi n ary d o l l ar) G i ves a b i n ary expression of n u meric d ata as str i n g type data.

• • • •

FO R M AT

B I N$(X)

X @lmlI N u m e r i c con stants, vari a b l es, array vari a b l es, and t h e i r exp res­ s i ons from 32768 to 65535. For a n eg at ive n u m ber, i t has t h e same va l u e as if its val u e was added to 65536. G i ve n Val u e : S t r i n g type -



F U N CT I O N A N D UTI L I ZAT I O N



Execution exa m p l e

• • •

PR I N T B I N$ ( l O O ) 1100100 PR I NT B IN$ ( -32768 ) 1 000000000000000

..



_ B LOAD (b inary load)

Loads a mach ine l an g u age p rogra m , o r loads and executes it.

• • •

FO R M AT

B LOAD "device name [f i l e name]" [ , R) [, offset)

Device n a m e @lm!) CAS: ... Cassette tape F i l e name cmB String within 6 characters. If 7 or more characters are

R option Offset

r!limJ r!limJ cmB (!limJ

specified, the 7th character and after are ignored. Loads the file which was found first. Load only. Integers from - 32768 to 65535. 0

F U N CT I O N AN D U T I L I ZAT I O N

Loads a mach ine l ang u age program saved b y a BSAV E statement a t an address between th e start i n g address and an end address specified by a BSAVE statement. If o ffset is s pecified, the value is added to the start­ ing address and end address. e lf ", R" i s specified, the program i s executed after load term inat i on. At t h at t i me, the execution start adGress is an address specified by a BSAV E statem ent.

• • • • • • • • • • • • • • • • •

• • •

_ BSAVE (binary save)

Saves th e content w i t h in a s pecified memory range with binary.

• • • • • • • • • • • •

FO R M AT

BSAVE "device name [fi l e name]", start i n g address, end address [, exe­ cuti on start address] Device name � CAS: ... Cassette tape File n a me � String within 6 characters. If 7 or more characters are specified, the seventh character and after are ignored. (!limJ N u l l string.

Starting address, end address t!mmI Integers from Execution start address � Integers from

-

32768 to 65535.

32768 to 65535. (!limJ Considered as a starting address. -

F U N CT I O N A N D UTI L I ZAT I O N

Saves th e content w i t h i n a memory range fro m a start i n g address to an e n d address with binary code w h i c h i s used for sav ing m ac h i n e l a n g u age. elf an exec u tion start address i s s pe c i fi ed, exec ut ion starts from t he ad­ dress s pecified when t h e mac h i n e l ang uage p rogram was loaded by a B LOAD statement with an R option. If om i tted, t h e starting address i s considered as an exec u t i o n start address. Execution exam p l e BSAVE "CAS:PROG4",&HEOOO,&HEBOO,&HEIOO

• • • • • •

..



_ CAL L (ca l l )

Executes an extended command o f a R O M cartr i d g e.

• • •

FO R M AT A N D F U N CT I O N

CALL extended c o m m a n d [(arg u m ent, arg u m ent . . . )]

Argument l!mil!J Integer constants, variables, array variables, and their expres­ sions. Character constants, variables, array variables, and their expressions.

When an extended com mand i s provided by a R OM cartri d g e, it can be executed by a CAL L statement. e_ ( under l ine) can be u t i l ized instead of a ch aracter CA LL.

• • • • •

C D B L (convert to d o u b l e pre c i s i on) Converts nu m er i c data to d o u b l e pre c i s i on d ata.

FO R M AT

C D BL(X)

X l!mil!J Numeric constants, variables, array variables, or their expres­ sions. Given value: Double precision numeric type

F U N CT I O N A N D U T I L I ZATI O N

G iven n u merical data i s i nternal l y treated as d o u b l e prec is ion data b y the C D B L funct ion.

• • • • • • • • • •

-

• •

, • •

• • • • • • •

• •





• • •

• •





r

"",Git.U' C H R$ (c h aracter d o l l ar)

G i ves the ch aracter of a specified character code.

FO R M AT

CHR$(X) X � Numeric constants, variables, array variables, and their expres· sions from 0 to 255. Given value: String type

F U N CT I O N A N D UTI L I ZAT I O N

Execution exa mple PRINT CHR $(lOO) d

See the character code table (page 186).

C I NT (convert to integer) Converts n u m er i c d ata to integer type d ata.

FO R M AT

C I N T(X)

-

X � Numerical constants, variables, array variables, and their expres­ sions from 32768 and less than 32768. Given value: Integer type

F U N CT I O N A N D UTI L I ZATI O N

W hen n u meric data X i s an integer val u e, i t i s m aintained as i t i s. W hen it i s a f l oating pOint type val ue, it is converted to an integer value by o m i t­ t ing val ues below the decimal pOint. I t d i ffers from t he I N T f unct i on in t h at the I N T f unction g ives t h e wh o l e n u m ber o u t of X w h i l e CINT con­ verts X to an integer in w h i c h the internal processing is d i fferent. Execut ion exa m p l e PR INT C INT (9/ 2 )

4 PR INT C INT ( 1 2*200 * 5 5 ) O verflow

, • •

C I RC L E (c i rc le) D raws a c i rc l e, ova l , a part of a c i rc u l ar arc or a fan shape on t he fore­ g ro u n d i n t h e g ra p h i c mode.

FO R M AT

C I RCLE [STEP] (central coord i n ate), rad i u s, [co l o r], [start an g le], [end a n g l e] , [aspect rat io]

-

Central X·coord i nate, central Y·coord i n ate cmJ Numerical constants, variables, array variables, their ex· Radius

cmJ

C!mm) tillmJ Start angle (DJ (!ljMJ (DJ End a ngle (!ljMJ Aspect ratio (DJ Color

(!ljMJ

pressions from 32768 to 32767. Numerical constants, variables, array variables, their ex· pressions from 32768 to 32767. Integers from 0 to 1 5 . Current foreground color From 211" to 211" (unit is radians). 0 From 211" to 211" (unit is radians). 211" Positive numerical constants, variables, array variables, their expressions. 1

-

F U N CT I O N A N D UTI L I ZAT I O N

D raws a c i rc l e w i t h a s pecified rad i u s and w i t h spec i f i ed coord i n ates a s its center. W h e n a start a n g l e a n d e n d a n g l e are specified, o n l y a part o f a c i rcul ar a rc i s drawn . A f a n s h a p e can be d rawn by p l a c i n g - (m i n u s) for t h e start a ng l e and e n d ang l e. A n oval can be drawn w i t h an aspect rat io by spec ifyi n g the power of the vert ical rad i u s for the horizontal rad ius. _See page 1 54 for STE P s pe c i ficat i o n s. Execution exa m p l e

10 20 30 40 50

..

CLS SCR EEN 2 C IR CLE ( 5 0 , 5 0 ) , 30 " , , 4 C IR CLE STEP (70,70) ,30" , , . 25 GOTO 5 0



• •

• • •

• • • •









• • •



,

• •



f\



� _J�



• •



• •



• •

_

I I

_ ,

: 70

et==> I

(50,50)

I Note I

If t h e aspect rat io i s om itted, an oval is d raw n . To display a circle, specify

1.4 as the aspect ratio.

C L EA R (c l ear) I n i t i a l izes a l l variables and sets t h e size of the c h aracter area and t he h i g hest memory address u s e d i n BAS I C. A l so, c l oses a l l ope n f i les, if any.

FO R M AT

CLEAR [s ize of ch aracter area] [, h i g hest add ress]



Size of cha racter a rea � N u m e r i c c o n stants, vari a b l es, array variables,



Highest address





t h e i r expres s i o ns.

I!lmIJ C u rre n t set va l u e ( i n i t i al state i s 200). H owever, t h e c h a racter area size can n ot be i n depe n dent· I y om itted. C!I!m!) N u m er i c a l c o n st a n ts, vari a b l e s , array varia· bles, t h e i r express i o n s. I!lmIJ C u rrent set value.



F U N CT I O N A N D UTI L I ZATI O N

• •

A l l variables are i n it i a l ized by t h i s statement. A l so, the size of the charac­ ter stri ng area is set to 400 bytes and t h e h i g hest address of t he BAS I C p ro g ram area is set t o 55296.



Execution example

CLEAR 400 , 5 5 296

..

• •

_ C LOA D (cassette load)



Loads an M SX-BAS I C p ro g ram f rom cassette tape.



FO R M AT

C LOA D ["fi l e name"]

File name «mJ Stri n g w i t h i n 6 c haracters. If 7 or m o re c haracters are spec i · f i ed , t h e seven t h c h arac t e r a n d a f t e r a re i g n o red.

(!liiHJ Loads the f i rs t program f i l e f o u n d .

CLOAD "PR O G 1 "

___ cassette Loads the program with the file name tape to memory

PROG1

from

. W hen an erro r occurs d u r i n g load, rew i n d t h e tape to reload i t .

_ C LOAD? (cassette l o ad verify)

Compares a p rogram saved on cassette tape with one i n memory.

FO R M AT

C LOAD? ["fi l e name"]

F i l e name «mJ S t r i n g w i t h i n 6 c h aracte rs. If 7 o r m o re c h aracters are spe c i ­ f i e d , t h e seve n t h c h a racter and a f t e r a r e i g n o red. (!liiHJ Compares t h e f i rst pro g ram f i le f o u n d w i t h o n e i n m e m o ry.

F U N CT I O N A N D U T I L IZAT I O N

A c o m m a n d that checks i f a p ro g ram i s correctly s aved o r n o t . When i t i s exec uted, th e p ro g ram i n memory i s com p ared w i t h a p rog ram saved o n cassette tape w i t h a specified f i l e name . • After comparison shows t h at t h e p ro g rams matc h , O K i s d is p l ayed and i n p u t wait occ u rs. When t h ey do not matc h , "Device I/O error" i s d i s­ p l ayed and i n p u t wait o c c u rs . • I f th e f i l e name i s om i tted o r C LOAD? "u" i s i n p u t , t he f i rst p ro g ram f i l e found o n a tape is com pared with t h e p ro g ram in memory. ( L.J means a s pace.)

..

Executi on example CLOAD ? "PR O G 1 "

• •

F U N CT I O N A N D U T I L I ZATI O N

Executi on example

• •

• • •

• •

• • •

• •







• •





• •

• •

• •



• • • •



• •

_ C LOSE (close)

C loses a f i l e w h i c h was opened by an O P E N statement.

FO R M AT

C LOS E [ # ] [f i l e n u m ber] [, f i l e n u m ber] . . . . . F i l e n umber (DJ 1 ;§file n umber� n umeral spe c i fied b y M AX F I LES = state­ ment (!limJ C l oses a l l t h e fi les.

F U N CT I O N A N D U T I L I ZAT I O N

Execution example 1 0 MAXF I L ES=3 2 0 S CR EEN 2 30 OPEN " G R P : " FOR OUTPUT AS # l -- Opens 40 OPEN "GRP : " FOR OUTPUT AS #2- 0pens 5 0 OPEN " GR P:" FOR OUTPUT AS #3 - 0pens 60 PR I N T # 1 , " ABC70 PR I N T #2 , "DEF" 80 PR I N T #3 , - GH I " Closes 1 0 0 CLO S E

1

file file 2 file 3

all the files.

_ C LS (clear screen)

E rases all d i sp lays o n t h e scree n .

FO R M AT

ClS . I n the g ra p h i c mode, t h e back g ro u n d color is c hanged by exec u t i n g ClS after spec i f y i n g i t w i t h a COlOR statement.

• • •

..





_ CalO R (color) Specifies t h e color of t h e fo reg ro u n d , bac k g ro u n d , and border area.



FO R M AT



COlOR [fore g ro u n d color] , [backg round c o l o r], [border color] Foreground color, background color, border color (gJ I n tegers f rom 0 to 15. (See the c o l o r table b e l ow.)

(!]iMJ C u rrent c o l o r

C ol o r c ode table Code

Color

Code

Color

Code

Color

Code

Color

0

Tra n spare n t B l ack M e d i u m g reen L i g h t g reen

4 5 6 7

D ark blue Light blue Dark red Sky b l u e

8 9 10 11

M ed i u m red L i g h t red Dark ye l low L i g h t y e l l ow

12 13 14 15

D a rk g reen Magenta G ray W h i te

1 2 3

F U N CT I O N A N D UTI LIZAT I O N

Executi on example

Only the foreground calor (character calor in text rnode, and graphics calor in graphic mode) is changed. --- Only the background calor is changed.

COlOR

6

COlOR

,2

COL OR

" ll--- Only the border area calor is changed.

C OlOR

15 , 4 ,4 ---- Initialized.

___

e See page 150 for t h e sc reen config u ration. eln the g ra p h i c mode, t h e backg ro u n d color i s not chan ged by o n l y specify i n g t h e bac kg ro u nd c o l o r wit h a COlO R statement but i s changed only after exec u t i ng ClS.





• •







• •





• • • • •



• •

_CO NT (co n t i n ue)



Restarts a p rogram.

• • • • • • • •

FO R M AT

CONT F U N CT I O N A N D UTI L I ZATI O N

Restarts a p rogram t h at was i nterru pted b y I CTRL I + I STOP I o r by a STO P statement i n a program. When a CONT statement i s executed , exe· c u t i o n starts from t he statemen t next to t he i n terrupted statement. However, i f a n i n terrupt occu rred d u r i n g t he exec ut ion of an I N PUT state­ ment, exec u tion starts from the beg i n n i ng of t he statemen t .

'i"'wm COS (co s i ne)

G ives the value of the cos i ne for n u meric d ata.

• • • • •

FO R M AT

COS(X) X � N umer i c type con stants, vari a b l es, array variables, t h e i r expres· s i o n s. (U n i t is rad i a n s.) Given va l u e: F loat i n g-po i n t type con stants from -1 to 1 .

FU N CT I O N A N D U T I L I ZAT I O N

Executi on example



PR I N T



PR INT

• • •

COS (3.14/3) .5 0045968900814 COS (60*3. 14/180) .5 0045 9689 00814

e To g ive X i n deg ree u n its, u se t he form u l a COS (X

*

17"/180).

El

• CSN G

(convert to s i n g l e p recision)

Converts n u meric data to s i n g l e p re c i s i o n d ata.

• • •

FO R M AT



CSN G(X) x C!mmI N u me r i c type con stants, variables, array variables, t h e i r ex p res·

s i ons. Given va l ue : S i n g l e· p re ci si o n type.

• •

F U N CT I O N A N D UTI L I ZATI O N

Execution example 1 0 PR I N T SQR ( 3 ) 2 0 PR I N T CSNG (SQR ( 3 ) ) RUN 1 .7 3 2 0 5 08 0 7 5 688 1 . 73205

• •

• •

Saves an M SX-BAS I C p ro g ram f i l e on cassette tape.



FO R M AT



_ C SAVE (cassette save)

CSAV E "fi l e name" [, baud rate] File n a me caB Stri n g w i t h i n 6 c h a racters. If 7 or more c haracters are Baud rate

s pe c ified, t h e seventh c h a racter and after are i g n o red. C!mmI 1 (1 200 baud) o r 2 (2400 baud). (!]lMJ 1 (1 200 baud)

F U N CT I O N A N D U T I L I ZATI O N

A l t h o u g h u p t o 6 c h aracters c a n b e used for a f i l e name, a n u m e ral can not be used at th e beg i n n i ng . As for t h e baud rate, when 1 i s specified, t h e baud rate i s 1 200 baud, and wh e n 2 i s s pe c i fied, i t i s 2400 baud. Executi on example CSAVE " PR O G 1 "

___

Saves a BASIC program in memory to cassette tape with a file name "PROG1".



• • • •

• •



• • •

'ilj,M'. C S R L I N

(cursor l i ne)

G ives th e Y-coordi nate of the c u rsor locat i o n .

• • • • • • •

• •

FO R M AT

CSR L l N F U N CT I O N A N D UTI L IZAT I O N

Executi on example 10 20 30 40 50

CLS I NPUT A$ PR I N T A$ ; CL=CS R L I N L OCATE 0 , CLt3 : PR I NT - EN D -

The ch aracter data d i s p l ayed by l i n e 30 occupies only on e l i ne or p l u ral l i nes depen d i n g its l e ng t h. H owever, the Y-coord i n ate (vert ical location) of the c u rsor after d i s p l ay i s i n p u t to variable CL and " E N D" i s d i s played w i t h a val ue which is g reater than CL by 3 as t h e Y-coord i n ate. Therefore " E N D" i s d i s p l ayed 3-l i n es below n otwithsta n d i n g t he A$ data l e n g t h .

• • • • • • • • •

..

_ DATA (data) r��� G i ves data read by a REA D statement.

FO R M AT DATA constant [, constant] Consta nt � N u me r i c o r s t r i n g type.

.

....

F U N CT I O N A N D UTI L I ZATI O N

e Wh en data items are arranged i n o n e DATA statement, t hey are punctu­ ated by a comma ( , ) . e l f data in a DATA state ment sequen t i a l l y matches variables i n a REA D statement, it can be located anyw h e re for a R EAD statement and as many DATA statements as d e s i red can be u t i l ized. e When string type data i n c l u des a comma ( , ) or colon ( :), or when a s pace i s i n serted i n f ront and at t h e back, it i s p l aced i n si de d o u b l e q uo­ tat i o n marks ( ) "

.

Execution example 10 20 30 40 50 60

CLS SCR EEN 2 R EAD A , B , C , D L I N E ( A , B) - (C , D ) DATA 0 , 0 , 2 5 5 , 1 91 GOTO 60

• •



• •



• • •











• •

• •

-







• •

• •

• •

• •





• •

• •







• •

• •

_ D E F F N (define functiOn) �"-"�7!0�••� Defines a user function.

FO R M AT DEF FN function name [(parameter [, parameter] ..... )]=expression Function n a m e C!l!m!) N u m er i c type, s t ring type varia b l es (Type is i n accord w i t h t h e expressio n . )

Parameter Expression

C!l!m!) U p t o 9 variables. � N u me ric type, s t r i n g type c o nstants, variables, array varia b l es, t h eir expre s s i o n s.

F U N CT I O N A N D UTI L I ZATI O N

Execution example 10 DEF FNA ( X , y ) = t X*2+Y*3) / ( X-Y) 20 B=FNA ( 4 , 2 ) 30 PR IN T B R UN 7

In line 10, the function FNA(X,Y) is defined as the following expression. In line 20, 4 and 2 are given as values for the X and Y parameter, then the function is called. The result, 7, is assigned to variable B.

• D E F I NT D E FS N G DEFDBL D E FST R



(define integer)



(define single precision) (define double precision) (define string)

Defines the correspondence of the first character of the variable name and the variable type. (INT: Integer type, SNG: Single precision, DBL: Double precision, STR: String type.)







• FO R M AT

DEFINT DEFSNG DEFDBL DEFSTR

character character character character



[-character] [-character] [-character] [-character]

• •

Character � One a l ph abet i c a l c h a racter.



F U N CT I O N A N D UTI L I ZATI O N DEF I NT A-C

As a result, all the variables, starting with characters A, Band C, are in­ teger type. Pri ority of type decla rati on characters (%, !, #, $) After declaring DEFINT A, A becomes a double-precision variable by declaring A # later.

• •



Executi on example

���;i�� ��� �� 89 } �g 40 B#= l _ 2 3 4 5 6 7 89 1 0 DEF I N T A-C



A to C are integer type. - Variables A, ABC become integer type by line 10. Variables from

Double-precision type by placing 5 0 C ! = 1 _ 2345 6789 -- Single·precision type by placing! 60 PRINT A;ABC ; B#;C ! RUN 1 1 1 _ 2 3 4 5 6789 1_ 23457 --

#

• • •



• •

• •





• •

• • •

• • •





• • •



• •



_ D E FU S R

(define user)

Specifies a starting address of a machine language subroutine to be called by a USR function.

FO R M AT

DEFUSR [X]=starting address X � I n tegers from 0 to 9. (!llMJ 0

Start i n g address � N umeric type c o n stants, vari a b l es, t h e i r ex p res­ s i o n s f rom 0 to 65535.

F U N CT I O N A N D UTI L I ZATI O N

Executi on example DEFUSRl=&HEOOO

As a result, a machine language subroutine which starts from address &H EOOO is defined as USR1. .The starting address can be redefined as many times as required in one program without changing the value of user number (X). (See 2-8, Machine Language Subroutines.)

_ D E L ET E (delete)

Erases a specified line in a program.

FO R M AT

DE LETE [line number) [·Iine number)

Line n u mber @lm!) Intege rs from 0 to 65529.

F U N CT I O N A N D UTI L I ZAT I O N

Execution example DEL ETE 40

-----

DEL ETE 20-40

---

Erases line 40 Erases lines from 20 to 40.

Erases lines from the starting line to line 50. ______ Erases a line displayed last by a LIST statement or DELETE . a line that was interrupted due to an error.

DELETE -50

• When

----

only one line is to be erased, input the 'Iine number only and

press 1 RETURN I.

• • • •

• • • •



• •

• •

• •

• • •





























_ D I M (dimension)

Declares the name of an array variable, data type, size and dimension.

FO R M AT

DI M variable name (maximum value of a subscript [, maximum value of a subscript] ...) [, variable name ( ) , ....] Va riable C!miIlJ N u me r i c or s t r i n g type. M a x i m u m value of a su bscript

C!miIlJ I nt e g e r type c o n stants, vari a b l es, array va r i a b l es, and t h e i r ex­ pre s s i o n s ove r O.

F U N CT I O N A N D UTI L I ZATI O N

Executi on example

Sets up an area of 16 numeric type array variables from A(O) to A(15) in memory. The initial value of variables is O. up an area of 12 variables as shown below (string type). Sets _ B$ ( 2 , 3 ) The initial value of variables is a null-string.

DIM A ( 15 DIM

)

___



8$(0,0)

8$(1,0)

8$(2,0)

8$(0,1)

8$(1,1)

8$(2,1)

8$(0,2)

8$(1,2)

8$(2,2)



8$(0,3)

8$(1,3)

8$(2,3)



• •

• •



• •

To define a plural number of ar ray variables by one DIM statement D I M A ( 2 ) , B$ ( 4 , 2 )

,C(3,3)

Each variable is punctuated with a comma. Multi-dimensi onal ar ray va riables

Multi-dimensional array variables are generated by specifying 2 maxi­ mum values or more for subscript. D I M X (3 , 4 , 5 ) ---- 3

dimension

DIM statement omissi on

When an array variable is utilized without declaring a DIM statement, the ' maximum value of the subscript is consid

..



_ D RAW (draw)



Draws grap!:lics on the graphic screen as specified in graphic sub­ commands_

• •

FO R M AT

DRAW subcommand

Subcom m a n d (!1Mg C h a racter s t r i n g (con stants) i n s i de " " o r s t r i n g type va r i a b l e s in w h i c h a c h arac t e r stri ng is a s s i g n e d . Capi­ t a l s o r sma l l c haracters.

Subc ommands

f



Con d i t i on

Sn (scale)

O� n � 255

S p e c i f i e s t h e n u mber of dots for 1 u n i t w h e n a l i ne i s d rawn. 1 /4 dot w i t h n = 1 . I n i t i a l izati o n i s S4.

An (an g l e)

0�n�3

A0

r'

• •

Sema n t i c s

Command

Ro"teHoocd i oate system by step of 90° fo r a standard coor- y d i n ate a x i s (0°). I n i t i a l izat i o n is AO.





A1

L ,�J 'I, '

,

A3









Cn (co l o r)

0 � n �15

S p e c i f i e s a c o l o r for a l i n e d rawn by a c o l o r code. In i t i a l izati o n i s C 1 5 .



Mx, y (move)

O � x � 255 O � y � 191

(0, D)



D raws a l i ne f rom a c u rre n t p o i n t to an abs o l ute location (x, y). y

X

~

• (x, y)

• • •

..













Command

Condition

M ± x , ±y (move)

o � x � 255





• • • •



Un ( u p) •

Dn (down)







Rn ( r i g h t)

• • • • •

• •

Ln ( left)

Sema n t i c s

O � y � 191

S h i fts horizo n ta l l y ± x from a c u rre n t p o i n t a n d ±y vert i ca l ly. The u n it for x, y i s t h e n u m b e r of dots s p e c i f i e d by t h e S s u bcomman d .

Draws a l i ne toward a n eg at i ve d i re c t i o n on t h e Y a x i s f ro m a c u rrent p o i n t to a n o t h e r p o i n t by a n n d i stance. The u n i t of n i s t h e number of dots specif i e d by t h e S s u bcommand. ( 1 i f om itted.)

M+30, -50

I I

- 30- �

Current point

x

�n

Current point y

D raws a l i n e toward a p o s i t i ve d i re c t i o n on t h e Y-a x i s from a c u rrent p o i n t to a n o t h e r p o i n t by an n d i stan ce. The u n i t for n is t h e n umber of dots specified by t h e S s u bcommand. (1 i f y o m itted.) D raws a l i n e i n a posit i ve d i re c t i o n on t h e X a x i s f ro m t h e c u rrent p o i n t to a n o t h e r p o i n t by an n d i stan ce. The u n i t of n i s . t h e n u m be r of dots s p e c i fi e d by t h e S s u b comma n d . (1 i f y o m i tted.) D raws a l i n e i n a n eg at i ve d i re c t i o n o n t h e X-a x i s from t h e c urrent p o i n t to a n o th er p o i n t by a n n d i stance. The u n i t of n i s t h e n u m ber of dots s p e c i f i ed by t h e S s u bcomm a n d . (1 i f o m i tted.)

I I I 150 I

x

Current point

�" n

x

.===----..

Current point

x

n •----===---.

Current point

y

..

• Com m a n d En

Fn

Gn

Hn

..

Condition



Semantics D raws a l i n e i n a pos i t i ve d i re c t i o n on t h e X·a x i s a n d i n a n e g at i ve d i re c t i o n on t h e Y·a x i s f rom t h e c u rre nt p o i n t to a n o t h e r p a i n t b y an n d i stan ce. The u n i t of n i s t h e n u m be r of dots s p e c i f i e d by the S s u b· c o m m a n d . (1 i f o m i tted.) Draws a l i ne in a pos i t i ve d i re c t i o n on t h e X·ax i s a n d i n a pos i t ive d i re c t i o n o n the Y·a x i s f r o m a c u rre n t p o i n t t o a n o t h e r poi n t b y an n d i st a n c e. The u n i t of n i s t h e n u m b e r of dots s p ec i f i ed by t h e S s u b· c o m m a n d . (1 if om itted.) Draws a l i n e i n a n e g at i ve d i re c t i o n o n t h e X·a x i s a n d i n a p o s i · t i ve d i re c t i o n o n t h e y. a x i s from a c u rre n t p o i n t to a n o t h e r p o i n t b y an n d i stance. T h e u n it of n i s t h e n u m b e r of d ots spec i f i e d by t h e S s u b c o m m a n d . (1 i f om itted). D raws a l i n e in a n e g at i ve d i re c t i o n o n t h e X·a x i s a n d i n a n e g a t i ve d i re c t i o n o n t h e Y·a x i s from a c u rre n t p o i n t to a n o t h e r p o i n t b y an n d i stance. T h e u n it of n i s t h e n u m be r of dots s p e c i f i ed b y t h e S s u bc o m m a n d . ( 1 i f o m i tted.)

x

y

LJ"

Current point



n



x

• •

y

n I I I I

n

x

Current PP ; o
0) , i n w h i c h a i s t h e base t h at i s a p o s i t i ve n u meral (a ", O), c a n b e o btai ned by LOG(b)/LOG (a). Exeuction exa mple PR I N T L O G ( l O )

2 . 302585 092994



L POS ( l i n e pri nter p o s i t i o n)

• • • • • • • • •

G i ves t h e p r i n t head location i n t h e printer b u ffer.

FO R MAT

L POS(X) X «!mm) A n arbit rary n u meral ( d u m m y a rg u m e n t). G iven value: I nteg er type.

F U N CT I O N A N D UTI L I ZAT I O N

G i ves t h e location of a c h a racter c u rre n t l y b e i n g p r i nted o u t t o t h e pri nter in t h e l i ne p ri nter buffer m e m o ry. (Start = O)

• L P R I NT ( l i n e p r i nt) O u t p uts the va l ue o f a n ex p ress i o n to the p r i n te r.

• • •

FO R M AT

L P R I N T [ex p ression] [separater] [ex p re s s i o n ] [separater] [ex p res s i o n ] . . . Expression (DJ N u m e ric a n d stri n g con stan ts, variables, a rray variables, th e i r expre s s i o n s . l!lii1II Li ne feeds Separater (DJ , o r ;

F U N CT I O N A N D UTI L I ZAT I O N

A n L P R I N T state m e n t o u t p u ts data t o a p r i n te r w h i l e a P R I N T state m e n t outp uts data t o t h e scre e n . S e e PR I NT f o r d eta i l s.

_ L P R I NT USI N G (l i ne p r i n t u s i ng) O u t p uts data to a p r i n te r in a spec i f i e d format.

FO R M AT

L P R I NT U S I N G format sym b o l ; e x p re s s i o n [ex p ress i o n ] . . . . . Expression (DJ Stri n g a n d n u me r i c c o n st a n ts, variables, array vari abl es, t h e i r ex p re s s i o n s .

F U N CT I O N A N D U T I L I ZAT I O N

L P R I N T U S I N G o u t p u t s d ata t o a p r i nter i n a spec i f i e d form at w h i l e P R I N T U S I N G outputs d ata to t h e screen i n a spec i f i ed format. See P R I N T U S I N G for deta i l s such as t hose for format sym b o l s.

• • • •

• •

• •



• • •











• • • • • • • •

_ M ERG E (m erge) Loads a p ro g ram saved by a n ASC I I format, and merges it w i t h a p ro g ram in m e m ory.

FO R M AT

M E RG E "d evice n a m e [f i l e n a m e]" Device name � CAS : . . . Cassette tape. � S t r i n g w i t h i n 6 c h a racters. If 7 o r m ore c h a racters are File name s p e c i f i e d , the 7th c h aracter and after are i g n o red. (!limJ M e rg e s ·the f i rst f i l e fou n d .

F U N CT I O N A N D UTI L IZAT I O N



O n l y CAS: can be spec i f ied as a d e v i c e n a m e. Lo ads a p rogram saved o n c assette t a p e i n a n ASC I I format b y a SAV E state m e n t . T h e ex i s t i n g p ro­ g ram in m e m o ry, m a i n ta i ned as i t i s, is m erged w i t h t h e p ro g ram loaded by a M E R G E stat e m e n t . e l f t h e l i n e n u m be rs of t h e p rog ram l o a d e d by a M E R G E state m e n t are t h e same as t h at of a n ex i s t i n g p rog ram in m e m ory, t h e l i n e n u m be rs of the p ro g ram n e w l y l oaded by a M E R G E state m e n t are m a i ntai n e d .



Execution exa mple

• •

• • • • • • • • •

MERGE " CAS : PR OG3 "

• •

M I D$ ( m i d d l e do l l ar)



Fetc hes and g i ves a p a rt of character data.

• FO R M AT

M I D$ (X$, M [, N ])

X$ C!!lm!J S t r i n g type con stants, variables, array v a r i a b l es, t h e i r expre s s i o n s . M C!mm) N u m er i c type c o n stants, vari abl es, array vari a b l es, t h e i r ex p re ss i o n s from 1 to 255. N C!!lm!J N u m e r i c type c o n stants, variables, array var i a b l es, t h e i r exp ress i o n s f ro m 1 to 255. C!limJ G i ves a l l c h aracters after the Mth c h aracter. G i ve n va l u e : S t r i n g type.









F U N CT I O N A N D UTI L I ZATI O N



Execution example



PR I N T M I D$ ( - JAPANUKFRAN CE - , 6 , 2 ) UK PR I N T M I D$ ( - JAPA NUKFR AN C E " , 6 , 2 . 6 ) UK PR INT M I D$ \( " J APANU K" 6 UK

"

4) }

PR I N T M I D$ ( " J APANUK " , 1 2 , 5 ) PR INT M I D$ ( " J APANUK " , 6 , 0 )

}

If N is not an intege r } -value, figures below the

decimal point are omitted. If N characters do not exist after the Mth character, all characters after the Mth character are given. When the value of M is larger than - the length of X$ or when N is 0 , a null string i s given.

-











• •

• • la





• • •

_ M I D$ =Y$ (m i d d l e d o l l a r) Rep laces a part of a c h aracter string w i t h another c h a racter stri n g .

• • • • • •

FO R M AT

M I O$(X$ , M L N]) =Y$

X$, Y$ l!mmI S t r i n g type c o n st a n ts, vari a b l es, array var i a b l es, t h e i r ex­ pre s s i o ns. M l!mmI N u m e r i c type c o n stants, variables, array vari a b l es, t h e i r exp ress i o n s f ro m 1 to 255. N l!mmI N u m e r i c type c o n stan ts, vari a b l es, array variabl es, t h e i r exp ress i o n s f ro m 1 to 255. C!liiJII Mth c h aracter and after in X$ are repl aced by Y$.

F U N CT I O N A N D U T I L I ZAT I O N



Rep laces t h e M t h c h aracter a n d after f rom t h e l e f t i n t h e X $ c h a racter stri n g with the characters f ro m t h e beg i n n i n g to t h e Nth c h aracter in Y$. H owever, the l e n g t h of X$ i s not c h a n ged after exec u t i o n .



Execution exa mple

• • •

1 0 X$= " ABCDEFG" 20 Y$= " Q R S TUVWXYZ" 30 M I D$ ( X$ , 4 , 2 ) =Y$ 40 PR I NT X$ RUN ABCQRFG

• • • • • • •

..

• •

_ M OTO R (motor)



Tu rns t h e motor of t h e cassette tape recorder on a n d off.

• FO R M AT

M OTO R

[{g� F}]





F U N CT I O N A N D UTI L I ZAT I O N

C o n n ect t h e c o m p uter TA P E term i n a l t o t h e re mote contro l term i n a l o f a cassette tape recorder and p l ace t h e record e r i n a p l ayback or record mode. Tape operat i o n starts w i t h M OTO R ON a n d stops w i t h M OTO R O F F. W h e n o n l y M OTO R i s exec uted, if i t is O N , it i s sw i t c h ed to and i f it is i t i s switched to O N .

OFF,

OFF,

_ N EW (new)

Erases a BAS I C pro g ram in m e m o ry and c l ears va riables.









• •

• FO R M AT

N EW

F U N CT I O N A N D U T I L I ZATI O N

N e w i s exe c u ted before entering a new p ro g ram t o e rase a l l p rev i o u s p ro­ g ra m s and enter a c o m m a n d wait state. e W h e n a m ac h i ne l an g u ag e p ro g ram ex i sts i n m e m o ry, i t is m a i n a i ned eve n i f N EW i s exec uted.



• • •



• •



• • •

'iij'M'" O CT$ (oc tonary d o l l a r)

G i ves an octal express i o n of n u meric d ata as string type d ata.

• • • •

• • • •

FO R M AT

OCT$(X)

-

X @!!mJ N u me r i c type con stants, vari a b les, array vari ables, t h e i r expres­ s i o n s f ro m 32768 to 65535. I f i t i s a negat i ve n u m eral , i t i s t h e same as a value in w h i c h t h e va l u e is added t o 65536. G i ven v a l u e : S t r i n g type.

F U N-CT I O N A N D UT I L I ZAT I O N

Execution exa m p l e PR I N T OCT$ ( lO O )

1 44

PR I N T O CT$ ( 6 5 5 3 6 - 32768 )

100000

• • • • • • • • • •

..



_ O N E R R O R G OTO (on e rror go to)



When an e rror o c c u rs, exec u t i o n is transfe rred to a spec i f i ed l i n e n u m be r.

• • •

FO R M AT

ON E R R O R G OTO l i n e n u m be r



L i n e n u m ber � I ntegers f r o m 0 to 65529.

F U N CT I O N A N D UTI LIZAT I O N



Used t o p reve n t a n exe c u t i o n i nterrupt i o n caused b y a n e rro r t h at oc­ c u rred d u r i n g p ro g ram exec u t i o n . W h e n an e rror o c c u rs after O N E R RO R G OTO i s d e c l a re d , exec u t i o n i s transfe rred t o a spec i f i ed l i ne n u m be r. (A l so, w h e n an e rro r res u l ts f ro m a d i rect c o m m a n d , exec u t i o n is t rans­ fe rred to a s p ec i f i e d l i n e n u m be r.)



Execution exa mple



1 0 ON ERROR GOTO 1 0 0 20 I NPUT A 30 B=SQR ( A ) 40 P R I N T �SQR ( A ) = " ; B 5 0 END 1 00 I F ER R =5 AND ERL=30 THEN PR I N T " I n pU t a pas i t i ve n umber " 1 1 0 R ESUME 20 -

END statement that distinguishes a main routine from the error processing routine. . _ Error processing routine.

To i nva l idate a n O N E R R O R G OTO statement E xecute ON E R R O R G OTO O .

}

• •

• •

• • • •

• •





• • •

_ O N - G O S U B ( o n - g o to su brout i n e) Branches program exec u t i o n to s u b ro u t i nes that start w i t h s p e c i f i e d l i n e n u m be rs d e p e nd i n g on t h e val u e of t h e ex p re s s i o n .

• • • • • • • • • • •

FO R M AT

ON expre s s i o n GOSU B l i ne n u m be r [, l i ne n u m be r] . . . . . Expression � N u m e r i c t y p e vari ables, array variables, t h e i r ex p res s i o n s from 0 t o 255. Line n u m ber � I nteg e rs from 0 to 65529. F U N CT I O N A N D U T I L I ZAT I O N 1 0 0 ON X GOSUB 500 , 600 , 700

In t h i s p ro g ra m , i f t h e va l u e of X i s 1 , exec u t i o n b ra n c hes to a su brout i n e from l i n e n u m be r 500, a n d i f t h e va l u e of X i s 2 , exe c u t i o n bra n c h e s to a su bro u t i n e from l i n e 600, and if i t i s 3, execut i o n branches to a su brou· t i ne f ro m l i n e 700. A ret u rn to the m a i n p ro g ram is accom p l i s hed by a R ETU R N state m e n t . Expression value a n d execution res ult When the expression value is not a n i nteger ... F i g u res below t h e d ec i m a l poi n t a r e o m i tted. When the expression va l u e is 0 or l a rger than the n u m ber of the l i n e num· ber specified by GOSU B . . Transferred to a statement next to t h e O N ­ G OS U B stat e m e n t . W h e n the expression value i s negat ive or I-a rger than 25t> . . . . . A n e rro r o c c u rs. .

.

• • • • • • •

..

-

• •

_ O N - G OTO (o n - g o to) B ranches p ro g ram exe c u t i o n to l i n e n u m be rs t h at depend o n the va l u e of an expres s i o n .

FO R M AT

ON express i o n G OTO l i n e n u m b e r [, l i n e n u m ber] . . . . . Expression C!mmI _N u m e r i c type var i a b l es, array variab les, t h e i r expre s s i o n s. Line n u m ber C!mmI I n teg ers f ro m 0 to 65529.





• •





F U N CT I O N A N D U T I L I ZAT I O N 1 00 O N X GOTO 1 2 0 , 1 30 , 1 8 0

I n t h i s p ro g ra m , i f t h e v a l u e of X i s 1 , i t b r a n c h e s t o l i n e 1 20 , i f i t i s 2, i t b r a n c h e s to l i ne 1 30, a n d i f i t i s 3, i t b r a n c h e s to l i n e 1 80. Expression va l u e and execution res u l t W h e n the expression value is n o t a n i nteger . . . F i g u res below t h e d ec i m a l poi nt are o m itted. When expression va l u e i s 0 o r l a rger than the n u m be r of l i n e n u m bers specified by G OTO . Tra nsferred to a state m e n t next to the O N - G OTO state ment. When the expression va l u e i s negative or l a rger than 2 5 5 . . A n e rror o c c u rs.

..

.

• •



• •

















• • • •

O N I NT E RVAL GOSU B (on i nterval go to s u b ro u t i n e) Dec l a res a s u b ro u t i n e to w h i c h p ro g ram b ranc hes w h e n an i n terrupt i s caused b y a b u i lt-i n t i m e r.

• • • • •





• •

• •

• • • •

• •

FO R M AT

ON I N TERVA L= I n terval t i me G O S U B l i n e n u m be r

I nterva l t i m e C!t!m!I N u m e r i c t y p e co nstants, vari a b les, array va r i a b l es, t h e i r ex p res s i o n s f ro m 32768 to 65535 a n d o t h e r t h a n O . L i n e n u m ber C!t!m!I I ntegers f rom 0 t o 65529. -

F U N CT I O N A N D U T I L I ZAT I O N

A state m e n t t h at d ec l a res a s u b ro u t i n e start i n g l i n e n u m ber t o w h i c h pro g ram branches w h e n a n i n terrupt i s caused b y a b u i l t - i n t i m e r w i t h a c e rt a i n i nterva l . The i n terrupt spac i n g i s about (i nte rval t i m e x 1 /50) se­ c o n d . In o t h e r words, w h e n the i n te rval t i m e i s spec i f i e d as 50, an i n ter­ rupt o c c u rs a p p rox i mately every seco n d . (See 2 - 7 I n terru pts) Exe cu tion examp le 1 0 ON I N TERVAL = 5 0 GOSUB 1 0 0 20 I N TER VAL ON 30 SCR E EN 2 , 1 40 SPR I TE$ ( 1 ) =CHR $ ( &H 1 8 ) t C HR $ (&H3 C ) tCHR$ ( &H66 ) tCHR$ ( &HDB ) tCHR $ (&HE 7 ) +C HR $ (&H7 E ) + CHR$ (&H24 ) +CHR$ ( &H42 ) 50 GOTO 5 0 1 0 0 X= I N T ( R ND ( 1 ) * 2 5 6 ) : Y= I N T ( R N D ( 1 H 1 92 ) 1 1 0 C = I N T ( R ND ( 1 ) * 1 4 ) +2 1 20 PUT SPR I TE 1 , ( X , Y ) , C , l 1 3 0 R ETURN 5 0

I n t h i s p ro g ra m , an i nterrupt occ u rs w i t h about 1 second s p ac i n g p rovi d ­ ed b y l i nes 1 0 a n d 2 0 , a n d eac h t i m e an i nterru pt o c c u rs, t h e exec u t i o n i s t ransferred to a s u brout i n e f r o m l i ne 1 00. Afte r a U FO sh aped s p r i te pattern i s d i s p l ayed by t h i s s u b rout i n e, a ret urn to l i ne 50 o c c u rs caused by R ETU R N 50 . • W h e n t h e i nterval t i m e i s set to a negative n u m e ra l , it is e q u a l to a n u m era l i n w h i c h t h e s p e c i fied i nterval t i me i s added to 65536 .

..



_ O N K EY G O S U B (On key g o to

Decl ares a s u b rout i n e to w h i c h p ro g ram branches w h e n an i n terrupt is a p p l i e d by a f u n c t i o n key.

FO R M AT

O N K EY GOSU B l i n e n u m be r [, l i n e n u m be r] . . . . Line n u m ber 8lm!J I ntegers form 0 to 65529.

F U N CT I O N A N D UTI L I ZATI O N

A state m e n t t h at d e c l ares t h e start i n g l i ne n u m be r o f a s u bro u t i n e to w h i c h p ro g ram b ranches w h e n an i nterrupt i s a p p l ied by a f u n c t i o n key. Up to 5 1 i n e n u m be rs can be s p e c i f i e d after G O S U B by p u n c t u at i n g t h e m to seq u e n t i a l l y corres p o n d t o [£!J, �, etc. Execution exa m p l e 10 ON KEY GOSUB 1000 2 0 0 0 20 KEY ( 1 ) O N : KEY ( 3 ) ON .



When [£!J i s p ressed , exe c u t i o n i s transferred to a s u bro u t i n e f ro m l i n e 1 000, and w h e n � i s p ressed , i t i s t ra n sferred t o t h e s u b ro u t i n e f rom l i ne 2000 based o n the above two l i n es of the p ro g ra m . A ret u rn f ro m t h e s u b ro u t i ne i s made by a R ETU R N statem e n t . (See 2-7 I nterru pts)





• •







• •



• • • • • •

+:+

• •









• • •



• •





• •





_ O N S P R I T E G OSU B (on s p r i te go to s u bro u t i ne)

Decl ares a s u bro u t i n e to w h i c h p rog ram branches w h e n an i nterrupt oc­ c u rs due to a sprite ove r l a p.

FO R M AT

O N S P R I T E G OS U B l i n e n u m be r

L i n e n u m be r C!rnm) I ntege rs from 0 to 65529.

F U N CT I O N A N D UTI L I ZATI O N

A statem e n t t h at d e c l a res t h e start i n g l i n e n u m be r of a s u b ro u t i n e to w h i c h p ro g ram bra n c h e s when an i n terrupt occ u rs d u e to an ove r l ap of s p r i te patte rns. Execution exa mple 1 0 O N SPR I TE G O S U B 1 0 0 0 20 SPR I TE ON

When a sprite ove r l a p o c c u rs, exec u t i o n is t ran sferred to a s u bro u t i n e f ro m l i n e 1 000 based o n t h e above t w o l i nes. A ret u rn i s made from a s u b ro u t i n e by a R ETU R N state m e n t . ( S e e 2 - 4 Scre e n co n f i g u rat i o n s and g ra p h i cs, 2 · 7 I nterru pts.)

• •



• •

• •

..

• _ O N STO P G OS U B (on sto p go to s u b ro u t i ne) Dec l a res a s u bro ut i n e to w h i c h p ro g ra m bra n c hes when a key i n terrupt occ u rs.

I STOP I

I CTRL 1 +

FO R M AT

O N STO P G OS U B l i n e n u m be r L i n e n u m ber � I n tegers f ro m 0 to 65529.

F U N CT I O N A N D UTI L I ZAT I O N

A state m e n t t h at d e c l ares t h e start i n g l i n e n u m be r of a s u b ro u t i n e to w h i c h prog ram bra n c h e s w h e n a I CTRL 1 + I STOP I key i n terrupt o c c u rs. Execution example 1 0 ON S TO P GOSUB 1000 20 STOP ON

Exec u t i o n is t ran sferred to a s u b ro u t i n e f rom l i n e 1 000 by s i m u l t a n e o u s l y p ress i n g I CTRL I a n d I STOP I based on t h e above two l i nes. A retu rn f ro m t h e s u b rout i n e i s m a d e b y a R ETU R N state m e n t . (See 2 - 7 I n te rru pts.)

I Preca u t i o n s I

I t i s necessary for a prog ram to be term i n ated s o m e h ow w h e n a s u bro u ­ t i n e i s exec uted. T h e o n l y way t o termi n ate t h e f o l l ow i n g p ro g ra m i s to p ress t h e I RESET I b utto n . 1 0 ON STOP GOSUB 100 20 S TO P O N 30 PR I N T - MA I N R OU T I N E 40 GOTO 40 1 0 0 PR I N T - CTRLt STOP EXECUTED1 1 0 R ETURN 30













• • •

• •



• • • •

• •





• • • •

• •





• • • •

• • •

_ O N ST R I G GOSU B

(o n s t i c k t r i g g e r go to s u bro u t i ne)

Decl ares a s u b ro u t i n e to w h i c h p rog ram branches when an i n terrupt is caused by t h e space bar or t h e t r i g g e r button of a j oy s t i c k .

FO R M AT

O N STR I G G O S U B l i n e n u m be r [, l i n e n u m be r] . . . . . L i n e n u m be r � I nlegers f ro m 0 10 .65529.

F U N CT I O N A N D UTI L I ZAT I O N

A stat e m e n t t h at d e c l ares t h e start i n g l i ne n u m ber of a s u b ro u t i n e to w h i c h prog ram branches when an i n terrupt occ u rs by the p res s i n g of t h e space b a r o r j oy st i c k t r i g g e r b u t t o n . U p to f i ve l i ne n u m be rs c a n b e spec i f i e d a f t e r G OS U B b y p u n c t u at i n g t h e m w i t h c o m m as. O N STR I G GOSU B l i n e N o. 0 , l i n e N o. 6 , l i n e N o. e , l i n e N o. 0 , l i n e N o. 0 L i n e N o. 0 . . . Branches when t h e space bar is p ressed. Line N o. 6 ... J oy stick 1 , Tri g g e r button 1 L i n e N o. e . . J oy st i c k 2, Tri g g e r button 1 L i n e N o. 0 . . . Joy st i c k 1 , Tri g g e r button 2 L i n e N o. 0 . . . J oy st i c k 2, Tri g g e r button 2 .

Execution exa mple 1 0 ON S TR I G GOSUB 1000 . 2000 . 3000 20 STR I G ( O ) ON : STR IG ( I ) O N : STR I G (2 )

ON



W h e n the s pace bar is p ressed, exe c u t i o n is t ra n sferred to a s u b ro u t i n e f ro m l i n e 1000, a n d w h e n t r i g g e r button 1 of joyst i c k 1 i s p ressed, exe c u ­ t i o n i s transfe rred t o a s u bro u t i n e f ro m l i n e 2000. A l so, w h e n t r i g g e r b u t· ton 1 of j oyst i c k 2 i s p ressed, exe c u t i o n i s transferred to a s u b rout i n e f ro m l i ne 3000. Return fro m a s u b ro u t i n e is acco m p l i shed w i t h a R ETU R N state m e n t .



(See 2-7 I n terrupts.)









..



_ O P E N (o pen)

Opens a f i l e a n d spec i f ies a mode.

FO R M AT

O P E N "dev i c e name [fi l e name) " F O R mode AS [ # ] f i l e n u m be r Device n a m e � CAS: . . . Cassette tape

File name



C!lWIJ Mode



File n u m be r �

C RT: . . . Tex t mode s c reen G R P: . . . G ra p h i c m o d e s c reen LPT: . . . Pri nter St ri n g w i t h i n 6 c h aracters. I f 7 o r m o re c h aracters are s p e c i f i e d , the 7th c h a racter and after are i g n o red. N u l l·stri n g O UTPUT . . . Write. I N PUT ... Read . 1 ;;;; f i l e n u me r ;;;; n u m eral s p e c i fied by M A X F I LES = state· ment

F U N CT I O N A N D U T I L I ZATI O N

A n O P E N state m e n t opens a f i l e w i t h a spec i f i e d f i l e n u m be r t o perform f i l e I/O for a spec i f i e d d ev i ce. S i n c e CRT:, G R P : , a n d LPT: of t h e devices t h at can be spec i f i ed are ded i c ated to write· i n , only OU PUT can be spec i ­ f i ed as a m o d e. O n t h e o t h e r h a n d , s i nce w r i te-i n a n d read-out can be p e r­ formed w i t h CAS : , OUT PUT a n d I N PUT can be spec i f i e d . e W h e n w r i te-i n i s performed w i t h a f i l e n a m e, re ad·o ut c a n b e performed by spec i fy i n g t h e same f i l e name. e The f i l e n u m be r s h o u l d be equal to o r l ess t h a n t h e n u m e ra l t h at i n d i ­ cates t h e m ax i m u m n u m e r o f f i l e s w h i c h c a n be o p e n e d , a s spec i f i ed by M AXFI LES = state m e n t . Execution example

SCR EEN 2 OPEN "GRP : " FOR OUTPUT AS # 1 3 0 PSET ( 1 20 , 90 ) 4 0 PR I N T # 1 , " ABC " 50 GOTO 5 0 10 20

T h i s i s a p rog ram t h at o u t p uts c h a racters o n t h e screen i n t h e g ra p h i c m o d e (SC R E E N 2). (See 2-6 F i l e Process i n g)



• •

• •



• • •

• •



• • • •

• •

• •

• • •

_ O UT (out)

O u t p u ts 1 byte d ata to a spec i f i e d I/O port.

• • •

FO R M AT

OUT port n u m be r, ex p ression Pori n u m ber, expression � N u m e r i c t y p e c o n stants, vari a b l es , array var i a b l e s , t h e i r expre s s i o n s f ro m 0 to 255.



F U N CT I O N A N D U T I L I ZAT I O N



T h i s i s a c o m m a n d t h at o u t p uts d at a d i rectly t o an I /O p o rt . See page 196 for I /O p o rt ass i g n m e n ts.

• •

'i"MM" PA D

(pad)

Prov i d e s t h e stat u s of t h e touch pad.

• • • • • • • •

FO R M AT

PA D(N) N � I n tegers f rom 0 to 7 . G i ven v a l u e : N u m e r i c type.

F U N CT I O N A N D UTI L I ZATI O N

Provi d es var i o u s d ata f ro m a touch pad b y an N va l u e. W h e n N i s 0, 1 , 2 , o r 3, t h e status of t h e t o u c h pad c o n n ected t o c o n t ro l l e r term i n a l A i s p rov i d e d . W h e n i s 4 , 5, 6 , o r 7 , t h e stat u s of t h e touch pad c o n nected to c o n t ro l l e r term i n a l B is g i ve n . Val ue of N o

or 4

S e m a n t i cs for a g i ve n val u e 0: N o t touched - 1 : I s touched



1 0(5

X coord i n ate of a touched locat i o n .

2 or 6

Y coord i n at e of a touched locat i o n .



3 or 7



0 : Switch i s not p ressed. - 1 : Switch i s p ressed.

..







_ PAI NT (pai nt) Co l o rs a n a rea s u rro u n ded by a b o rd e r l i n e.



FO R M AT

PA I N T [ST E P] (X-coord i n ate, Y-c oord i n ate), [d i s p l ay c o l o r] , [border l i n e c o l o r] X·coord inate � N u m e r i c type c o n stants, vari a b les, a rray v a r i a b l es, t h e i r ex p ress i o n s from 0 to 255. Y-coord inate � N u m e r i c type co n stants, v a r i a b l es, array vari a b l es, t h e i r ex p res s i o n s f rom 0 to 1 9 1 .

Display calor, border l i ne color � I n teg ers f ro m 0 to 15. I!lmIJ C u rre n t fore g ro u n d c a lo r.

F U N CT I O N A N D UTI LIZAT I O N

Execution exa m p l e CLS SCR E EN C I R CL E PAINT

@

]

(70 , 70 ) , 40 , 1 0 (70 , 70 ) ,(1 0 , 1 0)GOTO 50

---

• •





Col o rs a n area w i t h a d i s p l ay c o l o r i n s i d e a bord e r l i n e w i t h a s p e c i f i e d c o l o r i n c l u d i n g t h e l ocation spec i f i ed b y X,Y coord i n ates. e l f the border l i ne is not c o m p l etely c l osed, the e n t i re screen is c o l o re d . e l n t h e S C R E E N 2 ( h i g h reso l u t i o n ) m o d e, i f the d i s p l ay c o l o r i s not the same as t h e border l i ne c o l o r, t h e e n t i re screen i s c o l o re d . e See page 1 54 f o r S T E P spec i f i c at i o ns.

10 20 30 40 50



In SCREE N 2, the same col or must be specified for the display color and border line color.

(70,70)

Dark yellow

• •

• • • •



• •

• •



• • • • • •

10 20 30 40 50

CLS S CR EEN C IR C L E (70 , 70 ) , 40 , 1 0 i----. P A I NT (70 , 70 ) ,(8 , 10) GOTO 5 0

@

J

In SCREEN 3, different colors can be specified for the display color and border line color.

.70) Medium red

• • • • • • • • • • • • • • •

Dark yellow

• •

P D L (pad d l e)



G i ves t h e va l u e fro m a pad d l e.

• •

FO R M AT

PDL (N) N cmt I nt e g ers f ro m 1 to 1 2 . G i ve n v a l u e : N u me r i c type f rom 0 to 255.

F U N CT I O N A N D UTI L I ZATI O N

G i ves t h e value obta i ned f ro m a padd l e a s n u m e r i c type d ata. W h e n N i s an odd n u m be r, d ata is p rovided f ro m t h e p a d d l e con n ected to con­ t ro l l e r term i na l A , a n d when N i s a n even n u m ber, d ata i s provi de d fro m t h e pad d l e c o n n ected to contro l l e r term i n a l B.

G i ves t h e co ntent of a s p e c i f i e d m em o ry a d d ress.

P E E K (add ress) Address C!mm) N u me r i c type constants, varia b l es , array var i a b les, t h e i r ex· pres s i o n s from 32768 to 65535. In t h e case of n egat i ve n u m e r a l s , t h e i r val u e i s t h e s a m e as if it i s added to 65536. G iven value: N u m e ri c type d e c i m a l format. -

F U N CT I O N A N D UTI L I ZAT I O N

Execution exa m p l e

..





• • •

FO R M AT

( 5 0000 )

• •

P E E K (peek)

M=PEEK



___

Assigns the content of memory address to variable M.

50000



• •



• • •



• • •

• •



• • • •

G e n e rates a s o u n d accord i n g to a s u b co m m a n d spec i f i c at i o n .

FO R M AT

P LAY s u bc o m m a n d Subcom mand � C h a racter s t r i n g (con stant) i n s i d e " ", o r a s t r i n g type Subcommands

var i a b l e w h i c h is a s s i g n e d a c h a racter stri n g . Capitals or small c h a racters.

Command

Condition

Semantics

Tn (tem po)

I ntegers of 32 � n � 255

Spec i fies t h e speed of m us ic. The val u e of n i n d i c ates the c o u n t i n g of a q u arter n ote for o n e m i n ute. The i n i t i a l sett i n g i s T1 20.

On (octave)

I ntegers of 1 �n�8

S pec i f i e s one of 8 o ctaves. When 04 is spec i f i e d , m us i c w i t h i n t h e ran ge shown b e l o w i s performed.

� 1J J J J J F







• •

The octave becomes l ower as t h e va l u e of n becomes s m a l l e r and becomes h i g h e r as t h e val u e of n bec o mes l arger. The i n it i a l val u e i s 04. Ln (length)

1 � n � 64

Ll

• • • • •



I nd i cates t h e l e n g t h of s o u n d .

0

L2

j

L4

Ll6

L32

L64

) ) J ) LB

j

I n i t i a l sett i n g is L4. Nn (note)

0 � n � 96

Spec i f ies a m us i c a l n ote.

N 36 i s



N O is a rest.

The c h ro m a t i c scale i n c reases as n is i n c reased by 1 .

Cl

• Command

Condition

A-G An-Gn

1 � n � 64

Semantics

Spec i f i es t h e m u s j c a l n ote w i t h i n a spec i f i ed octave. c" D' C' D ' D- E-

F' G< A' F- G ' A ' G- A- S-

ItiltttI c

0

E

F

G

A

B

The s o u n d l e n g t h can be s p ec i f i ed by n . ( C 4 i s t h e same as L4C.) W h e n o m itted, i t i s t h e l e n g t h spec i f i ed by L n . 1 � n � 64

Vn (vo l u m e)

O � n �15

Sn (sha pe)

O � n �15

S p e c i f i e s a res t . R'

R2

R4

---

---

t

R'6

7



R32

f

R64

f

E x p ress a d o t . The l e n g t h i s exte n d ed to 1 . 5 t i m es b y p l a c i n g i t b y o n e. C4.= -1 R4.= I · Spec i fi e s t h e vo l u me. The vo l u m e i n c reases as n beco m es larg e r. The i n ital set t i n g is VS.

Sp'e c i f i e s the vol u m e variat i o n pattern from a m o n g the f o l l ow i n g patterns.

Magnitude 8 = 1 , 2, 3, 9

I t\

8 = 4, 5 , 6, 7, 15

1 11

8=8

I ttJ\N#N\ 8 = 10

I tvV\tv\

� �

R8







# (or + ) and - are used f o r a sem i to n e .

Rn (rest)



S= 11

IN

8= 12

I M1111W 8=13

I1

8= 14

I NV\N

The i n i t i a l sett i n g i s S 1 . T h e g e n e ra t i o n of many d i ffere n t sou n d s i s determ i ned b y a c o m b i n at i o n of t h e S s u bc o m m a n d a n d t h e M s u b c o m m a n d .





• • • • •

• •

• • •



• •



• •

• •

Com m a n d

Condition

Mn modul at i o n)

1 � n � 65535

Semantics Determ i ne s t h e cyc l e of t h e pattern spec i f i e d b y t h e S s u bc o m m an d . The cyc l e becomes l o n g as t h e v a l u e of n i s i n c reased . The i n i t i a l sett i n g i s M 255.

• • • • • • • • • • • • • • • • •

F U N CT I O N A N D UTI L I ZAT I O N PLAY " T8003L4CDEFG2 . R AB04CDC2 . "

� ased o n t h e above state m e n t , t h e sound i s p l ayed accord i n g to t h e f o l · l o w i n g notes.

f\

= 80

I� A � � 11.""' A ,\:y ""1"

tJ

I

�. ,. ./ •

I

....I -

I I



I

I

(

I.

..1. t

J

-

) t



______________� y �-----------� )

03

---

4-



l � --� y � __ �

04

To express a subcommand with a variable M$= " T8003L4CDEFG2 . R AB04CDC2 . " PLAY M$ A s u b c o m m a n d i s ass i g ned to a s t r i n g type va r i ab l e, M $ , o nce, t h e n M $

i s spec i f i ed i n a P LAY statement a s a s u bc o m m a n d . To express a p a rt o f a subcommand w i t h a vari a ble ( X variable;) 10 M$=" CDEFG2 . R " 20 PLAY " 0 4 L 4 XM$ ; GAGAG2 . R " 30 PLAY " XM$ ; AB05 CDC2 . "

When a s u bc o m m and ass i g ned to a stri n g type variabre i s used i n " " of a PLAY statem e n t , add X before a n d ; after. I n t h e exa m p l e above, a s u b· c o m m a n d assig ned to M $ i s used i n two PLAY statements.

• To express n in a subcommand w i th a vari a b l e ( = va riable;)

n w h i c h is s pecified in each s u bcommand can be a constant or a vari able i n a PLAY statement. W h e n expressed as a variable, i s added before and ; after. =

1 0 FOR 1 = 1 TO 8 20 PLAY -O=I ; CEG" 30 NEXT 1 T h i s p rog ram p l ays 8 octave m u s i c from P LAY " 0 1 C E G " to PLAY "08C E G ". Performance of chords

Up to 3 commands can be s i m u l taneously p l ayed s u c h as PLAY A$, B$, C$

1 0 A$= " 04CD03B04E2R 4 20 B$=-04EFDG2R 4 " 3 0 C$=- 04GAG05 C2R 4 4 0 PLAY A$ , B$ , C$ T h i s p ro g ram p l ays t h e f o l l o w i n g notes.

• •

• •



• • •

• •

(See 2-5 Sound.)







• •





• • •

• •

• • •

• • • •



• •

P LAY (p l ay) C h e c ks i f m us i c is be i n g p l ayed or not.

FO R M AT

P LAY ( N ) N � I nteg ers f r o m 0 to 3. G i ve n v a l u e : N u m e r i c type.

F U N CT I O N A N D UTI L I ZAT I O N

T h ree d i f f e re n t so u n d s c a n be s i m u l ta n eo u s l y p l ayed i n a PLAY state m e n t . I n t h e case of P LAY A$, B$, C $ ; t h e s o u n d o f s u b c o m m a n d A$ i s o u t p u t f r o m C h a n n e l 1 , t h e s o u n d of B$ i s output f ro m C h a n n e l 2, a n d t h e s o u n d of C$ i s o u t p ut f ro m C h a n n e l 3. The P LAY f u n c t i o n c hec ks i f data i s in t h e m u s i c data buffer of C h a n n e l 1 w h e n N = 1 , t h e same for C h a n n e l 2 w h e n N = 2, and the s a m e for C h a n ­ n e l 3 w h e n N = 3. W h e n d ata i s i n t h e b uffer, - 1 i s g ive n , a n d w h e n t h e re is no data, 0 is g iven . W h e n N = 0, t h e O R ( l o g i c a l s u m ) of t h e b u f fe r sta­ t u s (0 or 1) of a l l c h a n n e l s is g ive n . I n other words, if one of t h e m is - 1 , - 1 i s g i ve n .



• • •

• •



• •

..

liiileQiijfil POI NT (poi nt)

G i ves t h e c o l o r code of a p o i n t at a spec i f i e d l ocat i o n .

FO R M AT

PO I N T (X, Y)

X, Y cmB N u m e r i c type c o n stants, vari a b l es, array vari a b l es, t h e i r expres· s i o n s from - 32767 to 32767. G iven val u e: N u m e r i c type ( - 1 is g i ven when a s p e c i fied l o c at i o n i s o u t s i d e t h e d i s p l ay area.)

F U N CT I O N A N D UTI L I ZAT I O N Execution exam ple

1 0 SCR EEN 3 20 FOR 1 = 1 TO 2 5 0 30 X= I N T (RND ( 1 ) * 25 5 ) 4 0 Y= I NT (RND ( 1 ) * 19 1 ) 5 0 PSET ( X , Y) , 1 60 NEXT I 70 FOR Y=O TO 1 9 1 STEP 4 80 FOR x=o TO 2 5 5 STEP 4 90 C=PO IN T ( X , Y ) 1 00 I F C=4 THEN PSET ( X , Y ) , 1 5 1 1 0 NEXT X , Y 120 GOTO 120 The c o l o r c o d e for t h e l o c a t i o n ( X , Y ) i s ass i g ned to var i a b l e C i n l i n e 90, and c h a n g ed i n to w h ite in l i n e 1 00 if C i s 4 (dark b l u e).

• • • •

• • •

• •

• •



• •

• •





• • •

• •









• •

• •

• •

• • • •

• •

• •



_ PO K E (po ke)

Writes data to a s pecified m e m ory address.

FO R M AT

PO K E address, ex pression Add ress � N u m e r i c t y p e c o n st a n ts, var i a b l es, array vari ab les, t h e i r ex­ p ress i o n s f rom

-

32768 to 65535.

Expression � N u m e r i c type co n stants, vari a b l es, array var i a b l es, t h e i r ex­ pres s i o n s from 0 to 255.

F U N CT I O N A N D UTI L I ZAT I O N Execution exa m p l e

POKE '50000 . 2 5 5

---

POKE &HDOOO . &HAS

--

Writes 255 as data to memory 50000. Writes ASH as data to memory address DOOOH.

POS (pos i t i o n) G i ves the X-coord i n ate of the c u rsor p o s i t i o n .

FO R M AT

POS (X) X C!I!m!B An arb i t rary n u me r i c v a l u e (d u m m y arg u me nt) G i ve n va l u e : I nteger type

F U N CT I O N A N D UTI LIZATI O N Execution exa m p l e

10 20 30 40

INPUT A$ PR I N T A$ ; : X=POS ( X) I F X> =5 THEN CLS PR INT : GOTO 1 0

T h e va l ue of the c u rsor X-coord i n ate i s g iven t o t he variable X based on l i n e 20 , X= POS (X). As a resu l t, t h e scree n i s c l eared by i n p u t t i n g a st r i n g w i t h 5 ch a racters or m o re t h a n 5 c h a racters f o r A$.

..

• •

_ P R ES ET (point reset)

M arks o r e rases a d ot o n the s c reen in the g ra p h i c mode.

FO R M AT

P R ESET [ST E P] (X-coord i n ate, Y-coord i n ate) [, c o l o r] X, V·coord i nate � N u m e r i c type constants, var i a b l es, array vari a b l e s, t h e i r e x p re s s i o n s f ro m

-

32768 to 32767.

Col or � I ntegers from 0 to 15.

C!liiIII C u r re n t b a c k g ro u n d c o lo r.

F U N CT I O N A N D UTI L I ZATI O N

When executed with c o l o r o m i tted, a d o t i s m a r ked w i t h t h e same c o l o r as t h e bac kg ro u n d c o l o r. As a res u l t , i f somet h i n g i s d rawn at a spec i f i e d locat i o n w i t h a c o l o r other t h a n t h e backgro u n d c o l o r, i t l ooks as i f a po i nt at t h e same locat i o n was o n l y e rased. . W h e n a color i s spec i f i e d , i t f u n c t i o n s exact l y t h e same as when a c o l o r i s s p ec i f i ed by PS ET. . See page 154 for ST E P spec i f i c at i o n s . • See PSET for a p ro g ram exa m p l e.

_ P R I NT ( p r i nt)

D i s p l ays n u m e r i c d ata or c h a racter data o n the text sc ree n .

FO R M AT

P R I N T ex p re s s i o n [separator] [ex p re s s i o n] [separator] [ex p re s s i o n] . . . . . Express ion � N u m e r i c t y p e o r s t r i n g type c o n stants, va riables, array Separator

vari a b les, t h e i r e x p res s i o n s. � Com m a ( , ) o r s e m i c o l o n ( ; )

.

F U N CT I O N A N D UTI L I ZAT I O N Expression (data) writing method

..

N u me r i c type con stants, n u me r i c type a n d s t r i n g type vari a b l es are w ritten as t h ey a re, and stri n g type con stants are w r i tten i n s i d e q u otat i o n marks ( ). "

"





• •



• •



• •

• • • •

• •



• •

• •

• •

• •

• • • • •

• •





Separator function

When d ata is p u n c t u ated with a comma (,), spaces are i n serted between the d ata by a 14 d i g i t tab f u n c t i o n , and when i t i s p u n c t u ated w i t h a s e m i ­ c o l o n ( ; ) , i t i s fo l l owed b y t h e n ext data. If a separator i s not written at the e n d , l i n e feed is perfo rmed after the data d i sp l ay. If a separator i s written at the e n d , data of the n ext P R I N T state m e n t c o n t i n ues on t h e same l i n e w i t h o u t a l i ne feed . N u meric data and signs

In rega rd to s i g n s t h at i n d i c ate posit ive o r negat ive, + i s o m i tted w h i l e " - " i s d i s p l ayed a s i t i s . ( I f a " ; " sepa rator i s used w h e n p o s i t i ve n u m e r i c d ata i s d i s p l ayed , t w o s p a c e s a r e i n serted betwee n d ata to p rovide space for a s i g n . "

"

O m itted format

The same res u l t can be obta i n ed by i n p u t t i n g "?" i n stead of P R I N T. Execution exa m p l e 1 0 A$="ABC " : B$= " DEF " 2 0 PR I N T A$ ; B$ 30 PR I N T A$ , B$ 40 PR I N T 5 0 PR I N T " MS X " 60 PR I N T + 5 0 , - 5 0 70 ? "PER SONAL COMPUTER " RUN ABCDEF ABC DEF ---

Result of line 20. Result of line 30. ---- Result of line 40. Result of line 50. MS X -5 0 --- Result of line 60. 50 PER SONAL COMPUTER --- Result of line 70.













..

• _ P R I NT USI N G





( p r i n t u s i ng)

O u t p u ts data to t h e s c reen i n a s p e c i f i ed format.



FO R M AT

P R I N T U S I N G format sym bo l ; ex p res s i o n [ex p re s s i o n] . . . Expression � S t r i n g type a n d n u m e r i c type c o n stants, vari a b l es, array var i a b l es, t h e i r ex p re s s i o n s.

F U N CT I O N A N D UTI L I ZATI O N

T h e va l ue of an ex p re s s i o n i s d i s p l ayed i n a f o r m at s p e c i f i e d b y a format sym b o l . Format symbols f o r c h a racter type data Symbol "I"

E x p ress i o n format and Exe c u t i o n exam p l e O u t p u t s t h e f i rst 1 c h a racter. PR I N T US I NG UN

"\

L...l

i

\"

PR I N T U S I N G ABCDG H I

"&"

JKLM

"\

\ " ; " ABCDE F " , "GH I "

O u t p u ts a l l c h aracter s t r i n g .

10

20

AS= - N o r t h " : BS= " S o u t h PR I N T US I N G

"& Pp l e

RUN N or t h P o l e

S o u t h Po l e

"

; AS , BS



• •

• •



" ! " ; " U n i t e d " , " N a t i on "

O u t p u t s n + 2 c haracters. When data is s m a l l e r t h a n n + 2 c haract e rs, i ns e rt s spaces f o r t h e res i d u a l c h a racters.

n spaces



,

" JK L MN -

• •



• •





• •



• • • •

Format symbols for n u meric type data

" #"

10 PR I N T US I NG -####- ; 1 2 20 PR INT US I NG - ####- ; 1 23 4 5 RUN 12 % 1 2345

• •

. Wh e n the n u m be r of d i g its in a frac t i o n of n u m e r i c data is s m a l l e r t h a n t h e spec i f i e d # n u m b e r, "0" i s added, and when i t i s larg e r, i t i s rou n ded to t h e n earest w h o l e n u m be r.

• •

1 0 PR I N T US I NG - ## . ##- ; 25 . 3 20 PR INT US I NG -## . ##- ; 25 . 345 R UN 25 . 30 25 . 35

• •

The " + " s i g n of n u m e r i c d ata i s i g n o red and t h e " - " s i g n i s c o u n ted a s o n e d i g i t .



1 0 PR I N T U S I NG - ###- ; + 1 23 20 PR I NT US I NG - ###- ; - 123 RUN 123 %- 123



• • • • •

"

. Wh e n t h e n u m be r of i n t e g e r d i g its i s l e s s t h an t h e speci f i ed # n u m ber, d ata i s d i sp layed w i t h r i g h t j u st i fi c at i o n , and if it i s m o re, " % " i s added before t h e data.





Writes # b y t h e n u m be r of n u m e ra l d i g i t s to be d i s p l ayed. Dec i m a l p o i n t is " .

PR INT U S I NG -PO I NT : ### . #- ; 123 . 4 PO INT : 1 23 . 4





E x p re s s i o n format and Exe c u t i o n exam p l e

Symbol

"+"

" + "

i s a d d e d i f it i s a p o s i t i ve n u meral, and " - " i s added i f i t i s a n e g at i ve n u m e ra l before o r after t h e n u m eric data.

PR INT U S I NG " +####- ; 1 23 . - 123 20 PR I N T US ING - ####+ - ; 1 2 3 . - 123 RUN + 1 23 - 1 2 3 1 23+ 1 23-

10

" - " i s added after n e g at i ve n u m e r i c data,

PR I NT US I NG - ###- - ; 1 2 3 . - 1 23 1 23 1 2 3 -

..

+,:-

• " ** "

The s pace before n u me r i c data i s f i l l ed w i t h " * ". O n e " * t h e format ex p resses o n e d i g i t .

10 20

RUN

"

in

PR INT US ING - * * ###### - ; 1 2 3 PR I NT US I NG - * * ###### - ; -234

***** 123 * * * *-234 "££"

Adds "£" be fore n u me r i c data. One "£" in the form at is c o u n ted as o n e d i g i t .

10 20

RUN

PR I NT US I NG - ££ ### - ; 1 234 PR INT US ING - + ££ ###- ; - 1 234

£ 1 234 - £ 1 234 " * * £"

Adds "£" just before t h e n u m e r i c data, and s pace before t h a t i s f i l l ed w i t h " * ".

PR I NT US I NG - * * £ ### . ##- ; 1 2 . 34 * * * £ 1 2 . 34

W h e n t h i s i s spec i f i e d s o m ew h ere before t h e d e c i m a l p o i n t , i t i s d i s p l ayed b y t h e i n sert i o n of c o m m a s between each 3 d i g i t s to t h e left o f t h e dec i m a l p o i n t .

PR I NT US ING - # . ###### . ## - ; 1 23 4 5 . 67 1 2 . 34 5 . 67

" /\ /\ /\ /\ "

D i sp l ays n u m e r i c data by f l o at i n g pO i n t type. corresponds to t h e d i g i t s for t h e exp o n e n t part.

" /\ /\ /\ /\ "

PR I NT U S I NG - ## . ##AAA A _ ; 23 4 . 56 2 . 3 5 E+02



• •

• • • •

• •

• • •

• • •

• • •











• • •

• •

• • • • • • •







• •



_ P R I NT

#

(print n u m be r)

Writes data to a f i l e o p e n ed by an O P E N state m e n t .

FO R M AT

P R I N T # f i l e n u m be r, ex p re s s i o n File n u m ber cmJ 1 � fi l e n u m be r � n u m eral s p e c i f i ed b y M AX F I LES = state­ ment

Expression

cmJ Stri n g type and n u m e r i c type c o n stants, var i a b l es, array vari a b l es, t he i r expres s i o n s.

F U N CT I O N A N D UTI L I ZAT I O N

O u t p u ts d ata to a f i l e opened by an O P E N state m e n t . Execution exa m p l e 10 20 30 40 50 60 70

Opens a file to write-in

OPEN " CAS : DATA" F O R O U TPUT A S # 1 FOR 1 =0 TO 4 R EAD A$ PR 1 N T # 1 , A$ ; N EXT I CLOSE # 1 DATA TOKYO , LONDON , PAR 1 S , PE K 1 N G , N EW YORK -

"

,";

Writes data to a file.

T h i s i s a p ro g ram w h i c h sequent i a l l y writes d ata written in l i ne 70 to cas­ sette tape w i t h a f i l e name "DATA". (See 2-6 F i l e Process i n g .)

• P R I NT

#

USI N G

(pri n t n u m be r u s i n g)

Writes data to a f i l e opened by an O P E N state m e n t i n a spec i f i e d format .

• • •

FO R M AT

P R I N T # f i l e n u m be r U S I N G format sym bo l ; ex p re s s i o n File n u m be r (DJ 1 ;; fi l e n u m b e r ;; n u m eral s p e c i fied b y M A X F I LES = state· ment

Expression

(DJ Stri n g type a n d n u m e r i c type constants, var i a b l es , array var i a b l e s , t h e i r ex p re s s i o n s.

F U N CT I O N A N D UTI L IZAT I O N

T h i s format c a n b e spec i f i ed w h e n d ata i s o u t p u t t o a f i l e. S e e P R I N T U S · I N G f o r a format symbo l .

P S ET [ST E P] (X-coord i n ate, Y-coord i nate) [, c o l or]

X, Y coordi nates (DJ N u m eric type con stants, var i a b l es, array vari a b l es, t h e i r expres s i o n s from - 32768 to 32767. Color (DJ I nt e g e rs f ro m 0 to 15. (!]UIIJ C u rrent fore g ro u n d c a l or.



• • • •

F U N CT I O N A N D U T I L I ZATI O N



Execution exa m p l e SCR E EN 2 FOR x=o TO 2 5 5 PSET ( Xt 1 , 1 0 0 ) --- Draws a PR ESET ( X , 1 0 0 ) --- Erases the N EXT X

See page 154 for STE P s p e c i f ications.





FO R M AT

_





M arks a dot on a g rap h i c mode s c reen .

la





_ PSET (po i n t set)

10 20 30 40 50



dot. dot drawn before.

• • • •

• • •

_ PUT S P R I T E (put spri te) D i s p l ays a spec i f i ed s p ri te pattern at an arbi trary locat i o n on a spec i f i ed sp rite p l ane.

• • • • • • • •

FO R M AT

PUT S P R I TE s p rite p l ane n u m be r [[STEP] (X-coord i n ate, Y-coord i n ate)], [co l o r] , [s p r i te n u m be r] Sprite p l a ne n u m be r � I n tegers from 0 to 3 1 . X-coord i nate � N u m e r i c type co n stants, variables, array variables, t h e i r ex p ress i o n s f rom - 32 t o 255.

V-coord i nate C!Ilm!) N u m e r i c type c o n stan ts, var i a b les, array v a r i a b l es, t h e i r ex pres s i o n s from - 3 2 t o 1 9 1 .

STE P (X-coordinate, V-coord i nate) I!lmII Prev i o u s locat i o n spec i f i ed by the l ast g ra p h i c i n ­ struct i o n .

Color � I n te g e rs f rom 0 to 1 5 . I!lmII C u rre n t fore g ro u n d c a l or. Sprite n u m be r � Fo r 8 x 8 dots, it is f rom 0 to 255. Fo r 16 x 1 6 dots, it is from 0 to 63.

I!lmII Same as the sprite p l a n e n u m b e r



F U N CT I O N A N D UTI L IZAT I O N



Execution exam ple

• • • • • • • •

1 0 SCREEN 2 20 SPR I TE$ ( 1 ) =CHR $ ( &H 1 8 ) +CHR$ ( &H3C ) + CHR$ l &H66 ) +CHR $ (&HDB) +CHR$ (&HE7 J +CHR$ ( &H7E ) + CHR$ ( &H2 4 ) +CHR$ (&H42 ) 30 X=O : Y=O : DX= l : DY=l 40 PUT SPR I TE 0 , ( X , Y ) 1 5 0 X=X+DX : Y=Y+DY 60 IF X> 2 5 0 O R X 1 9 0 OR Y

Larger

X> Y, X$ > Y$

< >, >
Y, X$ > < Y $

< =, =
=, = >

Large r or eq u a l

X > =Y, X$ > =Y$

• •

• •

• •

• •



• • •





ID

• •





• • •

• • •









• •

LOG I CA L EXP R ESS I O N S

Log i cal ex p res s i o n s perform l o g i c a l operat i o n s between n u meric type con stants, variables, and f u n ct i o ns. Log ic a l o pe rat i o n ... Converts d ata to a n i n teg er c o n s i dere d as 1 6 bit b i n a ry, a n d perfo rms a n operat i o n for each co rres p o n d i n g bit. Log i c a l operat i o n N OT (negat i o n)



• •





L

A N D (log i c a l p ro d uc t)

0

1

x AND Y

1

0

0

0

0

x

Y

1

0

0

0

0

x

Y

x XOR Y

1

0

1

1

1

1

1

1

1

1

0 x OR Y 1

1

1

0 1

1

0

0

Y

x EQV Y

1

0

0

0

0

x

Y

x IMP Y

1

0

0

0

0

1

1

0

1 1

1

1

I I

0

0 1

I

1

x

0

I M P ( i m p l i c at i o n)

0

y

1

0

EQV (exc l u s i ve O R negation)

NOT X

x

0

XO R (exc l u s ive O R)

I I

1

0

O R (logical sum)

I

x

I I





Log i c a l o p e rat i o n res u l t f o r each b i t

1

0 1

1 1

C H A RACT E R EX P R ESS I O N S

For o perat i o n s between stri n g t y p e con stants, variables a n d f u n c t i o n s, o n l y a d d i t i o n i s effecti ve. Example PR I N T " ABC "+ " XYZ " ABCXYZ

ID



4. CO lO R CO D ES







• • •

5. M E M O RY M A P SAN k

&HOOOO

. .



1





MSX-BASIC ROM .

. .

.

.



.

• •

&H8000



User area 2 When 64 K byte RAM is installed

&HCOOO User area 1 &HF380 &HFFFF

When 16 K byte RAM is installed

System area

See t h e O pe rat i n g I n struct i o n s for t h e R A M capac i ty.



• • • • • •





• •

U S E R A R EA C O N FI G U R AT I O N

&H8000 (&HCOOO) Program area



Variable area



Array variable area



Free area







• •



• • •



• •





Stack area Character string area File control block &HF37F Program a rea A p ro g ram i s sto red w i t h l i n e n u m bers. Variable a rea Stores n u m e r i c type data and po i n te rs for stri n g type d ata. Array variable area Stores array var i a b l e data. Stores t h e pointer for t h e c h aracter stri n g area i f i t i s a s t r i n g type. Free a rea U n u sed area. The s ize can be known w i t h the FRE f u n c t i o n . Stack a re a The stack area is u sed to save a ret u r n address. Character string a rea Stores a c h aracter stri n g i n c l u ded in a stri n g type var i a b l e or array var i a b l e. The s ize can be spec i f i ed w i t h a C LEAR statem e nt. File control block U sed d u r i ng f i l e I n p ut/O utput.



6. 1/0 P O RT A L LO CATI O N : ;9t i l j �at i O�·, t Pbrt [ 0. RS-232-C

Pri nter

VDP

PSG

PPI

& H 80

I�

l'�fj

,j'Jt:W>\h'�' A'Pp I i C'� i

Data read-o ut/write-in

0

n,,!,

r.'t"

�.

!l

. ..

&H81

M ode s e t (d u r i ng write- i n ) Stat u s (d u r i n g read-out)

& H 90

Stro b e ( d u r i n g w r i te - i n) Stat u s (d u r i n g read-out)

&H91

Data w r i te- i n

& H 98

D ata read-o ut/w rite- i n w i t h v i deo R A M .

& H 99

C o m m a n d , add ress set (d u ri n g write- i n ) Stat u s (d u r i n g read - i n )

& H AO

Add ress latch (w rite- i n)

& H A1

D ata write-in

& H A2

D ata read-out

& H AS

D ata read-o ut/write-i n for port A ( M e m o ry s l ot sel ect) u se.

& H A9

Data read-out/write-i n for port B (keyboard scan) u se.

&HAA

D ata read -outlw r i te-i n f o r p o rt C (cassette).

&HAB

M od e set (write-in)

. 1/0 add resses f ro m & H OO to & H 7 F are not used. Add resses other than t h e above add resses of t h e add ress among & H 80 to & H F F a re reserved for system u se.

• •







• • •



• •



• •



• •

• •



• •

• •

• •









• •

• • •

• •

• •



,

Sony Corporation

P(injed "in'Japan

3-795-899-11 (1)