Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 705

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722
Introducing the Instruction Set Part 3 - Intellivision Wiki

Introducing the Instruction Set Part 3


Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/content/30/6867330/html/intellivision/wiki/includes/MagicWord.php on line 722
From Intellivision Wiki

Jump to: navigation, search
(Basic Structure)
m (Passing Arguments via Return Address)
Line 500: Line 500:
         ENDP
         ENDP
-
For many library functions, such as PRINT, you may want to have multiple entry points into the same function that read a different number of arguments as data vs. expecting arguments in registers.  The <CODE>PRINT</CODE> function linked above works this way, providing a high degree of flexibility in how it's called.  The way this is accomplished is simple in many cases.  You can put local labels on the various <CODE>[[MVI@]] R5</CODE> instructions at the top of the function, making it easy for callers to pick which parameters get read from after the <CODE>[[CALL]]</CODE> and which get passed in registers.   
+
For many library functions, such as <CODE>PRINT</CODE>, you may want to have multiple entry points into the same function that read a different number of arguments as data vs. expecting arguments in registers.  The <CODE>PRINT</CODE> function linked above works this way, providing a high degree of flexibility in how it's called.  The way this is accomplished is simple in many cases.  You can put local labels on the various <CODE>[[MVI@]] R5</CODE> instructions at the top of the function, making it easy for callers to pick which parameters get read from after the <CODE>[[CALL]]</CODE> and which get passed in registers.   
<BR/><BR/>
<BR/><BR/>
Here's a modified version of <CODE>FILLMEM</CODE>.  The local label <CODE>@@vla</CODE> denotes the entry point that will read "value", "length" and "address" as data after the <CODE>[[CALL]]</CODE>.  This local label is known to other functions as <CODE>FILLMEM.vla</CODE>.  The <CODE>@@la</CODE> entry point (aka <CODE>FILLMEM.la</CODE>) will read just "length" and "address" as data after the <CODE>[[CALL]]</CODE>. The value to fill needs to be set in R0.  And so on.  The <CODE>@@r</CODE> entry point (aka <CODE>FILLMEM.r</CODE>) expects all arguments to come in registers.
Here's a modified version of <CODE>FILLMEM</CODE>.  The local label <CODE>@@vla</CODE> denotes the entry point that will read "value", "length" and "address" as data after the <CODE>[[CALL]]</CODE>.  This local label is known to other functions as <CODE>FILLMEM.vla</CODE>.  The <CODE>@@la</CODE> entry point (aka <CODE>FILLMEM.la</CODE>) will read just "length" and "address" as data after the <CODE>[[CALL]]</CODE>. The value to fill needs to be set in R0.  And so on.  The <CODE>@@r</CODE> entry point (aka <CODE>FILLMEM.r</CODE>) expects all arguments to come in registers.

Revision as of 00:18, 7 November 2007

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox