diff --git a/boot/loader/cpu/cpu.asm b/boot/loader/cpu/cpu.asm index 206097a..e9b5274 100644 --- a/boot/loader/cpu/cpu.asm +++ b/boot/loader/cpu/cpu.asm @@ -20,3 +20,12 @@ temporize: loop .looping pop rcx ret + +bitemporize: + push rcx + mov rcx, 2000 +.looping: + call temporize + loop .looping + pop rcx + ret diff --git a/boot/loader/io/ata.asm b/boot/loader/io/ata.asm index bc9c2ef..9f6aaed 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]", 0x0 +end db "[End of Sector]", 0x0A, 0x0D, 0x0 buffer: times 513 db "_" ;; TEXT @@ -42,8 +42,8 @@ buffer: times 513 db "_" ata_read: ;-----------------------------------------------------------------------; ; x64/LM ATA Reading function ; -; ; -; ; +; bl : number of sectors to read XXX ; +; bh : the first sector to read ; ;-----------------------------------------------------------------------; ; Technical infos about the ports (Intel Doc): @@ -84,22 +84,21 @@ ata_read: ; 32h write long with retry ; 33h write long without retry ; - push rax push rbx - push rdx push rcx + push rdx push rdi mov dx, 0x1f6 ; Drive and head port mov al, 0x0a0 ; Drive 0, head 0 out dx,al mov dx, 0x1f2 ; Sector count port - mov al, 1 ; Read one sector + mov al, bl ; Read bl(s) sector out dx, al mov dx, 0x1f3 ; Sector number port - mov al, 1 ; Read sector one + mov al, bh ; Read from sector n°bh out dx, al mov dx, 0x1f4 ; Cylinder low port @@ -121,18 +120,18 @@ still_going: ;is ready. mov cx, 512/2 ; One sector /2 because it copies words - mov rdi, buffer + mov rdi, QWORD buffer mov dx, 0x1f0 ; Data port - data comes in and out of here. rep insw pop rdi - pop rcx - pop rdx - pop rbx - pop rax mov bl, 0x0F mov esi, buffer call dump mov bl, 0x0A mov esi, end call write + pop rdx + pop rcx + pop rbx + pop rax ret diff --git a/boot/loader/io/rmterm.asm b/boot/loader/io/rmterm.asm index 7bedfca..62f1b8a 100644 --- a/boot/loader/io/rmterm.asm +++ b/boot/loader/io/rmterm.asm @@ -40,7 +40,7 @@ PrintB: ;---------------------------------------------------; ; Print out a simple string. ; ; ; -; Expects: DS:SI = String to print ; +; DS:SI = String to print ; ; ; ; Returns: None ; ; ; diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index 897ba5a..a2bb849 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -224,8 +224,13 @@ main64: call write call temporize ; Temporized because the ATA drive must be ready + + mov bl, 1 + mov bh, 1 call ata_read + call bitemporize ; Temporized because the ATA drive must be ready + jmp Die ; times 1024 nop diff --git a/build/bin/disk.img b/build/bin/disk.img index d3916c3..9c35852 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 39723e4..94295b3 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 39723e4..94295b3 100644 Binary files a/build/obj/boot/loader.bin and b/build/obj/boot/loader.bin differ