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

Graphing calculator.

SAVE GOSBVL DisableIntr
A=DAT1.A D0=A LC 00014 A+C.A R2=A.A
D0+10 A=0.W A=DAT0.10 C=0.W LC 8300040 ?A=C.W % test the size
{ *.End GOSBVL AllowIntr LOADRPL }
GOSBVL "D0->Row1" D1=A D0-15 C=DAT0.A C-15.A GOSBVL WIPEOUT % erase screen
LC 0003F R1=C.W
{
LC 00082
{
R0=C.A
LC 001 GOSBVL OUTCINRTN ?CBIT=1.6 -> .End % If backspace, then stop
GOSUB .PointAndLine
C=R0.A C-1.A UPNC
}
A=R1.W A-1.A R1=A.A
{
LC 001 GOSBVL OUTCINRTN ?CBIT=1.6 -> .End % If backspace, then stop
GOSUB .PointAndLine
A=R0.A A+1.A R0=A.A LC 83 ?A#C.B UP % go one pixel on the left
}
A=R1.A A-1.A R1=A.A UPNC
}
GOTO .End
*.PointAndLine
A=R1.A A+A.A C=R2.A C+A.A ASL.A A+C.A % Aa: @ line of pixel in the grob
C=R0.A P=C.0 CSRB.A CSRB.A A+C.A D0=A % D0: point on the pixel to test,
LC 2481248124812481 P=0
A=DAT0.B A&C.P ?A=0.P RTY
GOSUB LIGNE GOSUB LIGNE
GOSBVL "D0->Row1" D0-20
A=R0.A C=R1.A GOVLNG aPixonB
*LIGNE
GOSBVL "D0->Row1" D0-20
A=R0.A B=A.A LA 00041
C=R1.A D=C.A C=0.A
GOVLNG aLineXor
ENDCODE
;
;
@"
"!NO CODE !RPL
::
CODE
% this program takes control of the screen and
% display a mandelbrot set using the standard algorithm
% ie: for each point from x=-1.5 to 0.5,
%
for each point from y=-1 to 1
%
if any an, n<256 in the serie
%
a0=x+iy (complex number), an+1=a0+an²
%
has an absolute value > 2, the point is not part of the set
% the numbers are stored on 32 bits.
% the numbers are shifted by 12 bits, the lower 12 bits representing
6-32 The Development Library
% No interrupts
% adr 1st pixels of the grob
% initial position in Z
% we are ready to scan right to left
% save the counter
% test the current point
% go one pixel on the right
% go one line higher
% ready to scan from right to left
% test the current point
% go one line higher (if not finish)
% This tests the current pix, returns
% if the pixel is white, draw a line
% if it is black
% P = number of the pixel to test in
% nibble (in Z/4Z)
% test the pixel. if white, return
% else, draw line twice in Xor mode
% and draw the pixel in black.
% D0 point on the screen
% A/B: X coordinates
% C/D: Y coordinates
% draw the line!
( turn into RPL mode)
( open a RPL program )
( remove the menu line )
% open an assembly program

49g+