{"id":1152,"date":"2015-10-19T10:17:03","date_gmt":"2015-10-19T10:17:03","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=1152"},"modified":"2017-05-14T01:48:46","modified_gmt":"2017-05-14T01:48:46","slug":"hp67-card-reader","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/1152\/hp67-card-reader\/","title":{"rendered":"HP67 Card Reader"},"content":{"rendered":"<p>This is a work in progress and likely to be updated.<\/p>\n<p>The HP67 Arithmetic, Control and Timing chip (ACT) is a Mostek MK6216N. It understands most of the instructions but the HP67 card reader chip (CRC, a Mostek MK6250N) adds instructions and two more data registers:<!--more--><\/p>\n<h2>Extra Instructions<\/h2>\n<p>Default Functions Flag. (ie if no program loaded. A-E do 1\/x etc.)<br \/>\nCRC 1000 = Set.<br \/>\nCRC 1100 = Test. If flag s[3]=1. Clear flag.<\/p>\n<p>Write mode (data or prog)<br \/>\nCRC 660 = Set.<br \/>\nCRC 760 = Clear.<\/p>\n<p>Merge Flag<br \/>\nCRC 1200 = Set.<br \/>\nCRC 1300 = Test. If flag s[3]=1. Clear flag.<\/p>\n<p>&#8220;a key was pressed&#8221; flag.<br \/>\nCRC 400 = Set.<br \/>\nCRC 500 = Test. If flag s[3]=1. Clear flag.<\/p>\n<p>&#8220;waiting for side 2&#8221; flag.<br \/>\nCRC 1400 = Set.<br \/>\nCRC 1500 = Test. If flag s[3]=1. Clear flag.<\/p>\n<p>???display_digits???<br \/>\nCRC  60 = Set.<br \/>\nCRC 160 = Test. If flag s[3]=1. Clear flag.<\/p>\n<p>CRC 300 = Test W\/PRGM switch. If &#8230; s[3]=1.<\/p>\n<p>CRC 560 = Test card inserted. If &#8230; s[3]=1.<\/p>\n<p>CRC 100 = Test ready. If ready s[3]= 1. Clear card inserted.<\/p>\n<p>CRC 360 = Motor off.<\/p>\n<p>CRC 260 = Motor on.<\/p>\n<p>CRC 1700 = RW (read\/write 7 nibbles fm\/to card)<\/p>\n<h2>Extra RAM addresses<\/h2>\n<p>0x99 Write data (to go to card) &#8211; only the lhs (7 nibbles get written).<br \/>\n0x9b Read data (from card) &#8211; same 7 nibbles appear in lhs and rhs eg 12345671234567.<\/p>\n<h1>Microcode<\/h1>\n<h2>Write<\/h2>\n<pre>\r\n13211 if 1 = s 3 \r\n13212 then go to 013406\r\n13213 return \r\n13154 a exchange c[w] \t; a is chksum (left 7 nibbles) and n (15..0) from ram[base+n]\r\n13155 c - 1 -&gt; c[p] \t; n=n-1\r\n13156 if n\/c go to 013125\r\n13125 c -&gt; addr \r\n13126 b exchange c[w] \r\n13127 data -&gt; c \t; get ram[base+n]\r\n13130 0 -&gt; a[w] \r\n13131 p &lt;- 6 \r\n13132 c -&gt; a[wp] \t; put rhs in a, lhs stays in c\r\n13133 rotate a left \t; move rhs, left 7 nibbles\r\n13134 rotate a left \r\n13135 rotate a left \r\n13136 rotate a left \r\n13137 rotate a left \r\n13140 rotate a left \r\n13141 rotate a left \r\n13142 0 -&gt; c[wp] \r\n13143 a exchange b[w] \t; save in b for later\r\n13144 a + b -&gt; a[w]\t; update chksum \r\n13145 a + c -&gt; a[w] \t; update chksum\r\n13146 jsb 013162\t; select ram[0x99]\r\n13162 p &lt;- 1 \r\n13163 load constant 9 \r\n13164 load constant 9 \r\n13165 c -&gt; addr \r\n13166 return \r\n13147 c -&gt; data \t; write c to ram[0x99]\r\n13150 jsb 013201\t; wait for crc to be ready\r\n13201 0 -&gt; s 3 \r\n13202 CRC 100 \r\n13203 if 0 = s 3 \r\n13204 then go to 013202\r\n13205 binary \r\n13206 p &lt;- 0 \r\n13207 0 -&gt; s 3 \r\n13210 CRC 1700 \t\t; write data to card\r\n13211 if 1 = s 3 \r\n13212 then go to 013406\t; probably error writing\r\n13213 return \r\n\r\n13151 b exchange c[w] \t; write what was in b (ram[..].rhs &lt;&lt; 7)\r\n13152 c -&gt; data \r\n13153 jsb 013201\t; wait for crc to be ready\r\n13201 0 -&gt; s 3 \r\n13202 CRC 100 \r\n13203 if 0 = s 3 \r\n13204 then go to 013202\r\n13205 binary \r\n13206 p &lt;- 0 \r\n13207 0 -&gt; s 3 \r\n13210 CRC 1700 \t\t; write\r\n13211 if 1 = s 3 \r\n13212 then go to 013406\r\n13213 return \r\n<\/pre>\n<h2>Read<\/h2>\n<pre>\r\n12650: b exchange c[w]\r\n12651: jsb 012644                    ; select ram bank 3 (addr=48)\r\n12652: b -&gt; c[w]\r\n12653: c -&gt; data register 15\r\n12654: a -&gt; b[w]\r\n12655: data register -&gt; c 12\r\n12656: a exchange c[w]\r\n12657: data register -&gt; c 11\r\n12660: if 0 = s 8\r\n12661: then go to 012670\r\n12662: if a &gt;= c[m]\r\n12663: then go to 012670\r\n;\r\n; update counters but don't save anything (g MERGE)\r\n12664: c - 1 -&gt; c[m]\r\n12665: c -&gt; data register 11\r\n12666: data register -&gt; c 15\r\n12667: if n\/c go to 012677\r\n;\r\n; update counters and save b in ram[ram[48+15]]\r\n12670: c - 1 -&gt; c[m]\r\n12671: c -&gt; data register 11\r\n12672: data register -&gt; c 15\r\n12673: c -&gt; addr\r\n12674: b exchange c[w]\r\n12675: c -&gt; data                   ; save ram[i]= lhs.rhs\r\n12676: b exchange c[w]\r\n;\r\n; finish up\r\n12677: p &lt;- 3\r\n12700: return\r\n<\/pre>\n<h2>Ask for Card<\/h2>\n<pre>\r\n13614: if 1 = s 13          \r\n13615: then go to 013657      \r\n13616: 0 -&gt; b[w]            \r\n13617: p &lt;- 13              \r\n13620: load constant 11     ; 'C'\r\n13621: load constant 10     ; 'r'\r\n13622: load constant 13     ; 'd'\r\n13623: 0 -&gt; c[wp]           ; set rest to 0xffffff...\r\n13624: c -&gt; a[w]            \r\n13625: a - 1 -&gt; a[wp]       \r\n13626: display toggle       ; show \"Crd   \"\r\n13627: 0 -&gt; s 3             \r\n;\r\n; clear key press\r\n13630: 0 -&gt; s 15            \r\n13631: if 1 = s 15          \r\n13632: then go to 013630      \r\n;\r\n; wait for card inserted or key press\r\n13633: if 1 = s 15          \r\n13634: then go to 013641    ; key pressed      \r\n13635: CRC 560              ; if card inserted s 3 = 1                  \r\n13636: if 0 = s 3           \r\n13637: then go to 013633      \r\n13640: return               ; card inserted\r\n<\/pre>\n<h1>Card Format<\/h1>\n<p>For<\/p>\n<pre>46: 00000000000e37\r\n47: 12131e153919fa\r\n<\/pre>\n<p>and W\/PRGM<\/p>\n<pre>\r\n*** CardWrite  0: 0000000\t; sync x 3\r\n*** CardWrite  1: 0000000\r\n*** CardWrite  2: 0000000\r\n*** CardWrite  3: 3100222\t; status\r\n*** CardWrite  4: 12131e1\tram[47] lhs\r\n*** CardWrite  5: 53919fa\tram[47] rhs\r\n*** CardWrite  6: 0000000\tram[46] lhs\r\n*** CardWrite  7: 0000e37\tram[46] rhs\r\n*** CardWrite  8: 0000000\r\n*** CardWrite  9: 0000000\r\n*** CardWrite 10: 0000000\r\n*** CardWrite 11: 0000000\r\n*** CardWrite 12: 0000000\r\n*** CardWrite 13: 0000000\r\n*** CardWrite 14: 0000000\r\n*** CardWrite 15: 0000000\r\n*** CardWrite 16: 0000000\r\n*** CardWrite 17: 0000000\r\n*** CardWrite 18: 0000000\r\n*** CardWrite 19: 0000000\r\n*** CardWrite 20: 0000000\r\n*** CardWrite 21: 0000000\r\n*** CardWrite 22: 0000000\r\n*** CardWrite 23: 0000000\r\n*** CardWrite 24: 0000000\r\n*** CardWrite 25: 0000000\r\n*** CardWrite 26: 0000000\r\n*** CardWrite 27: 0000000\r\n*** CardWrite 28: 0000000\r\n*** CardWrite 29: 0000000\r\n*** CardWrite 30: 0000000\r\n*** CardWrite 31: 0000000\r\n*** CardWrite 32: 0000000\r\n*** CardWrite 33: 0000000\r\n*** CardWrite 34: 0000000\r\n*** CardWrite 35: 0000000\r\n*** CardWrite 36: 96a5c34\t; chksum x2\r\n*** CardWrite 37: 96a5c34\r\n<\/pre>\n<h1>Status<\/h1>\n<p>c6 c5 c4 c3 c2 c1c0<\/p>\n<p>c6= 1 Data, 2 Data#2 (sec).<br \/>\n    3 Prog (001-112), 4 Prog Side 2 (steps 113-224).<br \/>\nThere are 7 steps per register, 16 registers per side, =112 steps).<\/p>\n<p>c5= 1 if single side, 0 if either part of 2 sided card.<\/p>\n<p>c4= (F0?8:0)+(F1?4:0)+(F2?2:0)+(F3?1:0)<\/p>\n<p>c3= 0 DEG, 1 RAD, 2 GRAD<\/p>\n<p>c2= dsp (eg 3 for DSP 3, 2 for DSP 2)<\/p>\n<p>c1c0= 22 FIX, 40 ENG, 00 SCI<\/p>\n<h1>More Detail<\/h1>\n<p>I have created commented \/ summarized listings for:<br \/>\n<a href=\"http:\/\/www.sydneysmith.com\/products\/gss-hp67u\/downloads\/67-write-prog-card.txt\" target=\"_blank\">writing a HP-67 program to a mag card<\/a><br \/>\n<a href=\"http:\/\/www.sydneysmith.com\/products\/gss-hp67u\/downloads\/67-read-prog-card.txt\" target=\"_blank\">reading a HP-67 program from a mag card<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a work in progress and likely to be updated. The HP67 Arithmetic, Control and Timing chip (ACT) is a Mostek MK6216N. It understands most of the instructions but the HP67 card reader chip (CRC, a Mostek MK6250N) adds instructions and two more data registers:<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5,3],"tags":[33,32],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1152"}],"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=1152"}],"version-history":[{"count":18,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1152\/revisions"}],"predecessor-version":[{"id":1357,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1152\/revisions\/1357"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}