News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

nasm to Goasm and prob with m1.exe

Started by zak100, July 21, 2009, 06:52:09 AM

Previous topic - Next topic

zak100

Hi,
I have got a code which is written in nasm. I have downloaded the Goasm assembler. Can somebody plz  help me to convert this code into Goasm code:

mov ax, 0xb800
       mov es, ax
        mov byte [es:0], 0x41
        mov byte [es:1], 0x1f
loop1: jmp loop1

times 510 - ($ - $$) db 0
db 0x55, 0xAA


When I compiled it, I got following errors:

D:\masm prog>goasm nasmB.asm

GoAsm.Exe Version 0.56.6b - Copyright Jeremy Gordon 2001/9 - JG@JGnet.co.uk

Error!
Line 1 of assembler source file (nasmB.asm):-
Must declare a section first -
Use DATA SECTION ["name"], CODE SECTION ["name"] or CONST SECTION ["name"]
Or just DATA, CODE or CONST; .DATA, .CODE or .CONST

OBJ file not made

D:\masm prog>

I also want to know the differences between masm32 & Goasm.

I got a link in which it says for masm use m1.exe. But its not being executed although its in my path:


D:\masm prog>echo %path%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microso
ft SQL Server\90\Tools\binn\;E:\gcc-part-objc-4.3.0-20080502-mingw32-alpha-bin\l
ibexec\gcc\mingw32\4.3.0;E:\MinGW\bin;D:\nasm-2.06rc10-dos-upx\nasm-2.06rc10;D:\
alink;.;d:\masm;d:\GoAsm

D:\masm prog>m1
'm1' is not recognized as an internal or external command,
operable program or batch file.


D:\masm prog>dir d:\masm
Volume in drive D is New Volume
Volume Serial Number is 70FD-1D2C

Directory of d:\masm

07/21/2009  11:00 AM    <DIR>          .
07/21/2009  11:00 AM    <DIR>          ..
03/19/1998  11:28 AM           462,899 link.exe
01/13/1995  09:10 AM           364,544 link16.exe
07/22/2001  12:31 AM             9,687 ml.err
03/29/1999  12:45 PM           372,736 ml.exe
               4 File(s)      1,209,866 bytes
               2 Dir(s)  22,654,599,168 bytes free

D:\masm prog>


Kindly help me in this regard.

Zulfi.

disintx

You're getting an error because you have no data/code sections declared :)

For example, in masm32 the equivalent would be:

.386
.model flat, stdcall
; includes and junk
.data
Something db "String",0
.code
start:
; do something
end start

I am fairly certain GoAsm is syntax compatible with Masm32 but don't take my word for it.

Also, you are creating 16-bit code so you'll need the assembler/linker to understand that.

P.S. It's "ML", not "M1". :)

ecube

you should try the unofficial GoASM SDK I put together at http://www.masm32.com/board/index.php?topic=11180.0, after you grab that you can update GoASM.exe with the latest version from http://www.masm32.com/board/index.php?action=dlattach;topic=11895.0;id=6484
and update the headers version with the latest from http://www.quickersoft.com/donkey/headers/headers.zip

I don't know nasm well enough to translate the code you posted, looks like DOS anyway which I don't think GoASM can build, here's a semi-barebones GoASM source that can be assembled for either 32bit/64bit, using the SDK looks something like


#DEFINE LINKFILES ;this auto finds the function imports needed
;#DEFINE WIN64 ;uncomment to build for 64bit
#include "\GoAsm\include\windows.h"

DATA SECTION
Something db "String",0

CODE SECTION
START:

#ifndef WIN64
invoke MessageBox,0,addr Something,"i'm running in 32bit!",MB_ICONINFORMATION
#else
invoke MessageBox,0,addr Something,"i'm running in 64bit!",MB_ICONINFORMATION
#endif



also here's a semi attempt at coverting code you posted, problem is I fail to see how this is legit

loop1: jmp loop1, that seems like a never end loop to me


#DEFINE LINKFILES
#include "\GoAsm\include\windows.h"

DATA SECTION
Something db "String",0

CODE SECTION
START:
mov ax, 0b800h
       mov es, ax
        mov B[es:0], 41h
        mov B[es:1], 1fh
loop1: jmp loop1

;times 510 - ($ - $$) db 0 ;no idea what this is
db 55h, 0AAh


this ofcourse won't build correctly, because I didn't translate it right,and like I said if it's DOS I don't think GoASM can build anyway.

zak100


Hi,
Thanks for your help. I have changed the code but still I am getting two errors:

D:\masm prog>ml nasmB.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: nasmB.asm
nasmB.asm(11) : error A2008: syntax error : integer
nasmB.asm(12) : error A2206: missing operator in expression

D:\masm prog>

Actually I want to print 'A' at boot time. This is what I am doing here. times would store zero in remaining bytes (i think so).
And the last line is the boot signature.


.386
.model flat, stdcall
.code
start:
mov ax, 0b800h
       mov es, ax
        mov byte ptr [es:0], 41h
        mov byte ptr [es:1], 1fh
loop1: jmp loop1

times 510 - ($ - $$) db 0
db 0x55, 0xAA
end start


Zulfi.

dedndave

i am not sure about these other assemblers
but, [es:0] should be es:[0]
and i don't think that addressing mode is allowed in masm
you might try this, instead:

        cld
        mov     ax,0B800h
        mov     es,ax
        xor     di,di
        mov     ax,1F41h
        stosw

STOSW stores the value in AX to ES:[DI], then adjusts DI to point to the next location

FORTRANS

   Another problem is that MASM does not accept 0x55 as a
hexadecimal value.  It should be 55H.

Steve