Re: Commodore 64 Ultimate Cartridge project

From: Groepaz <groepaz_at_gmx.net>
Date: Tue, 8 May 2012 07:09:06 +0200
Message-Id: <201205080709.07240.groepaz@gmx.net>
On Tuesday 08 May 2012, you wrote:
> I am not sure I understand this. SPI bus transfers (in full duplex, but it
> does not matter here, also I am not sure SD card would support read/write
> in same time) one bit within an SPI clock cycle, so 8MHz SPI clock means 1
> Mbyte/sec, did you mean this way, that one byte for a C64 clock cycle?

yes

> Just because I am lost then: C64 is not able to read a byte _and_ store
> the result within a single C64 clock cycle, even the shortest 6510 opcodes
> last for 2 clock cycles. Or do you mean that there is some buffering on
> "the small spi controller" and C64 can read it then slower? 

no buffering at all, and ofcourse what you say is true. single bytes would be 
transfered at 1Mb/s. and as cpu instructions take a few cycles, with an 
unrolled loop like

.repeat 512, n
lda $df00        ; 4
sta buffer + n   ; 4
.endrepeat

it takes 8 cycles per byte, resulting in 125kb/s

> What kind of controller is it, btw?

its a very simple shiftregister type of thing in a custom cpld (or GAL or MACH 
or whatever the fuck it is =D)

> I am just asking this, since I want to do something similar: I have devices
> (not even one, planned: SD card, the 28J60 ethernet controller, and maybe
> some rtc chip with SPI connection) connected to the SPI bus, and I need to
> connect to C64.  My idea (besides the slow bitbanging) is using an uC.  If
> I maximize the size of the SPI "block" transfer, I can even read it into
> uC-s memory, and allow C64 to read with non-constant speed etc, while uC
> can read/write another data chunk from/to the SPI bus, etc.  However when
> I think about this, I often feel, that it starts to "overgrow" my limited
> experience on the topic, and I should use bitbanging even if it's really
> slow :( Or using CIA's shift register, etc.

as you can see above, that wouldnt even improve the speed - 8 cycles per byte 
is the minimum (with an unrolled loop, 12 cycles with a normal loop).

> The other complicated solution would be disabling 6510 and allow uC to
> place data into C64's memory, so basically do some kind of DMA (from the
> view point of the C64 - I mean).  Then I can have more tight timing, not
> needed to think about slower transfer by 6510 program, etc.

with that kind of setup you could indeed get the theoretical maximum of 1Mb/s, 
yes.

       Message was sent through the cbm-hackers mailing list
Received on 2012-05-08 06:00:20

Archive generated by hypermail 2.2.0.