Added documentation for the .REFERTO.

This commit is contained in:
Evgeny Vrublevsky 2021-04-24 21:26:52 +03:00 committed by greg-king5
parent 83e7c37277
commit 50a58e7706
2 changed files with 30 additions and 3 deletions

View file

@ -3213,7 +3213,8 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
.endif
</verb></tscreen>
See also: <tt><ref id=".REFERENCED" name=".REFERENCED"></tt>
See also: <tt><ref id=".REFERENCED" name=".REFERENCED"></tt>, and
<tt><ref id=".REFERTO" name=".REFERTO"></tt>
<sect1><tt>.IMPORT</tt><label id=".IMPORT"><p>
@ -3764,6 +3765,33 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
See: <tt><ref id=".POPSEG" name=".POPSEG"></tt>
<sect1><tt>.REFERTO</tt><label id=".REFERTO"><p>
Mark a symbol as referenced.
It is useful in combination with the <tt><ref id=".IFREF" name=".IFREF"></tt>
command. A subroutine with two entry points can be created. When the first
entry point is called, it sets some default value as an argument, and falls
through into the second entry point. <tt>.REFERTO</tt> helps to ensure that
the second part is included into binary when only the first entry point is
actually used from the code.
Example:
<tscreen><verb>
.ifref ResetValue ; If this subroutine is used
ResetValue: ; Define it
lda #0 ; Set a default value
.referto SetValue ; Ensure that SetValue will be included
.endif
.ifref SetValue ; If this or previous subroutine is used
SetValue:
sta Value
rts
.endif
</verb></tscreen>
<sect1><tt>.RELOC</tt><label id=".RELOC"><p>
Switch back to relocatable mode. See the <tt><ref id=".ORG"

View file

@ -1734,8 +1734,7 @@ static void DoReferTo (void)
/* Mark given symbol as referenced */
{
SymEntry* Sym = ParseAnySymName (SYM_ALLOC_NEW);
if (Sym)
{
if (Sym) {
SymRef (Sym);
}
}