Amiga Computing - Commodore Is Awesome
Amiga Computing - Commodore Is Awesome
Amiga Computing - Commodore Is Awesome
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
92<br />
TUTORIAL<br />
values are those in the hardware copper<br />
list, so if beplane pointer adjustment needs<br />
to be done quickly, this is the place to do it.<br />
In short we need to search this list, find<br />
the instructions which set up the biplane<br />
pointers at the start of each display frame,<br />
and alter these.<br />
To avoid visible display disturbance. it's<br />
obvious that such adjustments need to be<br />
made at times when the Copper is not trying<br />
to read the bitpiane addresses itself. The<br />
secret here lies in realising that the Copper<br />
re-initialisation occurs as part of the housekeeping<br />
that goes on during vertical blanking<br />
intervals. A number of options are available<br />
but I'll discuss these when I deal with<br />
the scroll code itself.<br />
As you increase (or decrease) a screen's<br />
bitplane pointers, the effect will be to bring<br />
new bitplane memory into the visible display<br />
area. If, therefore, you set up a normal<br />
sized screen, the result of any bitplane<br />
pointer adjustment will be to move the<br />
memory area being used for the real display<br />
640 pixels wide<br />
Within the screen data that Intuition sets up there is<br />
a pointer to a View structure and the first thing we<br />
need to do is get the address of this using Intuition's<br />
ViewAddress() function. The result comes back in<br />
de and can be used immediately, because within the<br />
View structure there is a field called v_LOFCprList.<br />
This points to a cprlist structure which provides a<br />
pointer to the copper list the hardware actually executes.<br />
The end result is that we identify the sten of<br />
the required hardware list using this sort of code:<br />
CALLSTS Vie cAddre ss, _ EntuitionSist<br />
loce.1 dO, a 0 copy to an address righte r<br />
acce.1 c_ LAFC prtistia 0 ), a 0<br />
cri_start(a0),a0 pointe r to sta rt<br />
List Amm in e t<br />
Once we've got to this stage a loop needs to be<br />
used to locate the appropriate bitplane instructions.<br />
Copper instructions consist of two lb-bit words<br />
where the first word specifies the instruction type<br />
and the second specifies a data item. The instruction<br />
we need to locate is the first of a series of<br />
Figure 1 : Only the lowe r<br />
port of each! Chole r,* will<br />
iso vfuibl. whe n the<br />
'croon first ope ns.<br />
Top part of display will not be visible<br />
when screen first opens<br />
This lower part of display will be<br />
visible when screen opens<br />
<strong>Amiga</strong> <strong>Computing</strong><br />
MAY 1995<br />
EALISTS Vie cAddre ss, _ I ntoitiontise<br />
love d<br />
sove.t<br />
one.1<br />
march copia<br />
bed.'<br />
eddo.t<br />
Pre.'<br />
alecceendedlo_ I<br />
note.<br />
Listing t TimGoppor tAit se a rching code in its glory!<br />
outside the memory holding valid screen<br />
graphics information. This usually means<br />
that rubbish gets displayed on the screen.<br />
so the secret is to create an oversized<br />
display-memory area so that you only ever<br />
scroll within the bounds of whatever valid<br />
graphics data you've set up.<br />
CREATIONS<br />
As far as screen and window creation is<br />
concerned, very few changes are needed<br />
to last month's code The screen's title and<br />
.<br />
4<br />
t<br />
i<br />
o<br />
.<br />
p<br />
o•move<br />
instructions that copy bitplane pointer values<br />
iinto<br />
the <strong>Amiga</strong>'s bitplane hardware registers.<br />
n As the hardware registers can only hold 16-brt val-<br />
tues<br />
it actually requires a pair of registers, and there-<br />
e<br />
fore two separate copper instructions, to store a full<br />
r<br />
32-bit memory pointer. It just so happens that the<br />
first pair of high and low bitplane registers set up in<br />
Intuition-created copper lists are those of the lowest<br />
numbered bitplane. conventionally known as<br />
bitplane 1.<br />
The corresponding registers, called BPL1PTH<br />
and SPIAPTL. have absolute addresses of $0080<br />
and $00e2 above the custom chips base address,<br />
so what we need is a search loop which moves<br />
through a hardware copper list two words at a time.<br />
Riff)lane start<br />
identified by<br />
onginal bitplane<br />
Searching the hardware copper I15t<br />
comparing the first word of each instruction until it<br />
finds one which starts with Sea<br />
.search copi.c<br />
becks<br />
addo.t<br />
lion<br />
114,te0) look at insteoction<br />
Jearchend found e l instruction<br />
14,10 move to nest instruc—<br />
Oraa a e a rch N I A keep searching<br />
limAr<br />
0,10 o 0 A T to an Address re giste r<br />
c_LOFiprtistialThs0<br />
cr1_startfa0t,10 s t a r t of tilt nom in 10<br />
ASe0,fa0<br />
[oat a t instruction<br />
.seerchend f o u s d e0 instruction<br />
ei,10 m o v e to next instruction<br />
.sesrch and keep searching<br />
02a0 e v e r to 2nd instruction war<br />
•0,rappertistic a n d save Pointe r<br />
title bar will be removed by setting<br />
SA_Oulet tag to true and, because a<br />
play window is needed that is free fr<br />
any of Intuition's system gadgets. I<br />
going to turn the window into one of<br />
'invisible' borderless backdrop variety.<br />
To implement these latter changes I<br />
the WA_Borderless and WA_Backdroe<br />
tags to true, add false WA_DepthGadgee<br />
and WA_CloseGadget tags, and modify<br />
the window's title and drag bar tags. At<br />
these lags are defined in the system head<br />
ers but, as per usual, I'll be defining ir%<br />
own versions so that those of you withou'<br />
the official includes can still assemble the<br />
code. The end result is that you'll fine<br />
these changed tag definitions incorporate<br />
into the window's tag list:<br />
dc.IWA_Dragaer,TALSE<br />
dc.tiktittediALL<br />
dc.tdA_Bordertess,TRUE<br />
dc.t4A_Baccdrop,ILIE<br />
dc.tilt_DepthGadget, FALSE<br />
dc.tilA_CloseGadget, FALSE<br />
Screen and window sizes also have to<br />
be changed and here I have, somewhat I<br />
arbitrarily, chosen to use a high-res 640<br />
pixel wide screen with a height of 600<br />
lines. The resulting arrangement of the<br />
screen's bitplanes in memory, relative to<br />
what you as a viewer would see on you<br />
monitor, is shown in figure 1. 4 7 0<br />
,<br />
When the loop terminates, the first bitplane oriented<br />
copper instruction has been found, so just add two<br />
to it so that a0 is pointing to the second word (the<br />
data word) of the instruction, and then you can store<br />
the result for future use<br />
.<br />
.searctend Addo.1 $2,e0 e o n to 2nd !Attraction<br />
cord<br />
move.1 e0,coonertist_n e n d sive<br />
pointer<br />
If we put all these ideas together we end up with<br />
the code shown in listing 1. Don't worry if some of<br />
the ideas seem like magic to start with — just concentrate<br />
on understanding the basis of what we're<br />
doing. The important thing is that this code fragment<br />
enables us to find out the whereabouts of the<br />
instructions which set up those bitplane addresses<br />
in the copper list Intuition places. The only bad news<br />
from your point of view is that you now have to wait<br />
until next month's instalment to see how we make<br />
use of this informationl