【问题标题】:Operation size not specified and i cant see any error [duplicate]未指定操作大小,我看不到任何错误 [重复]
【发布时间】:2022-01-23 02:05:27
【问题描述】:

为此我使用的是 Windows 10

这里是错误:

ExtendedProgram.asm:34: error: operation size not specified

这是我的汇编代码:

[org 0x7e00]

jmp EnterProtectedMode

%include "gdt.asm"
%include "print.asm"

EnterProtectedMode:
    call EnableA20
    cli
    lgdt [gdt_descriptor]
    mov eax, cr0
    or eax, 1
    mov cr0, eax
    jmp codeseg:StartProtectedMode

EnableA20:
    in al, 0x92
    or al, 2
    out 0x92, al
    ret

[bits 32]

StartProtectedMode:

    mov ax, dataseg
    mov ds, ax
    mov ss, ax
    mov es, ax
    mov fs, ax
    mov gs, ax

    mov [0xb8000], 'H'

    jmp $

times 2048-($-$$) db 0

我真的需要快速帮助,因为我想创建自己的操作系统,顺便说一下,我需要用文本填充它,否则 stackoverflow 会杀了我,因为它主要是代码

【问题讨论】:

    标签: assembly nasm


    【解决方案1】:

    好的,我自己解决了,我需要在'H'之前添加字节duhh。

    【讨论】:

    • 推荐的风格是将大小说明符放在内存操作数上,而不是立即数。这更有意义,因为内存访问宽度很重要,而不是说add eax, strict dword 1 强制将立即数编码为 imm32 而不是 imm8。不过,使用add [mem], byte 1 表示字节操作数大小确实有效,只需使用byte 而不是strict byte
    猜你喜欢
    • 2016-11-12
    • 1970-01-01
    • 2021-03-02
    • 2017-07-10
    • 2017-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多