English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 18 April 2021, 17:30   #1
KONEY
OctaMED Music Composer
 
KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
Problem with blitter fills on fast machines (Maybe bchg?)

Stuck again with a very annoying problem.

I made a vector object drawn with blitter and then copied with fill mode in another bitmap. Everything is OK but the same code in a fast machine returns different values (always different in a different way) and I'm quite puzzled

This is what happens:



basically corners are not erased properly but this always change, they are never wrong in the "same way".

Being a BCHG instruction responsible for erasing the pixel corner I think the problem is within this piece of code:

Quote:
move.l a0,a1 ; copia l'indirizzo
cmpi.w #7,d1 ; il numero del bit e` > 7 ?
ble.s NonCorreggi ; se no salta
addq.w #1,a1 ; ..altrimenti punta al prossimo byte
subq.w #8,d1 ; e rendi il numero del bit < 7
NonCorreggi:
not.b d1 ; inverti la numerazione dei bit

bchg d1,(a1) ; inverti il primo pixel della linea
which comes from Randy's course

It seems like in fast machines the results are not consistent, and it's driving me crazy enough to beg for help

full code: https://github.com/KONEY/mechmicrobe...R_FILL_DEBUG.s
Attached Thumbnails
Click image for larger version

Name:	015.png
Views:	198
Size:	3.7 KB
ID:	71623  
KONEY is offline  
Old 18 April 2021, 18:09   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,038
I see nothing wrong in that piece of code. subq.w #8,d1 is not needed (you can add/sub 8/16/24/... and it will work the same since only the bottom 3 bits matter when bchanging the memory).
It's probably a combination of that and something else, or something else.
a/b is offline  
Old 18 April 2021, 18:31   #3
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Code works for me, only thing I see is a read from $dff000 in the blitter wait, which should be fixed but it should not cause the bugs you are experiencing.
StingRay is offline  
Old 18 April 2021, 18:41   #4
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,038
Just theoretical, but maybe a cause.. Blitter and cpu are writing to the same byte.
You are modifying the bitmap with cpu while the blitter is running. Since you generally draw a poly-line (end pixel of one is start pixel of next) there's a good chance CPU and blitter will hit the same pixel/byte in wrong order and negate one of the writes.
a/b is offline  
Old 18 April 2021, 22:20   #5
KONEY
OctaMED Music Composer
 
KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
Thanks, after spending the afternoon I tried another routine which is more optimized and it hasn't the problem. Seeing the same coordinates return a different thing at every refresh was quite crazy, still very curious to know what was going on!

@stingray that tst.w (a6) is in Photon's miniwrapper and I'm not sure what its role is. What I know is that usually in its place the instruction below ( btst #6,2(a6) ) is repeated, for some bug on older models I think. Maybe Photon's one was the same and there's an error?
KONEY is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lionheart - Shifted line problem on AGA machines viddi support.Games 72 08 April 2021 11:06
Blitter fill problem mekhall Coders. Asm / Hardware 7 20 June 2016 00:04
Blitter problem zeGouky Coders. Asm / Hardware 7 26 March 2014 14:12
Fast Blitter Line Clipping 71M Coders. Asm / Hardware 2 03 March 2014 22:33
Blitter Sweet oldskool intro problem! amilo3438 support.WinUAE 9 02 July 2013 11:44

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:03.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.19109 seconds with 14 queries