Page 1 of 2

asm6809 2.3 released

Posted: Wed Aug 13, 2014 11:50 am
by sixxie
In a sudden unnatural burst of productivity...

http://www.6809.org.uk/dragon/asm6809.shtml

Windows build.

Since 2.2:
  • Conditional assembly with IF/ELSIF/ELSE/ENDIF.
  • New -d, --define=SYM[=NUMBER] option.
  • New logical operators: !, &&, ||
  • New ternary operator: ?:
  • New relational operators: < <= > >= == !=
  • &n positional arg no longer accepted outside a string.
That last one is sadly important and may break existing code - because "&1" can easily be mistaken for "bitwise AND with the value 1", asm6809 doesn't accept it any more. Use "&{1}" or the lwasm-style "\1" instead.

Edit: brown paper bag release 2.3.1 - link updated!

Re: asm6809 2.3 released

Posted: Wed Aug 13, 2014 2:01 pm
by sorchard
Mr 6, you're a star! Conditional assembly is the icing on the cake. You are forgiven for breaking my macros ;)

I wondered how tricky it might be to implement a switch or pseudo op that makes symbols have file scope instead of global unless otherwise specified. That could be a tasty cherry to put on top...

Re: asm6809 2.3 released

Posted: Wed Aug 13, 2014 8:48 pm
by sixxie
Cheers, and I'll give that suggestion some thought.

I think what I want next is a "foreach" command...

And then obviously it needs the ability to read mail ;)

Re: asm6809 2.3 released

Posted: Thu Aug 14, 2014 8:08 am
by sorchard
sixxie wrote:I think what I want next is a "foreach" command...
I like your thinking... it would enable loop unrolling on an industrial scale.

Re: asm6809 2.3 released

Posted: Tue Jan 13, 2015 10:11 pm
by rolfmichelsen
Asm6809 has always been great, but here's a quick question regarding indexed addressing. It seems asm6809 (also the old Perl version) handles indexed addressing differently than other 6809 assemblers that I have tested. The following simple program demonstrates the difference:

Code: Select all

            leax        welcome,pc
loop        lda         ,x+
            beq         end
            jsr         $800c
            bra         loop
end         rts
welcome     fcc         "Hello, Dragon", 13, 0
DREAM will encode the LEAX instruction as 30 8c 0a, i.e. using the offset of welcome as the index. The program prints "Hello, Dragon", as expected. asm6809 generated 30 8d xx xx for the LEAX instruction, encoding the absolute address of the welcome message as the index, hence printing a random string from memory. (xx xx depends on the location of the program in memory.)

Is this intentional?

Regards,
-- Rolf

Re: asm6809 2.3 released

Posted: Tue Jan 13, 2015 11:28 pm
by sixxie
It's so you can specify an absolute offset relative to the PC - possibly more useful for disassembled code than for new. I always used ",PCR" to indicate the relative version (which is what the datasheet suggests).

You're right that DREAM treats it the same, so I went looking at other assemblers - most of the ones I have here do it the way you expect, except LWASM, which makes the same choice I did.

To clarify, what would you expect this to do just from reading it?

Code: Select all

	LEAX	4,PC
Me, I'd expect X to be PC+4, not the offset to address $0004.

Re: asm6809 2.3 released

Posted: Tue Jan 13, 2015 11:31 pm
by rolfmichelsen
I wasn't aware of the difference between PC and PCR. More testing tomorrow!

Thanks.
-- Rolf

Re: asm6809 2.3 released

Posted: Sat Mar 14, 2015 3:25 pm
by pser1
Hi, Ciaran
I have been using your asm6809 for some time.
Now I wanted to compile a program for DriveWire, that contains lines like this one:
JSR (DWRVEC) ; indirect addressing mode
being:
DWRVEC FDB $0000
When this is compiled with DskDream the resulting code is:
AD 9F xxxx

When I try it with asm6809 all I get is a "Invalid Addressing mode"
I have tried changing ( ) by [] but the same result ...

Finally I have solved it using another indirect addressing mode:
JSR [DWRVEC, PCR]
This gives a functional binary, but the generated code differs, it is now:
AD 9D mmmm
The post byte is different to denote the PCR relative addressing and so the mmmm is now different from the actual address xxxx in DskDream

Is there any trick to use the indirect 16 bits address instead of this PCR method?

thanks in advance

cheers
pere

Re: asm6809 2.3 released

Posted: Sat Mar 14, 2015 10:11 pm
by sorchard
Hi Pere,

Square brackets [] are used for indirect addressing but I remember having the same problem. The solution is to define the symbol before using it:

Code: Select all

DWRVEC FDB $0000

	JSR [DWRVEC]
Round brackets () don't change the addressing mode as they are used for expressions.

The other thing to watch out for is if you misspell the symbol. The error message will be "invalid addressing mode" instead of "undefined symbol"

Re: asm6809 2.3 released

Posted: Sat Mar 14, 2015 10:57 pm
by pser1
Hi Stew,

thanks, I had not made this test.
The JSR [DWRVEC, PCR] works well and in fact with the same bytes, not sure about the cycles, but I just don't matter.

cheers
pere