The [R/S] key is supposed to allow you to Run and Stop a user entered program. That, by itself, is useful. However, it also allows you to stop a program at a predetermined point and allow data to be keyed in. That is also very useful. When you’ve keyed in (or calculated) the value, you just press [R/S] to resume the program.
But it doesn’t work.
Well, it probably does on the real thing; but it doesn’t on the few microcode emulators available on the internet. You see, the available microcode doesn’t work.
The available microcode for [R/S] looks like this:
01000 goto 01242 ; 000 nop (start prog code jump table) ... 01042 goto 01101 ; 042 R/S ... 01101 0 -> c[m] 01102 delayed select group 1 01103 c <-> m 01104 c -> stack 01105 goto 01237
Line 01103 is actually the first line for the ENTER function.
It makes no sense at all to have R/S progress into ENTER. If you’ve keyed a number in and hit R/S, you don’t want a second copy going into the Y register in the stack.
Having a delayed instruction before a goto is pretty common given the limits inherent in the processor of the time. But, having it in one path (R/S) and not in another (ENTER) is unlikely. It is possible but everything would have to be in exactly the right locations for that to work. Move one bit (ie to fix or add something during development) and the whole lot would fail.
It’s unlikely.
I am sure that HP fixed it in the real thing and that the microcode in the real thing doesn’t look like that. It’s either a transcription error somewhere or an earlier version of the microcode. I had a pretty good look at what could have been mistyped but I couldn’t see it. My guess is the “earlier version” and that someone said, “oh my, that doesn’t work” and fixed it. Unfortunately I don’t know what they did to make the fix. There is limited space in the real thing. They’ve used up all of the 3K of ROM space. There are some “nops” in the code that might be useable. They might have even had to rewrite or move chunks around to fit in a few extra instructions.
Fundamentally, the [R/S] function is quite simple. It comes down to:
if not running if s8 = 0 goto make_it_run goto here+5 ; it is running clear the running flag 0 -> s8 goto the wait loop 1 -> f3 ; update display c <-> m ; X to C, settings to M goto 00622 make_it_run: set the running flag 1 -> s8 goto the wait loop goto 02107
It needs 8 instructions where only 2 will fit. HP will have solved it and their version might even be fancier and longer than my version. What’s more, they will have fitted it into the constraints of the hardware (10 bit instructions, 8 bit jumps, 3K of ROM). It is a very impressive feat.
These days memory is cheap and emulated memory is even cheaper. For my emulator, I was able to tack the additional instructions in address space 06000-06377 – a ROM that doesn’t exist. I also added a microcode instruction that I bet they wished every day that they had – a “gofar address” that will directly jump to any location in any ROM in any group from any location.
Neither the 06000 address space nor the gofar instruction match the real hardware. They simply let me patch the pre-release microcode so that it works. If I ever get a copy of the final version I’ll be delighted to use that instead.
The “gss-hp65” microcode emulator has been updated today (13 Dec 2015) with the patch and basic testing suggests that the [R/S] function is now working in this latest version.
How do you know if it is working in your copy, or another microcode emulator? Press [R/S]. If it has the buggy instructions the screen will blank for ages. It may eventually show a countdown. In the debug screen (for those emulators that have one) you’ll see it stuck in a loop somewhere in the 05000’s.
With the above fix you’ll get more sensible results. I did a (f CL PRGM) “LBL A, 1, +, R/S, GTO A” program and pressed [A]. Every time you press [R/S] it resumes and adds 1 again.
{
« Well, it probably does on the real thing; but it doesn’t on the few microcode emulators available on the internet »
http://www.sydneysmith.com/wordpress/1428/hp-65-rs/
}
➡ YES, the real HP-65 works perfectly;
➡ NO, because the Java Emulator of Jacques Laporte works perfectly:
http://wiki.epfl.ch/polymac/documents/Laporte/hp65/HP65.html
However, my own JavaScript Emulator (that you copied) does not work because it stops when the HP’s firmware waits for a key press, so that the User Programs will stop as well:
http://home.citycable.ch/pierrefleur/HP65/default.htm
➡ Like original Ashley Feniello’s HP-35 Emulator:
function keyStatusFlagTestInstructionHit() {
keyflagtests++
if (updateTrace)
updateTrace = false; // stop gathering after first s[0] test to avoid capturing (uninteresting) IO polling loop
}
{
« It’s either a transcription error somewhere or an earlier version of the microcode »
}
➡ NO, because the original HP firmware is identical for these 2 Emulators, since I copied Jacque’s microcode (.obj) !
Thank you for all the work on Microcode-Level Emulators that you published on your Web site !
Francois
Thank you Francois. I couldn’t have done my version without your earlier work.
I would like to apologise and will include credits on my HP65 Emulator Help page. You are credited (as is Jacques and Ashley) through the Help page for my HP67u. (see hp67u credits)
Thank you also for the link to Jacques’ HP-65 page. I corresponded with him some time ago over the HP67 but I’d been unable to find any of his work on the ’65. I remember him saying he’d publish his notes about the microcode (for the ’67) and that inspired me to do the recent batch of posts (for the ’65 for now).
You’ll find that I do the wait for key press differently, but with the same intent. The key flag test count is an elegant solution but I found it easier for the HP67 to just check the microcode address. I ended up using that in the ’65 too. Your approach is better because I’m writing code for a ROM that depends on the ROM. Not a problem if the ROM is never going to change; but sensing which microinstructions are running makes it work (mostly unchanged I expect) across all of the classics in your collection of emulators.
I’ll have a look and see if I can see anything different in how the delayed group select is implemented in those that work. Ashley’s, yours and mine all wake up on a key press (such as R/S) so it should be possible for it to work in the javascript versions too.
I was very impressed with your range of emulators.
Hi,
I spent a whole lot of time (too much to remember) going over the HP-65 code and finally found and repaired the problems. The emulator at http://www.teenix.org, now works 100% as described in the manuals.
cheers
A very impressive site and set of emulators Tony. Well done.
The followup article to this one is
http://www.sydneysmith.com/wordpress/1448/hp-65-delayed-select-group/. That discusses the error in the implementation of earlier emulators.