[Simh] fprint_sym and parse_sym limitation
Paul Koning
paulkoning at comcast.net
Fri Sep 11 20:17:12 EDT 2015
> On Sep 11, 2015, at 4:43 PM, J. David Bryan <jdbryan at acm.org> wrote:
>
> On Friday, September 11, 2015 at 15:32, Paul Koning wrote:
>
>> Not quite. It would break existing simulators that use the addr field
>> for register radix without masking it.
>
> But existing simulators wouldn't be passing any user-defined REG_* flags,
> so "(rptr->flags & REG_UFMASK) | rdx" would be equal to "rdx", and they'd
> receive the radix just as before.
Yes, good point.
>
>
>> If you want to disregard that case, would it not be just as simple,
>> but more powerful, to pass the index into the registers array as
>> "addr"? Then all you need is to find the regs vector from the UNIT
>> pointer, and index that with addr, and you have all the information you
>> might want about that register -- its flags, name, or the register
>> number if you want to use that.
>
> Assume that I have three CPU registers that I want to format identically.
> How do I tell if I've been called for one of these? If I receive the
> index, then I'd have to do:
>
> if (addr == 3 || addr == 7 || addr == 12) ...
>
> or:
>
> if (strcmp (cpu_reg [addr].name, "CIR") == 0 ||
> strcmp (cpu_reg [addr].name, "NIR") == 0 ||
> strcmp (cpu_reg [addr].name, "XIR") == 0) ...
>
> whereas with a user-defined flag, it's:
>
> if (addr & REG_IR) ...
I'd do: if (cpu_reg[addr].flags & REG_IR) ...
paul
More information about the Simh
mailing list