Hi,

I am trying to port some GNU code to MASM and don't know how to handle these codes:

.globl myLabel


movw (%ebx),%ax
...
movw 4(%ebx),%ax
...
movw (%ecx,%esi),%ax
...
movw 2(%ecx,%esi),%bx
...
bts %ecx,(%edi)
...
movl %ebx,(%ecx,%esi)
...
subl $4,%ebp
...
movw (%ecx,%esi),%ax
...
movw 2(%ecx,%esi),%bx
...
movl %ebx,(%ecx,%esi)
...
leal 4(%esi,%ebp),%ebp

Happy New year.

TIA for your help.


flyingtiger
Posted on 2003-01-07 11:17:48 by flyingtiger
Just a guess here, but:



mov ax, WORD PTR [EBX]

mov ax, WORD PTR [EBX + 4]

mov WORD PTR [ECX + ESI], ax

mov WORD PTR [ECX + ESI + 2], ax

bts [edi], ecx

mov DWORD PTR [ecx + esi], ebx

sub ebp, 4

mov ax, WORD PTR [ecx + esi]

mov bx, WORD PTR [ecx + esi + 2]

mov [ecx + esi], ebx

lea ebp, [esi + ebp + 4]


You see, those wierd ass, lentle munching bunch of hippies who put Loonix together write there opcodes the wrong way around. Probably based on some old VAX assembler style, either that, or they put their sandles on too tight and trapped all their blood in their toes so they can't think properly.

Bunch of communist, tree hugging, reprobates.

Mirno
Posted on 2003-01-07 11:37:56 by Mirno
Sorry can't add much.... I don't have experience with GAS but I know that it's like this... :grin:

I think its' better to understand what is actually happening on the code then translate it to MASM...

Mirno,

chill... :grin:
Posted on 2003-01-07 12:13:34 by arkane
Hi,

Many thanks for your help.

flyingtiger
Posted on 2003-01-07 13:34:21 by flyingtiger
there's a tool called gas2masm, quake 1 uses it. dunno if you want to do it yourself though.

-stormix
Posted on 2003-01-08 16:38:06 by stormix
Hi,

Thanks for the tip. Any pointer to the latest version ?

Cheers,

flyingtiger
Posted on 2003-01-08 19:03:33 by flyingtiger
> Any pointer to the latest version ?

http://www.google.com/search?q=gas2masm
Posted on 2003-01-09 01:05:54 by n u M I T_o r
I think the quake guys wrote it themselves so here is the source, as packaged with the QuakeWorld source.

regards,

-stormix
Posted on 2003-01-09 12:42:29 by stormix
Hi stormix, n u M I T_o r,

Thanks for your help. I built the tool and it looks like GAS has changed since and GAS2MASM was not updated.

For my snippets, gas2masm does not understand the followings:

.file

/*

bts

pushal

popal


Cheers,

flyingtiger
Posted on 2003-01-09 13:07:24 by flyingtiger
hey, i don't know anything about gas and i haven't really looked at that source but i reckon you could add support for those instructions without too much difficulty?

-stormix
Posted on 2003-01-10 09:05:43 by stormix