mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 19:29:37 +00:00
Merge pull request #221 from undisbeliever/master
Added .asize and .isize pseudo variables in ca65
This commit is contained in:
commit
43bda6928d
@ -1191,6 +1191,35 @@ writable.
|
|||||||
assignments to <tt/*/, use <tt/<ref id=".ORG" name=".ORG">/ instead.
|
assignments to <tt/*/, use <tt/<ref id=".ORG" name=".ORG">/ instead.
|
||||||
|
|
||||||
|
|
||||||
|
<sect1><tt>.ASIZE</tt><label id=".ASIZE"><p>
|
||||||
|
|
||||||
|
Reading this pseudo variable will return the current size of the
|
||||||
|
Accumulator in bits.
|
||||||
|
|
||||||
|
For the 65816 instruction set .ASIZE will return either 8 or 16, depending
|
||||||
|
on the current size of the operand in immediate accu addressing mode.
|
||||||
|
|
||||||
|
For all other CPU instruction sets, .ASIZE will always return 8.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
<tscreen><verb>
|
||||||
|
; Reverse Subtract with Accumulator
|
||||||
|
; A = memory - A
|
||||||
|
.macro rsb param
|
||||||
|
.if .asize = 8
|
||||||
|
eor #$ff
|
||||||
|
.else
|
||||||
|
eor #$ffff
|
||||||
|
.endif
|
||||||
|
sec
|
||||||
|
adc param
|
||||||
|
.endmacro
|
||||||
|
</verb></tscreen>
|
||||||
|
|
||||||
|
See also: <tt><ref id=".ISIZE" name=".ISIZE"></tt>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.CPU</tt><label id=".CPU"><p>
|
<sect1><tt>.CPU</tt><label id=".CPU"><p>
|
||||||
|
|
||||||
Reading this pseudo variable will give a constant integer value that
|
Reading this pseudo variable will give a constant integer value that
|
||||||
@ -1218,6 +1247,19 @@ writable.
|
|||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1><tt>.ISIZE</tt><label id=".ISIZE"><p>
|
||||||
|
|
||||||
|
Reading this pseudo variable will return the current size of the Index
|
||||||
|
register in bits.
|
||||||
|
|
||||||
|
For the 65816 instruction set .ISIZE will return either 8 or 16, depending
|
||||||
|
on the current size of the operand in immediate index addressing mode.
|
||||||
|
|
||||||
|
For all other CPU instruction sets, .ISIZE will always return 8.
|
||||||
|
|
||||||
|
See also: <tt><ref id=".ASIZE" name=".ASIZE"></tt>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.PARAMCOUNT</tt><label id=".PARAMCOUNT"><p>
|
<sect1><tt>.PARAMCOUNT</tt><label id=".PARAMCOUNT"><p>
|
||||||
|
|
||||||
This builtin pseudo variable is only available in macros. It is replaced by
|
This builtin pseudo variable is only available in macros. It is replaced by
|
||||||
|
@ -1099,6 +1099,15 @@ static ExprNode* Factor (void)
|
|||||||
N = Function (FuncAddrSize);
|
N = Function (FuncAddrSize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_ASIZE:
|
||||||
|
if (GetCPU () != CPU_65816) {
|
||||||
|
N = GenLiteralExpr (8);
|
||||||
|
} else {
|
||||||
|
N = GenLiteralExpr (ExtBytes[AM65I_IMM_ACCU] * 8);
|
||||||
|
}
|
||||||
|
NextTok ();
|
||||||
|
break;
|
||||||
|
|
||||||
case TOK_BLANK:
|
case TOK_BLANK:
|
||||||
N = Function (FuncBlank);
|
N = Function (FuncBlank);
|
||||||
break;
|
break;
|
||||||
@ -1132,6 +1141,15 @@ static ExprNode* Factor (void)
|
|||||||
N = Function (FuncIsMnemonic);
|
N = Function (FuncIsMnemonic);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_ISIZE:
|
||||||
|
if (GetCPU () != CPU_65816) {
|
||||||
|
N = GenLiteralExpr (8);
|
||||||
|
} else {
|
||||||
|
N = GenLiteralExpr (ExtBytes[AM65I_IMM_INDEX] * 8);
|
||||||
|
}
|
||||||
|
NextTok ();
|
||||||
|
break;
|
||||||
|
|
||||||
case TOK_LOBYTE:
|
case TOK_LOBYTE:
|
||||||
N = Function (FuncLoByte);
|
N = Function (FuncLoByte);
|
||||||
break;
|
break;
|
||||||
|
@ -1967,6 +1967,7 @@ static CtrlDesc CtrlCmdTab [] = {
|
|||||||
{ ccNone, DoUnexpected }, /* .ADDRSIZE */
|
{ ccNone, DoUnexpected }, /* .ADDRSIZE */
|
||||||
{ ccNone, DoAlign },
|
{ ccNone, DoAlign },
|
||||||
{ ccNone, DoASCIIZ },
|
{ ccNone, DoASCIIZ },
|
||||||
|
{ ccNone, DoUnexpected }, /* .ASIZE */
|
||||||
{ ccNone, DoAssert },
|
{ ccNone, DoAssert },
|
||||||
{ ccNone, DoAutoImport },
|
{ ccNone, DoAutoImport },
|
||||||
{ ccNone, DoUnexpected }, /* .BANK */
|
{ ccNone, DoUnexpected }, /* .BANK */
|
||||||
@ -2041,6 +2042,7 @@ static CtrlDesc CtrlCmdTab [] = {
|
|||||||
{ ccNone, DoIncBin },
|
{ ccNone, DoIncBin },
|
||||||
{ ccNone, DoInclude },
|
{ ccNone, DoInclude },
|
||||||
{ ccNone, DoInterruptor },
|
{ ccNone, DoInterruptor },
|
||||||
|
{ ccNone, DoUnexpected }, /* .ISIZE */
|
||||||
{ ccNone, DoUnexpected }, /* .ISMNEMONIC */
|
{ ccNone, DoUnexpected }, /* .ISMNEMONIC */
|
||||||
{ ccNone, DoInvalid }, /* .LEFT */
|
{ ccNone, DoInvalid }, /* .LEFT */
|
||||||
{ ccNone, DoLineCont },
|
{ ccNone, DoLineCont },
|
||||||
|
@ -139,6 +139,7 @@ struct DotKeyword {
|
|||||||
{ ".ALIGN", TOK_ALIGN },
|
{ ".ALIGN", TOK_ALIGN },
|
||||||
{ ".AND", TOK_BOOLAND },
|
{ ".AND", TOK_BOOLAND },
|
||||||
{ ".ASCIIZ", TOK_ASCIIZ },
|
{ ".ASCIIZ", TOK_ASCIIZ },
|
||||||
|
{ ".ASIZE", TOK_ASIZE },
|
||||||
{ ".ASSERT", TOK_ASSERT },
|
{ ".ASSERT", TOK_ASSERT },
|
||||||
{ ".AUTOIMPORT", TOK_AUTOIMPORT },
|
{ ".AUTOIMPORT", TOK_AUTOIMPORT },
|
||||||
{ ".BANK", TOK_BANK },
|
{ ".BANK", TOK_BANK },
|
||||||
@ -224,6 +225,7 @@ struct DotKeyword {
|
|||||||
{ ".INCBIN", TOK_INCBIN },
|
{ ".INCBIN", TOK_INCBIN },
|
||||||
{ ".INCLUDE", TOK_INCLUDE },
|
{ ".INCLUDE", TOK_INCLUDE },
|
||||||
{ ".INTERRUPTOR", TOK_INTERRUPTOR },
|
{ ".INTERRUPTOR", TOK_INTERRUPTOR },
|
||||||
|
{ ".ISIZE", TOK_ISIZE },
|
||||||
{ ".ISMNEM", TOK_ISMNEMONIC },
|
{ ".ISMNEM", TOK_ISMNEMONIC },
|
||||||
{ ".ISMNEMONIC", TOK_ISMNEMONIC },
|
{ ".ISMNEMONIC", TOK_ISMNEMONIC },
|
||||||
{ ".LEFT", TOK_LEFT },
|
{ ".LEFT", TOK_LEFT },
|
||||||
|
@ -126,6 +126,7 @@ typedef enum token_t {
|
|||||||
TOK_ADDRSIZE,
|
TOK_ADDRSIZE,
|
||||||
TOK_ALIGN,
|
TOK_ALIGN,
|
||||||
TOK_ASCIIZ,
|
TOK_ASCIIZ,
|
||||||
|
TOK_ASIZE,
|
||||||
TOK_ASSERT,
|
TOK_ASSERT,
|
||||||
TOK_AUTOIMPORT,
|
TOK_AUTOIMPORT,
|
||||||
TOK_BANK,
|
TOK_BANK,
|
||||||
@ -200,6 +201,7 @@ typedef enum token_t {
|
|||||||
TOK_INCBIN,
|
TOK_INCBIN,
|
||||||
TOK_INCLUDE,
|
TOK_INCLUDE,
|
||||||
TOK_INTERRUPTOR,
|
TOK_INTERRUPTOR,
|
||||||
|
TOK_ISIZE,
|
||||||
TOK_ISMNEMONIC,
|
TOK_ISMNEMONIC,
|
||||||
TOK_LEFT,
|
TOK_LEFT,
|
||||||
TOK_LINECONT,
|
TOK_LINECONT,
|
||||||
|
Loading…
Reference in New Issue
Block a user