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

Write (WE) active during reset #4

Open
jesari-git opened this issue Feb 1, 2024 · 2 comments
Open

Write (WE) active during reset #4

jesari-git opened this issue Feb 1, 2024 · 2 comments

Comments

@jesari-git
Copy link

When 'reset' is active the write signal 'WE' is also active. This means some memory corruption during reset (but confined to the stack page)
These write cycles shouldn't be a problem unless the clock frequency is out of specs (but this can happen during PLL startups), and the boot memory is writable.
I think the real 6502 also modifies the stack pointer during resets but its R/W signal is forced high, disabling writes.
A possible patch is to change the following line...:

/*

  • Write Enable Generator
    */

always @*
case( state )
BRK0, // writing to stack or memory
BRK1,
BRK2,
JSR0,
JSR1,
PUSH1,
WRITE: WE = ~(reset|res); // (before it was: WE = 1;)

    INDX3,  // only if doing a STA, STX or STY
    INDY3,
    ABSX2,
    ABS1,
    ZPX1,
    ZP0:     WE = store;

    default: WE = 0;
endcase
@jesari-git
Copy link
Author

Well, I mean the line WRITE: WE = 1; , now WE = ~(reset|res); I got the code a bit disturbed in the post ;)

@rejunity
Copy link

rejunity commented Nov 8, 2024

I had the same issue too! Fixed it in a bit different way: rejunity/tt09-atari-2600@162c005

WE = ~res;

I also found a number of other issues with RESET sequence, such as D flag not properly being initialised.

List of my fixes: https://github.com/rejunity/tt09-atari-2600/commits/main/src/6502.v (NOTE fixes are aimed at producing silicon / PDK)

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

No branches or pull requests

2 participants