.{pci, memory, string, log} := @use("../../stn/src/lib.hb");
.{IVec2} := @use("rel:lib.hb")

Color := struct {b: u8, g: u8, r: u8, a: u8}
white := Color.(255, 255, 255, 255)
black := Color.(0, 0, 0, 255)
gray := Color.(127, 127, 127, 255)
red := Color.(0, 0, 205, 255)
green := Color.(0, 205, 0, 255)
yellow := Color.(0, 205, 205, 255)
blue := Color.(205, 0, 0, 255)
magenta := Color.(205, 0, 205, 255)
cyan := Color.(205, 205, 0, 255)
light_gray := Color.(229, 229, 229, 255)
light_red := Color.(0, 0, 255, 255)
light_green := Color.(0, 255, 0, 255)
light_yellow := Color.(0, 255, 255, 255)
light_blue := Color.(255, 0, 0, 255)
light_magenta := Color.(255, 0, 255, 255)
light_cyan := Color.(255, 255, 0, 255)

clear := fn(color: Color): void {
	return
}

width := fn(): int {
	return 0
}

height := fn(): int {
	return 0
}

dimensions := fn(): IVec2 {
	return .(0, 0)
}

put_pixel := fn(position: IVec2, color: Color): void {
	return
}

put_filled_rect := fn(pos: IVec2, tr: IVec2, color: Color): void {
	return
}

put_rect := fn(pos: IVec2, tr: IVec2, color: Color): void {
	return
}

put_line_low := fn(p0: IVec2, p1: IVec2, color: Color): void {
	return
}
// do not use, use line() instead
put_line_high := fn(p0: IVec2, p1: IVec2, color: Color): void {
	return
}

put_line := fn(p0: IVec2, p1: IVec2, color: Color): void {
	return
}

set_height := fn(new: int): void {
	return
}

set_width := fn(new: int): void {
	return
}

set_dimensions := fn(new: IVec2): void {
	return
}

sync := fn(): void {
	return
}

init := fn(): void {
	b := memory.request_page(1)
	bus := 0
	device := 0
	loop if bus == 256 break else {
		loop if device == 32 break else {
			a := pci.config_read(0, 0, 0, 0)
			log.info(string.display_int(a, b))
			device += 1
		}
		bus += 1
	}
	return
}