[WP34S] Documentation for Advanced Programming Commands and Techniques


I have been taking a close look at the source code in the /xrom subdirectory at Sourceforge. It looks to me a lot like FOCAL code, but there is extra stuff in there that is documented neither in the main manual nor the assembler manual--things like #define, XLBL, MONADIC, DYADIC, etc. I see plenty of the JMP and GSB pseudo instructions that get handled by the preprocessor, as well as LBL-less targets. But there are other things that don't get recognized by the assembler when I try to compile this code (for example, integrate.wp34s) into user code. I also notice that there are a few xrom-based commands--XEQUSR, POPUSR, SLVQ--listed in the op-code file, and thus supposedly accessible to the end-user, but I can find no documentation on what they are or how to use them.

So I guess my questions are this: how does one assemble the source code in that /xrom directory for the end-user? Can they be compiled and used outside of XROM, and if so, how? And with the XROM commands found in the op-codes file, how does the end-user access them and is there documentation out there that to guide the advanced programmer?

Hopefully some of the development team can edify me in plain English, or French.




These commands fall into three groups:

#include, #define and the words like MONADIC and such are commands for the C preprocessor. The build process for xrom.wp34s uses it as a tool to build a file that can be handled by Neil's preprocessor and assembler.

xIN, xOUT, XEQUSR, etc., all flagged als XROM only in the op-code file, need a special environment and just won't work (or even crash the calculator) if encountered in normal user code. XROM is a very special environment.

JMP and GSB are handled by wp34s-pp.pl and are available for user programs as well to save LBLs. OTH, this makes changing programs on the device hard because all jump distances are precomputed. XROM doesn't have the problem because it's immutable.


... and therefore we didn't document those commands and most probably never will. Else fora would become crowded by users employing those and running into troubles.


Thanks, all, you have confirmed what I was learning--that the XROM code is interdependent with the C-code and does not stand alone with modification. I have to say that the use of #define to give register contents more transparent names makes the code much easier to read.



XROM uses almost standard keystroke programs. The big differences are three:

  1. XLBL -- provides the entry point addresses for the C code to call without requiring a LBL search. This also means we're not going to run out of LBLs either. This is a pseudo command -- no code is generated, just an entry point in a table.

  2. xIN -- a standard entry that preserves the stack & lettered registers & allocates some local flags. It does a pile more, checking for NaN arguments, switching to double precision mode and so forth.

  3. xOUT -- a standard exit that does the required stack manipulations, sets last X and so on, finally returning to user code or the keyboard handler.

Slightly simplistically, you take a key stroke program and put XLBL & xIN at the start and use xOUT instead of RTN to exit and you've got XROM code that is indistinguishable from a built in command.

This is worlds better than the previous XROM code that was quite difficult to code for -- check the history of the quadratic solver e.g. or look at the solve or integrate routines that don't use these helpers.

- Pauli

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP 41 Advanced Programming Tips Michael Fehlhammer 0 495 11-28-2013, 06:11 PM
Last Post: Michael Fehlhammer
  HP Prime documentation Nate Martin 10 1,248 11-25-2013, 12:55 PM
Last Post: toml_12953
  HP Prime - One thing I can not draw in advanced graphing dg1969 2 622 10-19-2013, 02:00 PM
Last Post: dg1969
  HMS commands Geoff Quickfall 6 947 10-14-2013, 06:27 PM
Last Post: Tim Wessman
  Tapping the Advanced Graphing App restarts the calculator Terje Vallestad 6 951 10-05-2013, 06:44 PM
Last Post: Terje Vallestad
  Programming with CAS commands (e.g., arcLen) Helge Gabert 8 1,030 10-01-2013, 04:08 PM
Last Post: Helge Gabert
  Advanced Graphing App. Jim Johnson 4 820 09-29-2013, 08:40 PM
Last Post: Joe Horn
  Documentation about Hp50g / 49g+ / 48gII and wikis Pier Aiello 9 1,272 09-10-2013, 04:22 AM
Last Post: Software49g
  HP-30B (WP-34S) Technical Documentation Barry Mead 3 758 09-09-2013, 03:07 PM
Last Post: Harald
  [HP-Prime xCAS] Arrays: Programming Commands (solution to the ambiguity) CompSystems 6 1,041 08-30-2013, 06:32 PM
Last Post: CompSystems

Forum Jump: