msp430-repl/examples/msp430-help/main.rs
John Breaux fc8f8b9622 v0.3.0: Total overhaul
- Everything has been rewritten
- Modularity is improved somewhat
  - No dependency injection in preprocessor/parser, though
- There are now early and late constant evaluation engines
  - This engine allows for by-value access to already-assembled code
  - Performs basic math operations, remainder, bitwise logic, bit shifts, negation, and bit inversion
  - Also allows for indexing into already-generated code using pointer-arithmetic syntax: `*(&main + 10)`. This is subject to change? It's clunky, and only allows word-aligned access. However, this rewrite is taking far too long, so I'll call the bikeshedding here.
  - Pretty sure this constant evaluation is computationally equivalent to Deadfish?
2024-01-30 05:27:12 -06:00

66 lines
1.9 KiB
Rust

// This example contains information adapted from the MSPGCC project's documentation.
// As such, it is licensed under the GPL, to the extent that such a thing is possible.
// https://mspgcc.sourceforge.net/manual/ln16.html
#![feature(decl_macro)]
fn main() {
println!("Hello, world!")
}
// use anes::{Color, ResetAttributes, SetForegroundColor};
// use msp430_asm::parser::preamble::*;
// use msp430_asm::preamble::*;
// use std::{
// error::Error,
// io::{stdin, IsTerminal, Write},
// };
// type AsmResult<T> = Result<T, Box<dyn Error>>;
// mod data;
// fn main() -> AsmResult<()> {
// if stdin().is_terminal() {
// hello();
// }
// repl()
// }
// fn hello() {
// println!(
// "{}{} v{}
// This software contains instruction and register descriptions adapted from
// the mspgcc project's fantastic documentation, which is licensed under the GPL.
// https://mspgcc.sourceforge.net/manual/book1.html{}\n",
// SetForegroundColor(Color::DarkGray),
// env!("CARGO_BIN_NAME"),
// env!("CARGO_PKG_VERSION"),
// ResetAttributes
// );
// }
// fn repl() -> AsmResult<()> {
// printflush!("> ");
// let mut line = String::new();
// while let Ok(len) = stdin().read_line(&mut line) {
// match len {
// 0 => break, // No newline (reached EOF)
// 1 => (), // Line is empty
// _ => {
// if line.starts_with('?') || line.starts_with("help") {
// data::list_opcodes()
// } else if let Ok(sf) = data::SyntaxFragment::try_from(line.as_str()) {
// sf.info();
// }
// }
// }
// printflush!("> ");
// line.clear();
// }
// Ok(())
// }
// macro printflush ($($x: expr),+) {
// {print!($($x),+); let _ = ::std::io::stdout().flush();}
// }