English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 21 December 2008, 03:17   #1
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
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)?
BlueAchenar is offline  
Old 21 December 2008, 10:31   #2
alexh
Thalion Webshrine
 
alexh's Avatar
 
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
alexh is offline  
Old 21 December 2008, 19:30   #3
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
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...
BlueAchenar is offline  
Old 21 December 2008, 19:36   #4
musashi5150
move.w #$4489,$dff07e
 
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 42
Posts: 2,351
I guess it'll be a tight movem loop for you then
musashi5150 is offline  
Old 07 January 2009, 14:59   #5
Photon
Moderator
 
Photon's Avatar
 
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.
Photon is offline  
Old 08 January 2009, 02:04   #6
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
Quote:
Originally Posted by Photon View Post
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.
I'll remember that when I need it (I opted not to try anything DMA related right now). Thanks
BlueAchenar is offline  
Old 11 January 2009, 19:58   #7
Photon
Moderator
 
Photon's Avatar
 
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.
Photon is offline  
Old 22 January 2009, 01:19   #8
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
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.
Ray Norrish is offline  
Old 22 January 2009, 01:41   #9
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
Quote:
Originally Posted by Ray Norrish View Post
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.
Thanks. I'd love to know how to use the blitter well.
BlueAchenar is offline  
Old 22 January 2009, 01:54   #10
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
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)
Ray Norrish is offline  
Old 22 January 2009, 01:56   #11
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
Quote:
Originally Posted by Ray Norrish View Post
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)
I saw somewhere that the blitter could be used to encode/decode MFM disk tracks. Is this really possible?
BlueAchenar is offline  
Old 22 January 2009, 01:58   #12
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
Join Date: May 2005
Location: Cheshire, UK
Age: 56
Posts: 322
Quote:
Originally Posted by BlueAchenar View Post
I saw somewhere that the blitter could be used to encode/decode MFM disk tracks. Is this really possible?
of course. Remember that the blitter worked on odd cycles, so it could double throughput. It was a powerful chip in its own right
Ray Norrish is offline  
Old 22 January 2009, 02:01   #13
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 42
Posts: 690
Quote:
Originally Posted by Ray Norrish View Post
of course. Remember that the blitter worked on odd cycles, so it could double throughput. It was a powerful chip in its own right
That would be a very useful trick for me to learn!
BlueAchenar is offline  
Old 22 January 2009, 02:18   #14
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
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
Ray Norrish is offline  
Old 22 January 2009, 23:29   #15
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
Quote:
Originally Posted by BlueAchenar View Post
I saw somewhere that the blitter could be used to encode/decode MFM disk tracks. Is this really possible?
Certainly. The logical operation that you perform to decode a sector is, in C:

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);
In order to perform that operation using the blitter:
- 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);
So in order to decode with a blit operation, you do something like:
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
Kalms is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:16.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11592 seconds with 15 queries