diff --git a/boot/loader/io/ata.asm b/boot/loader/io/ata.asm index 9f6aaed..f075b7d 100644 --- a/boot/loader/io/ata.asm +++ b/boot/loader/io/ata.asm @@ -34,7 +34,7 @@ ;; GLOBAL DATA Bootdrv db 0 -end db "[End of Sector]", 0x0A, 0x0D, 0x0 +ended db "[End of Sector]", 0x0A, 0x0A, 0x0D, 0x0 buffer: times 513 db "_" ;; TEXT @@ -124,12 +124,19 @@ still_going: mov dx, 0x1f0 ; Data port - data comes in and out of here. rep insw pop rdi +%ifdef DEBUG mov bl, 0x0F mov esi, buffer call dump mov bl, 0x0A - mov esi, end + mov esi, ended call write + add qword [NextTRAM], 120 ; Cursor moving : 1120 = 80 * 2 * 7 lignes +%else + mov bl, 0x0A + mov esi, Pass + call write +%endif pop rdx pop rcx pop rbx diff --git a/boot/loader/io/lmterm.asm b/boot/loader/io/lmterm.asm index 3fa0ccb..427ae89 100644 --- a/boot/loader/io/lmterm.asm +++ b/boot/loader/io/lmterm.asm @@ -93,9 +93,9 @@ write: dump: ;-----------------------------------------------------------------------; -; x64/LM Dump Printing Functions ; +; x64/LM Dump 512 bytes of a buffer ; ; bl : color code ; -; esi : string address ; +; esi : buffer address ; ;-----------------------------------------------------------------------; mov edi, [NextTRAM] ; TRAM ADDRESS push rsi @@ -107,10 +107,9 @@ dump: stosb ; text subpixel mov al, bl stosb ; color subpixel - add qword [NextTRAM], 0x2 ; Cursor moving - add qword [VGA_X], 0x2 ; coord + 2 because 2 subpixels loop .pLoop pop rcx pop rdi pop rsi + add qword [NextTRAM], 1000 ; Cursor moving : 1120 = 80 * 2 * 7 lignes ret diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index a2bb849..2cfc899 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -8,6 +8,8 @@ ; (x86_64 architecture only) ; ;=----------------------------------------------------------------------------=; +%define DEBUG + [BITS 16] [ORG 0x1000] @@ -161,18 +163,23 @@ main32: [BITS 64] ;; DATA -Init db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0x09, " Checking CPUID...",0 -CPUIDD db 0x09, " Checking CPUID...", 0 -EnA20 db 0x09, " Enabling A20 line...", 0 -ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0x0A, 0x0D, 0x0A, 0x0D,0 -txt db 0x09, " Switching to Long Mode... ", 0 -Reinit db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0 -Pass db " OK", 0x0A, 0x0D, 0 -Fail db " FAIL!", 0x0A, 0x0D, 0 -msg db "The system is now in x64 mode. Is this not beautiful ?", 0x0A, 0x0D, 0 -FileNotFound db "Second Stage Error : The Kernel was not found.", 0x0A, 0x0D, 0 -DiskError db "Second Stage Error : The Disk has crashed.", 0x0A, 0x0D, 0 -filename db "KERNEL BIN" + Init db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0x09, " Checking CPUID...",0 + CPUIDD db 0x09, " Checking CPUID...", 0 + EnA20 db 0x09, " Enabling A20 line...", 0 +%ifdef DEBUG + ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0x0A, 0x0D, 0x0A, 0x0D, 0 +%else + ReadAttempt db 0x09, " Attempt to read a sector with ATA commands...", 0 +%endif + txt db 0x09, " Switching to Long Mode... ", 0 + EndOfLoader db "End of loader.bin. System will halt !", 0x0A, 0x0D, 0 + Reinit db "Booting OS/K !", 0x0D, 0x0A, 0x0D, 0x0A, 0 + Pass db " OK", 0x0A, 0x0D, 0 + Fail db " FAIL!", 0x0A, 0x0D, 0 + msg db "The system is now in x64 mode. Is this not beautiful ?", 0x0A, 0x0D, 0 + FileNotFound db "Second Stage Error : The Kernel was not found.", 0x0A, 0x0D, 0 + DiskError db "Second Stage Error : The Disk has crashed.", 0x0A, 0x0D, 0 + filename db "KERNEL BIN" %include "boot/loader/io/lmmem.asm" %include "boot/loader/io/lmterm.asm" @@ -229,10 +236,9 @@ main64: mov bh, 1 call ata_read - call bitemporize ; Temporized because the ATA drive must be ready + mov bl, 0x0D + mov esi, EndOfLoader + call write jmp Die - ; times 1024 nop - ; XXX ; - ; It seems impossible to have an executable > 2.0 kB... diff --git a/build/bin/disk.img b/build/bin/disk.img index 9c35852..20e2f58 100644 Binary files a/build/bin/disk.img and b/build/bin/disk.img differ diff --git a/build/bin/loader.bin b/build/bin/loader.bin index 94295b3..319d772 100644 Binary files a/build/bin/loader.bin and b/build/bin/loader.bin differ diff --git a/build/obj/boot/loader.bin b/build/obj/boot/loader.bin index 94295b3..319d772 100644 Binary files a/build/obj/boot/loader.bin and b/build/obj/boot/loader.bin differ