NASM: `loader.s : 8: error: parser: instruction expected`
NASM: `loader.s : 8: error: parser: instruction expected`
我正在尝试使用 NASM 进行一些低级编程。我知道相当多的 Assembly,并且尝试编译我认为完美的代码会导致:
loader.s:8 : error: parser: instruction expected
这里有什么问题?这是我的代码:
global loader ; the entry symbol of the program
MAGIC_NUMBER equ 0x1BADB002 ; define the magic number constant
FLAGS equ 0x0 ; multiboot flags
CHECKSUM equ -MAGIC_NUMBER ; calculate the checksum
; (magic number + checksum + flags should equal 0)
KERNEL_STACK SIZE equ 4096 ; size of stack (4096 bytes or four kilobytes)
section .bss ; bss section for uninitialized values
align 4 ; the code must be aligned by 4 bytes
kernel_stack: ; label points to the beginnning of memory
resb KERNEL_STACK_SIZE ; reserve stack for the kernel
section .text ; the text section is where code is run
align 4 ; the code must be aligned by 4 bytes
dd MAGIC_NUMBER ; write the magic number to the machine code,
dd FLAGS ; the flags number,
dd CHECKSUM ; the checksum too
loader: ; the loader label, where the programstarts executing
mov eax, 0xCAFEBABE ; move the value 0xCAFEBABE to EAX
mov esp, kernel_stack + KERNEL_STACK_SIZE ;point kernel to top of stack
.loop:
jmp .loop ; loop forever (since this is a kernel, and it has to)
打字错误。 KERNEL_STACK SIZE
中不能有space。
我正在尝试使用 NASM 进行一些低级编程。我知道相当多的 Assembly,并且尝试编译我认为完美的代码会导致:
loader.s:8 : error: parser: instruction expected
这里有什么问题?这是我的代码:
global loader ; the entry symbol of the program
MAGIC_NUMBER equ 0x1BADB002 ; define the magic number constant
FLAGS equ 0x0 ; multiboot flags
CHECKSUM equ -MAGIC_NUMBER ; calculate the checksum
; (magic number + checksum + flags should equal 0)
KERNEL_STACK SIZE equ 4096 ; size of stack (4096 bytes or four kilobytes)
section .bss ; bss section for uninitialized values
align 4 ; the code must be aligned by 4 bytes
kernel_stack: ; label points to the beginnning of memory
resb KERNEL_STACK_SIZE ; reserve stack for the kernel
section .text ; the text section is where code is run
align 4 ; the code must be aligned by 4 bytes
dd MAGIC_NUMBER ; write the magic number to the machine code,
dd FLAGS ; the flags number,
dd CHECKSUM ; the checksum too
loader: ; the loader label, where the programstarts executing
mov eax, 0xCAFEBABE ; move the value 0xCAFEBABE to EAX
mov esp, kernel_stack + KERNEL_STACK_SIZE ;point kernel to top of stack
.loop:
jmp .loop ; loop forever (since this is a kernel, and it has to)
打字错误。 KERNEL_STACK SIZE
中不能有space。