Do nothing at $20005 (HP-42S Assembly programming)



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
CON(5) #5AC3F
* Return to RPN context, drop one stack level
D0=D0+ 5
* Rev A = 10D5F, Rev C = 10DE1

Or just entered directly into the monitor:

20000: F3CA5DA07D61421648DF5D01 (Rev A)
20000: F3CA5DA07D61421648D1ED01 (Rev C)

Best regards,

Erik Ehrling (Sweden)



Hello Erik,

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.

Best regards.

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP 42s programming help for novice Carl D (new) 4 711 02-02-2013, 11:39 PM
Last Post: Mike Morrow
  HP 75 Assembly Language Michael Fehlhammer 7 1,015 10-01-2012, 08:32 AM
Last Post: Michael Fehlhammer
  Re: RPN Programming exercise (HP-42S) Gerson W. Barbosa 1 460 02-27-2012, 05:51 PM
Last Post: Marcus von Cube, Germany
  RPN Programming exercise (HP-42S) Gerson W. Barbosa 71 4,870 02-26-2012, 11:48 AM
Last Post: Valentin Albillo
  42s questions and 42s vs 35s snaggs 13 2,271 09-19-2011, 02:44 AM
Last Post: snaggs
  Programming HP-42S Howard Jones 2 498 10-17-2009, 06:47 PM
Last Post: Howard Jones
  HP 42S Programming Howard Jones 3 586 10-08-2009, 11:21 AM
Last Post: Vieira, Luiz C. (Brazil)
  Book for learning 41/42s programming? Keith Beyer 8 985 11-14-2008, 09:12 AM
Last Post: Nigel J Dowrick
  HP-42S, 41CX and synthetic programming thoughts Vincent Weber 0 379 06-25-2008, 09:13 AM
Last Post: Vincent Weber
  HP-10 Dis-assembly Jeff Davis 2 526 03-24-2008, 09:20 AM
Last Post: Jeff Davis

Forum Jump: