File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -443,6 +443,8 @@ void keywords (char **cstatement)
443443 playsfx (statement );
444444 else if (!strncmp (statement [1 ], "mutesfx" , 8 ))
445445 mutesfx (statement );
446+ else if (!strncmp (statement [1 ], "strcpy" , 6 ))
447+ dostrcpy (statement );
446448 else if (!strncmp (statement [1 ], "memcpy" , 6 ))
447449 domemcpy (statement );
448450 else if (!strncmp (statement [1 ], "memset" , 6 ))
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ int linenumber=1;
1919%x speechquotestart
2020%x songdata
2121%x songquotestart
22+ %x strcpy
2223%x plotchars
2324%x plotquotestart
2425%x player
@@ -126,6 +127,12 @@ int linenumber=1;
126127<plotquotestart >[' ] {printf (" %s" ,yytext);BEGIN (INITIAL );}
127128<plotquotestart >^ \n * printf(" %s" ,yytext);
128129
130+ " strcpy" {printf (" %s" ,yytext);BEGIN (strcpy);}
131+ <strcpy >[' ] {printf (" %s" ,yytext);BEGIN (plotquotestart);}
132+ <strcpy >[ \t ]+ putchar(' ' );
133+ <strcpy >[ \t\r ]+ $
134+ <strcpy >\n {linenumber++;printf (" \n " );BEGIN (INITIAL );}
135+
129136" _include" printf(" %s" , yytext);
130137" include" {printf (" %s" ,yytext);BEGIN (includes);}
131138<includes >^ \n * printf(" %s" ,yytext);
Original file line number Diff line number Diff line change @@ -1843,6 +1843,30 @@ int inlinealphadata (char **statement)
18431843 return (quotelen );
18441844}
18451845
1846+ void dostrcpy (char * * statement )
1847+ {
1848+ // 1 2 3
1849+ // strcpy destination 'string literal'
1850+
1851+
1852+ int autotextwidth = 0 ;
1853+
1854+ assertminimumargs (statement , "strcpy" , 2 );
1855+
1856+ if (statement [3 ][0 ] == '\'' )
1857+ autotextwidth = inlinealphadata (statement + 1 );
1858+ else
1859+ prerror ("strcpy requires a string literal" );
1860+
1861+ printf (" ldy #%d\n" ,autotextwidth );
1862+ printf ("copystr%d\n" , templabel );
1863+ printf (" lda [%s-1],y\n" ,statement [3 ]);
1864+ printf (" sta [%s-1],y\n" ,statement [2 ]);
1865+ printf (" dey\n" );
1866+ printf (" bne copystr%d\n" , templabel ++ );
1867+ }
1868+
1869+
18461870void plotchars (char * * statement )
18471871{
18481872 // 1 2 3 4 5 6
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ void adjustvisible (char **);
8888void gosub (char * * );
8989void doif (char * * );
9090void domemcpy (char * * );
91+ void dostrcpy (char * * );
9192void pokechar (char * * );
9293void setfade (char * * statement );
9394void let (char * * );
You can’t perform that action at this time.
0 commit comments