English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 01 March 2010, 01:44   #1
redblade
Zone Friend
 
redblade's Avatar
 
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.
Attached Files
File Type: txt uCopperExample.S.txt (4.1 KB, 267 views)
redblade is offline  
Old 01 March 2010, 11:22   #2
phx
Natteravn
 
phx's Avatar
 
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() ?
phx is offline  
Old 01 March 2010, 16:12   #3
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
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()
it should work. "CopListPtr" is the result of the _LVOUCopperListInit() call, i.e. you'll have to do
Code:
	move.l	d0,CopListPtr
right after the _LVOUCopperListInit() call.

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.
StingRay is offline  
Old 05 March 2010, 13:43   #4
redblade
Zone Friend
 
redblade's Avatar
 
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.
redblade is offline  
Old 13 March 2010, 00:48   #5
redblade
Zone Friend
 
redblade's Avatar
 
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.
redblade is offline  
Old 26 March 2010, 02:59   #6
redblade
Zone Friend
 
redblade's Avatar
 
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.
redblade is offline  
Old 27 March 2010, 22:57   #7
Photon
Moderator
 
Photon's Avatar
 
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.
Photon is offline  
Old 03 April 2010, 06:25   #8
redblade
Zone Friend
 
redblade's Avatar
 
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.
redblade is offline  
 


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

Similar Threads
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

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


All times are GMT +2. The time now is 11:32.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13108 seconds with 14 queries