ack/mach/m65oo2/as/mach4.c

50 lines
1.4 KiB
C

operation
: OP_impl
{ emit1($1);}
| OP_branch expr
{ branch($1, $2);}
| OP_arithm SIZE '#' expr
{ encode_imm($1+0x9, $2, $4);}
| OP_arithm SIZE expr
{ emit1($1+0x0D); encode_addr($3, $2);}
| OP_arithm SIZE expr ',' REG_x
{ emit1($1+0x1D); encode_addr($3, $2);}
| OP_arithm SIZE expr ',' REG_y
{ emit1($1+0x19); encode_addr($3, $2);}
| OP_arithm SIZE '(' expr ',' REG_x ')'
{ emit1($1+0x01); encode_addr($4, $2);}
| OP_arithm SIZE '(' expr ')' ',' REG_y
{ emit1($1+0x11); encode_addr($4, $2);}
| OP_jump expr
{ emit1($1); encode_addr($2, 0);}
| OP_jump '(' expr ')'
{ emit1($1+0x20); encode_addr($3, 0);}
| OP_jsr expr
{ emit1($1); encode_addr($2, 0);}
| OP_rol REG_acc
{ emit1($1+0x0A);}
| OP_rol SIZE expr
{ emit1($1+0x0E);encode_addr($3, $2);}
| OP_rol SIZE expr ',' REG_x
{ emit1($1+0x1E);encode_addr($3, $2);}
| OP_bit SIZE expr
{ emit1($1);encode_addr($3, $2);}
| OP_cpx SIZE '#' expr
{ encode_imm($1, $2, $4);}
| OP_cpx SIZE expr
{ emit1($1+0x0C);encode_addr($3, $2);}
| OP_inc SIZE expr
{ emit1($1+0x0E);encode_addr($3, $2);}
| OP_inc SIZE expr ',' REG_x
{ emit1($1+0x1E);encode_addr($3, $2);}
| OP_stx SIZE expr
{ emit1($1);encode_addr($3, $2);}
| OP_ldx SIZE '#' expr
{ encode_imm($1, $2, $4);}
| OP_ldx SIZE expr
{ emit1($1+0x0C);encode_addr($3, $2);}
| OP_ldx SIZE expr ',' REG_x
{ emit1($1+0x1C);encode_addr($3, $2);}
;