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

Published:

Updated:

Commodore basic is not exactly the same as that of all other old and new basics, so beware of problems if you try these with other basic interpreters, emulators, languages or programs.

COMMODORE 64 PROGRAMMER'S REFERENCE GUIDE

Strings or     string constants

Pages 4 >

Letters = "JOE"

Numbers = "860"

Symbols = "$^*"

Or a mix of any of those such as: "6K)"

Strings are inside quotes "X"

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

Data can be numbers 48923 or strings "/?9F"

-----------

Numeric Variables

Represent numbers

2 LEM = 25

4 PRINT LEM

Type RUN

Type Enter-Return

Get

25

-----

LEM = Numeric Variable

25 = Numeric Constant

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

String Variables

A string variable represents strings

2 FRUIT$ = "BANANA"

4 PRINT FRUIT$

RUN

BANANA

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

FRUIT$ = String Variable

"BANANA" = String Constant

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

Names must start with a letter

String variables must end with $

Different variables must not have the same 2 characters

You may not use variables that have in them basic commands

So we must get familiar first with the names of basic commands.

--------

It is also ok:

DOK = 6+4

-----


2 Y=96

4 AGE=Y

6 PRINT AGE

RUN

96

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

NAME$ = "JOE"

-----

2 D$ = "JOE"

4 C$ = D$

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

Beware of mistakes verify info yourself

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

LET DOG = 3

LET TH$ = "MAY"

In that case the LET command is optional it doesn't have to be used it can just be:

DOG = 3

TH$ = "MAY"

-----

Type in direct mode or with numbers if in a program:

X = 250 + 50

PRINT X

-----------

5 X = 250 - 50

10 PRINT X

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

To multiply use *

Y = 3*2

PRINT Y

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

To divide

J = 100/4

PRINT J

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

Exponents or Powers:

2^2 = 4

9^2 = 81

2^3= 8

Beware of mistakes

1 LE = 3^3

2 PRINT LE

--------

2 Y = [2^3] - 5

4 PRINT Y

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

Order of Math operations it is best to put the operations in parentheses otherwise:

Powers-Exponents are done first, then:

Multiplications and divisions are second, then:

Additions and substractions are last.

Read the C-64's Guide.

Using parenthesis you can do like this:

C = ((2^3)+15)*6

Maybe much better than trying to guess how it will be computed by the program or the Pc.

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

PRINT "MOTOR" + "CAR"

MOTORCAR

-----------

PRINT "MOTOR" + " " + "CAR"

MOTOR CAR

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

10 X$ = "JOE"

15 K$ = " "

20 Y$ = "BROWN"

30 PRINT X$ + K$ + Y$

RUN

JOE BROWN

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

No more of these posts for a few days (1 to 3 or so ) then I will continue them.

You might want to try the examples with the C-64 Interpreter or with a C-64 Emulator or with some other old basic interpreter and make sure that there are no mistakes if there are mistakes make sure that a C-64 interpreter or emulator is used and also read the C-64 guides that you might have downloaded or some other basic tutorial(s) or guide(s).

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

Beware of  mistakes, so read basic guides or tutorials, other than what I post on here.

Entry #331

Comments

This Blog entry currently has no comments.

Post a Comment

Please Log In

To use this feature you must be logged into your Lottery Post account.

Not a member yet?

If you don't yet have a Lottery Post account, it's simple and free to create one! Just tap the Register button and after a quick process you'll be part of our lottery community.

Register