HP67 Microcode – DSP 0

As you probably know, DSP n where n is one of the digit keys [0] to [9] sets the display precision. E.g. DSP 2 in FIXed mode gives you “0.00”, DSP 3 gives “0.000”.

Here’s how the internals do that

Pressing [DSP] gives

00214 ...
00217 keys to a                          ; A= 0000fffffff920 (scanrow=9 scancol=2)
00256 a -> rom address                   ; 5*9+2=47 =057
01457 if n/c go to 01510                 ; part of a "jump table".

; do [DSP]:
; set s 13 and M1[x]=060
01510 jsb 01740                          ; [DSP] is a prefix key, clear prefix state
01511 load constant 6                    ; C= 00000000000060 P= 0
00451 1 -> s 13                          ; S= .........9...d.f
00144 m1 exch c                          ; C= 03000000000400 M1=00000000000060
... (update display and back into wait loop)

Pressing [0] gives

00214 ...
00217 keys to a                          ; A= 0000fffffff720 (row 7 col 2)
00256 a -> rom address                   ; 5*7+2=37 =045, C= 00000000000060 P= 1
01445 if n/c go to 01613

; do [0]:
01613 if 1 = s 4 : 01614 then go to 01654
01615 if 0 = s 6 : 01616 then go to 01643
01643 if 0 = s 8 : 01644 then go to 01654
01654 if c[p] # 0
01655 then go to 01566
01566 delayed rom 01
01567 if n/c go to 0437

00437 ...; A= 00000000000060 M1=00000000000060 S= .........9.....f C= 00000000000000 P= 12
06027 a -> rom address                   ; A[2,1]= 0x06 = 0000 0110 = 00 000 110 = 006
06006 if n/c go to 06040

; do [DSP] n (or the other 0x6[a-f] hex codes)
; check n < 10 else go elsewhere
; get display info etc from ram[62]
; shift A left by 6 so A[0] lines up with dsp nibble in ram[62]
; put n in the dsp nibble then save back to ram[62]
06040 ... ; S= ......6..9.....f A= 00000000000060 C= 0000000000000a P= 0
07460 if a >= c[p]                       ; check n < 10 (A= 0...6n)
07461 then go to 07413
07462 jsb 07706                          ; select ram bank 3, P= 0 C= 00000000000000
07463 data register -> c 14              ; ram[62] -> C= 00000012220000
; shift A left by 6
07464 p <- 6                             ; P= 6
07465 load constant 5                    ; C= 00000015220000 P= 5
07466 p <- 6                             ; P= 6
07467 shift left a[w]                    ; A= 00000000000600
07470 c - 1 -> c[p]                      ; C= 00000014220000
07471 if n/c go to 07467
; A= 00000000006000 C= 00000013220000
; A= 00000000060000 C= 00000012220000
; A= 00000000600000 C= 00000011220000
; A= 00000006000000 C= 00000010220000
; A= 00000060000000 C= 0000001f220000
07471 if n/c go to 07467
; put n in the dsp nibble
07472 a exchange c[p]                    ; A= 0000006f000000 C= 00000010220000
; save the updated DSP setting
07473 c -> data register 14              ; c= 00000010220000 -> ram[62] 
07474 delayed rom 00
07475 if n/c go to 0114
... (update display and back into wait loop) ; "0."

The same for [DSP] [3] ends like this:

; [3] pressed
00214 ...
00217 keys to a                          ; A= 00fffffffff600
00256 a -> rom address                   ; 5*6+0=30 = 036, A= 00fffffffff1e0 P= 1 C= 00000000000060 M1=03000000000400

; [0] was to 01445 then 01613 - gave C=0...060
01436 c + 1 -> c[x]                      ; C= 00000000000061
01437 c + 1 -> c[x]                      ; C= 00000000000062
01440 if n/c go to 01612

01612 c + 1 -> c[x]                      ; C= 00000000000063
; now have C=0...060 - 0...069 for DSP 0-9. This is the hex code for DSP 0-9
01613 if 1 = s 4 : 01614 then go to 01654
01615 if 0 = s 6 : 01616 then go to 01643
01643 if 0 = s 8 : 01644 then go to 01654
01654 if c[p] # 0
01655 then go to 01566
01566 delayed rom 01
01567 if n/c go to 0437
00437 ...  ; A= 00000000000063 M1=00000000000063 S= .........9.....f C= 00000000000000 P= 12
06027 a -> rom address                   ; A[2,1]= 0x06 = 0000 0110 = 00 000 110 = 006
06006 if n/c go to 06040                 ; all of the 0x60-0x6f hex codes go here.

; do [DSP] n (or the other 0x6[a-f] hex codes)
06040 ...                                ; S= ......6..9.....f
07463 data register -> c 14              ; ram[62] -> C= 00000010220000
; shift A[0] left 6 positions so it lines up with the DSP nibble in C[6]
07464 ...
; A= 00000000000630 C= 00000014220000
; A= 00000000006300 C= 00000013220000
; A= 00000000063000 C= 00000012220000
; A= 00000000630000 C= 00000011220000
; A= 00000006300000 C= 00000010220000
; A= 00000063000000 C= 0000001f220000
07471 if n/c go to 07467
; put the new DSP n value into C
07472 a exchange c[p]                    ; A= 0000006f000000 C= 00000013220000
; save the updated value
07473 c -> data register 14              ; C (=00000013220000) -> ram[62] 
07474 delayed rom 00
07475 if n/c go to 0114
... (update display and back into wait loop) ; "0.000"

More info is in 67-dsp-0.txt.

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 *