Boch를 사용하여 부트 로더를 실행하고 https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf 4.1.문자열을 BIOS로 출력하기 비디오 메모리가 작동하지 않습니다.
비디오 콘솔에 직접 기록하여 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
'DS'의 값은 무엇입니까? – xmojmr
코드가 32 비트 보호/비현실 모드 용임을 알고 있습니까? 부트 로더는 두 번째 스 니펫에있는 것만은 아닙니다. –
16 비트 리얼 모드의 코드를 대상으로하고 있기 때문에 (부트 로더가 보호 모드로 전환하지 않았으므로) '비트 32'가 아닌 '비트 16'을 사용해야합니다. BIOS가 386 대의 컴퓨터와 대부분의 386 대의 에뮬레이터가 부팅되는 방식으로 인해 [언리얼 모드] (https://en.wikipedia.org/wiki/Unreal_mode)로 끝납니다. 16 비트 명령어가있는 데이터의 경우 32 비트 주소가있는 32 비트 레지스터를 사용할 수 있어야합니다. 이것은 물론 8086 또는 80286 프로세서 (그리고 아마도 고대 80386 하드웨어)에서 작동하지 않을 것입니다. –