--- MiNT/src/asm.y 2018/04/24 17:55:40 1.1 +++ 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); } + ; @@ -190,7 +212,7 @@ jmp_buf start; #ifdef NATIVEATARI -#define STACK 32*1024L; +#define STACK 32*1024L #ifdef LATTICE @@ -254,7 +276,7 @@ do_include(file) - f = fopen(file, "r"); + f = fopen(file, "rt"); if (!f) { @@ -298,6 +320,8 @@ do_initial_defs() if (syntax == GAS) { + do_define("mmusr", "psr"); + do_define("fpiar", "fpi"); do_define("XREF", ".globl"); @@ -322,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"); } @@ -372,7 +396,7 @@ main (argc, argv) } - f = fopen(*argv, "w"); + f = fopen(*argv, "wt"); if (!f) @@ -464,7 +488,7 @@ main (argc, argv) while(*argv) { - if (!(f = fopen(*argv, "r"))) + if (!(f = fopen(*argv, "rt"))) perror(*argv);