Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting on implementing different variants #88

Merged
merged 10 commits into from
Oct 31, 2023
Merged

Conversation

omarandlorraine
Copy link
Collaborator

No description provided.

@omarandlorraine
Copy link
Collaborator Author

From what I can see, the failing CI/CD process has to do with linting skeptic, a build time dependency. How then shall I proceed?

@mre
Copy link
Owner

mre commented Aug 27, 2023

Skeptic checks that the examples in the README.md are up-to-date. If these get fixed, then it should work again.

@omarandlorraine
Copy link
Collaborator Author

Skeptic checks that the examples in the README.md are up-to-date. If these get fixed, then it should work again.

Can you read the output of the CI / lint (pull request)? The error is not coming from the README.

error: unnecessary hashes around raw string literal
  --> /home/runner/work/mos6502/mos6502/target/debug/build/mos6502-5d795f23ad8c7099/out/skeptic-tests.rs:53:10
   |
53 |   {}"####, r####"use mos6502::memory::Bus;
   |  __________^
54 | | use mos6502::memory::Memory;
55 | | use mos6502::instruction::Nmos6502;
56 | | use mos6502::cpu;
...  |
83 | | }
84 | | "####);
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
   = note: `-D clippy::needless-raw-string-hashes` implied by `-D warnings`

@omarandlorraine
Copy link
Collaborator Author

Okay, I've sussed it.

Clippy is being run with --all-targets, which gets it to check all targets. But skeptic is unmmaintained, so it's beginning to fall behind. I suggest we remove either skeptic or --all-targets.

Which do you prefer?

@omarandlorraine
Copy link
Collaborator Author

I have disabled --all-targets for the time being, the tests are passing now

@mre
Copy link
Owner

mre commented Aug 28, 2023

Thanks. We can remove skeptic then. I hope there's a replacement of some sort.

@omarandlorraine
Copy link
Collaborator Author

We can remove skeptic then. I hope there's a replacement of some sort.

Do you want to find one? Or shall we remove the example(s) from the README and refer readers to the examples/ folder?

@omarandlorraine
Copy link
Collaborator Author

omarandlorraine commented Sep 8, 2023

Thanks. We can remove skeptic then. I hope there's a replacement of some sort.

There is a replacement; cargo doctest can do it now. I'll open another pull request to bring the compile times down by removing skeptic and num, which should close #89 as well.

@mre
Copy link
Owner

mre commented Sep 8, 2023

Perfect. Thanks!

@omarandlorraine
Copy link
Collaborator Author

Perfect. Thanks!

You ready to merge the variety branch then, or? Still want to do the review?

@mre
Copy link
Owner

mre commented Sep 8, 2023

Oh, sorry, I was referring to your comment about removing skeptic and nom. 😅
Still have to do the review of this PR.

@omarandlorraine
Copy link
Collaborator Author

omarandlorraine commented Oct 29, 2023

We should revert c87975e and then rebase this pull-request after #93 is in

@omarandlorraine omarandlorraine mentioned this pull request Oct 29, 2023
@mre
Copy link
Owner

mre commented Oct 30, 2023

We should revert c87975e and then rebase this pull-request after #93 is in

It's in now. Feel free to revert. 👍

@omarandlorraine
Copy link
Collaborator Author

It's in now. Feel free to revert. 👍

That commit has been reverted and the PR has been rebased; so this is ready for merging as far as I am concerned

pub struct Nmos6502;

impl crate::Variant for Nmos6502 {
fn decode(opcode: u8) -> Option<(Instruction, AddressingMode)> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is so nice.

@@ -40,3 +40,12 @@ pub mod cpu;
pub mod instruction;
pub mod memory;
pub mod registers;

pub trait Variant {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some doc comments would help here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a basic description that there are different variants of the CPU, and that they handle operations differently.

@@ -52,7 +53,7 @@ fn main() {
0x4c, 0x10, 0x00, // Jump to .algo
];

let mut cpu = cpu::CPU::new(Memory::new());
let mut cpu = cpu::CPU::new(Memory::new(), Nmos6502);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add a Default impl for that?

// Initializes an Nmos6502 variant
let mut cpu = CPU::default();

If we don't want to add a default, we can alternatively provide

let mut cpu = CPU::nmos();

Just an idea.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out how to do Default because of the generics; do you have a concrete idea?

@mre
Copy link
Owner

mre commented Oct 30, 2023

Looks good. Just some minor comments. We can merge if you like as there are no blockers. Up to you. 😄

@omarandlorraine
Copy link
Collaborator Author

Great, are you happy to merge and do a release on crates.io?

@mre mre merged commit 11499b6 into mre:master Oct 31, 2023
8 checks passed
@mre
Copy link
Owner

mre commented Oct 31, 2023

Sure!

@mre
Copy link
Owner

mre commented Oct 31, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants