>> > I'm translatting the assembler source code of Linux (as86) to Nasm
>> > syntax. I need to understand the syntax of as86 wich is (very??)
>> > different from Nasm's one, in particular :
>>
>> Ye gods. Umm no idea
>>
>> >
>> >     movb    4(di),*36    ; (What mean the * prefix of value 36)
>> >                                      ; does 4(di) means [di+4] ???
>> >
>> > Do you know where I can find any documentation. If not may be I can
>> > reach Bruce Evans himself.
>
>Hi all,
>
>Like part of my previous message will show you,  I will apreciate any
>documentation on as86 syntax, I mean, may be a document where stuff like
>previous 'movb 4(di),*36' will be explain.

This is equivalent to movb [di+4],#36, or in nasm format mov byte [di+4],36

Personally I think it's a double edged sword that as86 supports many
equivalent syntaxes for the same purpose. I have developed a set of macros
that allow me to assemble a file under as86 or nasm with the change
of a #define.  It requires a bit of discipline, i.e. no gratuitous
use of alternate syntax, e.g. ; instead of !, db/dw/dd instead of
.byte/.word/.long, some macros to cope with the constant/reference
distinction, i.e.

as86:   CON(x) -> *x
        LOC(x) -> x
        STRDECL(x) -> .ascii x
nasm:   CON(x) -> x
        LOC(x) -> [x]
        STRDECL(x) -> db x

Some pathological constructs need #ifdef AS86 and #ifdef NASM, but I
can get away with perhaps 10 or so in 2000 lines of assembler.

It works pretty well and I have attained byte for byte match of the
resulting binaries, except for instructions like xchg ax,bx which have
two equivalent forms, of course.

Personally I think if as86 code were converted this way, you keep the
as86 users happy.

You can see the use of this technique in contrib/mkfreedosnbi/first.S,
src/loader.asm and src/zloader.asm in the Etherboot distribution at
www.slug.org.au/etherboot

Reply via email to