Frozen Utopia Forum
Welcome, Guest. Please login or register.
September 09, 2010, 01:19:16 PM

Login with username, password and session length
Search:     Advanced search
Mysterious Song pre-orders to reopen shortly.
8659 Posts in 571 Topics by 73 Members
Latest Member: angiela2j
* Home Help Search Calendar Login Register
Frozen Utopia Forum  |  For Developers  |  Programming Techniques  |  Topic: DMA routine for HuC 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: DMA routine for HuC  (Read 1309 times)
tomaitheous
Guest
« on: May 19, 2006, 05:42:47 PM »

***UPDATE***

I updated the routine and zip file. The array was causing the compiler to bloat and slowdown the code - fixed.

***CAUTION***
Don't use this routine if the number of bytes is more than 32 and the display is on. It will delay all interrupts!

 
[original]
Here's a small DMA routine for use with HuC. The PCE has a total of five DMA instructions - I actually didn't notice a fifth one until today Cheesy

I made the interface C friendly. The instructions on it use are inside the DMA_RTN.h file. The destination can be anywhere - VDC, VCE, memory, SGX data port($0012), etc. You're not limited to global variables when assigning the parameters, but it's prefered for speed when used in loops.

 The speed of the DMA is at ASM level since it's a block transfer instruction, but the arguement assigning is handled via the HuC compiler for flexibility and ease of use. If there is a need for a fast parameter setup in clock cycle resitrictive loops, let me know and I'll see what I can come up with.

Here's the file - http://pcedev.net/HuC/Dma_rtn.zip

 I'll post it on the magicengine forums, although the dev section looks to be at a crawl at the moment.


-Rich

« Last Edit: May 22, 2006, 10:46:05 PM by tomaitheous » Logged
tomaitheous
Guest
« Reply #1 on: May 19, 2006, 10:15:46 PM »

[Edit]
The DMA routine does not load BANK that contains the specific DATA pointed by routine.

For bandaid fix, do a
Code:
var=source_data[x]
each time in HuC to prime the bank, before using START_DMA() - until I can update the code.

If you use DMA_SRC=DATA right before START_DMA, you should be ok as this should cause HuC to load the corrosponding bank inwhich the DATA is pointed to.


[Edit]#2
DMA_SRC=DATA does not trigger the BANK switch - probably because it's a #define instead of a var. Use a global var to trigger the bank switch,i.e. force_bank=data[0]; .

« Last Edit: May 19, 2006, 11:02:01 PM by tomaitheous » Logged
Inpuptacuts
Ball Of Snow
*

Karma: +0/-3
Offline Offline

Gender: Male
Posts: 5


View Profile
« Reply #2 on: December 29, 2009, 06:48:06 PM »

Here's a dinky little program that will tell you the size of variables according to your environment/compiler.


Code:
Logged
Keranu
Frozen Utopia Member
Ruler Of The Cold
******

Karma: +7/-0
Offline Offline

Gender: Male
Posts: 1507



View Profile WWW
« Reply #3 on: December 29, 2009, 10:46:49 PM »

Hahaha, post of the year!
Logged

Paranoia Dragon
Frozen Utopia Member (A)
Ruler Of The Cold
******

Karma: +2/-0
Offline Offline

Gender: Male
Posts: 1192


Freedom is the right of all sentient beans!


View Profile
« Reply #4 on: December 30, 2009, 12:27:40 AM »

Here's a dinky little program that will tell you the size of variables according to your environment/compiler.


Code:

How can I apply this wonderful code with ASM #48328@# & the Fibinache routine?
Logged

Quadrapalegic Beligerant Mongaloidian Sloth Juggling Consultant
Nodtveidt
Soul Of Ice
Frozen Utopia Member (A)
Ruler Of The Cold
******

Karma: +4/-0
Offline Offline

Gender: Male
Posts: 1500


Master Of The Black Arts


View Profile
« Reply #5 on: December 30, 2009, 07:41:39 AM »

Here's my favorite piece of code:

Code:
if (user == lame)
{
  ban += user;
}
Logged

Pages: [1] Go Up Print 
Frozen Utopia Forum  |  For Developers  |  Programming Techniques  |  Topic: DMA routine for HuC « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.091 seconds with 20 queries.