HP-65 Display X in FIXed mode

Here’s how we get X displayed when we’re in FIXed display mode.

The process summarizes to:
if A & B aren’t already valid from last time (f3)
– if (w/prgm) do something else (s3)
– if (SCI mode) do something else too (M[1])
– 04164 Display X in FIX mode
– create mask in B (29999999999999)
– move it right by exponent digits (eg 0002999999999)
– round X in A to precision (M[2])
– add holes in mask to rhs of “.” to precision
– blank out the exponent ’cause this is FIXed mode
– turn the display on
end if

if f3 is 0 and A & B are already valid, the display must still be on because it jumps to after that point.

The microcode looks like:

00531 0 -> s3
00532 1 -> f2
00533 1 -> p                             ; P= 1
00534 c <-> m                            ; C= 00000000000221 M =05432100000004
00535 0 -> s11
00536 0 -> f3                            ; S= ...........b
;
00537 if s3 = 0                          ; if in RUN mode
00540 goto 00552
; else see "display program step" instead

00552 if s11 = 0                         ; if f3 was clear before now
00553 goto 00764                         ; we can skip the following (A & B already valid)

; setup A & B for display
00554 if c[p] = 0
00555 goto 00616                         ; display X in SCI notation
00556 c - 1 -> c[p]                      ; C= 00000000000211
00557 if c[p] = 0
00560 goto 00616                         ; display X in SCI notation
00561 load 2                             ; C= 00000000000221 P= 0
00562 delayed select group 1
00563 rom 0

; display X in FIX notation
04164 jsb 04101                          ; create mask in B with "2" where "." should be
.04101 dispoff
.04102 c -> a[x]                         ; A= 98000000000221 (precision,mode,ang)
.04103 c <-> m                           ; C= 05432100000004 M =00000000000221
.04104 shiftr a[x]                       ; A= 98000000000022
.04105 shiftr a[x]                       ; A= 98000000000002 (precision)
.04106 0 -> p
.04107 if c[m] >= 1                      ; if mantissa=0 04111 would set exp=0 too
.04110 goto 04112
.04112 b <-> c[w]                        ; B= 05432100000004 C= 00000000000000
.04113 0 -> c[w]
.04114 c - 1 -> c[w]                     ; C= 99999999999999 (mask)
.04115 c + 1 -> c[s]                     ; C= 09999999999999
.04116 c + 1 -> c[s]                     ; C= 19999999999999
.04117 c + 1 -> c[s]                     ; C= 29999999999999 (2 mask)
.04120 b <-> c[w]                        ; B= 29999999999999 C= 05432100000004
.04121 0 -> f2
.04122 return
04165 a + c -> a[x]                      ; A= 98000000000006 =precision+exponent
04166 jsb 04266
.04266 a + 1 -> a[x]                     ; A= 98000000000007 =precision+exponent+1 = digits
.04267 12 -> p                           ; P= 12
.04270 goto 04124
.04124 a - 1 -> a[x]                     ; A= 98000000000006
.04125 goto 04206
.04206 if p # 2
.04207 goto 04123
.04123 p - 1 -> p                        ; P= 11
.04124 a - 1 -> a[x]                     ; A= 98000000000005
.04125 goto 04206
; P= 10 A= 98000000000004
; P= 9  A= 98000000000003
; P= 8  A= 98000000000002
; P= 7  A= 98000000000001
; P= 6  A= 98000000000000
; P= 5  A= 98000000000999
.04125 goto 04206
; P = digits blanked on the right 
.04126 0 -> a[w]                         ; A= 00000000000000
; copy the blanked frac to A, & the exponent
.04127 c -> a[wp]                        ; A= 00000000000004
; round the value (2*undisplayed frac adds 1 if >=0.5)
.04130 a + c -> a[m]                     ; A= 05432100000004
.04131 goto 04135
.04135 a -> b[x]                         ; B= 29999999999004
.04136 return
04167 if a[xs] >= 1                      ; if exp sign negative
04170 goto 04364
; about to shift decimal point to the right by exp places
04171 13 -> p                            ; P= 13
04172 p - 1 -> p                         ; P= 12
04173 shiftr b[ms]                       ; B= 02999999999004
04174 a - 1 -> a[x]                      ; A= 05432100000003
04175 goto 04361
04361 if p # 3                           ; but if going into exponent area
04362 goto 04172                         ; do s/thing else
; P= 11 B= 00299999999004 A= 05432100000002
; P= 10 B= 00029999999004 A= 05432100000001
; P= 9  B= 00002999999004 A= 05432100000000
; P= 8  B= 00000299999004 A= 05432100000999
04175 goto 04361
04176 jsb 04272                          ; get prec,mode,ang to a[x]
.04272 c <-> m                           ; C= 00000000000221 M =05432100000004
.04273 c -> a[x]                         ; A= 05432100000221
.04274 c <-> m                           ; C= 05432100000004 M =00000000000221
.04275 return
04177 goto 04151
04151 if a[xs] >= 1                      ; if DSP . 1 or more
04152 goto 04231
; about to open mask holes for digits on rhs of decimal
; a[xs]= precision
; p points to the "." in B
; so code below is "for (; a[xs]>0; a[xs]--) b[p--]=0"
04231 p - 1 -> p                         ; P= 7
04232 if p # 2                           ; but still check not in exp area
04233 goto 04147
04147 0 -> b[p]                          ; B= 00000209999004
04150 a - 1 -> a[xs]                     ; A= 05432100000121
04151 if a[xs] >= 1
04152 goto 04231
04231 p - 1 -> p                         ; P= 6
04232 if p # 2
04233 goto 04147
04147 0 -> b[p]                          ; B= 00000200999004
04150 a - 1 -> a[xs]                     ; A= 05432100000021
04151 if a[xs] >= 1
04152 goto 04231
; always blank out the exponent in FIX mode
04153 0 -> a[x]                          ; A= 05432100000000
04154 a - 1 -> a[x]                      ; A= 05432100000999
04155 a -> b[x]                          ; B= 00000200999999
04156 goto 04321
; put sign of X in a[13]
04321 c -> a[s]
;
04322 if s5 = 0
04323 goto 04331
; wrap up
04331 clearstatus                        ; S= ............
04332 goto 04326
04326 delayed select group 0
04327 rom 1
00730 0 -> s9
00731 1 -> s10                           ; S= ..........a.
; display
00732 disptoggle                         ; =" 5432.10"
00733 goto 00622

waitloop2:
00622 ...

waitloop3:
00764 ...

waitloop4:
00774 ...
00777 goto 00726

Anything that gets to 00531 is up to the display routine and about to go back into the wait loop.

See also:
HP-65 Display program step

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 *