CPU-Z80-Disassembler
view release on metacpan or search on metacpan
t/data/zx81.ctl view on Meta::CPAN
:;
1A74:C
:#; start of loop.
:#
:#;; SWAP-BYTE
1A74 1A ld a, (de) :C SWAP_BYTE
:; each byte of second
1A75:C
1A75 4E ld c, (hl) :C
:; each byte of first
1A76:C
1A76 EB ex de, hl :C
:; swap pointers
1A77:C
1A77 12 ld (de), a :C
:; store each byte of first
1A78:C
1A78 71 ld (hl), c :C
:; store each byte of second
1A79:C
1A79 23 inc hl :C
:; advance both
1A7A:C
1A7A 13 inc de :C
:; pointers.
1A7B:C
1A7B 10F7 djnz $1A74 :C
:; loop back to SWAP-BYTE until all 5 done.
:;
1A7D:C
1A7D EB ex de, hl :C
:; even up the exchanges
:; so that DE addresses STKEND.
1A7E:C
1A7E C9 ret :C
:; return.
:;
1A7F:C
:#; ---------------------------------
:#; THE 'SERIES GENERATOR' SUBROUTINE
:#; ---------------------------------
:#; offset $86: 'series-06'
:#; offset $88: 'series-08'
:#; offset $8C: 'series-0C'
:#; The ZX81 uses Chebyshev polynomials to generate approximations for
:#; SIN, ATN, LN and EXP. These are named after the Russian mathematician
:#; Pafnuty Chebyshev, born in 1821, who did much pioneering work on numerical
:#; series. As far as calculators are concerned, Chebyshev polynomials have an
:#; advantage over other series, for example the Taylor series, as they can
:#; reach an approximation in just six iterations for SIN, eight for EXP and
:#; twelve for LN and ATN. The mechanics of the routine are interesting but
:#; for full treatment of how these are generated with demonstrations in
:#; Sinclair BASIC see "The Complete Spectrum ROM Disassembly" by Dr Ian Logan
:#; and Dr Frank O'Hara, published 1983 by Melbourne House.
:#
:#;; series-xx
1A7F 47 ld b, a :C series_xx
:; parameter $00 - $1F to B counter
1A80:C
1A80 CDA019 call $19A0 :C
:; routine GEN-ENT-1 is called.
:; A recursive call to a special entry point
:; in the calculator that puts the B register
:; in the system variable BREG. The return
:; address is the next location and where
:; the calculator will expect its first
:; instruction - now pointed to by HL'.
:; The previous pointer to the series of
:; five-byte numbers goes on the machine stack.
:;
1A83:B
:#; The initialization phase.
:#
1A83-1A83 2D :B
:;;duplicate x,x
1A84:B
1A84-1A84 0F :B
:;;addition x+x
1A85:B
1A85-1A85 C0 :B
:;;st-mem-0 x+x
1A86:B
1A86-1A86 02 :B
:;;delete .
1A87:B
1A87-1A87 A0 :B
:;;stk-zero 0
1A88:B
1A88-1A88 C2 :B
:;;st-mem-2 0
:;
1A89:B
:#; a loop is now entered to perform the algebraic calculation for each of
:#; the numbers in the series
:#
:#;; G-LOOP
1A89-1A89 2D :B G_LOOP
:;;duplicate v,v.
1A8A:B
1A8A-1A8A E0 :B
:;;get-mem-0 v,v,x+2
( run in 1.132 second using v1.01-cache-2.11-cpan-71847e10f99 )