[Simh] Custom PC formatting

Mark Pizzolato - Info Comm Mark at infocomm.com
Sun Oct 6 13:06:22 EDT 2013


On Sunday, October 06, 2013 at 9:54 AM, Peter Onion wrote:
> On Sun, 2013-10-06 at 09:37 -0700, Mark Pizzolato - Info Comm wrote:
> >  >
> > >
> > > I'll reply to the list this time !
> > >
> > > Ok, so I guess this is done via HRDATADF and the psl_bits definition ?
> > >
> > > HRDATADF is not mentioned in the docs and from that one example it is
> > > rather hard to see how to use it to do what I need.
> >
> > I believe that these are mentioned in the doc files in the doc directory at
> github.com/simh/simh.
> 
> I've looked, but IO can't find any reference to them.
> 
> > > I have a 14 bit SCR register and I want to print ((SCR >> 1) & 8191) and a
> > > decimal, and add a "+" on the end if ((SCR & 1) == 1).
> > >
> > > I've tried to define my PC using HRDATADF, and it picks up the name
> string
> > > OK but it isn't doing anything with the bit/field definitions as far as I can
> tell,
> > > it's still just printing it out a decimal.
> >
> > Please provide your code.
> >
> > I'll take a shot, not knowing precisely what you really want to see:
> >
> > It seems like this register has two fields.  Lets say it is a 16 bit
> 
> 14 bits actually...
> 
> > register with the high 15 bits the PCValue and the Low Bit this extra
> > flag bit you want to see as a "+" when it is set.  And you'd like to
> > see the high 15 bits displayed in octal.
> 
> Decimal actually...
> 
> > I'd define the low bit as a selector on two strings:
> >
> > uint16 scr;
> >
> > char *lowbit_values[] = {"", "+"};
> >
> > BITFIELD SCR_bits {
> >     BITFNAM(LOW,1, lowbit_values),
> >     BITFFMT(PCV,15,"%o") ,
> >     ENDBITS
> > };
> >
> > REG cpu_reg[] = {
> >    ....
> >     { HRDATADF(SCR,        scr, 16, "sequence control register", SCR_bits) },
> >    ....
> >    NULL
> > };
> >
> 
> That's close to the code I had already, but it doesn't affect the way
> that the SCR is printed out after the "stop message" when sim_instr
> returns.  When it reaches a dynamic stop in the second instruction in
> location 4 it prints
> 
> "Dynamic Stop, SCR: 0009"
> when it should print
> "Dynamic Stop, SCR: 0004+"
> 
> 
> Thanks for trying to help :-)

No problem, we are now narrowing in on the right question.

To address this issue, your simulator should provide a "sim_vm_fprint_addr" routine.  This routine has a signature of:

void sim_vm_fprint_addr (FILE *st, DEVICE *dptr, t_addr addr);

The LGP simulator uses this interface.  Look there for details.

- Mark

You can 

sim_vm_fprint_addr


More information about the Simh mailing list