Binary
There is no decimal inside the LGP-30. Everything on its drum is a 32-bit binary word, and every instruction works on those bits. You can write a short program in the IDE without thinking about this. To understand what the machine is doing, you need binary.
What you will meet
- Words. A word is a sign bit, 30 bits of magnitude and a spacer
bit that is always zero. So 42 shows in the memory pane as
00000054, not 42. - Negative numbers. They are stored in two's complement. -6 is
wwwwwww4. - Hexadecimal. Words are written in hex, and in the LGP-30's own hex digits at that (see LGP-30 Hex).
- Fractions. Multiply and divide treat a word as a fraction between -1 and 1. Larger numbers need a scale factor, which the programmer keeps track of by hand.
- Instructions. The same 32 bits can be read as an instruction. The instruction letter is in bits 17 to 20, the address in the track and sector fields.
- Masks. Extract (
e) ANDs the accumulator with a word. It is how a program picks one field out of a word.
None of this is hard, but it is all unfamiliar if you have only used decimal and a modern language. The manuals and program listings of the time assume you know it. So does the debugger. The same ideas return on nearly every machine that came after, from minicomputers to eight-bit home computers.
The Binary Course
The Binary Course covers this ground in 21 lessons: counting in other bases, bitwise operations, negative numbers, fractions in binary, and reading real machine words. Lesson 19 decodes a raw word from the LGP-30. Each lesson has exercises, with the answers at the back. You do not need an account to read it.
If you already read hex and two's complement comfortably, skip it and go straight to Programming.
The Calculator
The Calculator converts a number between decimal, hexadecimal, binary and the LGP-30's word format, and shows how a word reads as an instruction. Use it to check your working, or to see how a number will look in the debugger.