mirror of
https://github.com/cc65/cc65.git
synced 2025-01-03 16:33:19 +00:00
Added the .TIME pseudo function
git-svn-id: svn://svn.cc65.org/cc65/trunk@1651 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
0edf53fd2f
commit
8fc78c2c8d
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<!doctype linuxdoc system>
|
<!doctype linuxdoc system>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
@ -406,6 +407,7 @@ Available operators sorted by precedence:
|
|||||||
.DEFINED Builtin function 1
|
.DEFINED Builtin function 1
|
||||||
.MATCH Builtin function 1
|
.MATCH Builtin function 1
|
||||||
.TCOUNT Builtin function 1
|
.TCOUNT Builtin function 1
|
||||||
|
.TIME Builtin function 1
|
||||||
.XMATCH Builtin function 1
|
.XMATCH Builtin function 1
|
||||||
.PARAMCOUNT Builtin pseudo variable (r/o) 1
|
.PARAMCOUNT Builtin pseudo variable (r/o) 1
|
||||||
.REFERENCED Builtin function 1
|
.REFERENCED Builtin function 1
|
||||||
@ -2139,17 +2141,33 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
.macro ldax arg
|
.macro ldax arg
|
||||||
.if (.match (.mid (0, 1, arg), #))
|
.if (.match (.mid (0, 1, arg), #))
|
||||||
; ldax called with immidiate operand
|
; ldax called with immidiate operand
|
||||||
lda #<(.right (.tcount (arg)-1, arg))
|
lda #<(.right (.tcount (arg)-1, arg))
|
||||||
ldx #>(.right (.tcount (arg)-1, arg))
|
ldx #>(.right (.tcount (arg)-1, arg))
|
||||||
.else
|
.else
|
||||||
...
|
...
|
||||||
.endif
|
.endif
|
||||||
.endmacro
|
.endmacro
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1><tt>.TIME</tt><label id=".TIME"><p>
|
||||||
|
|
||||||
|
Reading this pseudo variable will give a constant integer value that
|
||||||
|
represents the current time in POSIX standard (as seconds since the
|
||||||
|
Epoch).
|
||||||
|
|
||||||
|
It may be used to encode the time of translation somewhere in the created
|
||||||
|
code.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
<tscreen><verb>
|
||||||
|
.dword .time ; Place time here
|
||||||
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.WARNING</tt><label id=".WARNING"><p>
|
<sect1><tt>.WARNING</tt><label id=".WARNING"><p>
|
||||||
|
|
||||||
Force an assembly warning. The assembler will output a warning message
|
Force an assembly warning. The assembler will output a warning message
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
@ -660,6 +661,11 @@ static ExprNode* Factor (void)
|
|||||||
N = Function (FuncTCount);
|
N = Function (FuncTCount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_TIME:
|
||||||
|
N = LiteralExpr (time (0));
|
||||||
|
NextTok ();
|
||||||
|
break;
|
||||||
|
|
||||||
case TOK_XMATCH:
|
case TOK_XMATCH:
|
||||||
N = Function (FuncXMatch);
|
N = Function (FuncXMatch);
|
||||||
break;
|
break;
|
||||||
|
@ -1430,6 +1430,7 @@ static CtrlDesc CtrlCmdTab [] = {
|
|||||||
{ ccNone, DoUnexpected }, /* .STRLEN */
|
{ ccNone, DoUnexpected }, /* .STRLEN */
|
||||||
{ ccNone, DoSunPlus },
|
{ ccNone, DoSunPlus },
|
||||||
{ ccNone, DoUnexpected }, /* .TCOUNT */
|
{ ccNone, DoUnexpected }, /* .TCOUNT */
|
||||||
|
{ ccNone, DoUnexpected }, /* .TIME */
|
||||||
{ ccNone, DoWarning },
|
{ ccNone, DoWarning },
|
||||||
{ ccNone, DoWord },
|
{ ccNone, DoWord },
|
||||||
{ ccNone, DoUnexpected }, /* .XMATCH */
|
{ ccNone, DoUnexpected }, /* .XMATCH */
|
||||||
|
@ -228,6 +228,7 @@ struct DotKeyword {
|
|||||||
{ ".STRLEN", TOK_STRLEN },
|
{ ".STRLEN", TOK_STRLEN },
|
||||||
{ ".SUNPLUS", TOK_SUNPLUS },
|
{ ".SUNPLUS", TOK_SUNPLUS },
|
||||||
{ ".TCOUNT", TOK_TCOUNT },
|
{ ".TCOUNT", TOK_TCOUNT },
|
||||||
|
{ ".TIME", TOK_TIME },
|
||||||
{ ".WARNING", TOK_WARNING },
|
{ ".WARNING", TOK_WARNING },
|
||||||
{ ".WORD", TOK_WORD },
|
{ ".WORD", TOK_WORD },
|
||||||
{ ".XMATCH", TOK_XMATCH },
|
{ ".XMATCH", TOK_XMATCH },
|
||||||
|
@ -201,6 +201,7 @@ enum Token {
|
|||||||
TOK_STRLEN,
|
TOK_STRLEN,
|
||||||
TOK_SUNPLUS,
|
TOK_SUNPLUS,
|
||||||
TOK_TCOUNT,
|
TOK_TCOUNT,
|
||||||
|
TOK_TIME,
|
||||||
TOK_WARNING,
|
TOK_WARNING,
|
||||||
TOK_WORD,
|
TOK_WORD,
|
||||||
TOK_XMATCH,
|
TOK_XMATCH,
|
||||||
|
Loading…
Reference in New Issue
Block a user