Specy/asm-editor

post increment addressing mode works correctly?

Closed this issue · 6 comments

Does post increment addressing mode works properly?
When traced execution of a program
LEA $1200,A0
MOVEQ #$55,D2
EOR.B D2,(A0)+
and changed memory view to address $1200, noticed that the last instruction worked as "pre increment", not "post increment", because of changing value under $1201, not $1200 address.

Specy commented

Ah yes i just noticed this, i tried to test it on Easy68K and it wrote to 1200 as expected
I found the affected code
increment of post increment: here
eor instruction: here
The issue being that the register is read (and incremented) and then written (not incremented) while it should be the opposite

It should be easy to fix, i need to add a new parameter to the get_operand_value that counts how many times the parameter is used, if it's a pre increment, then the get should increase it regardless, but if it's a post, it increases it only if Used::once. in the store it's the opposite, if it's post pre increment, then update only if Used::once, if post increment, update regardless

i'm a bit busy lately so might take a bit to fix the bug, thanks for letting me know though!

I hope this helps. Sometimes it's more convenient to use your online assembler/debugger than Easy68K or any other installed.

Specy commented

Yup i'm doing the fix now! it was way easier than i expected, i should be finished in a few hours.

Just for curiosity, why are you writing m68k? is it for some sort of lectures or just for fun?

Specy commented

image
Seems to be working! I just published the changes

also thanks to @transistorfet the inspriation of the Used::Twice/Used::Once

Yup i'm doing the fix now! it was way easier than i expected, i should be finished in a few hours.

Just for curiosity, why are you writing m68k? is it for some sort of lectures or just for fun?

Years ago I did a lot of coding in 68K, now I use it to teach students processor programming.
Checked, now works properly:) Thanx a lot!

Specy commented

Years ago I did a lot of coding in 68K, now I use it to teach students processor programming

That's the whole reason why i made the interpreter, the learning curve for assembly is so steep at the beginning because of the lack of "easy to use" tools to teach the basics, i'm glad it's been useful.

Thanks again for the bug report! It also made me spot a similar bug which i fixed