English Amiga Board    


Go Back   English Amiga Board > » Coders > Coders. General

Reply
 
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: 31
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   Reply With Quote
Old 21 December 2008, 10:31   #2
alexh
Thalion Webshrine
 
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 10,514
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
__________________
Thalion Webshrine
alexh is offline   Reply With Quote
Old 21 December 2008, 19:30   #3
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 31
Posts: 690
Only chip memory... I remembered that right after I wrote the post. And that's a problem...
BlueAchenar is offline   Reply With Quote
Old 21 December 2008, 19:36   #4
musashi5150
move.w #$4489,$dff07e
 
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 31
Posts: 2,245
I guess it'll be a tight movem loop for you then
musashi5150 is offline   Reply With Quote
Old 07 January 2009, 14:59   #5
Photon
Oldskool Demo Coder
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Age: 41
Posts: 3,674
Send a message via MSN to Photon
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.
__________________
Henrik. Programs Amiga demos, iPhone apps, websites, etc.
A1000/512k - A500 2.0/040@28/4M/.5M slowmem/8M/SCSI/CF - A600 portable II 3.1/ACA630/WiFi/CF - 'A1700' 3.1/68060@80/64M/IDE-Fix Express/CF - etc."The difference between PC and Amiga is that 10yo PCs are worth $0. 20yo Amigas are worth a lot, and Amigas that are only 15yo cost a fortune!"
If you like Portal 2, try my >> single player and cooperation maps <<
Photon is offline   Reply With Quote
Old 08 January 2009, 02:04   #6
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 31
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   Reply With Quote
Old 11 January 2009, 19:58   #7
Photon
Oldskool Demo Coder
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Age: 41
Posts: 3,674
Send a message via MSN to Photon
I has nothing to do with DMA and everything to do with copying areas without overwriting the original.
__________________
Henrik. Programs Amiga demos, iPhone apps, websites, etc.
A1000/512k - A500 2.0/040@28/4M/.5M slowmem/8M/SCSI/CF - A600 portable II 3.1/ACA630/WiFi/CF - 'A1700' 3.1/68060@80/64M/IDE-Fix Express/CF - etc."The difference between PC and Amiga is that 10yo PCs are worth $0. 20yo Amigas are worth a lot, and Amigas that are only 15yo cost a fortune!"
If you like Portal 2, try my >> single player and cooperation maps <<
Photon is offline   Reply With Quote
Old 22 January 2009, 01:19   #8
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
Join Date: May 2005
Location: Cheshire, UK
Age: 45
Posts: 300
Send a message via ICQ to Ray Norrish
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.
__________________
Robotron remake - completed
I, Robot remake - WIP
Amiga demos in DHTML
Ray Norrish is offline   Reply With Quote
Old 22 January 2009, 01:41   #9
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 31
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   Reply With Quote
Old 22 January 2009, 01:54   #10
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
Join Date: May 2005
Location: Cheshire, UK
Age: 45
Posts: 300
Send a message via ICQ to Ray Norrish
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)
__________________
Robotron remake - completed
I, Robot remake - WIP
Amiga demos in DHTML
Ray Norrish is offline   Reply With Quote
Old 22 January 2009, 01:56   #11
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 31
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   Reply With Quote
Old 22 January 2009, 01:58   #12
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
Join Date: May 2005
Location: Cheshire, UK
Age: 45
Posts: 300
Send a message via ICQ to Ray Norrish
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
__________________
Robotron remake - completed
I, Robot remake - WIP
Amiga demos in DHTML
Ray Norrish is offline   Reply With Quote
Old 22 January 2009, 02:01   #13
BlueAchenar
Not dead yet!!! :D
 
BlueAchenar's Avatar
 
Join Date: Feb 2008
Location: Aveiro / Portugal
Age: 31
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   Reply With Quote
Old 22 January 2009, 02:18   #14
Ray Norrish
Registered User
 
Ray Norrish's Avatar
 
Join Date: May 2005
Location: Cheshire, UK
Age: 45
Posts: 300
Send a message via ICQ to Ray Norrish
I posted the code a long time ago. No probs to post it again if you don't have.
Check out the demo first
__________________
Robotron remake - completed
I, Robot remake - WIP
Amiga demos in DHTML
Ray Norrish is offline   Reply With Quote
Old 22 January 2009, 23:29   #15
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 121
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   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Old cache memory as a "base" for GVP memory rkauer Hardware pics 4 22 November 2008 06:23
Not enough memory Petesamus support.Games 26 30 June 2007 22:47
Memory numb New to Emulation or Amiga scene 5 15 March 2005 16:08
Memory THX1138 support.Hardware 3 04 May 2003 19:45
Memory Tazz support.Hardware 5 04 June 2001 17:51


All times are GMT +2. The time now is 22:56.

-->

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Page generated in 0.23992 seconds with 9 queries