The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

41-MCODE trivia: backwards or forwards?
Message #1 Posted by Ángel Martin on 5 Mar 2012, 9:23 a.m.

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? :-)

      
Re: 41-MCODE trivia: backwards or forwards?
Message #2 Posted by Geir Isene on 5 Mar 2012, 10:15 a.m.,
in response to message #1 by Ángel Martin

That it wraps around and thus makes no difference?

      
Re: 41-MCODE trivia: backwards or forwards?
Message #3 Posted by cgh on 5 Mar 2012, 2:18 p.m.,
in response to message #1 by Ángel Martin

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.

      
Re: 41-MCODE trivia: backwards or forwards?
Message #4 Posted by Håkan Thörngren on 5 Mar 2012, 4:38 p.m.,
in response to message #1 by Ángel Martin

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).


[ Return to Index | Top of Index ]

Go back to the main exhibit hall