HP Forums
MCODE: The significance of a "3" in nybble 3 in register "b" - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: MCODE: The significance of a "3" in nybble 3 in register "b" (/thread-131011.html)



MCODE: The significance of a "3" in nybble 3 in register "b" - Geir Isene - 01-18-2008

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


Re: MCODE: The significance of a "3" in nybble 3 in register "b" - JoseL - 01-21-2008

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


Re: MCODE: The significance of a "3" in nybble 3 in register "b" - Geir Isene - 01-21-2008

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


Re: MCODE: The significance of a "3" in nybble 3 in register "b" - Raymond Del Tondo - 01-21-2008

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

HTH

Raymond


Re: MCODE: The significance of a "3" in nybble 3 in register "b" - JoseL - 01-22-2008

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.