51 Commits

Author SHA1 Message Date
7ab0a596c9 cpu.rs, tests.rs: fix clippy lints (thanks clippy) 2023-08-31 22:40:30 -05:00
8de4f42ff6 docs: Fix examples (now passes all doc tests again) 2023-08-31 22:39:14 -05:00
e4f8001a16 CPU: Add hires font 2023-04-30 00:54:58 -05:00
96b6038bbe Chirp: Bus Schism: Split into Mem (internal) and Screen (external) 2023-04-29 23:32:14 -05:00
f4d7e514bc auto_cast: Move out of bus module 2023-04-29 19:52:38 -05:00
c7226bf9cc cpu.rs: Fix up ROM loading in new(), and doctests 2023-04-29 18:42:19 -05:00
cb69af048f cpu: Change ST and DT back to u8 2023-04-29 18:37:29 -05:00
57c2ac681c cpu: fix renaming mistake "screen" -> "mem" 2023-04-29 18:34:24 -05:00
ea357be477 Monotonic: This flag is being deprecated soon, switch it for bool 2023-04-29 18:20:49 -05:00
7d5718f384 cpu.rs: Separate lastkey from flags 2023-04-29 12:08:26 -05:00
16a5e6a2a4 cpu.rs: Actually derive (De)Serialize if feature=serde 2023-04-23 12:16:31 -05:00
c1219e60f0 cpu.rs: Refactor for modularity
- Break into submodules
  - Move bus into submodule of CPU
  - Keep program and charset rom inside CPU
  - Take only the screen on the external Bus
  - Refactor the disassembler into an instruction definition and the actual "Dis" item
2023-04-23 12:10:02 -05:00
33da1089a2 AnyRange: Add AnyRange for taking any range in error 2023-04-23 12:01:47 -05:00
92dc899510 Update copyright notices 2023-04-23 11:58:57 -05:00
1c1d4dafaf cpu.rs: Adjust doctests for new stack behavior 2023-04-17 06:39:05 -05:00
45adf0a2b8 cpu.rs: Remove stack from main memory 2023-04-17 06:34:48 -05:00
401b247c05 cpu: Remove reference to nonexistent "init" module 2023-04-17 05:13:41 -05:00
95d4751cdd bus: Major refactor: auto-impl implicit casting for all numerics 2023-04-17 05:12:37 -05:00
43fa623da3 Improve workflow and docs somewhat, make minifb optional 2023-04-14 22:20:30 -05:00
674af62465 cpu.rs: Break into submodules 2023-04-14 21:25:41 -05:00
d12f3fe710 cpu.rs: Fiddle with the alignment, to help me feel whole. 2023-04-14 16:50:32 -05:00
8bb34f2593 schip: Improve architecture & compatibility somewhat 2023-04-03 05:46:33 -05:00
acc7629516 schip: Add preliminary SuperChip support (no test) 2023-04-03 02:01:25 -05:00
93bbf67433 cpu.rs: Double max IPF in dynamic timing by only getting the time once 2023-04-02 14:48:34 -05:00
f27537b3b8 tests: Update tests to match current behavior. 2023-04-01 02:31:51 -05:00
a4c548d0ec lib.rs: Remove crate::prelude, re-export in lib.rs 2023-04-01 02:31:06 -05:00
bb8015f33c Quirks: Make the Cosmac VIP behavior default. 2023-04-01 00:15:40 -05:00
7173b9e39b Break io into chirp-minifb, and refactor to use Results in more places 2023-04-01 00:14:15 -05:00
a676280ec8 clippy: Fix all clippy lints 2023-03-31 14:32:01 -05:00
627511282a chirp-minifb: Propagate errors up to main 2023-03-30 10:46:35 -05:00
cc3bc3a7fe Major Refactor: Make invalid states unrepresentable™️
- Rewrote the instruction decoder as an enum
- Used imperative_rs to auto-generate the bit twiddling logic
- Implemented Display on that enum, for disassembly
- Rewrote CPU::tick
  - Now >10x faster
  - Disassembly mode is still 5x slower though
- Implemented time-based benchmarking
  - (use option -S to set the number of instructions per epoch)
2023-03-30 08:27:06 -05:00
8ab9799913 cpu.rs: Fix some documentation errors 2023-03-30 02:13:59 -05:00
f60a4b3cc2 Refactor disassembler to use imperative-rs
It's like MAGIC. Easily cut out 200 LOC
2023-03-30 02:12:03 -05:00
b9c35c0e68 lib.rs: Deny (missing docs) 2023-03-29 23:45:39 -05:00
ce0dc954d0 tests: Improve cpu.rs line coverage to >99% 2023-03-28 12:31:56 -05:00
83c178413d tests: Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience. 2023-03-28 08:57:24 -05:00
fbc0a0b2ea tests: Coverage and cleanup/speedup
- Improved test coverage to >80% of lines, functions
  - When doctests are included.
  - Wrote new unit tests:
    - Explicit tests for invalid instructions in the
      ranges {`5xyn`, `8xyn`, `9xyn`, `Fxbb`}
    - `rand` Tests for 1052671 cycles, to ensure
      randomly generated number is < ANDed byte
    - `Ex9E` (sek), `ExA1`(snek) will press only the expected key,
      then every key except the expected key, for every address
    - `Fx0A` (waitk) asserts based on the waveform of a keypress.
      After all, an A press is an A press.
- Improved test performance by printing slightly less
- Removed nightly requirement
  - (now optional, with feature = "unstable")
- Amended justfile to test with `cargo nextest` (nice)
- Changed release builds to optlevel 3
2023-03-28 07:33:17 -05:00
59a0b2fada bus.rs/cpu.rs: Improve doctest coverage 2023-03-27 21:01:57 -05:00
0e91b103ed LICENSE: Add MIT Licence 2023-03-27 18:30:31 -05:00
784845b6f5 cpu.rs: Make quirks individually configurable 2023-03-27 17:27:55 -05:00
a2a44dfd4f cpu.rs: Make private function names more concise 2023-03-26 18:32:31 -05:00
edd2b60665 cpu.rs: Refactor dump(&self) to do fewer allocations 2023-03-25 18:32:45 -05:00
73a69f3469 cpu.rs: Create unit tests for most instructions 2023-03-25 18:17:09 -05:00
27ac674616 cpu.rs: Refactor instruction implementations
- Use rust standard implementations of overflowing arithmetic
- Make draw more concise and readable
2023-03-25 18:14:36 -05:00
5159afa3fd cpu.rs: Reference chaining mutable functions 2023-03-25 18:09:41 -05:00
49a6fc0377 dump.rs: Does not spark joy (remove dump.rs) 2023-03-25 17:45:22 -05:00
712acc5984 bus.rs: Improve region encoding with enums 2023-03-25 17:20:20 -05:00
dc61bd0087 I/O: KISS the bus, attach a screen, plug in a controller
Chip-8 has no ROM, nor memory management.
- It's much easier to just use contiguous memory.
- Then we can return references to slices of that memory
- ~3x speed increase
Screen exists now, uses 24-bit framebuffer
- We have a 1-bit framebuffer
- I chose colors that look good to me
Controller exists as well, has 16 buttons
- Mapped "0 123 456 789 ab cdef" to (QWERTY) "X 123 QWE ASD zC 4RFV"
- Other chip-8 interpreters may use a different layout
  - This is good enough for now.
- F1-F9 map to control functions
  - F1, F2: Dump CPU registers/screen contents
  - F3, F4: Toggle disassembly/pause
  - F5:     Single-step the CPU, pausing after
  - F6, F7: Set/Unset breakpoint
  - F8, F9: Soft/Hard Reset CPU
2023-03-22 15:03:53 -05:00
ef3d765651 experimentation: benchmarking and alternate impl's
- Do some basic benchmarking with std::time
- Try writing bus writer based on iterator
  - Fail, because that requires mutable iterator
  - Begin rewriting bus based on simpler design instead.
    - Simpler design uses a unified memory model,
      which grows based on the maximum addresses expected in it
    - Still uses the "infallible" Read/Write traits from previous
      implementation. :( Alas, it's much faster during operation,
      even if it takes longer to instantiate.
    - Reassessed the syntax for bus macro
  - Made CPU tick generic over bus::Read and bus::Write traits
2023-03-17 20:06:31 -05:00
2ba807d7a8 Rumpulator: Change name to Chumpulator 2023-03-10 15:33:36 -06:00