ScuzzBlog: Diaries April 2021

Entry 5th April 2021: Post 1: C64 - Direct mode is your OS.

C64 - Direct mode is your OS.

I do sense from some of the questions I see on the various forums
that many new and returning users fail to realise that they have
powerful control over the computer beyond BASIC. For many I guess
with just the prompt at your fingertips it is difficult to appreciate
the difference between program control and direct control.

The following aims to simplify just what taking direct control
means. Before I get into that by the use of a few images it is worth
mentioning some basics about the C64.

First up if you are using an old power supply then get it checked
out or better get a much newer one. Second learn the layout of the
keyboard and familiarise yourself with those all important keys
that drive your machine. Thirdly, to enjoy programming mode you
do need a datassette or better a floppy drive. With drives getting
more long in the tooth, again a newer version is easier to use,
faster and less prone to generating faulty disks.

That all said lets talk direct mode.

C64 - Direct mode is your OS.

This is a very old power supply.

Always play safe and get your PSU checked.

Whilst you may like the idea of the older
style C64, the newer one works just the same.

Read the manual and learn which
keys do what. Note the CRSR keys.

Not all keys are the same and they
do different things. Obvious I know
but knowing what button does just what
will make usage much speedier.

Understand what are graphics and what
are actual program function keys.

Most important, that little cluster
of keys bottom left run everything.

RF is old but in truth is a life saver.
See if you can get one on standby.

Floppy is way better than tape.

And a 1571 beats them all.

And do get good quality discs.

Tape is OK but learn the controls.
Also record your saved files as there
is no file search and listing as such.



The PLUS key is just a one button
press. NOT a shift button press. If
you shift + you will get a graphics
plus that will not add up.

Learn what RUN STOP does and the C= key.

CRSR are essential for editing LINES.
Remember that BASIC requires a Line Editor.


What is a DIRECT COMMAND. Simple.
An instruction you type in that
DOES NOT have a line number. So if
you type a PRINT command it will
print once and then FORGET what it did.

So press RETURN and the C64 executes
the PRINT command and then forgets it.
Returning the statement READY.

You cannot LIST a direct command. BUT
stick a number in front of it and then
it becomes the subject of a LINE EDITOR
and technically becomes a program.

The program with LINE NUMBERS is a
program command line and can not only
be listed it can be saved to tape/disc.

There is only one sequential line program
in memory at any one time so saving will
copy that to your drive.

and therefore has no line number.

With the memory cleared you can use
another DIRECT COMMAND such as LOAD
to retrieve a file from storage.

LIST will then show you the program.

I created a simple program to explain
that + issue. If you enter the incorrect
symbol for plus by pressing SHIFT + then
the statement line will ignore the symbol
and simply type AB and not A+B. Remember
that the + is not a SHIFT + as it is on
a Windows or modern keyboard.

So learn the keys and what they do.

This image is really to show you how
to EDIT a line in your program. Use
the CRSR arrows to navigate around the
lines of your program and use INST DEL
to EDIT the text.

To stop a program when running just
hit the RUN STOP.

Remember that the CRSR keys are in truth
your LINE EDITOR and lets you traverse
the program making changes. Other computers
do this differently. The LINE EDITOR is
DIRECT MODE working to let you alter and
change programs.

BASIC requires a LINE EDITOR on the C64.

Without the numbers everything you
do will be lost. If you are keen to
lose what is in memory then just enter
the statement NEW. Again the command NEW
is a DIRECT instruction. First though it
is sensible to save your work. And again
we use a DIRECT command in the form of SAVE.

After you SAVE if you enter NEW it
will clear everything from memory.

Just LIST and see.

That last line is the one I typed
after I entered the NEW command.

NEW is a very powerful command.

And there you have it. Learn the two
distinct tools under your control when
using a C64 or any BASIC computer. The
DIRECT CONTROL can be seen as your OS
of sorts controlling not only the
computer but also your peripherals.
Learn to distinguish between DIRECT
and PROGRAM instructions.

The computer will forget every DIRECT
command after execution, whilst PROGRAM
lines remain unless cleansed with NEW.


OK let's play 1541 disk operations.

First command .. LOAD "$",8
We are working in DOS and not BASIC
and so LOAD is understood by the computer
as a file operation to find a file on the
drive. The "$" is a wildcard and scans for
all files on the disk. The 8 is just there to
identify an external drive. Otherwise the C64
would be asking you to press the tape controls.

The LIST command now shows the results.
More on this later.

From the list there is a PROG called
"CHECK DISK" so the load command for
this program uses LOAD "CHECK LIST",8
If you don't add the 8 the computer
will try to access the Datassette.

To run the program just enter RUN.

FORMAT now and I use the 1541 drive command.
To do this we open a channel to the drive to
start communicating .. OPEN 15,8,15.
And then we enter PRINT#15,"NEW:SCUZZ,02"
PRINT#15 is a standard command for all drive
actions as I will demonstrate. The NEW is the
FORMAT command to make a new disk. The '0' is
for a single drive or left and right, 0 or 1.
SCUZZ is the disk name and the 02 its id.
You should give disks a different id.

When the 1541 has formatted the disk you will
see the red light go out and the READY appear.
If the drive starts blinking, restart and try
to latch the drive door a little better. Or
just jump up and down and swear. Clean the heads.

Next LOAD "$",8 and LIST and you will see the
disk named SCUZZ with id 02 and no files.

OK same process but kinda how the C64
manual would suggest using the 1,8,15,
This time we open channel 1, Use N as
an abbreviated NEW and do all this in
the same line... opening and closing.

And we achieve the same end.

Back to BASIC and saving a simple one
line program 100 PRINT "SCUZZ"
So what I do is SAVE "SCUZZ1",8
This tells the C64 to save that file
on the 1541 disk drive as I am using 8.

Now here is an oddity. If you do not
type NEW after the program is saved
it will add the listing of the DRIVE
contents to the BASIC lines of the
program. So if you try to run it will
find an error with the none BASIC text.

So between all operations you should
get in the habit of typing NEW.

Time to COPY a file that you have on disk.

Remember to CLOSE at the end. The new
copy will be called NEWNAME and will be
a copy of the file called SCUZZ1.

I rename SCUZZ1 as VEIGA. Seems only fair.

The listing now shows VEIGA and not SCUZZ1.

To delete a file we need to ditch that itch.
The command is PRINT#15,"SCRATCH0=SCUZZ2"
You will note that SCUZZ2 vanished.

Please remember to OPEN and CLOSE each operation.

Then there is VALIDATE... Whatever.

Getting the names the right way round
when copying will save a lot of time
having to keep writing things out.
I knew this and still got it wrong TWICE !!.

Sometimes you wish the SAVE did more.

scuzz site

If you can only see this CONTENT window
then click the image above for the full site

Last updated 5th April 2021

Chandraise Kingdom

Keep the Faith
scuzzscink 2021