13 May 2018, 22:28 | #1 |
Posts: n/a
|
Devpac: Data section in Chip-Mem
This is my first post, so bear with me...
My Devpac3 documenation suggests that I can get data-sections loaded in Chip-mem with this assembler directive before the data: SECTION Image,DATA_C But how is this supposed to work in practice? The code is relocatable, and is loaded somewhere in Fast-Mem, $200000-somewhere on my system. In my code I'm referencing relative symbols, how am I supposed to reach the data if the AmigaDOS-loader puts a section/hunk somewhere in Chip-Mem? My workaround now is to allocate chip-mem and move the data at runtime. Any thoughts or input around this? Kind regards, R. Bratseth |
13 May 2018, 22:41 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Hi and welcome.
There are two methods. - advanced: scan through hunks list in memory - standard an simple that use reloc in executable: reference through a label For the latter one example is: Code:
SECTION Code,CODE Start: lea my_image,a0 ... rts SECTION Image,DATA_C my_image: ds.b 320*256/8 |
13 May 2018, 22:49 | #3 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,987
|
Quote:
You will have to use absolute addresses, which will relocate to the correct address when the program is run. If you wish to keep your code PC relative and use pointers, that keeps your code neat. So for instance move.l picture_pointer(pc),a0 picture_pointer: dc.l picture Section Picture,Data_C Picture: incbin sysicture.raw But most will settle for simply using absolute which will relocate. lea picture,a0 |
|
13 May 2018, 23:12 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Just to add some info about "indirect" access suggested by Galahad (that I make it also fall into the second of my cases).
You might ask why use a slower code (four more cycles, [EDIT:in pure 68k]), which requires 2 bytes more in code section and that in any case uses a relocation. Well, to maintain open a possibility for a change of "picture_pointer" in successive code. You can take the first setup like an init. If you think you never change the pointer then use the lea statement. Last edited by ross; 13 May 2018 at 23:20. Reason: [] |
14 May 2018, 01:13 | #5 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Nearly unknown to most people is that OS3.0 introduced a new relocation hunk called HUNK_RELRELOC32, which in fact enables resolving relative references between sections! It only works with 32-bit PC-relative references though, so a 68020 is required, additionally to V39.
|
14 May 2018, 08:45 | #6 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Personnally I value the BASEREG directive very much. Ok, it doesn't work on Devpac
|
14 May 2018, 10:06 | #7 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
Can be useful to make more compact 020+ code (freeing some structured data). Thank you for highlighting its existence Yes, BASEREG register usage are really valuable and a good practice! (I've always used it "manually" in Devpac for the heap). |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HELP - Need mask for chip Mem | Sinphaltimus | support.Hardware | 6 | 20 July 2017 22:38 |
Devpac - CNOP in a BSS Section | h0ffman | Coders. Asm / Hardware | 30 | 18 March 2015 23:12 |
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 |
Need virtual memory for chip mem. | Thorham | request.Apps | 7 | 28 March 2008 15:06 |
|
|