21 April 2013, 12:54 | #1 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
AmiDEVcpp: Allocating gfxdata in chip mem
I´m trying AmiDEVccp to code a few things for Amiga68k but I have a problem.
When I define a gfx in other compilers I can use the chip keyword to allocate it in CHIPMEM but here I cant. How can I do it? Must I do AllocMEM in chipmem and copy my gfx there? What am I doing wrong? Thanks! |
21 April 2013, 13:13 | #2 |
Ya' like it Retr0?
Join Date: Jul 2005
Location: United Kingdom
Age: 49
Posts: 9,768
|
as I remember it you need to token the variable you want to store in chip.
in DICE I would use "__CHIP" before the variable - thats two underscore's btw i.e. Code:
__CHIP UBYTE tile[2048] To ensure that variables are stored in FAST memory, again the token of "__FAST" is used under DICE, there should be a pre-compiler list for these for the compiler that you are using. to dynamically allocate memory, as with all pointers its about your cast Code:
void main( void ) { __CHIP unsigned char *tile; tile = (char *) malloc ( sizeof (char) *2046 ); if (tile == 0) { printf("ERROR: Out of memory\n"); exit(0); } // REST OF CODE HERE*** // Remeber to free the pointer afterwards! } |
21 April 2013, 20:45 | #3 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
I'm out of home but I'll try tomorrow. Thanks mate!
|
21 April 2013, 20:53 | #4 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
__chip (lower case letters) should be defined in GCC (AmiDevCPP), if it's not then try __attribute((chip)) or __attribute((__chip__)). It may also require static duration, so you must declare it either static or global.
If you have to resort to allocating dynamically then you must use AllocMem(), calling malloc() and then casting to a pointer with __chip can never work because the qualifier only applies to storage of the pointer value itself. |
21 April 2013, 21:35 | #5 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,643
|
using a qualifier like __chip__ causes the data to be stored in a chip data hunk in the resulting executable, i.e. amigados loads it directly into chipmem.. If you don't find a way to make the compiler/linker do this, but use the allocmem method, you will have duplicate copies in memory, which is not a good idea :-)
|
21 April 2013, 21:49 | #6 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
I think I tried those qualifiers yesterday but remember to have an error "chip attribute is no supported in this target" or something similar. Hope to be in home soon and try. Thanks for the answers!
|
21 April 2013, 22:00 | #7 |
Amiga Tomcat
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,502
|
StormC uses Pragmas to set the type of memory that the data should be stored in.
i.e. #pragma Chip Everything from here until the #pragma Fast is encountered is stored in Chip RAM. Dave G |
21 April 2013, 22:56 | #8 | |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Quote:
If everything else fails then just put the array in its own file and type a couple of lines assembly to declare it as chip data, and assemble and link it in. That always works. |
|
22 April 2013, 03:32 | #9 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,424
|
I just use the API?
AllocMem Code:
MEMF_CHIP: If the requested memory will be used by the Amiga custom chips, this flag *must* be set. Only certain parts of memory are reachable by the special chip sets' DMA circuitry. Chip DMA includes screen memory, images that are blitted, audio data, copper lists, sprites and Pre-V36 trackdisk.device buffers. |
22 April 2013, 20:21 | #10 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
Yes NovaCoder. Thats the other option I use but wanted to know why it didn´t work.
I have tried all other options but not working. I´ll use the AllocMem/copy option. Thanks friends! Last edited by tolkien; 22 April 2013 at 22:37. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A600 2 Mb Chip Mem Upgrade (clockport) | mikele | MarketPlace | 7 | 12 March 2013 07:36 |
Amiga 500 chip mem | Nikolaj_sofus | support.Hardware | 3 | 03 September 2010 21:34 |
Clock port on my A600 chip mem expansion? | Frimann | support.Hardware | 10 | 18 August 2009 22:07 |
Allocating Fast RAM as Chip? | Fingerlickin_B | support.Hardware | 22 | 20 November 2008 22:15 |
Need virtual memory for chip mem. | Thorham | request.Apps | 7 | 28 March 2008 15:06 |
|
|