diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index aae5809..c530292 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,7 +8,10 @@
+
+
+
@@ -36,71 +39,78 @@
- {
- "keyToString": {
- "Cargo.Build `Run emmagui`.executor": "Run",
- "Cargo.Build `Run gemmaegui`.executor": "Run",
- "Cargo.Build `Run gemmaimgui`.executor": "Run",
- "Cargo.Build `Run trevors_chip8_toy`.executor": "Run",
- "Cargo.Build `Test chip8::computer::test::cls_test`.executor": "Run",
- "Cargo.Build `Test chip8::instructions::test::LdStVx_test`.executor": "Run",
- "Cargo.Build `Test chip8::instructions::test::random_produces_different_numbers`.executor": "Run",
- "Cargo.Build `Test chip8::instructions::test::series8xy6_corex_tests`.executor": "Run",
- "Cargo.Build `Test chip8::instructions::test::shl_vx_vy_test`.executor": "Run",
- "Cargo.Build `Test chip8::util::test::byte_to_bool_changes`.executor": "Run",
- "Cargo.Build `Test chip8::util::test::ubln`.executor": "Run",
- "Cargo.Build `Test chip8::video::test::poke_byte_test`.executor": "Run",
- "Cargo.Build `Test chip8::video::test::poke_byte`.executor": "Run",
- "Cargo.Build `Test computer::test`.executor": "Run",
- "Cargo.Build `Test instructions::test (1)`.executor": "Run",
- "Cargo.Build `Test instructions::test`.executor": "Run",
- "Cargo.Build gemma.executor": "Run",
- "Cargo.Run emmagui.executor": "Run",
- "Cargo.Run gemmaegui.executor": "Debug",
- "Cargo.Run gemmaimgui.executor": "Debug",
- "Cargo.Run trevors_chip8_toy.executor": "Debug",
- "Cargo.Test chip8::computer::test::cls_test.executor": "Run",
- "Cargo.Test chip8::computer::test::decoder_test_valid_instructions.executor": "Run",
- "Cargo.Test chip8::instructions::test::LdStVx_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::LdVxDt_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::LdiAddr_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::RndVxByte_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::ShrVxVy_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::SneVxVy_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::decoder_test_invalid_instructions.executor": "Run",
- "Cargo.Test chip8::instructions::test::draw_nibble_vx_vy_n_test.executor": "Debug",
- "Cargo.Test chip8::instructions::test::encode_decode_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::random_produces_different_numbers.executor": "Run",
- "Cargo.Test chip8::instructions::test::series4000_corex_tests.executor": "Run",
- "Cargo.Test chip8::instructions::test::series8xy4_corex_tests.executor": "Run",
- "Cargo.Test chip8::instructions::test::series8xy6_corex_tests.executor": "Run",
- "Cargo.Test chip8::instructions::test::shl_vx_vy_test.executor": "Run",
- "Cargo.Test chip8::instructions::test::subn_vx_vy_test.executor": "Run",
- "Cargo.Test chip8::util::test::bool_to_byte_changes.executor": "Run",
- "Cargo.Test chip8::util::test::byte_to_bool_changes.executor": "Run",
- "Cargo.Test chip8::util::test::ubln.executor": "Run",
- "Cargo.Test chip8::video::test::poke_byte.executor": "Run",
- "Cargo.Test chip8::video::test::poke_byte_test.executor": "Run",
- "Cargo.Test chip8::video::test::poke_sprite_test.executor": "Debug",
- "Cargo.Test computer::test.executor": "Debug",
- "Cargo.Test instructions::test (1).executor": "Debug",
- "Cargo.Test instructions::test.executor": "Debug",
- "Cargo.Test sound_timer::test.executor": "Run",
- "Cargo.Test util::test.executor": "Run",
- "Cargo.Test video::test.executor": "Coverage",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.rust.reset.selective.auto.import": "true",
- "git-widget-placeholder": "master",
- "last_opened_file_path": "/home/tmerritt/Projects/chip8_toy/gemmaimgui",
- "node.js.detected.package.eslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
- "org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
- "org.rust.first.attach.projects": "true",
- "settings.editor.selected.configurable": "language.rust.build.tool.cargo"
+
+}]]>
@@ -109,7 +119,7 @@
-
+
@@ -127,6 +137,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -163,10 +190,11 @@
+
-
+
@@ -200,12 +228,17 @@
+
+
+
+
+
diff --git a/gemmautil/src/bin/ch8asm.rs b/gemmautil/src/bin/ch8asm.rs
new file mode 100644
index 0000000..2426115
--- /dev/null
+++ b/gemmautil/src/bin/ch8asm.rs
@@ -0,0 +1,44 @@
+use std::path::Path;
+use clap::Parser;
+
+/// Ch8Asm
+/// Converts well formed CH8ASM.
+/// no variables.
+/// no labels.
+/// nothing fun.
+
+pub struct Assembler {}
+
+impl Assembler {
+ pub fn instruction_to_string() -> String {
+ // Format the output as
+ // IST [P0] [P1] [P2] ; XXXX
+ // IST = 3 letter instruction code
+ // P0-2 = Parameters to Instruction
+ // XXXX = Hex representation of data
+ // ** OR **
+ // DW XXXX ;
+ // DW = DATAWORD
+ // XXXX = HEX OF DATA
+
+ String::new()
+ }
+}
+
+#[derive(Parser)]
+#[command(version, about, long_about = None)]
+struct AssemblerApp {
+ #[arg(short)]
+ input_file: Box,
+ #[arg(short)]
+ output_file: Option
+}
+
+fn main() {
+ println!("Taxation is Theft");
+
+ let result = AssemblerApp::parse();
+
+ println!("Preparing to assemble {}", result.input_file.file_name());
+
+}
\ No newline at end of file
diff --git a/gemmautil/src/bin/ch8disasm.rs b/gemmautil/src/bin/ch8disasm.rs
index d29ebcf..2b9e76c 100644
--- a/gemmautil/src/bin/ch8disasm.rs
+++ b/gemmautil/src/bin/ch8disasm.rs
@@ -22,6 +22,8 @@ fn main() {
println!("PREPARING TO DISASSEMBLE {:?}", result.input_file.file_name());
let mut last_byte: u8 = 0x00;
let mut working_instruction: u16 = 0x0000;
+ let mut dump_as_data: bool = false;
+
// read the input file and loop through it byte by byte.
for (offset, byte) in std::fs::read(result.input_file).unwrap().iter().enumerate() {
@@ -35,8 +37,8 @@ fn main() {
println!("FOUND ERROR INSTRUCTION. LIKELY DATA.");
}
Chip8CpuInstructions::JpAddr(x) => {
- if x == (offset + 0x1ff) as u16 {
- println!("FOUND JUMP TO SELF. INFINITE LOOP DETECTED.");
+ if (offset + 0x200) == x as usize {
+ println!("INFINITE LOOP")
}
}
_ => {
diff --git a/gemmautil/tests/assmber_tests.rs b/gemmautil/tests/assmber_tests.rs
new file mode 100644
index 0000000..61dabe6
--- /dev/null
+++ b/gemmautil/tests/assmber_tests.rs
@@ -0,0 +1,3 @@
+#[test]
+fn smoke() { assert!(true) }
+
diff --git a/resources/test/gemma_disassembler_1_chip_logo_ch8_asm.asc b/resources/test/gemma_disassembler_1_chip_logo_ch8_asm.asc
new file mode 100644
index 0000000..5785125
--- /dev/null
+++ b/resources/test/gemma_disassembler_1_chip_logo_ch8_asm.asc
@@ -0,0 +1,38 @@
+cls ; 00e0
+ldx 0x01, 0x60 ; 6160
+ldx 0x00, 0x08 ; 6008
+ldi 0x250 ; a250
+drw 0x00, 0x01, 0x0f ; d01f
+ldx 0x00, 0x10 ; 6010
+ldi 0x25f ; a25f
+drw 0x00, 0x01, 0x0f ; d01f
+ldx 0x00, 0x18 ; 6018
+ldi 0x26e ; a26e
+ldx 0x00, 0x1f ; d01f
+ldx 0x00, 0x20 ; 6020
+ldi 0x27d ; a27d
+drw 0x00, 0x01, 0x0f ; d01f
+ldx 0x00, 0x28 ; 6028
+ldi 0x28c ; a28c
+ ; d01f
+ ; 6030
+ ; a29b
+ ; d01f
+ ; 6110
+ ; 6008
+ ; a2aa
+ ; d01f
+ ; 6010 a2b9 d01f 6018 a2c8 d01f 6020 a2d7
+ ; d01f 6028 a2e6 d01f 6030 a2f5 d01f 124e
+ ; 0f02 0202 0202 0000 1f3f 71e0 e5e0 e8a0
+ ; 0d2a 2828 2800 0018 b8b8 3838 3fbf 0019
+ ; a5bd a19d 0000 0c1d 1d01 0d1d 9d01 c729
+ ; 2929 2700 00f8 fcce c6c6 c6c6 0049 4a49
+ ; 483b 0000 0001 0303 0301 f030 9000 0080
+ ; 0000 00fe c783 8383 c6fc e7e0 e0e0 e071
+ ; 3f1f 0000 0702 0202 0239 3838 3838 b8b8
+ ; 3800 0031 4a79 403b dddd dddd dddd dddd
+ ; 0000 a038 20a0 18ce fcf8 c0d4 dcc4 c500
+ ; 0030 4424 1463 f103 0707 7717 6371 0000
+ ; 288e a8a8 a6ce 8703 0303 87fe fc00 0060
+ ; 90f0 8070
\ No newline at end of file