だから、Bochs を使ってブートローダーとhttps://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdfを実行しています 。
ビデオ メモリに直接書き込んで BIOS コンソールに出力しようとしていますが、Bochs を実行すると文字列が出力されません。コードは、実際には PDF のコードと同じです。何か不足していますか?忘れている Bochs の設定がありますか、それとも PDF が教えてくれませんでしたか?
関数を含むアセンブリ ファイルは次のとおりです。
;
; A simple collection of string routines for 32-bit protected mode.
;
[bits 32]
VIDEO_MEMORY equ 0xB8000
WHITE_ON_BLACK equ 0x0f ; Color mode for the text to be written
PrintString: ; Assume ebx holds memory address of string.
; edx will hold start of video memory
; Recall that each character written will take up 2 bytes of video memory
; So any particular row or column on the screen will have mem location = 0xb80000
; + 2 * (80r + c)
; The way this code is written, its always writing starting from the start of the
; video memory at 0xb8000, the top left of the screen, replacing everything there.
pusha
mov edx, VIDEO_MEMORY
PrintLoop:
mov al, [ebx] ; Only ebx can be used to index
mov ah, WHITE_ON_BLACK
cmp al, 0
je ExitRoutine
mov [edx], ax
inc ebx
add edx, 2
jmp PrintLoop
ExitRoutine:
popa
ret
これが私の実際のブートロジックです。
;
; A simple boot sector program that loops forever.
;
[bits 32]
[org 0x7c00]
mov ebx, welcome_msg
call PrintString
jmp $
%include "string_utils.s"
welcome_msg db 'WELCOME TO BASICOS OMFG!', 0
goodbye_msg db 'Goodbye! Thanks for using my BasicOS!', 0
times 510 -( $ - $$ ) db 0
dw 0xaa55