Post Reply 
WIP: 16C firmware hack for more memory
11-11-2023, 01:56 AM
Post: #81
RE: WIP: 16C firmware hack for more memory
(11-10-2023 11:07 PM)brouhaha Wrote:  
(11-10-2023 08:38 PM)blackjetrock Wrote:  As this is emulated code, surely it is possible to have more than one instruction at an address? The strict one to one relationship between addresses and instructions that the hardware imposes on a real machine doesn't necessarily need to apply when emulating instructions?

I have a simulated program counter that points to an simulated ROM word, so without going too crazy in inventing new embellishments to the Nut architecture, I still only get two instructions in two ROM addresses. Or one two-word instruction, such as a subroutine call to elsewhere else.

The two-word thing was interesting, in that it limited the choices available unless I replaced it with a subroutine call. A much bigger acoomplishment was fitting a higher-precision divide-by-14 routine (multiplication by a higher-precision approximation of the reciprocal of 14) in the less space than the original, and having it work just slightly faster.

When I got the HP-41C and HP-41CX microcode running on the DIY5 hardware the late Richard Ottosen and I built, in order to add four-level stack display, I had the simulator trap certain PC addresses and do special things. The four-level stack display actually runs the microcode that formats the X register display four times instead of just one, for T, Z, Y, and X in that order, so that at the end of the iterations, the calculator state should be identical to what it would be if only X were displayed. There were several other such hacks to increase the number of flags, etc. (I have no idea whether the SwissMicros firmware for their DM41X uses similar techniques.)

In the case of the HP-41, I was worried that actually changing the mainframe ROM image could break things. In the case of the HP-16C, it is a much more contained problem, due to having no plug-in ROMs, so I'm more confident in my ROM patches.

Could you not have the following:?

When address x is executed,

1. Execute the instruction from the ROM
2. Execute extra instructions

It sound like the 41C insertion you did. I think even jumps to X still work and you can squish more functionality onto the code. It's really like having a new, longer opcode added to the instruction set I suppose. It does mean that you can never put it in a ROM, but you do get your extra functionality, and it shouldn't break anything, which is the big advantage.
I've not done this at all, so it's interesting to see that you did it in the 41C work.
It doesn't get the elegance award, but does get the job done.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
More labels? - brouhaha - 01-30-2023, 06:40 AM
statistical registers - brouhaha - 04-22-2023, 06:00 AM
RE: WIP: 16C firmware hack for more memory - blackjetrock - 11-11-2023 01:56 AM



User(s) browsing this thread: 1 Guest(s)