f



DMA to C64 memory via cartridge port?

If I want to use DMA to transfer bytes into the onboard C64 memory via the
cartridge port. Is this the way to it?

  Set DMA = low
  Wait for BA == high
  Set A0-A15 + D0-D7
  Set R/W = low

Other signals that one need to pay attention to?
  Dot clock
  Phase2 clock

How many bytes at a time can one push?, considering that dram refresh has to
be executed. Ofcourse video chip (VIC-II) may want the bus too, but it can be
shutoff I suppose. Just like when loading from tape.


Ref:
  http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_6/page_366.html#Expansion

0
pbdelete
10/12/2005 8:03:39 PM
comp.sys.cbm 14331 articles. 0 followers. dunric (341) is leader. Post Follow

6 Replies
1104 Views

Similar Articles

[PageSpeed] 20

It occurred to me that pbdelete@spamnuke.ludd.luthdelete.se.invalid wrote in
comp.sys.cbm:
> If I want to use DMA to transfer bytes into the onboard C64 memory via the
> cartridge port. Is this the way to it?
>
>   Set DMA = low

But only when phase2 is low, and AFAIK only at the begin of a machine cycle.
IIRC you can only use DMA in practice when the start of the DMA transfer is
under the 6510's control (as it is with the REU, and with the Z80 cartridge,
for example).

>   Wait for BA == high
>   Set A0-A15 + D0-D7
>   Set R/W = low
>
> Other signals that one need to pay attention to?
>   Dot clock
>   Phase2 clock

Well, considering that all DMA does is halting the processor, you'll only have
access to the bus during the high phase of phase2, as the bus is still owned
by the VIC when phase2 is low. 

> How many bytes at a time can one push?, considering that dram refresh has to
> be executed.

The DMA device "owns" the bus as long as you keep DMA asserted, under certain
conditions. Memory refresh happens during the VIC access of the bus, when
phase2 is low. When the VIC wants the bus for video access (during badlines,
etc), it will release BA.

The bus is yours and yours only as long as BA is asserted, and phase2 is high.
Remember that this whole DMA thing is also used by the Z80 cartridge (And
I assume the SCPU as well) to replace the 6510; there's no limit in how long
you can claim the bus, as long as you pay attention to the VIC timing.

You could find some inspiration on pages like 

http://www.baltissen.org/htm/pccard.htm

> Ofcourse video chip (VIC-II) may want the bus too, but it can be shutoff I
> suppose. Just like when loading from tape.

It can't be shut off completely. All you can do is prevent the VIC from 
stealing "your" cycles, in which case you don't have to pay attention to
BA during your transfer. But it'll still claim the bus when phase2 is low.

-- 
    Martijn van Buul - pino@dohd.org - http://www.stack.nl/~martijnb/
	 Geek code: G--  - Visit OuterSpace: mud.stack.nl 3333
 The most exciting phrase to hear in science, the one that heralds new
discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...' Isaac Asimov
0
Martijn
10/13/2005 7:53:05 AM
Hallo Martijn,


Martijn van Buul schreef:
> >   Set DMA = low
>
> But only when phase2 is low,

That should be 'only when phase2 is High'.


> You could find some inspiration on pages like
>
> http://www.baltissen.org/htm/pccard.htm

Hmmm, the schematic is missing :( I'll try that to fix this evening.
Sorru for the inconvenience.


Groetjes, Ruud

0
Ruud
10/13/2005 11:22:10 AM
> That should be 'only when phase2 is High'.

Sorry, that is not entirely correct either.

Better have a look at http://www.baltissen.org/htm/c64_cpm.htm where
you can see how the Z80 is connected to the C64. In this case the Z80
also performs a kind of DMA, seen from the view of the 6510. And here
you can see that DMA is activated by a simple I/O operation. In this
case DMA is (re)set at the falling edge of Phi2.

Groetjes, Ruud

0
Ruud
10/13/2005 11:33:00 AM
<pbdelete@spamnuke.ludd.luthdelete.se.invalid> wrote in message
news:434d6c1b$0$49016$14726298@news.sunsite.dk...
> If I want to use DMA to transfer bytes into the onboard C64 memory via the
> cartridge port. Is this the way to it?
>
>   Set DMA = low

This immediatly takes control of the bus. Bad.

>   Wait for BA == high

The way I worked out, and i am willing to accept it may be wrong, is.

Watch the BA line. When the VIC requests access, it will let you know via
BA.
Count three clock cycles (Like the VIc does), and pull the DMA line.
Wait for VIC to release BA, then its all yours.

If you pull DMA, it decouples the address and data lines from the CPU, it
does not allow the three clock cycles to pass like the VIC can (The VIC has
seperate access to the RDY and AEC pins, the DMA line pulls both at the same
time).. This is fine assuming you want the 6510 to crash or can use the 6510
to syncronise (ie, to activate the z80 ZPM cartridge the 6510 writes to a
register and starts excecuting safe NOP op codes).
As you need to monitor the BA line anyway, you may as well use it to start
your DMA activity.


0
Dancin
10/13/2005 4:03:01 PM
After reading some material, should one do like this?

  Wait for PHI2==high + BA==high
  Set DMA==low

  Repeat while PHI2==high + BA==high
    Set A0-A15 + D0-D7
    Set R/W = low     (mainly want to transfer to C64)

0
pbdelete
10/14/2005 8:32:46 PM
On Thursday, October 13, 2005 1:33:00 PM UTC+2, Ruud wrote:
> > That should be 'only when phase2 is High'.
>=20
> Sorry, that is not entirely correct either.
>=20
> Better have a look at http://www.baltissen.org/htm/c64_cpm.htm where
> you can see how the Z80 is connected to the C64. In this case the Z80
> also performs a kind of DMA, seen from the view of the 6510. And here
> you can see that DMA is activated by a simple I/O operation. In this
> case DMA is (re)set at the falling edge of Phi2.
>=20
> Groetjes, Ruud

A bit late answer, we can say in 2012 :) However: as far as I know, the Z80=
 cartridge has problems on some C64 models. Is this related to the mode it =
used to "disable" 6510 for the bus access? Because if it's, then care must =
be taken as similar methods won't work on all C64 models? It sounds odd, bu=
t I have some faint memories that Z80 CP/M cartridge really has problems wi=
th some C64 models at least ...

0
lgblgblgb (1)
5/8/2012 7:59:38 AM
Reply: