Welcome, Guest. Please Login.
Linuxslate.com Forums

<=== Back to the Linuxslate.com Homepage

Newest Forum Posts

Oct 25th, 2021, 10:55am
News: Welcome to the linuxslate.com forums. May 2020: Forum registration has been disabled due to recent advancements in bypassing captcha's and the resulting increase in spam on the forums. Registration may be re-enabled at a later date. In the meantime, if you would like to register, please email "john" at this domain, and I will manually create an account for you. Registration is for legitimate and relevant discussion only. Misused accounts will be deleted without warning.


Pages: 1
Electronica MK-52 Vintage Soviet Calculator (Read 1585 times)
Administrator
Forum Administrator
*****


Administrator

Posts: 153
Electronica MK-52 Vintage Soviet Calculator
Feb 6th, 2020, 8:55pm
 
In this thread, I will post some tips, tricks and code for the Electronica MK-52 Vintage Soviet/Russian Calculator.
 
If you are reading this, you probably already know the basics of the Soviet-era Electronica MK-52 vintage electronic calculator.
 
If not, here are is some info:
 

  • First off, you may have a tendency to read "MK-52" as "Mark 52".  This is not correct.  MK stands for Micro Kalkulator.  In Russian "C" is not pronounced 2 different ways as it is in English.  "C" is always "S" as in "certify", and K is always the hard C (obviously as in calculator). It's coincidence that it also looks like it could be read "Mark 52".
  • The MK-52 is a 1980's era Scientific Programmable calculator developed and made in the former Soviet Union.
  • It was the last of the last true Soviet Scientific Programmable calculator designs. Calculators that followed it were clones of products available in the West -- usually Sharp or Casio -- with perhaps just a bit of "Russianization" -- i.e. Cyrillic keycaps and character sets.
  • It was the first and only such calculator to feature internal EEPROM storage -- basically a "flash drive", although extremely limited by modern standards.  The EEPROM is separate from the volatile internal program memory and registers.  Registers and Program steps must be written to the EEPROM, and then read back to realize non-volatile memory.  

Back to top
 
 

Mobile Linux ?
Got That!
WWW   IP Logged
Administrator
Forum Administrator
*****


Administrator

Posts: 153
Re: Electronica MK-52 Vintage Soviet Calculator
Reply #1 - Feb 6th, 2020, 8:58pm
 
The Electronica MK-52 has limited support for Hexadecimal characters, although with a strange character representation for hex values >9.  It's similar to what happens when you send a value >9 to a 7447 BCD display chip (but different specific characters)
 
Basically, the full "character set" for this calculator is 0123456789-LCГE_
 
For most of this text, I will be using "r" , which looks similar to the Cyrillic letter "Г" that sounds like a English "G".  Also "_" is a blank. A space is printed -- not an underscore.
 
This leads to the phase "EGGOG!" which is how a Russian person would pronounce (perhaps exclaim) the displayed "Err0r".  You can see that "Err0r" is actually spelled out in the MK-52 using the hex number EDD0D.
 
If we also use numbers such as 0 for "O", 1 for "I", and 5 for "S", we see that we can spell out a lot of English words.  For example, one could use "C0rrECr" as a recognizable "Correct" for successfully completing a "guess the numbers" game, or "C00L" for "Cool". Or the old calculator joke of  "80085" which can be read out as.... Well, you get the idea.
 
But how do we type these "words" into the MK-52?  It doesn't have a hex mode, and the keys with a...e marked under them refer to Registers R(a)...R(e), and cannot be used to enter those characters.
 
Here's an easy way to quickly store a "word" in a register:
 
Start with an "8", then decimal.
Continue with an 8 for every hex character, and a 0 for every "regular" (0 - 9) number.
Press Enter(B↑).
 
For example, to write "ERROR", as the calculator does, we would type:
8.88808, followed by Enter (B↑).
 
Again, start with an "8."
Continue with the normal values for regular (decimal) numbers (digits where we entered a "0" above, and the following for hex values >=A, where 2=A ("-") 3=B ("L") 4=C("C") 5=D("r") 6=E("E") and  7=F(" ")
 
To continue our example of writing "Err0r", we would enter:
8.65505
 
Since we have to precede the values with "8.", we can make alphanumeric words of phrases with a maximum of 7 characters, including spaces.
 
Press K then the down carat (blue character above the /-/ key) to Logic "OR" the 2 values.
 
You should have the word you want, preceded by "8."  But don't worry, we can exploit one of the may "features" of this calculator to get only the text we want, and to get the period at the end.
 
For the example of writing "Err0r", we would have
8.Err0r   displayed.
 
Get rid of the "8." by taking the fractional part (Press K then {x}), which fortunately fails to convert the hex characters to a decimal number like almost all of the other functions do.
 
But now the display is kinda messed up.  The period is in the wrong place, and there is an -01 showing.
 
For the example of writing "Err0r", we would have
E.rr0r   -01    displayed.
 
No problem -- We can move the decimal (period) by raising the value to the number of characters.  Press BП (EXP) followed by the number of characters.  Don't press Enter.
 
Since Err0r is 5 characters, we would enter:
Bп    5   (Bп is read as "Enter Power, it would be the EE -- "Enter Exponent" or the EXP key on a western calculator.)
 
Store it in a register of your choice:
 
X -> П   (r), where r is the chosen register (0 -- e).  This time we would use the a -- e keys printed under the respective keys to store it in a register location >9. Note that there is no Register(f).
 
You should have the desired "text" Displayed (X Register) as well as in the register you chose.
 
For the example of writing "Err0r", we would have
Err0r.   displayed, and stored in register 0.
 
Let's do another example:
To write "Cool", enter:
 
8.8008
Enter
8.4003
K OR
K {x}
Bп   4
X->П   0
 
"C00L" is displayed, and saved in R(0).
 
OK, so that's -- Well -- "C00L", but as soon as we turn the calculator off, we'll loose it.  How do we save it to EEPROM?
 
Next Post:  Saving the characters we've typed.
 
Back to top
 
 

Mobile Linux ?
Got That!
WWW   IP Logged
Administrator
Forum Administrator
*****


Administrator

Posts: 153
Re: Electronica MK-52 Vintage Soviet Calculator
Reply #2 - Feb 6th, 2020, 9:03pm
 
So in the last post I provided a simply way to enter values into the Electronica MK-52 Calculator that look like English text.  What if we want to save these values (or any value in a register) to the non-volatile EEPROM?
 
Let's also assume we have a small program (perhaps that uses the text) stored stating at 0000 in EEPROM.  Let's say it's less than 30 steps long.  We can start storing registers at the next "page" or location 32.
 
For this example, we'll only store the one register -- R(0), containing the value "C00L" (See previous post for entering this value into a register).
 
First we must ensure the area of EEPROM we want to use is "clean" or erased.
 
Move the "C   3   CЧ" switch to "C" ("Clear")
Move the "д   п" switch to д (which translates to "D" for "Data")
 
Enter the number 1003207 -- This is read as follows: 1 is any non-zero number, and is required.  0032 means start at location 0032 (so that we do not destroy the program that is lower in the EEPROM). 07 means store (clear) 7 bytes -- we only want to clear room for 1 register.
 
Press A↑, then ↑↓  (Address, followed by the Read/Write key).
 
Note that this will also clear the register, so you may have to enter the text as described above, and store it in R(0) *after* you clear the EEPROM.
 
Move the "C  3   CЧ" switch to "3" ("Write")
Enter 1003207
Press A↑, then ↑↓
 
You can check that "C00L" is saved by either clearing R(0) (storing  0 in R(0)), or by turning the calculator off, waiting 30 seconds, and then turning it back on.
 
We re-load it to R(0) the same way:
 
Move the "C  3   CЧ" switch to "CЧ" ("Read")
Enter 1003207
Press A↑, then ↑↓
 
Then hitting  
П->X   0
Should recall "C00L." to the display.
 
 
Back to top
 
 

Mobile Linux ?
Got That!
WWW   IP Logged
Administrator
Forum Administrator
*****


Administrator

Posts: 153
Re: Electronica MK-52 Vintage Soviet Calculator
Reply #3 - Feb 6th, 2020, 9:17pm
 
Electronica MK-52 Vintage Soviet/Russian Calculator
 
General Notes and hints:
 
It's a good idea to get in the habit of moving the "C  3   CЧ" switch back to "CЧ" ("Read") after every EEPROM operation.  This helps to prevent accidental loss of what is saved in the EEPROM.
 
To save all of the registers, save 7 * 14, or 98 bytes. Note that this will not store R(e), or the non-existant R(f).  I don't know how to store R(e), and as mentioned there is no R(f), so it cannot be stored.
For example, to clear enough room, starting at location 0032 for the contents of R(0) -- R(d):
 
Move the "C   3   CЧ" switch to "C" ("Clear")
Move the "д   п" switch to д (which translates to "D" for "Data")
Enter the number 1003298
Press A↑, then ↑↓  (Address, followed by the Read/Write key).
 
For this device, when we say wait 30 seconds between turning the calculator off, and back on, we mean it.  This caclulator uses a VFD or Vacuum Flourescent Display, which is actually a vacuum tube.  As with other vacuum tube devices, the tube employes high voltage.  If the HV capacitors are not allowed to discharge, turning the calculator back on can cause possibly damaging voltage spikes.  Wait *at least* 30 seconds.
 
Another good habit is pressing B/0 and CX if you stop to think for a moment or get confused.  B/0 resets the program counter to 0, and CX clears X.  This insures that subsequently pressing ПPT ("PRG" -- or Program Mode -- "LRN" or "Learn" on a typical western vintage caclulator) displays your program from the beginning, and C/П (Continue/Pause which would be R/S-- Run/Stop on a western device) begins executing a program from the beginning.  Obviously, this assumes you want to Clear X, and reset the Program Counter.  The contents of X will be lost.  You also may not want to do this if you are working with a program that begins someplace else other than the beginning of memory.
Back to top
 
 

Mobile Linux ?
Got That!
WWW   IP Logged
Administrator
Forum Administrator
*****


Administrator

Posts: 153
Re: Electronica MK-52 Vintage Soviet Calculator
Reply #4 - Aug 21st, 2021, 8:08pm
 
I recently pulled my MK-52 out of it's storage box, and reinserted the separately stored batteries.
 
Doing so made me realize that I had never shared my "Dice Roll" program -- so without further delay, here's the code, in what is hopefully a clear mnemonic/pseudo code form:
 
Columns:
1.  Memory Location
2.  Opcode/content
3.  Key Strokes
 
Code:
00  
01  6-  N->X(a)     4 Digit Seed must be stored in Register (a) -- Recall it.
02  22  X^2         Square -- Start of Middle Square Code
03  01  1
04  0C  EE
05  06  6
06  13  /           Divide by 1E6
07  35  {x}         Take the Fractional part
08  01  1
09  0C  EE
10  04  4
11  12  *           Multiply by 1E4
12  34  [x]         Take the Whole Part  -- End of Middle Square code
13  4-  X->N(a)     Store the New Seed
14  3L  RND         Random.  This is the actual Dice Roll
15  06  6             
16  12  *           Multiply by 6
17  34  [x]         Take the Whole part
18  01  1
19  10  +           Add 1
20  50  R/S         Stop
21  52  RTN         Goto 00 to run again. 


 
Code Design:
 
The MK-52, and it's close cousin, the MK-61 have very poor random number generators.  For any given seed, the pattern of pseudo random numbers will repeat after only a few iterations, especially for a low value integer, like a dice roll.
 
In the code above, I use a "Middle Square" routine to generate a new seed for every dice roll.  By using this combination of 2 random number generators, it seems to be a fairly unpredictable dice roll.  It does however remain only pseudo random.  If you are sitting down at the gambling table with a particularly tough group of comrades, I'd suggest leaving your MK-52/MK-61 in your back pocket.  In that position, it may save you from a bullet as your head for the door, if you pull it out and try to use it instead of the dice they offer, it may get you a bullet.
 
Note that the code above generates only a single 6-sided dice roll.
Note also that I use the MK-52 notation for hex values, for example memory location 14 contains the opcode for RND, which is Hex 3B, however, I write it as the MK-52 displays it: 3L.
 
Enjoy.
Back to top
 
 

Mobile Linux ?
Got That!
WWW   IP Logged
Administrator
Forum Administrator
*****


Administrator

Posts: 153
Re: Electronica MK-52 Vintage Soviet Calculator
Reply #5 - Aug 26th, 2021, 7:34pm
 
Updated Dice Roll Program for the MK-52.
 
In this version, the new seed is generated from the results of both pseudo random number generators, and not just the Middle Square routine.
 
Code:
00
01  6-  N(a)->X		4 Digit Seed must be stored in Register (a) -- Recall it.
02  22  X^2		Square -- Start of Middle Square Code
03  01  1
04  0C  EE
05  06  6
06  13  /		Divide by 1E6
07  35  {x}		Take the Fractional part (Removes the Left 2 Digits)
08  01  1
09  0C  EE
10  04  4
11  12  *		Multiply by 1E4
12  34  [x]		Take the Whole Part  (Removes the Right 2 Digits) -- End of Middle Square code
13  3L  RND		Random.  This is the actual Dice Roll
14  4L  X->N(b)		Store the result
15  01  1
16  0C  EE
17  04  4
18  12  *		Multiply by 1E4
19  34  [x]		Take the Whole Part.  This is the New Seed
20  4-  X->N(a)		Store the New Seed
21  6L  N(b)->X		Recall the Roll
22  06  6		 
23  12  *		Multiply by 6
24  34  [x]		Take the Whole part
25  01  1
26  10  +		Add 1
27  50  R/S		Stop so that result is displayed.
 

Back to top
 
 

Mobile Linux ?
Got That!
WWW   IP Logged
Pages: 1