Programming on MK calculators: how I made graphic games

After reading an article about a programmable calculator on iOS, I got such an attack of nostalgia that I climbed into a bookcase, and after a long search, I found an old notebook with programming notes and self-developed games.

On the first page with a felt-tip pen, the URL of the site on the people, which we made almost the entire yard, was proudly scribbled. I will periodically refer to it.

The beginning of the recordings is the basics of programming (the code was written for the MK-61, but will work on similar devices).
To switch to the corresponding mode, press - Fпр, to exit - Фвт.

The basic technique that I used when writing programs was working with registers.
To write to the register, use the button П → X, to output X → P. For example, a sequence of presses 72 П → X 1 writes the number 72 to the register RG1, and X → П 1 displays the value from the register RG1 to the register X. The

contents of the register X are always displayed on the screen - this is one of the stack registers (X, Y, Z, T). To work with stack registers, the following commands are used:
- In ↑ (copies the contents of the register X to Y, Y to Z, etc.).
- (swaps the contents of the X and Y registers)
- CX (erases the contents of the X register)

I also actively used the if function - the keys Fx = 0, Fx = / 0, Fx <0 and Fx> 0 are responsible for this. Syntax:
Fx # 0 (step to jump if the condition is not met) (the next command when the condition is met).

You can read more about syntax inthis article .

Let's move on to the most interesting. In those years and under those circumstances, none of my company had any devices on which to program — we spent whole hours at the calculator, and we really liked it. Like any children, we wanted to play, and noticed that the “inv” function (logical inversion) can convert numbers, for example, to the symbol “G”. “E” or “C”, and if you display “8-EC” and turn the calculator clockwise, we will see something that looks like a man.

image

The game, the code of which was painted in the notebook most beautifully, was called "Lamer Andrew meets America" .

The instruction reads: “You can watch the cartoon (by pressing VO SP), shoot a monster (BP 53), break the enemy’s car (BP 74). If you die, you will see the symbols '8 *****', if you win - 'ECC'. In this game you can use several types at once - front and top. " Uncomplicated.

In the values ​​of the registers, the command P (for example, 80013 inv P 0) entered the "animation":

RegisterValue for "normal view"Meaning for Advanced View
080013 inv80013 inv
18 inv8 inv
281 inv81 inv
3801 inv8573 inv
4800077 inv857 inv
580109 inv81308333 inv
680108 inv81300876 inv
78077099 inv8570757 inv
88015 inv8135 inv
980105 inv81305 inv
a, b5 inv5 inv
c807799 inv857757 inv
d80779 inv8577333 inva


The code itself (to reduce the recording of the operation “P → x”, “x → P” and “S / P” is designated as “IP”, “P” and “SP”) is simple and long: So, our program mainly consists of “animation” output operators (sequences of register values), stop and unconditional jump operators. For example, our little man “shoots” like this: A real calculator, before a new output to the screen, extinguished it for a split second - this gave more to the “shooting”. Simple, but we really liked the result, and parents even drew a letter to us :) Didn’t play enough? The second (and last) code from the same notebook is tamagotchi (yes, also with graphics): Instructions translated from the language that I adopted in childhood as English:

000 ИП1
001 ИП2
002 СП
003 ИПА
004 В^
005 5
006 -
007 F x>o
008 17
009 5
010 5
011 5
012 5
013 7
014 К ИНВ
015 ИП2
016 СП
017 ИП2
018 ИП2
019 ИП2
020 ИП5
021 СП
022 ИПА
023 В^
024 1
025 +
026 ПА
027 ИП5
028 СП
029 П5
030 ИП5
031 ИП2
032 ИП2
033 СП
034 ИП2
035 ИП2
036 ИП2
037 ИП2
038 ИП6
039 СП
040 ИПА
041 В^
042 1
043 +
044 ПА
045 ИП6
046 СП
047 ИП6
048 ИП6
049 ИП2
050 СП
051 БП
052 56
053 ИП8
054 ИП9
055 СП
056 ИП2
057 ИП2
058 ИП2
059 ИП4
060 ИП4
061 ИП4
062 ИП4
063 ИП7
064 ИП7
065 ИП7
066 ИП7
067 ИП7
068 СП
069 ИП7
070 ИП7
071 ИП4
072 СП
073 БП
074 87
075 ИП7
076 ИПС
077 ИП7
078 ИПС
079 ИП7
080 ИПС
081 СП
082 ИПА
083 В^
084 2
085 +
086 ПА
087 СП
088 ИПD
089 СП
090 ИПD
091 ИПD
092 ИП4
093 СП
094 ИП6
095 СП
096 5
097 5
098 5
099 ИНВ
100 СП
101 ИП0
102 СП












[ип1] [ип1] [ип1] [ип1] [ип1] [с\п] [ипВ] [В^] [2] [0] [-] [Fx>/=0] [19] [8] [0] [0] [1] [3] [Kинв] [С\П] [ипВ] [в^] [1] [+] [пВ] [С\П] [Сх] [ипС] [В^] [1] [0] [-] [Fx>/=0] [35] [ип3] [с\п] [ипD] [В^] [1] [5] [-] [Fx>/=0] [44] [ип3] [с\п] [ип8] [В^] [1] [0] [-] [Fx>/=0] [] [53] [ип3] [сп] [ВО] [ипD] [B^] [2] [-] [ПD] [C/П] [ип6] [ип7] [8] [ВО] [ипС] [B^] [2] [-] [пс] [о] [сп] [ип9] [ипА] [ВО] [ип8] [В^] [3] [-] [п8] [с\п] [ип4] [с\п] [BО] [ипВ] [B^] [10] [-] [Fx>/=0] [93] [ип2] [п1] [ВО]




Press С \ П - you will see Andrey. Press C \ P again and it will start programming. You will see some numbers - this is a conclusion from his programs. Press C \ P. After five programs, Andrei will grow by five years. Your goal is to grow him to 20, helping Andrei:

1. Feed him. Press PSU 65 and C \ P. He will eat and the hunger ratio will drop. If the ratio reaches 10, he will die, and you will see a great video.

2. Walk with him. Press PSU 84 and C \ P. He walks and goes to the toilet. If the value of the “anti-walking” coefficient reaches 10, he will die. With the video!

3. Sleep. When Andrei is tired, press BP 75 S \ P. To wake up - press С \ П. With the video.

4. Visit to the doctor. When Andrei turns 10, he will need to see a doctor. Press PSU 55 S \ P.

If you win - you will see "8 EU", if you lose - "8 ----- 8". Andrey changes as he grows!

Enjoy it.

A large number of games from different authors can be found, for example, here: http://lordbss.narod.ru/pmk.html

UPD: There are broken links on mk61.narod.ru (c: \ mysite - I was young and stupid) Unfortunately, it’s impossible to correct them now, because For 11 years, the mail has changed repeatedly, and passwords have been lost.

Also popular now: