The Museum of HP Calculators
HP Forum Archive 14
[ Return to Index | Top of Index ]
|Do nothing at $20005 (HP-42S Assembly programming)|
Message #1 Posted by Erik Ehrling (Sweden) on 18 May 2004, 4:13 p.m.
I have recently started to look at the possibility to program the HP-42S in Saturn Assembly. One of the first tasks I have been been trying to achieve is to return safely to the RPN context from the language ROM area, called by the XFCN (therefore the subject of this posting: "Do nothing at $20005").
The snippet below seems to work fine in Emu42 (I have also tested it on a rev A HP-42S with the 2 x 32K RAM upgrade as suggested by Nelson M Sicuro), but is this the correct way to do this?
* Language ROM Detect Constant
* Return to RPN context, drop one stack level
* Rev A = 10D5F, Rev C = 10DE1
Or just entered directly into the monitor:
20000: F3CA5DA07D61421648DF5D01 (Rev A)
20000: F3CA5DA07D61421648D1ED01 (Rev C)
Erik Ehrling (Sweden)
|Re: Do nothing at $20005 (HP-42S Assembly programming)|
Message #2 Posted by HrastProgrammer on 19 May 2004, 2:17 a.m.,
in response to message #1 by Erik Ehrling (Sweden)
Don't do anything except GOVLNG #10DE1 (or #10D5F) because D0 points to the next byte of the instruction and not to the next RPL address! In the case of XFCN (and all instructions from this category), D0 points to the first byte of the alpha argument.
For example, if you execute XFCN "ABCDEF", D0 points to F7 F1 41 42 43 44 45 46 sequence of bytes. You don't have to restore D0 or manipulate (drop anything from) the return stack in your code because the firmware will do this for you.
BTW, I am usually returning with GOVLNG #15D8A (Rev C) which is the same as =xNEXT (#10DE1) but it enables stack lifting as well.
Return to Index | Top of Index ]
Go back to the main exhibit hall