Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly NASM:`loader.s:8:错误:应为解析器:指令`_Assembly_X86_Kernel_Nasm_Osdev - Fatal编程技术网

Assembly NASM:`loader.s:8:错误:应为解析器:指令`

Assembly NASM:`loader.s:8:错误:应为解析器:指令`,assembly,x86,kernel,nasm,osdev,Assembly,X86,Kernel,Nasm,Osdev,我正在尝试使用NASM进行一些低级编程。我知道相当多的汇编代码,尝试编译我认为完美的代码会导致: loader.s:8:错误:解析器:应为指令 这里怎么了?这是我的密码: global loader ; the entry symbol of the program MAGIC_NUMBER equ 0x1BADB002 ; define the magic number constant FLAGS equ 0x0

我正在尝试使用NASM进行一些低级编程。我知道相当多的汇编代码,尝试编译我认为完美的代码会导致:
loader.s:8:错误:解析器:应为指令
这里怎么了?这是我的密码:

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\u堆栈大小中不能有任何空间

祝OSDev旅途好运。在无限循环中放置
hlt
,以使用更少的电源。(或VM中的CPU时间)。