Hi,

I am new to programming for the most part except matlab, html, javascript, actionscript, etc.

I am trying to learn how to assemble/dissassemble files.

I have several assemply/dis. programs: nasmw/ndisasmw, flat assembler, pedasm, etc...

I can't figure out how to assemble the hello world program. here is an example of what I have:

message    db     'hello world','$'
   mov        dx,     offset message
   call       DisplayString

DisplayString: 

     mov     ax,cs
     mov     ds,ax
     mov     ah,9    ; DOS FUNCTION: display message
     int     21h     ; Call the DOS interrupt
     ret

this one almost works but it says error: expected comma on 2. (flat assembler)

Any help on where I should look for good resources or maybe a correction to this code would be helpful.

Basically, I want to learn how to disassemble a program(*.exe) file and then reassemble it. Maybe I need to learn some assembly language first though.

Thanks
D.

Here are some of my machine details if they are necessary:
intel T5500
plenty of ram and hard drive
win Xp pro

Recommended Answers

All 2 Replies

If the above is a complete program there are some obvious things wrong with it, but, if it isn't a complete program, the 2, I would guess, is probably a line number which refers to a line we may not have.

Hi,

I am new to programming for the most part except matlab, html, javascript, actionscript, etc.

I am trying to learn how to assemble/dissassemble files.

I have several assemply/dis. programs: nasmw/ndisasmw, flat assembler, pedasm, etc...

I can't figure out how to assemble the hello world program. here is an example of what I have:

message    db     'hello world','$'
   mov        dx,     offset message
   call       DisplayString
 
DisplayString: 
 
     mov     ax,cs
     mov     ds,ax
     mov     ah,9    ; DOS FUNCTION: display message
     int     21h     ; Call the DOS interrupt
     ret

this one almost works but it says error: expected comma on 2. (flat assembler)

Any help on where I should look for good resources or maybe a correction to this code would be helpful.

Basically, I want to learn how to disassemble a program(*.exe) file and then reassemble it. Maybe I need to learn some assembly language first though.

Thanks
D.

Here are some of my machine details if they are necessary:
intel T5500
plenty of ram and hard drive
win Xp pro

Try the below edited one with TASM assembler, but remember one thing you have to convert the exe file that got generated after assembling and linking in to an com file, since this code have only one segment.

U can use the dos utility exe2bin to convert the final exe file in to com file.

it goes like this, lets assume the file name as test.asm

__________________________________________
> TASM test.asm
now u will get the obj file.

> TLINK test.obj
now u will get the exe file.

> exe2bin test.exe test.com
now u will get the final com file that can be executed.

>test.com

__________________________________________


-----------------------------------------------------------
codeSegment SEGMENT USE16

ASSUME cs:codeSegment, ds:codeSegment, ss:codeSegment

org 100h ; required for specifying a com file.

MAIN_ENTRY:

jmp skipdata ; skip the data section in the code.

message db 'hello world','$'

skipdata:

mov dx, offset message
call DisplayString

DisplayString:

mov ax,cs
mov ds,ax
mov ah,9 ; DOS FUNCTION: display message
int 21h ; Call the DOS interrupt

ret


codeSegment ENDS

END MAIN_ENTRY

------------------------------------------------

thats it -- Garni.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.