CHEXSUM (Clifford Ramshaw, Mark Ramshaw)

CHEXSUM - Banner Image

Title – CHEXSUM
System –
Commodore 64
Author – 
Clifford Ramshaw, Mark Ramshaw
Publication
– Commodore 64 Games Book
Page Scans1 2 3 4 5
Preserved by – eboy71
Recommended EmulatorVICE

CHEXSUM - Mark & Clifford Ramshaw - Screenshot 1

Download ROM

Loading the Game –

  • Mount the disk image (Chexsum – Commodore 64 – Games Book.d64) in your emulator. In VICE, this is done by selecting File → Attach Disk Image
  • Load the app by typing LOAD”CHEXSUM”,8
  • Once loaded, type RUN to start

Article Text & Instructions

WHY:
When a book of programs, such as this book, is keyed in everybody invariably makes reading and typing mistakes and then spends ages trying to sort out where and what is causing the error (or errors).

Even experienced programmers often cannot identify an error by just listing the relevant line and need to do the tedious job of going back to the book, especially with DATA statements.

Realising that this is a major cause of frustration in keying the programs we decided to do something about it.

There are two short routines in this book which you should key in and save BEFORE you key any other programs in.

Using these routines you will be able to find out if you have made any keying errors at all and in which lines, before you even run the program.

In effect this means that with this book you need not waste time looking for keying errors, you simply run the routines and look at the display to identify lines containing errors. It’s just that easy.

The principle behind the routines is a unique chexsum which is calculated on each individual line of the program as you have keyed it in. Compare this chexsum value with the value for that line in the list at the end of the program listing, if they are the same the line is correct, if not there is an error in that line.

HOW:
The CHEXSUM program uses line 62000 onwards, and no other program in this book uses line numbers that large.

To use it, you need to type in the CHEXSUM program first (or load it from tape). You then type in the program you have chosen from the book.

At any stage of typing your game program, you can check on the correctness of your work by entering the command RUN 62000.

When you have completed entering your program, and are satisfied that all is correct, you can delete the CHEXSUM program by running it and answering DELETE to the question “TO PRINTER (Y, N OR DELETE) ?”. You can now save your program to disk or cassette as it will still be intact in memory.

WHEN:
The simplest method is to enter the CHEXSUM program in now and save it to tape or disk. Each time you want to enter a new program just load CHEXSUM and key the program.

You can type in the CHEXSUM program at any time, even if you have started to type in a program. You cannot, of course, load in CHEXSUM from tape or disk because it will erase all you have typed so far.

A partial solution to this is the MERGE program included here that will allow you to merge two programs. To use it, you will have to save all you have typed in so far onto your cassette or disk, load the MERGE program, and run it. You will be prompted to load in your program and the CHEXSUM program.

If you are using a Datasette it might be an idea to save CHEXSUM and MERGE on a separate cassette, saving CHEXSUM first. This will enable you to save all your corrected programs on one cassette and allow you easy access to the CHEXSUM and MERGE routines without having to constantly run backwards and forwards through the tape.

HOW CAN YOU TELL IF CHEXSUM HAS BEEN CORRECTLY ENTERED?
After having keyed CHEXSUM (or MERGE) the logical thing would be to chexsum these programs too, to ensure that they are correct. But is it possible to do this? If you follow the instructions you will be able to check them both.

Type and save CHEXSUM

Edit line 62020 and change the value of E from 61999 to 62200

Type RUN and check output against the table of values at the end of the program.
If the program is incorrect then edit the incorrect lines and resave the program after having reset the values of E in line 62020.

Type and save MERGE.

You can only check the data in the MERGE routine, however this is the most important part of the routine. All you need to do is “RUN” merge, it will check its own data and prompt you if there is an error.

INSTRUCTIONS

1: RUN 62000

2: answer the question.

“Y” if you want listing on printer “N” if listing is to be displayed “DELETE” to delete CHEXSUM

3: hit “RUN/STOP” to halt output.

4: type “CONT” to continue.

5: if all is correct then “RUN 62000” again and answer with “DELETE”.

6: otherwise correct errors and start again from 1.

Editor’s Notes:

  • This is an interesting approach to checksum programs that appeared in books and magazines in the 80’s. Unlike checksum routines that reside in memory and check the code in realtime, CHEXSUM resides at the end of the program you are typing in. And then, when the program has been verified to be working, it has a self-deletion method to remove the CHEXSUM code, leaving only the program that you just typed in.
  • CHEXSUM is not foolproof. It is order-dependent (e.g., PRINT and PRITN result in different checksum values), however, some characters (e.g., “9” and “)”, which reside on the same key) result in the same values, so errors are still possible.

About eboy71

eboy71, or Bryon as he's known IRL, grew up in the 80's, bathed in that warm monitor glow from his Commodore 64. He enjoys preserving programs from the computer magazines of his youth, especially COMPUTE!, and still manages to get in a game of Impossible Mission from time to time.

Leave a Reply

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