/* Allow terminating lines with the "|" char */
line_terminator : /* Nothing */
| BITW_OR line_terminator
+ ;
section_switch : SECTION_TEXT {
section = SECTION_TEXT;
}
;
-mem : BRACK_OPEN hexnum_decnum BRACK_CLOSE {
+mem : BRACK_OPEN imm BRACK_CLOSE {
struct memory *mem = xmalloc(sizeof(struct memory));
+ struct immediate *offset_imm = $2;
mem->type = MEM_DIRECT;
- mem->offset = (unsigned long)$2;
+ mem->offset = offset_imm->imm;
+ free(offset_imm);
$$ = mem;
}
- | BRACK_OPEN hexnum_decnum COMMA OFFR regnr BRACK_CLOSE {
+ | BRACK_OPEN imm COMMA OFFR regnr BRACK_CLOSE {
struct memory *mem = xmalloc(sizeof(struct memory));
+ struct immediate *offset_imm = $2;
mem->type = MEM_INDIRECT;
- mem->offset = (unsigned long)$2;
+ mem->offset = offset_imm->imm;
+ free(offset_imm);
mem->offr_nr = (unsigned long)$5;
$$ = mem;
}
;
-imm : hexnum {
- struct immediate *imm = xmalloc(sizeof(struct immediate));
- imm->imm = (unsigned long)$1;
- $$ = imm;
- }
- | decnum {
+imm : hexnum_decnum {
struct immediate *imm = xmalloc(sizeof(struct immediate));
imm->imm = (unsigned long)$1;
$$ = imm;
or [0],0,[0] ; Can have one mem input and one mem output
mov testlabel, r0 ; Can use label as immediate value
mov r0,r1|mov r2, r3 ; | does also seperate instructions
+ mov [(1+1)],[(2+2),off0] ; Can use complex immediates as memory offsets
; The .initvals section generates an "Initial Values" file