Git Product home page Git Product logo

Comments (4)

hoglet67 avatar hoglet67 commented on June 24, 2024

BBR/BBS is actually supported, but only if you specify an appropriate CPU type.

Try specifying --cpu=R65C02

It should also work with --cpu=W65C02, but looking at the code there is currently a bug in that case.

What's your understanding of which manufacturer's 65C02 include the Rockwell/WDC extensions (BBR/BBS/RMB/SMB)?

This is my understanding:

  • W65C02 (WDC) - Yes
  • R65C02 (Rockwell, some external 2nd Proc) - Yes
  • R65C102 (Rockwell, internal 6502 2nd Proc) - Yes
  • G65SC02 (California Micro Devices, some external 2nd Proc) - No
  • G65SC12 (California Micro Devices, BBC Master) - No
  • 65C02 (Generic) - No
  • Arlet 65C02 FPGA Core - No
  • AlanD 65C02 FPGA Core - No

Can you think of any other cases?

I think the only one that's currently incorrect is W65C02

BTW, this is my go-to reference for all things 65C02:

I also don't think I correctly handle the WDC-only WAI and STP instructions, because they are variable (potentially infinite) length, and because I have never seen any code that uses them.

from 6502decoder.

gfoot avatar gfoot commented on June 24, 2024

Ah yes, R65C02 works perfectly, thanks!

I'm afraid I don't know much about which CPUs provide which instructions as I've mostly stuck to the NMOS instruction set.

For STP I imagine all that's needed is to watch out for a reset sequence and then continue from there. It's not an instruction I've used though. WAI seems trickier, but so is anything related to RDY really unless it's being sampled by the logic analyser. If RDY is sampled then I would have thought WAI would work fine, as it pulls RDY low to pause the CPU - it should be observable by the logic analyser. RDY could probably be connected to PA4 to prevent sampling when it's low, in fx2pipe modes at least, without requiring 16-bit sampling - this kind of control works very well for me with the CPU's reset pin.

Otherwise, it looks like after WAI is executed the logic analyser sees the next opcode repeated until WAI ends, then execution resumes as normal. The decoder didn't recover very quickly from the desyncs this caused.

It is probably unlikely that there would be many (if any) identical bytes in memory following the WAI instruction, so it may be a fairly safe bet to assume that if the data stream is not changing then the WAI instruction is still waiting. Otherwise I think you'd need to consider backtracking if there's a prediction fail soon after the WAI instruction, and trying again with it consuming fewer cycles. That sounds pretty complex, unless it's something you already have support for!

But if RDY is wired through to the logic analyser then it would be best not to do anything heuristic I think.

from 6502decoder.

gfoot avatar gfoot commented on June 24, 2024

Being curious, I did some experiments with WAI and STP - I built a simple system to test this in with just the CPU and some ROM, so there'd be no complications.

STP is indeed pretty simple, it just stops, and the opcode at the following memory address repeats on the data bus forever until the next reset.

As far as I can tell, RDY mostly behaves like a three-cycle instruction, except it pulls RDY low if there are no pending interrupts. In particular, if IRQ is already low, then RDY is not pulled low at all, and WAI finishes in three cycles. In addition, if I let the logic analyser see the state of RDY by wiring it along with nRESET through a NAND gate, then it prevents sampling when RDY is low, and in all cases I checked, WAI then appears - to the decoder - to have taken three cycles. I tested interrupting WAI with a masked interrupt, as well as with an NMI.

Looking in the code, it looks like WAI was set to be a single cycle instruction (

/* CB */ { "WAI", 0, IMP , 1, 0, OTHER, 0}, // WD65C02=3
) but changing it to 3 means that all my captures with WAI are working well with no prediction fails. There is a comment next to this line saying "WD65C02=3" which might be referring to this or something else, I'm not sure! But I think it's a good change.

So I think this is promising as a way to support WAI, at least if the user hooks RDY up to PA4 or PA5 appropriately. I tested this mostly with "--ifclck=xi" and a 10MHz clock, but it also seemed to work with "-a" and a 1.8MHz clock.

from 6502decoder.

hoglet67 avatar hoglet67 commented on June 24, 2024

Thanks for that investigation George.

I'll update the decoder with those changes, but it may take a few days as my main/ancient dev machine has died and I'm awaiting a cheap ebay HP Z440 to replace it.

from 6502decoder.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.