HP-41 XROM numbers
11-19-2019, 08:59 PM (This post was last modified: 11-19-2019 10:15 PM by JurgenRo.)
Post: #1
 JurgenRo Member Posts: 133 Joined: Jul 2015
HP-41 XROM numbers
Is there somewhere a list of HP-41 XROM numbers for the synthetic instructions, including such as byte jumper, byte grabber, Q-loader etc?
Thanks and greetings,
Juergen!
11-20-2019, 03:27 AM
Post: #2
 rprosperi Senior Member Posts: 3,900 Joined: Dec 2013
RE: HP-41 XROM numbers
From p. 37 of Jeremy Smith's Synthetic QRG:

Byte Jumper: 05,01
Byte Grabber (7-byte): 28,63
Byte Grabber (3-byte): 15,48
NOP (Text 0): 03,48

hth

--Bob Prosperi
11-20-2019, 02:46 PM
Post: #3
 Sylvain Cote Senior Member Posts: 1,240 Joined: Dec 2013
RE: HP-41 XROM numbers
Synthetic Instructions XROM, where is this coming from ?
First look into bytes encoding make no sense, need to look deeper into this.
After 40 years, I still discover things on the HP-41 ... or re-discover due to ageing
11-20-2019, 05:52 PM (This post was last modified: 11-20-2019 05:53 PM by hth.)
Post: #4
 hth Senior Member Posts: 335 Joined: Mar 2014
RE: HP-41 XROM numbers
(11-20-2019 02:46 PM)Sylvain Cote Wrote:  Synthetic Instructions XROM, where is this coming from ?
First look into bytes encoding make no sense, need to look deeper into this.
After 40 years, I still discover things on the HP-41 ... or re-discover due to ageing

When you press a key assignment, the 2-byte function code has its highest nibble inspected. If it is non-zero, it is assumed to be a 2-byte XROM.

Knowing this, we want to display the function name, but as it is an XROM it needs to scan for it using GTRMAD. For a 2-byte synthetic assignment, this will interpret the real function code (RCL M or whatever) as an XROM, extracting the ROM ID and function number (it assumes it is in A000-A7FF range, but that is not checked as it cannot happen in the normal HP-41).

GTRMAD will most likely fail to find a matching function and this is reported back. We now want to display the function anyway (the case where the key is being held for NULL test), so we go to XROMNF to display it as and XROM with numbers. This makes use of that GTRMAD always output the split up ROM Id and function code, even when it fails.

The formula used internally (in GTRMAD) for taking a two-byte instruction and getting the XROM i,j is:

Code:
 i: (fcnCode & 0xfc0) >> 6 j: (fcnCode & 0x3f)

So for a 7-byte byte grabber we often use F73F (to get a question mark in the inserted alpha string literal, mainly for easy recognition):
Code:
 (0xf73f & 0xfc0) >> 6 ->  28 (decimal) (0xf73f & 03f) -> 63 (decimal)

Thus, we will see XROM 28,63.

Technically, the 0xfc0 constant should be 0x7c0 for a correct number. However, the code assumes valid input (A000-A7FF), so it makes use of that knowledge save some MCODE instructions. This is why you may see XROM Id above 31 for such synthetic instructions.
11-20-2019, 07:40 PM
Post: #5
 JurgenRo Member Posts: 133 Joined: Jul 2015
RE: HP-41 XROM numbers
Hi all and thank you very much for your valuable replies!
I eventually found a pretty useful list in W. C. Wickes excellent book "Synthetic Programming on the HP-41C/CV": P. 51, Chapter 5f, CREATION OF SYNTHETIC PROGRAM LINES
Thanks again and all the best,
Jürgen
11-20-2019, 07:41 PM
Post: #6
 JurgenRo Member Posts: 133 Joined: Jul 2015
RE: HP-41 XROM numbers
(11-20-2019 03:27 AM)rprosperi Wrote:  From p. 37 of Jeremy Smith's Synthetic QRG:

Byte Jumper: 05,01
Byte Grabber (7-byte): 28,63
Byte Grabber (3-byte): 15,48
NOP (Text 0): 03,48

hth
Great, thanks! That helps a lot!
11-20-2019, 08:11 PM
Post: #7
 JurgenRo Member Posts: 133 Joined: Jul 2015
RE: HP-41 XROM numbers
(11-20-2019 02:46 PM)Sylvain Cote Wrote:  Synthetic Instructions XROM, where is this coming from ?
First look into bytes encoding make no sense, need to look deeper into this.
After 40 years, I still discover things on the HP-41 ... or re-discover due to ageing

Hi Sylvain,
just found an introduction on how to calculate XROM-Numbers from the byte-table in Keith Jarret's book HP-41 Synthetic Programming made easy: p. 86 ff, Chapter 4C, Pseudo-XROM previews.
Greetings, Juergen
11-20-2019, 09:48 PM
Post: #8
 JurgenRo Member Posts: 133 Joined: Jul 2015
RE: HP-41 XROM numbers
(11-20-2019 05:52 PM)hth Wrote:
(11-20-2019 02:46 PM)Sylvain Cote Wrote:  Synthetic Instructions XROM, where is this coming from ?
First look into bytes encoding make no sense, need to look deeper into this.
After 40 years, I still discover things on the HP-41 ... or re-discover due to ageing

When you press a key assignment, the 2-byte function code has its highest nibble inspected. If it is non-zero, it is assumed to be a 2-byte XROM.

Knowing this, we want to display the function name, but as it is an XROM it needs to scan for it using GTRMAD. For a 2-byte synthetic assignment, this will interpret the real function code (RCL M or whatever) as an XROM, extracting the ROM ID and function number (it assumes it is in A000-A7FF range, but that is not checked as it cannot happen in the normal HP-41).

GTRMAD will most likely fail to find a matching function and this is reported back. We now want to display the function anyway (the case where the key is being held for NULL test), so we go to XROMNF to display it as and XROM with numbers. This makes use of that GTRMAD always output the split up ROM Id and function code, even when it fails.

The formula used internally (in GTRMAD) for taking a two-byte instruction and getting the XROM i,j is:

Code:
 i: (fcnCode & 0xfc0) >> 6 j: (fcnCode & 0x3f)

So for a 7-byte byte grabber we often use F73F (to get a question mark in the inserted alpha string literal, mainly for easy recognition):
Code:
 (0xf73f & 0xfc0) >> 6 ->  28 (decimal) (0xf73f & 03f) -> 63 (decimal)

Thus, we will see XROM 28,63.

Technically, the 0xfc0 constant should be 0x7c0 for a correct number. However, the code assumes valid input (A000-A7FF), so it makes use of that knowledge save some MCODE instructions. This is why you may see XROM Id above 31 for such synthetic instructions.
Thanks for the explanation! Just for your information, there is also a dedicated chapter on this subject in Keith Jarret's "HP-41 Synthetic Programming made easy" on p. 86 ff, Chapter 4C, Pseudo-XROM previews, explaining the "assignments" XROM-Number <-> instruction in a mathematical way. Nice reading.
Jürgen
11-21-2019, 08:57 PM
Post: #9
 JurgenRo Member Posts: 133 Joined: Jul 2015
RE: HP-41 XROM numbers
(11-20-2019 03:27 AM)rprosperi Wrote:  From p. 37 of Jeremy Smith's Synthetic QRG:

Byte Jumper: 05,01
Byte Grabber (7-byte): 28,63
Byte Grabber (3-byte): 15,48
NOP (Text 0): 03,48

hth

As for the Q-Loader: In K. Jarrets book, the Q-Loader is 27, 0 (Byte Table Decimal) and for the XROM number i = 4(x mod 16) + INT(y/64), j = y mod 64. So, 27, 0 should translate to XROM 44,00. Am I wrong?
Juergen
11-22-2019, 11:00 PM
Post: #10
 rprosperi Senior Member Posts: 3,900 Joined: Dec 2013
RE: HP-41 XROM numbers
I just copied some of the notes from Jeremy's SQRG, which lists entries intended for the "MK" (Make Key assignments) program. There are various Q loader variants listed; I don't recall the differences/functions among these Q-Loaders, however the 2 lines that have the XROM indicated are:

E. Q loader 44,04 Reference noted is p.283 of the PPC ROM manual (notes on using MK)

The entry for simple Q loader does not have an XROM equivalent listed, but has references to section 5I on p. 55 in Wickes' book, and SPME, section 4B on p. 77 (though page references vary between the 2 versions of the book published; I'd guess this is for the earlier edition, but section 4B is hopefully the same).

--Bob Prosperi
11-23-2019, 09:36 PM
Post: #11
 JurgenRo Member Posts: 133 Joined: Jul 2015
RE: HP-41 XROM numbers
(11-22-2019 11:00 PM)rprosperi Wrote:  I just copied some of the notes from Jeremy's SQRG, which lists entries intended for the "MK" (Make Key assignments) program. There are various Q loader variants listed; I don't recall the differences/functions among these Q-Loaders, however the 2 lines that have the XROM indicated are:

E. Q loader 44,04 Reference noted is p.283 of the PPC ROM manual (notes on using MK)