# HP 48gII Advanced User's Reference Manual Page 519

Graphing calculator.

% the decimal part of the number (in 1/4096)
SAVE
INTOFF
SKUB {
*start
!ARM
STMDB sp! {R4 R5 R6 R7 R8 LP}
LDR R2, [R1, #2324]
% reg B, nibbles 0-7)
LDR R3, [R1, #2340]
% reg B, nibbles 0-7)
MOV R7 R2
MOV R8 R3
MOV R6 256
{
MUL R4, R2, R2
MOV R4 R4 >> 12
MUL R5, R3, R3
MOV R5 R5 >> 12
CMP LP \$4000
EXITGT
SUB R4 R4 R5
MUL R3 R2 R3
MOV R3 R3 >> 11
SUBS R6 R6 1
UPNE
% we have looped 256 times and abs(An)<2, the point is in the set!
LDRB R6 [R1 2408]
BIC R6 R6 1
STRB R6 [R1 2408]
LDMIA sp! {R4 R5 R6 R7 R8 PC}
}
% we have reached a An where abs(An)>2,the point is out of the set
LDRB R6 [R1 2408]
ORR R6 R6 1
STRB R6 [R1 2408]
LDMIA sp! {R4 R5 R6 R7 R8 PC}
!ASM
*end
}
C=RSTK D0=C
D1=80100
% I can copy the program
LC(5) end-start MOVEDN
C=0.B SETLNED
D1=8229E
LC A9 A=0.W A-1.W { DAT1=A.W D1+16 C-1.B UPNC } % paint it in black
D0=00120 LC 8229E DAT0=C.A
% save the RPL pointers
% disable keyboard interrupts
% jump over the ARM code
% switch to ARM mode
% save registers in the stack
% load R2=x (content of saturn
% load R3=y (content of saturn
% copy X in r7
% copy Y in r8
% copy 256 in R6
% r4= x² << 12
% r4= x²
% r5= y²
% LP = x² + y²
% if abs² an > 4
% exit
% r4= x²-y²
% R3= X*Y
% r2= X + x²-y² = new x
% r3= x*y*2
% r3= Y+2*x*y = new Y
% decrement loop counter
% up if not 0
% clear the flag ST0
% restore all registers and return
% set the flag ST0
% restore all registers and return
% back in ASM mode
% D0 points to ARM instruction
% D1 points at a place where
% copy n nibbles
% point on 2Kb free memory
% point the screen to that memory
The Development Library 6-33

49g+