A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / bobs blitting gfx bugs

 

Author Message
bigJz
Member
#1 - Posted: 1 Aug 2008 21:55 - Edited
Reply Quote
hi

I want to blit on a 320x160 32 colors screen, 2 bobs (96x96 and 320x82).
I use a double buffering. blitting is on the top of the screen.

how to do the vbl timing ?
I have flickering and glitching depending of timing and hardware (a500,a1200...)

If I put my blit routine in VBI, it slow down animation and music (pt player is in VBI).

I tested several timing:
.wait
move.l $dff004,d0
and.l #$1ff00,d0
cmp.l #312<<8,d0 ; or 255
bne.b .wait

or

.wait
cmpi.b #-1,$dff006
bne.s wait
.wait2 cmpi.b #3,$dff006
bne.s .wait2

how to get a good timing hardware compatible ?
or using triple buffering ?

thanx
ZEROblue
Member
#2 - Posted: 2 Aug 2008 00:42
Reply Quote
You don't need more than two buffers to get flicker free animation.

In your case you don't even need double buffers since your screen and blits are small and can be done quickly in between the end and beginning of your screen. Simply waiting for the first raster line after the screen before starting the blits and calling the PT replay will work.

If you paste or upload the code somewhere it will be easier to see exactly what you're doing wrong.
hitchhikr
Member
#3 - Posted: 2 Aug 2008 00:57 - Edited
Reply Quote
You could try that:

wait_sync:
        btst #0,$dff005
        beq.b wait_sync
.wait_sync:
        btst #0,$dff005
        bne.b .wait_sync


Make sure the bitaplnes swapping isn't located in the VBI.
The correct sequence would be: wait sync / swap front & back buffer / clear back buffer (if necessary) / blit to back buffer / display back buffer in copperlist / loop.
bigJz
Member
#4 - Posted: 2 Aug 2008 12:13 - Edited
Reply Quote
ok

my routine :

AnimBob:
bsr syncvbl ; one of the 2 routines above [EDIT:  
in the mainloop, not here] move.l ptscreen1(pc),d0 move.l ptscreen2(pc),ptscreen1 move.l d0,ptscreen2 lea CopperListBitplan,a0 move.w #4,d1 move.w #40,d2 bsr bitplan_install ; put d0 in copperlist ; clear screen move.l ptscreen1(pc),a0 move.w #96*5*64+12/2,d0 bsr waitblitter move.l #-1,$44(a6 ) move.l #$1000000,$40(a6) move.w #0,$66(a6) move. l a0,$54(a6) move.w d0,$58(a6) ; copy bob 1 lea Bob1,a0 move.l ptscreen1(pc),a1 lea maskbob1 ,a2 bsr waitblitter move.w #40-12,$60(a6) ; mod C dest move.l #0,$62(a6) ; mod B bob1 - mod A mask bob1 move.w #40-12,$66(a6) ; mod D dest move.l #-1,$44(a6) move.l #$fca0000,$40(a6) m ove.l a2,$50(a6) move.l a0,$4c(a6) move.l a1,$48(a 6) move.l a1,$54(a6) move.w #96*5*64+12/2,$58(a6) ; copy second bob lea bob2,a0 move.l ptscreen1(pc),a1 adda.l #40 *5*10,a1 add.l posBob2(pc),a1 ; moving position lea maskbob2,a2 bsr waitblitter move.l #0 ,$60(a6) ; mod C - B move.l #0,$64(a6) ; mod A - D move.l #-1,$44(a6) move.l #$fca0000,$40(a6) move .l a2,$50(a6) ; A mask bob2 move.l a0,$4c(a6) ; B bob2 move.l a1,$48(a6) ; C dest move.l a1,$54(a6) ; D dest move.w #62*5*64+40/2,$58(a6) rts


I use mask for bob1, but it is in background fix position. Perhaps only Bob2 need a mask (non square picture).
ZEROblue
Member
#5 - Posted: 2 Aug 2008 14:11
Reply Quote
What does your main loop look like from where you are calling AnimBob? Are you using an interrupt to call PT_replay? Are you sure that what you're seeing is not the lag/tear effect of a 50Hz PAL emulation without V-sync on a 60Hz or higher screen mode (if you're using an emulator)?

In general, don't raster sync to a position where an interrupt might occur (f.ex. syncing at line 0 with VBL interrupt on) and cause your sync to "miss". Don't change your copper list at any line where the copper might be reading the very instructions you're changing (f.ex changing the list at line 0 where the copper list starts execution each frame).

Try:

sync to $12b and then to $12c
switch your buffers and update the copper list
call PT replayer
draw your graphics
bigJz
Member
#6 - Posted: 2 Aug 2008 16:13 - Edited
Reply Quote
I missed the mainloop

mainloop:
bsr syncvbl ; and not in AnimBob
bsr AnimBob
btst #6,$bfe001
bne mainloop

I use an interrupt to call PT_replay.
On emulator, the bug could appear, depending of settings "immediat blitter" or "cycle exact cpu".

the screen start at line $29 in copperlist.
I made a test with blitter priority On in dmacon at the start of the animbob, and Off at the end, with wait raster 255 : no more bugs on real A1200 nor A500 (even on uae)

I hope it's good on other hardware (a600,a4000...)
bigJz
Member
#7 - Posted: 2 Aug 2008 18:47
Reply Quote
now I have trouble with another routines :p
1 text writer using blitter (not very fast I think)
1 background effects (dots flag not too big 31x31 and filled vectors - not at the same time)

if I want no slow down, or flickering, or big blitter bugs on the writer,
where to put these routs?
for now, the writer is in a mainloop (second one, after first AnimBob).
If I put back effect in VBI, effect and player slow down.
If I put writer and back effect in VBI or both in main, or blitter priority On, I have a blitter conflict with the writer.
for now, I put back effect in a copperInterrupt. works fine on real A1200,
but on A500 the back effects are slow and flicking. (impossible to get same bugs on uae)

how to know where to put the copper interrupt (if I use it), or the synchro
for the writer? or put all routs in VBI or copper interrupt ?
ZEROblue
Member
#8 - Posted: 2 Aug 2008 19:14
Reply Quote
For speed's sake it doesn't matter in what order or where you call your routines, summed up they still require the same amount of time regardless.

Starting the background effect during the VBI gives no special speed benefit or such, and in your case it seems you are rendering text during that time anyway and will just clutter up your bitplanes. If you can't layer your effects in separate bitplanes to avoid overdraw, then you should make sure that each effect is finished before you start drawing the next one.

It would be easier to explain the best way to render your effects if you post a screenshot or image of what you want to do.
bigJz
Member
#9 - Posted: 2 Aug 2008 21:41 - Edited
Reply Quote
I'm working for the first time on a little intro for "real", not only for me, for joke... I haven't coded since many years now. So I need some help ;)

My A500 have a crappy keyboard and floppy drive now. I can only use assembler on A1200, else using WinUae. But It's not the same thing than a real A500.

the writer is like on ICE/Silents. the letters (4 colors) are written with cpu on 2 firsts bitplans, the "flying" ones are blitted on the third bitplan (20 letters). It use the first playfield.
the dots flag use only 1 bitplan (can use 3 bitplans). It use the second playfield. not optimized (certainly not like the Flag in Rampage/Tek, or others big Flags).
There are 6 sprites 4 colors on the main screen and a logo 5 bitplans at the top of the screen.
the text+effect is (320x160x3)x2

in Ice/Silents, it was a 3d object on the screen with the writer. I don't know what can I put in background with such writer.

Example

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0