Welcome Guest
( Log In | Register )
The time is now 7:44 pm
You last visited January 24, 2017, 6:17 pm
All times shown are
Eastern Time (GMT-5:00)

9th Part: "Nostalgia" "Old" Basic Language interpreters, Commodore 64 Basic Interpreter # 1.

Published:

Last Edited: April 13, 2011, 1:43 pm

Numbers and strings can also be printed close or near to each other.

The Semicolon ; is used between data.

1 PRINT 1;2;3;7;23;19;874


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
1 PRINT 1;2;3;7;23;19;874
RUN
    1  2  3  7  23  19  874

READY.

--------

The computer prints 2 spaces between the numbers.

-------

To print 2 Strings:

10 PRINT "HOT";"DOG"

---


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 PRINT "HOT";"DOG"
RUN
HOTDOG

READY.

In that way no spaces were printed between HOT and DOG.

-----------

10 PRINT " HOT ";"DOG"

-------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 PRINT " HOT ";"DOG"
RUN
    HOT DOG

READY.

-------------------

To print 4 numeric variables:

10 W=10:X=15:Y=20:Z=25

20 PRINT W;X;Y;Z

---------------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 W=10:X=15:Y=20:Z=25

20 PRINT W;X;Y;Z
RUN
    10  15  20  25

READY.

-----------------------

To PRINT 3 String Variables:

10 A$="TICK":B$="TOCK":C$=" "

20 PRINT A$;C$;B$

TheC$" " is also a string.

Numbers and strings can also be mixed.

----------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 A$="TICK":B$="TOCK":C$=" "

20 PRINT A$;C$;B$
RUN
TICK TOCK

READY.

------------------

10 X=2*3

20 PRINT "THE ANSWER=";X

-------------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 X=2*3

20 PRINT "THE ANSWER=";X
RUN
THE ANSWER= 6

READY.

--------------

10 PRINT 10;20;30;40

20 PRINT 100;200;300;400

30 PRINT 1000;2000;3000;4000

-------------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 PRINT 10;20;30;40

20 PRINT 100;200;300;400

30 PRINT 1000;2000;3000;4000
RUN
    10  20  30  40
    100  200  300  400
    1000  2000  3000  4000

READY.
In this way data doesn't line up right as when you use standard columns.
---------------------

--------------------

To print data with spaces you can use the SPC keyword.

SPC(X) the (X) stand for the number of spaces.

For example:

10 PRINT "A" SPC(6) "B"

It should skip 6 spaces between A and B.

--------------------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 PRINT "A" SPC(6) "B"
RUN
A      B

READY.

------------------

Variables can be used to represent the spaces:

10 S1=7

20 S2=11

30 PRINT "A" SPC(S1) "B" SPC(S2) "C"

-------------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 S1=7

20 S2=11

30 PRINT "A" SPC(S1) "B" SPC(S2) "C"
RUN
A       B           C

READY.

--------------

The TAB keyword.

TAB(X), X = 0 up to 255

----------

10 PRINT TAB(20) "ABC" TAB(30) "DEF"

----------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 PRINT TAB(20) "ABC" TAB(30) "DEF"
RUN
                       ABC                              DEF

READY.

-----------------

Numeric variables can also be used:

10 A1=20

11 A2=30

12 PRINT TAB(A1) 200 TAB(A2) "BANANAS"

-------------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
10 A1=20

11 A2=30

12 PRINT TAB(A1) 200 TAB(A2) "BANANAS"
RUN
                        200                               BANANAS

READY.

--------------------------

Printing reverse characters is just printing with reverse colors, the font and the background of the characters will be reversed that is their colors only.

That is for an emulator or for a Comodore 64, so I will skip on that here at least for now.

-----------------

On a Commodore there are cursor control keys CRSR and they can also be used with the PRINT command, but here on a Pc like this that casn't be done other than with an emulator so I have to skip on that.

------------------

On an emulator and on the C-64 there are other ways in which the key words can be entered like using ? for the PRINT keyword, let us see if that will work here with this interpreter or not:

1 ? "Hello"

-------


       **** COMMODORE 64 BASIC V2 ****

    64K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
1 ? "Hello"
RUN
Hello

READY.
--------

It worked so that can be used.

I think that all the keywords have such things, for more info look at the books that you downloaded from my links on the C-64 guides maybe at the very end of them they are there.

Such things do save on having to do a lot of typing, long ago when I took a look at Commodore basic and was typing a lot of programs' lines by hand I was using them.

--------------

So here ? = PRINT

==============

Well that is it for this post.

-----------------

Are we learning some yet?

Programming is so hard and complicated and takes so very long to code and to think how to code in order to do what you want done and it might take a lot of Math knowledge to do things that might be of some use, that it might not be a thing that many or most of us want or should do.

And not because a person knows what the keywords do, that doesn't mean that a person can make programs with them, things are complicated and convoluted.

As Andrew said about WinHunter (His Lottery Program): "Not For The Faint Of Heart".

Entry #336

Comments

This Blog entry currently has no comments.

You must be a Lottery Post member to post comments to a Blog.

Register for a FREE membership, or if you're already a member please Log In.