I'm developing a Hello World kernel and bootloader...I wrote this code but when I try to compile it via NASM It says : "bootloader.asm:30: error: TIMES value -44 is negative".
bootloader.asm:
[BITS 16]
[ORG 0x7C00]
MOV DL, 0x80
MOV DH, 0x0
MOV CH, 0x0
MOV CL, 0x02
MOV BX, 0x1000
MOV ES, BX
MOV BX, 0x0
ReadFloppy:
MOV AH, 0x02
MOV AL, 0x01
INT 0x13
JC ReadFloppy
MOV AX, 0x1000
MOV DS, AX
MOV ES, AX
MOV FS, AX
MOV GS, AX
MOV SS, AX
JMP 0x1000:0x0
TIMES 510 - ($ - $$) db 0
DW 0xAA55
kernel.asm:
MOV AH, 0x0E
MOV BH, 0x00
MOV BL, 0x07
MOV SI, msg
CALL PrintString
JMP $
PrintString:
nextch:
MOV AL, [SI]
OR AL, AL
JZ exit
INT 0x10
INC SI
JMP nextch
RET
exit:
RET
msg db 'Hello world from the kernel!', 13, 10, 0
TIMES 512 - ($ - $$) db 0
I used;
nasm -f bin bootloader.asm -o bootloader.bin -p kernel.asm
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…