{"id":1428,"date":"2015-12-13T11:55:47","date_gmt":"2015-12-13T11:55:47","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=1428"},"modified":"2017-05-14T00:43:08","modified_gmt":"2017-05-14T00:43:08","slug":"hp-65-rs","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/1428\/hp-65-rs\/","title":{"rendered":"HP-65 R\/S"},"content":{"rendered":"<p>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&#8217;ve keyed in (or calculated) the value, you just press [R\/S] to resume the program.<\/p>\n<p>But it doesn&#8217;t work. <!--more--><\/p>\n<p>Well, it probably does on the real thing; but it doesn&#8217;t on the few microcode emulators available on the internet. You see, the available microcode doesn&#8217;t work.<\/p>\n<p>The available microcode for [R\/S] looks like this:<\/p>\n<pre>\r\n01000 goto 01242     ; 000 nop   (start prog code jump table)\r\n...\r\n01042 goto 01101     ; 042 R\/S\r\n...\r\n01101\t0 -&gt; c[m]\r\n01102\tdelayed select group 1\r\n01103\tc &lt;-&gt; m\r\n01104\tc -&gt; stack\r\n01105\tgoto 01237\r\n<\/pre>\n<p>Line 01103 is actually the first line for the ENTER function.<\/p>\n<p>It makes no sense at all to have R\/S progress into ENTER. If you&#8217;ve keyed a number in and hit R\/S, you don&#8217;t want a second copy going into the Y register in the stack.<\/p>\n<p>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.<\/p>\n<p>It&#8217;s unlikely.<\/p>\n<p>I am sure that HP fixed it in the real thing and that the microcode in the real thing doesn&#8217;t look like that. It&#8217;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&#8217;t see it. My guess is the &#8220;earlier version&#8221; and that someone said, &#8220;oh my, that doesn&#8217;t work&#8221; and fixed it. Unfortunately I don&#8217;t know what they did to make the fix. There is limited space in the real thing. They&#8217;ve used up all of the 3K of ROM space. There are some &#8220;nops&#8221; 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.<\/p>\n<p>Fundamentally, the [R\/S] function is quite simple. It comes down to:<\/p>\n<pre>\r\nif not running             if s8 = 0\r\ngoto make_it_run           goto here+5\r\n; it is running\r\nclear the running flag     0 -&gt; s8\r\ngoto the wait loop         1 -&gt; f3     ; update display\r\n                           c &lt;-&gt; m     ; X to C, settings to M\r\n                           goto 00622\r\nmake_it_run:\r\nset the running flag       1 -&gt; s8\r\ngoto the wait loop         goto 02107\r\n<\/pre>\n<p>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&#8217;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.<\/p>\n<p>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 &#8211; a ROM that doesn&#8217;t exist. I also added a microcode instruction that I bet they wished every day that they had &#8211; a &#8220;gofar address&#8221; that will directly jump to any location in any ROM in any group from any location.<\/p>\n<p>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&#8217;ll be delighted to use that instead.<\/p>\n<p>The &#8220;gss-hp65&#8221; 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.<\/p>\n<p>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&#8217;ll see it stuck in a loop somewhere in the 05000&#8217;s.<\/p>\n<p>With the above fix you&#8217;ll get more sensible results. I did a (f CL PRGM) &#8220;LBL A, 1, +, R\/S, GTO A&#8221; program and pressed [A]. Every time you press [R\/S] it resumes and adds 1 again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ve keyed in (or calculated) the value, you &hellip; <a href=\"https:\/\/www.sydneysmith.com\/wordpress\/1428\/hp-65-rs\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HP-65 R\/S<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5,39],"tags":[37,32],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1428"}],"collection":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1428"}],"version-history":[{"count":5,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1428\/revisions"}],"predecessor-version":[{"id":1433,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1428\/revisions\/1433"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}