September’s Program: S.M.P.


My attempt at creating a computer notepad, back in the early ’80s.

[S.M.P., 1984]October’s program of the month is S.M.P. or Sinclair Memo Pad. A simple scrolling editor that allows you to take a couple of quick notes that last as long they are on-screen.

Since the space key also acts as a break, which will stop the program, S.M.P. uses the newline key instead. The right arrow key, shift-8, will cause the screen to scroll, replacing the traditional newline functionality. Think of S.M.P. as a roll of paper that is being feed into a shredder. Sadly, this program isn’t very practical. Sure, you could stop the program and use COPY to print out the screen if you really wanted to save it. Sure you could stick your ZX81 and a small TV in your kitchen and keep notes there. However, as cool as it may sound, pen and paper are just more convenient and still trumps using a ZX81 for such a task.

Interestingly, this program runs in the ZX81 FAST mode. If you’ve ever typed on a ZX81, you’ll understand why. Next to today’s fast computers, it is an exercise in patience. The old style membrane keyboard tended to slow you down anyway, but even then I could still type faster than the computer could read the keys. Even today using an emulator I will revert to FAST when typing in programs.

The structure of S.M.P. is straight forward. It uses a simple for loop to track the cursor. The bulk of the program is keyboard validation. I deal with the space and newline key remapping in lines 90 and 110. Line 100 checks if you are using the rubout key. This is an example of directly manipulating the loop variable to move back one space, effectively deleting the last character. If you reach the end of the line or use the right arrow key, the screen scrolls upwards. Line 120 just makes sure the characters are printable in a single character. Remember, the ZX81 has keywords that expand into multiple characters. Allowing those to print would cause problems. And that my friend, is it, a simple editor in 21 lines of code.

Interestingly, this program judiciously uses CHR$ and CODE instructions. I had to do this to because the keys I need to test cannot be entered in a string. I could have implemented those routines, as well as others, in various ways. For example, I could have changed line 80 to LET A=CODE INKEY$. I would have to then remove all the other CHR$ and CODE instructions. One last change would have been in line 140 where I would need to change A$ to CHR$ A. I’m sure there are other ways to tighten up the code as well as to enhance it more. It wouldn’t be hard to change so that one could enter graphic characters. That said, it does its job well.

I wonder how hard it would be to embed a ZX81 and TV into a refrigerator? Ah, the possibilities.

If you want to run this program on your Android phone or tablet you can download a compressed copy of the program to your device. You’ll need to save the .p version of the program to your device to allow Zed Ex (Beta) to run it.



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive