Pseudo-writing mode

"It's not dope. It's fucking magic"
(GWAR)

All the 54-compartible Soviet calculators (MK-54/61/52, B3-34) work with BCD numbers, that is, every digit of a number in memory is stored as four bit - from decimal 0 to decimal 15. Obviously, most "normal" numbers use only digits from 0 to 9. However, there are ways to get your calculator to show the other six "digits" and memorize them as a part of the number  - A ("-"), B ("L"), C ("C"), D ("r"), E ("E") and F (empty space). Of course, those digits often appear  in programming mode : for example, a simple instruction such as  K SUB d would be written in program code as "AD" (this is displayed as "-r"). The owners of MK-61 and MK-52 could also use the binary-calculation mode of their machines : for example, binary inversion of "543210" ("8.5432109 K-INV") would give them a full set of hex digits ("8,-LCrE 6").  Even on a lowly 54, you could get some digits as a part of standart error message ErrOr (for example, 0 F+ln) and then try to mold them to your own needs by using lots of special manipulation techniques (more of that later :).

However, those methods were too easy and/or uninteresting. Therefore, here I'll describe a rather special mode that you could get your calculator in. That mode seems ideally suited for the creation of those strange hexadecimal strings. And besides, its very existance is quite unbelievable... unless you try for yourself!

First of all, let's create a program that includes all the digits. For example, this one will do nicely:

F-PROG

00. K SUB a (AA) 01. K STO b (BB) 02. K x<0 c (CC) 03. K RCL d (DD) 04. K x=0 e (EE) 05. 0 (00) 06. - (11) 07. F x2 (22) 08. K 6 (33) 09. STO 4 (44) 10. K 1 (55) 11. RCL 6 (66) 12. K x!=0 7 (77) 13. K JMP 8 (88) 14. K x>=0 9 (99)

F-AUTO

The whole point of this "program", of course, is that it contatins every possible digit, from 0 to 9 and from A to E. There are some hackers' ways to force a FF code into your program, naturally, but all of them are somewhat time-consuming, and they aren't needed here anyway : the empty spaces before address 00 of user program will do as well as proper FF's. The second digit in those codes doesn't really mean anything : the only reason for doing it like this (with second digits identical to the first ones) is that it, quite simply, looks better :)

Let's go. 1 EXP 6 EXP 99 EXP STO c. This will create a  "E000000". You can change the number of digits in this "number" by modifying the first exponent to 5 or 7: for example, "1 EXP 5..." would give you a "E00000" (you can also use 1-4, 8 and 9+, but it would lead you elsewhere during the next step). Now, press "EXP . 0" (don't forget a "point"). Surprise, surprise : you suddenly are in programming mode (and, incidentally, you've just entered a FF right into your program; it is very far from the start though). In this mode, everything already works strange : the key "K" seems to be always active and if you'd try to press a simple "-", you'd get a "special" monster : an "ErrOr    ,,,". However, let's not play with beasts right now. Use instead "RET/0 RET/0 JMP RET/0". That's it. You're now in Pseudo-Writing Mode (PWM or, in Russian, PSCH).

Most keys that would normally allow you to write or run programs, now operate quite differently :

• STOP/RUN looks like it goes into an calculation mode (almost F-AUTO)
• RET/0 looks like it goes into a programming mode (almost F-PROG)
• Any usual number-processing keys (such as digits) will immediately throw you into a "calculation" mode. You cannot edit a program in PWM - you can only use what you already have (nothing can stop you from loading an stored program if you use a 52, though).
• F-AUTO or F-PROG will stop the PWM and really go into the mode you specified
• An appearance of any bignum will stop the PWM
• Pressed alone, JMP or SUB will show you another part of program(it will go into "programming" mode regardless of which mode you were in); JMP will go to address 10 and SUB will go to the part of your program 10 steps after where you were when you pressed SUB. If you try to go to next (or previous) step, you'll return to your original address
• If you press JMP or SUB. followed by a hexadecimal number, yout calculator will go into "calculation" mode and then directly execute the code you typed. For example, if you type JMP 1C, you'll compute a sinus of the number in RPN register X.
• And now, the strangest one of 'em all : EXP. When you press it in "programming" mode, it will change the first digit of the number in RPN register X with the first digit on display (it also can be said to work in "calculation" mode - it doesn't do anything, after all!). For example, if you press "RET/0", go to address 01 (in fact, you should be there already) and do "EXP STOP/RUN", you should get "-000000". The first digit "E" got replaced by "-".
The way to create any hexadecimal string should be obvious now to any hacker deserving his name. You write it from right to left (yes, I do know that it feels disgusting). For example, let us write "-C-". We already have a first letter in place, so let's just shift the number to the right, filling the empty place with a zero. The good designers of our calculator have given us just the tool to do so :  indirect adressing, which fills the number in the register used with trailing zeroes. Press STO a K RCL a RCL a (you'll get "0-000000"), RET/0, find a "CC" code and press "EXP STOP/RUN". We have now a "C-000000".  Adding the last "-" should be easy now : EXP /-/ 1 STO a K RCL a RCL a RET/0 STEP-LEFT STEP-LEFT EXP STOP/RUN. I'd leave the tidying up of zeroes to you as an exercise :) The owners of MK-61/52 can generate such numbers without any PWM, of course : 8,535 K INV K {x} EXP 3 ENTER. But that would be boring, wouldn't it? :)

Inserting an "empty hole" (F) into your number is done with a same technique, but you should exercise extreme caution. Instead of simpe shifting by EXP /-/ 1 you must always use a more complicated procedure : EXP /-/ 1 . STO a STO a Cx ENTER ENTER ENTER. After that, you can add trailing zeroes to a number in A : K RCL a, clean up the stack (Cx ENTER ENTER ENTER), call up a halfway-completed string (RCL a), go into a programming mode, find an empty code (before an address 00) and do the usual EXP STOP/RUN.

Looks hard? Never mind. There's at least one tip to help you do it quicker. Remember that JMP and SUB temporary change the part of your program you're looking it? Well, you can use a code of EXP key - "0C" immediately after them to immediately pick up the first letter of a code on this another part of your program! For example, if you were to press JMP 0C with a "program" at the top of this page, it would pick up letter "4" and make it the first digit of an on-screen number. So, if you think you're going to need a lot of a certain letter in your string(s), simply place its code on location 09. And if the code you need is too far away (say, if you wanted to add a "9" right after "-"), you don't have to step all the way through the program. Just get up to 10 steps from this code you need, press SUB 0C, and that's it!

Amazing? You bet. If a little Soviet calculator can boast such crazy features as those (and have you read all the other articles on it?) - then how can you be sure that all other calculators, computers, house appliances or airplanes don't have those? Can you imagine a win98 machine that reacts to certain keys by going into a mode when Control-Esc will cause a power shut-up, and Alt-Esc will format hard disk? VCR erasing all your tapes when you press PLAY with STOP together? WHY NOT? WHO ARE YOU? WHY ARE YOU DRAGGIN ME AWAY FROM MY...

:)

The content of this page is based upon the article from the magazine "Technica - molodyozhi" (technic for the youth), june 1987 by Mikhail Pukhov. That article mentioned S. Bannikov (Moscow), I.Emelianov (Jakutsk), B.Muradov (Zhukovskij) as the first discoverers of pseudo-writing mode.

This page is (C) Gregory Escov 1998. Please contact me at gryn@tangram.spb.ru if you want to do anything with it..