![]() |
![]() |
#1 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
uCopperExample.s Why does my code bomb?
Hi people.
Can some one please tell me why my code bombs? It seems to guru at _LVOFreeVPortCopLists(a6). Thanks in advance. |
![]() |
![]() |
#2 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,552
|
Doesn't FreeVPortCopLists() deallocate all copper lists of your view port?
You probably only want to deallocate your user copper list with FreeCopList() ? |
![]() |
![]() |
#3 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
That's what I think too, if you change the FreeVPortCopLists to
Code:
move.l CopListPtr(pc),a0 move.l GfxBase(pc),a6 jsr -546(a6) ; FreeCopList() Code:
move.l d0,CopListPtr Besides, your code is not very clean since you don't really check for errors, f.e. if graphics.lib couldn't be opened in your "openAll" routine you'll face a neat crash since you are using gfxbase in your "loadCopper" routine. |
![]() |
![]() |
#4 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
@stingRay: Yeah I know it's not very clean, It's roughly based on the RKM version, I still have to add all the Error Checking, doesn't require much tho.
It's bad to "Assume" that something will always work. |
![]() |
![]() |
#5 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
@Stingray: but RKM UCopperExample.s uses _LVOFreeVPortCopLists.
Really wished they released it in Assembler as well as C. |
![]() |
![]() |
#6 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
Right still debugging this code, Keep getting Error
$0100000F.$ADDRESS So according to /exec/allerts.i [pre]AN_BadFreeAddr equ $0100000F ; Memory header not located. ( Usually an ; invalid address passed to FreeMem() ) [/pre] so this means the error must be in my loop that sets up the copper list. It seems near identical to the RKM one which I run through MonAM. but I should be able to find the flaw. |
![]() |
![]() |
#7 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,684
|
I have a hard time getting from the code to the thought behind it, but at a quick glance your lib calls to create a copper list writes more than the 12 bytes you've alloced, or there's a messed up stack from the plethora of bra's and the rts'es.
I'd also look at the 'bcc to exit a fixed count loop'. Is this generated code from a compiler of some sort? If it's modified after that, the bcc to exit might not have the same meaning. Also, you test absolutely everything except the viewport. It's much more likely that you can open a lib or allocate 12 bytes. Also, a 32 color copperlist will occupy minimum 68 bytes, not 12. Sorry that I can't really help you solve it but only give hints, just had a quick look. |
![]() |
![]() |
#8 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
It's based on the ReSourced version of UCopperExample.c that comes with the kick13 RKM manual. I use MonAM and step through the RKM version and it works fine, it even _LVOAllocMem the same amount as I based my on the RKM version. But your right it could actually be caused by the stack.
I'll have another look at it again and again. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bomb the Bass new album | NewDeli | Nostalgia & memories | 13 | 09 September 2008 19:31 |
Best of Bomb the Bass - £2.99 | killergorilla | Retrogaming General Discussion | 7 | 23 April 2008 00:14 |
Ripping Bomb-x | fairchild | project.Sprites | 3 | 23 May 2005 14:03 |
Logic Bomb | Amiga1992 | Retrogaming General Discussion | 1 | 12 September 2002 17:08 |
|
|