Elektronika MK-85 emulator
The program emulates a PDP-11 compatible CPU and uses a ROM dump from the original calculator.
Therefore it should function almost exactly like the real one, inclusive all undocumented features, quirks and bugs and the machine code programming ability.
It works on PC-compatible machines with Microsoft Windows operating system.
A Windows CE port of an early version of this program is available at: http://4pda.ru/forum/index.php?showtopic=41145
Program version 45, updated 2009/12/25
mk85emsr.zip - Delphi sources, file size: 55kB
mk85emex.zip - compiled executable, file size: 222kB
Usage: extract the files into an empty directory, then run the program MK85M.exe


Disassembly box
- On entry, the starting address matches the Program Counter.
It can be modified by clicking on the address in the first line.
Accepted values: $0000..$7FFE for the ROM area and $8000..$7FFE+RamSize for the RAM area.
New value must be confirmed with Enter.
- After clicking on a disassembled instruction, a new instruction can be typed.
As with the starting address, pressing Enter accepts the changes.
Syntax errors are signalled with a red question mark.
Only changes in the RAM area will be saved upon program termination, all ROM modifications will be lost.
Binary Editor box
- The binary editor box allows viewing/changing the RAM contents only.
- It is possible to modify the starting address and the RAM contents by clicking on them.
Enter accepts the changes.
Registers box
- The contents of the registers can be modified by clicking on them.
Enter accepts the changes.
- The bottom line in the register box shows bits TNZVC of the PSW register.
Program execution control
- Closing the debugger windows resumes the program execution without tracing.
- Pressing the button [Run] in the Single step group box executes a single machine code instruction.
- To execute a specified number of machine code instructions type the required value to the field in the Number of steps group box, then press the associated [Run] button.
Please note that entering the debugger when the calculator is idle usually hits PC=$014A, where the clock is stopped and the processor waits for an interrupt from the keyboard.
Single stepping from this state doesn't have any effect.
- The Breakpoint group box allows to specify condition that determine when the program execution should be interrupted.
Currently it only compares the Breakpoint Address typed in the field with the Program Counter.
When they match, the program execution is stopped and the debugger window reappears.
Some parameters of the emulator can be customised by editing the MK85M.ini file with any text editor.
Description of the contents of this file:
CpuSpeed=250
- This setting controls the emulated CPU execution speed (number of instructions executed every 10ms).
ViewMatrix=0
- This setting controls the pixel size of the LCD dot matrix.
Any non-zero value selects large height.
RamSize=2048
- This setting defines the physical size of emulated RAM.
Typical values are 2048 for the MK85 with 2kB of RAM, and 6144 for the MK85M with 6kB of RAM.
After any change, the memory initialisation with the F8 key or the TEST command is required.
Radix=16
- This setting changes the base of the numeral system used by the debugger (16 for the hexadecimal system, 8 for the octal system).
To uninstall the emulator, simply delete the directory where it was installed.
The program doesn't modify anything outside its installation directory.
- All graphics, the user interface and most of the Windows related stuff are taken from the unfinished project of an MK-85 emulator written by Aleksei Akatov (Arigato Software).
- Significant part of the code is based on the PDP-11/03 emulator
written by Ovsienko V.A.
- The disassembler is based on the program pinst.c written by Martin Minow.
- The program includes a freeware component ThreadedTimer developed by Carlos Barbosa.
mk85emut.zip - file size: 31kB, sources and executables, DOS and Windows (in a DOS window)
BAS2RAM
This utility converts a list of BASIC programs in ASCII format to the MK-85 memory image.
Usage:
bas2ram.com program1.bas [program2.bas program3.bas ...]
- The utility creates an output file RAM.BIN which can be used by the emulator.
If the output code fits into 2kB then it corresponds to the MK-85 memory organisation, otherwise the MK-85M with 6kB of RAM is assumed as target device.
- Cyrillic characters are expected to be encoded in the Windows-1251 character set.
- Relational operators <>, <= and >= are converted to equivalent MK-85 codes 0x5C, 0x5F,
0x7E.
Forms ><, =< and => are accepted as well.
- Numerical constants in exponential form can be noted as 1.23E5 or 5.67E-8, the E and E- strings are replaced with equivalent MK-85 codes 0x7B and 0x7D.
- String PI is converted to the MK-85 code 0x7C.
RAM2BAS
This utility does the opposite to the previous one, i.e. displays BASIC programs from the RAM image file specified in the command line.
Usage: ram2bas.com ram.bin
- Cyrillic characters are encoded in the Windows-1251 character set.
- The output can be redirected to a file or a printer.
RAM2VARS
Function similar to the previous one, but displays the list of variables instead of programs.
Tetris

An amazing program written in BASIC, fitting only 2kB RAM, published once on the http://www.aha.ru/~fiks/tetris/ web site.
Due to MK-85 display limitations the bricks move horizontally, from the right to the left.
Key functions:
S - rotate clockwise
W - move up
X - move down
A - drop
mk85tetr.zip - file size: 2kB, BASIC scripts and the MK-85 RAM image
Usage: copy the ram.bin file to the MK-85 emulator folder.
Snake

The original version of this program written by Sergei Kiselev was found on the http://mk85.narod.ru/ web site.
It stored the screen state in a numerical array which required a lot of memory.
The program wouldn't run on the MK-85 version with 2kB RAM.
The author reported all sorts of problems when trying to use string arrays to save the memory, which could indicate some interesting BASIC interpreter bugs.
Out of curiosity I have modified the program to see what problems it would cause, but it worked flawlessly.
Therefore, it's published here in order not to waste my efforts 
The snake should be directed to pick the dots randomly appearing on the display, while not hitting the border nor itself.
Key functions:
2 - down
4 - left
6 - right
8 - up
mk85snak.zip - file size: 3kB, commented BASIC script and the MK-85 RAM image
Usage: copy the ram.bin file to the MK-85 emulator folder.