Compare commits

..

No commits in common. "559f25bb4e280d5dbc71961be66e73574a3f387c" and "2afa83a615ebe812f07ff5704c8f26c54618ce66" have entirely different histories.

3 changed files with 9 additions and 56 deletions

View file

@ -1,6 +1,4 @@
.{memory, buffer, log} := @use("../../../libraries/stn/src/lib.hb")
// Influenced by https://github.com/levex/osdev/blob/master/drivers/ata.c
.{memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
main := fn(): int {
// shuts down ableOS
@ -9,53 +7,7 @@ main := fn(): int {
a := memory.inb(0x4600)
b := memory.inb(0x4700)
// c := buffer.search("XNumber\0")
ata := ATA.new()
c := buffer.search("XNumber\0")
return 0
}
ATA_PRIMARY := @as(u8, @intcast(0x0))
ATA_PRIMARY_IO := @as(u8, @intcast(0x1F0))
ATA_REG_HDDEVSEL := @as(u8, @intcast(0x6))
ATA_MASTER := @as(u8, @intcast(0x0))
IDE := struct {}
ide_select_drive := fn(bus: u8, i: u8): void {
if bus == ATA_PRIMARY {
if i == ATA_MASTER {
// BUG: Causes qemu to crash
// memory.outb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xA0)
} else {
// outportb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xB0);
}
} else {
if i == ATA_MASTER {
// outportb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xA0);
} else {
// outportb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xB0)
}
}
}
identify := fn(bus: u8, drive: u8): bool {
io := 0
ide_select_drive(bus, drive)
if bus == ATA_PRIMARY {
io = ATA_PRIMARY_IO
}
return true
}
ata_probe := fn(): void {
if identify(ATA_PRIMARY, ATA_MASTER) {
}
}
ATA := struct {
new := fn(): void {
ata_probe()
}
}

View file

@ -19,6 +19,7 @@ main := fn(): int {
screen := render.init(true)
render.clear(screen, render.black)
font := @unwrap(render.text.font_from_psf2(@bitcast(&psf), false))
wallpaper := render.image.from(@bitcast(&img))
@ -30,7 +31,7 @@ main := fn(): int {
mouse_x := 100
mouse_y := 100
text_label := Label.new_label("\0", 1024)
text_label := Label.new_label("Hi\0", 1024)
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
loop {

View file

@ -25,8 +25,8 @@ resolution = "1024x768x24"
# [boot.limine.ableos.modules.render_example]
# path = "boot:///render_example.hbf"
[boot.limine.ableos.modules.diskio_driver]
path = "boot:///diskio_driver.hbf"
# [boot.limine.ableos.modules.horizon]
# path = "boot:///horizon.hbf"
[boot.limine.ableos.modules.ps2_mouse_driver]
path = "boot:///ps2_mouse_driver.hbf"
@ -37,8 +37,8 @@ path = "boot:///ps2_mouse_driver.hbf"
# [boot.limine.ableos.modules.ps2_driver]
# path = "boot:///ps2_driver.hbf"
[boot.limine.ableos.modules.sunset_client]
path = "boot:///sunset_client.hbf"
# [boot.limine.ableos.modules.sunset_client]
# path = "boot:///sunset_client.hbf"
[boot.limine.ableos.modules.sunset_server]
path = "boot:///sunset_server.hbf"