Fixed the assembler weirdness.

git-svn-id: http://www.cdkersey.com/harp/harptool@116 0246edb2-e076-4747-b392-db732a341fa2
This commit is contained in:
chad 2013-01-17 09:35:23 +00:00
parent 4428bcd1b7
commit afe15f4ff1
11 changed files with 355 additions and 380 deletions

View file

@ -1 +1,2 @@
_ Large expanses of space intentionally
_ The BYTE directive was not updated when the word directive was; inconsistent
behavior.

View file

@ -1,10 +1,11 @@
namespace HarpTools {
enum AsmTokens {
ASM_T_DIR_DEF = 1, ASM_T_DIR_PERM, ASM_T_DIR_BYTE, ASM_T_DIR_WORD,
ASM_T_DIR_STRING, ASM_T_DIR_ALIGN, ASM_T_DIR_ENTRY, ASM_T_DIR_GLOBAL,
ASM_T_DIR_ARG_NUM, ASM_T_DIR_ARG_STRING, ASM_T_DIR_ARG_SYM,
ASM_T_DIR_ARG_R, ASM_T_DIR_ARG_W, ASM_T_DIR_ARG_X, ASM_T_DIR_END,
ASM_T_LABEL, ASM_T_PRED, ASM_T_INST, ASM_T_PREG, ASM_T_REG, ASM_T_LIT,
ASM_T_SYM, ASM_T_PEXP
ASM_T_DIR_DEF = 1, ASM_T_DIR_PERM, ASM_T_DIR_BYTE, ASM_T_DIR_WORD,
ASM_T_DIR_SPACE, ASM_T_DIR_STRING, ASM_T_DIR_ALIGN, ASM_T_DIR_ENTRY,
ASM_T_DIR_GLOBAL, ASM_T_DIR_ARG_NUM, ASM_T_DIR_ARG_STRING,
ASM_T_DIR_ARG_SYM, ASM_T_DIR_ARG_R, ASM_T_DIR_ARG_W, ASM_T_DIR_ARG_X,
ASM_T_DIR_END, ASM_T_LABEL, ASM_T_PRED, ASM_T_INST,
ASM_T_PREG, ASM_T_REG, ASM_T_LIT, ASM_T_SYM,
ASM_T_PEXP
};
};

View file

@ -107,7 +107,7 @@ ostream &Harp::operator<<(ostream& os, Instruction &inst) {
}
void Instruction::executeOn(Core &c) {
D(1, "Begin instruction execute.");
D(3, "Begin instruction execute.");
/* If I try to execute a privileged instruction in user mode, throw an
exception 3. */

View file

@ -341,33 +341,33 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[222] =
static yyconst flex_int16_t yy_accept[224] =
{ 0,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 21, 21, 39, 39, 42, 40,
39, 14, 40, 40, 40, 13, 40, 12, 26, 40,
40, 25, 25, 24, 30, 40, 27, 28, 29, 33,
40, 40, 32, 32, 31, 41, 40, 34, 37, 40,
40, 36, 36, 38, 40, 21, 23, 40, 40, 40,
40, 22, 40, 19, 15, 39, 14, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 12, 11, 26,
25, 25, 25, 0, 25, 24, 30, 33, 32, 32,
32, 0, 32, 31, 0, 35, 0, 34, 37, 36,
39, 39, 39, 39, 22, 22, 39, 39, 42, 40,
39, 15, 40, 40, 40, 14, 40, 13, 27, 40,
40, 26, 26, 25, 31, 40, 28, 29, 30, 33,
40, 40, 32, 32, 41, 40, 34, 37, 40, 40,
36, 36, 38, 40, 22, 24, 40, 40, 40, 40,
23, 40, 20, 16, 39, 15, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 13, 12, 27, 26,
26, 26, 0, 26, 25, 31, 33, 32, 32, 32,
0, 32, 0, 35, 0, 34, 37, 36, 36, 36,
36, 36, 0, 36, 38, 21, 23, 0, 18, 18,
0, 0, 0, 0, 20, 0, 0, 0, 0, 0,
0, 0, 19, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 25, 32,
35, 36, 18, 18, 18, 0, 18, 0, 17, 17,
0, 0, 0, 0, 0, 0, 0, 0, 0, 16,
16, 0, 0, 2, 0, 0, 0, 0, 0, 1,
0, 0, 10, 0, 0, 18, 17, 17, 17, 0,
17, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 16, 16, 0, 16, 0, 4, 0, 0,
0, 36, 38, 22, 24, 0, 19, 19, 0, 0,
0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 26, 32, 35,
36, 19, 19, 19, 0, 19, 0, 18, 18, 0,
0, 0, 0, 0, 0, 0, 0, 0, 17, 17,
0, 0, 2, 0, 0, 0, 0, 0, 0, 1,
0, 0, 11, 0, 0, 19, 18, 18, 18, 0,
18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 17, 0, 17, 0, 4, 0, 0,
3, 0, 5, 0, 17, 0, 0, 0, 0, 0,
0, 16, 7, 8, 0, 0, 0, 0, 9, 6,
0
3, 0, 0, 5, 0, 18, 0, 0, 0, 0,
0, 0, 17, 8, 9, 0, 6, 0, 0, 0,
10, 7, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@ -411,67 +411,67 @@ static yyconst flex_int32_t yy_meta[48] =
4, 4, 4, 4, 4, 4, 1
} ;
static yyconst flex_int16_t yy_base[237] =
static yyconst flex_int16_t yy_base[238] =
{ 0,
0, 0, 47, 0, 93, 98, 143, 0, 190, 0,
236, 253, 101, 104, 271, 0, 96, 108, 696, 702,
691, 702, 683, 291, 672, 702, 633, 653, 702, 668,
101, 309, 104, 0, 702, 666, 702, 702, 702, 702,
665, 108, 311, 111, 0, 702, 236, 0, 702, 664,
113, 319, 115, 702, 663, 663, 702, 661, 246, 622,
363, 702, 622, 0, 702, 659, 702, 624, 613, 626,
619, 619, 622, 607, 609, 240, 326, 621, 702, 702,
324, 118, 123, 0, 228, 0, 702, 702, 331, 328,
333, 0, 335, 0, 242, 702, 329, 0, 702, 341,
0, 0, 47, 0, 93, 98, 142, 159, 177, 0,
223, 240, 101, 104, 258, 0, 96, 108, 647, 688,
644, 688, 642, 278, 633, 688, 603, 622, 688, 637,
101, 104, 108, 0, 688, 636, 688, 688, 688, 688,
620, 111, 123, 113, 688, 127, 0, 688, 611, 118,
296, 130, 688, 609, 605, 688, 598, 152, 552, 340,
688, 538, 0, 688, 574, 688, 538, 512, 523, 510,
507, 504, 73, 494, 225, 233, 509, 688, 688, 298,
133, 213, 0, 215, 0, 688, 688, 308, 231, 306,
0, 310, 229, 688, 303, 0, 688, 314, 316, 318,
343, 345, 0, 349, 702, 628, 702, 365, 409, 415,
401, 0, 0, 0, 0, 0, 403, 406, 607, 603,
453, 422, 0, 585, 575, 560, 542, 527, 512, 508,
501, 427, 438, 440, 486, 428, 499, 435, 0, 0,
342, 0, 319, 702, 501, 0, 507, 439, 513, 521,
459, 455, 542, 490, 488, 495, 493, 0, 511, 534,
544, 445, 434, 702, 418, 421, 388, 381, 383, 702,
355, 563, 702, 0, 565, 530, 535, 702, 574, 0,
582, 551, 560, 572, 580, 0, 586, 588, 0, 590,
592, 543, 702, 609, 0, 619, 374, 702, 343, 359,
0, 320, 688, 518, 688, 322, 386, 392, 378, 0,
0, 0, 0, 0, 346, 327, 496, 489, 430, 399,
0, 474, 463, 471, 447, 447, 394, 402, 386, 366,
397, 411, 415, 377, 380, 476, 478, 0, 0, 397,
0, 423, 688, 485, 0, 495, 403, 505, 514, 411,
416, 534, 436, 432, 465, 467, 0, 471, 524, 536,
355, 334, 688, 319, 326, 309, 300, 286, 288, 688,
422, 512, 688, 0, 522, 555, 557, 688, 569, 0,
577, 474, 529, 543, 555, 0, 563, 566, 0, 574,
581, 583, 688, 598, 0, 604, 279, 688, 265, 225,
702, 292, 702, 445, 599, 596, 598, 606, 616, 625,
627, 636, 702, 702, 288, 232, 629, 635, 702, 702,
702, 674, 677, 680, 683, 687, 690, 693, 697, 259,
257, 247, 240, 121, 114, 111
688, 214, 200, 688, 477, 600, 587, 592, 608, 610,
612, 616, 629, 688, 688, 138, 688, 138, 618, 620,
688, 688, 688, 663, 666, 669, 673, 676, 679, 683,
165, 163, 155, 153, 150, 131, 121
} ;
static yyconst flex_int16_t yy_def[237] =
static yyconst flex_int16_t yy_def[238] =
{ 0,
221, 1, 221, 3, 222, 222, 221, 7, 221, 9,
222, 222, 222, 222, 221, 15, 222, 222, 221, 221,
221, 221, 221, 221, 221, 221, 221, 223, 221, 221,
221, 221, 221, 224, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 225, 221, 226, 227, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 228, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 229, 221, 223, 221, 221,
221, 221, 221, 230, 221, 224, 221, 221, 221, 221,
221, 231, 221, 225, 226, 221, 226, 227, 221, 221,
223, 1, 223, 3, 224, 224, 224, 224, 223, 9,
224, 224, 224, 224, 223, 15, 224, 224, 223, 223,
223, 223, 223, 223, 223, 223, 223, 225, 223, 223,
223, 223, 223, 226, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223, 227, 228, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 229, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 230, 223, 225, 223, 223, 223,
223, 223, 231, 223, 226, 223, 223, 223, 223, 223,
232, 223, 227, 223, 227, 228, 223, 223, 223, 223,
221, 221, 232, 221, 221, 221, 221, 221, 221, 221,
221, 61, 61, 61, 61, 61, 61, 61, 221, 221,
221, 221, 228, 221, 221, 221, 221, 221, 221, 221,
221, 229, 229, 229, 229, 221, 221, 221, 230, 231,
226, 232, 221, 221, 221, 233, 221, 221, 221, 221,
61, 61, 121, 61, 61, 121, 121, 121, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 234, 221, 233, 221, 221, 221, 235,
221, 61, 61, 153, 153, 153, 121, 121, 153, 121,
121, 221, 221, 221, 236, 221, 221, 221, 221, 221,
233, 223, 223, 223, 223, 223, 223, 223, 223, 60,
60, 60, 60, 60, 60, 60, 223, 223, 223, 223,
229, 223, 223, 223, 223, 223, 223, 223, 223, 223,
230, 230, 230, 230, 223, 223, 223, 231, 232, 227,
233, 223, 223, 223, 234, 223, 223, 223, 223, 60,
60, 119, 60, 60, 119, 119, 119, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 235, 223, 234, 223, 223, 223, 236,
223, 60, 60, 152, 152, 152, 119, 119, 152, 119,
119, 223, 223, 223, 237, 223, 223, 223, 223, 223,
221, 221, 221, 234, 235, 153, 153, 153, 153, 121,
121, 236, 221, 221, 221, 221, 153, 153, 221, 221,
0, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221
223, 223, 223, 223, 235, 236, 152, 152, 152, 152,
119, 119, 237, 223, 223, 223, 223, 223, 152, 152,
223, 223, 0, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223
} ;
static yyconst flex_int16_t yy_nxt[750] =
static yyconst flex_int16_t yy_nxt[736] =
{ 0,
20, 21, 22, 23, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 24, 25, 20, 20, 20, 26,
@ -482,82 +482,81 @@ static yyconst flex_int16_t yy_nxt[750] =
31, 20, 25, 32, 33, 20, 20, 20, 20, 20,
20, 34, 20, 20, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 20, 21, 35, 36, 21, 46, 21,
34, 34, 34, 20, 21, 35, 36, 21, 45, 21,
35, 36, 21, 54, 55, 21, 54, 55, 25, 21,
46, 25, 212, 25, 65, 205, 25, 81, 82, 25,
85, 85, 204, 25, 89, 90, 65, 93, 93, 100,
101, 104, 104, 37, 85, 85, 38, 39, 37, 83,
83, 38, 39, 20, 21, 40, 41, 20, 20, 20,
20, 20, 20, 20, 42, 20, 42, 20, 25, 43,
44, 20, 20, 20, 20, 20, 20, 45, 20, 20,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 20,
20, 21, 46, 20, 47, 20, 20, 20, 20, 20,
35, 36, 21, 53, 54, 21, 53, 54, 25, 21,
45, 25, 128, 25, 64, 129, 25, 80, 81, 25,
82, 82, 213, 25, 84, 84, 64, 88, 89, 92,
92, 94, 206, 37, 98, 99, 38, 39, 37, 90,
90, 38, 39, 21, 40, 41, 102, 102, 83, 84,
84, 205, 95, 42, 176, 42, 141, 25, 43, 44,
21, 40, 41, 106, 139, 106, 138, 91, 107, 108,
42, 222, 42, 221, 25, 43, 44, 20, 21, 45,
20, 46, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 25, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 25, 20, 20, 20, 20,
20, 20, 20, 20, 48, 20, 20, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 20, 21, 49, 50,
96, 176, 133, 134, 85, 85, 96, 51, 142, 51,
135, 25, 52, 53, 21, 49, 50, 108, 140, 108,
139, 97, 109, 110, 51, 220, 51, 97, 25, 52,
53, 20, 56, 57, 58, 20, 59, 60, 20, 61,
20, 20, 20, 20, 20, 20, 25, 20, 20, 20,
62, 20, 20, 20, 63, 64, 20, 20, 64, 64,
20, 47, 20, 20, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 20, 21, 48, 49, 132, 133, 82,
82, 84, 84, 94, 50, 134, 50, 218, 25, 51,
52, 21, 48, 49, 135, 217, 135, 92, 92, 136,
137, 50, 216, 50, 95, 25, 51, 52, 20, 55,
56, 57, 20, 58, 59, 20, 60, 20, 20, 20,
20, 20, 20, 25, 20, 20, 20, 61, 20, 20,
20, 62, 63, 20, 20, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 20, 68, 69,
143, 70, 71, 219, 72, 83, 83, 91, 91, 216,
73, 144, 74, 141, 75, 102, 102, 136, 144, 136,
83, 83, 137, 138, 93, 93, 96, 91, 91, 91,
91, 93, 93, 84, 97, 92, 171, 102, 102, 104,
104, 102, 102, 103, 112, 104, 104, 97, 84, 113,
113, 114, 115, 113, 116, 92, 116, 173, 113, 117,
118, 109, 110, 119, 120, 103, 215, 121, 214, 113,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
63, 63, 63, 63, 20, 67, 68, 140, 69, 70,
215, 71, 100, 100, 82, 82, 214, 72, 204, 73,
203, 74, 90, 90, 90, 90, 92, 92, 95, 202,
100, 100, 102, 102, 100, 100, 102, 102, 107, 108,
101, 110, 83, 153, 154, 201, 111, 111, 112, 113,
111, 114, 91, 114, 200, 111, 115, 116, 101, 199,
117, 118, 150, 151, 119, 198, 111, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 119, 119, 119, 111, 142, 197, 147,
152, 147, 170, 142, 148, 149, 136, 137, 143, 132,
121, 121, 121, 121, 121, 121, 121, 121, 121, 113,
143, 213, 148, 203, 148, 202, 143, 149, 150, 151,
152, 144, 154, 155, 201, 145, 145, 144, 144, 133,
134, 147, 147, 159, 144, 159, 171, 135, 160, 161,
133, 134, 133, 134, 137, 138, 171, 153, 135, 200,
135, 175, 175, 146, 112, 149, 150, 173, 199, 113,
113, 114, 115, 113, 116, 198, 116, 173, 113, 156,
157, 182, 183, 119, 120, 151, 152, 158, 197, 113,
158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
158, 158, 158, 158, 158, 158, 158, 158, 158, 113,
133, 94, 144, 144, 143, 143, 169, 134, 146, 146,
158, 143, 158, 132, 133, 159, 160, 132, 133, 148,
149, 134, 95, 171, 142, 134, 168, 150, 151, 167,
145, 110, 182, 183, 166, 143, 111, 111, 112, 113,
111, 114, 143, 114, 173, 111, 155, 156, 153, 154,
117, 118, 182, 183, 157, 152, 111, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 111, 171, 171, 171,
152, 187, 188, 190, 191, 165, 142, 159, 160, 164,
182, 183, 172, 172, 175, 175, 142, 143, 173, 173,
171, 170, 143, 153, 154, 155, 182, 183, 143, 190,
191, 187, 188, 144, 177, 172, 172, 145, 145, 144,
144, 173, 177, 147, 147, 178, 144, 160, 161, 179,
179, 143, 178, 178, 153, 192, 177, 181, 181, 189,
178, 169, 144, 174, 192, 192, 193, 178, 168, 144,
194, 194, 167, 193, 178, 193, 193, 180, 184, 185,
196, 196, 193, 193, 171, 166, 171, 182, 183, 186,
186, 186, 186, 186, 186, 177, 182, 183, 195, 172,
172, 175, 175, 177, 165, 173, 178, 173, 206, 207,
179, 179, 164, 178, 178, 153, 208, 209, 181, 181,
173, 144, 144, 163, 143, 162, 177, 143, 161, 189,
111, 146, 146, 171, 143, 177, 111, 178, 152, 104,
174, 179, 179, 171, 178, 192, 178, 78, 172, 172,
181, 181, 130, 178, 173, 127, 193, 192, 175, 175,
194, 194, 126, 193, 173, 182, 183, 125, 193, 180,
184, 185, 196, 196, 124, 193, 142, 123, 177, 207,
208, 186, 186, 186, 186, 186, 186, 143, 195, 178,
177, 209, 210, 122, 143, 65, 178, 120, 177, 187,
188, 178, 211, 212, 192, 179, 179, 189, 178, 178,
211, 212, 109, 181, 181, 193, 178, 190, 191, 192,
177, 178, 187, 188, 210, 211, 210, 211, 190, 191,
192, 178, 206, 207, 217, 218, 189, 163, 178, 162,
192, 193, 217, 218, 113, 194, 194, 113, 193, 106,
189, 193, 208, 209, 189, 196, 196, 192, 193, 79,
189, 210, 211, 210, 211, 217, 218, 131, 193, 130,
189, 217, 218, 129, 128, 193, 127, 126, 125, 124,
66, 122, 111, 107, 106, 105, 99, 88, 87, 189,
80, 79, 77, 189, 20, 20, 20, 20, 78, 78,
78, 86, 76, 86, 94, 67, 94, 95, 95, 95,
95, 98, 66, 98, 123, 221, 123, 132, 132, 132,
105, 177, 193, 207, 208, 192, 104, 189, 219, 220,
193, 103, 178, 97, 194, 194, 193, 193, 189, 178,
196, 196, 87, 193, 219, 220, 209, 210, 211, 212,
192, 189, 211, 212, 219, 220, 219, 220, 86, 79,
78, 193, 76, 75, 66, 65, 223, 223, 193, 223,
223, 223, 189, 223, 223, 223, 189, 223, 223, 223,
223, 223, 189, 20, 20, 20, 20, 77, 77, 77,
85, 223, 85, 93, 93, 93, 93, 96, 223, 96,
121, 223, 121, 131, 131, 131, 131, 19, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
132, 19, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223
} ;
static yyconst flex_int16_t yy_chk[750] =
static yyconst flex_int16_t yy_chk[736] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -571,76 +570,75 @@ static yyconst flex_int16_t yy_chk[750] =
3, 3, 3, 3, 5, 5, 5, 17, 17, 6,
6, 6, 13, 13, 13, 14, 14, 14, 5, 18,
18, 17, 236, 6, 17, 235, 13, 31, 31, 14,
33, 33, 234, 18, 42, 42, 18, 44, 44, 51,
51, 53, 53, 5, 82, 82, 5, 5, 6, 83,
83, 6, 6, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
18, 17, 73, 6, 17, 73, 13, 31, 31, 14,
32, 32, 237, 18, 33, 33, 18, 42, 42, 44,
44, 46, 236, 5, 50, 50, 5, 5, 6, 43,
43, 6, 6, 7, 7, 7, 52, 52, 32, 81,
81, 235, 46, 7, 234, 7, 233, 7, 7, 7,
8, 8, 8, 58, 232, 58, 231, 43, 58, 58,
8, 218, 8, 216, 8, 8, 8, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 11, 11, 11,
47, 233, 76, 76, 85, 85, 95, 11, 232, 11,
76, 11, 11, 11, 12, 12, 12, 59, 231, 59,
230, 47, 59, 59, 12, 216, 12, 95, 12, 12,
12, 15, 15, 15, 15, 15, 15, 15, 15, 15,
9, 9, 9, 9, 11, 11, 11, 75, 75, 82,
82, 84, 84, 93, 11, 75, 11, 203, 11, 11,
11, 12, 12, 12, 76, 202, 76, 89, 89, 76,
76, 12, 200, 12, 93, 12, 12, 12, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 24, 24,
143, 24, 24, 215, 24, 32, 32, 43, 43, 202,
24, 143, 24, 97, 24, 52, 52, 77, 143, 77,
81, 81, 77, 77, 90, 90, 141, 89, 89, 91,
91, 93, 93, 32, 97, 43, 171, 100, 100, 101,
101, 102, 102, 52, 61, 104, 104, 141, 81, 61,
61, 61, 61, 61, 61, 89, 61, 171, 61, 61,
61, 108, 108, 61, 61, 100, 200, 61, 199, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
15, 15, 15, 15, 15, 24, 24, 95, 24, 24,
199, 24, 51, 51, 80, 80, 197, 24, 169, 24,
168, 24, 90, 90, 88, 88, 92, 92, 95, 167,
98, 98, 99, 99, 100, 100, 102, 102, 106, 106,
51, 60, 80, 116, 116, 166, 60, 60, 60, 60,
60, 60, 88, 60, 165, 60, 60, 60, 98, 164,
60, 60, 115, 115, 60, 162, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 107, 161, 109,
115, 109, 134, 108, 109, 109, 135, 135, 107, 131,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
109, 197, 111, 169, 111, 168, 110, 111, 111, 117,
117, 109, 118, 118, 167, 109, 109, 110, 109, 132,
132, 110, 110, 122, 110, 122, 138, 132, 122, 122,
133, 133, 134, 134, 136, 136, 204, 117, 133, 166,
134, 138, 138, 109, 121, 148, 148, 138, 165, 121,
121, 121, 121, 121, 121, 163, 121, 204, 121, 121,
121, 152, 152, 121, 121, 151, 151, 121, 162, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
131, 140, 107, 107, 108, 107, 130, 131, 108, 108,
120, 108, 120, 132, 132, 120, 120, 133, 133, 147,
147, 132, 140, 171, 142, 133, 129, 150, 150, 128,
107, 119, 151, 151, 127, 142, 119, 119, 119, 119,
119, 119, 142, 119, 171, 119, 119, 119, 154, 154,
119, 119, 153, 153, 119, 150, 119, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 136, 205, 137,
153, 155, 155, 156, 156, 126, 144, 158, 158, 125,
182, 182, 136, 136, 137, 137, 146, 144, 136, 205,
137, 135, 145, 151, 155, 155, 154, 154, 147, 157,
157, 156, 156, 145, 149, 137, 137, 145, 145, 147,
145, 137, 150, 147, 147, 149, 147, 159, 159, 149,
149, 176, 149, 150, 154, 160, 177, 150, 150, 156,
150, 131, 176, 137, 192, 161, 160, 177, 130, 176,
160, 160, 129, 160, 177, 192, 161, 149, 153, 153,
161, 161, 192, 161, 172, 128, 175, 182, 182, 153,
153, 153, 153, 153, 153, 179, 183, 183, 160, 172,
172, 175, 175, 181, 127, 172, 179, 175, 184, 184,
179, 179, 126, 179, 181, 182, 185, 185, 181, 181,
137, 144, 144, 124, 144, 123, 148, 146, 122, 155,
118, 146, 146, 172, 146, 149, 117, 148, 182, 104,
136, 148, 148, 175, 148, 159, 149, 77, 172, 172,
149, 149, 74, 149, 172, 72, 159, 160, 175, 175,
159, 159, 71, 159, 175, 183, 183, 70, 160, 148,
152, 152, 160, 160, 69, 160, 176, 68, 177, 184,
184, 152, 152, 152, 152, 152, 152, 176, 159, 177,
179, 185, 185, 67, 176, 65, 177, 62, 181, 187,
187, 179, 188, 188, 192, 179, 179, 184, 179, 181,
190, 190, 59, 181, 181, 192, 181, 191, 191, 194,
205, 181, 187, 187, 188, 188, 190, 190, 191, 191,
194, 205, 206, 206, 207, 207, 184, 125, 205, 124,
196, 194, 208, 208, 120, 194, 194, 119, 194, 106,
187, 196, 209, 209, 190, 196, 196, 212, 196, 78,
206, 210, 210, 211, 211, 217, 217, 75, 212, 74,
208, 218, 218, 73, 72, 212, 71, 70, 69, 68,
66, 63, 60, 58, 56, 55, 50, 41, 36, 210,
30, 28, 27, 217, 222, 222, 222, 222, 223, 223,
223, 224, 25, 224, 225, 23, 225, 226, 226, 226,
226, 227, 21, 227, 228, 19, 228, 229, 229, 229,
57, 206, 192, 207, 207, 196, 55, 187, 208, 208,
194, 54, 206, 49, 194, 194, 196, 194, 190, 206,
196, 196, 41, 196, 209, 209, 210, 210, 211, 211,
213, 207, 212, 212, 219, 219, 220, 220, 36, 30,
28, 213, 27, 25, 23, 21, 19, 0, 213, 0,
0, 0, 209, 0, 0, 0, 211, 0, 0, 0,
0, 0, 219, 224, 224, 224, 224, 225, 225, 225,
226, 0, 226, 227, 227, 227, 227, 228, 0, 228,
229, 0, 229, 230, 230, 230, 230, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
229, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 221, 221, 221
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 223
} ;
/* The intent behind this definition is that it'll catch
@ -684,7 +682,7 @@ using namespace HarpTools;
#line 688 "lex.yy.cc"
#line 686 "lex.yy.cc"
#define INITIAL 0
#define DEFARGS 1
@ -799,7 +797,7 @@ YY_DECL
#line 50 "scanner.lex"
#line 803 "lex.yy.cc"
#line 801 "lex.yy.cc"
if ( !(yy_init) )
{
@ -852,13 +850,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 222 )
if ( yy_current_state >= 224 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 702 );
while ( yy_base[yy_current_state] != 688 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@ -894,193 +892,192 @@ YY_RULE_SETUP
case 2:
YY_RULE_SETUP
#line 56 "scanner.lex"
{ BEGIN DEFARGS; return ASM_T_DIR_DEF; }
{ BEGIN DEFARGS; return ASM_T_DIR_DEF; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 57 "scanner.lex"
{ BEGIN PERMARGS; return ASM_T_DIR_PERM; }
{ BEGIN PERMARGS; return ASM_T_DIR_PERM; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 58 "scanner.lex"
{ BEGIN WORDARGS; return ASM_T_DIR_BYTE; }
{ BEGIN WORDARGS; return ASM_T_DIR_BYTE; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 59 "scanner.lex"
{ BEGIN WORDARGS; return ASM_T_DIR_WORD; }
{ BEGIN WORDARGS; return ASM_T_DIR_WORD; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 60 "scanner.lex"
{ BEGIN STRINGARGS; return ASM_T_DIR_STRING; }
{ BEGIN WORDARGS; return ASM_T_DIR_SPACE; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 61 "scanner.lex"
{ BEGIN ALIGNARGS; return ASM_T_DIR_ALIGN; }
{ BEGIN STRINGARGS; return ASM_T_DIR_STRING; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 62 "scanner.lex"
{ BEGIN EMPTYARGS; return ASM_T_DIR_ENTRY; }
{ BEGIN ALIGNARGS; return ASM_T_DIR_ALIGN; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 63 "scanner.lex"
{ BEGIN EMPTYARGS; return ASM_T_DIR_GLOBAL; }
{ BEGIN EMPTYARGS; return ASM_T_DIR_ENTRY; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 65 "scanner.lex"
#line 64 "scanner.lex"
{ BEGIN EMPTYARGS; return ASM_T_DIR_GLOBAL; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 66 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_PRED; }
YY_BREAK
case 11:
case 12:
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 67 "scanner.lex"
#line 68 "scanner.lex"
{ BEGIN EATCOLON;
yylval.s = std::string(YYText());
return ASM_T_LABEL; }
YY_BREAK
case 12:
case 13:
YY_RULE_SETUP
#line 70 "scanner.lex"
#line 71 "scanner.lex"
{ BEGIN INSTARGS;
yylval.s = std::string(YYText());
return ASM_T_INST; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 73 "scanner.lex"
{}
YY_BREAK
case 14:
/* rule 14 can match eol */
YY_RULE_SETUP
#line 74 "scanner.lex"
{yyline++;}
{}
YY_BREAK
case 15:
/* rule 15 can match eol */
YY_RULE_SETUP
#line 76 "scanner.lex"
{ BEGIN INITIAL; }
#line 75 "scanner.lex"
{yyline++;}
YY_BREAK
case 16:
YY_RULE_SETUP
#line 79 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_PREG; }
#line 77 "scanner.lex"
{ BEGIN INITIAL; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 81 "scanner.lex"
#line 80 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_REG; }
return ASM_T_PREG; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 83 "scanner.lex"
#line 82 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_LIT; }
return ASM_T_REG; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 85 "scanner.lex"
{ yylval.s = std::string(YYText()); return ASM_T_SYM; }
#line 84 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_LIT; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 86 "scanner.lex"
{ yylval.s = std::string(YYText()); return ASM_T_PEXP; }
{ yylval.s = std::string(YYText()); return ASM_T_SYM; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 88 "scanner.lex"
{}
#line 87 "scanner.lex"
{ yylval.s = std::string(YYText()); return ASM_T_PEXP; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 89 "scanner.lex"
{ BEGIN INITIAL; return ASM_T_DIR_END; }
{}
YY_BREAK
case 23:
/* rule 23 can match eol */
YY_RULE_SETUP
#line 90 "scanner.lex"
{ BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }
{ BEGIN INITIAL; return ASM_T_DIR_END; }
YY_BREAK
case 24:
/* rule 24 can match eol */
YY_RULE_SETUP
#line 93 "scanner.lex"
{ yylval.s = std::string(YYText());
return ASM_T_DIR_ARG_SYM; }
#line 91 "scanner.lex"
{ BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 95 "scanner.lex"
#line 94 "scanner.lex"
{ yylval.s = std::string(YYText());
return ASM_T_DIR_ARG_SYM; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 96 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_DIR_ARG_NUM; }
YY_BREAK
case 26:
/* rule 26 can match eol */
YY_RULE_SETUP
#line 97 "scanner.lex"
{ yyline++; BEGIN INITIAL; }
YY_BREAK
case 27:
/* rule 27 can match eol */
YY_RULE_SETUP
#line 100 "scanner.lex"
{ return ASM_T_DIR_ARG_R; }
#line 98 "scanner.lex"
{ yyline++; BEGIN INITIAL; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 101 "scanner.lex"
{ return ASM_T_DIR_ARG_W; }
{ return ASM_T_DIR_ARG_R; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 102 "scanner.lex"
{ return ASM_T_DIR_ARG_X; }
{ return ASM_T_DIR_ARG_W; }
YY_BREAK
case 30:
/* rule 30 can match eol */
YY_RULE_SETUP
#line 103 "scanner.lex"
{ BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }
{ return ASM_T_DIR_ARG_X; }
YY_BREAK
case 31:
/* rule 31 can match eol */
YY_RULE_SETUP
#line 106 "scanner.lex"
{ yylval.s = std::string(YYText());
return ASM_T_DIR_ARG_SYM; }
#line 104 "scanner.lex"
{ BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 108 "scanner.lex"
#line 107 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_DIR_ARG_NUM; }
YY_BREAK
case 33:
/* rule 33 can match eol */
YY_RULE_SETUP
#line 110 "scanner.lex"
#line 109 "scanner.lex"
{ BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 112 "scanner.lex"
#line 111 "scanner.lex"
{ yylval.s = std::string(YYText());
return ASM_T_DIR_ARG_SYM; }
YY_BREAK
case 35:
/* rule 35 can match eol */
YY_RULE_SETUP
#line 114 "scanner.lex"
#line 113 "scanner.lex"
{ BEGIN INITIAL;
yylval.s = std::string(YYText());
yylval.s = yylval.s.substr(1,
@ -1089,39 +1086,39 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
#line 120 "scanner.lex"
#line 119 "scanner.lex"
{ yylval.u = read_number(YYText());
return ASM_T_DIR_ARG_NUM; }
YY_BREAK
case 37:
/* rule 37 can match eol */
YY_RULE_SETUP
#line 122 "scanner.lex"
#line 121 "scanner.lex"
{ yyline++; BEGIN INITIAL; }
YY_BREAK
case 38:
/* rule 38 can match eol */
YY_RULE_SETUP
#line 125 "scanner.lex"
#line 124 "scanner.lex"
{ yyline++; BEGIN INITIAL; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 127 "scanner.lex"
#line 126 "scanner.lex"
{ /*Ignore inter-token whitespace.*/ }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 128 "scanner.lex"
#line 127 "scanner.lex"
{ std::cout << "Unexpected character on line " << std::dec << yyline << '\n';
exit(1); }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 130 "scanner.lex"
#line 129 "scanner.lex"
ECHO;
YY_BREAK
#line 1125 "lex.yy.cc"
#line 1122 "lex.yy.cc"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(DEFARGS):
case YY_STATE_EOF(PERMARGS):
@ -1510,7 +1507,7 @@ int yyFlexLexer::yy_get_next_buffer()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 222 )
if ( yy_current_state >= 224 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1538,11 +1535,11 @@ int yyFlexLexer::yy_get_next_buffer()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 222 )
if ( yy_current_state >= 224 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 221);
yy_is_jam = (yy_current_state == 223);
return yy_is_jam ? 0 : yy_current_state;
}
@ -2029,4 +2026,4 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 130 "scanner.lex"
#line 129 "scanner.lex"

View file

@ -110,7 +110,7 @@ Obj *AsmReader::read(std::istream &input) {
= Instruction::Opcode(i);
enum {
ST_INIT, ST_DEF1, ST_DEF2, ST_PERM, ST_WORD1, ST_WORD2, ST_STRING1,
ST_INIT, ST_DEF1, ST_DEF2, ST_PERM, ST_WORD1, ST_SPACE, ST_STRING1,
ST_STRING2, ST_BYTE1, ST_BYTE2, ST_ALIGN, ST_INST1, ST_INST2
} state(ST_INIT);
@ -151,6 +151,10 @@ Obj *AsmReader::read(std::istream &input) {
state = ST_WORD1;
} else { asmReaderError(yyline, "Unexpected .word"); }
break;
case ASM_T_DIR_SPACE:
if (state == ST_INIT) state = ST_SPACE;
else asmReaderError(yyline, "Unexpected .space");
break;
case ASM_T_DIR_STRING:
if (state == ST_INIT) {
state = ST_STRING1;
@ -172,20 +176,39 @@ Obj *AsmReader::read(std::istream &input) {
case ASM_T_DIR_ARG_NUM:
switch (state) {
case ST_DEF2: defs[string_arg] = yylval.u; state = ST_INIT; break;
case ST_WORD1: dc->size += (yylval.u)*wordSize;
state = ST_INIT;
break;
case ST_WORD2: if (outstate == OS_DATACHUNK) {
dc->size += wordSize;
dc->contents.resize(dc->size);
wordToBytes(&*(dc->contents.end()-wordSize),
yylval.u, wordSize);
} else {
asmReaderError(yyline, "Word not in data chunk"
"(internal error)");
}
state = ST_INIT;
break;
case ST_WORD1: {
if (outstate != OS_DATACHUNK) {
outstate = OS_DATACHUNK;
dc = new DataChunk(next_chunk_name, next_chunk_align?
next_chunk_align:wordSize,
flagsToWord(permR, permW, permX));
next_chunk_align = 0;
o->chunks.push_back(dc);
if (entry) o->entry = o->chunks.size() - 1;
if (global) dc->setGlobal();
}
dc->size += wordSize;
dc->contents.resize(dc->size);
wordToBytes(&*(dc->contents.end()-wordSize), yylval.u, wordSize);
} break;
case ST_SPACE: {
// TODO: the following statement is basically copied from above. Fix
// this.
if (outstate != OS_DATACHUNK) {
outstate = OS_DATACHUNK;
dc = new DataChunk(next_chunk_name, next_chunk_align?
next_chunk_align:wordSize,
flagsToWord(permR, permW, permX));
next_chunk_align = 0;
o->chunks.push_back(dc);
if (entry) o->entry = o->chunks.size() - 1;
if (global) dc->setGlobal();
}
size_t oldSize = dc->size;
dc->size += wordSize * yylval.u;
dc->contents.resize(dc->size);
for (size_t i = oldSize; i < dc->size; ++i) dc->contents[i] = 0;
} break;
case ST_BYTE1: dc->size += yylval.u;
state = ST_INIT;
break;
@ -235,17 +258,6 @@ Obj *AsmReader::read(std::istream &input) {
case ASM_T_DIR_ARG_SYM:
switch (state) {
case ST_DEF1: string_arg = yylval.s; state = ST_DEF2; break;
case ST_WORD1: {
state = ST_WORD2;
outstate = OS_DATACHUNK;
dc = new DataChunk(yylval.s, next_chunk_align?
next_chunk_align:wordSize,
flagsToWord(permR, permW, permX));
next_chunk_align = 0;
o->chunks.push_back(dc);
if (entry) o->entry = o->chunks.size() - 1;
if (global) dc->setGlobal();
} break;
case ST_BYTE1: {
state = ST_BYTE2;
outstate = OS_DATACHUNK;

View file

@ -53,13 +53,14 @@ endl \r?\n
for (const char *c = YYText(); *c; c++) if (*c == '\n') yyline++;
}
<INITIAL>\.def { BEGIN DEFARGS; return ASM_T_DIR_DEF; }
<INITIAL>\.perm { BEGIN PERMARGS; return ASM_T_DIR_PERM; }
<INITIAL>\.byte { BEGIN WORDARGS; return ASM_T_DIR_BYTE; }
<INITIAL>\.word { BEGIN WORDARGS; return ASM_T_DIR_WORD; }
<INITIAL>\.def { BEGIN DEFARGS; return ASM_T_DIR_DEF; }
<INITIAL>\.perm { BEGIN PERMARGS; return ASM_T_DIR_PERM; }
<INITIAL>\.byte { BEGIN WORDARGS; return ASM_T_DIR_BYTE; }
<INITIAL>\.word { BEGIN WORDARGS; return ASM_T_DIR_WORD; }
<INITIAL>\.space { BEGIN WORDARGS; return ASM_T_DIR_SPACE; }
<INITIAL>\.string { BEGIN STRINGARGS; return ASM_T_DIR_STRING; }
<INITIAL>\.align { BEGIN ALIGNARGS; return ASM_T_DIR_ALIGN; }
<INITIAL>\.entry { BEGIN EMPTYARGS; return ASM_T_DIR_ENTRY; }
<INITIAL>\.align { BEGIN ALIGNARGS; return ASM_T_DIR_ALIGN; }
<INITIAL>\.entry { BEGIN EMPTYARGS; return ASM_T_DIR_ENTRY; }
<INITIAL>\.global { BEGIN EMPTYARGS; return ASM_T_DIR_GLOBAL; }
<INITIAL>@p{num}{space}\? { yylval.u = read_number(YYText());
@ -103,8 +104,6 @@ endl \r?\n
<PERMARGS>{endl} { BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }
<WORDARGS>{sym} { yylval.s = std::string(YYText());
return ASM_T_DIR_ARG_SYM; }
<WORDARGS>{num} { yylval.u = read_number(YYText());
return ASM_T_DIR_ARG_NUM; }
<WORDARGS>{endl} { BEGIN INITIAL; yyline++; return ASM_T_DIR_END; }

View file

@ -32,20 +32,8 @@ loop: ld %r2, %r1, #0;
jmprt %r5;
.perm rw
.word Array1 -1
.word Array1_01 -2
.word Array1_02 -3
.word Array1_03 -4
.word Array1_04 -5
.word Array1_05 -6
.word Array1_06 -7
.word Array1_07 -8
Array1:
.word -1 -2 -3 -4 -5 -6 -7 -8
.word Array2 1
.word Array2_00 2
.word Array2_01 3
.word Array2_02 4
.word Array2_03 5
.word Array2_04 6
.word Array2_05 7
.word Array2_06 8
Array2:
.word 1 2 3 4 5 6 7 8

View file

@ -1,41 +0,0 @@
.perm x
.entry
boot: ldi %r5 kernEnt;
skep %r5 ;
ldi %r0 #0x1;
ldi %r1 #0x18;
ldi %r2 #0x4;
muli %r2 %r2 #0x8;
subi %r2 %r2 #0x1;
shl %r0 %r0 %r2 ;
tlbadd %r0 %r0 %r1 ;
ei ;
ldi %r5 entry;
jmpru %r5 ;
kernEnt: subi %r0 %r0 #0x8;
rtop @p0 %r0 ;
@p0 ? reti ;
ldi %r8 #0x1;
ldi %r1 #0x4;
muli %r1 %r1 #0x8;
subi %r1 %r1 #0x1;
shl %r8 %r8 %r1 ;
ld %r0 %r8 #0x0;
subi %r1 %r0 #0x71;
rtop @p0 %r1 ;
notp @p0 @p0 ;
@p0 ? halt ;
st %r0 %r8 #0x0;
ldi %r0 #0xa;
st %r0 %r8 #0x0;
reti ;
entry: ldi %r7 hello;
jali %r5 puts;
jmpi entry;
.perm rw
.word hello 0x6c6c6548
.word __anonWord0 0x41202c6f
.word __anonWord1 0x6e616c74
.word __anonWord2 0xa216174
.word __anonWord3 0x0

View file

@ -47,5 +47,4 @@ puts_l: ld %r6, %r7, #0;
puts_end: jmpr %r5
.perm rwx
.word digstack 0
.word 9
digstack: .space 10

View file

@ -84,7 +84,4 @@ loop4: ld %r1, %r0, array;
.string xstr "Exiting loop\n"
.global
.word array 0 /* Basically, 0 and 1 are pre-cleared. */
.word _0 0 /* Given a name, contents are zero. */
_arr:
.word 0xffe /* Empty space of size SIZE-2 words. */
array: .space 0x1000 /* SIZE words of space. */

22
src/test/simple.s Normal file
View file

@ -0,0 +1,22 @@
/*******************************************************************************
HARPtools by Chad D. Kersey, Summer 2011
********************************************************************************
Sample HARP assmebly program.
*******************************************************************************/
/* Simple example. */
.align 4096
.perm x
.entry
.global
entry: ldi %r7, hello
jali %r5, puts
ldi %r0, #2; /* i = 2 */
trap; /* All traps currently cause a halt. */
.perm rw /* TODO: How should I write section permissions? */
/* TODO: String literals! */
.string hello "\"Harp!\" is how a harp seal says hello!\n"