EASy68K Assembly - first program errors -
i'm new assembly language, i'm having little trouble first program. supposed recreate following code, except in assembly language obviously. can me fix errors , me program work properly? think close.
original non-assembly code:
q = 7; p = 15; // test on p = 14 , p = 6 if (p > 12) p = 8 * p + 4; // requirement: use asl multiplied 8 else p = p - q; print p;
here have far, i'm getting errors. i'll post errors @ bottom.
start org $1000 //program starts @ loc $1000 if cmp #12,p //is p > 12? ble endif //if p < 12, go endif asl #3,p //shift left 3 times (multiply p * 8) add #4,p //p + 4 endif sub q,p //p - q * data section org $2000 //data starts @ loc 2000 p dc.w 15 //int p = 15; q dc.w 7 //int q = 7; end start
line 4: error: invalid addressing mode line 7: error: invalid addressing mode
i recommend keep m68000 programmer's reference manual around correct way of using instructions.
asl
has no #<data>,<ea>
form. does have <ea>
form, can asl p
3 times. or can move p
register, shift 3 bits left, , put result in p
.
likewise, there's no <ea>,<ea>
form of sub
. 1 solution move q
d
-register, , subtract register p
.
Comments
Post a Comment