Little Man Computer Simulator Input Code

I'm just learning about the Little Man Computer CPU simulator, and am using a version online here: http://peterhigginson.co.uk/lmc/

The instruction set used by the simulator is the same as the one here, I believe: https://en.wikipedia.org/wiki/Little_man_computer#Instructions.

I have got confused right at the beginning of my learning due to the way the instruction INP is handled.

If I have a program with just 1 line - INP and then watch the simulation, I see that the code901 is fetched into the CPU, and split into 9 in the instruction register and 01 in the address register.

I am having trouble understanding how the 01 part can be considered to reference a memory location, as the value which is input goes straight onto the accumulator.

My initial theory is that the instruction/memory (or opcode/address) split doesn't apply to the INP, OUT and HLT commands, but only to the remaining ones (ADD, STA etc.), but that the simulator is not built to account to this distinction.

However, I don't have enough experience to know is that is a reasonable assumption or if I am missing something conceptually.

Any clarification much appreciated.

• Not every instruction needs to interpret what is called the "address" as a memory address. Notice that the INP and OUT both have instruction code 9, but differ in the "address" part being either 01 or 02. Then notice the labeling on the wiring coming from input/going to the output. – Derek Elkins Jul 28 '18 at 1:53
• So the simulator would be more accurate if the address register was left blank or had N/A or equivalent for opcodes starting with 9 or 0? Maybe the instruction register could hold the 3-digit code for these cases? – Robin Jul 29 '18 at 11:32