HP65 Microcode R/S Infinite Loop

As discussed in HP-65 R/S, the commonly available microcode for the HP-65 calculator goes into an (almost?) infinite loop if you press the [R/S] key. Here’s what it looks like:

00763 rom 2
01364 buffer -> rom address
01365 goto 01000
01042 goto 01101
01101 0 -> c[m]
01102 delayed select group 1
01103 c <-> m            ; C= 01000000000001 M =10000000000221
01104 c -> stack         ; D= 01000000000001
01105 goto 01237
05237 a + b -> a[ms]     ; A= 00999999990000
05240 c + 1 -> c[x]      ; C= 01000000000002
05241 a -> b[m]          ; B= 00999999990000
05242 a <-> b[x]
05243 c -> a[m]          ; A= 01000000000000
05244 p - 1 -> p         ; P= 11
05245 goto 05156
05156 if a[x] >= 1
05157 goto 05001
05160 a <-> b[m]         ; A= 00999999990000 B= 01000000000000
05161 goto 05151
05151 a - 1 -> a[m]      ; A= 00999999989000
05152 goto 05150
05150 c + 1 -> c[p]      ; C= 01100000000002
05151 a - 1 -> a[m]      ; A= 00999999988000
05152 goto 05150
05150 c + 1 -> c[p]      ; C= 01200000000002
05151 a - 1 -> a[m]      ; A= 00999999987000
05152 goto 05150
05150 c + 1 -> c[p]      ; C= 01300000000002
05151 a - 1 -> a[m]      ; A= 00999999986000
05152 goto 05150
05150 c + 1 -> c[p]      ; C= 01400000000002
05151 a - 1 -> a[m]      ; A= 00999999985000
05152 goto 05150

Eventually a[m] will get to 0 and the loop above (05150 – 05152) will exit. That is because the “goto” has an implied “if no carry”. It’s just the way it works.

05153 does a “rom 1” instruction so, after 10 billion (actual number involved) loops through the above with a blank display, we’d arrive at 00554 and something might happen.

It's only fair to share...Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUponDigg thisPin on PinterestEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *