MSX BASIC – lesson 1

da | Nov 3, 2023 | MSX BASIC | 0 comments

“MSX BASIC” COLUMN by Orazio Cacciola (part 1)

The PRINT statement

Hello everybody,
starting today a new column begins, in which I will explain MSX Basic commands and functions that will be used to make our programs. For experts it will be a refresher, while for those who are beginners, they will have the opportunity to understand and learn their use. I will try to explain at least one a week.

Let's start with the PRINT function

Print a sentence, number or variable. It can print on screen, on paper or on magnetic media
Its syntax is: PRINT [argument]
Using it alone will cause a line to skip. If we want to print a message we should enclose it in quotation marks: PRINT “Hello”. If we want to print on paper just add the L in front: LPRINT “Hello”. If we want to print it or rather the correct word is to save it on magnetic support, just add the pound sign: PRINT #1, “CIAO”. The number after the pound sign is the open port for writing to magnetic media.
We can also do some calculations: PRINT 5+6; will print the result of the sum. Instead of constants we can use variables: A=5, B=6, PRINT A+B. We can print sentences and numbers at the same time: PRINT “How old are you?”; 30, or a variable, A=30: PRINT “How old are you?”; A. You can concatenate 2 sentences or more sentences using the + (plus) sign; PRINT “Orazio”+”Cacciola”. OrazioCacciola will be printed, if we want to detach it just add an empty space after the name: PRINT “Orazio “+”Cacciola”. In addition to the plus sign, other tabulators, the comma sign and the semicolon, can be used. The comma leaves spaces between the 2 variables and exactly 14, while the dot and joins the 2 variables. Be careful though, while the semicolon joins the variables, whatever they are, the + sign can only be used with alphanumeric sentences or variables.
The next episode will be dedicated to PRINT USING, the so-called formatted printing.
Until next time
Orazio Cacciola

0 Comments

Submit a Comment

Your email address will not be published. I campi obbligatori sono contrassegnati *

LEZIONE 26 – INTERVAL ON, RND ED ALTRI

LESSON 26 – INTERVAL ON, RND AND OTHERS

Good morning everyone, In this episode I will talk about an important interrupt, especially for games, when we want to make an enemy suddenly appear or a useful object, but also to create a stopwatch or a clock and many other things. The COMMAND exploits the...

LEZIONE 26 – INTERVAL ON, RND ED ALTRI

LESSON 24 – THE DATA MANAGED BY THE MSX (PART 3)

Kind regards to everyone. Today we will close this topic, I will talk about direct or random access files. But first, as I mentioned in the last episode, I will give a small explanation about the program. First of all, the first thing to say is that I used a command which...