Compare commits
15 commits
Author | SHA1 | Date | |
---|---|---|---|
peony | f023773b2e | ||
peony | b7d668c83a | ||
peony | 92bf9207b3 | ||
peony | 0da9467a0f | ||
peony | f6dd752b77 | ||
peony | 851e0bd94a | ||
peony | 38c6f6cf47 | ||
peony | 1c9ca8962e | ||
peony | 8d36083729 | ||
peony | ad351155da | ||
peony | 1039db1247 | ||
peony | fbdf737306 | ||
peony | 15c978f90f | ||
peony | 39ebaa03ba | ||
peony | de8000f596 |
|
@ -406,6 +406,8 @@ fn run(release: bool, target: Target, do_accel: bool) -> Result<(), Error> {
|
||||||
"-parallel", "none",
|
"-parallel", "none",
|
||||||
"-monitor", "none",
|
"-monitor", "none",
|
||||||
"-machine", accel,
|
"-machine", accel,
|
||||||
|
"-audiodev", "pa,id=speaker",
|
||||||
|
"-machine", "pcspk-audiodev=speaker",
|
||||||
"-cpu", "max",
|
"-cpu", "max",
|
||||||
"-device", "isa-debug-exit,iobase=0xf4,iosize=0x04",
|
"-device", "isa-debug-exit,iobase=0xf4,iosize=0x04",
|
||||||
]);
|
]);
|
||||||
|
|
0
sysdata/libraries/mouse/src/lib.hb
Normal file
0
sysdata/libraries/mouse/src/lib.hb
Normal file
|
@ -13,7 +13,6 @@
|
||||||
- Surface Operations:
|
- Surface Operations:
|
||||||
- FlipV
|
- FlipV
|
||||||
- FlipH
|
- FlipH
|
||||||
- Resize
|
|
||||||
- Wrap the colour operations
|
- Wrap the colour operations
|
||||||
- Tile
|
- Tile
|
||||||
- Gradient overlay
|
- Gradient overlay
|
||||||
|
|
|
@ -40,6 +40,7 @@ put_filled_rect := mode.put_filled_rect
|
||||||
put_line := mode.put_line
|
put_line := mode.put_line
|
||||||
clear := mode.clear
|
clear := mode.clear
|
||||||
put_surface := mode.put_surface
|
put_surface := mode.put_surface
|
||||||
|
put_scaled := mode.put_scaled
|
||||||
// thanks peony for these three!
|
// thanks peony for these three!
|
||||||
put_trirect := mode.put_trirect
|
put_trirect := mode.put_trirect
|
||||||
put_vline := mode.put_vline
|
put_vline := mode.put_vline
|
||||||
|
|
|
@ -203,6 +203,77 @@ put_surface := fn(surface: Surface, top: Surface, pos: Vec2(int), flip_v: bool):
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
put_scaled := fn(surface: Surface, source: Surface, pos: Vec2(int), size: Vec2(int)): void {
|
||||||
|
step := Vec2(int).(1, 1)
|
||||||
|
if size.x < 0 {
|
||||||
|
pos.x += source.width - 1
|
||||||
|
size.x = -size.x
|
||||||
|
step.x = -1
|
||||||
|
}
|
||||||
|
if size.y < 0 {
|
||||||
|
pos.y += source.height - 1
|
||||||
|
size.y = -size.y
|
||||||
|
step.y = -1
|
||||||
|
}
|
||||||
|
surface_idx := @inline(index, surface, pos.x, pos.y)
|
||||||
|
|
||||||
|
source_pos := Vec2(int).(0, 0)
|
||||||
|
subpixel_pos := Vec2(int).(0, 0)
|
||||||
|
step_size := size / .(source.width, source.height)
|
||||||
|
if size.x < source.width {
|
||||||
|
step_size.x = source.width / size.x
|
||||||
|
}
|
||||||
|
if size.y < source.height {
|
||||||
|
step_size.y = source.height / size.y
|
||||||
|
}
|
||||||
|
one_up_step := size / (size - step_size * .(source.width, source.height))
|
||||||
|
|
||||||
|
pos = .(0, 0)
|
||||||
|
loop if pos.y >= size.y break else {
|
||||||
|
loop if pos.x >= size.x break else {
|
||||||
|
*surface_idx = *@inline(index, source, source_pos.x, source_pos.y)
|
||||||
|
surface_idx += step.x
|
||||||
|
|
||||||
|
if size.x < source.width {
|
||||||
|
if source_pos.x % one_up_step.x == 0 {
|
||||||
|
source_pos.x += 1
|
||||||
|
}
|
||||||
|
source_pos.x += step_size.x
|
||||||
|
} else {
|
||||||
|
subpixel_pos.x += 1
|
||||||
|
if subpixel_pos.x > step_size.x | source_pos.x % one_up_step.x == 0 & subpixel_pos.x >= step_size.x {
|
||||||
|
source_pos.x += 1
|
||||||
|
subpixel_pos.x = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pos.x += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if size.y < source.height {
|
||||||
|
if source_pos.y % one_up_step.y == 0 {
|
||||||
|
source_pos.y += 1
|
||||||
|
}
|
||||||
|
source_pos.y += step_size.y
|
||||||
|
} else {
|
||||||
|
subpixel_pos.y += 1
|
||||||
|
if subpixel_pos.y > step_size.y | source_pos.y % one_up_step.y == 0 & subpixel_pos.y >= step_size.y {
|
||||||
|
source_pos.y += 1
|
||||||
|
subpixel_pos.y = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
surface_idx += surface.width * step.y - size.x * step.x
|
||||||
|
|
||||||
|
source_pos.x = 0
|
||||||
|
pos.x = 0
|
||||||
|
|
||||||
|
pos.y += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// peony-made
|
// peony-made
|
||||||
put_trirect := fn(surface: Surface, pos: Vec2(int), size: Vec2(int), color0: Color, color1: Color): void {
|
put_trirect := fn(surface: Surface, pos: Vec2(int), size: Vec2(int), color0: Color, color1: Color): void {
|
||||||
step := Vec2(int).(1, 1)
|
step := Vec2(int).(1, 1)
|
||||||
|
|
1
sysdata/libraries/sound/README.md
Normal file
1
sysdata/libraries/sound/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simple sound driver.
|
23
sysdata/libraries/sound/src/lib.hb
Normal file
23
sysdata/libraries/sound/src/lib.hb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
.{memory, log, string} := @use("../../stn/src/lib.hb")
|
||||||
|
|
||||||
|
start := fn(): void {
|
||||||
|
memory.outb(0x61, memory.inb(0x61) | 3)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
stop := fn(): void {
|
||||||
|
memory.outb(0x61, memory.inb(0x61) & 0xFC)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
set_frequency := fn(frequency: u16): void {
|
||||||
|
dfreq := 0xFFFE & 1193180 / frequency
|
||||||
|
memory.outb(0x43, 0xB6)
|
||||||
|
fmtpage := memory.request_page(1)
|
||||||
|
log.info(string.display_int(@as(u8, @intcast(dfreq) & 0xFF), fmtpage))
|
||||||
|
log.info(string.display_int(@as(u8, @intcast(dfreq >> 8) & 0xFF), fmtpage))
|
||||||
|
memory.outb(0x42, @as(u8, @intcast(dfreq) & 0xFF))
|
||||||
|
memory.outb(0x42, @as(u8, @intcast(dfreq >> 8) & 0xFF))
|
||||||
|
//memory.outb(0x20, 0x20)
|
||||||
|
return
|
||||||
|
}
|
11
sysdata/programs/mouse_driver/meta.toml
Normal file
11
sysdata/programs/mouse_driver/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "mouse_driver"
|
||||||
|
authors = ["peony"]
|
||||||
|
|
||||||
|
[dependants.libraries]
|
||||||
|
|
||||||
|
[dependants.binaries]
|
||||||
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
command = "hblang src/main.hb"
|
55
sysdata/programs/mouse_driver/src/main.hb
Normal file
55
sysdata/programs/mouse_driver/src/main.hb
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
.{memory, buffer, log, string} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
wait_for := fn(for: u8): void {
|
||||||
|
loop {
|
||||||
|
if (memory.inb(0x64) & 2 >> for) == for {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
send_info := fn(info: u8): void {
|
||||||
|
wait_for(1)
|
||||||
|
memory.outb(0x64, info)
|
||||||
|
}
|
||||||
|
|
||||||
|
send_command := fn(command: u8): void {
|
||||||
|
@inline(send_info, 0xD4)
|
||||||
|
@inline(wait_for, 1)
|
||||||
|
memory.outb(0x60, command)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
get_response := fn(): u8 {
|
||||||
|
@inline(wait_for, 0)
|
||||||
|
return memory.inb(0x60)
|
||||||
|
}
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
format_page := memory.alloc(u8, 1024)
|
||||||
|
|
||||||
|
wait_for(1)
|
||||||
|
memory.outb(0x64, 0xA8)
|
||||||
|
log.info("Aux mouse device enabled.\0")
|
||||||
|
|
||||||
|
send_command(0xF6)
|
||||||
|
get_response()
|
||||||
|
|
||||||
|
send_command(0xF4)
|
||||||
|
get_response()
|
||||||
|
|
||||||
|
loop {
|
||||||
|
loop {
|
||||||
|
if (memory.inb(0x64) & 0x21) == 0x21 break
|
||||||
|
}
|
||||||
|
status := memory.inb(0x60)
|
||||||
|
//log.info("NEGATIVE Y MOVEMENT\0\0")
|
||||||
|
log.info(string.display_int(status, format_page))
|
||||||
|
d_x := memory.inb(0x60)
|
||||||
|
log.info(string.display_int(d_x, format_page))
|
||||||
|
d_y := memory.inb(0x60)
|
||||||
|
log.info(string.display_int(d_y, format_page))
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
11
sysdata/programs/mouse_test/meta.toml
Normal file
11
sysdata/programs/mouse_test/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "mouse_test"
|
||||||
|
authors = ["peony"]
|
||||||
|
|
||||||
|
[dependants.libraries]
|
||||||
|
|
||||||
|
[dependants.binaries]
|
||||||
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
command = "hblang src/main.hb"
|
3
sysdata/programs/mouse_test/src/main.hb
Normal file
3
sysdata/programs/mouse_test/src/main.hb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
main := fn(): int {
|
||||||
|
return 0
|
||||||
|
}
|
17
sysdata/programs/render_example/src/examples/scale.hb
Normal file
17
sysdata/programs/render_example/src/examples/scale.hb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
.{Vec2} := @use("../../../../libraries/stn/src/lib.hb").math
|
||||||
|
render := @use("../../../../libraries/render/src/lib.hb")
|
||||||
|
|
||||||
|
bmp_1 := @embed("./assets/able.bmp")
|
||||||
|
bmp_2 := @embed("./assets/mini.bmp")
|
||||||
|
|
||||||
|
example := fn(): void {
|
||||||
|
screen := render.init(true)
|
||||||
|
|
||||||
|
image := render.image.surface_from_bmp(@bitcast(&bmp_2))
|
||||||
|
|
||||||
|
loop {
|
||||||
|
render.clear(screen, render.black)
|
||||||
|
render.put_scaled(screen, image, .(100, 100), .(image.width / 2 + image.width / 4, image.height * 3))
|
||||||
|
render.sync(screen)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
.{example} := @use("./examples/surface.hb")
|
.{example} := @use("./examples/scale.hb")
|
||||||
|
|
||||||
main := example
|
main := example
|
|
@ -1,13 +1,24 @@
|
||||||
.{log, string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
.{log, string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
|
sound := @use("../../../libraries/sound/src/lib.hb")
|
||||||
|
|
||||||
service_search := fn(): void {
|
service_search := fn(): void {
|
||||||
a := "\{01}\0"
|
a := "\{01}\0"
|
||||||
@eca(3, 0, a, 2)
|
@eca(3, 0, a, 2)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
beep := fn(): void {
|
||||||
|
sound.set_frequency(1024)
|
||||||
|
sound.start()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
|
//loop {
|
||||||
|
// memory.outb(0x61, memory.inb(0x61) & 0xFE | 1)
|
||||||
|
// memory.outb(0x61, memory.inb(0x61) & 0xFE)
|
||||||
|
//}
|
||||||
|
beep()
|
||||||
//service_search()
|
//service_search()
|
||||||
buf := "\0\0\0\0"
|
buf := "\0\0\0\0"
|
||||||
x := 0
|
x := 0
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
default_entry = 1
|
default_entry = 1
|
||||||
timeout = 0
|
timeout = 0
|
||||||
verbose = false
|
verbose = false
|
||||||
# interface_resolution = "1920x1080x24"
|
interface_resolution = "1600x900x24"
|
||||||
interface_resolution = "1024x768x24"
|
# interface_resolution = "640x480x32"
|
||||||
# interface_resolution = "640x480x24"
|
|
||||||
# Terminal related settings
|
# Terminal related settings
|
||||||
# term_wallpaper = "boot:///background.bmp"
|
# term_wallpaper = "boot:///background.bmp"
|
||||||
term_wallpaper = "boot:///empty-background.bmp"
|
term_wallpaper = "boot:///empty-background.bmp"
|
||||||
|
@ -16,9 +15,8 @@ comment = "Default AbleOS boot entry."
|
||||||
protocol = "limine"
|
protocol = "limine"
|
||||||
kernel_path = "boot:///kernel_${ARCH}"
|
kernel_path = "boot:///kernel_${ARCH}"
|
||||||
kernel_cmdline = ""
|
kernel_cmdline = ""
|
||||||
# resolution = "1920x1080x24"
|
# resolution = "640x480x32"
|
||||||
resolution = "1024x768x24"
|
resolution = "1600x900x24"
|
||||||
# resolution = "640x480x24"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules]
|
[boot.limine.ableos.modules]
|
||||||
|
|
||||||
|
@ -31,8 +29,8 @@ resolution = "1024x768x24"
|
||||||
# [boot.limine.ableos.modules.diskio_driver]
|
# [boot.limine.ableos.modules.diskio_driver]
|
||||||
# path = "boot:///diskio_driver.hbf"
|
# path = "boot:///diskio_driver.hbf"
|
||||||
|
|
||||||
[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.serial_driver_test]
|
# [boot.limine.ableos.modules.serial_driver_test]
|
||||||
# path = "boot:///serial_driver_test.hbf"
|
# path = "boot:///serial_driver_test.hbf"
|
||||||
|
@ -58,5 +56,8 @@ path = "boot:///render_example.hbf"
|
||||||
# [boot.limine.ableos.modules.pumpkin_print]
|
# [boot.limine.ableos.modules.pumpkin_print]
|
||||||
# path = "boot:///pumpkin_print.hbf"
|
# path = "boot:///pumpkin_print.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.tetris]
|
[boot.limine.ableos.modules.mouse_driver]
|
||||||
# path = "boot:///tetris.hbf"
|
path = "boot:///mouse_driver.hbf"
|
||||||
|
|
||||||
|
[boot.limine.ableos.modules.mouse_test]
|
||||||
|
path = "boot:///mouse_test.hbf"
|
||||||
|
|
Loading…
Reference in a new issue