A.D.A. Amiga Demoscene Archive

  Welcome guest! Please register a new account or log in

  

  

  

Demos Amiga Demoscene Archive Forum / Coding / Weird bug?

 

Author Message
LaBodilsen
Member
#1 - Posted: 7 Mar 2016 19:55
Reply Quote
Hi..
moving on from dotflags, to a new effect involving bitmap scaling, i've come across a bug i simply can't explain.

i've done some scaling with 4 blitter copies with masks and shifting, after that have a tempbuffer where every 2nd word contains my final image. so i read a long word from tempbuffer, and write a word to Drawbuffer. effectively copying everu 2nd word to the drawbuffer

This work

move.l TempBuffer,A5
move.l DrawBuffer,A6

REPT 64
movem.l (A5)+,D0-D4
Movem.w D0-D4,(A6)
Movem.w D0-D4,10(A6)
Movem.w D0-D4,2560(A6)
Movem.w D0-D4,2570(A6)
Add.w #40,A6
ENDR


But this dont:
	REPT	32
move.l TempBuffer,A5
move.l DrawBuffer,A6

movem.l (A5)+,D0-D7/A0-A1
Movem.w D0-D4,(A6)
Movem.w D0-D4,10(A6)
Movem.w D0-D4,2560(A6)
Movem.w D0-D4,2570(A6)
Movem.w D5-D7/A0-A1,40(A6)
Movem.w D5-D7/A0-A1,50(A6)
Movem.w D5-D7/A0-A1,2600(A6)
Movem.w D5-D7/A0-A1,2610(A6)
Add.l #80,A6
ENDR


the really strange thing is, that number 2 method does what i expect if i comment out this line "Movem.w D0-D4,2560(A6)"

then everything else works as it should. but if this single line is included, the Drawbuffer get mangled with missing bitplanes and what not.

it does not pass vblank, as everything is neatly under one frame. and it does not write into some unwanted memory (checked that to).

another fun fact. if i repeat the code 16 times (REPT 16), but if i repeat it 17 times, the bug starts to show??..

any pointers would be helpfull, maybe it's a winuae bug :D (not likely)

regards
LaBodilsen
Member
#2 - Posted: 7 Mar 2016 20:36
Reply Quote
2nd piece of code should ofcourse be like this.


move.l TempBuffer,A5
move.l DrawBuffer,A6

REPT 32
movem.l (A5)+,D0-D7/A0-A1
Movem.w D0-D4,(A6)
Movem.w D0-D4,10(A6)
Movem.w D0-D4,2560(A6)
Movem.w D0-D4,2570(A6)
Movem.w D5-D7/A0-A1,40(A6)
Movem.w D5-D7/A0-A1,50(A6)
Movem.w D5-D7/A0-A1,2600(A6)
Movem.w D5-D7/A0-A1,2610(A6)
Add.l #80,A6
ENDR

LaBodilsen
Member
#3 - Posted: 9 Mar 2016 17:34
Reply Quote
Hi Again

nevermind, i found the bug.

it was caused be reusing D6 with a word value later in the code, but not clearing the whole longword of D6 before use. hence it contained old data, which in turn was used to retrieve a wrong sinus value..

case closed.

 

  Please register a new account or log in to comment

  

  

  

 

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