Working simulated screen. Start keyboard memory map implementation

master
Jamie Munro 1 year ago
parent 74c6ce3fe6
commit aeb5354adf
  1. 1962
      Cargo.lock
  2. 1
      Cargo.toml
  3. 4
      hack16/src/parser.rs
  4. 8
      hack16/src/translator.rs
  5. 87
      programs/Fill.asm
  6. 48
      programs/Mult.asm
  7. 87
      programs/No_KBD_Fill.asm
  8. 6
      src/main.rs
  9. 228
      src/simulator.rs
  10. 1
      target/.rustc_info.json
  11. 3
      target/CACHEDIR.TAG
  12. 0
      target/debug/.cargo-lock
  13. BIN
      target/debug/.fingerprint/hack16-92f935f468a8b88b/dep-lib-hack16
  14. 1
      target/debug/.fingerprint/hack16-92f935f468a8b88b/invoked.timestamp
  15. 1
      target/debug/.fingerprint/hack16-92f935f468a8b88b/lib-hack16
  16. 1
      target/debug/.fingerprint/hack16-92f935f468a8b88b/lib-hack16.json
  17. 5
      target/debug/.fingerprint/hack16-92f935f468a8b88b/output-lib-hack16
  18. 1
      target/debug/.fingerprint/sim-384d1e4ecdaacb6e/bin-sim
  19. 1
      target/debug/.fingerprint/sim-384d1e4ecdaacb6e/bin-sim.json
  20. BIN
      target/debug/.fingerprint/sim-384d1e4ecdaacb6e/dep-bin-sim
  21. 1
      target/debug/.fingerprint/sim-384d1e4ecdaacb6e/invoked.timestamp
  22. 13
      target/debug/.fingerprint/sim-384d1e4ecdaacb6e/output-bin-sim
  23. 10
      target/debug/deps/hack16-92f935f468a8b88b.d
  24. BIN
      target/debug/deps/libhack16-92f935f468a8b88b.rlib
  25. BIN
      target/debug/deps/libhack16-92f935f468a8b88b.rmeta
  26. BIN
      target/debug/deps/sim-384d1e4ecdaacb6e
  27. 6
      target/debug/deps/sim-384d1e4ecdaacb6e.d
  28. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/10fcp6tzq1x8ubf3.o
  29. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/11sq9i9evk7k045f.o
  30. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/13v3a8ppzycpsxqc.o
  31. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/17xh9yzu5becir5t.o
  32. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1a1505kwlotbzj4z.o
  33. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1atexyet8if1ldk.o
  34. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1bikkp7rwyt3b0m4.o
  35. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1cxsaoo19n49gxf0.o
  36. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1dc1j2c8km4wtd53.o
  37. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1dx0ci7t3pa724et.o
  38. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1eclpzwuoe27tf02.o
  39. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1hty0gixfg5etqa5.o
  40. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1hxafbqit0a48xh8.o
  41. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1kmiyzqs4eozyo46.o
  42. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1lkcc0c2z86ze1cv.o
  43. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1n9whw03oppiqqa5.o
  44. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1nsr1dxn8ikdhw5i.o
  45. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1qezfrookidjkut8.o
  46. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1vxk97m78h95eshc.o
  47. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1wadh33cberqx8rr.o
  48. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1xqi4evkd4k76oeg.o
  49. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1yn71k6elm5s1c8w.o
  50. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/1zjeyp4mp0yf3vxb.o
  51. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/209f7il8u1oartmh.o
  52. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/20brtpbj0jr2t369.o
  53. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/20vr9pf2jfw1kbi3.o
  54. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/23k36l4m8kkaxjbn.o
  55. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/29ilw1ewkn31vbnq.o
  56. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2bp8blgihkwbaj78.o
  57. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2dcm327laxrrvyi6.o
  58. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2iswvlbn09qznp02.o
  59. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2jz37lxphlfkmka0.o
  60. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2khgd19pzvxoaorq.o
  61. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2n3qvmdg9ttpkuhm.o
  62. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2qnd3kiyb20wt9cm.o
  63. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2sse772ogic68bzd.o
  64. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2tgnow18oy069e8m.o
  65. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2x7ljg2g26o7zlbr.o
  66. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2xzcpzcihkzugr81.o
  67. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2z074psoazt0iwt2.o
  68. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2zwhhjammaq1p3fp.o
  69. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/2zzx85pd0vmyr4ir.o
  70. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/31nabwtrx7fdtrrg.o
  71. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/33qfwtilupaaigrh.o
  72. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/38qptu7fm404xmxr.o
  73. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/391lxzy5eawtna77.o
  74. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3kdv6i20zuxxu5w2.o
  75. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3l7j7dh1n5yeaeox.o
  76. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3lda3o6862mea79d.o
  77. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3mu9ikvvnll8unns.o
  78. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3nbctn1hu3ltz2jz.o
  79. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3or92954nfvzg0rx.o
  80. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3r4b7jheut5b9oqf.o
  81. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3t6me79zzqx0wae5.o
  82. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3x9uq35z58qo1x2n.o
  83. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/3z5rqz4jxi668tvv.o
  84. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4016vp8xbtt3yper.o
  85. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/41jams6xd9yt40ry.o
  86. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4303yuq9dhrf1bf.o
  87. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/46d0hexiz143jg87.o
  88. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/46kb1zfsm05jvpoa.o
  89. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/47x6mhlv9969k62w.o
  90. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4dfsp4dhjo618zpd.o
  91. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4dyb4i12dn7qwk6n.o
  92. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4ei1b7l4pwzwrog7.o
  93. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4f0rbbl64zm69bo9.o
  94. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4hivociimih2olta.o
  95. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4i9zq7f8593eg32r.o
  96. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4irwsfmxf095p916.o
  97. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4iw4gx2g4tyexktu.o
  98. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4jh5wl6os693fcci.o
  99. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4jr9dvth09rvzpl3.o
  100. BIN
      target/debug/incremental/hack16-149ho8c76qgw9/s-g8v4hn94ne-190e3re-23g4wcz3qegul/4lhooqxhmduuocqt.o
  101. Some files were not shown because too many files have changed in this diff Show More

1962
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -9,3 +9,4 @@ edition = "2021"
[dependencies]
hack16 = { path = "hack16" }
piston_window = "*"

@ -1,6 +1,6 @@
#[derive(Debug, Clone)]
pub enum Instruction {
A{val: u32},
A{val: i16},
C{dest:String, comp:String, jump:String},
}
@ -24,7 +24,7 @@ pub fn parse(lines : Vec<(usize, String)>) -> Vec<(usize,Instruction)> {
fn line_to_instruction(line: String) -> Option<Instruction> {
if &line[0..1] == "@" {
//A instruction
let value :u32 = match line[1..].trim().parse() {
let value :i16 = match line[1..].trim().parse() {
Err(_) => return None,
Ok(val) => val,
};

@ -61,7 +61,7 @@ fn translate_instruction(instruction: Instruction) -> Option<Code> {
}
}
fn encode_val(val: u32) -> Option<String> {
fn encode_val(val: i16) -> Option<String> {
if val > 32767 {
None
}
@ -74,7 +74,7 @@ fn encode_val(val: u32) -> Option<String> {
while place > 0 {
place -= 1;
let x = u32::pow(2, place);
let x = i16::pow(2, place);
if total + x <= val {
bin.push_str("1");
total += x;
@ -145,7 +145,7 @@ fn encode_comp(comp: String) -> Option<String> {
"A+1" => Some(String::from("0110111")),
"D-1" => Some(String::from("0001110")),
"A-1" => Some(String::from("0110010")),
("D+A") | ("A+D") => Some(String::from("0000010")),
"D+A" | "A+D" => Some(String::from("0000010")),
"D-A" => Some(String::from("0010011")),
"A-D" => Some(String::from("0000111")),
"D&A" => Some(String::from("0000000")),
@ -156,7 +156,7 @@ fn encode_comp(comp: String) -> Option<String> {
"-M" => Some(String::from("1110011")),
"M+1" => Some(String::from("1110111")),
"M-1" => Some(String::from("1110010")),
("D+M") | ("M+D") => Some(String::from("1000010")),
"D+M" | "M+D" => Some(String::from("1000010")),
"D-M" => Some(String::from("1010011")),
"M-D" => Some(String::from("1000111")),
"D&M" => Some(String::from("1000000")),

@ -0,0 +1,87 @@
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel;
// the screen should remain fully black as long as the key is pressed.
// When no key is pressed, the program clears the screen, i.e. writes
// "white" in every pixel;
// the screen should remain fully clear as long as no key is pressed.
// Put your code here.
//initialise R0 to point at start of screen
(START)
@SCREEN
D=A
@R0
M=D
//check if a key is pressed
(CHECK)
@KBD
D=M
//if not:
//jump to no key
@NOKEY
D;JEQ
//if so:
//blacken pixel at R0
@32767
D=A
@R0
A=M
M=D
//increment R0
@R0
M=M+1
//check if R0 != 24576 (end of screen)
@24576
D=A
@R0
D=D-M
//if so:
//jump back to check
@CHECK
D;JNE
//otherwise:
//jump back to start (reset R)
@START
0;JMP
(NOKEY)
//check if R0 == SCREEN
@SCREEN
D=A
@R0
D=D-M
//if so:
//jump back to check
@CHECK
D;JEQ
//otherwise:
//deincrement R0
@R0
M=M-1
//whiten pixel at R0
@0
D=A
@R0
A=M
M=D
//jump back to check
@CHECK
0;JMP

@ -0,0 +1,48 @@
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
//
// This program only needs to handle arguments that satisfy
// R0 >= 0, R1 >= 0, and R0*R1 < 32768.
// Put your code here.
//initialise i to 0
@i
M=0
//initalise R2 to 0
@R2
M=0
(LOOP)
//jump to end if i-R1>= 0
@i
D=M
@R1
D=D-M
@END
D;JGE
//increment i
@i
M=M+1
//R2 = R2+R0
@R0
D=M
@R2
M=M+D
//jump to start of loop
@LOOP
0;JMP
(END)
@END
0;JMP

@ -0,0 +1,87 @@
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel;
// the screen should remain fully black as long as the key is pressed.
// When no key is pressed, the program clears the screen, i.e. writes
// "white" in every pixel;
// the screen should remain fully clear as long as no key is pressed.
// Put your code here.
//initialise R0 to point at start of screen
(START)
@SCREEN
D=A
@R0
M=D
//check if a key is pressed
(CHECK)
//@KBD
//D=M
//if not:
//jump to no key
//@NOKEY
//D;JEQ
//if so:
//blacken pixel at R0
@32767
D=A
@R0
A=M
M=D
//increment R0
@R0
M=M+1
//check if R0 != 24576 (end of screen)
@24576
D=A
@R0
D=D-M
//if so:
//jump back to check
@CHECK
D;JNE
//otherwise:
//jump back to start (reset R)
@START
0;JMP
(NOKEY)
//check if R0 == SCREEN
@SCREEN
D=A
@R0
D=D-M
//if so:
//jump back to check
@CHECK
D;JEQ
//otherwise:
//deincrement R0
@R0
M=M-1
//whiten pixel at R0
@0
D=A
@R0
A=M
M=D
//jump back to check
@CHECK
0;JMP

@ -5,7 +5,7 @@ mod simulator;
fn main() {
let args: Vec<String> = std::env::args().collect();
if args.len() != 2 {
if args.len() < 2 {
println!("USAGE: sim [path/to/prog.asm]");
return;
}
@ -19,12 +19,12 @@ fn main() {
let mut machine = simulator::Machine::new();
machine.load_rom(instructions);
machine.set_debug(true);
machine.set_debug(false);
machine.set_ram(0, 4);
machine.set_ram(1, 5);
let final_state = machine.start(1000);
let final_state = machine.start(100000);
println!("{:?}", &final_state[0..15]);
}

@ -1,74 +1,119 @@
use piston_window::*;
use hack16::{parser::Instruction};
pub const MEM_SIZE: usize = 24576;
pub const MEM_SIZE: usize = 24577;
pub const ROM_SIZE: usize= 32767;
pub const SCREEN_WIDTH: u32 = 512;
pub const SCREEN_HEIGHT: u32 = 256;
pub const SCREEN: u32 = 16384;
pub const KBD: u32 = 24576;
pub struct Machine {
A:i16,
D:i16,
PC:i16,
a:i16,
d:i16,
pc:i16,
out:i16,
RAM: [i16; MEM_SIZE],
ROM: Vec<Instruction>,
ram: [i16; MEM_SIZE],
rom: Vec<Instruction>,
screen: PistonWindow,
debug: bool,
}
impl Machine {
pub fn new() -> Machine {
let RAM = [0; MEM_SIZE];
let ROM:Vec<Instruction> = Vec::new();
let ram = [0; MEM_SIZE];
let rom:Vec<Instruction> = Vec::new();
let screen: PistonWindow =
WindowSettings::new("Simulated Screen", [SCREEN_WIDTH, SCREEN_HEIGHT])
.exit_on_esc(false)
.resizable(false)
.automatic_close(false)
.decorated(false)
.build().unwrap();
Machine {
A:0,
D: 0,
PC: 0,
a:0,
d: 0,
pc: 0,
out:0,
RAM,
ROM,
ram,
rom,
screen,
debug:false,
}
}
pub fn load_rom(&mut self, instructions: Vec<(usize,Instruction)>) {
if instructions.len() > ROM_SIZE {
panic!("Too many instructions for ROM");
panic!("Too many instructions for rom");
}
for (_ ,instruction) in instructions {
self.ROM.push(instruction);
self.rom.push(instruction);
}
}
pub fn set_ram(&mut self, address: usize, value: i16) {
self.RAM[address] = value;
self.ram[address] = value;
}
pub fn start(&mut self, max_iter: usize) -> [i16; MEM_SIZE] {
for _ in 0..max_iter {
let PC = usize::try_from(self.PC).expect("Invalid value in PC!");
let pc = usize::try_from(self.pc).expect("Invalid value in pc!");
if pc < self.rom.len() {
//get next instruction
let instruction = self.rom[pc].clone();
//execute instruction
self.execute(&instruction);
//get window event
let event = match self.screen.next() {
Some(event) => event,
None => panic!("No window"),
};
//update keyboard memory map
if let Some(key) = event.button_args() {
if key.state == ButtonState::Press {
self.update_keyboard(key.button);
}
}
if self.debug {println!("instruction: {:?}", self.ROM[PC]);}
//only update the screen if the screen memory map has been modified
match instruction {
Instruction::C{dest, ..} => {
if dest.contains("M") && self.a >= SCREEN as i16 {
self.update_screen(event);
}
},
_ => {},
}
if PC < self.ROM.len() {
self.execute(self.ROM[PC].clone());
//debug info
if self.debug {println!("instruction: {:?}", self.rom[pc]);}
if self.debug {
self.print_state();
println!("");
}
}
else {
panic!("PC out of range!");
}
if self.debug {
self.print_state();
println!("");
panic!("pc out of range!");
}
}
self.RAM
self.screen.set_should_close(true);
self.ram
}
pub fn execute(&mut self, instruction: Instruction) {
pub fn execute(&mut self, instruction: &Instruction) {
match instruction {
Instruction::A{val} => {
self.execute_a(val.try_into().unwrap());
self.execute_a(*val);
},
Instruction::C{dest, comp, jump} => {
self.execute_comp(comp);
@ -79,63 +124,64 @@ impl Machine {
}
pub fn print_state(&mut self) -> () {
let addr = usize::try_from(self.A).expect("Invalid A value!");
println!("State: A: {}, D: {}, M: {}, out: {}, PC: {}", self.A, self.D, self.RAM[addr], self.out, self.PC);
let addr = usize::try_from(self.a).expect("Invalid A value!");
println!("State: A: {}, D: {}, M: {}, out: {}, pc: {}", self.a, self.d, self.ram[addr], self.out, self.pc);
}
pub fn set_debug(&mut self, val: bool) {
self.debug = val;
}
}
fn execute_a(&mut self, val: i16) {
if val < 0 {
panic!("A instruction value out of range! @[val] < 32768.");
}
else {
self.A = val;
self.a = val;
}
self.PC += 1;
self.pc += 1;
}
fn execute_comp(&mut self, comp: String) {
let addr = usize::try_from(self.A).expect("Invalid A value!");
fn execute_comp(&mut self, comp: &str) {
let addr = usize::try_from(self.a).expect("Invalid A value!");
match comp.as_str() {
match comp {
"0" => self.out = 0,
"1" => self.out = 1,
"-1" => self.out = -1,
"D" => self.out = self.D,
"A" => self.out = self.A,
"!D" => self.out = !self.D,
"!A" => self.out = !self.A,
"-D" => self.out = 0 - self.D,
"-A" => self.out = 0 - self.A,
"D+1" => self.out = self.D + 1,
"A+1" => self.out = self.A + 1,
"D-1" => self.out = self.D - 1,
"A-1" => self.out = self.A - 1,
("D+A") | ("A+D") => self.out = self.D + self.A,
"D-A" => self.out = self.D - self.A,
"A-D" => self.out = self.A - self.D,
"D&A" => self.out = self.D & self.A,
"D|A" => self.out = self.D | self.A,
"M" => self.out = self.RAM[addr],
"!M" => self.out = !self.RAM[addr],
"-M" => self.out = 0 - self.RAM[addr],
"M+1" => self.out = self.RAM[addr] + 1,
"M-1" => self.out = self.RAM[addr] - 1,
("D+M") | ("M+D") => self.out = self.D + self.RAM[addr],
"D-M" => self.out = self.D - self.RAM[addr],
"M-D" => self.out = self.RAM[addr] - self.D,
"D&M" => self.out = self.D & self.RAM[addr],
"D|M" => self.out = self.D & self.RAM[addr],
"D" => self.out = self.d,
"A" => self.out = self.a,
"!D" => self.out = !self.d,
"!A" => self.out = !self.a,
"-D" => self.out = 0 - self.d,
"-A" => self.out = 0 - self.a,
"D+1" => self.out = self.d + 1,
"A+1" => self.out = self.a + 1,
"D-1" => self.out = self.d - 1,
"A-1" => self.out = self.a - 1,
"D+A" | "A+D" => self.out = self.d + self.a,
"D-A" => self.out = self.d - self.a,
"A-D" => self.out = self.a - self.d,
"D&A" => self.out = self.d & self.a,
"D|A" => self.out = self.d | self.a,
"M" => self.out = self.ram[addr],
"!M" => self.out = !self.ram[addr],
"-M" => self.out = 0 - self.ram[addr],
"M+1" => self.out = self.ram[addr] + 1,
"M-1" => self.out = self.ram[addr] - 1,
"D+M" | "M+D" => self.out = self.d + self.ram[addr],
"D-M" => self.out = self.d - self.ram[addr],
"M-D" => self.out = self.ram[addr] - self.d,
"D&M" => self.out = self.d & self.ram[addr],
"D|M" => self.out = self.d & self.ram[addr],
_ => panic!("Unrecognised comp instruction: \"{}\"!", comp),
};
}
fn execute_dest(&mut self, dest: String) {
let addr = usize::try_from(self.A).expect("Invalid A value!");
fn execute_dest(&mut self, dest: &str) {
let addr = usize::try_from(self.a).expect("Invalid A value!");
let dest = String::from(dest);
if dest.len() == 0 {
return;
@ -146,17 +192,17 @@ impl Machine {
else if dest.chars().all(|x| x == 'A' || x == 'D' || x == 'M') {
// A Register
if dest.contains("A") {
self.A = self.out;
self.a = self.out;
}
//D register
if dest.contains("D") {
self.D = self.out;
self.d = self.out;
}
//M register
if dest.contains("M") {
self.RAM[addr] = self.out;
self.ram[addr] = self.out;
}
}
else {
@ -164,33 +210,61 @@ impl Machine {
}
}
fn execute_jump(&mut self, jump: String) {
self.PC += 1;
fn execute_jump(&mut self, jump: &str) {
self.pc += 1;
match jump.as_str() {
match jump {
"JGT" => {
if self.out > 0 {self.PC = self.A;}
if self.out > 0 {self.pc = self.a;}
},
"JEQ" => {
if self.out == 0 {self.PC = self.A;}
if self.out == 0 {self.pc = self.a;}
},
"JGE" => {
if self.out >= 0 {self.PC = self.A;}
if self.out >= 0 {self.pc = self.a;}
},
"JLT" => {
if self.out < 0 {self.PC = self.A;}
if self.out < 0 {self.pc = self.a;}
},
"JNE" => {
if self.out != 0 {self.PC = self.A;}
if self.out != 0 {self.pc = self.a;}
},
"JLE" => {
if self.out <= 0 {self.PC = self.A;}
if self.out <= 0 {self.pc = self.a;}
},
"JMP" => {
self.PC = self.A;
self.pc = self.a;
},
"" => (),
_ => panic!("Unrecognised jump instruction: \"{}\"!", jump),
};
}
fn update_screen(&mut self, event: Event) {
self.screen.draw_2d(&event, |context, graphics, _device| {
//clear display
clear([1.0; 4], graphics);
for row in 0..SCREEN_HEIGHT {
for col in 0..SCREEN_WIDTH {
let word = self.ram[(SCREEN + (row * 32) + (col / 16)) as usize];
let bit = col % 16;
if word & (1 << bit) != 0 {
rectangle(color::BLACK,
[col as f64, row as f64, col as f64 + 1.0, row as f64 + 1.0],
context.transform,
graphics);
}
}
}
});
}
fn update_keyboard(&mut self, key: Button) {
match key {
Button::Keyboard(Key::Up) => println!("up!"),
_ => (),
}
}
}

@ -1 +0,0 @@
{"rustc_fingerprint":7437628601159509931,"outputs":{"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.57.0\nbinary: rustc\ncommit-hash: unknown\ncommit-date: unknown\nhost: x86_64-unknown-linux-gnu\nrelease: 1.57.0\nLLVM version: 13.0.0\n","stderr":""},"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/usr\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"15537503139010883884":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""}},"successes":{}}

@ -1,3 +0,0 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/

@ -1 +0,0 @@
This file has an mtime of when this was started.

@ -1 +0,0 @@
{"rustc":17278786309488306807,"features":"[]","target":9946130396266312125,"profile":9251013656241001069,"path":7356247636524780384,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/hack16-92f935f468a8b88b/dep-lib-hack16"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

@ -1,5 +0,0 @@
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"hack16/src/translator.rs","byte_start":3639,"byte_end":3640,"line_start":148,"line_end":148,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":3645,"byte_end":3646,"line_start":148,"line_end":148,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_parens)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"hack16/src/translator.rs","byte_start":3639,"byte_end":3640,"line_start":148,"line_end":148,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":3645,"byte_end":3646,"line_start":148,"line_end":148,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0mhack16/src/translator.rs:148:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m148\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_parens)]` on by default\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m148\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"D+A\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m | (\"A+D\") => Some(String::from(\"0000010\")),\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m148\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m \"D+A\" | (\"A+D\") => Some(String::from(\"0000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"hack16/src/translator.rs","byte_start":3649,"byte_end":3650,"line_start":148,"line_end":148,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":3655,"byte_end":3656,"line_start":148,"line_end":148,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"hack16/src/translator.rs","byte_start":3649,"byte_end":3650,"line_start":148,"line_end":148,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":3655,"byte_end":3656,"line_start":148,"line_end":148,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0mhack16/src/translator.rs:148:19\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m148\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+A\") | (\"A+D\") => Some(String::from(\"0000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m148\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m (\"D+A\") | \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"A+D\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m => Some(String::from(\"0000010\")),\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m148\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m (\"D+A\") | \"A+D\" => Some(String::from(\"0000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"hack16/src/translator.rs","byte_start":4141,"byte_end":4142,"line_start":159,"line_end":159,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":4147,"byte_end":4148,"line_start":159,"line_end":159,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"hack16/src/translator.rs","byte_start":4141,"byte_end":4142,"line_start":159,"line_end":159,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":4147,"byte_end":4148,"line_start":159,"line_end":159,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0mhack16/src/translator.rs:159:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m159\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m159\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"D+M\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m | (\"M+D\") => Some(String::from(\"1000010\")),\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m159\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m \"D+M\" | (\"M+D\") => Some(String::from(\"1000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"hack16/src/translator.rs","byte_start":4151,"byte_end":4152,"line_start":159,"line_end":159,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":4157,"byte_end":4158,"line_start":159,"line_end":159,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"hack16/src/translator.rs","byte_start":4151,"byte_end":4152,"line_start":159,"line_end":159,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"hack16/src/translator.rs","byte_start":4157,"byte_end":4158,"line_start":159,"line_end":159,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0mhack16/src/translator.rs:159:19\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m159\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+M\") | (\"M+D\") => Some(String::from(\"1000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m159\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m (\"D+M\") | \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"M+D\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m => Some(String::from(\"1000010\")),\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m159\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m (\"D+M\") | \"M+D\" => Some(String::from(\"1000010\")),\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"4 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 4 warnings emitted\u001b[0m\n\n"}

@ -1 +0,0 @@
{"rustc":17278786309488306807,"features":"[]","target":1897382851984237091,"profile":9251013656241001069,"path":1036222786711178230,"deps":[[12504305855290076067,"hack16",false,11595368920804033364]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/sim-384d1e4ecdaacb6e/dep-bin-sim"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

@ -1 +0,0 @@
This file has an mtime of when this was started.

@ -1,13 +0,0 @@
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":3120,"byte_end":3121,"line_start":118,"line_end":118,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/simulator.rs","byte_start":3126,"byte_end":3127,"line_start":118,"line_end":118,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_parens)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":3120,"byte_end":3121,"line_start":118,"line_end":118,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/simulator.rs","byte_start":3126,"byte_end":3127,"line_start":118,"line_end":118,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:118:13\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m118\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_parens)]` on by default\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m118\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"D+A\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m | (\"A+D\") => self.out = self.D + self.A,\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m118\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m \"D+A\" | (\"A+D\") => self.out = self.D + self.A,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":3130,"byte_end":3131,"line_start":118,"line_end":118,"column_start":23,"column_end":24,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":23,"highlight_end":24}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/simulator.rs","byte_start":3136,"byte_end":3137,"line_start":118,"line_end":118,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":3130,"byte_end":3131,"line_start":118,"line_end":118,"column_start":23,"column_end":24,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":23,"highlight_end":24}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/simulator.rs","byte_start":3136,"byte_end":3137,"line_start":118,"line_end":118,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:118:23\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m118\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+A\") | (\"A+D\") => self.out = self.D + self.A,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m118\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m (\"D+A\") | \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"A+D\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m => self.out = self.D + self.A,\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m118\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m (\"D+A\") | \"A+D\" => self.out = self.D + self.A,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":3626,"byte_end":3627,"line_start":128,"line_end":128,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/simulator.rs","byte_start":3632,"byte_end":3633,"line_start":128,"line_end":128,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":3626,"byte_end":3627,"line_start":128,"line_end":128,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/simulator.rs","byte_start":3632,"byte_end":3633,"line_start":128,"line_end":128,"column_start":19,"column_end":20,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":19,"highlight_end":20}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:128:13\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m128\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m128\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"D+M\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m | (\"M+D\") => self.out = self.D + self.RAM[addr],\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m128\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m \"D+M\" | (\"M+D\") => self.out = self.D + self.RAM[addr],\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"unnecessary parentheses around pattern","code":{"code":"unused_parens","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":3636,"byte_end":3637,"line_start":128,"line_end":128,"column_start":23,"column_end":24,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":23,"highlight_end":24}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/simulator.rs","byte_start":3642,"byte_end":3643,"line_start":128,"line_end":128,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":3636,"byte_end":3637,"line_start":128,"line_end":128,"column_start":23,"column_end":24,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":23,"highlight_end":24}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/simulator.rs","byte_start":3642,"byte_end":3643,"line_start":128,"line_end":128,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unnecessary parentheses around pattern\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:128:23\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m128\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m (\"D+M\") | (\"M+D\") => self.out = self.D + self.RAM[addr],\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: remove these parentheses\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m128\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m (\"D+M\") | \u001b[0m\u001b[0m\u001b[38;5;9m(\u001b[0m\u001b[0m\"M+D\"\u001b[0m\u001b[0m\u001b[38;5;9m)\u001b[0m\u001b[0m => self.out = self.D + self.RAM[addr],\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m128\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m (\"D+M\") | \"M+D\" => self.out = self.D + self.RAM[addr],\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\n\n"}
{"message":"structure field `A` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":131,"byte_end":132,"line_start":7,"line_end":7,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":" A:i16,","highlight_start":5,"highlight_end":6}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(non_snake_case)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":131,"byte_end":132,"line_start":7,"line_end":7,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":" A:i16,","highlight_start":5,"highlight_end":6}],"label":null,"suggested_replacement":"a","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: structure field `A` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:7:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m7\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m A:i16,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `a`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(non_snake_case)]` on by default\u001b[0m\n\n"}
{"message":"structure field `D` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":142,"byte_end":143,"line_start":8,"line_end":8,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":" D:i16,","highlight_start":5,"highlight_end":6}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":142,"byte_end":143,"line_start":8,"line_end":8,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":" D:i16,","highlight_start":5,"highlight_end":6}],"label":null,"suggested_replacement":"d","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: structure field `D` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:8:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m8\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m D:i16,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `d`\u001b[0m\n\n"}
{"message":"structure field `PC` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":153,"byte_end":155,"line_start":9,"line_end":9,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":" PC:i16,","highlight_start":5,"highlight_end":7}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":153,"byte_end":155,"line_start":9,"line_end":9,"column_start":5,"column_end":7,"is_primary":true,"text":[{"text":" PC:i16,","highlight_start":5,"highlight_end":7}],"label":null,"suggested_replacement":"pc","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: structure field `PC` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:9:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m9\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m PC:i16,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `pc`\u001b[0m\n\n"}
{"message":"structure field `RAM` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":178,"byte_end":181,"line_start":11,"line_end":11,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" RAM: [i16; MEM_SIZE],","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":178,"byte_end":181,"line_start":11,"line_end":11,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" RAM: [i16; MEM_SIZE],","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":"ram","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: structure field `RAM` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:11:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m11\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m RAM: [i16; MEM_SIZE],\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `ram`\u001b[0m\n\n"}
{"message":"structure field `ROM` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":204,"byte_end":207,"line_start":12,"line_end":12,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" ROM: Vec<Instruction>,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":204,"byte_end":207,"line_start":12,"line_end":12,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" ROM: Vec<Instruction>,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":"rom","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: structure field `ROM` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:12:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m12\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m ROM: Vec<Instruction>,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `rom`\u001b[0m\n\n"}
{"message":"variable `RAM` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":304,"byte_end":307,"line_start":18,"line_end":18,"column_start":13,"column_end":16,"is_primary":true,"text":[{"text":" let RAM = [0; MEM_SIZE];","highlight_start":13,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":304,"byte_end":307,"line_start":18,"line_end":18,"column_start":13,"column_end":16,"is_primary":true,"text":[{"text":" let RAM = [0; MEM_SIZE];","highlight_start":13,"highlight_end":16}],"label":null,"suggested_replacement":"ram","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variable `RAM` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:18:13\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m18\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let RAM = [0; MEM_SIZE];\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `ram`\u001b[0m\n\n"}
{"message":"variable `ROM` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":337,"byte_end":340,"line_start":19,"line_end":19,"column_start":13,"column_end":16,"is_primary":true,"text":[{"text":" let ROM:Vec<Instruction> = Vec::new();","highlight_start":13,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":337,"byte_end":340,"line_start":19,"line_end":19,"column_start":13,"column_end":16,"is_primary":true,"text":[{"text":" let ROM:Vec<Instruction> = Vec::new();","highlight_start":13,"highlight_end":16}],"label":null,"suggested_replacement":"rom","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variable `ROM` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:19:13\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m19\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let ROM:Vec<Instruction> = Vec::new();\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `rom`\u001b[0m\n\n"}
{"message":"variable `PC` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/simulator.rs","byte_start":1039,"byte_end":1041,"line_start":48,"line_end":48,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let PC = usize::try_from(self.PC).expect(\"Invalid value in PC!\");","highlight_start":17,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"convert the identifier to snake case","code":null,"level":"help","spans":[{"file_name":"src/simulator.rs","byte_start":1039,"byte_end":1041,"line_start":48,"line_end":48,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let PC = usize::try_from(self.PC).expect(\"Invalid value in PC!\");","highlight_start":17,"highlight_end":19}],"label":null,"suggested_replacement":"pc","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variable `PC` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/simulator.rs:48:17\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m48\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let PC = usize::try_from(self.PC).expect(\"Invalid value in PC!\");\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: convert the identifier to snake case: `pc`\u001b[0m\n\n"}
{"message":"12 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 12 warnings emitted\u001b[0m\n\n"}

@ -1,10 +0,0 @@
/home/jbm/Projects/Elements/projects/sim/target/debug/deps/hack16-92f935f468a8b88b.rmeta: hack16/src/lib.rs hack16/src/preprocessor.rs hack16/src/parser.rs hack16/src/translator.rs
/home/jbm/Projects/Elements/projects/sim/target/debug/deps/libhack16-92f935f468a8b88b.rlib: hack16/src/lib.rs hack16/src/preprocessor.rs hack16/src/parser.rs hack16/src/translator.rs
/home/jbm/Projects/Elements/projects/sim/target/debug/deps/hack16-92f935f468a8b88b.d: hack16/src/lib.rs hack16/src/preprocessor.rs hack16/src/parser.rs hack16/src/translator.rs
hack16/src/lib.rs:
hack16/src/preprocessor.rs:
hack16/src/parser.rs:
hack16/src/translator.rs:

Binary file not shown.

@ -1,6 +0,0 @@
/home/jbm/Projects/Elements/projects/sim/target/debug/deps/sim-384d1e4ecdaacb6e: src/main.rs src/simulator.rs
/home/jbm/Projects/Elements/projects/sim/target/debug/deps/sim-384d1e4ecdaacb6e.d: src/main.rs src/simulator.rs
src/main.rs:
src/simulator.rs:

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save