HP Forums

Full Version: 41-MCODE trivia: backwards or forwards?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

As informed MCODERS you guys out there know the second digit of a FAT entry can be used to signal the location of the function code, relative to the page the FAT is in.

So a FAT entry like 00A0BC indicates: current page, address 0xpABC

whereas a FAT entry like 01A0BC is for the *next* page, and BTW "subsequent" ones can be also called by increasing the page digit, like: 0x02ABC, and 0x03ABC....

Put this together with the fact that an entry like 0x0FA0BC denotes the *previous* one, and that "decreasing" the digit will also reach out to preceeding pages, like two earlier (E), three (D), etc.

But is there a limit to this scheme, and where is it?
For instance, the most confusing one: does 0x08ABC denote 8 pages behind or 8 pages ahead?

What's your guess? :-)

That it wraps around and thus makes no difference?

I do not believe that we add or substract the page. I prefer to say that we always add and perform a "AND 0xF" to the page result.

And this true is we go forward 13 + 1 = 14 & 15 = 14
And backward 13 + 15 = 28 & 15 = 12.

Trying with nsimII. Putting a value of 0x08a0bc jumps 8 pages.
I put a module in page 13 (D) and the code in page 5 (13-8).

CAT 2 shows the function in page 5.
XEQ "..." calls the function in page 5.

And this is also 13 + 8 = 21 % 16 = 21 AND 15 = 5.
Putting 08a0bc in page 5 will jumps also 8 pages to go in page 13.

CAT 2 shows the function in page 13.
XEQ "..." calls the function in page 13.

Edited: 5 Mar 2012, 2:22 p.m.

It always add and truncates the resulting address to 16 bits.

Truncating away a 1 means that it wraps around to a page below. Truncating away a 0 means that we go to a higher page (no wrap).