As I know, when I want to reserve a memory (variable) I do the following:
msg db 'Hello world!',0
num db 10
But what about this:
str: db "Welcome to my OS", 0
My code (Very simple bootloader):
org 0x7c00
mov bp, 0x7c00
mov sp, bp
mov ax, str
call printString
jmp $
printString:
mov al, [str]
mov ah, 0eh
int 10h
str db 'W', 0 ; <-- str must to be str:
times 510-($-$$) db 0
dw 0xaa55
:
is also used to declare variables or that is just a label?
because I use this way str:
to reserve memory in bios mode.
CodePudding user response:
This is a rudiment of a MASM/TASM feature which doesn't exist in NASM. The rudiment is that you can leave out the colon after a label name when using certain directives.
In MASM/TASM there used to be a difference between placing the colon and not placing it, but no such difference exists in NASM.