1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-29 18:49:42 +00:00

Added support for character escape sequence '\\'. Closes #504

This commit is contained in:
jespergravgaard 2021-08-04 17:08:40 +02:00
parent 66b73ddd56
commit 8c83c21a0f
9 changed files with 411 additions and 282 deletions

View File

@ -144,7 +144,7 @@ fragment NAME_CHAR : [a-zA-Z0-9_];
// Strings and chars // Strings and chars
STRING : '"' ('\\"' | ~'"')* '"' [z]?([aps][tsmua]?)?[z]? ; STRING : '"' ('\\"' | ~'"')* '"' [z]?([aps][tsmua]?)?[z]? ;
CHAR : '\'' ('\\'(['"rfn]|'x'[0-9a-f][0-9a-f]) | ~'\'' ) '\''; CHAR : '\'' ('\\'(['"rfn\\]|'x'[0-9a-f][0-9a-f]) | ~'\'' ) '\'';
// White space on hidden channel 1 // White space on hidden channel 1
WS : [ \t\r\n\u00a0]+ -> channel(1); WS : [ \t\r\n\u00a0]+ -> channel(1);

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCLexer.g4 by ANTLR 4.9 // Generated from /Users/jespergravgaard/c64/kickc/src/main/java/dk/camelot64/kickc/parser/KickCLexer.g4 by ANTLR 4.9.1
package dk.camelot64.kickc.parser; package dk.camelot64.kickc.parser;
@ -13,7 +13,7 @@ import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class KickCLexer extends Lexer { public class KickCLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.9", RuntimeMetaData.VERSION); } static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA; protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache = protected static final PredictionContextCache _sharedContextCache =
@ -446,101 +446,101 @@ public class KickCLexer extends Lexer {
"\u008a\u011d\u008b\u011f\u008c\u0121\u008d\u0123\u008e\u0125\u008f\u0127"+ "\u008a\u011d\u008b\u011f\u008c\u0121\u008d\u0123\u008e\u0125\u008f\u0127"+
"\2\u0129\2\u012b\2\u012d\u0090\u012f\u0091\u0131\u0092\u0133\u0093\u0135"+ "\2\u0129\2\u012b\2\u012d\u0090\u012f\u0091\u0131\u0092\u0133\u0093\u0135"+
"\2\u0137\2\u0139\u0094\u013b\u0095\u013d\u0096\u013f\u0097\u0141\u0098"+ "\2\u0137\2\u0139\u0094\u013b\u0095\u013d\u0096\u013f\u0097\u0141\u0098"+
"\u0143\u0099\u0145\u009a\u0147\u009b\u0149\u009c\5\2\3\4\26\6\2UUWWuu"+ "\u0143\u0099\u0145\u009a\u0147\u009b\u0149\u009c\5\2\3\4\27\6\2UUWWuu"+
"ww\f\2DFKKNNUUYYdfkknnuuyy\6\2NNWWnnww\4\2DDdd\3\2\62\63\3\2\62;\5\2\62"+ "ww\f\2DFKKNNUUYYdfkknnuuyy\6\2NNWWnnww\4\2DDdd\3\2\62\63\3\2\62;\5\2\62"+
";CHch\5\2C\\aac|\6\2\62;C\\aac|\3\2$$\3\2||\5\2ccrruu\5\2ccoouw\7\2$$"+ ";CHch\5\2C\\aac|\6\2\62;C\\aac|\3\2$$\3\2||\5\2ccrruu\5\2ccoouw\b\2$$"+
"))hhpptt\4\2\62;ch\3\2))\6\2\13\f\17\17\"\"\u00a2\u00a2\4\2\f\f\17\17"+ "))^^hhpptt\4\2\62;ch\3\2))\6\2\13\f\17\17\"\"\u00a2\u00a2\4\2\f\f\17\17"+
"\4\2--//\7\2/;C\\^^aac|\2\u087e\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2"+ "\7\2$$))hhpptt\4\2--//\7\2/;C\\^^aac|\2\u087e\2\5\3\2\2\2\2\7\3\2\2\2"+
"\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3"+ "\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3"+
"\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2"+ "\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2"+
"\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2"+ "\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2"+
"\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2"+ "\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2"+
"\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2"+ "\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2"+
"\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q"+ "\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2"+
"\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2"+ "O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3"+
"\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2"+ "\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2"+
"\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w"+ "\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2\2\2"+
"\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2"+ "u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2"+
"\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b"+ "\u0081\3\2\2\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089"+
"\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2"+ "\3\2\2\2\2\u008b\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091\3\2\2"+
"\2\2\u0095\3\2\2\2\2\u0097\3\2\2\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d"+ "\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2\2\2\u0099\3\2\2\2\2\u009b"+
"\3\2\2\2\2\u009f\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2"+ "\3\2\2\2\2\u009d\3\2\2\2\2\u009f\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2"+
"\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af"+ "\2\2\u00a5\3\2\2\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad"+
"\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2"+ "\3\2\2\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5\3\2\2"+
"\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1"+ "\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2\2\2\u00bd\3\2\2\2\2\u00bf"+
"\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2"+ "\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2"+
"\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3"+ "\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1"+
"\3\2\2\2\2\u00d5\3\2\2\2\2\u00dd\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5\3\2\2"+ "\3\2\2\2\2\u00d3\3\2\2\2\2\u00d5\3\2\2\2\2\u00dd\3\2\2\2\2\u00e3\3\2\2"+
"\2\2\u00e7\3\2\2\2\2\u00e9\3\2\2\2\2\u00eb\3\2\2\2\3\u00ed\3\2\2\2\3\u00ef"+ "\2\2\u00e5\3\2\2\2\2\u00e7\3\2\2\2\2\u00e9\3\2\2\2\2\u00eb\3\2\2\2\3\u00ed"+
"\3\2\2\2\3\u00f1\3\2\2\2\3\u00f3\3\2\2\2\3\u00f5\3\2\2\2\3\u00f7\3\2\2"+ "\3\2\2\2\3\u00ef\3\2\2\2\3\u00f1\3\2\2\2\3\u00f3\3\2\2\2\3\u00f5\3\2\2"+
"\2\3\u00f9\3\2\2\2\3\u00fb\3\2\2\2\3\u00fd\3\2\2\2\3\u00ff\3\2\2\2\3\u0101"+ "\2\3\u00f7\3\2\2\2\3\u00f9\3\2\2\2\3\u00fb\3\2\2\2\3\u00fd\3\2\2\2\3\u00ff"+
"\3\2\2\2\3\u0103\3\2\2\2\3\u0105\3\2\2\2\3\u0107\3\2\2\2\3\u0109\3\2\2"+ "\3\2\2\2\3\u0101\3\2\2\2\3\u0103\3\2\2\2\3\u0105\3\2\2\2\3\u0107\3\2\2"+
"\2\3\u010b\3\2\2\2\3\u010d\3\2\2\2\3\u010f\3\2\2\2\3\u0111\3\2\2\2\3\u0113"+ "\2\3\u0109\3\2\2\2\3\u010b\3\2\2\2\3\u010d\3\2\2\2\3\u010f\3\2\2\2\3\u0111"+
"\3\2\2\2\3\u0115\3\2\2\2\3\u0117\3\2\2\2\3\u0119\3\2\2\2\3\u011b\3\2\2"+ "\3\2\2\2\3\u0113\3\2\2\2\3\u0115\3\2\2\2\3\u0117\3\2\2\2\3\u0119\3\2\2"+
"\2\3\u011d\3\2\2\2\3\u011f\3\2\2\2\3\u0121\3\2\2\2\3\u0123\3\2\2\2\3\u0125"+ "\2\3\u011b\3\2\2\2\3\u011d\3\2\2\2\3\u011f\3\2\2\2\3\u0121\3\2\2\2\3\u0123"+
"\3\2\2\2\3\u012d\3\2\2\2\3\u012f\3\2\2\2\3\u0131\3\2\2\2\3\u0133\3\2\2"+ "\3\2\2\2\3\u0125\3\2\2\2\3\u012d\3\2\2\2\3\u012f\3\2\2\2\3\u0131\3\2\2"+
"\2\3\u0139\3\2\2\2\3\u013b\3\2\2\2\3\u013d\3\2\2\2\3\u013f\3\2\2\2\4\u0141"+ "\2\3\u0133\3\2\2\2\3\u0139\3\2\2\2\3\u013b\3\2\2\2\3\u013d\3\2\2\2\3\u013f"+
"\3\2\2\2\4\u0143\3\2\2\2\4\u0145\3\2\2\2\4\u0147\3\2\2\2\4\u0149\3\2\2"+ "\3\2\2\2\4\u0141\3\2\2\2\4\u0143\3\2\2\2\4\u0145\3\2\2\2\4\u0147\3\2\2"+
"\2\5\u014b\3\2\2\2\7\u014e\3\2\2\2\t\u0150\3\2\2\2\13\u0152\3\2\2\2\r"+ "\2\4\u0149\3\2\2\2\5\u014b\3\2\2\2\7\u014e\3\2\2\2\t\u0150\3\2\2\2\13"+
"\u0154\3\2\2\2\17\u0156\3\2\2\2\21\u0158\3\2\2\2\23\u015a\3\2\2\2\25\u015c"+ "\u0152\3\2\2\2\r\u0154\3\2\2\2\17\u0156\3\2\2\2\21\u0158\3\2\2\2\23\u015a"+
"\3\2\2\2\27\u015e\3\2\2\2\31\u0161\3\2\2\2\33\u0165\3\2\2\2\35\u0167\3"+ "\3\2\2\2\25\u015c\3\2\2\2\27\u015e\3\2\2\2\31\u0161\3\2\2\2\33\u0165\3"+
"\2\2\2\37\u0169\3\2\2\2!\u016c\3\2\2\2#\u016e\3\2\2\2%\u0170\3\2\2\2\'"+ "\2\2\2\35\u0167\3\2\2\2\37\u0169\3\2\2\2!\u016c\3\2\2\2#\u016e\3\2\2\2"+
"\u0172\3\2\2\2)\u0174\3\2\2\2+\u0176\3\2\2\2-\u0179\3\2\2\2/\u017c\3\2"+ "%\u0170\3\2\2\2\'\u0172\3\2\2\2)\u0174\3\2\2\2+\u0176\3\2\2\2-\u0179\3"+
"\2\2\61\u017e\3\2\2\2\63\u0180\3\2\2\2\65\u0182\3\2\2\2\67\u0184\3\2\2"+ "\2\2\2/\u017c\3\2\2\2\61\u017e\3\2\2\2\63\u0180\3\2\2\2\65\u0182\3\2\2"+
"\29\u0187\3\2\2\2;\u018a\3\2\2\2=\u018d\3\2\2\2?\u0190\3\2\2\2A\u0192"+ "\2\67\u0184\3\2\2\29\u0187\3\2\2\2;\u018a\3\2\2\2=\u018d\3\2\2\2?\u0190"+
"\3\2\2\2C\u0195\3\2\2\2E\u0198\3\2\2\2G\u019a\3\2\2\2I\u019d\3\2\2\2K"+ "\3\2\2\2A\u0192\3\2\2\2C\u0195\3\2\2\2E\u0198\3\2\2\2G\u019a\3\2\2\2I"+
"\u01a0\3\2\2\2M\u01b8\3\2\2\2O\u01ba\3\2\2\2Q\u01c2\3\2\2\2S\u01c8\3\2"+ "\u019d\3\2\2\2K\u01a0\3\2\2\2M\u01b8\3\2\2\2O\u01ba\3\2\2\2Q\u01c2\3\2"+
"\2\2U\u01cf\3\2\2\2W\u01d8\3\2\2\2Y\u01e0\3\2\2\2[\u01e7\3\2\2\2]\u01f0"+ "\2\2S\u01c8\3\2\2\2U\u01cf\3\2\2\2W\u01d8\3\2\2\2Y\u01e0\3\2\2\2[\u01e7"+
"\3\2\2\2_\u01f7\3\2\2\2a\u0203\3\2\2\2c\u020c\3\2\2\2e\u0219\3\2\2\2g"+ "\3\2\2\2]\u01f0\3\2\2\2_\u01f7\3\2\2\2a\u0203\3\2\2\2c\u020c\3\2\2\2e"+
"\u0223\3\2\2\2i\u0228\3\2\2\2k\u022e\3\2\2\2m\u0234\3\2\2\2o\u0239\3\2"+ "\u0219\3\2\2\2g\u0223\3\2\2\2i\u0228\3\2\2\2k\u022e\3\2\2\2m\u0234\3\2"+
"\2\2q\u0271\3\2\2\2s\u0273\3\2\2\2u\u0276\3\2\2\2w\u027b\3\2\2\2y\u0281"+ "\2\2o\u0239\3\2\2\2q\u0271\3\2\2\2s\u0273\3\2\2\2u\u0276\3\2\2\2w\u027b"+
"\3\2\2\2{\u0284\3\2\2\2}\u0288\3\2\2\2\177\u028f\3\2\2\2\u0081\u0296\3"+ "\3\2\2\2y\u0281\3\2\2\2{\u0284\3\2\2\2}\u0288\3\2\2\2\177\u028f\3\2\2"+
"\2\2\2\u0083\u029c\3\2\2\2\u0085\u02a5\3\2\2\2\u0087\u02ab\3\2\2\2\u0089"+ "\2\u0081\u0296\3\2\2\2\u0083\u029c\3\2\2\2\u0085\u02a5\3\2\2\2\u0087\u02ab"+
"\u02b3\3\2\2\2\u008b\u02b8\3\2\2\2\u008d\u02bf\3\2\2\2\u008f\u02c5\3\2"+ "\3\2\2\2\u0089\u02b3\3\2\2\2\u008b\u02b8\3\2\2\2\u008d\u02bf\3\2\2\2\u008f"+
"\2\2\u0091\u02ca\3\2\2\2\u0093\u02d1\3\2\2\2\u0095\u02d8\3\2\2\2\u0097"+ "\u02c5\3\2\2\2\u0091\u02ca\3\2\2\2\u0093\u02d1\3\2\2\2\u0095\u02d8\3\2"+
"\u02e0\3\2\2\2\u0099\u02e8\3\2\2\2\u009b\u02f1\3\2\2\2\u009d\u02f6\3\2"+ "\2\2\u0097\u02e0\3\2\2\2\u0099\u02e8\3\2\2\2\u009b\u02f1\3\2\2\2\u009d"+
"\2\2\u009f\u02ff\3\2\2\2\u00a1\u0305\3\2\2\2\u00a3\u030c\3\2\2\2\u00a5"+ "\u02f6\3\2\2\2\u009f\u02ff\3\2\2\2\u00a1\u0305\3\2\2\2\u00a3\u030c\3\2"+
"\u0341\3\2\2\2\u00a7\u034c\3\2\2\2\u00a9\u034e\3\2\2\2\u00ab\u035a\3\2"+ "\2\2\u00a5\u0341\3\2\2\2\u00a7\u034c\3\2\2\2\u00a9\u034e\3\2\2\2\u00ab"+
"\2\2\u00ad\u0364\3\2\2\2\u00af\u036f\3\2\2\2\u00b1\u0377\3\2\2\2\u00b3"+ "\u035a\3\2\2\2\u00ad\u0364\3\2\2\2\u00af\u036f\3\2\2\2\u00b1\u0377\3\2"+
"\u0384\3\2\2\2\u00b5\u0386\3\2\2\2\u00b7\u038d\3\2\2\2\u00b9\u0394\3\2"+ "\2\2\u00b3\u0384\3\2\2\2\u00b5\u0386\3\2\2\2\u00b7\u038d\3\2\2\2\u00b9"+
"\2\2\u00bb\u039c\3\2\2\2\u00bd\u03a0\3\2\2\2\u00bf\u03a6\3\2\2\2\u00c1"+ "\u0394\3\2\2\2\u00bb\u039c\3\2\2\2\u00bd\u03a0\3\2\2\2\u00bf\u03a6\3\2"+
"\u03ac\3\2\2\2\u00c3\u03b3\3\2\2\2\u00c5\u03bc\3\2\2\2\u00c7\u03c1\3\2"+ "\2\2\u00c1\u03ac\3\2\2\2\u00c3\u03b3\3\2\2\2\u00c5\u03bc\3\2\2\2\u00c7"+
"\2\2\u00c9\u03c8\3\2\2\2\u00cb\u03d9\3\2\2\2\u00cd\u03e7\3\2\2\2\u00cf"+ "\u03c1\3\2\2\2\u00c9\u03c8\3\2\2\2\u00cb\u03d9\3\2\2\2\u00cd\u03e7\3\2"+
"\u03f8\3\2\2\2\u00d1\u040c\3\2\2\2\u00d3\u040f\3\2\2\2\u00d5\u0418\3\2"+ "\2\2\u00cf\u03f8\3\2\2\2\u00d1\u040c\3\2\2\2\u00d3\u040f\3\2\2\2\u00d5"+
"\2\2\u00d7\u041f\3\2\2\2\u00d9\u0421\3\2\2\2\u00db\u0423\3\2\2\2\u00dd"+ "\u0418\3\2\2\2\u00d7\u041f\3\2\2\2\u00d9\u0421\3\2\2\2\u00db\u0423\3\2"+
"\u0425\3\2\2\2\u00df\u042e\3\2\2\2\u00e1\u0430\3\2\2\2\u00e3\u0432\3\2"+ "\2\2\u00dd\u0425\3\2\2\2\u00df\u042e\3\2\2\2\u00e1\u0430\3\2\2\2\u00e3"+
"\2\2\u00e5\u0448\3\2\2\2\u00e7\u0456\3\2\2\2\u00e9\u045c\3\2\2\2\u00eb"+ "\u0432\3\2\2\2\u00e5\u0448\3\2\2\2\u00e7\u0456\3\2\2\2\u00e9\u045c\3\2"+
"\u0467\3\2\2\2\u00ed\u0475\3\2\2\2\u00ef\u06a1\3\2\2\2\u00f1\u06a3\3\2"+ "\2\2\u00eb\u0467\3\2\2\2\u00ed\u0475\3\2\2\2\u00ef\u06a1\3\2\2\2\u00f1"+
"\2\2\u00f3\u06a5\3\2\2\2\u00f5\u06a7\3\2\2\2\u00f7\u06a9\3\2\2\2\u00f9"+ "\u06a3\3\2\2\2\u00f3\u06a5\3\2\2\2\u00f5\u06a7\3\2\2\2\u00f7\u06a9\3\2"+
"\u06ab\3\2\2\2\u00fb\u06ad\3\2\2\2\u00fd\u06af\3\2\2\2\u00ff\u06b1\3\2"+ "\2\2\u00f9\u06ab\3\2\2\2\u00fb\u06ad\3\2\2\2\u00fd\u06af\3\2\2\2\u00ff"+
"\2\2\u0101\u06b3\3\2\2\2\u0103\u06b6\3\2\2\2\u0105\u06b9\3\2\2\2\u0107"+ "\u06b1\3\2\2\2\u0101\u06b3\3\2\2\2\u0103\u06b6\3\2\2\2\u0105\u06b9\3\2"+
"\u06bb\3\2\2\2\u0109\u06bd\3\2\2\2\u010b\u06bf\3\2\2\2\u010d\u06c1\3\2"+ "\2\2\u0107\u06bb\3\2\2\2\u0109\u06bd\3\2\2\2\u010b\u06bf\3\2\2\2\u010d"+
"\2\2\u010f\u06c3\3\2\2\2\u0111\u06c5\3\2\2\2\u0113\u06c8\3\2\2\2\u0115"+ "\u06c1\3\2\2\2\u010f\u06c3\3\2\2\2\u0111\u06c5\3\2\2\2\u0113\u06c8\3\2"+
"\u06cd\3\2\2\2\u0117\u06d2\3\2\2\2\u0119\u06d4\3\2\2\2\u011b\u06e4\3\2"+ "\2\2\u0115\u06cd\3\2\2\2\u0117\u06d2\3\2\2\2\u0119\u06d4\3\2\2\2\u011b"+
"\2\2\u011d\u06ed\3\2\2\2\u011f\u06fd\3\2\2\2\u0121\u06ff\3\2\2\2\u0123"+ "\u06e4\3\2\2\2\u011d\u06ed\3\2\2\2\u011f\u06fd\3\2\2\2\u0121\u06ff\3\2"+
"\u0706\3\2\2\2\u0125\u070a\3\2\2\2\u0127\u0710\3\2\2\2\u0129\u0712\3\2"+ "\2\2\u0123\u0706\3\2\2\2\u0125\u070a\3\2\2\2\u0127\u0710\3\2\2\2\u0129"+
"\2\2\u012b\u0714\3\2\2\2\u012d\u0716\3\2\2\2\u012f\u071e\3\2\2\2\u0131"+ "\u0712\3\2\2\2\u012b\u0714\3\2\2\2\u012d\u0716\3\2\2\2\u012f\u071e\3\2"+
"\u0724\3\2\2\2\u0133\u072b\3\2\2\2\u0135\u0732\3\2\2\2\u0137\u0734\3\2"+ "\2\2\u0131\u0724\3\2\2\2\u0133\u072b\3\2\2\2\u0135\u0732\3\2\2\2\u0137"+
"\2\2\u0139\u0736\3\2\2\2\u013b\u073a\3\2\2\2\u013d\u0740\3\2\2\2\u013f"+ "\u0734\3\2\2\2\u0139\u0736\3\2\2\2\u013b\u073a\3\2\2\2\u013d\u0740\3\2"+
"\u074b\3\2\2\2\u0141\u0759\3\2\2\2\u0143\u0762\3\2\2\2\u0145\u076f\3\2"+ "\2\2\u013f\u074b\3\2\2\2\u0141\u0759\3\2\2\2\u0143\u0762\3\2\2\2\u0145"+
"\2\2\u0147\u0775\3\2\2\2\u0149\u0780\3\2\2\2\u014b\u014c\7}\2\2\u014c"+ "\u076f\3\2\2\2\u0147\u0775\3\2\2\2\u0149\u0780\3\2\2\2\u014b\u014c\7}"+
"\u014d\b\2\2\2\u014d\6\3\2\2\2\u014e\u014f\7\177\2\2\u014f\b\3\2\2\2\u0150"+ "\2\2\u014c\u014d\b\2\2\2\u014d\6\3\2\2\2\u014e\u014f\7\177\2\2\u014f\b"+
"\u0151\7]\2\2\u0151\n\3\2\2\2\u0152\u0153\7_\2\2\u0153\f\3\2\2\2\u0154"+ "\3\2\2\2\u0150\u0151\7]\2\2\u0151\n\3\2\2\2\u0152\u0153\7_\2\2\u0153\f"+
"\u0155\7*\2\2\u0155\16\3\2\2\2\u0156\u0157\7+\2\2\u0157\20\3\2\2\2\u0158"+ "\3\2\2\2\u0154\u0155\7*\2\2\u0155\16\3\2\2\2\u0156\u0157\7+\2\2\u0157"+
"\u0159\7=\2\2\u0159\22\3\2\2\2\u015a\u015b\7<\2\2\u015b\24\3\2\2\2\u015c"+ "\20\3\2\2\2\u0158\u0159\7=\2\2\u0159\22\3\2\2\2\u015a\u015b\7<\2\2\u015b"+
"\u015d\7.\2\2\u015d\26\3\2\2\2\u015e\u015f\7\60\2\2\u015f\u0160\7\60\2"+ "\24\3\2\2\2\u015c\u015d\7.\2\2\u015d\26\3\2\2\2\u015e\u015f\7\60\2\2\u015f"+
"\2\u0160\30\3\2\2\2\u0161\u0162\7\60\2\2\u0162\u0163\7\60\2\2\u0163\u0164"+ "\u0160\7\60\2\2\u0160\30\3\2\2\2\u0161\u0162\7\60\2\2\u0162\u0163\7\60"+
"\7\60\2\2\u0164\32\3\2\2\2\u0165\u0166\7A\2\2\u0166\34\3\2\2\2\u0167\u0168"+ "\2\2\u0163\u0164\7\60\2\2\u0164\32\3\2\2\2\u0165\u0166\7A\2\2\u0166\34"+
"\7\60\2\2\u0168\36\3\2\2\2\u0169\u016a\7/\2\2\u016a\u016b\7@\2\2\u016b"+ "\3\2\2\2\u0167\u0168\7\60\2\2\u0168\36\3\2\2\2\u0169\u016a\7/\2\2\u016a"+
" \3\2\2\2\u016c\u016d\7-\2\2\u016d\"\3\2\2\2\u016e\u016f\7/\2\2\u016f"+ "\u016b\7@\2\2\u016b \3\2\2\2\u016c\u016d\7-\2\2\u016d\"\3\2\2\2\u016e"+
"$\3\2\2\2\u0170\u0171\7,\2\2\u0171&\3\2\2\2\u0172\u0173\7\61\2\2\u0173"+ "\u016f\7/\2\2\u016f$\3\2\2\2\u0170\u0171\7,\2\2\u0171&\3\2\2\2\u0172\u0173"+
"(\3\2\2\2\u0174\u0175\7\'\2\2\u0175*\3\2\2\2\u0176\u0177\7-\2\2\u0177"+ "\7\61\2\2\u0173(\3\2\2\2\u0174\u0175\7\'\2\2\u0175*\3\2\2\2\u0176\u0177"+
"\u0178\7-\2\2\u0178,\3\2\2\2\u0179\u017a\7/\2\2\u017a\u017b\7/\2\2\u017b"+ "\7-\2\2\u0177\u0178\7-\2\2\u0178,\3\2\2\2\u0179\u017a\7/\2\2\u017a\u017b"+
".\3\2\2\2\u017c\u017d\7(\2\2\u017d\60\3\2\2\2\u017e\u017f\7\u0080\2\2"+ "\7/\2\2\u017b.\3\2\2\2\u017c\u017d\7(\2\2\u017d\60\3\2\2\2\u017e\u017f"+
"\u017f\62\3\2\2\2\u0180\u0181\7`\2\2\u0181\64\3\2\2\2\u0182\u0183\7~\2"+ "\7\u0080\2\2\u017f\62\3\2\2\2\u0180\u0181\7`\2\2\u0181\64\3\2\2\2\u0182"+
"\2\u0183\66\3\2\2\2\u0184\u0185\7>\2\2\u0185\u0186\7>\2\2\u01868\3\2\2"+ "\u0183\7~\2\2\u0183\66\3\2\2\2\u0184\u0185\7>\2\2\u0185\u0186\7>\2\2\u0186"+
"\2\u0187\u0188\7@\2\2\u0188\u0189\7@\2\2\u0189:\3\2\2\2\u018a\u018b\7"+ "8\3\2\2\2\u0187\u0188\7@\2\2\u0188\u0189\7@\2\2\u0189:\3\2\2\2\u018a\u018b"+
"?\2\2\u018b\u018c\7?\2\2\u018c<\3\2\2\2\u018d\u018e\7#\2\2\u018e\u018f"+ "\7?\2\2\u018b\u018c\7?\2\2\u018c<\3\2\2\2\u018d\u018e\7#\2\2\u018e\u018f"+
"\7?\2\2\u018f>\3\2\2\2\u0190\u0191\7>\2\2\u0191@\3\2\2\2\u0192\u0193\7"+ "\7?\2\2\u018f>\3\2\2\2\u0190\u0191\7>\2\2\u0191@\3\2\2\2\u0192\u0193\7"+
">\2\2\u0193\u0194\7?\2\2\u0194B\3\2\2\2\u0195\u0196\7@\2\2\u0196\u0197"+ ">\2\2\u0193\u0194\7?\2\2\u0194B\3\2\2\2\u0195\u0196\7@\2\2\u0196\u0197"+
"\7?\2\2\u0197D\3\2\2\2\u0198\u0199\7@\2\2\u0199F\3\2\2\2\u019a\u019b\7"+ "\7?\2\2\u0197D\3\2\2\2\u0198\u0199\7@\2\2\u0199F\3\2\2\2\u019a\u019b\7"+
@ -998,9 +998,9 @@ public class KickCLexer extends Lexer {
"\3\2\2\2\u070e\u070c\3\2\2\2\u070e\u070f\3\2\2\2\u070f\u0126\3\2\2\2\u0710"+ "\3\2\2\2\u070e\u070c\3\2\2\2\u070e\u070f\3\2\2\2\u070f\u0126\3\2\2\2\u0710"+
"\u0711\t\6\2\2\u0711\u0128\3\2\2\2\u0712\u0713\t\7\2\2\u0713\u012a\3\2"+ "\u0711\t\6\2\2\u0711\u0128\3\2\2\2\u0712\u0713\t\7\2\2\u0713\u012a\3\2"+
"\2\2\u0714\u0715\t\b\2\2\u0715\u012c\3\2\2\2\u0716\u071a\7)\2\2\u0717"+ "\2\2\u0714\u0715\t\b\2\2\u0715\u012c\3\2\2\2\u0716\u071a\7)\2\2\u0717"+
"\u0718\7^\2\2\u0718\u071b\t\17\2\2\u0719\u071b\n\21\2\2\u071a\u0717\3"+ "\u0718\7^\2\2\u0718\u071b\t\24\2\2\u0719\u071b\n\21\2\2\u071a\u0717\3"+
"\2\2\2\u071a\u0719\3\2\2\2\u071b\u071c\3\2\2\2\u071c\u071d\7)\2\2\u071d"+ "\2\2\2\u071a\u0719\3\2\2\2\u071b\u071c\3\2\2\2\u071c\u071d\7)\2\2\u071d"+
"\u012e\3\2\2\2\u071e\u0720\5\u0131\u0098\2\u071f\u0721\t\24\2\2\u0720"+ "\u012e\3\2\2\2\u071e\u0720\5\u0131\u0098\2\u071f\u0721\t\25\2\2\u0720"+
"\u071f\3\2\2\2\u0721\u0722\3\2\2\2\u0722\u0720\3\2\2\2\u0722\u0723\3\2"+ "\u071f\3\2\2\2\u0721\u0722\3\2\2\2\u0722\u0720\3\2\2\2\u0722\u0723\3\2"+
"\2\2\u0723\u0130\3\2\2\2\u0724\u0728\7#\2\2\u0725\u0727\5\u0137\u009b"+ "\2\2\u0723\u0130\3\2\2\2\u0724\u0728\7#\2\2\u0725\u0727\5\u0137\u009b"+
"\2\u0726\u0725\3\2\2\2\u0727\u072a\3\2\2\2\u0728\u0726\3\2\2\2\u0728\u0729"+ "\2\u0726\u0725\3\2\2\2\u0727\u072a\3\2\2\2\u0728\u0726\3\2\2\2\u0728\u0729"+
@ -1019,7 +1019,7 @@ public class KickCLexer extends Lexer {
"\2\2\2\u074f\u074e\3\2\2\2\u0750\u0753\3\2\2\2\u0751\u0752\3\2\2\2\u0751"+ "\2\2\2\u074f\u074e\3\2\2\2\u0750\u0753\3\2\2\2\u0751\u0752\3\2\2\2\u0751"+
"\u074f\3\2\2\2\u0752\u0754\3\2\2\2\u0753\u0751\3\2\2\2\u0754\u0755\7,"+ "\u074f\3\2\2\2\u0752\u0754\3\2\2\2\u0753\u0751\3\2\2\2\u0754\u0755\7,"+
"\2\2\u0755\u0756\7\61\2\2\u0756\u0757\3\2\2\2\u0757\u0758\b\u009f\b\2"+ "\2\2\u0755\u0756\7\61\2\2\u0756\u0757\3\2\2\2\u0757\u0758\b\u009f\b\2"+
"\u0758\u0140\3\2\2\2\u0759\u075b\7>\2\2\u075a\u075c\t\25\2\2\u075b\u075a"+ "\u0758\u0140\3\2\2\2\u0759\u075b\7>\2\2\u075a\u075c\t\26\2\2\u075b\u075a"+
"\3\2\2\2\u075c\u075d\3\2\2\2\u075d\u075b\3\2\2\2\u075d\u075e\3\2\2\2\u075e"+ "\3\2\2\2\u075c\u075d\3\2\2\2\u075d\u075b\3\2\2\2\u075d\u075e\3\2\2\2\u075e"+
"\u075f\3\2\2\2\u075f\u0760\7@\2\2\u0760\u0761\b\u00a0\13\2\u0761\u0142"+ "\u075f\3\2\2\2\u075f\u0760\7@\2\2\u0760\u0761\b\u00a0\13\2\u0761\u0142"+
"\3\2\2\2\u0762\u0768\7$\2\2\u0763\u0764\7^\2\2\u0764\u0767\7$\2\2\u0765"+ "\3\2\2\2\u0762\u0768\7$\2\2\u0763\u0764\7^\2\2\u0764\u0767\7$\2\2\u0765"+

View File

@ -7,7 +7,7 @@ char MESSAGE[] = "hello\nworld\\";
char* const memA = (char*)0xff; char* const memA = (char*)0xff;
void main() { void main() {
byte i=0; char i=0;
while(MESSAGE[i]) while(MESSAGE[i])
chrout(MESSAGE[i++]); chrout(MESSAGE[i++]);
} }

View File

@ -3,7 +3,7 @@
#pragma encoding(petscii_mixed) #pragma encoding(petscii_mixed)
char MESSAGE[] = "hello\nworld"; char MESSAGE[] = "hello\nworld\\again";
char CH = '\n'; char CH = '\n';
char* SCREEN = (char*)0x0400; char* SCREEN = (char*)0x0400;
@ -19,12 +19,16 @@ void main() {
line += 0x28; line += 0x28;
cursor = line; cursor = line;
break; break;
case '\\':
line += 0x50;
cursor = line;
break;
default: default:
*cursor++ = *msg & 0x3f; *cursor++ = *msg & 0x3f;
} }
msg++; msg++;
} }
SCREEN[0x50] = CH; SCREEN[0xa0] = CH;
} }

View File

@ -34,9 +34,9 @@ main: {
lda (msg),y lda (msg),y
cmp #0 cmp #0
bne __b2 bne __b2
// SCREEN[0x50] = CH // SCREEN[0xa0] = CH
lda #CH lda #CH
sta SCREEN+$50 sta SCREEN+$a0
// } // }
rts rts
__b2: __b2:
@ -48,6 +48,13 @@ main: {
ldy #0 ldy #0
cmp (msg),y cmp (msg),y
beq __b4 beq __b4
// case '\\':
// line += 0x50;
// cursor = line;
// break;
lda #'\\'
cmp (msg),y
beq __b5
// *msg & 0x3f // *msg & 0x3f
lda #$3f lda #$3f
and (msg),y and (msg),y
@ -58,13 +65,27 @@ main: {
bne !+ bne !+
inc.z cursor+1 inc.z cursor+1
!: !:
__b6: __b7:
// msg++; // msg++;
inc.z msg inc.z msg
bne !+ bne !+
inc.z msg+1 inc.z msg+1
!: !:
jmp __b1 jmp __b1
__b5:
// line += 0x50
lda #$50
clc
adc.z line
sta.z cursor
lda #0
adc.z line+1
sta.z cursor+1
lda.z cursor
sta.z line
lda.z cursor+1
sta.z line+1
jmp __b7
__b4: __b4:
// line += 0x28 // line += 0x28
lda #$28 lda #$28
@ -78,8 +99,8 @@ main: {
sta.z line sta.z line
lda.z cursor+1 lda.z cursor+1
sta.z line+1 sta.z line+1
jmp __b6 jmp __b7
} }
.segment Data .segment Data
MESSAGE: .text @"hello\nworld" MESSAGE: .text @"hello\nworld\\again"
.byte 0 .byte 0

View File

@ -3,14 +3,14 @@ void main()
main: scope:[main] from main: scope:[main] from
[0] phi() [0] phi()
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@6 main::@1: scope:[main] from main main::@7
[1] main::cursor#3 = phi( main/(byte*) 1024, main::@6/main::cursor#6 ) [1] main::cursor#4 = phi( main/(byte*) 1024, main::@7/main::cursor#8 )
[1] main::line#2 = phi( main/(byte*) 1024, main::@6/main::line#5 ) [1] main::line#3 = phi( main/(byte*) 1024, main::@7/main::line#8 )
[1] main::msg#2 = phi( main/MESSAGE, main::@6/main::msg#1 ) [1] main::msg#2 = phi( main/MESSAGE, main::@7/main::msg#1 )
[2] if(0!=*main::msg#2) goto main::@2 [2] if(0!=*main::msg#2) goto main::@2
to:main::@3 to:main::@3
main::@3: scope:[main] from main::@1 main::@3: scope:[main] from main::@1
[3] *(SCREEN+$50) = CH [3] *(SCREEN+$a0) = CH
to:main::@return to:main::@return
main::@return: scope:[main] from main::@3 main::@return: scope:[main] from main::@3
[4] return [4] return
@ -18,18 +18,25 @@ main::@return: scope:[main] from main::@3
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
[5] if(*main::msg#2==' [5] if(*main::msg#2=='
'pm) goto main::@4 'pm) goto main::@4
to:main::@5 to:main::@8
main::@5: scope:[main] from main::@2 main::@8: scope:[main] from main::@2
[6] main::$0 = *main::msg#2 & $3f [6] if(*main::msg#2=='\'pm) goto main::@5
[7] *main::cursor#3 = main::$0
[8] main::cursor#2 = ++ main::cursor#3
to:main::@6 to:main::@6
main::@6: scope:[main] from main::@4 main::@5 main::@6: scope:[main] from main::@8
[9] main::cursor#6 = phi( main::@4/main::cursor#1, main::@5/main::cursor#2 ) [7] main::$0 = *main::msg#2 & $3f
[9] main::line#5 = phi( main::@4/main::line#8, main::@5/main::line#2 ) [8] *main::cursor#4 = main::$0
[10] main::msg#1 = ++ main::msg#2 [9] main::cursor#3 = ++ main::cursor#4
to:main::@7
main::@7: scope:[main] from main::@4 main::@5 main::@6
[10] main::cursor#8 = phi( main::@4/main::cursor#1, main::@5/main::cursor#2, main::@6/main::cursor#3 )
[10] main::line#8 = phi( main::@4/main::line#11, main::@5/main::line#12, main::@6/main::line#3 )
[11] main::msg#1 = ++ main::msg#2
to:main::@1 to:main::@1
main::@5: scope:[main] from main::@8
[12] main::cursor#2 = main::line#3 + $50
[13] main::line#12 = main::cursor#2
to:main::@7
main::@4: scope:[main] from main::@2 main::@4: scope:[main] from main::@2
[11] main::cursor#1 = main::line#2 + $28 [14] main::cursor#1 = main::line#3 + $28
[12] main::line#8 = main::cursor#1 [15] main::line#11 = main::cursor#1
to:main::@6 to:main::@7

View File

@ -8,41 +8,53 @@ main: scope:[main] from __start::@1
main::cursor#0 = main::line#0 main::cursor#0 = main::line#0
main::msg#0 = MESSAGE main::msg#0 = MESSAGE
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@6 main::@1: scope:[main] from main main::@7
main::cursor#5 = phi( main/main::cursor#0, main::@6/main::cursor#6 ) main::cursor#7 = phi( main/main::cursor#0, main::@7/main::cursor#8 )
main::line#4 = phi( main/main::line#0, main::@6/main::line#5 ) main::line#7 = phi( main/main::line#0, main::@7/main::line#8 )
main::msg#2 = phi( main/main::msg#0, main::@6/main::msg#1 ) main::msg#2 = phi( main/main::msg#0, main::@7/main::msg#1 )
main::$1 = 0 != *main::msg#2 main::$1 = 0 != *main::msg#2
if(main::$1) goto main::@2 if(main::$1) goto main::@2
to:main::@3 to:main::@3
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
main::cursor#4 = phi( main::@1/main::cursor#5 ) main::cursor#6 = phi( main::@1/main::cursor#7 )
main::line#3 = phi( main::@1/main::line#4 ) main::line#5 = phi( main::@1/main::line#7 )
main::msg#3 = phi( main::@1/main::msg#2 ) main::msg#3 = phi( main::@1/main::msg#2 )
if(*main::msg#3==' if(*main::msg#3=='
'pm) goto main::@4 'pm) goto main::@4
to:main::@5 to:main::@8
main::@3: scope:[main] from main::@1 main::@3: scope:[main] from main::@1
SCREEN[$50] = CH SCREEN[$a0] = CH
to:main::@return to:main::@return
main::@4: scope:[main] from main::@2 main::@4: scope:[main] from main::@2
main::msg#6 = phi( main::@2/main::msg#3 ) main::msg#7 = phi( main::@2/main::msg#3 )
main::line#2 = phi( main::@2/main::line#3 ) main::line#3 = phi( main::@2/main::line#5 )
main::line#1 = main::line#2 + $28 main::line#1 = main::line#3 + $28
main::cursor#1 = main::line#1 main::cursor#1 = main::line#1
to:main::@7
main::@8: scope:[main] from main::@2
main::cursor#5 = phi( main::@2/main::cursor#6 )
main::msg#6 = phi( main::@2/main::msg#3 )
main::line#6 = phi( main::@2/main::line#5 )
if(*main::msg#3=='\'pm) goto main::@5
to:main::@6 to:main::@6
main::@5: scope:[main] from main::@2 main::@5: scope:[main] from main::@8
main::line#6 = phi( main::@2/main::line#3 ) main::msg#8 = phi( main::@8/main::msg#6 )
main::cursor#3 = phi( main::@2/main::cursor#4 ) main::line#4 = phi( main::@8/main::line#6 )
main::msg#4 = phi( main::@2/main::msg#3 ) main::line#2 = main::line#4 + $50
main::cursor#2 = main::line#2
to:main::@7
main::@6: scope:[main] from main::@8
main::line#9 = phi( main::@8/main::line#6 )
main::cursor#4 = phi( main::@8/main::cursor#5 )
main::msg#4 = phi( main::@8/main::msg#6 )
main::$0 = *main::msg#4 & $3f main::$0 = *main::msg#4 & $3f
*main::cursor#3 = main::$0 *main::cursor#4 = main::$0
main::cursor#2 = ++ main::cursor#3 main::cursor#3 = ++ main::cursor#4
to:main::@6 to:main::@7
main::@6: scope:[main] from main::@4 main::@5 main::@7: scope:[main] from main::@4 main::@5 main::@6
main::cursor#6 = phi( main::@4/main::cursor#1, main::@5/main::cursor#2 ) main::cursor#8 = phi( main::@4/main::cursor#1, main::@5/main::cursor#2, main::@6/main::cursor#3 )
main::line#5 = phi( main::@4/main::line#1, main::@5/main::line#6 ) main::line#8 = phi( main::@4/main::line#1, main::@5/main::line#2, main::@6/main::line#9 )
main::msg#5 = phi( main::@4/main::msg#6, main::@5/main::msg#4 ) main::msg#5 = phi( main::@4/main::msg#7, main::@5/main::msg#8, main::@6/main::msg#4 )
main::msg#1 = ++ main::msg#5 main::msg#1 = ++ main::msg#5
to:main::@1 to:main::@1
main::@return: scope:[main] from main::@3 main::@return: scope:[main] from main::@3
@ -67,7 +79,7 @@ SYMBOL TABLE SSA
constant byte CH = ' constant byte CH = '
'pm 'pm
constant byte* MESSAGE[] = "hello constant byte* MESSAGE[] = "hello
world"pm world\again"pm
constant byte* SCREEN = (byte*)$400 constant byte* SCREEN = (byte*)$400
void __start() void __start()
void main() void main()
@ -81,6 +93,8 @@ byte* main::cursor#3
byte* main::cursor#4 byte* main::cursor#4
byte* main::cursor#5 byte* main::cursor#5
byte* main::cursor#6 byte* main::cursor#6
byte* main::cursor#7
byte* main::cursor#8
byte* main::line byte* main::line
byte* main::line#0 byte* main::line#0
byte* main::line#1 byte* main::line#1
@ -89,6 +103,9 @@ byte* main::line#3
byte* main::line#4 byte* main::line#4
byte* main::line#5 byte* main::line#5
byte* main::line#6 byte* main::line#6
byte* main::line#7
byte* main::line#8
byte* main::line#9
byte* main::msg byte* main::msg
byte* main::msg#0 byte* main::msg#0
byte* main::msg#1 byte* main::msg#1
@ -97,31 +114,37 @@ byte* main::msg#3
byte* main::msg#4 byte* main::msg#4
byte* main::msg#5 byte* main::msg#5
byte* main::msg#6 byte* main::msg#6
byte* main::msg#7
byte* main::msg#8
Adding number conversion cast (unumber) 0 in main::$1 = 0 != *main::msg#2 Adding number conversion cast (unumber) 0 in main::$1 = 0 != *main::msg#2
Adding number conversion cast (unumber) $50 in SCREEN[$50] = CH Adding number conversion cast (unumber) $a0 in SCREEN[$a0] = CH
Adding number conversion cast (unumber) $28 in main::line#1 = main::line#2 + $28 Adding number conversion cast (unumber) $28 in main::line#1 = main::line#3 + $28
Adding number conversion cast (unumber) $50 in main::line#2 = main::line#4 + $50
Adding number conversion cast (unumber) $3f in main::$0 = *main::msg#4 & $3f Adding number conversion cast (unumber) $3f in main::$0 = *main::msg#4 & $3f
Adding number conversion cast (unumber) main::$0 in main::$0 = *main::msg#4 & (unumber)$3f Adding number conversion cast (unumber) main::$0 in main::$0 = *main::msg#4 & (unumber)$3f
Successful SSA optimization PassNAddNumberTypeConversions Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0 Simplifying constant integer cast 0
Simplifying constant integer cast $50 Simplifying constant integer cast $a0
Simplifying constant integer cast $28 Simplifying constant integer cast $28
Simplifying constant integer cast $50
Simplifying constant integer cast $3f Simplifying constant integer cast $3f
Successful SSA optimization PassNCastSimplification Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $50 Finalized unsigned number type (byte) $a0
Finalized unsigned number type (byte) $28 Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) $50
Finalized unsigned number type (byte) $3f Finalized unsigned number type (byte) $3f
Successful SSA optimization PassNFinalizeNumberTypeConversions Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in main::$0 = *main::msg#4 & $3f Inferred type updated to byte in main::$0 = *main::msg#4 & $3f
Alias main::cursor#0 = main::line#0 Alias main::cursor#0 = main::line#0
Alias main::msg#2 = main::msg#3 main::msg#6 main::msg#4 Alias main::msg#2 = main::msg#3 main::msg#7 main::msg#6 main::msg#8 main::msg#4
Alias main::line#2 = main::line#3 main::line#4 main::line#6 Alias main::line#3 = main::line#5 main::line#7 main::line#6 main::line#4 main::line#9
Alias main::cursor#3 = main::cursor#4 main::cursor#5 Alias main::cursor#4 = main::cursor#6 main::cursor#7 main::cursor#5
Alias main::cursor#1 = main::line#1 Alias main::cursor#1 = main::line#1
Alias main::cursor#2 = main::line#2
Successful SSA optimization Pass2AliasElimination Successful SSA optimization Pass2AliasElimination
Alias main::msg#2 = main::msg#5 Alias main::msg#2 = main::msg#5
Successful SSA optimization Pass2AliasElimination Successful SSA optimization Pass2AliasElimination
@ -142,19 +165,21 @@ Inlining constant with var siblings main::msg#0
Constant inlined main::cursor#0 = (byte*) 1024 Constant inlined main::cursor#0 = (byte*) 1024
Constant inlined main::msg#0 = MESSAGE Constant inlined main::msg#0 = MESSAGE
Successful SSA optimization Pass2ConstantInlining Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN+$50) Consolidated array index constant in *(SCREEN+$a0)
Successful SSA optimization Pass2ConstantAdditionElimination Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of main Adding NOP phi() at start of main
CALL GRAPH CALL GRAPH
Created 5 initial phi equivalence classes Created 5 initial phi equivalence classes
Coalesced [9] main::line#9 = main::line#2 Coalesced [10] main::line#13 = main::line#3
Coalesced [10] main::cursor#9 = main::cursor#2 Coalesced [11] main::cursor#12 = main::cursor#3
Coalesced [13] main::msg#7 = main::msg#1 Coalesced [14] main::msg#9 = main::msg#1
Coalesced (already) [14] main::line#7 = main::line#5 Coalesced (already) [15] main::line#10 = main::line#8
Coalesced [15] main::cursor#7 = main::cursor#6 Coalesced [16] main::cursor#9 = main::cursor#8
Not coalescing [17] main::line#8 = main::cursor#1 Not coalescing [18] main::line#12 = main::cursor#2
Coalesced [18] main::cursor#8 = main::cursor#1 Coalesced [19] main::cursor#11 = main::cursor#2
Not coalescing [21] main::line#11 = main::cursor#1
Coalesced [22] main::cursor#10 = main::cursor#1
Coalesced down to 3 phi equivalence classes Coalesced down to 3 phi equivalence classes
Adding NOP phi() at start of main Adding NOP phi() at start of main
@ -164,14 +189,14 @@ void main()
main: scope:[main] from main: scope:[main] from
[0] phi() [0] phi()
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@6 main::@1: scope:[main] from main main::@7
[1] main::cursor#3 = phi( main/(byte*) 1024, main::@6/main::cursor#6 ) [1] main::cursor#4 = phi( main/(byte*) 1024, main::@7/main::cursor#8 )
[1] main::line#2 = phi( main/(byte*) 1024, main::@6/main::line#5 ) [1] main::line#3 = phi( main/(byte*) 1024, main::@7/main::line#8 )
[1] main::msg#2 = phi( main/MESSAGE, main::@6/main::msg#1 ) [1] main::msg#2 = phi( main/MESSAGE, main::@7/main::msg#1 )
[2] if(0!=*main::msg#2) goto main::@2 [2] if(0!=*main::msg#2) goto main::@2
to:main::@3 to:main::@3
main::@3: scope:[main] from main::@1 main::@3: scope:[main] from main::@1
[3] *(SCREEN+$50) = CH [3] *(SCREEN+$a0) = CH
to:main::@return to:main::@return
main::@return: scope:[main] from main::@3 main::@return: scope:[main] from main::@3
[4] return [4] return
@ -179,21 +204,28 @@ main::@return: scope:[main] from main::@3
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
[5] if(*main::msg#2==' [5] if(*main::msg#2=='
'pm) goto main::@4 'pm) goto main::@4
to:main::@5 to:main::@8
main::@5: scope:[main] from main::@2 main::@8: scope:[main] from main::@2
[6] main::$0 = *main::msg#2 & $3f [6] if(*main::msg#2=='\'pm) goto main::@5
[7] *main::cursor#3 = main::$0
[8] main::cursor#2 = ++ main::cursor#3
to:main::@6 to:main::@6
main::@6: scope:[main] from main::@4 main::@5 main::@6: scope:[main] from main::@8
[9] main::cursor#6 = phi( main::@4/main::cursor#1, main::@5/main::cursor#2 ) [7] main::$0 = *main::msg#2 & $3f
[9] main::line#5 = phi( main::@4/main::line#8, main::@5/main::line#2 ) [8] *main::cursor#4 = main::$0
[10] main::msg#1 = ++ main::msg#2 [9] main::cursor#3 = ++ main::cursor#4
to:main::@7
main::@7: scope:[main] from main::@4 main::@5 main::@6
[10] main::cursor#8 = phi( main::@4/main::cursor#1, main::@5/main::cursor#2, main::@6/main::cursor#3 )
[10] main::line#8 = phi( main::@4/main::line#11, main::@5/main::line#12, main::@6/main::line#3 )
[11] main::msg#1 = ++ main::msg#2
to:main::@1 to:main::@1
main::@5: scope:[main] from main::@8
[12] main::cursor#2 = main::line#3 + $50
[13] main::line#12 = main::cursor#2
to:main::@7
main::@4: scope:[main] from main::@2 main::@4: scope:[main] from main::@2
[11] main::cursor#1 = main::line#2 + $28 [14] main::cursor#1 = main::line#3 + $28
[12] main::line#8 = main::cursor#1 [15] main::line#11 = main::cursor#1
to:main::@6 to:main::@7
VARIABLE REGISTER WEIGHTS VARIABLE REGISTER WEIGHTS
@ -201,51 +233,56 @@ void main()
byte~ main::$0 22.0 byte~ main::$0 22.0
byte* main::cursor byte* main::cursor
byte* main::cursor#1 16.5 byte* main::cursor#1 16.5
byte* main::cursor#2 22.0 byte* main::cursor#2 16.5
byte* main::cursor#3 6.6000000000000005 byte* main::cursor#3 22.0
byte* main::cursor#6 16.5 byte* main::cursor#4 5.5
byte* main::cursor#8 22.0
byte* main::line byte* main::line
byte* main::line#2 5.5 byte* main::line#11 22.0
byte* main::line#5 16.5 byte* main::line#12 22.0
byte* main::line#3 6.285714285714286
byte* main::line#8 22.0 byte* main::line#8 22.0
byte* main::msg byte* main::msg
byte* main::msg#1 22.0 byte* main::msg#1 22.0
byte* main::msg#2 6.111111111111112 byte* main::msg#2 5.5
Initial phi equivalence classes Initial phi equivalence classes
[ main::msg#2 main::msg#1 ] [ main::msg#2 main::msg#1 ]
[ main::line#2 main::line#5 main::line#8 ] [ main::line#3 main::line#8 main::line#11 main::line#12 ]
[ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ]
Added variable main::$0 to live range equivalence class [ main::$0 ] Added variable main::$0 to live range equivalence class [ main::$0 ]
Complete equivalence classes Complete equivalence classes
[ main::msg#2 main::msg#1 ] [ main::msg#2 main::msg#1 ]
[ main::line#2 main::line#5 main::line#8 ] [ main::line#3 main::line#8 main::line#11 main::line#12 ]
[ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ]
[ main::$0 ] [ main::$0 ]
Allocated zp[2]:2 [ main::msg#2 main::msg#1 ] Allocated zp[2]:2 [ main::msg#2 main::msg#1 ]
Allocated zp[2]:4 [ main::line#2 main::line#5 main::line#8 ] Allocated zp[2]:4 [ main::line#3 main::line#8 main::line#11 main::line#12 ]
Allocated zp[2]:6 [ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] Allocated zp[2]:6 [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ]
Allocated zp[1]:8 [ main::$0 ] Allocated zp[1]:8 [ main::$0 ]
REGISTER UPLIFT POTENTIAL REGISTERS REGISTER UPLIFT POTENTIAL REGISTERS
Statement [2] if(0!=*main::msg#2) goto main::@2 [ main::msg#2 main::line#2 main::cursor#3 ] ( [ main::msg#2 main::line#2 main::cursor#3 ] { } ) always clobbers reg byte a reg byte y Statement [2] if(0!=*main::msg#2) goto main::@2 [ main::msg#2 main::line#3 main::cursor#4 ] ( [ main::msg#2 main::line#3 main::cursor#4 ] { } ) always clobbers reg byte a reg byte y
Statement [3] *(SCREEN+$50) = CH [ ] ( [ ] { } ) always clobbers reg byte a Statement [3] *(SCREEN+$a0) = CH [ ] ( [ ] { } ) always clobbers reg byte a
Statement [5] if(*main::msg#2==' Statement [5] if(*main::msg#2=='
'pm) goto main::@4 [ main::msg#2 main::line#2 main::cursor#3 ] ( [ main::msg#2 main::line#2 main::cursor#3 ] { } ) always clobbers reg byte a reg byte y 'pm) goto main::@4 [ main::msg#2 main::line#3 main::cursor#4 ] ( [ main::msg#2 main::line#3 main::cursor#4 ] { } ) always clobbers reg byte a reg byte y
Statement [6] main::$0 = *main::msg#2 & $3f [ main::msg#2 main::line#2 main::cursor#3 main::$0 ] ( [ main::msg#2 main::line#2 main::cursor#3 main::$0 ] { } ) always clobbers reg byte a reg byte y Statement [6] if(*main::msg#2=='\'pm) goto main::@5 [ main::msg#2 main::line#3 main::cursor#4 ] ( [ main::msg#2 main::line#3 main::cursor#4 ] { } ) always clobbers reg byte a reg byte y
Statement [7] *main::cursor#3 = main::$0 [ main::msg#2 main::line#2 main::cursor#3 ] ( [ main::msg#2 main::line#2 main::cursor#3 ] { } ) always clobbers reg byte y Statement [7] main::$0 = *main::msg#2 & $3f [ main::msg#2 main::line#3 main::cursor#4 main::$0 ] ( [ main::msg#2 main::line#3 main::cursor#4 main::$0 ] { } ) always clobbers reg byte a reg byte y
Statement [11] main::cursor#1 = main::line#2 + $28 [ main::msg#2 main::cursor#1 ] ( [ main::msg#2 main::cursor#1 ] { } ) always clobbers reg byte a Statement [8] *main::cursor#4 = main::$0 [ main::msg#2 main::line#3 main::cursor#4 ] ( [ main::msg#2 main::line#3 main::cursor#4 ] { } ) always clobbers reg byte y
Statement [12] main::line#8 = main::cursor#1 [ main::msg#2 main::line#8 main::cursor#1 ] ( [ main::msg#2 main::line#8 main::cursor#1 ] { } ) always clobbers reg byte a Statement [12] main::cursor#2 = main::line#3 + $50 [ main::msg#2 main::cursor#2 ] ( [ main::msg#2 main::cursor#2 ] { } ) always clobbers reg byte a
Statement [13] main::line#12 = main::cursor#2 [ main::msg#2 main::line#12 main::cursor#2 ] ( [ main::msg#2 main::line#12 main::cursor#2 ] { } ) always clobbers reg byte a
Statement [14] main::cursor#1 = main::line#3 + $28 [ main::msg#2 main::cursor#1 ] ( [ main::msg#2 main::cursor#1 ] { } ) always clobbers reg byte a
Statement [15] main::line#11 = main::cursor#1 [ main::msg#2 main::line#11 main::cursor#1 ] ( [ main::msg#2 main::line#11 main::cursor#1 ] { } ) always clobbers reg byte a
Potential registers zp[2]:2 [ main::msg#2 main::msg#1 ] : zp[2]:2 , Potential registers zp[2]:2 [ main::msg#2 main::msg#1 ] : zp[2]:2 ,
Potential registers zp[2]:4 [ main::line#2 main::line#5 main::line#8 ] : zp[2]:4 , Potential registers zp[2]:4 [ main::line#3 main::line#8 main::line#11 main::line#12 ] : zp[2]:4 ,
Potential registers zp[2]:6 [ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] : zp[2]:6 , Potential registers zp[2]:6 [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ] : zp[2]:6 ,
Potential registers zp[1]:8 [ main::$0 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:8 [ main::$0 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES REGISTER UPLIFT SCOPES
Uplift Scope [main] 61.6: zp[2]:6 [ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] 44: zp[2]:4 [ main::line#2 main::line#5 main::line#8 ] 28.11: zp[2]:2 [ main::msg#2 main::msg#1 ] 22: zp[1]:8 [ main::$0 ] Uplift Scope [main] 82.5: zp[2]:6 [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ] 72.29: zp[2]:4 [ main::line#3 main::line#8 main::line#11 main::line#12 ] 27.5: zp[2]:2 [ main::msg#2 main::msg#1 ] 22: zp[1]:8 [ main::$0 ]
Uplift Scope [] Uplift Scope []
Uplifting [main] best 1460 combination zp[2]:6 [ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] zp[2]:4 [ main::line#2 main::line#5 main::line#8 ] zp[2]:2 [ main::msg#2 main::msg#1 ] reg byte a [ main::$0 ] Uplifting [main] best 1940 combination zp[2]:6 [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ] zp[2]:4 [ main::line#3 main::line#8 main::line#11 main::line#12 ] zp[2]:2 [ main::msg#2 main::msg#1 ] reg byte a [ main::$0 ]
Uplifting [] best 1460 combination Uplifting [] best 1940 combination
ASSEMBLER BEFORE OPTIMIZATION ASSEMBLER BEFORE OPTIMIZATION
// File Comments // File Comments
@ -272,12 +309,12 @@ main: {
.label line = 4 .label line = 4
// [1] phi from main to main::@1 [phi:main->main::@1] // [1] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main: __b1_from_main:
// [1] phi main::cursor#3 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 // [1] phi main::cursor#4 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<$400 lda #<$400
sta.z cursor sta.z cursor
lda #>$400 lda #>$400
sta.z cursor+1 sta.z cursor+1
// [1] phi main::line#2 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 // [1] phi main::line#3 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1
lda #<$400 lda #<$400
sta.z line sta.z line
lda #>$400 lda #>$400
@ -298,9 +335,9 @@ main: {
jmp __b3 jmp __b3
// main::@3 // main::@3
__b3: __b3:
// [3] *(SCREEN+$50) = CH -- _deref_pbuc1=vbuc2 // [3] *(SCREEN+$a0) = CH -- _deref_pbuc1=vbuc2
lda #CH lda #CH
sta SCREEN+$50 sta SCREEN+$a0
jmp __breturn jmp __breturn
// main::@return // main::@return
__breturn: __breturn:
@ -313,43 +350,68 @@ main: {
ldy #0 ldy #0
cmp (msg),y cmp (msg),y
beq __b4 beq __b4
jmp __b5 jmp __b8
// main::@5 // main::@8
__b5: __b8:
// [6] main::$0 = *main::msg#2 & $3f -- vbuaa=_deref_pbuz1_band_vbuc1 // [6] if(*main::msg#2=='\'pm) goto main::@5 -- _deref_pbuz1_eq_vbuc1_then_la1
lda #'\\'
ldy #0
cmp (msg),y
beq __b5
jmp __b6
// main::@6
__b6:
// [7] main::$0 = *main::msg#2 & $3f -- vbuaa=_deref_pbuz1_band_vbuc1
lda #$3f lda #$3f
ldy #0 ldy #0
and (msg),y and (msg),y
// [7] *main::cursor#3 = main::$0 -- _deref_pbuz1=vbuaa // [8] *main::cursor#4 = main::$0 -- _deref_pbuz1=vbuaa
ldy #0 ldy #0
sta (cursor),y sta (cursor),y
// [8] main::cursor#2 = ++ main::cursor#3 -- pbuz1=_inc_pbuz1 // [9] main::cursor#3 = ++ main::cursor#4 -- pbuz1=_inc_pbuz1
inc.z cursor inc.z cursor
bne !+ bne !+
inc.z cursor+1 inc.z cursor+1
!: !:
// [9] phi from main::@4 main::@5 to main::@6 [phi:main::@4/main::@5->main::@6] // [10] phi from main::@4 main::@5 main::@6 to main::@7 [phi:main::@4/main::@5/main::@6->main::@7]
__b6_from___b4: __b7_from___b4:
__b6_from___b5: __b7_from___b5:
// [9] phi main::cursor#6 = main::cursor#1 [phi:main::@4/main::@5->main::@6#0] -- register_copy __b7_from___b6:
// [9] phi main::line#5 = main::line#8 [phi:main::@4/main::@5->main::@6#1] -- register_copy // [10] phi main::cursor#8 = main::cursor#1 [phi:main::@4/main::@5/main::@6->main::@7#0] -- register_copy
jmp __b6 // [10] phi main::line#8 = main::line#11 [phi:main::@4/main::@5/main::@6->main::@7#1] -- register_copy
// main::@6 jmp __b7
__b6: // main::@7
// [10] main::msg#1 = ++ main::msg#2 -- pbuz1=_inc_pbuz1 __b7:
// [11] main::msg#1 = ++ main::msg#2 -- pbuz1=_inc_pbuz1
inc.z msg inc.z msg
bne !+ bne !+
inc.z msg+1 inc.z msg+1
!: !:
// [1] phi from main::@6 to main::@1 [phi:main::@6->main::@1] // [1] phi from main::@7 to main::@1 [phi:main::@7->main::@1]
__b1_from___b6: __b1_from___b7:
// [1] phi main::cursor#3 = main::cursor#6 [phi:main::@6->main::@1#0] -- register_copy // [1] phi main::cursor#4 = main::cursor#8 [phi:main::@7->main::@1#0] -- register_copy
// [1] phi main::line#2 = main::line#5 [phi:main::@6->main::@1#1] -- register_copy // [1] phi main::line#3 = main::line#8 [phi:main::@7->main::@1#1] -- register_copy
// [1] phi main::msg#2 = main::msg#1 [phi:main::@6->main::@1#2] -- register_copy // [1] phi main::msg#2 = main::msg#1 [phi:main::@7->main::@1#2] -- register_copy
jmp __b1 jmp __b1
// main::@5
__b5:
// [12] main::cursor#2 = main::line#3 + $50 -- pbuz1=pbuz2_plus_vbuc1
lda #$50
clc
adc.z line
sta.z cursor
lda #0
adc.z line+1
sta.z cursor+1
// [13] main::line#12 = main::cursor#2 -- pbuz1=pbuz2
lda.z cursor
sta.z line
lda.z cursor+1
sta.z line+1
jmp __b7_from___b5
// main::@4 // main::@4
__b4: __b4:
// [11] main::cursor#1 = main::line#2 + $28 -- pbuz1=pbuz2_plus_vbuc1 // [14] main::cursor#1 = main::line#3 + $28 -- pbuz1=pbuz2_plus_vbuc1
lda #$28 lda #$28
clc clc
adc.z line adc.z line
@ -357,69 +419,76 @@ main: {
lda #0 lda #0
adc.z line+1 adc.z line+1
sta.z cursor+1 sta.z cursor+1
// [12] main::line#8 = main::cursor#1 -- pbuz1=pbuz2 // [15] main::line#11 = main::cursor#1 -- pbuz1=pbuz2
lda.z cursor lda.z cursor
sta.z line sta.z line
lda.z cursor+1 lda.z cursor+1
sta.z line+1 sta.z line+1
jmp __b6_from___b4 jmp __b7_from___b4
} }
// File Data // File Data
.segment Data .segment Data
MESSAGE: .text @"hello\nworld" MESSAGE: .text @"hello\nworld\\again"
.byte 0 .byte 0
ASSEMBLER OPTIMIZATIONS ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1 Removing instruction jmp __b1
Removing instruction jmp __b3 Removing instruction jmp __b3
Removing instruction jmp __breturn Removing instruction jmp __breturn
Removing instruction jmp __b5 Removing instruction jmp __b8
Removing instruction jmp __b6 Removing instruction jmp __b6
Removing instruction jmp __b7
Succesful ASM optimization Pass5NextJumpElimination Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #0 Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b6_from___b4 with __b6 Replacing label __b7_from___b5 with __b7
Removing instruction __b6_from___b4: Replacing label __b7_from___b4 with __b7
Removing instruction __b6_from___b5: Removing instruction __b7_from___b4:
Removing instruction __b7_from___b5:
Removing instruction __b7_from___b6:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main: Removing instruction __b1_from_main:
Removing instruction __b3: Removing instruction __b3:
Removing instruction __breturn: Removing instruction __breturn:
Removing instruction __b5: Removing instruction __b8:
Removing instruction __b1_from___b6: Removing instruction __b6:
Removing instruction __b1_from___b7:
Succesful ASM optimization Pass5UnusedLabelElimination Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction ldy #0 Removing instruction ldy #0
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination Succesful ASM optimization Pass5UnnecesaryLoadElimination
FINAL SYMBOL TABLE FINAL SYMBOL TABLE
constant byte CH = ' constant byte CH = '
'pm 'pm
constant byte* MESSAGE[] = "hello constant byte* MESSAGE[] = "hello
world"pm world\again"pm
constant byte* SCREEN = (byte*) 1024 constant byte* SCREEN = (byte*) 1024
void main() void main()
byte~ main::$0 reg byte a 22.0 byte~ main::$0 reg byte a 22.0
byte* main::cursor byte* main::cursor
byte* main::cursor#1 cursor zp[2]:6 16.5 byte* main::cursor#1 cursor zp[2]:6 16.5
byte* main::cursor#2 cursor zp[2]:6 22.0 byte* main::cursor#2 cursor zp[2]:6 16.5
byte* main::cursor#3 cursor zp[2]:6 6.6000000000000005 byte* main::cursor#3 cursor zp[2]:6 22.0
byte* main::cursor#6 cursor zp[2]:6 16.5 byte* main::cursor#4 cursor zp[2]:6 5.5
byte* main::cursor#8 cursor zp[2]:6 22.0
byte* main::line byte* main::line
byte* main::line#2 line zp[2]:4 5.5 byte* main::line#11 line zp[2]:4 22.0
byte* main::line#5 line zp[2]:4 16.5 byte* main::line#12 line zp[2]:4 22.0
byte* main::line#3 line zp[2]:4 6.285714285714286
byte* main::line#8 line zp[2]:4 22.0 byte* main::line#8 line zp[2]:4 22.0
byte* main::msg byte* main::msg
byte* main::msg#1 msg zp[2]:2 22.0 byte* main::msg#1 msg zp[2]:2 22.0
byte* main::msg#2 msg zp[2]:2 6.111111111111112 byte* main::msg#2 msg zp[2]:2 5.5
zp[2]:2 [ main::msg#2 main::msg#1 ] zp[2]:2 [ main::msg#2 main::msg#1 ]
zp[2]:4 [ main::line#2 main::line#5 main::line#8 ] zp[2]:4 [ main::line#3 main::line#8 main::line#11 main::line#12 ]
zp[2]:6 [ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] zp[2]:6 [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ]
reg byte a [ main::$0 ] reg byte a [ main::$0 ]
FINAL ASSEMBLER FINAL ASSEMBLER
Score: 1297 Score: 1727
// File Comments // File Comments
// Test using some simple supported string escape \n in both string and char // Test using some simple supported string escape \n in both string and char
@ -444,12 +513,12 @@ main: {
.label msg = 2 .label msg = 2
.label line = 4 .label line = 4
// [1] phi from main to main::@1 [phi:main->main::@1] // [1] phi from main to main::@1 [phi:main->main::@1]
// [1] phi main::cursor#3 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 // [1] phi main::cursor#4 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<$400 lda #<$400
sta.z cursor sta.z cursor
lda #>$400 lda #>$400
sta.z cursor+1 sta.z cursor+1
// [1] phi main::line#2 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 // [1] phi main::line#3 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1
lda #<$400 lda #<$400
sta.z line sta.z line
lda #>$400 lda #>$400
@ -468,10 +537,10 @@ main: {
cmp #0 cmp #0
bne __b2 bne __b2
// main::@3 // main::@3
// SCREEN[0x50] = CH // SCREEN[0xa0] = CH
// [3] *(SCREEN+$50) = CH -- _deref_pbuc1=vbuc2 // [3] *(SCREEN+$a0) = CH -- _deref_pbuc1=vbuc2
lda #CH lda #CH
sta SCREEN+$50 sta SCREEN+$a0
// main::@return // main::@return
// } // }
// [4] return // [4] return
@ -487,40 +556,66 @@ main: {
ldy #0 ldy #0
cmp (msg),y cmp (msg),y
beq __b4 beq __b4
// main::@5 // main::@8
// case '\\':
// line += 0x50;
// cursor = line;
// break;
// [6] if(*main::msg#2=='\'pm) goto main::@5 -- _deref_pbuz1_eq_vbuc1_then_la1
lda #'\\'
cmp (msg),y
beq __b5
// main::@6
// *msg & 0x3f // *msg & 0x3f
// [6] main::$0 = *main::msg#2 & $3f -- vbuaa=_deref_pbuz1_band_vbuc1 // [7] main::$0 = *main::msg#2 & $3f -- vbuaa=_deref_pbuz1_band_vbuc1
lda #$3f lda #$3f
and (msg),y and (msg),y
// *cursor++ = *msg & 0x3f // *cursor++ = *msg & 0x3f
// [7] *main::cursor#3 = main::$0 -- _deref_pbuz1=vbuaa // [8] *main::cursor#4 = main::$0 -- _deref_pbuz1=vbuaa
sta (cursor),y sta (cursor),y
// *cursor++ = *msg & 0x3f; // *cursor++ = *msg & 0x3f;
// [8] main::cursor#2 = ++ main::cursor#3 -- pbuz1=_inc_pbuz1 // [9] main::cursor#3 = ++ main::cursor#4 -- pbuz1=_inc_pbuz1
inc.z cursor inc.z cursor
bne !+ bne !+
inc.z cursor+1 inc.z cursor+1
!: !:
// [9] phi from main::@4 main::@5 to main::@6 [phi:main::@4/main::@5->main::@6] // [10] phi from main::@4 main::@5 main::@6 to main::@7 [phi:main::@4/main::@5/main::@6->main::@7]
// [9] phi main::cursor#6 = main::cursor#1 [phi:main::@4/main::@5->main::@6#0] -- register_copy // [10] phi main::cursor#8 = main::cursor#1 [phi:main::@4/main::@5/main::@6->main::@7#0] -- register_copy
// [9] phi main::line#5 = main::line#8 [phi:main::@4/main::@5->main::@6#1] -- register_copy // [10] phi main::line#8 = main::line#11 [phi:main::@4/main::@5/main::@6->main::@7#1] -- register_copy
// main::@6 // main::@7
__b6: __b7:
// msg++; // msg++;
// [10] main::msg#1 = ++ main::msg#2 -- pbuz1=_inc_pbuz1 // [11] main::msg#1 = ++ main::msg#2 -- pbuz1=_inc_pbuz1
inc.z msg inc.z msg
bne !+ bne !+
inc.z msg+1 inc.z msg+1
!: !:
// [1] phi from main::@6 to main::@1 [phi:main::@6->main::@1] // [1] phi from main::@7 to main::@1 [phi:main::@7->main::@1]
// [1] phi main::cursor#3 = main::cursor#6 [phi:main::@6->main::@1#0] -- register_copy // [1] phi main::cursor#4 = main::cursor#8 [phi:main::@7->main::@1#0] -- register_copy
// [1] phi main::line#2 = main::line#5 [phi:main::@6->main::@1#1] -- register_copy // [1] phi main::line#3 = main::line#8 [phi:main::@7->main::@1#1] -- register_copy
// [1] phi main::msg#2 = main::msg#1 [phi:main::@6->main::@1#2] -- register_copy // [1] phi main::msg#2 = main::msg#1 [phi:main::@7->main::@1#2] -- register_copy
jmp __b1 jmp __b1
// main::@5
__b5:
// line += 0x50
// [12] main::cursor#2 = main::line#3 + $50 -- pbuz1=pbuz2_plus_vbuc1
lda #$50
clc
adc.z line
sta.z cursor
lda #0
adc.z line+1
sta.z cursor+1
// [13] main::line#12 = main::cursor#2 -- pbuz1=pbuz2
lda.z cursor
sta.z line
lda.z cursor+1
sta.z line+1
jmp __b7
// main::@4 // main::@4
__b4: __b4:
// line += 0x28 // line += 0x28
// [11] main::cursor#1 = main::line#2 + $28 -- pbuz1=pbuz2_plus_vbuc1 // [14] main::cursor#1 = main::line#3 + $28 -- pbuz1=pbuz2_plus_vbuc1
lda #$28 lda #$28
clc clc
adc.z line adc.z line
@ -528,15 +623,15 @@ main: {
lda #0 lda #0
adc.z line+1 adc.z line+1
sta.z cursor+1 sta.z cursor+1
// [12] main::line#8 = main::cursor#1 -- pbuz1=pbuz2 // [15] main::line#11 = main::cursor#1 -- pbuz1=pbuz2
lda.z cursor lda.z cursor
sta.z line sta.z line
lda.z cursor+1 lda.z cursor+1
sta.z line+1 sta.z line+1
jmp __b6 jmp __b7
} }
// File Data // File Data
.segment Data .segment Data
MESSAGE: .text @"hello\nworld" MESSAGE: .text @"hello\nworld\\again"
.byte 0 .byte 0

View File

@ -1,24 +1,26 @@
constant byte CH = ' constant byte CH = '
'pm 'pm
constant byte* MESSAGE[] = "hello constant byte* MESSAGE[] = "hello
world"pm world\again"pm
constant byte* SCREEN = (byte*) 1024 constant byte* SCREEN = (byte*) 1024
void main() void main()
byte~ main::$0 reg byte a 22.0 byte~ main::$0 reg byte a 22.0
byte* main::cursor byte* main::cursor
byte* main::cursor#1 cursor zp[2]:6 16.5 byte* main::cursor#1 cursor zp[2]:6 16.5
byte* main::cursor#2 cursor zp[2]:6 22.0 byte* main::cursor#2 cursor zp[2]:6 16.5
byte* main::cursor#3 cursor zp[2]:6 6.6000000000000005 byte* main::cursor#3 cursor zp[2]:6 22.0
byte* main::cursor#6 cursor zp[2]:6 16.5 byte* main::cursor#4 cursor zp[2]:6 5.5
byte* main::cursor#8 cursor zp[2]:6 22.0
byte* main::line byte* main::line
byte* main::line#2 line zp[2]:4 5.5 byte* main::line#11 line zp[2]:4 22.0
byte* main::line#5 line zp[2]:4 16.5 byte* main::line#12 line zp[2]:4 22.0
byte* main::line#3 line zp[2]:4 6.285714285714286
byte* main::line#8 line zp[2]:4 22.0 byte* main::line#8 line zp[2]:4 22.0
byte* main::msg byte* main::msg
byte* main::msg#1 msg zp[2]:2 22.0 byte* main::msg#1 msg zp[2]:2 22.0
byte* main::msg#2 msg zp[2]:2 6.111111111111112 byte* main::msg#2 msg zp[2]:2 5.5
zp[2]:2 [ main::msg#2 main::msg#1 ] zp[2]:2 [ main::msg#2 main::msg#1 ]
zp[2]:4 [ main::line#2 main::line#5 main::line#8 ] zp[2]:4 [ main::line#3 main::line#8 main::line#11 main::line#12 ]
zp[2]:6 [ main::cursor#3 main::cursor#6 main::cursor#1 main::cursor#2 ] zp[2]:6 [ main::cursor#4 main::cursor#8 main::cursor#1 main::cursor#2 main::cursor#3 ]
reg byte a [ main::$0 ] reg byte a [ main::$0 ]