# ASM Code Question

This topic is 3623 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have an ASM Code Question. I recently downloaded/installed WinAsm Studio and wanted to test a simple Hello World application. When I assembled the code, I got two errors; one of them I fixed by adding an underscore infront of the 'main proc' statement. The other error says: D:\Programming\helloworld.asm(18) : fatal error A1010: unmatched block nesting : main Here is the code:
.model small
.stack
.data
message   db "Hello world, I'm learning Assembly !!!", "\$"

.code

_main   proc
mov   ax,seg message
mov   ds,ax

mov   ah,09
lea   dx,message
int   21h

mov   ax,4c00h
int   21h
main   endp
end main


Can anyone tell me what's wrong?

##### Share on other sites
It looks like you edited your post, and the line with the error appears to be outside of the code you pasted. Can you paste the entire source?

##### Share on other sites
Quote:
 Original post by ajm0528The other error says: D:\Programming\helloworld.asm(18) : fatal error A1010: unmatched block nesting : main

You gave _main to the proc macro and main to endp -- they need to match. Just add an underscore there. x)

##### Share on other sites
Just in case you're not aware, since it seems to come up fairly routinely, the code you have there is 16-bit DOS code. Windows will emulate it for you but it isn't native Windows code (or any other even vaguely modern OS).

I'm not saying that what you're doing is completely wasted effort, but a lot of the kind of stuff people usually start doing as a next step from that point (e.g. talking directly to "video memory") either doesn't work at all or is extremely slow because of the layers of emulation needed to get it to work.

##### Share on other sites
Quote:
 Original post by Anon MikeJust in case you're not aware, since it seems to come up fairly routinely, the code you have there is 16-bit DOS code. Windows will emulate it for you but it isn't native Windows code (or any other even vaguely modern OS).I'm not saying that what you're doing is completely wasted effort, but a lot of the kind of stuff people usually start doing as a next step from that point (e.g. talking directly to "video memory") either doesn't work at all or is extremely slow because of the layers of emulation needed to get it to work.

The tutorial I was looking at is most likely really old. I just found it on a search and saw the Hello World program.

Oxyd, when I add the underscore to the second main statement I get these:

Assembling: D:\Programming\testcode.asm
D:\Programming\testcode.asm(19) : error A2006: undefined symbol : main
D:\Programming\testcode.asm(9) : error A2004: symbol type conflict
D:\Programming\testcode.asm(19) : error A2148: invalid symbol type in expression : main

##### Share on other sites
Ok, i put an underscore infront of all the 'main' statements and I get this:

D:\Programming\testcode.asm(9) : error A2004: symbol type conflict

which marks this line of code in the editor:
mov   ax,seg message

Anyone?

##### Share on other sites
Are you sure 'seg' has to be infront of 'message'? I'm just a beginner but never saw that in my HW program...

##### Share on other sites
Quote:
 Original post by DecriusAre you sure 'seg' has to be infront of 'message'? I'm just a beginner but never saw that in my HW program...

I tried removing 'seg' and I still get errors. Oh well, I was just wanting to mess around with ASM right now but I guess I'll stick to C++.

##### Share on other sites
Wild stab in the dark, have you tried _message?

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 13
• 9
• 12
• 9
• ### Forum Statistics

• Total Topics
631438
• Total Posts
3000071
×