Saturday, March 15, 2014

Fill command of DMAgic DMA controller implemented

In the previous post, the C65 startup display had lots of @ characters that I had to remove by hand, because the DMAgic DMA controller was not at all implemented.

DMAgic has four functions: FILL, COPY, MIX and SWAP.

FILL is the easiest, and COPY and SWAP aren't that hard to implement either.  MIX is not implemented in the real C65 prototypes, so that is a lower priority.

As FILL is easiest, and has direct impact on the startup display, since DMA is used to clear screen lines on the C65, I set about implementing that first.

DMAgic is a separate IC on the C65, but in the C65GS I have made it part of the CPU, since it simplifies a number of things, and avoids me having to duplicate the address decoding logic.

After pulling my hair out over some precedence of assignment issues in VHDL, I managed to get it working.  I had to guess whether 1 or 0 in the DIRection bit meant forwards, and initially guessed wrong, but that was easy to fix.

With all that in place, the C65 ROM now displays almost correctly, as can be seen below.  This screen grab was captured as-is, with no hand modification.


All those pesky @'s have gone away, giving me confidence that DMAgic is working more or less correctly for the FILL command.

The colour bars are still not showing, which I had originally thought might have been DMAd over the top.  A bit of investigating reveals that they are drawn just using RVS-ON and spaces.  So they really should be showing up.

I'll look into that after I implement the DMAgic COPY command, just in case DMA copies are used to set other important structures up.  I also know that COPY is used heavily in the BASIC interpreter, and COPY should be so easy to implement now that FILL is working, anyway, that there really is no reason not to knock it off now.  SWAP and MIX will likely wait.

Other niggly problems are related to IRQ handling, where if IRQs are enabled on power up the machine does something odd instead of booting.  Similarly enabling IRQs after boot causes lots of "BREAK" messages to scroll past (well, they will scroll when DMAgic COPY works).  So I'll have to have a look into that once DMAgic is working satisfactorily.

No comments:

Post a Comment