Page 10
4. Numbers and variable Constants Numeric constants Variables Variables Array conversion Type Expressions and operators Arithmetic operators Interger division and modulus arithmetic Overflow and division by zero Relational operators operators Logical Functional operators String operators 5. Graphics Screen mode Screen mode Screen 2 mode Screen 3 mode...
Page 11
Sound Play (Octave) “O”’ “T” (Tempo) “L”" (Length) “S”’ (Shape) ‘M”’ (Tone) “R” (Rest) (Volume) ‘VV’ channels of sound Using a Tone generator control Amplitude control control Mixer Register Envelope Period control register Shape register PSG block diagram 7. MSX-basic 8.
Page 15
Unpacking and sound cable video cable and data cable, computer, recorder packed foam cushioned carton. in a Please save packaging materials case unit you must ship maintenance repairs. and Sockets Ports jack Video Sound jack jack Expansion bus Printer port Expansion bus Connects external bus to the computer.
Page 16
Power cable connection Before connecting the sure the power switch on please check power, side left units is off. cable Connect to wall outlet. power Power on first connected the monitor After have turn on your computer to T.V. power then turn the computer power switch position.
Page 17
Installation System need computer and 220V electrical outlets connect you will system, your set. monitor, T.V. Choose comportable position for operation, away from any source extreme heat etc). (sunlight, heater, reasonable The computer designed provide against such inter- protection interfer- ference residential installation.
Page 18
How to with Data Recorder. connect cable Attach data recorder 8 pin side panel jack computer. other consists three cables. case, cable connects data recorder. Black input White cable connects data recorder. output cable data recorder. connects input Computer Black (REM) White (EAR)
Page 19
Installation System need outlets 220V electrical you will connect your computer system, set. monitor, or T.V. Choose operation, away from any source extreme comportable position (sunlight, heat heater, etc). reasonable The computer against such designed to provide inter- protection there interfer- residential installation.
Page 20
How to connect with Data Recorder. cable one end Attach data side panel recorder 8 pin jack at computer. consists three The other end cables. case, Black cable connects data recorder. input White cable connects data recorder. output cable data recorder. connects input Computer...
Page 23
Programming generally done sending instructions the computer through instructions and the computer's responses are keyboard. Your visible on a connected which screen, computer. keyboard should somewhat familiar to you computer’s look because resem- that bles of a typewriter. However, contains additional keys that are keyboard...
Page 24
Control Keys this pause the program execution. key will Pressing STOP this resume the execution. will Pressing again Key. this character simultane- CONTROL Pressing CTRL ously tells computer to work special function. (See Appendix this terminates the STOP key simultaneously will Pressing program execution and...
Page 25
Editing Keys when wish characters This used to insert within line. key is The key toggle switch for insert mode. When insert mode acts like a size inserted reduced and characters cursor Characters position. the cursor current right move right cursor inserted.
Page 26
Function Keys at the and each located marked keys on keyboard, top row keys letter because with labor-saving devices they allow "F”. to instruct They instead used function frequently pressing only computer perform having to type many keys. each function brief description list of performs...
Page 27
continue” command used totell the This conttreturn computer executed program execution after last line. this With LIST. period next to only (with a last line were working on (whether programming, editing, the screen. be displayed on etc.) will This command the standard similar to command.
Page 33
Screen where MSX-BASIC Editor lets you change line line the screen. Screen at a time. The change Edi- only tor can be used after an and before a prompt appears command issued. the cursor and the control keys edit- using the screen, around can move...
Page 34
let's correct the ward line 10. First use the cursor MARIO Key's line 10 and then the direction RIGHT direction to move move letter cursor to “E” of "MERIO” letter change the Press word to MARIO”, then press RETURN. “A"’ stored line will...
Page 35
mode “INSERT” and the cursor press the become will half tall before. This INS, key and press means mode. “INSERT” RETURN. Type IS”. just inserted the words the steps used have Follow verify “SHE 10 and line will see: LIST PRINT “SHE MARIO”...
Page 36
mode "COPY" have cleared. RETURN. Now Type new, done Let's following line. enter PRINT “HE MARIO" RETURN. 1" 10" the cursor Then move to up direction line letter number change the 10 to “2” line RETURN to Press line just line 10 to duplicated have...
Page 39
featured with up to 14 digits double precision MSX BASIC is accuracy arithmetic means arithmetic operations function. This no more generate strange round errors that confuse novice users. trancendental functions are this also calculated with Every accuracy. faster also available for execution.
Page 41
Numeric Constants either numbers. Numeric may be single precision or double precision constants constants are stored Single precision numeric with digits precision, numeric constants are printed with up to precision. Double precision digits stored with 14 digits printed with up to 14 digits. Double precision precision the default for constant...
Page 42
Variables are names used Variables values used program. The represent a BASIC variable may be value assigned may be of a explicitly by programmer, or assigned as the program. Before variable calculations assigned result assumed value to be zero. a value, characters are variable names...
Page 43
There second method which is a variable types may be declared. The MSX- statements included BASIC DEFSTR, DEFSNG, DEFDBL in a DEFINT, declare the types for certain variable Refer to program to names. description statements. these Variables Array table variable values referenced name.
Page 44
Conversion Type When MSX-BASIC will constant from necessary, convert numeric type to another. The following rules and examples should be kept mind. Ifa numeric constant numeric variable different equal to type will stored number type declared variable name. type, string variable numeric value vice versa, equal to...
Page 45
When converted to fractional portion floating-point integer, value truncated. Example: 10 C%=55.88 PRINT C% first double precision variable assigned single precision value, only will the converted digits of This because number valid. only digits supplied with were single precision value. accuracy Example: A!=SOR(2)
Page 46
Arithmetic Operators are: The arithmetic operators. order precedence, Operation Sample Expression Operator Exponentiation AAN: Negation Multiplication, Floating- Division point Addition, Subtraction change the the operations are order which parentheses. performed, use parentheses, the within parentheses Inside usual Operations first. performed maintained.
Page 47
Overflow Zero Division expression, division encountered, the evaluation of during zero “Division zero” error execution message displayed program termimates. overflow occurs, “Overflow” error execution displayed message terminates. Relational Operators values. Relational used to The result operators are comparison compare “false” either “true”...
Page 48
Operators Logical tests operators perform Logical on relations, multiple manipulation, or Boolean operations. The logical operator returns either a bitwise result which “true” (not zero) or “false” operations are (zero). an expression, logical per- arithmetic formed after relational operations. The outcome logical opera- listed...
Page 49
XIMPY oo==x Just relational used decisions operators can to make regarding program false and return two or more relations connect true flow, logical operators used value to be decision. in a Example: F<4 D< THEN I>10 OR K<O THEN P THEN two's work converting their...
Page 50
Functional Operators function used predetermined expression to call a operation that that reside MSX-BASIC "intrinsic”’ functions performed on an operand. such root) or SIN (sine). (square system, that are written also allows functions MSX-BASIC “’user-defined”’ pro- descriptions for “DEF FN". grammer.
Page 53
four different kinds display mode this There screen compu- another Graphic mode. mode and Text ter, two Screen mode Screen mode modes and can display lines with up to Text line. 40 characters each characters are These formed matrix which a 5x7 dot dot font.
Page 54
Screen mode This graphic mode called multi-color mode. 64x48 colored which consist blocks dots. Each can be any sixteen colors. block Color These are sixteen colors computer. Each signified with color code. color codes are: color Now, Transparent Black Green Green Light Blue...
Page 55
Border, Background Color Foreground the screen's We may think the three display layers, on top other. there there bottom Border, Back ground (which above Screen mode covers the Border screen totally; graphic “grows down” Border bottom size “exposes” screen.) Above Foreground which might be described Background comes that...
Page 56
Circle the computer type begin exploring graphics capability lines, after each following completed: pressing RETURN SCREEN 2 (128,80), 60, CIRCLE PAINT (128,80), GOTO see the program and circle Now, will yellow appear on then the computer's the screen will filled yellow in by let's...
Page 57
Paint PAINT (128,80), command. This command line introduces PAINT This certain tells its “paint brush” areas. computer to fill have line instructed to circle just fill computer outlined order to paint must line an object give (fill) numbers parentheses) which coordinates computer inside...
Page 58
program to read: Change SCREEN 2 (128,96), 3.14, 6.28 CIRCLE GOTO following result: will give RUNning program see the bottom half Should change should circle. line...
Page 59
3.14 (128,96), 80, 6.28, CIRCLE see that the top half circle drawn. Another way You will whole circle with line changes constructing following...
Page 60
(128,96), 80, 6.28 CIRCLE 13, 0, who remember that 3.14 Those will recall your geometry and 6.28 (approximate). The two numbers which is 2pi follow (#13) where color on line number tell computer end the computer to begin and circle (how much would like cirlce...
Page 61
the three How did commas after get an ellipse? Well, number to inform that we are necessary will computer be specifying the shape and are starting ending points therefore them The computer knows what blank. to do leaving that when we leave blank.
Page 62
Line Drawing LINE that have seen what do with circles computer can your at lines and boxes. The com- paintbrush, we'll take a look does puter has the same simple method for drawing them circles. to clear the program First, type memory using...
Page 63
40)-(200, LINE (50, 150), the computer draw from This line tells a line position the screen and points down from points from left margin on that points from the top over to position left margin number designates the and 150 points down from top.
Page 64
40)-(200, LINE (50, 150), 8,BF and paints will see that the draws the same Now, program color outline. inside with same DRAW command door to an actual mini- DRAW actually within called “Graphic Macro Language language BASIC (GML)” the computer's start clearing memory.
Page 65
“U50 R50 D50 L50” DRAW T$ GOTO defines the This second way of first we wish object DRAWing and then and then in T$ DRAWS T$. DRAW, places can draw Please note diagonally using right diagonally up =diagonally down right diagonally down left left...
Page 66
Sprites that we have learned how to deal with shapes, simpler examine the more complex type will generation graphics understand generation. The best way to called SPRITE sprite create and easily control. genie imagine magic encountered commands we have Unlike graphic till now-...
Page 67
SCREEN 2 FORT=1TO8 READ S$ =S$ (VAL A$)) ("&B” CHR$S NEXTT (1)= S$ SPRITES PUT SPRITE 0, (128, 96), 8, GOTO 00011000 DATA 00111100 DATA 01111110 DATA 01111110 DATA 01111110 DATA 01111110 DATA 00111100 DATA 00011000 DATA the screen. This appear at the center should ball...
Page 68
100-170: These design the clothes that the genie Lines lines will wear language, they contain straighter design sprite's shape). Each line data statement has eight charac- represent the ters size sprite. The zeros They that the shape make while display transparent point ones are the...
Page 69
PUT SPRITE (128, 96), 8, read this be able to follow like sentence, (It's a long you'!I it): line, SPRITE which specified at #1, on that the center position (128, 96) which plane (surface) using color #8. The sprite to screen, command, (Note:...
Page 70
screen forx=1t0 30 read 40 restore s$=s$ +chr$ (val ("& b"’+ a$)) sprite$ (128, put sprite 96), next goto 100 data 11111111 first that the and then Notice fills fills a box by 16, computer alongside this to make by 16. another when careful manipulation...
Page 73
There also a very powerful music built-in to synthesizer computer that used simple BASIC easily com- mands this music. addition to produce power that most important to realize do its synthesizer, What this work main microprocessor. independently that the synthesizer to do means you can program...
Page 74
PLAY command that opens the this synthesizer BASIC door statement: BASIC PLAY. example, keyword Typing “CEG” PLAY pressing the return produce musical tones followed key will do-mi-sol from your the speaker on your televi- computer through results could achieve sion or monitor. writing same program with...
Page 75
TEMPO “T” line 10 to read: change Now, "T3201CEG" PLAY The program the same note heard will before but at now play rate. much What “T32” before slower you did by typing set the “oTCEG” TEMPO or speed music. The values for “T”...
Page 76
the same note example: played on piano trumpet pitch at the have two distinctly different sounds. will same These commands allow shape the notes are creat- the same way. “S" (SHAPE) ’S” command the shape controls note. As illustra- line tion to read: this,...
Page 77
“R” (REST) also insert pauses between notes using “R” command. line to read: Change “o4CRIER10G" PLAY C” causes the This then note to silence heard for a play then the then while ’E” note plays, shorter silence, period C” then the note followed immediately "G”' note again.
Page 78
three notes What hear combination to being played each channel chord. also have create something play the others entirely different from create melody harmony music create. part than the Other statement which allows create musi- PLAY use the cal notes, statement to directly cotrol SOUND...
Page 79
Tone control generator tone channels The PSG each The frequency for channel obtained counting down times clock by input value wanted. frequency example: Desired Value 1789773/(16*frequency) /256 Desired Value Remainder > Lowregister of < /256 < Desired Value > High register Integer The high...
Page 80
control Amplitude we used should notice previous example program, reg- ister 8 to enable channel has three to volume The PSG channels control different separate amplitude register Channel Register Each channel volume from 9 to can have with 15 being loudest.
Page 81
Register channel Noise used Tone channel LILLUN logical value Bits channel disabled enabled channel example: 11111110 7,&B SOUND tone channel will turn on 7,&B 11110110 SOUND tone channel enable both noise and will Envelope period control register patterns can be accom- generation complex envelope fairly...
Page 82
Shape register can select 9 different shapes envelope period output, register programming shape Selected value Shape 0,1:2,3:9 4,5,6,7 example: SOUND 13, down according to enve- create tone will modulating up when the enable 4 of register lope period (SOUND 8, 16) is set.
Page 83
block diagram REGISTER Tune Fine Channel A Tone Period ‚ Coarse Tune Fine Tune Channel B Tone Period Coarse Tune Fine Tune Channel Tone Period Coarse Tune Noise Period Period Control IN/OUT Tone Noise Enable 10B/10A| L3/L2 Channel A Amplitude L3/L2/u/|LO Channel ó...
Page 87
an extended standard MSX-BASIC is version to Microsoft Basic 4.5, which version includes to graphics, music various supports peripherals attached Gener- Home Personal computer. follow which ally, MSX-BASIC is designed to GW-BASIC standard Basic 16-bit machine world. major effort made whole system as to make and expandable...
Page 88
Returns absolute the expression without value its sign (+or -). always positive double precision number. answer 1O0FOR|=-2TO02 PRINT "ABSOLUTE OF”; VALUE IS"; NEXT ABSOLUTE VALUE ABSOLUTE VALUE OF1-1 IS OISO ABSOLUTE VALUE ABSOLUTE VALUE ABSOLUTE VALUE OF 2 (X$) Returns that character numerical value...
Page 89
Returns the arctangent radians. Result the range pi/2. —pi/2 may be any numeric type, but evaluation always per- expression formed double precision. 10P=3.1415926535# PRINT ”X (DEG.) ATN (X)” STEP “ USING"# PRINT INT(I/P+180); PRINT ATN(I) NEXT (DEG.) 5609821 1609574 -89863709304242 1.0830346193243 1.1921125187293 1.2626272556706...
Page 90
AUTO [< number AUTO line >[, < increment >] number line automatically after every carriage return. generate and increment each subsequent <line number line AUTO begins numbering > <increment>. number> The default both value <Line number is fol- <increment> increment lowed comma but last...
Page 91
(<n>) BASE rrent base address number decimal each table of VDP (Video Display Processor). The description follows next. table base text mode. name meaningless base table text mode pattern generator meaningless meaningless table base text mode. name color table text mode. base table for text mode.
Page 92
BEEP the same beep sound. with outputting generate Exactly $ (7). 10FORI=0TO5 BEEP NEXT NEXT 50FORI=0TO5 PRINT CHRS$ NEXT...
Page 93
”; BINS Returns string which represents the binary value decimal argument. -32768 numeric expression the range to 32767. n is negative, two's complement the same as form used. (65536 BIN$ BIN$ That (-n) -n). answer becomes to be zero number. suppressed 10A=123:B=234 (A);...
Page 94
BLOAD >] [< “< :[<file LR], device > offset BLOAD >] name machine language program from specified device. To load a option spec- the address loading, program begins execution automatically from after ified, BSAVE. specified which machine language be stored at memory location The loaded will...
Page 95
Ì BSAVE #’ >], end address > >, < > <top address BSAVE “’< device < file name <execution address>] device. specified memory location to memory image save address <end address> address <top address> are the area to be saved. omitted,<top address>is regarded as execution address>...
Page 96
CDBL(X) Converts double precision number. precision of before conversion, same as answer 10B1=2.333333# !/1.7) CDBL PRINT A# 1.3725470588235 CHR$ character whose used Returns code ASCII CHR$ is a string commonly send character the opposite console, etc. special (X$). This the character correspond that not displayed but control code,...
Page 97
CINT Converts number truncating the fractional portion. integer -32768 Xisn't the range 32767, ‘Overflow’ error occurs. 10B#=1.23456789123454 CINT (B PRINT A%, (2.3333#) CINT PRINT...
Page 98
CIRCLE <radius> [‚<color>] <start CIRCLE STEP > angle >, (X,Y) <{(X,Y) <end >] angle [,< ratio >] draw an ellipse with center and radius indicated first of its arguments. the center coordinate circle on or STEP specifies (XY) (X,Y) screen. The <color>...
Page 99
CLEAR [<string space > <highest location >] CLEAR numeric variables to zero, string variables to close null, files, set the end optionally to memory. open > < string space string variables. Default size Space bytes. location < Highest > memory location available highest by BASIC.
Page 100
CLOAD? [’<file >"] CLOAD? name cassette with verify a BASIC program on CLOAD? memory. gener- used right after command tht the CSAVE to confirm ally program memory stored tape surely. CLOAD? “SAMPLE” FOUND: SAMPEL CLOSE >] <file number >] [.[#<file number CLOSE the channel release the...
Page 101
clear Valid modes. screen screen. SCREEN 20 FORI=0TO (1)*226) =INT (RND 192) =INT (RND (1) 226) (RND (1)+ (1)*192) INT (RND COLOR Y1)-(X2, Y2), 8O LINE (X1, NEXT I= 0 NEXT GOTO...
Page 102
COLOR <border [<foreground color>] color color >] COLOR <background >] the range Actual can be define color screen. argument each follows. color corresponding to value three color not allowed. Omitting codes transparent black medium green light green dark blue ONonnRWUnN— blue light dark red...
Page 104
CSAVE <baud rate>] name>”’ CSAVE “’<file the cassette a BASIC file save tape. program files saves the binary format. take up more BASIC file in a compressed ASCII that space, but files be format. some access ASCII require types exam- intended to be must be saved...
Page 105
CSRLIN vertical coordinate Returns cursor. current statement. About horizontal coordinate cursor, About the horizontal vertical coordinate LOCATE cursor, statement. first print csrlin line — csrlin fourth line — print line print csrlin seventh —...
Page 106
DATA <list of constants > DATA …. constants that accessed numeric statement store by READ string (s). nonexecutable and statements may be placed anywhere DATA pro- statement constants as A DATA may contain will fit line gram. many number used commas), and any statements may be...
Page 107
10FORI=0TO4 READ A$ PRINT (5);A$ NEXT READ A, B, PRINT A, B, WANT DATA DATA HAVE DATA COMPUTER” “YOU, DATA FROM AVT..! &010, &B10 DATA 10, &h10, WANT TO HAVE COMPUTER YOU, FROM...
Page 108
<name> [<parameter>, < function <parameter>…] definition> define function written the user. that name must legal variable becomes < name > This name, proceded name. the name the those function. Comprised variable function name that definition are to be replaced function called.
Page 109
DEFINT/DEFSNG/DEFDBL/DEFSTR DEFINT/DEFSNG/DEFDBL/DEFSTR < ranges of characters > declare variable type integer, single precision, double precision, or string. DEFINT/SNG/DBL/STR statements declare that the variable names beginning that with type variable. However, type decla- character(s) specified will character always takes precedence ration statement DEFxxx over...
Page 110
DEFUSR [< >]= <start address > DEFUSR digit address assembly language subroutine. specify starting the number may be any digit from > corresponds < digit digit whose address routine omitted, DEFUSR being <digit> specified. assumed. start address> the starting address The value of <...
Page 111
DELETE DELETE start number>] line [-<end [< >] line number delete program lines. returns command BASIC after executed. always level DELETE number exist, line does < function > call’ error occurs. ‘Illegal 10A=1 20B=2 =A+B 40D=A’B 60F=A-B PRINT A,B,C,D,E,F 30-60 DELETE list 10A-1...
Page 112
subscript, < variable name > (maximum values of subscripts and allocate maximum values array variable storage specify accordingly. used without statement, the maximum value array variable name greater than assumed to be used of its subscript(s) subscript that range’ error occurs. The minimum maximum specified, ‘Subscript out value...
Page 113
DRAW <string DRAW expression > draw figure according to graphic macro language. language commands The graphic macro are contained string expression. when The string defines object, which drawn executes the BASIC DRAW examines the statement. value and interprets During execution, BASIC string commands...
Page 114
commands The following two the above movement prefix may precede any commands. plot Moves, but doesn't any points. finished. Moves, but returns original position when The following also available: commands Sets angle where from is O degree, range 180, 270. 2 is 3 is Sets...
Page 115
like these can be 123 or all of commands, argument constant where be '=<variable>;' <variable> numeric variable. The name when variable this way, command. semicolon(;) required between semicolon Otherwise, commands. Spaces are optional ignored could use variables move command this string.
Page 116
terminate command program execution, close files return to level. statements may be placed terminate anywhere program to execu- tion. does not to be Unlike STOP statement, cause a BREAK message statement printed. An END of a optional but this case program files.
Page 117
ERASE < variable name >, < variable name ERASE >… eliminate from arrays program redimensioned previously allocated Arrays may be after they ERASEd, or used made to other purposes. memory may be an attempt space array first 'Redimensioned redimension without array’...
Page 118
ERL/ERR When an subroutine entered, the contains the variable error handling contains the number error code for error. And variable line line used which detected. The variables error usually THEN trap statements to direct program flow routine. error the statement that caused the direct mode statement, will...
Page 119
'GOTO ERROR ON ERROR GOTO 1°999;A “+ INPUT PRINT A <1 1000 A> 5OIF A ERROR THEN GOTO 'ERROR-GOTO <> THEN ” * PRINT UNPRINTABLE ERROR” “ PRINT IN —"; RESUME NEXT ON ERROR GOTO * IF 1°999? 500 1999? 2000 2000 UNPRINTABLE ERROR *IN-50...
Page 120
code ERROR error < > simulate the occurrence an error or to allow error codes to be defined user. value greater than and less than error code must of < > 255. value error code equals an error code already <...
Page 121
means the base Returns’e'to the power of X.‘e' natural must be < logarism. 145.062860858862. overflows, ‘Overflow’ error printed. message 1OPRINT” EXP(X) LOG(EXP(X))" 1=.4 STEP .2 PRINT USING “’#.# |; EXP #84.HHH", (|); PRINT LOG(EXPI()) NEXT (EXP(X)) EXP(X) _.39999999999985 1.492 _.59999999999982 1.822 2.226 .79999999999987...
Page 122
Returns equivalent integer (fraction truncated). part FIX(X) does between that The major difference SGN(X)+INT(ABS(X)). return next lower number negative =-1.2345 1.2345 STEP .5 FOR A PRINT USING “’#4.HHHH"; A; B = FIX PRINT USING “##”; =INT(A) USING “’##";B PRINT A:END NEXT -1.2345-1-2 -0.7345...
Page 123
NEXT >= Z>] <variable >= < [STEP [[< NEXT variable >] <variable >] variable can be integer, single-precision or double-precision. < > allow series of instructions to be performed number in a loop a given times. first < variable > is used counter.
Page 124
case the variables) statement may be omitted, which NEXT NEXT statement match recent statement. statement will most NEXT encountered without before statement, FOR' corresponding a 'NEXT issued and execution terminated. error message STEP PRINT NEXT I:PRINT 40 FORI=O STEP 5 “###";...
Page 125
(" (X)/FRE ’') returns the number Arguments dummy bytes arguments. used memory not being by BASIC. returns the number used memory which can be bytes for BASIC FRE(O) returns the machine program, text file, language file, etc. FRE(" program ”) number more details, to Appendix...
Page 126
GOSUB <line number> GOSUB number RETURN [<line branch at<line number>and return from sub- subroutine beginning, routine. the subroutine. subroutine may be called number first line line < > is times subroutine may be called from within number program, Such nesting subroutines limited only available...
Page 127
<line number>. Only one space between allowed GOTO PRINT “YOU”;: GOTO PRINT “I”; PRINT “LOVE”;: GOTO PRINT “AVT MSX"; PRINT “COMPUTER":END “,::GOTO PRINT ILOVEYOU, AVT MSX COMPUTER...
Page 128
HEX$ Returns represents the value string which hexadecimal decimal argument. ‘n’ expression -32768 numeric to 32767. “n” range negative, the two's complement from used. That the same as is, HEX$ (-n) HEX$ (65536 -n). The answer becomes to be suppressed leading zeros.
Page 129
IF-THEN-ELSE IF-GOTO-ELSE statements statements < expression > THEN < > ELSE < > <statements <statements > GOTO ELSE <expression > > based returned decision regarding program flow make result expression. the result clause < expression > is not zero, GOTO THEN exe- number...
Page 130
number IF-THEN statement followed line direct mode, an by a results unless number ‘Undefined statement with specified line line’ error entered previously been indirect mode. “ INPUT “INPUT No."; PRINT" PRINT “ABC” IF N = THEN PRINT “DEF” THEN IF N PRINT “GHI”...
Page 131
INKEY $ Returns either one character character read from string containing key- echoed and characters board or null string pressed. will key is characters are passed through program except for which ter- minates the program. end” PRINT “Hit space “ =INKEYS:IF THEN ”...
Page 132
Returns the the range byte read from must 255. port complementary function to statement. number above and functions, port handled with 16bit statements number Z80's that accesses I/O port with to support capability register [BC] standard does those extended However, not support pair.
Page 133
INPUT [*< prompt string <variable>, < variable> >"’;] INPUT …. allow input from keyboard during program execution. When statement encountered, program execution INPUT pauses printed to indicate waiting for question data. “< prompt program mark >” is printed before the question included, string string...
Page 134
causes the message with too many items Responding to INPUT “’?Extra ignored”’ to be printed and statement to be executed. next list INPUT “A ”;A,B PRINT ?Extra ignored with too few item two question marks to be causes Responding to INPUT wait next data...
Page 135
INPUT # <file <variable> >, <variable number INPUT >.…..] channel and assign them read data items from to program specified variables. file The type data must match type specified < variables >. state- mark printed with INPUT Unlike statement, question INPUT ment.
Page 136
INPUT INPUT [#]< number file >) Return.a characters, read number of n from < > file. file string number which the file OPENed. 10 'PASSWORD “MSX"+'ESC'KEY “MSX"+CHR$ (27) “Password PRINT “; INPUT $(4):PRINT A$ allowed <> PRINT” You !”:GOTO THEN world! Welcome to PRINT:BEEP:PRINT"*...
Page 137
INSTR INSTR ([N], Searches first returns the occurrence Y$ in X$ position string which the sets the match found. Optional offset position for starting search. the range must 255. >LEN X$ is null or (X$) cannot be found or returns null, INSTR is null, only...
Page 138
<= Returns largest integer statement. Compare to X", PRINT “INT(X)" 1=-2.4 PRINTI, INT NEXT INT(X)
Page 139
ON/OFF/STOP INTERVAL activate /deactivate trapping of time interval a BASIC program. must be executed to activate trapping time inter- statement INTERVAL ON number line After statement, specified val. INTERVAL statement then starts every time BASIC statement GOSUB INTERVAL number line a GOSUB check time...
Page 140
#>''< < ” function key string characters > the range string to specified function key < function must key # > characters. < string characters must be within 15 > “LOAD” auto color list auto goto LOAD list goto KEY LIST the contents function of all...
Page 141
ON/OFF/ STOP activate/deactivate trapping specified function key BASIC program. statement must executed A KEY(n)ON to activate trapping function key. After number statement, line KEY(n)ON specified GOSUB statement then every time BASIC starts new statement check to will number pressed. line specified key will perform...
Page 142
GOSUB 80, 90, 100, 110, 120, 130, 140, 150, 160, 170 ON:KEY(2) ON KEY(1) ON:KEY(4) ON KEY(3) ON:KEY(6) ON KEY(5) KEY(7) ON:KEY(8) ON:KEY(10) ON KEY(9) GOTO 1:GOTO 2:GOTO :GOTO :GOTO :GOTO :GOTO :GOTO :GOTO 9:GOTO 170N=10 “ USING PRINT KEY IS DEPRESSED";‚N RETURN DEPRESSED...
Page 143
ON/OFF 24th turn on/off function line of text screen. display on color auto list goto LEFT LEFT $ (X$, Returns characters leftmost string must comprising greater than the entire returned. 255. range LEN (X$), string (X$) returned. 1=0, a null string (length zero) INPUT A$...
Page 144
(X$) Returns the number characters characters and blanks Nonprinting counted. daewoo 10 A$ computer” PRINT LEN(A$) <variable> <expression> [LET] variable. assign value an expression to when assigning i.e. the sufficient Notice word sign optional; equal variable name. an expression to 1OLETA= 10:PRINT A 5:PRINT A...
Page 145
LINE [ee 1) < color code >] STEP v1)|l |sTEP (x2, v2)| p41, draw detail of line connecting two specified coordinate. <coor- dinate SPRITE statement. specifier>, description at fills specified, draws rectangle. ’B' rectangle. specified, 'BF" SCREEN 2 STEP 3 95-I)-(131+, 95+), LINE...
Page 146
Typing CONT returns level taneously. BASIC statement. execution at resumes LINE INPUT “ * YOU PRINT” PRINT CHR$(34); "&";CHR$(44) ” * INPUT" PRINT BY ‘LINE INPUT A$ LINE ="; PRINT "&, YOU CAN PRINT BY 'LINE INPUT" “AVT”, MSX “AVT”, MSX...
Page 147
LINE INPUT >, <file <string variable > number INPUT LINE read entire characters), without delimiters, from line (up to sequen- string variable. tial file file number the number which < file > is OPENed. the name which the line variable string variable to will >...
Page 148
LIST > [< [-[<line number >]]] line number LIST To list all or part program. number both line < > parameters are omitted, listed, beginning program at the lowest number. line > first that < line line is listed. only number specified, -”...
Page 149
LIST [<line number> [<line number>]]] LIST list or part of command printer. (See program on LIST the parameters) details LOAD >“ “<file LOAD name [,R] load file from device. a BASIC program files closes deletes the current program from memory. LOAD open data files remain...
Page 150
LOCATE [<X>][,< cursor display switch LOCATE [,< >] >] character < cursor display switch > can be speci- position for locate PRINT. fied only text mode. O:disable cursor display 1:enable cursor display 10 A$ "ABCDEFGHIJKLMN” CLS: FOR I-1:PRINT LEFTS(A$, LOCATE NEXT ABCD ABCDE...
Page 151
greater than then natural logarithm of Returns must zero. X. X 1=10 STEP PRINT LOG(";1;") “;LOG(I) NEXT LEND 2.302585092994 2.995732273554 3.4011973816622 3.6888794541139 3.912023005428 LPOS Returns the current head within line printer line position printer print buffer. Does not print head. is a necessarily physical position...
Page 152
LPRINT/LPRINT USING data line printer. statements below (see PRINT PRINT USING print details.) PRINT “PRINT SENTENCE" INPUT A$ LINE PRINT A$ LPRINT PRINT SENTENCE ‚ MAXFILES MAXFILES =< expression> maximum number files time. specify opened the range When 'MAXFILES can be 0’...
Page 153
MERGE “<device [<file > name MERGE >]"” lines from an into ASCII file program currently merge program memory. file lines number as being merged have line lines same lines from file will corresponding lines replace program memory, memory. resides After MERGE command, memory, and...
Page 154
2> 1>), (<string <string n[‚m)]) exp. exp. string. portion of string with replace another character <string exp. 1>, beginning position replaced characters refers the number characters <string exp.2>_The optional 2> that used omitted or from <string will m is replacement. exp.
Page 155
MOTOR [< ON/OFF >] MOTOR When change the status cassette motor switch. argument given, enables/disables motor switch. Otherwise, cassette. flips motor MOTOR ON MOTOR OFF entire program from working memory and variables. delete reset list 10 A$="ABC12345++*?=" PRINT MID$(A$, 4, 7) list...
Page 156
represents the decimal argument. Returns string which octal value 65535. the range -32768 numeric expression n is negative, n is a the same as two's used. That OCT$ complement form is, OCT$ (-n) (65536-n). PRINT” OCT(X)” STEP 2 “## USING PRINT &&”;...
Page 157
ERROR GOTO <line number > ON ERROR GOTO enable first line sub- error trapping specify error handling routine. has been enabled Once error trapping errors detected, including direct mode errors (e.g., SN (Syntax) errors), will cause jump to specified error handling number does subroutine.
Page 158
GOSUB/ON GOTO <line number>.…. GOSUB <expression> GOTO value branch of several specified line numbers, depending on expression > deter- returned when evaluated. The value of < an expression used which example, mines line list will branching. number the destination three, the number third line list will...
Page 159
GOSUB INTERVAL <time interval <line number > > GOSUB INTERVAL number line time interval. BASIC trap interval Generates interrupt < > second. timer time every When the trap occurs automatic STOP executed so receive INTERVAL the trap never take place. The from traps can RETURN...
Page 160
GOSUB <list numbers> line GOSUB numbers when the function line BASIC trap key is pressed. Example GOSUB 100, 200,, 400,, When automatic executed so receive traps can STOP is trap occurs, an KEY(n) take the trap automatically do place. The from routine will...
Page 161
ON SPRITE GOSUB line number > ON SPRITE GOSUB< line number when the sprites coincide. BASIC to trap to the trap automatic executed When SPRITE STOP so receive occurs, an traps take the trap place. The from routine automatically do RETURN will never...
Page 162
STOP GOSUB number> <line ON STOP GOSUB numbers when the line Control-STOP BASIC key is trap pressed. When the trap occurs automatic executed so receive STOP, STOP is traps take automatically do place. The from trap routine RETURN will can never has been unless STOP...
Page 163
GOSUB ON STRIG <list numbers> ON STRIG line GOSUB when the numbers trigger button line for BASIC trap pressed. 200,, ON STRIG GOSUB, the trap When automatic occurs an STRIG(n) STOP is executed so receive traps take place. The from RETURN trap routine never...
Page 164
OPEN OPEN “’<device descripter> [<file name>]”' <mode>] [FOR filenumber> < allocate I/O and set the buffer for that mode be used with buffer. will This further statement opens device processing. Currently, following devi- ces are supported. cassette screen screen Graphic line printer Device descriptors can...
Page 165
<port number < integer expression > >, send machine output byte to port. number> and <integer to 255. expression> <integer range <port transmitted. data to be expression> (byte) OUT&HAO, 7:OUT&HA1, 7 OUT&HAO, 8:OUT&HA1, 30 FORI=0TO OUT&HAO, 6:OUT&HA1, SO:NEXT NEXT PRINT “hit <...
Page 166
(<n>) Returns various status touch pad. <n> can be the range When connected selected, specified, touch pad stick port 3 is when 4 port — when When the status touch when <n>=0 touched, returned, or 4, released. When <n>-1 when <n>=2 or Y-coordinate X-coordinate...
Page 167
PAINT PAINT (X,Y) < border color >] color regarded >] Paint STEP at <coordi- an arbitrary graphics figure of color starting specified fill fill see the the <coordinate nate detail description at specifier>. specifier> does not allow <coordinate specifier> to be out statement.
Page 168
(<n>) <n the range Returns value can be of a paddle. > <n >is either 3,5, When paddle connected to port used. 9 or 11, When paddle connected to port used. 2, 4, 6, 8, 2 is or 12, PDL (2)
Page 169
PEEK Returns the range to 255) read from memory loca- byte (decimal integer -32768 tion to 65535. must range complementary function to statement. POKE PEEK '*** MEMORY DUMP INPUT “ADDRESS ”; IFA <OTHE A= A+65536 A TO A+64 STEP 8 PRINT *’...
Page 170
PLAY 1> for voice < string exp for voice 2 < string >[, < string exp PLAY exp. 3>]] for voice play music according to music macro language. ‘music concept similar to implements DRAW macro PLAY by embedding character into string.
Page 171
when The length may also follow want note change the note. length only example, A16 L16A. default equivalent to figures may range from to 64, Pause(rest). the pause the same length L(length). default is 4. causes the note to be After a or period) note,...
Page 172
01259 LLL 17 \NNDNDNDNN ENENENENENE — [LLL LI] L£ variable < <; Executes specified string. these commands the can be constant all of can be argument like “= where the name variable variable variable. The semicolon < > of a when this and when...
Page 173
PLAY<n> 0-3. Returns the status music queue. <n> can be <n>=0, of a range <n>iseither status and returned. returned ORed 3, -1 is i.e, reiurned otherwise is still in operation, still playing. queue that immediate after function Note statement PLAY issued, PLAY returns...
Page 174
POINT POINT (X,Y) Returns color specified pixel SCREEN 2 OPEN “GRP:"FOR OUTPUT AS #1 3O FOR FORJ=1 TO8 24, I+8) PRESET(J+* (RND(1) *13}+2 “9 ” COLOR C:PRINT#1, NEXT COLOR PRESET (100, 170) “Color No.” PRINT 130FORJ=1TO8 POINT(J*24+4, I+x8+4) 150 PRESET(J*24+8, USING “#4”;...
Page 176
POKE >, < address < integer expression > POKE memory write byte into memory location. the address address memory > memory location to be POKEd < data to be must be < integer expression > is POKEd. (byte) -32768 address the range to 255.
Page 177
Returns the current cursor positon. The leftmost position is a dummy argument. 20 FORI=0TO |+2, :PRINT POS(X) LOCATE NEXT...
Page 178
PRESET < coordinate specifier > < color > PRESET coordinate reset the detail < specified coordinate. specifier >, see the statement. SPRITE description at The only difference between color PSET PRESET is < > is given that statement, the selected. PRESET background color...
Page 179
Positive preceded by a space. numbers are minus sign. space. Negative preceded by a by a used mark may be word statement. question in a PRINT place PRINT PRINT “AVT MSX" !” “COMPUTER COMPUTER Friend” PRINT “My Friend...
Page 180
PRINT USING < <list PRINT USING string expression > expressions > strings or numerics using specified format. print comprises the list > numeric expressions < expressions expressions string that are to be printed, separated semicolons. string literal < string expression >...
Page 181
“gn that the character whole Specifies to be printed. given string Example: A$="You" PRINT USING love much.”’;A$ “I & very very much love you When used PRINT USING is numbers, the characters to print following special may be used to format numeric field: “gn...
Page 182
field minus the end numbers to be sign at format will cause negative printed with trailing minus sign. Example: v###.##-";1.25-1.25 PRINT USING 1.25- 1.25 asterisk double format string causes beginning leading spaces numeric field to be with asterisks. filled also specifies positions for two more digits.
Page 183
8” The **$"at format combines the of a effects of above beginning string be asterisk-filled dollar sign symbols. Leading will will spaces three printed before number. which specifies more digit positions, dollar sign. Example: **$#.4#;12.35 PRINT USING 12.35 left that A comma decimal point formatting string causes...
Page 184
The significant digits and the Unless left-justified, adjusted. exponent trailing used left leading specified, digit position will — sign. decimal point to print space minus Example: “#8.#4’"""; 234.56 PRING USING 2.35E+02 "-12.34 “#84 PRINT USING -.12E+02 v+#.Hi"; 12.34 12.34, PRINT USING +1.23E+01-1.23E+01 og"...
Page 185
the number exceed 24, an illegal function digits specified call’ will error result. "84444"; 123456 PRINT USING #4##"; 12.345 PRINT USING “’#. 1234.56 USING “&###.#"; PRINT “$$44#4" 12345 USING PRINT “####, USING PRINT #"; 12345 “++ ##47; USING PRINT “#44 12345 PRINT USING +";...
Page 186
USING PRINT < number >, PRINT # file [<expression> …... number> # < PRINT file USING <expression>; [<expression> ….. write data to the specified channel. (See PRINT/PRINT USING statements details.) 1OCLS MSX" "AVT “CRT: OPEN OUTPUT LOCATE 10, PRINT CLOSE...
Page 187
PUT SPRITE >] [,< color >] SPRITE <sprite plane number > [-<coordinates specifier number >] <pattern sprite attributed. plane number> may range from to 31. <sprite <coordinates two forms: specifier> always can come offset, offset) or STEP absolute (absolute first second form point relative to...
Page 188
defaults When field current value start color omitted, the used. the current foreground color. the pattern than <pattern number> must be less specifies sprite, when and must less than 64 when size of sprites size sprites number> (See defauits to the <sprite plane number>. also SCREEN <pattern...
Page 189
READ data ignored. statement. statements from reread DATA start, use RESTORE 10FORI=1 TO 3 READ PRINT TAB(3);A$ D=B+C PRINT TAB(7) USING “’4#####4;B;C;D NEXT AVT”, 50, DATA DATA “MSX”, DATA “COMPUTER”, COMPUTER...
Page 190
Remarks may be line remark with of a preceding single quotation mark instead of :REM. use this DATA would be considered data. statement legal statement read, data TO 3 READ A$ PRINT A$ SPC(2) NEXT DATA avt, msx, computer avt msx computer...
Page 191
RENUM <increment > RENUM [<new number >] <old number > renumber program lines. first new number number the new sequence. > is line to be used < <old number the current where renum- default line in > is program <increment to begin.
Page 192
RESTORE <line number >] RESTORE reread allow statements to be from DATA specified line. statement After statement accesses the RESTORE executed, next READ first statement first item DATA (line number) speci- program. statement accesses the next READ first item DATA fied, specified nonexistent...
Page 193
RESUME RESUME NEXT <line number > continue procedure has been program execution after an error recovery performed. formats shown where four above may be used, depending upon execution resume: RESUME RESUME the statement caused the which Execution error. resumes RESUME NEXT Execution resumes at the statement...
Page 194
RIGHT <>) RIGHTS (<X$>, characters Returns the rightmost return string IELEN (X$), null returned. string (length zero) 10CLS INPUT “DATA="; A$ 3O L=LEN (A$) B$=RIGHTS$(A$, B$=RIGHT$(SPACE$(50)+B$, PRINT NEXT DATA=? AVT...
Page 195
[(<X>)] Returns random number between random same sequence number generated each random gen- time < RUN. program erator reseeded repeats the number generated. last > given generates the the sequence. next random number 10FORI=1TO05 A=RND(1) PRINT A;TAB(18);INT(A +10) NEXT .59521943994623 .10658628050158 .76597651772823 .57756392935958...
Page 196
SAVE <filename ” SAVE “’[<device descripter> > treated device. Control asend-of-file. BASIC file save a +Z]|is program “CAS:SAMPLE" SAVE...
Page 197
SCREEN [<mode>] SCREEN [‚<sprite switch >] size >] [,<key click L<cassette baud rate> <printer option >] assign the screen mode, sprite size, key cassette baud rate and printer click, option. select 40x24 select < mode should be 32x24 text text mode, >...
Page 198
that Note statements SPRITE’ text mode, ‘'PUT graphics except generate function that the when error. Note also forced to text mode call’ mode “Illegal level. encountered INPUT" BASIC returns statement command determines that default cassette baud rate baud rate for write <...
Page 199
Returns (for > (for (for X < 0). X=0), O0), INPUT “SIGN”; J=SGN(I) J=J+2 90, 100, 110 GOSUB PRINT “THIS PRINT PRINT GOTO A$="MINUS"":RETURN A$="ZERO":RETURN A$="PLUS":RETURN SIGN? THIS PLUS SIGN?0O THIS ZERO SIGN MINUS THIS SIGN?
Page 200
the sine Returns radians. calculated to double precision. SIN(X) 10FOR TO 3 A=SIN(l} PRINT NEXT .84147098480792 .90929742682566 .14112000805978 SOUND PSG>, <DATA> SOUND <register PSG>. write value directly the <register 7,254 SOUND...
Page 201
SPACE SPACE discards the Returns string of The expression frac- spaces length tional portion and must be range to 255. "CRT: OPEN OUTPUT AS #1 CLS: FOR I=0 TO +17) S=INT(RND(1) +”; PRINT +”; SPACES(S);" PRINT PRINT #1, SPACE$(17-S); “SPACE”; S NEXT CLOSE:END SPACE...
Page 203
ON/OFF/STOP SPRITE activate/deactivate in a BASIC sprite trapping program. statement sprite. After must be executed to activate trapping A SPRITE ON number line GOSUB statement, ON SPRITE SPRITE ON specified statement then every time starts check to BASIC statement will the sprites coincide.
Page 204
SPRITE < pattern number > SPRITE pattern sprite. pattern number > than < must be less when size less sprites than 64 when size sprites is 2 that this variable fixed to 32 The length of (bytes). So, assign string shorter than 32 character, chr$(0)'s are added.
Page 205
the square >= Returns root must X. X "="I INPUT PRINT "SOR(ij="; PRINT SOR!) PRINT .5="; “1 PRINT PRINT GOTO SOR(i)=4.7958315233127 1.5=4.7958315233124 +755 SOR(i)=7.4161984870955 1°.5=7.4161984870947...
Page 206
STICK STICK(<n>) <n the range 0-2. Returns direction < can be >=0, of a joy-stick. n > <n used as either cursor key joy-stick.lf > is joy-stick con- When returned. value nected used. Otherwise, to proper port neutral, corresponding to direction returned.
Page 207
STOP level. terminate program execution and return to command terminate may be used execution. STOP statement anywhere in a program to When encountered, the STOP statement printed: following message Break is a line number) nnn (nnn files. statement, STOP statement does Unlike close...
Page 208
STRIG (<n>) STRIG the status the range Returns of a trigger button of a joy-stick. < n > <n>is 0-4. <n> the space used either trigger button. either used. When trigger joy-stick > is joy-stick <nn returned returned otherwise. being pressed, trigger —1 PRINT STRIG...
Page 209
ON/OFF/STOP STRIG >) ON/OFF/STOP STRIG (< sticks activate/deactivate trigger buttons of joy a BASIC trapping program. <n> the range 0-4. the space used can be <n >=0, trigger trigger <n> <n either button. used. When of a joy-stick > either joy-stick trigger but- must be executed to activate trapping...
Page 210
STRING (<I>,<Xx$>) STRING first whose characters have code Returns string of length ASCII character string 10CLS TO 13 +20) L=INT(RND(1) LOCATE 3, #4"; USING PRINT LOCATE x"") PRINT STRINGS(L, NEXT “nana KKK KKK KKK AAAK XXX AN KAKKEN KAAK...
Page 211
SWAP <variable > < variable >, SWAP exchange the value two variables. (integer, single precision, double precision, variable may be Any type SWAPed the same mismatch’ two variable must be string), but type or a ‘Type error results. I=0TO3 X(IJ=INT(RND(1)*99) Y(IJ=INT(RND(1)* NEXT:GOSUB PRINT...
Page 212
Spaces the current to position console. print position already does and the beyond leftmost position, space nothing. Space minus the range width must to 255. rightmost position one. used may only be with PRINT statements. LPRINT PRINT ’*” “+” PRINT PRINT “...
Page 213
the tangent calculated to double precision. Returns radians. overflows, 'Overflow’ error will occur. 6.28 FOR I=3.14 TO A=TAN([*3.14) PRINT A NEXT -46447027876367 .46253546743286 .46060350459682 .45867437419176 TIME internal timer. automatically incremented everytime system TIME when times dis- per second), thus, generates interrupt (60 an interrupt when...
Page 214
The trace flag square statement command when disabled with a NEW executed). TROFF PRINT vavt ”; “msx PRINT ”; PRINT “computer” avt msx computer tron [10] avt [20] msx [30] computer troff avt msx computer...
Page 215
[<digit>] the argument the user's assembly language subroutine with < > is Calls digit and corresponds supplied with the range DEFUSR digit assumed. that routine. USRO is < digit > is omitted, statement 200, CLEAR &HEFFF AD=&HF000 AD+9 I=AD TO ("&h”+A$) READ A$:A=VAL...
Page 216
VAL (X$) function also strips lead- numerical value Returns string string. linefeeds from the argument bianks, tabs, FOR I=0 TO STEP PRINT "HEX"; HEXS(I); TAB (6) “IS ";VAL(UV&H+HEXS(I) NEXT HEXO HEX5 HEXA HEXF HEX14 HEX19 HEXIE...
Page 217
VARPTR (< VARPTR variable name >) number > VARPTR (#< file the address Returns first byte data identified with variable name < > value must variable execution VARPTR assigned name < prior to > function Otherwise, error results. type variable name may be call’...
Page 218
VPEEK (< address of VRAM>) VPEEK address Returns value of VRAM of VRAM > specified. < range 0-16383. A%=VPEEK(1) VPOKE written> < address VRAM>, < value VPOKE address value to specified location of VRAM > can be of VRAM. < poke 0-16383.
Page 219
WAIT ‚L,[J] <port number> WAIT machine program execution while monitoring the status suspend Input port. statement causes execution to be until WAIT suspended specified machine input port develops specified pattern. read The data exclusive with J, and OR'ed port integer expression then AND'ed with integer expression result...
Page 223
Addition C=A+B PRINT of circle area INPUT M=3.14159*xR+R PRINT M Drawing of box SCREEN LINE (0,0)-(140, 100), (100, 80)-(255, LINE 191), 2,BF GO TO...
Page 224
Subtraction from 100 to step 3 J=100 STEP-3 PRINT NEXT table Multiplication K=1TO9 J=1TO09 JxK; PRINT NEXT PRINT NEXTK Sounds helicopter FOR I=0 TO A:SOUND READ NEXT 0,0, 0, 30, DATA 16,4, DATA 100,...
Page 225
Array x(10) J=1 TO XI) =Jx2 NEXT PRINT X(K) NEXT of circle Drawing SCREEN P=3.14159 FOR T=0 STEP 0.1 TO 2+*P X=30*COS (T)+40 Y=30 SIN (T)+48 LINE Y)-(40, 48), X1=X+80;Y1=Y PSET (X1, Y1), NEXT (40, 144), 30, 3 CIRCLE (120, CIRCLE 144), (40, 144), 3...
Page 226
LEFT$, RIGHT$ READ PRINT LEFTS (A$, 7) PRINT RIGHTS (A$, 4) DATA "ABCDEFGHIJKLMNOPORSTUVWXYZ” MID$ READ MID$ PRINT (A$, AS=LEFT$ (A$, 7) PRINT AM A TEACHER”, “PIONEER” DATA “I STRING$ RIGHT$, MID$) (LEFT$, A$="THREE!&#$/STRING!&#$/FUNCTIONS” L$=LEFT$ (A$, M$=MID$ (A$, 11, RS=RIGHTS (A$, 9) PRINT...
Page 227
DRAW SCREEN 2 (220, PSET 191), DRAW “U190” I=189 STEP-4 A$="L"+STRS(I}+"D"+STRS(|-1+"R"+STRS(1-2}H+"U"+STRS(1 XA$;” DRAW NEXT GO TO...
Page 228
PLAY BACH “T240L6V12", “T240L2V9" PLAY "O4GOSGE" “R8O6GABO7DCCED”, PLAY “O4BO5EO4E” PLAY “DGF#GDOGBGAB”, "O4ABO5C” “O7CDEDCOGBGABG”, PLAY “F#GADF#AO7COGBA”, “"O5DF#D" PLAY "BGA8O7DCCED”, “CGC” PLAY “O4BOSED” “DGF#GDOGBGAB”, PLAY "EO7DCOGBAGDGF#G2", “CC#DG” PLAY PLAY (0) THEN ‘x** PRINT THE END *++*”' STRING$ I=3 TO +20) L=INT (RND (1) LOCATE ##";L USING...
Page 229
Plottine sine curve SINE WAVE T=0TO 12.5 STEP A=INT (16+15*SIN(T)) PRINT "SINE" TAB(A); NEXTT table Truth (AUB)N (TC) ” PRINT X” READ X=(A (NOT PRINT “#4”; USING PRINT B, C, X NEXT 1,1, 1,1, 1,0, 1,0, 1,1, DATA 0,0, 1,1,0, 1,0, 1,0, DATA...
Page 230
area and perimeter triangle PRINT “THE LENGTHS OF THE ”; A" PRINT “SIZES OF “;A,B, INPUT “TRIANGLE PRINT P=A+B+C PRINT “PERIMETER=";P P-0.5xP S=SOR (P* (P-A)»(P-B)(P-C)) PRINT “AREA:=";S Calculation (Monte-Carlo Method) FOR B=1TO08 X=RND (1) Y=RND (1) Z< S=S+1 THEN N=N+1 P=4+S/N NEXT PRINTP...
Page 231
Arithmetic mean M=0:N=0 READ A=-999 THEN N=N+1 M=M+A GO TO M=M/N “NUMBER OF" PRINT PRINT “SAMPLES=";N PRINT PRINT “MEAN”; (19); =" PRINT 0,-999 DATA 12,...
Page 232
Combination REM COMBINATION PRINT “I” R=OTON FORK=1 F=FxK NEXTK F=F/K NEXT F=F/K NEXT PRINT NEXT PRINT NEXT...
Page 233
Expectation X(12), P(12) TO 11 X(l), READ P(I) S=S+X(|)*P{I) NEXT xX1=S/4.5E+06 “8” PRINT “EXPECTATION=";X1; 10000000, DATA 100000, 88, 5000000, 10000, 196 4000, 132, 1000000, DATA 500000, DATA 45, 100000, 10000, 900000 DATA 1000, 9000, 100,...
Page 234
base ten to another Conversion base) (from A(15) INPUT NEW BASE?";B “THE "FIRST AND LAST PRINT ”; PRINT “NUMBER TO” INPUT “CONVERT?"; F‚L PRINT GOSUB 160 PRINT A TABLE ENTRY PRINT TAB (7); FOR D=J TO STEP AD); PRINT NEXT NEXT O=INT (11/B)
Page 235
Graphic SCREEN 2 Y1=30:Y2=0:PI=3.141592# 0), 11 PSET (190, PI/25 STEP FOR T=0 TO 6+*PI X=60+*COS(T):GX=126+X Y1=Y1+1:Y2=Y2+1 Y2), 11 LINE{GX, (126, LINE Y1){GX, Y2), 11 NEXT T GO TO Graphic SCREEN 2 =-540 E=-270 GOSUB B=-270: E=-180: GOSUB B=-180 C=14 E=90 GOSUB B=90 E=270...
Page 236
Graphic SCREEN 2 SC=1.16:CX=128:CY=96 C=COS(.1):S=SIN(.1) 0.05 STEP R=88*COS(2+*T) COLOR X=CX+SC+R+COS(T) Y=CY+R+SIN(T) (128, 96)-(X, LINE NEXTT COLOR 15 FOR R=90 STEP X=R:Y=0 T=X*C-Y*S YEXxS+YxC THEN IF I=O PSET(CX+SC+X, CY-Y) LINE -(CX+SC+X, CY-Y) NEXT I:NEXT...
Page 237
Clock REM CLOCK 1:CLS SCREEN COLOR 10, LOCATE 3, 5:PRINT TIME NOW?" “WHAT 30” LOCATE 6, 7:PRINT “FOR EXAM. 12:30= > LOCATE 10, 9:INPUT H, M 142:SCREEN PI=3. 2, 2, LINE 0)-(255, 191), 14, (127, 85, 14 96), CIRCLE GOSUB PAINT MAIN TIME=0...
Page 238
REM UFO THE CITY COLOR 15, SCREEN 24, 7e, 7e, 24, DATA 18, 3c, “: (“&H"+A$): S$=" READ A$:A=VAL S$=S$+CHRS(A):NEXT SPRITE$(1)=S$ PSET (RND(1)*255, RND(1)*191), RND(1)*15 NEXT 120}{40, LINE 191), 15, (48, 152104, 191), 7, LINE FOR X=8 TO STEP 16 FOR Y=128 TO STEP LINE...
Page 245
Appendix CONTROL CODE TABLE Epen FUNCTION Header character byte for Graphic first character previous word cursor move terminate waiting for input delete behind current cursor position first character move the next word cursor beep left delete the character the cursor the next horizontal tab position move cursor...
Page 250
Appendix ADDRESS |DESCRIPTION REMARK data to V-RAM |Towrite [equivalent 9129 read date from V-RAM |with write Command or Set Address Status read RS-232C latch Address equivalent 8910 wirte data to PSG with read data from |(Towirtedatato port equivalent PRINTER |Toreaddatafrom with 8255A port write data to port...
Page 251
Appendix PINOUTS INPUT/OUTPUT DEVICES Joystick SIGNAL FORWARD BACKWARD CONNECTION LEFT o/ln|sjw|in/-— RIGHT TRIGGER TRIGGER 2 OUTPUT Recorder Interface Data SIGNDL CONNECTION CASSETTE OUT olsviola/sjwin|-= CASSETTE REMOTE REMOTE...
Page 253
Cartridge NAME PIN No. NAME T572 SLTSL Reserved — RFSH WATT BUSDIR IOR” MERG RESET Reserved — [ee] CLOCK — —_ — +12V — —- -12V _SUNDIN allowed to use *1:Not *2:Open Collector...
Page 254
NAME PIN No. Description address Select signal 400OH-7FFF of ROM Select signal for address 8BOOOH-BFFF cs12 Select signal for address 400OH-BFFF Select signal slot SLTSL Reserved Reserved future Refresh cycle RFSH dynamic Wait WAIT request Interrupt request Instruction fetch cycle of CPU direction external data bus buffer BUSDIR...
Page 255
Appendix MESSAGES CODES ERROR AND ERROR file name used An illegal form with file name LOAD, SAVE, KILL, etc. NAME, number Bad file that references with number statement or command a file a file the range numbers by MAXFILE of file specified OPEN statement.
Page 256
File OPEN file hasn't been specified OPENed. a PRINT#, INPUT#, direct Illegal statement that entered as direct mode direct mode is illegal in command. function call: Illegal that string func- passed math parameter range as the tion. An error may also occur result 1.
Page 257
memory files, has too many too large, loops or program many GOSUBs, many variables, or expressions that are too complicated. string space caused the amount free String variables have to exceed BASIC allocate string space dynamically, BASIC will until memory remaining. runs memory.
Page 258
Syntax error line encountered that contains some incorrect charac- sequence ters as unmatched parenthesis, command (such state- misspelled ment, incorrect punctuation, etc.) mismatch Type value string variable numeric or vice versa; assigned name function that numeric argument argument given string expects vice versa.
Page 259
Appendix WORDS MSX-BASIC RESERVED statements and function BASIC names are reserved. That key words used variable names. cannot This appendix lists all of MSX-BASIC listed language words that reserved. any of attempt words below variable, an indicated name computer. error DEFINT OPEN DEFSNG...
Page 260
STOP TIME SOUND STRIG VPEEK STR$ VPOKE TROFF SPACE$ WAIT STRING$ TRON WIDTH SWAP USING SPRITE STEP STICK THEN VARPTP...
Page 261
Appendix MATHEMATICAL FUNCTIONS Functions Derived that Functions are not available can be derived MSX-BASIC using following formulae: Function MSX-BASIC Equivalent SECANT 1/COS(X) COSECANT 1/SIN(X) COTANGENT 1/TAN(X) INVERSE SINE (X/SOR(-X+X 1.5708 INVERSE COSINE (X/SOR(-X+X = —ATN + 1)) + INVERSE SECANT (X/SOR (X+X-1)) SGN (SGN(X}-1)+1.5708...
Page 262
Appendix SHOOTING TROUBLE CHART Cause Symptom Remedy Power switch not Make sure power switch turned position in “ON” socket Power Power cable not Check loose power disconnected power cable pluged fuse Take to authorized system computer dealer replacement fuse Video cable not plugged Check cable Picture...
Need help?
Do you have a question about the MSX DPC-200 and is the answer not in the manual?
Questions and answers