开发者

Assembling an ASM file into an EXE

开发者 https://www.devze.com 2023-03-11 13:51 出处:网络
I just started learning the assembly language programming few days ago. Now I have a problem assembling the asm file into an exe. I use NASM a开发者_Go百科s my assembler. This is the command I use to

I just started learning the assembly language programming few days ago. Now I have a problem assembling the asm file into an exe. I use NASM a开发者_Go百科s my assembler. This is the command I use to assemble it:

nasm file.asm -o file.com or exe

Here is my code:

.model small
.data
.code
start:
mov ax,@data
mov ds,ax

mov ax,00h
mov bx,33h

mov ah,4ch
int 21h
end start

...but I get these errors:

boss.asm:1: error: attempt to define a local label before any non-local labels
boss.asm:1: error: parser: instruction expected
boss.asm:2: error: attempt to define a local label before any non-local labels
boss.asm:3: error: attempt to define a local label before any non-local labels
boss.asm:13: error: parser: instruction expected

I don't understand what these errors mean. How do I fix these errors?


It's been a long time but I think this can be caused by a lack of proper segment definitions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号