71

In my childhood I used to program on an MK-61 Soviet calculator. It had four operating registers (X, Y, Z, T) and 15 storage registers. A program could have 105 steps.

As I recall it, it had commands like:

  • Swap X and Y registers
  • Shift registers (Z to T, Y to Z, X to Y)
  • Copy from storage register (1..15) to X
  • Copy from X to storage register (1..15)
  • If X < 0 then go to program step ##
  • Perform operation (+, -, *, /) using X and Y values and put result to X

Is this command set an assembly language? Did I have a basic idea of assembly languages by using this device?

Device

It turns out it is something called "keystroke programming".

Funny fact: a similar calculator (like this one, but with energy independent memory) was used as a back-up hardware for space mission trajectory calculations in 1988. :-)

Peter Mortensen
  • 1,045
  • 2
  • 12
  • 14
defhlt
  • 618
  • Nice! - that picture brings back memories. I still got my MK-52 in the basement somewhere :) – DXM Dec 13 '13 at 21:40
  • This looks like a Soviet clone of the HP 65. It may be programmed in Reverse Polish Notation with operations that push and pull on a stack. The RPN operators are simply recorded in memory, and interpreted by a what is probably equivalent to a 4004 CPU. The code in the 4004 ROM was probably compiled from 4004 assembler, but the keystrokes are really more like spreadsheet macros. – Meredith Poor Dec 14 '13 at 05:38

7 Answers7

36

I would say that the answer to both parts of your question is no: this calculator's commands aren't like assembly language, and programming this calculator is different from programming in assembly language.

The "language" this calculator is programmed in is fairly low level, but it still represents an abstraction on top of lower-level constructs that aren't visible to you as the programmer. I'm guessing a bit, but from your description, and from looking at the keyboard (and comparing it to similar-looking calculators from Hewlett Packard or Texas Instruments from the late 1970s and early 1980s) I'd say that each program "step" not only could be a simple operation like "add" or "swap X & Y" but also more complex operations like trigonometry, exponentiation, logarithms, etc. Each of these steps is probably implemented as a internal microcoded routine. That microcode probably is programmed in assembly language, but I don't think it's visible to ordinary calculator programming at the level you've described.

As others have described, assembly language usually is in very close (if not 1:1) correspondence with the facilities of the underlying machine. I'd say that assembly language programming includes the following characteristics that are probably not present in programming this calculator.

  • Operations include lower level level operations such as bitwise AND, OR, XOR, shifting; integer and (maybe) floating point arithmetic, on a variety of data sizes (e.g. single or double precision); load/store of a variety of sizes (byte, halfword, word, etc.).

  • Higher level operations (trig, logarithms) are usually subroutine calls, not instructions. There are some exceptions, such as the DEC VAX which had a polynomial-evaluation instruction. [Edit: OP pointed out that x87 also has trig functions.]

  • The addressing scheme of the machine is exposed. If the address space is segmented, you have to load a base address into a register and then address code or data relative to that register. Even with a flat address space, you're aware of addresses and address arithmetic. Usually assemblers will allow programmers to use labels to denote addresses. But if an address is in a different segment you may have to load a segment register before you can get to it.

  • Memory alignment is exposed. For example, on many machines a 4-byte word can only be loaded from or stored to addresses that are multiples of 4 bytes.

  • Data representation is exposed. Usually assemblers provide some way to specify numeric data in hex, octal, decimal, floating point, and occasionally character data.

  • Specialization of registers is exposed. Some architectures allow integer and address operations in some registers, but floating point only in others, or allow addressing only relative to certain registers. Sometimes there are specialized registers such as those with condition or status bits that cannot be used for addressing or arithmetic.

  • Subroutine calling conventions are exposed. Arguments and return values may be passed in registers, or pushed to and popped from a stack. (This stack is usually a region of memory addressed by a special stack pointer register, not a fixed set like X Y Z and T.)

  • You may need to be conscious of how to interact with the OS, or if there isn't one, how to deal with low-level hardware facilities. With an OS you have to load arguments into registers (or the stack) and trap into the kernel. Without an OS you probably have to deal with interrupts and timers.

My recollection of assembly programming is that it is very, very painful. I think that programming this calculator is easy and fun by comparison. (Sorry.)

Stuart Marks
  • 2,235
  • 1
  • Well, it has some bitwise operation AND, OR, XOR, NOT - blue symbols , , and ИНВ (which means INV) on keyboard. 2) I thought that sine, cosine etc. are instructions according to this reference http://ref.x86asm.net/coder32.html for x86 processors. But of course I do agree with you that assembler is a lot more complicated.
  • – defhlt Jul 13 '12 at 06:01
  • If you want the refrence for that VMS instruction set operation - http://deathrow.vistech.net/help?key=MACRO~VAX_MACRO_Assembler~Instructions~POLYx . Some other fun bits can be found in http://esolangs.org/wiki/User:Ian#Some_interesting.2Fcomplex_VAX_instructions –  Jul 13 '12 at 16:04