Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!amdahl!oliveb!amiga!jimm
From: jimm@amiga.UUCP (Jim Mackraz)
Newsgroups: comp.sys.amiga.tech
Subject: Re: I fixed the loadrgb4() problem myself
Message-ID: <2755@amiga.UUCP>
Date: 15 Aug 88 18:58:01 GMT
References: <4989@pasteur.Berkeley.EDU>
Reply-To: jimm@cloyd.UUCP (Jim Mackraz)
Organization: Commodore-Amiga Inc, Los Gatos CA
Lines: 55

In article <4989@pasteur.Berkeley.EDU> koster@cory.Berkeley.EDU (Herbert West) writes:
)I had this problem that with double buffering, each LOFlist had its own
)color load-up set, so LoadRGB4() only worked on the last LOFlist and not
)the other ones.
)
)I tried various honest things, then decided just to look at the ROM and see
)what they do. I single stepped the LoadRGB4() routine, and what did I find?
)They modify an existing in-use Copper list on the fly!
)
)They look through the LOFlist and find copper load instructions to the
)0180++ range for the color table, then write the next word.
)

I don't really want to join the long list of people warning you that
you'll blow up if the copper lists the OS creates ever change in format,
but I thought of another problem you might have.

)I figured if they are doing it, why don't I? I have three LOFlists
)and look for the 0180++ loads just like they do, and don't even call
)LoadRGB4(). I have to do it on each list, of course.

The reason is that use of the system screen copper lists is arbitrated by
Intuition, so that if you allow the user to drag screens, hit AmigaM/N,
or a system requester pops a screen to the front, Intuition will FreeMem()
the copper lists (or maybe it's FreeVPortCopLists or something).  Unless
your are protected against this, you is busted, big-time, this release.

Now if you are protected against this, your only sin is assuming something
about the format of the copper lists created by MakeVPort().

Now, I don't know why you needed to change colors so often, nor some other
things about your requirements, but if you can, you might want to prepare
two viewports, and two views, and double-buffer using LoadView().  This
is 'least overhead' (near-optimal) and you can just call LoadRGB4()
on both viewports.

Now if you really are going to assume the format of the copper lists, and
protect against them being freed, you only need to search once, and as I
tried to suggest in some mail (might have bounced), you might even consider
using the blitter to copy the color map portion of copper lists around.

But indeed, you better make it clear that you will possible need an upgrade
in the future, and that such problems will be yer fault.  You won't be the
first, but if you can use the system calls, or protect yourself from
system changes (such as by cobbling your  own copper lists which are
copies of the V1.2 copper lists maybe), it would be better.

)koster@cory.berkeley.edu
)David Ashley


-- 
	Jim Mackraz, I and I Computing	  
	amiga!jimm	BIX:jmackraz
Opinions are my own.  Comments regarding the Amiga operating system, and
all others, are not to be taken as Commodore official policy.