Welcome Guest
( Log In | Register )
The time is now 12:31 pm
You last visited January 23, 2017, 11:43 am
All times shown are
Eastern Time (GMT-5:00)

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

Published:

Last Edited: April 10, 2011, 7:47 am

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.

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.