1

変数に格納されているテキスト スクリーン プリント 'h' を作成しようとしています。NASMを使用しています。x86 保護モード、ゼロからのカーネル。

表示メッセージ:
        ;mov バイト[色], 0xF
        ;mov CFC、EAX;
        ;mov バイト[色], 104
        ;プッシュ 104
        ;mov バイト[esi], メッセージ
        ;lodsb
        mov ebx、メッセージ
        ebx を追加、4
        mov [メッセージ], eax
        mov バイト[0xB8000]、メッセージ
        ;mov バイト[eax]、色
        ;ポップバイト[0xB8000]
        ;mov バイト[0xB8000], バイト色
        ;移動バイト[0xB8000]、0xB500000;
        ;今すぐ戻る
        戻る
終了コード:
メッセージ: デシベル 104

表示される文字は決して正しくありません。これを行う適切な方法は何ですか?

4

2 に答える 2

9
    mov ebx, Msg ; this loads ebx with the address of Msg, OK
    add ebx, 4 ; this increments the address by 4, OK, but why?
    mov [Msg], eax ; this stores eax into the first 4 bytes of Msg, OK, but why?
    mov byte[0xB8000], Msg ; this writes the least significant byte of the
                           ; address of Msg to the screen, not OK.
                           ; Does not make any sense.

なぜそうではないのですか?:

mov al, [Msg]
mov [0xB8000], al

Msgもちろん、データ セグメントのセグメント記述子に 0 のベース アドレスがあり、あなたorgは正しいです。

于 2012-09-30T08:13:35.797 に答える