41CL Calculator Manual
© 2019 Systemyde International Corporation
83
recognize and use it. Next
PLUG
t
he
HEPAX
i
ma
ge
i
nt
o
a
Por
t
.
To
ve
r
i
f
y
t
ha
t
you’
ve
done everything correctly, try executing a HEPDIR command. The display should return
H:DIR EMPTY
, and clearing this from the display should show
2610
, which is the
size of four pages of HEPAX RAM.
Patching HEPAX
The HEPAX
DISASM
function scans the keyboard during the disassembly process, but it
appears that to save space this scanning function was not implemented properly. (The
code does not look at the keyboard valid flag.)
In addition, early versions of the 41CL keyboard scanner did not output the same scan
code as the original 41C when no key is being pressed. (The idle state code was not
specified in the HP documentation.)
As a result of these two issues the HEPAX
DISASM
code thinks that the
ON
key has
been pressed immediately after the last address digit has been entered, turning the
calculator off.
The way around this issue is to remove the test for a press of the
ON
key during the
HEPAX
DISASM
function. This requires copying one page of the HEPAX code to RAM
so that one location can be patched, and then pointing the MMU at the patched code.
The example below assumes that the HEPAX module has been loaded into the lower half
of Port 2, which is page A, and that the uppermost page of RAM (starting address
0x83F000) will be used for the patched HEPAX page.
First, the Bank 4 HEPAX image is copied to RAM:
ALPHA
030>83F
ALPHA
XEQ ALPHA
YMCPY
ALPHA
Next, the instruction that tests for a press of the
ON
key is replaced with a NOP instruc-
tion:
ALPHA
83F08D-0000
ALPHA
XEQ ALPHA
YPOKE
ALPHA
Finally, this RAM page is substituted for bank 4 of the HEPAX image in Flash by directly
programming the MMU register. The MMU register must be programmed directly
because we are only substituting one bank of the HEPAX code.