Welcome to the EASy68K forum. This is the place to
discuss 68000 assembly language programming with EASy68K.
| View previous topic :: View next topic |
| Author |
Message |
marc_256
Joined: 01 Nov 2009 Posts: 12 Location: Belgium
|
Posted: Sat Nov 28, 2009 4:04 pm Post subject: ALIGN command |
|
|
Hello,
I it possible to add the 'ALIGN' command in the easy68k assembler/editor ?
Is it also possible to add selection for W and L ?
Thanks,
Marc _________________ Greetings from Belgium
Hobby robot builder
www.marc-systems.be |
|
| Back to top |
|
 |
profkelly

Joined: 16 Dec 2004 Posts: 596 Location: Monroe County Community College, Monroe Michigan, U.S.A.
|
Posted: Sat Nov 28, 2009 11:00 pm 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.
Examples:
| Code: |
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.
|
_________________ Prof Chuck Kelly |
|
| Back to top |
|
 |
marc_256
Joined: 01 Nov 2009 Posts: 12 Location: Belgium
|
Posted: Sun Nov 29, 2009 10:36 am Post subject: |
|
|
Hello,
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,
Marc _________________ Greetings from Belgium
Hobby robot builder
www.marc-systems.be |
|
| Back to top |
|
 |
paulrsm
Joined: 20 Jun 2005 Posts: 14
|
Posted: Sun Nov 29, 2009 11:22 am Post subject: |
|
|
Can this be done with a macro?
| Code: | 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 |
|
|
| Back to top |
|
 |
paulrsm
Joined: 20 Jun 2005 Posts: 14
|
Posted: Sun Nov 29, 2009 12: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.
| Code: | ALIGN MACRO
DS.B (*+3)&-4-*
ENDM |
(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).
| Code: | ALIGN MACRO
DS.B (*-1)/\1*\1+\1-*
ENDM |
This ALIGN will work with any argument but it will align to long if there is no argument. The listing is a little uglier.
| Code: | ALIGN MACRO
IFARG 1
DS.B (*-1)/\1*\1+\1-*
MEXIT
ENDC
DS.B (*+3)&-4-*
ENDM |
|
|
| Back to top |
|
 |
marc_256
Joined: 01 Nov 2009 Posts: 12 Location: Belgium
|
Posted: Tue Dec 01, 2009 2: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,
greetings,
Marc _________________ Greetings from Belgium
Hobby robot builder
www.marc-systems.be |
|
| Back to top |
|
 |
profkelly

Joined: 16 Dec 2004 Posts: 596 Location: Monroe County Community College, Monroe Michigan, U.S.A.
|
Posted: Tue Dec 01, 2009 5: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. _________________ Prof Chuck Kelly |
|
| Back to top |
|
 |
|