Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #2975 > unrolled thread
| Started by | Michael Pohoreski <michael.pohoreski@gmail.com> |
|---|---|
| First post | 2016-08-18 15:08 -0700 |
| Last post | 2016-08-23 00:50 -0700 |
| Articles | 11 — 4 participants |
Back to article view | Back to comp.sys.apple2.programmer
[Asm] Merlin32: DUM padding/align to new page Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-08-18 15:08 -0700
[Asm] Merlin32: DUM padding/align to new page Antoine Vignau <antoine.vignau@laposte.net> - 2016-08-18 23:15 -0700
Re: [Asm] Merlin32: DUM padding/align to new page Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-08-19 08:26 -0700
Re: [Asm] Merlin32: DUM padding/align to new page Antoine Vignau <antoine.vignau@laposte.net> - 2016-08-20 06:48 -0700
Re: [Asm] Merlin32: DUM padding/align to new page olivier.zardini@itn-group.eu - 2016-08-22 01:39 -0700
Re: [Asm] Merlin32: DUM padding/align to new page Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-08-22 06:31 -0700
Re: [Asm] Merlin32: DUM padding/align to new page olivier.zardini@itn-group.eu - 2016-08-22 07:48 -0700
Re: [Asm] Merlin32: DUM padding/align to new page Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-08-22 07:51 -0700
Re: [Asm] Merlin32: DUM padding/align to new page olivier.zardini@itn-group.eu - 2016-08-22 07:56 -0700
Re: [Asm] Merlin32: DUM padding/align to new page Michael J. Mahon <mjmahon@aol.com> - 2016-08-22 21:54 -0500
Re: [Asm] Merlin32: DUM padding/align to new page olivier.zardini@itn-group.eu - 2016-08-23 00:50 -0700
| From | Michael Pohoreski <michael.pohoreski@gmail.com> |
|---|---|
| Date | 2016-08-18 15:08 -0700 |
| Subject | [Asm] Merlin32: DUM padding/align to new page |
| Message-ID | <d327a86c-590f-4131-a079-32e9d6bcfe7e@googlegroups.com> |
TL:DR; Is DS \ the only way to page align?
I'm starting to assemble my .s files with both ca65 and merlin32 now.
It's nice to work with an assembler that isn't brain dead.
One of the benefits is that it helps keep my ca65 source "clean".
I like that.
Anyways, with ca65 I'm able to tell the assembler NOT to reserve space but generate the symbol address at the start of a page boundary via:
LDX #0
LDA foo,X
RTS
pad EQU 256 - <*
page EQU *+pad
foo EQU page
bar EQU page+256
I was running into a small problem telling merlin32 to align data on a page boundary after all my code.
The DUM and DEND directives do what I want (almost):
While this works ...
DUM *
foo DS 256
DEND
... it doesn't page align foo.
I thought I could use this ...
DUM *
pad DS 256-<*
foo DS 256
DEND
... but that generates this error:
=> [Error] Impossible to decode Data format for instruction 'DS 256-<*' (line ###, file 'test.s') : Wrong DS Format Data in Operand '256-<*' (The number of element is even (should be value [operator value [operator value]...])).
I see ORG can use the current PC ...
ORG *
... but it can't take any form of math ...
ORG *+(256-<*)
... which again generates the same type of error:
=> [Error] Error : Impossible to evaluate ORG Address : 'ozunid_1+(256-<*)' (line ###, file 'test.s') : '(256' can't be translated as a numeric expression.
Reading through the manual ... (yes some of us still do that)
http://www.brutaldeluxe.fr/products/crossdevtools/merlin/
... I see a solution is to use the fill-until-next-page-boundary operator '\':
> Reserve space for Operand bytes of data (set to 0x00). You can choose to fill the reserved space with values other than 0x00 by providing a value (or an expression) as second operand. If you use the keyword \ as first operand, the memory is filled until the next page boundary. On relocatable code, the DS \ should only be used at the end of the file.
1. Is this the only way to do this?
2. I'm not complaining if it is, but I was just kind of surprised that
ORG *+(256-<*)
or
pad DS 256-<*
didn't work.
Is this a feature or a bug? :-)
Michael
[toc] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2016-08-18 23:15 -0700 |
| Message-ID | <d9f85385-a99d-41c9-b328-1e45824c75ee@googlegroups.com> |
| In reply to | #2975 |
"If that does not asm on Merlin16 then it does not work in Merlin32" is the quote of the day ;-) Some years ago, Michael Mahon, on csa2 or csa2.programmer, wrote something about alignment in Merlin, try to dig that old thread. I'll tell Olivier Z. about your message, av
[toc] | [prev] | [next] | [standalone]
| From | Michael Pohoreski <michael.pohoreski@gmail.com> |
|---|---|
| Date | 2016-08-19 08:26 -0700 |
| Message-ID | <c0dc838c-a477-4d4d-b57b-83f6219cf20a@googlegroups.com> |
| In reply to | #2978 |
On Thursday, August 18, 2016 at 11:15:26 PM UTC-7, Antoine Vignau wrote:
> "If that does not asm on Merlin16 then it does not work in Merlin32" is the quote of the day ;-)
>
> Some years ago, Michael Mahon, on csa2 or csa2.programmer, wrote something about alignment in Merlin, try to dig that old thread.
Are you referring to this post/thread ?
https://groups.google.com/d/msg/comp.sys.apple2.programmer/2RL8a9JV7VA/NfLlIruaCgAJ
align mac ; Align 0 mod arg
ds *+]1-1/]1*]1-*
eom
--
That's a little bit of macro-fu magic ! Terse, but interesting ;-)
> I'll tell Olivier Z. about your message,
That would be appreciated.
[toc] | [prev] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2016-08-20 06:48 -0700 |
| Message-ID | <6a55a57c-e427-4456-9bae-bdcdcf0fd71f@googlegroups.com> |
| In reply to | #2979 |
Yes, good catch! av
[toc] | [prev] | [next] | [standalone]
| From | olivier.zardini@itn-group.eu |
|---|---|
| Date | 2016-08-22 01:39 -0700 |
| Message-ID | <48962d76-8d53-45ce-9729-7ff1a3e105c8@googlegroups.com> |
| In reply to | #2975 |
Le vendredi 19 août 2016 00:08:16 UTC+2, Michael Pohoreski a écrit :
> TL:DR; Is DS \ the only way to page align?
I could add to Merlin 32 two new ways to be aligned :
- DS \ANY_CONSTANT_VALUE
- ORG \ANY_CONSTANT_VALUE
with ANY_CONSTANT_VALUE an integer indicating the alignment. By default DS \ align on 256 bytes, but now, with the new syntax we could have any alignment possible :
DS \ ; Default behavior = 256 bytes boundary
DS \8 ; Align on 8 bytes boundary
DS \16 ; Align on 16 bytes boundary
DS \1024 ; Align on 1024 bytes boundary
...
Same for ORG :
ORG \ ; New ORG is previous ORG + number of byte to be aligned on the next 256 bytes boundary
ORG \8 ; New ORG is previous ORG + number of byte to be aligned on the next 8 bytes boundary
ORG \16 ; New ORG is previous ORG + number of byte to be aligned on the next 16 bytes boundary
ORG \1024 ; New ORG is previous ORG + number of byte to be aligned on the next 1KB bytes boundary
...
We are loosing Merlin 16+ compatibility, but we gain some flexibility.
Does that work for you ?
Regards,
Olivier
[toc] | [prev] | [next] | [standalone]
| From | Michael Pohoreski <michael.pohoreski@gmail.com> |
|---|---|
| Date | 2016-08-22 06:31 -0700 |
| Message-ID | <763ae7da-9fa3-47e8-b494-c242625a037d@googlegroups.com> |
| In reply to | #2983 |
On Monday, August 22, 2016 at 1:39:45 AM UTC-7, olivier...@itn-group.eu wrote: > Le vendredi 19 août 2016 00:08:16 UTC+2, Michael Pohoreski a écrit : > > > TL:DR; Is DS \ the only way to page align? > > I could add to Merlin 32 two new ways to be aligned : > > - DS \ANY_CONSTANT_VALUE > - ORG \ANY_CONSTANT_VALUE > > with ANY_CONSTANT_VALUE an integer indicating the alignment. By default DS \ align on 256 bytes, but now, with the new syntax we could have any alignment possible : > > DS \ ; Default behavior = 256 bytes boundary > DS \8 ; Align on 8 bytes boundary > DS \16 ; Align on 16 bytes boundary > DS \1024 ; Align on 1024 bytes boundary > ... > > Same for ORG : > > ORG \ ; New ORG is previous ORG + number of byte to be aligned on the next 256 bytes boundary > ORG \8 ; New ORG is previous ORG + number of byte to be aligned on the next 8 bytes boundary > ORG \16 ; New ORG is previous ORG + number of byte to be aligned on the next 16 bytes boundary > ORG \1024 ; New ORG is previous ORG + number of byte to be aligned on the next 1KB bytes boundary > ... > > We are loosing Merlin 16+ compatibility, but we gain some flexibility. > > Does that work for you ? Yup, that works! That syntax is sweet too -- a nice logical extension. Q. Is the alignment restricted to being a pow2 (power-of-2) ? I only need alignment to 32 bytes but I could see an amateur trying to align to a non-pow2, say like 35 bytes as used by the DOS3.3 CATALOG FDIR entry. Actually, I might have to do that for one of my future utilities ... :-/ Thanks!
[toc] | [prev] | [next] | [standalone]
| From | olivier.zardini@itn-group.eu |
|---|---|
| Date | 2016-08-22 07:48 -0700 |
| Message-ID | <00efa285-604a-4011-829b-7534afa14a30@googlegroups.com> |
| In reply to | #2984 |
Le lundi 22 août 2016 15:31:44 UTC+2, Michael Pohoreski a écrit :
> On Monday, August 22, 2016 at 1:39:45 AM UTC-7, olivier...@itn-group.eu wrote:
> Q. Is the alignment restricted to being a pow2 (power-of-2) ?
No, it can be any value, but I'd like to keep it as a constant (in decimal).
Are you using Merlin 32 on Windows, Macintosh or Linux ?
Regards,
Olivier
[toc] | [prev] | [next] | [standalone]
| From | Michael Pohoreski <michael.pohoreski@gmail.com> |
|---|---|
| Date | 2016-08-22 07:51 -0700 |
| Message-ID | <5bcf44a2-9d5b-4c18-8809-3b94e4ceede9@googlegroups.com> |
| In reply to | #2985 |
On Monday, August 22, 2016 at 7:48:24 AM UTC-7, olivier...@itn-group.eu wrote: > > Q. Is the alignment restricted to being a pow2 (power-of-2) ? > > No, it can be any value, but I'd like to keep it as a constant (in decimal). Awesome. > Are you using Merlin 32 on Windows, Macintosh or Linux ? OSX (almost exclusively) but rarely I'll be running under Win64 and Linux.
[toc] | [prev] | [next] | [standalone]
| From | olivier.zardini@itn-group.eu |
|---|---|
| Date | 2016-08-22 07:56 -0700 |
| Message-ID | <13e86d6a-1a11-4861-bc27-9cf6a428351c@googlegroups.com> |
| In reply to | #2986 |
Le lundi 22 août 2016 16:51:22 UTC+2, Michael Pohoreski a écrit :
> OSX (almost exclusively) but rarely I'll be running under Win64 and Linux.
The DS \ is ready but I need to check a Merlin 16+ behavior first. I have a doubt about alignment if the DS \ is already on the expected boundary. Do we have to insert 0 byte or the 256 bytes :
$0300 DS \
RTS
Not sure is RTS address is $0300 or if it will be $0400.
Olivier
[toc] | [prev] | [next] | [standalone]
| From | Michael J. Mahon <mjmahon@aol.com> |
|---|---|
| Date | 2016-08-22 21:54 -0500 |
| Message-ID | <D5WdnZWdvaZQJybKnZ2dnUU7-KdQAAAA@giganews.com> |
| In reply to | #2984 |
Michael Pohoreski <michael.pohoreski@gmail.com> wrote: > On Monday, August 22, 2016 at 1:39:45 AM UTC-7, olivier...@itn-group.eu wrote: >> Le vendredi 19 août 2016 00:08:16 UTC+2, Michael Pohoreski a écrit : >> >>> TL:DR; Is DS \ the only way to page align? >> >> I could add to Merlin 32 two new ways to be aligned : >> >> - DS \ANY_CONSTANT_VALUE >> - ORG \ANY_CONSTANT_VALUE >> >> with ANY_CONSTANT_VALUE an integer indicating the alignment. By default >> DS \ align on 256 bytes, but now, with the new syntax we could have any >> alignment possible : >> >> DS \ ; Default behavior = 256 bytes boundary >> DS \8 ; Align on 8 bytes boundary >> DS \16 ; Align on 16 bytes boundary >> DS \1024 ; Align on 1024 bytes boundary >> ... >> >> Same for ORG : >> >> ORG \ ; New ORG is previous ORG + number of byte to be aligned on >> the next 256 bytes boundary >> ORG \8 ; New ORG is previous ORG + number of byte to be aligned on >> the next 8 bytes boundary >> ORG \16 ; New ORG is previous ORG + number of byte to be aligned on >> the next 16 bytes boundary >> ORG \1024 ; New ORG is previous ORG + number of byte to be aligned on >> the next 1KB bytes boundary >> ... >> >> We are loosing Merlin 16+ compatibility, but we gain some flexibility. >> >> Does that work for you ? > > Yup, that works! That syntax is sweet too -- a nice logical extension. > > Q. Is the alignment restricted to being a pow2 (power-of-2) ? > > I only need alignment to 32 bytes but I could see an amateur trying to > align to a non-pow2, say like 35 bytes as used by the DOS3.3 CATALOG FDIR > entry. Actually, I might have to do that for one of my future utilities ... :-/ > > Thanks! > My "align" macro will align to *any* modulus, and it's completely backward compatible, even to Merlin 8. -- -michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
[toc] | [prev] | [next] | [standalone]
| From | olivier.zardini@itn-group.eu |
|---|---|
| Date | 2016-08-23 00:50 -0700 |
| Message-ID | <c6cf1398-7d59-4bcf-9cd7-578e19de1aa6@googlegroups.com> |
| In reply to | #2994 |
Le mardi 23 août 2016 04:54:10 UTC+2, mjm...@aol.com a écrit :
> My "align" macro will align to *any* modulus, and it's completely backward
> compatible, even to Merlin 8.
I'm glad that your Macro for DS \ alignment works on every Merlin releases, so it can also be used in Merlin 32 for people who want to keep a perfect retro compatibility between original Merlin assembly process and new cross dev tools chain.
We will add the DS \VALUE and the ORG \VALUE in order to simplify the read of the code as we have added the PUTBIN directive to make easy the integration of binary content in the object code. John Brooks is also interested in a new addressing mode keeping only the lower byte of an address ($E120A0 -> $A0) to make his Page Zero programming easier. Probably with a \ character : LDA \$E120A0 will be assembled as A5 A0 (Page Zero LDA).
Even if the purpose of Merlin 32 is to let you assemble old code in a new PC and also to send back the source code created on a new PC to the original Merlin 16+ release, the evolution of Merlin 32 will not be limited because of retro compatibility issues (as we did for the Linker we have re-written with a new syntax). We simply have to document carefully what are the new directives that make your source files incompatible with original Merlin 16+ release.
Olivier
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web