Hello I am very new to assembly(just started today) and ran into this problem when doing exactly what is said in this tutorial . I made an asm file with this text:
bits 16
org 0x7c00
jmp Main
:In= si = string, ah = 0eh, al = char, Out= character screen
Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print
Done:
ret
Main
mov si, msg
call Print
cls
hlt
msg db "Hello World",0
times 510 - ($-$$) db 0
dw 0xAA55
and in my folder with the asm file I have a copy of nasm and nasmpath, I also have a shortcut to bochs. what I am trying to do is convert it into a bin file. when I put this command:
nasm -f bin boot.asm -o boot.bin
I get this error
boot.asm:5: error: label or instruction expected at the start of line
I am wondering if this is a bad tutorial or am I typing something wrong. also I would like to know what it means by "label or instruction".
You also should put colon after Main and cls
bits 16
org 0x7c00
jmp Main
;In= si = string, ah = 0eh, al = char, Out= character screen
Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print
Done:
ret
Main:
mov si, msg
call Print
cls:
hlt
msg db "Hello World",0
times 510 - ($-$$) db 0
dw 0xAA55
You use a comment in line 5. To mark a line as comment you need a semicolon. "label or instruction" means, that each line have to be an instruction(an opcode like mov,add,...) or it have to be a label(like Print:) or a label followed by an instruction.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.