#RastPort.AreaInfo
14-Dec-94 22:56:20
Sb: #44790-#RastPort.AreaInfo
Fm: Jim Maddox 74667,2175
To: Werner Kazmierzak 100041,1320
Werner –
Thanks for the response. I've tried setting RastPort.AreaInfo manually
and it doesn't seem to work. (Well, it works for one pass, and then
somehow resets to 0.)
I'm opening a screen using OpenScreenTagList(), then referencing
RastPort.AreaInfo and RastPort.TmpRas using the pointer I get from
Screen.RastPort. Here, I'll show you:
OPEN_SCREEN movea.l #0,a0 ; no NewScreen pointer
lea ScTags,a1 ; new screen base address
CALLSYS OpenScreenTagList,_IntuitionBase
move.l d0,screen_p
beq CLOSE_TRAS
move.l d0,viewport_p
add.l #sc_ViewPort,viewport_p
move.l d0,rastport_p
add.l #sc_RastPort,rastport_p
So here I get the pointer to the screen's RastPort and load it into
rastport_p. Then I call InitArea() and InitTmpRas():
* set up RastPort.AreaInfo
lea areainfo,a0 ; pointer to AreaInfo structure
lea areabuffer,a1 ; pointer to vector buffer
move.l #MAXVECTORS,d0 ; number of vectors that buffer can hold
CALLSYS InitArea,_GfxBase
* set up RastPort.TmpRas
lea tmpras,a0 ; pointer to TmpRas structure
movea.l tmprasbuf,a1 ; pointer to TmpRas buffer
move.l #PLANESIZE,d0 ; size of one bitplane is enough space
CALLSYS InitTmpRas,_GfxBase
Here's how I call AreaMove(), AreaDraw(), and AreaEnd(). Just to see if I
did indeed have to set RastPort.AreaInfo manually, I stuck a little test
in the loop:
dopoly1:
movea.l rastport_p,a1
moveq.l #10,d0
CALLSYS SetAPen,_GfxBase
lea poly1dat,a2
movea.l rastport_p,a1
move.l rp_AreaInfo(a1),d4
lea areainfo,a3
cmp.l a3,d4 ; compare contents of RastPort.AreaInfo with
; actual location of struct AreaInfo
bne signal_areainfo_error
move.b #6,d2 ; point count (after initial)
move.w (a2)+,d0 ; x-coord
move.w (a2)+,d1 ; y-coord
CALLSYS AreaMove,_GfxBase
cmp.w #-1,d0
beq signal_areafn_error ; make sure AreaMove() doesn't fail
dp1loop:
move.w (a2)+,d0
move.w (a2)+,d1
CALLSYS AreaDraw,_GfxBase
cmp.w #-1,d0
beq signal_areafn_error ; make sure AreaDraw() doesn't fail
subq.b #1,d2
bne dp1loop
CALLSYS AreaEnd,_GfxBase
rts
signal_areainfo_error:
movea.l bm1_Planes,a4 ; trash screen a little if there's
add.l #8200,a4 ; a problem
movem.l d0-d7/a0-a7,(a4)
add.l #200,a4
movem.l d0-d7/a0-a7,(a4)
lea areainfo,a3 ; fix the problem?
movea.l rastport_p,a4
move.l a3,rp_AreaInfo(a4)
rts
Here's what I saw when I traced it with MonAm: First, the program traps
the incorrect RastPort.AreaInfo pointer (a 0, usually) and corrects it.
Then it quits back to the calling function ("main"). The main loop calls
the polygon routine again. It passes the AreaInfo pointer test, and the
AreaMove() succeeds. Then it goes to the first AreaDraw() — and when
AreaDraw() pulls the RastPort.AreaInfo pointer, it gets a 0!
(Incidentally, I also stepped through AreaMove() and AreaDraw() and got
totally confused at the end. It looks as though AreaMove() tried to
change the pointer RastPort.BitMap!)
Sorry to unload on you like this, but I seem to be hopelessly lost here.
:l
>> Tell me if this would not help, so I may E-Mail you some asm code
>> fragment I use since day one to set up the TmpRas and AreaBuffer.
That would help. Thanks.
– Jim, on AP!