forked from koniifer/ableos
update hblang to latest git
remove old ps/2 driver remove defunct time driver clean up stuff i promise im done fiddling with ecah.rs and memory.hb
This commit is contained in:
parent
f7b970eaf0
commit
19992595fc
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -444,17 +444,17 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cbe6f98dff9960e6b070173f35cf54434b0262f6"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#641be15703153386fef1a6b083a7e00c85414df9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes#cbe6f98dff9960e6b070173f35cf54434b0262f6"
|
source = "git+https://git.ablecorp.us/ableos/holey-bytes#641be15703153386fef1a6b083a7e00c85414df9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hblang"
|
name = "hblang"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cbe6f98dff9960e6b070173f35cf54434b0262f6"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#641be15703153386fef1a6b083a7e00c85414df9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
]
|
]
|
||||||
|
@ -462,7 +462,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cbe6f98dff9960e6b070173f35cf54434b0262f6"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#641be15703153386fef1a6b083a7e00c85414df9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
]
|
]
|
||||||
|
@ -470,7 +470,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes#cbe6f98dff9960e6b070173f35cf54434b0262f6"
|
source = "git+https://git.ablecorp.us/ableos/holey-bytes#641be15703153386fef1a6b083a7e00c85414df9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
|
||||||
]
|
]
|
||||||
|
|
|
@ -111,13 +111,7 @@ pub fn handler(vm: &mut Vm) {
|
||||||
let msg_type = msg_vec[0];
|
let msg_type = msg_vec[0];
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
match msg_type {
|
match msg_type {
|
||||||
// XY\0\0V
|
|
||||||
// X = 0: Read, 1: Write
|
|
||||||
// Y = 0: 8bit, 1: 16bit, 2: 32bit
|
|
||||||
// \0 = Port
|
|
||||||
// V = Value
|
|
||||||
0 => 'wow: {
|
0 => 'wow: {
|
||||||
// info!("inb");
|
|
||||||
let size = match msg_vec[0] {
|
let size = match msg_vec[0] {
|
||||||
0 => 1,
|
0 => 1,
|
||||||
1 => 2,
|
1 => 2,
|
||||||
|
@ -128,8 +122,7 @@ pub fn handler(vm: &mut Vm) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
|
let addr = u16::from_le_bytes(msg_vec[0..2].try_into().unwrap());
|
||||||
let addr = ((msg_vec[0] as u16) << 8) | msg_vec[1] as u16;
|
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
let value = unsafe {
|
let value = unsafe {
|
||||||
|
@ -155,7 +148,7 @@ pub fn handler(vm: &mut Vm) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
let addr = ((msg_vec[0] as u16) << 8) | msg_vec[1] as u16;
|
let addr = u16::from_le_bytes(msg_vec[0..2].try_into().unwrap());
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
msg_vec.remove(0);
|
msg_vec.remove(0);
|
||||||
trace!("Setting address {}", addr);
|
trace!("Setting address {}", addr);
|
||||||
|
@ -164,14 +157,11 @@ pub fn handler(vm: &mut Vm) {
|
||||||
1 => x86_out(addr, msg_vec[0]),
|
1 => x86_out(addr, msg_vec[0]),
|
||||||
2 => x86_out_16(
|
2 => x86_out_16(
|
||||||
addr,
|
addr,
|
||||||
((msg_vec[0] as u16) << 8) | msg_vec[1] as u16,
|
u16::from_le_bytes(msg_vec[0..2].try_into().unwrap()),
|
||||||
),
|
),
|
||||||
4 => x86_out_32(
|
4 => x86_out_32(
|
||||||
addr,
|
addr,
|
||||||
((msg_vec[0] as u32) << 24)
|
u32::from_le_bytes(msg_vec[0..4].try_into().unwrap()),
|
||||||
| ((msg_vec[1] as u32) << 16)
|
|
||||||
| ((msg_vec[2] as u32) << 8)
|
|
||||||
| (msg_vec[3] as u32),
|
|
||||||
),
|
),
|
||||||
_ => panic!("How?"),
|
_ => panic!("How?"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
software := @use("rel:software.hb")
|
|
|
@ -1,16 +0,0 @@
|
||||||
.{buffer} := @use("../../stn/src/lib.hb")
|
|
||||||
|
|
||||||
test := fn(): int {
|
|
||||||
buffer_id := buffer.search("XGraphics\0")
|
|
||||||
msg := "\0"
|
|
||||||
buffer.send_message(msg, buffer_id)
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
put_pixel := fn(): int {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
sync := fn(): int {
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -40,10 +40,7 @@ outl := fn(addr: u16, value: u32): void {
|
||||||
*msg = 1;
|
*msg = 1;
|
||||||
*(msg + 1) = 2;
|
*(msg + 1) = 2;
|
||||||
*@as(^u16, @bitcast(msg + 2)) = addr;
|
*@as(^u16, @bitcast(msg + 2)) = addr;
|
||||||
*(msg + 4) = value >> 24 & 0xFF;
|
*@as(^u32, @bitcast(msg + 4)) = value
|
||||||
*(msg + 5) = value >> 16 & 0xFF;
|
|
||||||
*(msg + 6) = value >> 8 & 0xFF;
|
|
||||||
*(msg + 7) = value & 0xFF
|
|
||||||
@eca(void, 3, 3, msg, 8)
|
@eca(void, 3, 3, msg, 8)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@ FB_PIXELS := FB_WIDTH * FB_HEIGHT
|
||||||
FB_BYTES := FB_PIXELS << 2
|
FB_BYTES := FB_PIXELS << 2
|
||||||
// actual enforced max copy size is 0xFFFF, but this was faster
|
// actual enforced max copy size is 0xFFFF, but this was faster
|
||||||
MAX_COPY_SIZE := 0x1800
|
MAX_COPY_SIZE := 0x1800
|
||||||
// see stn.math.min, cant use here due to compiler bug (reg id leaked)
|
COPY_PIXELS := math.min(MAX_COPY_SIZE, FB_BYTES) >> 2
|
||||||
// COPY_PIXELS := math.min(MAX_COPY_SIZE, FB_BYTES) >> 2
|
|
||||||
COPY_PIXELS := MAX_COPY_SIZE + (FB_BYTES - MAX_COPY_SIZE & FB_BYTES - MAX_COPY_SIZE >> 31) >> 2
|
|
||||||
PARTITIONS := FB_PIXELS / COPY_PIXELS
|
PARTITIONS := FB_PIXELS / COPY_PIXELS
|
||||||
TOTAL_PAGES := 1 + FB_BYTES >> 12
|
TOTAL_PAGES := 1 + FB_BYTES >> 12
|
||||||
|
|
||||||
|
@ -35,8 +33,6 @@ create_buffer := fn(): Buffer {
|
||||||
return buffer
|
return buffer
|
||||||
}
|
}
|
||||||
create_raw_buffer := fn(): ^ColorBGRA {
|
create_raw_buffer := fn(): ^ColorBGRA {
|
||||||
// helps to trace allocation bugs
|
|
||||||
log.info("Creating buffer. This will allocate.\0")
|
|
||||||
if TOTAL_PAGES <= 0xFF {
|
if TOTAL_PAGES <= 0xFF {
|
||||||
return @bitcast(memory.request_page(TOTAL_PAGES))
|
return @bitcast(memory.request_page(TOTAL_PAGES))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# PS/2 Driver
|
|
||||||
This program is a simple driver to read keypresses from a PS/2 Keyboard
|
|
||||||
Also will contain an abstraction for the PS/2 controller in general so the Mouse code will probably also live here...maybe
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "ps2_driver"
|
|
||||||
authors = ["Talha Qamar"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,30 +0,0 @@
|
||||||
.{memory, log, string, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
|
||||||
|
|
||||||
send_byte := fn(byte: u8): u8 {
|
|
||||||
memory.outb(0x6000, byte)
|
|
||||||
return memory.inb(0x6000)
|
|
||||||
}
|
|
||||||
|
|
||||||
main := fn(): int {
|
|
||||||
log.info("PS/2 Driver Loaded\0")
|
|
||||||
if send_byte(0xEE) == 0xEE {
|
|
||||||
log.info("PS/2 Keyboard Echoed\0")
|
|
||||||
}
|
|
||||||
if send_byte(0xF4) == 0xFA {
|
|
||||||
log.info("Enabled scanning\0")
|
|
||||||
}
|
|
||||||
buf := buffer.create("XKeyboard\0")
|
|
||||||
ptr := memory.request_page(1)
|
|
||||||
prev_input := 0xFA
|
|
||||||
loop {
|
|
||||||
input := memory.inb(0x6000)
|
|
||||||
if input == prev_input {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
prev_input = input
|
|
||||||
keycode_str := string.display_int(input, ptr)
|
|
||||||
log.info(string.display_int(input, ptr))
|
|
||||||
buffer.send_message(keycode_str, buf)
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -1,7 +1,4 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb");
|
.{string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
.{string, memory, buffer} := stn
|
|
||||||
|
|
||||||
frame_buffer := @as(^u8, @bitcast(18446603339442421760))
|
|
||||||
|
|
||||||
log_info := fn(): void {
|
log_info := fn(): void {
|
||||||
a := buffer.search("XNumber\0")
|
a := buffer.search("XNumber\0")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb");
|
.{log, string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
.{log, string, memory, buffer} := stn
|
|
||||||
|
|
||||||
service_search := fn(): void {
|
service_search := fn(): void {
|
||||||
a := "\{01}\0"
|
a := "\{01}\0"
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "time_driver"
|
|
||||||
authors = ["SamBuckley"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,22 +0,0 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb")
|
|
||||||
log := stn.log
|
|
||||||
mem := stn.memory
|
|
||||||
s := stn.string
|
|
||||||
page := 0
|
|
||||||
|
|
||||||
main := fn(): void {
|
|
||||||
page += mem.request_page(1)
|
|
||||||
port_str := "\0\0\{47}\0"
|
|
||||||
a := @eca(u8, 3, 3, port_str, 4)
|
|
||||||
|
|
||||||
n := 5000000
|
|
||||||
loop {
|
|
||||||
if n == 0 break
|
|
||||||
n -= 1
|
|
||||||
stack_reclamation_edge_case := 0
|
|
||||||
}
|
|
||||||
td := s.display_int(a, page)
|
|
||||||
log.debug(td)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -23,9 +23,6 @@ resolution = "1024x768x24"
|
||||||
[boot.limine.ableos.modules.a_serial_driver]
|
[boot.limine.ableos.modules.a_serial_driver]
|
||||||
path = "boot:///a_serial_driver.hbf"
|
path = "boot:///a_serial_driver.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.ps2_driver]
|
|
||||||
path = "boot:///ps2_driver.hbf"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.diskio_driver]
|
[boot.limine.ableos.modules.diskio_driver]
|
||||||
path = "boot:///diskio_driver.hbf"
|
path = "boot:///diskio_driver.hbf"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue