diff --git a/blog/content/edition-3/posts/02-booting/index.md b/blog/content/edition-3/posts/02-booting/index.md index c59574ac..ab52bd01 100644 --- a/blog/content/edition-3/posts/02-booting/index.md +++ b/blog/content/edition-3/posts/02-booting/index.md @@ -1104,30 +1104,6 @@ We see that our guess that the whole screen would turn gray was right: We finally see some output from our little kernel! -You can try experimenting with the pixel bytes if you like, for example by increasing the pixel value on each loop iteration: - -```rust ,hl_lines=5-9 -// in src/kernel/main.rs - -fn kernel_main(boot_info: &'static mut BootInfo) -> ! { - if let Some(framebuffer) = boot_info.framebuffer.as_mut() { - let mut value = 0x90; - for byte in framebuffer.buffer_mut() { - *byte = value; - value = value.wrapping_add(7); - } - } - loop {} -} -``` - -We use the [`wrapping_add`] method here because Rust panics on implicit integer overflow (at least in debug mode). -The result looks as follows: - -[`wrapping_add`]: https://doc.rust-lang.org/std/primitive.u8.html#method.wrapping_add - -![QEMU showing repeating gradient columns](qemu-wrapping-add.png) - ### Booting on Real Hardware To boot on real hardware, write either the `uefi.img` or the `bios.img` disk image to an USB thumb drive. diff --git a/blog/content/edition-3/posts/02-booting/qemu-wrapping-add.png b/blog/content/edition-3/posts/02-booting/qemu-wrapping-add.png deleted file mode 100644 index fed729be..00000000 Binary files a/blog/content/edition-3/posts/02-booting/qemu-wrapping-add.png and /dev/null differ diff --git a/blog/content/edition-3/posts/03-screen-output/index.md b/blog/content/edition-3/posts/03-screen-output/index.md index 6f961418..e4862a7e 100644 --- a/blog/content/edition-3/posts/03-screen-output/index.md +++ b/blog/content/edition-3/posts/03-screen-output/index.md @@ -38,7 +38,7 @@ The complete source code for this post can be found in the [`post-3.3`][post bra In the [previous post], we learned how to make our minimal kernel bootable. Using the [`BootInfo`] provided by the bootloader, we were able to access a special memory region called the _[framebuffer]_, which controls the screen output. -We wrote some example code to display a gray stripe pattern: +We wrote some example code to display a gray background: [previous post]: @/edition-3/posts/02-booting/index.md [`BootInfo`]: https://docs.rs/bootloader_api/latest/bootloader_api/info/struct.BootInfo.html @@ -48,10 +48,8 @@ We wrote some example code to display a gray stripe pattern: fn kernel_main(boot_info: &'static mut BootInfo) -> ! { if let Some(framebuffer) = boot_info.framebuffer.as_mut() { - let mut value = 0x90; for byte in framebuffer.buffer_mut() { - *byte = value; - value = value.wrapping_add(7); + *byte = 0x90; } } loop {}