Credit goes to Richard Mansfield for the excellent column in COMPUTE!’s Gazette that started in July 1983 and remained for years in the Commodore-specific version of COMPUTE!’s magazine. Let’s dive into the first article and we’ll break down the discussion, using this format moving forward…

Article Date and Pages: July 1983, Pages 84,86
Magazine Publisher: COMPUTE!’s Gazette
Link: Internet Archive
Author: Richard Mansfield

Highlights:

  • Machine language exploration every month: hands-on, examples to type in.
  • Machine language isn’t that much more difficult than Basic.
  • Take a look at how basic works, which is a essentially a machine language program used as an interpreter, not a compiler.
  • Follow an example demonstration that PEEKs into memory containing BASIC in ROM.
    • We get to see a list of BASIC command words. A “lookup table” of ~50 words.
    • The end of the resulting list shows error messages (each ending with a capital letter).
  • BASIC takes up memory locations 40960 to 49151 on the C64, using ~8K of memory.
  • We get to hear a bit about ROM (read-only) memory address lookup in BASIC and how it’s not as efficient as machine language, which can be hundreds of times faster.
  • Follows the trail of how BASIC “interprets” a PRINT instruction.
  • It’s possible to control the cursor location for BASIC — POKE new location numbers. Line location is address is 214 with position 211
    • POKE 214,12 to move the cursor to the twelfth line.
    • POKE 211,10: PRINT “X”
  • Final experiment:
    • Machine language can be combined with a BASIC “host” program.
    • Machine language is contained in DATA statements.
    • Numbers get POKE’d into memory as machine language.
    • Program will fill the screen with the character pressed on the keyboard.
    • Machine language is invoked by a SYS command containing the starting address of the routine.

Putting the code to work

In the first demonstration, we’re asked to PEEK into the area of memory containing BASIC and have a look at the list of command words. The PRINT CHR$(14) must be used to show off the last letter of each command / error message word in the table.


There’s a spot in the article where we POKE some cursor positions.

Here’s what that looks like.


Finally, the experiment. If you’re using an emulator on a Windows PC or MacOS, just hit the Escape key to break.


On to next month!!

Leave a Reply

Your email address will not be published. Required fields are marked *