Compare commits
2 commits
2afa83a615
...
559f25bb4e
Author | SHA1 | Date | |
---|---|---|---|
Able | 559f25bb4e | ||
Able | 82b9cb1206 |
|
@ -1,4 +1,6 @@
|
||||||
.{memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
.{memory, buffer, log} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
// Influenced by https://github.com/levex/osdev/blob/master/drivers/ata.c
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
// shuts down ableOS
|
// shuts down ableOS
|
||||||
|
@ -7,7 +9,53 @@ main := fn(): int {
|
||||||
a := memory.inb(0x4600)
|
a := memory.inb(0x4600)
|
||||||
b := memory.inb(0x4700)
|
b := memory.inb(0x4700)
|
||||||
|
|
||||||
c := buffer.search("XNumber\0")
|
// c := buffer.search("XNumber\0")
|
||||||
|
ata := ATA.new()
|
||||||
return 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()
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,6 @@ main := fn(): int {
|
||||||
|
|
||||||
screen := render.init(true)
|
screen := render.init(true)
|
||||||
render.clear(screen, render.black)
|
render.clear(screen, render.black)
|
||||||
|
|
||||||
font := @unwrap(render.text.font_from_psf2(@bitcast(&psf), false))
|
font := @unwrap(render.text.font_from_psf2(@bitcast(&psf), false))
|
||||||
|
|
||||||
wallpaper := render.image.from(@bitcast(&img))
|
wallpaper := render.image.from(@bitcast(&img))
|
||||||
|
@ -31,7 +30,7 @@ main := fn(): int {
|
||||||
mouse_x := 100
|
mouse_x := 100
|
||||||
mouse_y := 100
|
mouse_y := 100
|
||||||
|
|
||||||
text_label := Label.new_label("Hi\0", 1024)
|
text_label := Label.new_label("\0", 1024)
|
||||||
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
|
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
|
@ -25,8 +25,8 @@ resolution = "1024x768x24"
|
||||||
# [boot.limine.ableos.modules.render_example]
|
# [boot.limine.ableos.modules.render_example]
|
||||||
# path = "boot:///render_example.hbf"
|
# path = "boot:///render_example.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.horizon]
|
[boot.limine.ableos.modules.diskio_driver]
|
||||||
# path = "boot:///horizon.hbf"
|
path = "boot:///diskio_driver.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.ps2_mouse_driver]
|
[boot.limine.ableos.modules.ps2_mouse_driver]
|
||||||
path = "boot:///ps2_mouse_driver.hbf"
|
path = "boot:///ps2_mouse_driver.hbf"
|
||||||
|
@ -37,8 +37,8 @@ path = "boot:///ps2_mouse_driver.hbf"
|
||||||
# [boot.limine.ableos.modules.ps2_driver]
|
# [boot.limine.ableos.modules.ps2_driver]
|
||||||
# path = "boot:///ps2_driver.hbf"
|
# path = "boot:///ps2_driver.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.sunset_client]
|
[boot.limine.ableos.modules.sunset_client]
|
||||||
# path = "boot:///sunset_client.hbf"
|
path = "boot:///sunset_client.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.sunset_server]
|
[boot.limine.ableos.modules.sunset_server]
|
||||||
path = "boot:///sunset_server.hbf"
|
path = "boot:///sunset_server.hbf"
|
||||||
|
|
Loading…
Reference in a new issue