21 December 2008, 03:17 | #1 |
Not dead yet!!! :D
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
|
DMA memory to memory copy
How do I copy x bytes from address A to address B using DMA transfers or something similar (custom chips)?
|
21 December 2008, 10:31 | #2 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,337
|
Remember that with a DMA copy you'll be limited to CHIP RAM and that a DMA copy will be slower than a CPU fast RAM copy on accelerated Amiga's.
Google for BLITTER http://pub.elowar.com/AmigaDev/Hardw.../node0121.html |
21 December 2008, 19:30 | #3 |
Not dead yet!!! :D
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
|
Only chip memory... I remembered that right after I wrote the post. And that's a problem...
|
21 December 2008, 19:36 | #4 |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 42
Posts: 2,351
|
I guess it'll be a tight movem loop for you then
|
07 January 2009, 14:59 | #5 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Remember to check for non-longword aligned start/end addresses for source and destination, and to copy from end to start instead of from start to end, depending on how the areas overlap. If they don't overlap all is fine, and if source and destination start address is the same, you just skip the copy.
|
08 January 2009, 02:04 | #6 | |
Not dead yet!!! :D
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
|
Quote:
|
|
11 January 2009, 19:58 | #7 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
I has nothing to do with DMA and everything to do with copying areas without overwriting the original.
|
22 January 2009, 01:19 | #8 |
Registered User
Join Date: May 2005
Location: Cheshire, UK
Age: 56
Posts: 322
|
I remember using the blitter to copy bits of a soundtracker module around for the mix-e-loader on Sonic Attack. If you can't find the source in PD, or want to see, let me know.
|
22 January 2009, 01:41 | #9 |
Not dead yet!!! :D
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
|
|
22 January 2009, 01:54 | #10 |
Registered User
Join Date: May 2005
Location: Cheshire, UK
Age: 56
Posts: 322
|
This was a rather unusual way to use the blitter. Usually, it would be used to copy screen memory around.
Fortunately, I noted that the ST note track is 256 bytes (or something) and was blitter freindly. A simple blitter routine can used to copy memory from a to b for any number of purposes, but restricted to certain block sizes (binary restrictions) |
22 January 2009, 01:56 | #11 | |
Not dead yet!!! :D
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
|
Quote:
|
|
22 January 2009, 01:58 | #12 |
Registered User
Join Date: May 2005
Location: Cheshire, UK
Age: 56
Posts: 322
|
|
22 January 2009, 02:01 | #13 |
Not dead yet!!! :D
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
|
|
22 January 2009, 02:18 | #14 |
Registered User
Join Date: May 2005
Location: Cheshire, UK
Age: 56
Posts: 322
|
I posted the code a long time ago. No probs to post it again if you don't have.
Check out the demo first |
22 January 2009, 23:29 | #15 | |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
Quote:
Code:
char rawSectorData[512*2]; char decodedSectorData[512]; // fill rawSectorData with contents first for (int i = 0; i < 512; i++) decodedSectorData[i] = ((rawSectorData[i] & 0x55) << 1) | (rawSectorData[i + 512] & 0x55); - rewrite it using word operations - the blitter can only shift left when in descending mode, so make loop go backwards - the blitter shifts before masking together channels, so move shift before masking Code:
short rawSectorData[256*2]; short decodedSectorData[256]; // fill rawSectorData with contents first for (int i = 0; i < 256; i++) decodedSectorData[255 - i] = ((rawSectorData[255 - i] << 1) & ~0x5555) | (rawSectorData[511 - i] & 0x5555); BLTAPT = rawSectorData + 255 words; BLTBPT = rawSectorData + 511 words; BLTDPT = decodedSectorData + 255 words; BPLAMOD..BPLDMOD = 0 BLTCDAT = $5555 minterm = Ac + BC = ABc + Abc + ABC + aBC = $40 + $10 + $80 + $08 = $D8 Channel A-shift = 1 Channel B-shift = 0 Enabled DMA channels = ABD Descending = 1 => BLTCON0 = $1DD8 => BLTCON1 = $0002 BLTAFWM,BLTALWM = $FFFF BLTSIZE = 256 * 64 + 1 |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Virtual Memory or Memory Compactor | Leandro Jardim | support.Apps | 2 | 29 May 2012 23:12 |
Blizzard Turbo Memory - SMD memory chips doesn't work | sanjyuubi | Hardware mods | 5 | 26 May 2010 15:40 |
C++ to Assembler conversion (speedup) memory copy hack | NovaCoder | Coders. General | 35 | 09 February 2010 20:37 |
[68000 ASM] Move memory to memory | AmigaBoy | Coders. General | 7 | 08 December 2009 08:16 |
Old cache memory as a "base" for GVP memory | rkauer | Hardware pics | 4 | 22 November 2008 06:23 |
|
|