From 808d51918f534192a201539efce566fa3628af85 Mon Sep 17 00:00:00 2001 From: Garrett Dickinson Date: Thu, 28 Mar 2024 23:48:43 -0500 Subject: [PATCH] Small changes --- .gitignore | 1 + Cargo.lock | 7 ------- notes.txt => notes/instructions.txt | 0 notes/registers.txt | 8 ++++++++ src/chip8.rs | 7 +++++++ 5 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 Cargo.lock rename notes.txt => notes/instructions.txt (100%) create mode 100644 notes/registers.txt create mode 100644 src/chip8.rs diff --git a/.gitignore b/.gitignore index ea8c4bf..96ef6c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index c5dc472..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "salt-n-vinegar" -version = "0.1.0" diff --git a/notes.txt b/notes/instructions.txt similarity index 100% rename from notes.txt rename to notes/instructions.txt diff --git a/notes/registers.txt b/notes/registers.txt new file mode 100644 index 0000000..4becac4 --- /dev/null +++ b/notes/registers.txt @@ -0,0 +1,8 @@ +16 8-bit general registers, V0 -> VF +1 16-bit register I, only 12 bits are used + +Program counter (PC) should be 16-bit, and is used to store the currently executing address. +The stack pointer (SP) can be 8-bit, it is used to point to the topmost level of the stack. +The stack is an array of 16 16-bit values, used to store the address that the interpreter shoud return to when finished with a subroutine. +Chip-8 allows for up to 16 levels of nested subroutines. + diff --git a/src/chip8.rs b/src/chip8.rs new file mode 100644 index 0000000..ccaeae2 --- /dev/null +++ b/src/chip8.rs @@ -0,0 +1,7 @@ +// Miscellanious registers +static mut program_counter: u16 = 0; +static mut stack_ptr: u8 = 0; + +// General purpose registers +static mut registers: [u8; 16] = [0; 16]; +