asm6809 2.3 released

A place to discuss everything Dragon related that doesn't fall into the other categories.
sixxie
Posts: 1344
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

asm6809 2.3 released

Post 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!
Last edited by sixxie on Fri Aug 15, 2014 8:46 am, edited 1 time in total.
sorchard
Posts: 529
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: asm6809 2.3 released

Post 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...
Stew
sixxie
Posts: 1344
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: asm6809 2.3 released

Post 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 ;)
sorchard
Posts: 529
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: asm6809 2.3 released

Post 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.
Stew
User avatar
rolfmichelsen
Posts: 296
Joined: Wed Apr 08, 2009 8:43 pm
Location: Oslo, Norway
Contact:

Re: asm6809 2.3 released

Post 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
sixxie
Posts: 1344
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: asm6809 2.3 released

Post 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.
Last edited by sixxie on Tue Jan 13, 2015 11:33 pm, edited 1 time in total.
User avatar
rolfmichelsen
Posts: 296
Joined: Wed Apr 08, 2009 8:43 pm
Location: Oslo, Norway
Contact:

Re: asm6809 2.3 released

Post by rolfmichelsen »

I wasn't aware of the difference between PC and PCR. More testing tomorrow!

Thanks.
-- Rolf
pser1
Posts: 1652
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: asm6809 2.3 released

Post 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
sorchard
Posts: 529
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: asm6809 2.3 released

Post 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"
Stew
pser1
Posts: 1652
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: asm6809 2.3 released

Post 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
Post Reply