{"id":2060,"date":"2018-03-14T13:05:09","date_gmt":"2018-03-14T13:05:09","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=2060"},"modified":"2018-03-14T13:05:09","modified_gmt":"2018-03-14T13:05:09","slug":"the-hp-25-rom-dilemma","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/2060\/the-hp-25-rom-dilemma\/","title":{"rendered":"The HP-25 ROM dilemma"},"content":{"rendered":"<p>Current thinking has the HP-25 and HP-25C having the same ROMs. After all, they do the same things. It makes a lot of sense.<\/p>\n<p>This suggests that you can take an emulator that supports continuous memory and add in a standard HP-25 \/ HP-25C ROM. Whilst that does sound like a valid recipe for a HP-25C, it isn&#8217;t. There are some issues that may not have been mentioned before.<!--more--><\/p>\n<p>The combination doesn&#8217;t work for a very simple reason. It doesn&#8217;t work because the first thing the ROM does is to clear the memory! No, it doesn&#8217;t sound very continuous to me either.<\/p>\n<p>Clearing memory makes sense on a HP-29C, if it detects a memory lost error. But, as far as I recall, fancy checks like that didn&#8217;t come until after the HP-25C. Besides, there doesn&#8217;t seem to be any checking beforehand in the HP-25 ROM. It just clears memory regardless. The checks in the HP-29C are pretty obvious. There is nothing like that in the HP-25\/C startup code.<\/p>\n<p>Now I might be missing something here but, for now, my hypothesis is:<\/p>\n<p><em>Despite current thinking, the ROM got upgraded between the models.<\/em><\/p>\n<p>It wouldn&#8217;t need to be much of a change; but it can&#8217;t be continuous memory if the first thing you do is forget.<\/p>\n<p>There is some support for this idea in the chips present in the calculators. It&#8217;s not conclusive in what I have to hand but, whilst the listing says certain ROMs were present in both the HP-25 and the HP-25C, it does say that ROM \/ anode driver 1818-0153 was only used in the HP-25. There are plenty of other examples where a chip has &#8220;25\/25C&#8221; written against it so it is interesting that this one only says &#8220;25&#8221;. There is also a later chip &#8211; the 1818-0168 &#8211; that replaces the HP-25 ROM \/ anode driver with a &#8220;25\/25C&#8221; version.<\/p>\n<p>The available startup code said to be for a HP-25 \/ HP-25C looks like this:<br \/>\n<code><\/p>\n<pre>\r\nHP25 Logging started.\r\n; S= ...3.5..........\r\n00000 if n\/c goto 00236\r\n00236 c -> addr\r\n00237 clear data registers\r\n...\r\n<\/pre>\n<p><\/code><br \/>\nIt is pretty short so there are few opportunities to not clear the registers.<\/p>\n<p>This is power up code so both the carry flag and the C register are normally zero. If that is the case, then data registers 0-15 are going to get zeroed.<\/p>\n<p>Your options for avoiding that fate are:<\/p>\n<p><strong>Option 1<\/strong>. Set carry at &#8220;power up&#8221; on a HP-25C so the original goto never happens. This might be possible, if the carry flag is available on a CPU chip pin. However, the code that gets run if the goto doesn&#8217;t happen (not n\/c), the code from 0001 onward; doesn&#8217;t seem to have any relationship to power up code. There is also a &#8220;goto 0001&#8221; (at 00153) which suggests that the program counter gets to 0001 from there rather than by carry being set at power up. I should note that both the HP-25 and HP-25C are said to use the same CPU chip so it can&#8217;t be that the CPU chip behaves differently when placed near continuous memory RAM. It&#8217;d have to be a pin and different wiring.<\/p>\n<p><strong>Option 2<\/strong>. Put some value other than 0 in c at power up if it is a HP-25C. That&#8217;d be possible, but again you&#8217;d need a CPU pin to make it boot up differently when installed in a HP-25C.<\/p>\n<p>Short of extreme measures that would be difficult to build into the CPU (having a &#8220;clear data registers&#8221; opcode only work when the program counter isn&#8217;t 00237, or perhaps until after four other instructions have executed); the above are your only two options.<\/p>\n<p>An extra pin is possible. They would have needed to know beforehand: that &#8220;continuous memory&#8221; was going to come along, that they were going to upgrade the HP-25, that they would need to change the behaviour of the existing microcode; and that they would do it by forcing carry high or by forcing a value into c.<\/p>\n<h2>The Dilemma<\/h2>\n<p>How can the same ROM with the same CPU and the same power up conditions produce different outcomes?<\/p>\n<p>If the output is determinable from the inputs and the inputs are the same and the processes are the same then the outputs should be the same.<\/p>\n<h2>Solutions<\/h2>\n<p><strong>Solution 1<\/strong>. The most likely explanation is the ROM \/ anode driver got upgraded between the HP-25 and the HP-25C and the ROMs weren&#8217;t the same. The new ROM doesn&#8217;t clear the data registers on power up. The calculator will start with zeros in the volatile RAM in a HP-25; or with existing values in the &#8220;continuous memory&#8221; RAM in a HP-25C. The easiest fix would be to replace the &#8220;clear data registers&#8221; at 00237 with a &#8220;nop&#8221;. Perhaps that was the change between the two ROM \/ anode driver chips.<\/p>\n<p><strong>Solution 2<\/strong>. Add an extra input that is different between the two calculators. This is the extra pin solution.<\/p>\n<h2>HP-25 \/ HP-25C Emulator<\/h2>\n<p>I believe:<\/p>\n<ul>\n<li>the problem only occurred when they went to develop the HP-25C,<\/li>\n<li>they issued an updated ROM \/ anode driver to not &#8220;clear data registers&#8221; for a HP-25C,<\/li>\n<li>the most likely change was to &#8220;nop&#8221;-out that instruction,<\/li>\n<li>the new ROM is common to the HP-25C and newer HP-25 calculators, and<\/li>\n<li>the available ROM uses microcode from the original, HP-25 only, 1818-0153 chip.<\/li>\n<\/ul>\n<p>I have modified the ROM code I use with my HP-25 \/ HP-25C emulator to &#8220;nop&#8221;-out the &#8220;clear &#8230;&#8221;, as discussed above.<\/p>\n<p>The modified ROM results in the emulator working properly in both HP-25 and HP-25C modes.<\/p>\n<p>As always, I&#8217;m happy to be corrected if any of my logic or assumptions are wrong. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Current thinking has the HP-25 and HP-25C having the same ROMs. After all, they do the same things. It makes a lot of sense. This suggests that you can take an emulator that supports continuous memory and add in a standard HP-25 \/ HP-25C ROM. Whilst that does sound like a valid recipe for a &hellip; <a href=\"https:\/\/www.sydneysmith.com\/wordpress\/2060\/the-hp-25-rom-dilemma\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">The HP-25 ROM dilemma<\/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,69],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2060"}],"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=2060"}],"version-history":[{"count":10,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2060\/revisions"}],"predecessor-version":[{"id":2070,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2060\/revisions\/2070"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}