[Simh] Custom PC formatting

Peter Onion Peter.Onion at btinternet.com
Sun Oct 6 12:19:20 EDT 2013


On Sun, 2013-10-06 at 08:46 -0700, Mark Pizzolato - Info Comm wrote:
> On Sunday, October 06, 2013 at 7:54 AM, Peter Onion wrote:
> > I'm just having a look at porting an existing emulation into the simh
> > framework.
> > 
> > My first problem is that there seems to be no way to provide a custom
> > "print" routine for the value of the PC.
> > 
> > Why do I need one ?
> > 
> > Because the least significant bit of the Sequence Control Register in my
> > machine has the value "half" as there are 2 instructions in each word.
> > 
> > I'm sure I'll have lots more questions soon !
> 
> Hi Peter,
> 
> Actually there is a custom way to display the contents of any simh device register.
> 
> This is available on the most recent simh codebase on github:  https://github.com/simh/simh
> 
> In the latest code, registers can have an optional bit field description for the register.  The bitfields can be formatted in a variety of flexible ways.
> 
> An example of a register which uses a custom formatting paradigm is the PSL register definition in the VAX CPU module at https://github.com/simh/simh/blob/master/VAX/vax_cpu.c
> 
> FYI a zip of the current code base is available at: https://github.com/simh/simh/archive/master.zip
> 
> Please come back with more questions as you encounter them.
> 

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 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.


Peter Onion
Elliott 803 Team leader 
The National Museum of Computing





More information about the Simh mailing list