[Simh] H316 LDX instructin

Dennis Boone drb at msu.edu
Tue Oct 26 17:24:06 EDT 2010


Adrian,

 > This next line looks "surprising" to me. The computed EA ought to be
 > 01036, not 01037. Since LDX ans STX share an opcode, and are
 > differentiated by the index bit that indicates indexing in all *other*
 > instructions, and it has the value '1' for LDX, I think this is a bug.

 > I'm pretty sure that I have seen this reported before (a long time ago
 > by Philipp Hachtmann IIRC).

 > I think it is a simh bug. Looks like the LDX is indexing, which it
 > should not.

That is indeed where I thought it went wrong.  I was focused on the
incorrect value, and failed to notice the miscalculated address, but
you're right, that is what it's doing.  The confirmation is
appreciated.  After having tracked down a number of my own mistakes, I
wasn't sure I should scream "bug" immediately.

A quick look at the code suggests that it uses the Ea() function for all
address computation, so that may be where it goes wrong.  I'll look
deeper later.

 > If you send me source code I'll run it on my simulator and let you know
 > whether that fixes the issue.

I appreciate the offer.  The formats I have are somewhat less than
convenient, but I'll provide a variety of bits at the end of this
message.  I should point out that I've actually been using the Prime
assembler (PMA) in 16S mode, and that its column which shows machine
code in octal is, um, odd.

 > It might also be worth mentioning that this is an extremely cumbersome
 > code sequence for incrementing the index register. It is usually done
 > with "IRS 0". If you arrange the loop to go from -N to -1 the skip that
 > IRS does as it increments from -1 to 0, when you get to the end of the
 > string, can escape from a loop.

Aha!  I should explain that the origin of my little project lies in
exploring the similarities of the System 16 architecture and the the
Prime machines which were originally compatibles and evolved into the
far more complex 50-series.  I've used some Honeywell and some Prime
documentation (and even Prime operating system source code) in figuring
out how to build this little program.

I first tried the IRX instruction, but it appears that was a Prime
addition to the instruction set as the 316 threw a UII.  Believe I tried
"LDA '0" to no avail as well.  Dunno how I missed IRS, but thanks for
the lesson.  I've not integrated it into the code below, but it will be
useful.

De

Assembler listing:

    (0001)         ABS
    (0002)         D16S
    (0003)         SDM     0
    001000   (0004)         ORG     '1000
    001000:       070104   (0005) HW      SKS     '104
    001001:     01.001000A (0006)         JMP     HW
    001002:       030104   (0007)         OCP     '104
    001003:     35.001036A (0008) LOOP    LDX     IXR
    001004:     22.001026A (0009)         LDA     MSG,1
    001005:       141340   (0010)         ICA
    001006:       141050   (0011)         CAL
    001007:     10.001022A (0012)         JST     CHAROUT
    001010:     22.001026A (0013)         LDA     MSG,1
    001011:       141050   (0014)         CAL
    001012:     10.001022A (0015)         JST     CHAROUT
    001013:     02.001036A (0016)         LDA     IXR
    001014:       141206   (0017)         A1A
    001015:     04.001036A (0018)         STA     IXR
    001016:     11.001035A (0019)         CAS     LEN
    001017:       000000   (0020)         HLT
    001020:       000000   (0021)         HLT
    001021:     01.001003A (0022)         JMP     LOOP
    (0023)
    001022:     00.000000A (0024) CHAROUT DAC     **
    001023:       170004   (0025) OTL2    OTA     4
    001024:     01.001023A (0026)         JMP     OTL2
    001025:     41.001022A (0027)         JMP     CHAROUT,*
    (0028)
    001026:       144305   (0029) MSG     BCI     'HELLO WORLD!'
    001027:       146314
    001030:       147640
    001031:       153717
    001032:       151314
    001033:       142241
    001034:       106612   (0030)         OCT     '106612
    001035:     00.000007A (0031) LEN     DAC     *-MSG
    001036:       000000   (0032) IXR     OCT     0
    001037       (0033)         END     HW

Hex dump from the Prime debugger:

    1000  70104   3000  30104  73036  45026 141340 141050  21022
    1010  45026 141050  21022   5036 141206  11036  23035      0
>>> 1021   3003      0 170004   3023 103022 144305 146314 147640
    1031 153717 151314 142241 106612      7      0

>>> Note that it decided not to bother to display the zero in location
1020.  I suspect if I dug in the docs, I could suppress that "helpful"
little feature, but I've checked enough times to know that the location
not displayed really does contain 0.

Here's a disassembly from simh h316, complete with it interpreting data
as instructions and such:

    H316 simulator V3.8-1
    sim> restore h316_hw16s.save
    sim> e -m 1000-1036
    1000:   SKS 104
    1001:   JMP 1000
    1002:   OCP 104
    1003:   LDX 1036
    1004:   LDA 1026,1
    1005:   ICA
    1006:   CAL
    1007:   JST 1022
    1010:   LDA 1026,1
    1011:   CAL
    1012:   JST 1022
    1013:   LDA 1036
    1014:   AOA
    1015:   STA 1036
    1016:   CAS 1035
    1017:   HLT
    1020:   HLT
    1021:   JMP 1003
    1022:   HLT
    1023:   OTA 4
    1024:   JMP 1023
    1025:   JMP* 1022
    1026:   LDA* 305,1
    1027:   ANA* 314,1
    1030:   ANA* 1640,1
    1031:   ERA* 1717,1
    1032:   STA* 1314,1
    1033:   JMP* 241,1
    1034:   ANA* 612
    1035:   DBL
    1036:   HLT

and an octal dump from the simh h316 sim:

    sim> e 1000-1036
    1000:   070104
    1001:   003000
    1002:   030104
    1003:   073036
    1004:   045026
    1005:   141340
    1006:   141050
    1007:   021022
    1010:   045026
    1011:   141050
    1012:   021022
    1013:   005036
    1014:   141206
    1015:   011036
    1016:   023035
    1017:   000000
    1020:   000000
    1021:   003003
    1022:   000000
    1023:   170004
    1024:   003023
    1025:   103022
    1026:   144305
    1027:   146314
    1030:   147640
    1031:   153717
    1032:   151314
    1033:   142241
    1034:   106612
    1035:   000007
    1036:   000000

============ fini



More information about the Simh mailing list