{"id":2014,"date":"2018-03-09T11:27:51","date_gmt":"2018-03-09T11:27:51","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=2014"},"modified":"2018-04-25T22:48:05","modified_gmt":"2018-04-25T22:48:05","slug":"hp-29-microcode-reference","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/2014\/hp-29-microcode-reference\/","title":{"rendered":"HP-29 Microcode Reference"},"content":{"rendered":"<p>This is a bit early but I wanted to get a few things down now<!--more--><\/p>\n<p>98 Program steps occupy 14 registers, 7 steps per register, in ram[32..45].<br \/>\nThe user program counter is in M2[2..0] as step, bank, register.<br \/>\nRegister starts as D (13) and works down to 0.<br \/>\nSteps are 6..0. Bank is always 2 (ram 32..47).<br \/>\nA value of 000 shows as step &#8220;00&#8221;.<\/p>\n<p>Memories are 0-9 in ram[0-9], .0-.5 (indirect 10-15) in ram[10-15], and indirect 16-29 in ram[16-29]. These are in ram banks 0 and 1.<\/p>\n<p>LastX is in ram[31]<br \/>\nX gets stored in lots of places (A\/B, C, M1, and ram[30] and ram[47])<br \/>\nThe magic number gets stored in ram[46]. If this is missing, the microcode reports an &#8220;Error&#8221; due to a loss of Continuous Memory.<\/p>\n<p>s3 is the PRGM-RUN switch flag. 1=RUN.<br \/>\ns5 is power ok. 0=low power.<br \/>\ns15 is keypressed<\/p>\n<p>The microcode includes 01120, 01220 and 01320 opcodes, which are unknown and presumed to be printer related.<\/p>\n<p>In the real world, only ram banks 0 and 2 are CMOS. In the emulator, all are.<\/p>\n<p>Whilst there is no way to share programs between a HP-29C and a HP-19C, they use the same hex codes for user program steps. This means the HP-29C could potentially attempt to execute &#8220;printer related&#8221; keys intended for a HP-19C. This lends credence to the unknown opcodes being &#8220;printer related&#8221;.<\/p>\n<p>User program step 1 is stored in the bottom 2 nibbles of ram[45]. The user program counter value for this is &#8220;62D&#8221;. &#8220;D&#8221; of bank 2 is ram[2*16+13]= ram[45] (ie ram[0x2D]).<\/p>\n<p>The HTML5 emulator (<a href=\"http:\/\/www.sydneysmith.com\/wordpress\/hp29u\/\">hp29u<\/a>) saves ram if you close the browser or tab, navigate to a different page, or do a refresh. It also does a save if you switch the calculator OFF.<\/p>\n<p>You WILL get an &#8220;Error&#8221; the first time you load the HTML5 emulator. This is because Continuous Memory has not been saved previously and cannot be loaded. All values are zero and this triggers the (memory lost) &#8220;Error&#8221; message. It is very hard to get that error again afterwards. *Update*: use menu, advanced, settings to zero out the value in d46 (ram[46]); then refresh the page. This will save the zeros and restart with the memory lost &#8220;Error&#8221;.<\/p>\n<p>Precision is stored in ram[46][2], the exponent sign.<\/p>\n<p>For the hp29 emulators a voltage of 1.9 or less will trigger the low voltage display and 2.1 or more is fine. (2.0 varies, sorry &#8211; my inconsistency). I don&#8217;t know what the trigger point is on the real thing. It has 2xAA batteries so that is nominally 3V though, with rechargeables, that might be 2.6 or 2.4V. Below 2 seemed plausible for &#8220;low&#8221;.<\/p>\n<p>There is a <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/hp29rom.txt\" rel=\"noopener\" target=\"_blank\">HP-29C microcode listing<\/a> with octal addresses and statements.<\/p>\n<h2>Addresses<\/h2>\n<p>00000 start<br \/>\n00152 wait loop start<br \/>\n00124 end of function (common code from here)<br \/>\n01167 clear prefixes (&#038; s0,13,14)<br \/>\n00425 key_sto<br \/>\n00436 key_9<br \/>\n00437 key_8<br \/>\n00440 key_7<br \/>\n00441 key_sub<br \/>\n00443 key_3<br \/>\n00444 key_2<br \/>\n00445 key_1<br \/>\n00456 key_dot<br \/>\n00457 key_0<br \/>\n00462 key_6<br \/>\n00463 key_5<br \/>\n00464 key_4<br \/>\n00465 key_add<br \/>\n00467 key_f<br \/>\n00473 key_g<br \/>\n00555 key_clx<br \/>\n00745 digit<br \/>\n00747 upd_hex (adds digit into hex code)<br \/>\n01045 gto_dot<br \/>\n06000 hex_0x<br \/>\n06401 func_enter (hex code 01)<br \/>\n06404 func_clx (hex code 04)<\/p>\n<h2>s Flags<\/h2>\n<p>s3 run_mode (PRGM-RUN switch)<br \/>\ns5 power_ok<br \/>\ns4,6,7,8,10 prefix code (f,g,STO,RCL,GTO,GSB,LBL,..)<br \/>\ns9 auto_enter<br \/>\ns12 digit entry<br \/>\ns13 (for STO\/RCL\/LBL\/&#8230;) over 5 (not .0 &#8211; .5)<br \/>\ns15 key_pressed<\/p>\n<h2>RAM<\/h2>\n<p>00-09 STO\/RCL 0-9<br \/>\n10-15 STO\/RCL .0-.5<br \/>\n16-29 STO\/RCL i (i = 16-29)<br \/>\n30 used?<br \/>\n31 LastX<br \/>\n32-45 98 program steps (14 registers)<br \/>\n46 Magic (cmos fail if mantissa wrong) [xs]=precision<br \/>\n47 SaveX (keeps X in cmos when off)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a bit early but I wanted to get a few things down now<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5,66],"tags":[32,34],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2014"}],"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=2014"}],"version-history":[{"count":9,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2014\/revisions"}],"predecessor-version":[{"id":2137,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2014\/revisions\/2137"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}