HBASM: no_std compatible now

This commit is contained in:
able 2023-06-26 05:18:14 -05:00
parent da1553d030
commit a63c252c7a
5 changed files with 45 additions and 9 deletions

21
Cargo.lock generated
View file

@ -13,6 +13,12 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "allocator-api2"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9"
[[package]] [[package]]
name = "beef" name = "beef"
version = "0.5.2" version = "0.5.2"
@ -70,10 +76,21 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "hashbrown"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
dependencies = [
"ahash",
"allocator-api2",
]
[[package]] [[package]]
name = "hbasm" name = "hbasm"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"hashbrown 0.14.0",
"hbbytecode", "hbbytecode",
"lasso", "lasso",
"logos", "logos",
@ -90,7 +107,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"delegate", "delegate",
"derive_more", "derive_more",
"hashbrown", "hashbrown 0.13.2",
"hbbytecode", "hbbytecode",
"log", "log",
"paste", "paste",
@ -103,7 +120,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4644821e1c3d7a560fe13d842d13f587c07348a1a05d3a797152d41c90c56df2" checksum = "4644821e1c3d7a560fe13d842d13f587c07348a1a05d3a797152d41c90c56df2"
dependencies = [ dependencies = [
"hashbrown", "hashbrown 0.13.2",
] ]
[[package]] [[package]]

View file

@ -7,6 +7,7 @@ edition = "2021"
hbbytecode = { path = "../hbbytecode" } hbbytecode = { path = "../hbbytecode" }
lasso = "0.7" lasso = "0.7"
paste = "1.0" paste = "1.0"
hashbrown = "0.14.0"
[dependencies.logos] [dependencies.logos]
version = "0.13" version = "0.13"

View file

@ -5,3 +5,14 @@ start:
-- Uses r20 to set the port -- Uses r20 to set the port
init_serial_port: init_serial_port:
add r20, r30, r10 add r20, r30, r10
li r20, 00
-- outb(PORT + 1, 0x00); // Disable all interrupts
-- outb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor)
-- outb(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud
-- outb(PORT + 1, 0x00); // (hi byte)
-- outb(PORT + 3, 0x03); // 8 bits, no parity, one stop bit
-- outb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
-- outb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
-- outb(PORT + 4, 0x1E); // Set in loopback mode, test the serial chip
-- outb(PORT + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte)

View file

@ -1,8 +1,15 @@
use std::collections::HashMap; #![no_std]
#![feature(error_in_core)]
// use std::collections::HashMap;
extern crate alloc;
use alloc::vec::Vec;
use { use {
core::fmt::{Display, Formatter},
hashbrown::HashMap,
lasso::{Rodeo, Spur}, lasso::{Rodeo, Spur},
logos::{Lexer, Logos, Span}, logos::{Lexer, Logos, Span},
std::fmt::{Display, Formatter},
}; };
macro_rules! tokendef { macro_rules! tokendef {
@ -73,12 +80,12 @@ pub struct Error {
} }
impl Display for Error { impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(f, "Error {:?} at {:?}", self.kind, self.span) write!(f, "Error {:?} at {:?}", self.kind, self.span)
} }
} }
impl std::error::Error for Error {} impl core::error::Error for Error {}
macro_rules! expect_matches { macro_rules! expect_matches {
($self:expr, $($pat:pat),* $(,)?) => {$( ($self:expr, $($pat:pat),* $(,)?) => {$(

View file

@ -1 +1 @@
stable nightly