--- MiNT/src/asm.y 2018/04/24 17:56:16 1.1.1.2 +++ MiNT/src/asm.y 2018/04/24 17:57:02 1.1.1.3 @@ -1,5 +1,3 @@ -/* Infix notation calculator--calc */ - %{ @@ -148,6 +146,30 @@ operand: basic {$$ = $1; } free($1); free($3); free($5); } + | '(' '[' basic ',' basic ']' ',' basic ',' basic ')' + + { $$=postindex($3,$5,$8,$10); + + free($3); free($5); free($8); free($10); } + + | '(' '[' basic ',' basic ',' basic ']' ',' basic ')' + + { $$=preindex($3,$5,$7,$10); + + free($3); free($5); free($7); free($10); } + + | '(' '[' basic ']' ')' + + { $$=postindex0($3); + + free($3); } + + | '(' '[' basic ']' ',' basic ')' + + { $$=postindex1($3,$6); + + free($3); free($6); } + ; @@ -254,7 +276,7 @@ do_include(file) - f = fopen(file, "r"); + f = fopen(file, "rt"); if (!f) { @@ -324,11 +346,11 @@ do_initial_defs() } else if (syntax == ASM) { - do_define("TEXT", "SECTION TEXT"); + do_define("TEXT", "SECTION TEXT,CODE"); - do_define("DATA", "SECTION DATA"); + do_define("DATA", "SECTION DATA,DATA"); - do_define("BSS", "SECTION BSS"); + do_define("BSS", "SECTION BSS,BSS"); } @@ -374,7 +396,7 @@ main (argc, argv) } - f = fopen(*argv, "w"); + f = fopen(*argv, "wt"); if (!f) @@ -466,7 +488,7 @@ main (argc, argv) while(*argv) { - if (!(f = fopen(*argv, "r"))) + if (!(f = fopen(*argv, "rt"))) perror(*argv);