You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perhaps a bad idea, but I'm using dasm to write a program for the MC6800. 6803 code is backwards compatible with 6800's documented instructions, so I thought it'd be a safe thing to do.
However, I just encountered a problem:
JSR $0040
On a 6800, this would use extended addressing, since there's no direct (zero-page) JSR there, so it would be assembled into $BD $0040. The 6803 does have a direct JSR instruction though, and dasm will obviously use it, creating code that's not compatible with 6800.
In this specific case, it's even worse. The opcode for direct JSR on 6803 is $9D, which on the 6800 was an undocumented opcode: The mythical "halt and catch fire"!
Anyway, my actual question is this: I realize dasm doesn't support 6800 and that maybe I should use something else, but is there a way to force it to use extended addressing in cases like this, without simply inputting the raw bytes?
Yeah, that's not the worst idea for my particular use case. Thanks.
And I do realize I probably shouldn't dasm for 6800. but I've used dasm for F8 in the past and I quite like it. Maybe the solution is to add 6800 support to dasm…
When an instruction supports direct and extended addressing mode the < character
can be used to force direct mode and the > character forces extended mode. Otherwise
the assembler selects the best mode automatically, which defaults to extended mode
for external symbols.
Oh, interesting! No, I must have missed that in the documentation. Not sure if this kind of syntax is common and I just don't know about it. This looks perfect.
My admin-gurus at the university used to say: "You've got the sources, luke .." (especcially when docs where missing ;-)
src/main.c around line 1030 you should find it.
With dasm this extension works for any opcode where both addressing modes are available.
Activity
andrew-davie commentedon Apr 15, 2020
How about creating a macro for that situation and using the macro in an opcode-like fashion?
Something like...
Then you'd just never use "JSR" but instead always "JSRX"
Not quite answering your question about "forcing" but perhaps a better solution than inputting the raw bytes every single time.
tobiasvl commentedon Apr 15, 2020
Yeah, that's not the worst idea for my particular use case. Thanks.
And I do realize I probably shouldn't dasm for 6800. but I've used dasm for F8 in the past and I quite like it. Maybe the solution is to add 6800 support to dasm…
tobiasvl commentedon Apr 19, 2020
The
vasmassembler has the following feature:Could be something to consider.
thomas374b commentedon Jul 12, 2020
Have you tried the postfix '.w'
Should create 'bd 00 40' (I've tested this)
With dasm one can force addressing mode to direct address with postfix (.b) or to extended address (.w)
tobiasvl commentedon Jul 12, 2020
Oh, interesting! No, I must have missed that in the documentation. Not sure if this kind of syntax is common and I just don't know about it. This looks perfect.
thomas374b commentedon Jul 13, 2020
My admin-gurus at the university used to say: "You've got the sources, luke .." (especcially when docs where missing ;-)
src/main.c around line 1030 you should find it.
With dasm this extension works for any opcode where both addressing modes are available.
Testcase for issue #41 added
thrust26 commentedon Apr 13, 2021
Can this be closed?
tobiasvl commentedon Apr 13, 2021
Yes. Thanks!