[Simh] H316 LDX instructin

Dennis Boone drb at msu.edu
Tue Oct 26 01:57:38 EDT 2010


I've been writing a small "hello world" program for the H316 as an
exercise.  After suffering several self-inflicted injuries, I've come to
a problem I don't think is my fault.

The program uses the index register to step through the message string.
But the index register doesn't seem to take on the series of values I'd
expect.  An edited down CPU trace from simh shows the problem fairly
clearly:

    H316 simulator V3.8-1
    sim> restore h316_hw16s.save
    sim> set cpu history=9999
    sim> run 1000
    HELLWOHERLHE

    HALT instruction, P: 01021 (JMP 1003)
    sim> show cpu history
    PC     C A       B       X       ea     IR
  <snip>
    01023  0 000314  000000  000001         OTA 4
    01024  0 000314  000000  000001  01023  JMP 1023
    01023  0 000314  000000  000001         OTA 4
    01025  0 000314  000000  000001  01013  JMP* 1022
    01013  0 000314  000000  000001  01036  LDA 1036  [000001]
    01014  0 000001  000000  000001         AOA
    01015  0 000002  000000  000001  01036  STA 1036  [000001]
    01016  0 000002  000000  000001  01035  CAS 1035  [000007]
    01021  0 000002  000000  000001  01003  JMP 1003
    01003  0 000002  000000  000001  01037  LDX 1036  [000003]
    01004  0 000002  000000  000003  01031  LDA 1026,1  [153717]
  <snip>

The example shows the second pass through the LDA-AOA-STA code sequence.
Note that though the A register contains the expected value at each
step, when LDX loads it from location 1036, the value is wrong.  The
full trace which is quite long shows that when the LDA at 1013 fetches
the value from 1036 to increment it, it's correct at each step.
(There's an LDX at the top of the main loop which fetches the value from
1036 to use as the index into the character string.)

So, it looks to me like LDX isn't doing what I expect.  Best I can tell
fromm the manual, it's supposed to replace the contents of X with the
contents of the effective address named in the instruction.

So, someone please hit me with a clue-by-four?  Or tell me I've found an
actual bug?

Thanks

De



More information about the Simh mailing list