Thursday 4 September 2014

SID audio at last, plus CPU and VIC-IV redesign catching

I finally had some time over the last couple of days to get the redesigned CPU and VIC-IV to some reasonable degree of working, so that I can finally begin enjoying the benefit of the work, and making use of the about 2/3 of the FPGA that the redesign has freed up.

I have fixed bugs with the read-modify-write instructions, PLP, PHW, the $nn,Y addressing mode (it had a copy and paste error and was acting like $nn,X), the MAP instruction was no inhibiting interrupts and numerous others.

I also finally got around to making the dummy write in read-modify-write instructions only happen if the target address is $D019, i.e., to acknowledge VIC-II interrupts, thus avoiding an extra cycle in those instructions.

The CPU now passes the Lorenz 6502 tests for all the legal opcodes, and C64 and C65 mode BASIC both work, as does the DOS for the internal drive, making it easier to test a wider variety of software again.  The Lorenz test suite takes about half an hour on a real C64, but all the official 6502 opcodes can be tested on the C65GS in under a minute. This really is a fast 8-bit computer.

However, not everything is right, since Bouldermark crashes for a reason I have yet to discover.  Synthmark64 runs fine, however, and the speed is almost unchanged from the last test.  The slight slow-down is due to putting back a necessary wait-state when reading from colour RAM.

Obligatory screen shot of Synthmark64 running very fast indeed.

I also put some effort into tracking down some bugs in the newly added parts, including the emulated stereo SIDs (although they both come out the same mono audio jack right now).  Apart from some speed issues, which is just as likely due to the 60Hz screen refresh rate as anything, sound is now working, as tested in Bouldermark and Lemmings.

The VIC-IV reimplementation is not yet complete, with multi-colour and bitmap graphics modes still having a few bugs to shake out.  I did manage to get extended colour mode and bitmap modes working to some degree, although multi-colour mode and bitmap modes both have some problems to work out, which I have yet to fully explore.

Along the way I also added support for the DMAgic DMA controller to DMA memory from outside the 1MB C65 address range.  This is used to copy the disk chooser program from the Kickstart ROM to $C000 at start up.  Similarly, chained DMA lists are now supported, and one chained DMA list does the copy as well as clear the screen and colour RAM.  Clearing 4KB RAM and copying another 4KB RAM all takes about 13,000 cycles, about the equivalent of five rasters on a real C64.

The next steps will probably be to debug the multi-colour graphics problems to figure out what is going on there, so that graphics looks right.  Then I might finally get started on implementing writing to SD card and implementing sprites, at which point all core functionality will exist, however flawed and imperfect it may be.

My plan for sprites is to have the 8 normal C64 sprites, plus another 8 (or 16 if I can manage it) 64x64 256-colour sprites.  These will each require up to 4KB of data.  I am thinking about how I can make the sprite data fetching character based, so that the sprites can be made up from 8x8 pixel character tiles, making for much more efficient use of memory.  In principle I could re-use the character generator machinery

8 comments:

  1. Hi Paul,

    as usual glad to see your achievements :)

    Does the C65 support hardware sprites ?

    If yes, how many, and with how many colours ?

    ReplyDelete
    Replies
    1. The C65 has only the same sprites as C64. The only difference is that the sprite colour registers become 8 bit. The number of simultaneous colours and resolution remain unchanged.

      Paul.

      Delete
  2. Paul,
    How did you design the CPU, VIC-IV, and SID? I mean, to my knowledge there aren't schematics for the latter two are there? I've read that designing a SID is difficult because of the analogue components to it. Does your design allow for playing of digitized sounds like the original (older) SIDs? Thanks.
    Kevin

    ReplyDelete
    Replies
    1. I used an existing open-source SID implementation, that includes digital filters. I believe that $D418 audio works. I have also included stereo 8 bit digital audio channels. I.e., you get 3 SID channels plus $D418 + an extra 8 bit digital channel for the left and right side.

      For the VIC-IV and CPU I worked from the specifications and have implemented the official functions of these. This means that the VIC-IV will not support all the strange VIC-II and VIC-III tricks that have been discovered over time.

      Paul.

      Delete
    2. That's quite a bit of work! Any plans to implement the hardware external interfaces like the cart port, etc? It would be great to have a hardware machine that could handle neat peripherals like the Covox Voicemaster (sound digitizer) and ComputerEyes (image digitizer).

      Delete
    3. Hello,
      I plan to have a user port, joysticks, real C64/C65 keyboard interface, serial disk drive port. I have been thinking about the cartridge port, and I may support some simple cartridges, but this isn't a big priority. For video capture you have 100mbit ethernet, and for audio capture there is actually an onboard microphone, and it wouldn't be too hard to add a separate audio-in port, maybe even a digital one. Basically having a fully compatible cartridge port will make it much more complex, and in my view for relatively little gain. But of course things can change.

      Paul.

      Delete
    4. That's great! Thanks for the replies. Looking forward to seeing this completed.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete