MCODE: The significance of a "3" in nybble 3 in register "b"



#2

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


#3

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


#4

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


#5

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

#6

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.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 1,076 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  Little curiosity: why the fourth stack register is called "T"? Antlab 34 8,699 07-03-2013, 04:49 PM
Last Post: Walter B
  41-MCODE: Auto XEQ+ALPHA possible? Ángel Martin 5 2,014 05-29-2013, 06:15 AM
Last Post: Ángel Martin
  HP 41 Mcode related Questions Michael Fehlhammer 4 2,030 05-10-2013, 07:09 PM
Last Post: Michael Fehlhammer
  41-MCODE: Breaking the FAT barrier. Ángel Martin 0 936 09-03-2012, 06:31 AM
Last Post: Ángel Martin
  41-MCODE: Dr. Jekyll & Mr. Hyde Ángel Martin 9 3,069 07-09-2012, 09:41 AM
Last Post: Monte Dalrymple
  HP41C: Factorial (kind of) in MCODE Frido Bohn 7 2,521 05-26-2012, 09:18 AM
Last Post: Frido Bohn
  [WP34S] Register use by functions. Chris Tvergard 5 2,081 05-12-2012, 03:35 AM
Last Post: Walter B
  HP-34C Storage Register Arithmetic & Programming Matt Agajanian 14 4,277 05-08-2012, 11:04 AM
Last Post: Matt Agajanian
  41-MCODE: SOLVE & INTEG - 4k ROM Ángel Martin 9 2,836 04-19-2012, 05:29 AM
Last Post: fhub

Forum Jump: