ALIGN command
Page 1 of 1

Author:  marc_256 [ Sat Nov 28, 2009 9:04 pm ]
Post subject:  ALIGN command

I it possible to add the 'ALIGN' command in the easy68k assembler/editor ?
Is it also possible to add selection for W and L ?


Author:  profkelly [ Sun Nov 29, 2009 4:00 am ]
Post subject: 

A suggested syntax. Comments?

Syntax: align alignment[, [fill][, max]]

Pad the location counter (in the current subsection) to a particular storage boundary. alignment (which must be absolute) is the alignment required, as described below.

fill (also absolute) gives the fill value to be stored in the padding bytes. It (and the comma) may be omitted. If it is omitted, the padding bytes are zero.

max is also absolute, and is also optional. If it is present, it is the maximum number of bytes that should be skipped by this alignment directive. If doing the alignment would require skipping more bytes than the specified maximum, then the alignment is not done at all. You can omit the fill value (the second argument) entirely by simply using two commas after the required alignment.

        align  2        force word align
        align  4        force long word align
        align  2048, $4E71, 1024  force alignment on 2K boundary, fill with NOP instructions, don't align if more than 1024 bytes required.

Author:  marc_256 [ Sun Nov 29, 2009 3:36 pm ]
Post subject: 


This is very nice.
It is even more than I dreamed of.

For me, I can save a lot of time with this extra command.

align 2 force word align
align 4 force long word align

Is it also possible to add the syntax 'ALIGN',
for always aligning on long addresses.

Thanks very much.
Best regards,

Author:  paulrsm [ Sun Nov 29, 2009 4:22 pm ]
Post subject: 

Can this be done with a macro?

00001002        12  ALIGN   MACRO
00001002        13          DS.B    (*+\1-1)&-\1-*
00001002        14          ENDM
00001002        15 
00001002        16          DS.W    0       ;align to word
00001002        17          DS.B    1       ;force odd address
00001003        18         
00001003        19m         ALIGN   4
00001003        20m         DS.B    (*+4-1)&-4-*
00001004        21m         ENDM
00001004        22         
00001004        23          DS.B    1
00001005        24         
00001005        25m         ALIGN   2
00001005        26m         DS.B    (*+2-1)&-2-*
00001006        27m         ENDM

Author:  paulrsm [ Sun Nov 29, 2009 5:20 pm ]
Post subject: 

Here are some other (better) macros.

If Marc just wants to type ALIGN and have it always align to long, then this macro will fullfill his needs.

        DS.B    (*+3)&-4-*

(I would prefer to call this macro LONG, but he is trying to make his code compatible with a different assembler.)

This ALIGN macro needs an argument but it will align to any number, including odd numbers (like 5 or 13).

        DS.B    (*-1)/\1*\1+\1-*

This ALIGN will work with any argument but it will align to long if there is no argument. The listing is a little uglier.

        IFARG   1
        DS.B    (*-1)/\1*\1+\1-*
        DS.B    (*+3)&-4-*

Author:  marc_256 [ Tue Dec 01, 2009 7:34 am ]
Post subject: 

Hi paulrsm,

Yes, the reason I like to use ALIGN are two older 'DOS' working assemblers.
One of them 'PseudoAsm' uses '.ALIGN' and the other just 'ALIGN'.

The .ASM software for my robot takes about 1.5 Mb as an assembler file.
So a lot of work to change it for the EASY68K software.

I'm also rewriting an older assembler who works on my 68K SBC.
So I do not have to use the PC anymore.

And there they also use the 'ALIGN' command.

Thanks for the input,

Author:  profkelly [ Tue Dec 01, 2009 10:12 am ]
Post subject: 

Using a macro is a viable solution that does not require any modification of the EASy68K code , which is less work for me :). I will consider this wish granted.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group