HP35 recriprocal function
With this function that computes 1/x,
we'll take some time to relax because it is very simple.
No complicated algorithm, simply the genuine divider (which happens to be very
fast).
The offset of the function 1/X being 16, there can we follow a very simple code (trace of 1/5) :
00016:
0 -> a[w]
a + 1 -> a[p]
00020: 0 -> b[w]
select rom 1
; goto asn12
asn12:
jsb div11
if s10 = 0 then go to rtn12
On entry status bit s10 is zero (it is set to 1 when the "arc" shift key is pressed which makes no sense here), the Pointer hold the value c (12).
Register A is set to zero and a digit "1" is put in the 12th position making
number 1 100 in the register.
B is zeroed and we go to label "asn12" which a relay betweens ROMs : there will
find a call to the standard floating point divider "div11" which is going to
perform operation A/C (result placed in C).
Note that we exit of the divide routine by the relay "tnm12" which will copy C to A, to build later the floating point form, and exponent of result to C, forming the normalized form.
From there we will "go" to "nrm21"
routine that will normalize the result and exit through label rtn21, rtn11 and
rtn12, which are false "return" instructions but will go to 00333 where control
finds a call to output format routine "jsb of13".
The later routine has its own real "return" at address 00361:
return.
I mention this "itinerary" to outline that we have here 2 subroutines calls and
one "return" (the subroutine stack has only one level). In fact, it is very
difficult to read this highly packed code directly form the source.