HP Forums

Full Version: MCODE: The significance of a "3" in nybble 3 in register "b"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

In "MCode for beginners" by Ken Emery, pages 42 and 43 we find the instructions for the program called "GE" (Goto End):

READ 13(c)
C=0 M
R= 3
LD@R 3

This loads a "3" into nybble 3 in the status register "b", the first nybble specifying the program pointer in user memory. This nybble gives the nybble within the register where the program pointer points to. Why put a "3" in there to execute the .END. ?

Hi, Geir

A register in the HP41 memory contains 7 bytes, numbered like this: 6-5-4-3-2-1-0.

The .END. is always located in the bytes 2-1-0 of the last register in User Program Memory.

On the other hand, the Address Pointer (within b register) is: pqrs, where qrs is the register number and p the byte number, within this register qrs, of the last instruccion executed. So, the next instrucción to execute will be byte (p-1) of register qrs.

You Write: "Why put a "3" in there to execute the .END. ?"

The .END. is located in the memory register pointed by nibbles 2-1-0 of c register (qrs). And whitin this register (qrs), in bytes numbers 2-1-0. So, the address pointer should be 3qrs, which is a byte preceding the position of the .END., which is the next instruction to be executed.

Best regards

Thank you very much. I suspected something like this. Where is this documentet? I'd like to read more about related subjects.

Should be in one of the books about synthetic programming;-)

IIRC, a short (abbreviated) version of the above can be seen in the 'Synthetic Quick Reference Guide'...



Yes, as Raymond says ...

There are two books about Synthetic Programming:

HP41 Synthetic Programming made easy ..... Keith Jarret.

Synthetic Programming .... W.C Wickes.

There you can learn all about the "internal mysteries" of 41's. If you are diving in MCODE programming, you should read these books as well.

I wish you luck and please, tell us your progress in MCODE.