English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 15 November 2021, 21:06   #1
losso
Registered User
 
losso's Avatar
 
Join Date: Oct 2013
Location: Hamburg
Posts: 69
Behavior with BPLCON1 shifts and mid-scanline BPLCON0 change

I've run into a bitplane rendering mismatch when using BPLCON1 shifts and changing the number of bitplanes mid-scanline.

Display setup:
  • 352px overscan + 16px invisible
  • BPL1 = full-width (used as overlay)
  • BPLPT2/BPLPT3 and BPLPT4/5 point to the same 2-bitmap image (256px wide)
  • BPLPT2-BPLPT5 are set on each new line
  • Switch to 5 bitplanes at hpos $42 and back to 1 bitplane at $c4
  • PF2 bits of BPLCON1 are used to shift the center image ($00 .. $F0)

The copper instructions look like this for each line (with different values for BPLCON1):

Code:
 0100 1200 [06c 0d0]  ;  BPLCON0 := 0x1200
 6d01 fffe [06c 0d6]  ;  Wait for vpos >= 0x6d and hpos >= 0x00 VP 6d, VE 7f; HP 00, HE fe; BFD 1
 0102 0000 [06d 008]  ;  BPLCON1 := 0x0000
 00e4 0001 [06d 00c]  ;  BPL2PTH := 0x0001
 00e6 5c14 [06d 010]  ;  BPL2PTL := 0x5c14
 00e8 0001 [06d 014]  ;  BPL3PTH := 0x0001
 00ea 5c14 [06d 018]  ;  BPL3PTL := 0x5c14
 00ec 0001 [06d 01c]  ;  BPL4PTH := 0x0001
 00ee 5c34 [06d 020]  ;  BPL4PTL := 0x5c34
 00f0 0001 [06d 024]  ;  BPL5PTH := 0x0001
 00f2 5c34 [06d 028]  ;  BPL5PTL := 0x5c34
 6d43 fffe [06d 02c]  ;  Wait for vpos >= 0x6d and hpos >= 0x42 VP 6d, VE 7f; HP 42, HE fe; BFD 1
 0100 5200 [06d 048]  ;  BPLCON0 := 0x5200
 6d51 fffe [06d 04c]  ;  Wait for vpos >= 0x6d and hpos >= 0x50 VP 6d, VE 7f; HP 50, HE fe; BFD 1
 01a2 0eee [06d 058]  ;  COLOR17 := 0x0eee
 6dc5 fffe [06d 05e]  ;  Wait for vpos >= 0x6d and hpos >= 0xc4 VP 6d, VE 7f; HP c4, HE fe; BFD 1
 01a2 0aaa [06d 0cc]  ;  COLOR17 := 0x0aaa
 0100 1200 [06d 0d0]  ;  BPLCON0 := 0x1200
 ...
I used a cover-up sprite for my specific use case, hence the COLOR17 stuff. Screenshots and test executable are attached. The red boxes show where the BPLCON0 switches occur and can be moved when the left mouse button is pressed.

Tested with WinUAE 4.4.0 and latest Beta, showing slightly different behaviors.

(EDIT: test executable updated)
Attached Thumbnails
Click image for larger version

Name:	bplcon0-switch.png
Views:	226
Size:	121.3 KB
ID:	73809   Click image for larger version

Name:	sysinfo.png
Views:	166
Size:	90.8 KB
ID:	73810  
Attached Files
File Type: zip bplcon.zip (6.1 KB, 70 views)

Last edited by losso; 16 November 2021 at 09:52.
losso is offline  
Old 16 November 2021, 17:49   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,504
Great, new undocumented feature

It is more correct in subpixel mode (missing left part becomes visible). I haven't yet debugged why it even happens..

There is probably some internal Denise delays that cause this effect.
Toni Wilen is online now  
Old 16 November 2021, 19:38   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,504
Could you do following tests:

- I assume it does not happen if PF1 == PF2?
- does it happen if you swap PF1 and PF2?
- does it happen if PF1 BPLCON1 bit is F (instead of zero. Or some other non-zero static value)? (or when swapped, PF2 is F)
- does it happen only if PF1 > PF2 and/or PF2 > PF1?

PF1 != PF2 requires subpixel mode which explains the difference.
Toni Wilen is online now  
Old 17 November 2021, 00:56   #4
losso
Registered User
 
losso's Avatar
 
Join Date: Oct 2013
Location: Hamburg
Posts: 69
Test executable updated (adjust PF1 portion of BPLCON1 with RMB + mouse up/down). Screenshots with PF1 values of $0 to $f attached, that should cover all combinations.

I hope the literal screenshots are still helpful, don't have any capturing equipment...
Attached Thumbnails
Click image for larger version

Name:	15.jpg
Views:	150
Size:	53.2 KB
ID:	73831  
Attached Files
File Type: zip pf1-screenshots.zip (868.3 KB, 75 views)
File Type: zip bplcon-new.zip (6.2 KB, 71 views)
losso is offline  
Old 17 November 2021, 01:00   #5
losso
Registered User
 
losso's Avatar
 
Join Date: Oct 2013
Location: Hamburg
Posts: 69
For completeness: This is how the center image looks like
Attached Thumbnails
Click image for larger version

Name:	debug-center.png
Views:	172
Size:	2.0 KB
ID:	73832  
losso is offline  
Old 18 November 2021, 18:21   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,504
Interesting tiny difference when ECS Denise or AGA. (Check black/red in right edge) OCS Denise or A1000: identical to image in first post.

Old test executable. Image is from real A500 connected OSSC + custom configured "extreme" overscan mode.
Attached Thumbnails
Click image for larger version

Name:	IMG_20211118_191035.jpg
Views:	143
Size:	193.9 KB
ID:	73844  
Toni Wilen is online now  
Old 19 November 2021, 18:12   #7
dirkwhoffmann
Dirk Hoffmann
 
dirkwhoffmann's Avatar
 
Join Date: Jun 2019
Location: Karlsruhe
Posts: 33
I've probably made it work in vAmiga. Some details can be found in this GitHub issue:
https://github.com/dirkwhoffmann/vAmiga/issues/609

However, I am not sure if this can help troubleshooting UAE since the code base of vAmiga is completely different.

Furthermore, I’ve only tested the program with the start configuration and I haven’t compared my emulator output with the real machine for other BPLCON combinations yet (in other words: I didn’t push any mouse button when running the test).
dirkwhoffmann is offline  
Old 19 November 2021, 18:14   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,504
Should now work correctly in WinUAE (winuae.7z updated). ECS Denise/AGA extra feature is not yet emulated.

Denise logic was not correct. Normal sequence is:

- Agnus does BPLxDAT DMA. Denise stores the data.
- When BPL1DAT DMA happens, Denise copies all BPLxDAT contents to internal storage registers. All planes.
- When BPLCON1 shift matches horizontal counter, only currently active planes are copied to shift register. (UAE used plane count value when BPL1DAT was written but it needs to be current value)
- All planes' shift registers are active, including disabled planes. (UAE only shifted active planes, even if plane count decreased mid scanline)

(Possibly more detailed description will appear in undocumented features thread later)

EDIT: just noticed earlier post. interesting timing..
Toni Wilen is online now  
Old 20 November 2021, 18:57   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,504
ECS Denise/AGA side-effect: if bitplane gets disabled mid-scanline and if bit 0 of disabled bitplane's last word copied to shifter is one, it appears twice on screen. This logic results in 100% identical output when compared to real ECS Denise A500 and A1200.

Quite weird behavior.

Emulation added, supported only in subpixel mode.
Toni Wilen is online now  
Old 21 November 2021, 13:21   #10
dirkwhoffmann
Dirk Hoffmann
 
dirkwhoffmann's Avatar
 
Join Date: Jun 2019
Location: Karlsruhe
Posts: 33
- When BPLCON1 shift matches horizontal counter, only currently active planes are copied to shift register.

Quick question: This means that if BPLCON1 contains the same shift values for even and odd planes and assuming that all bitplanes are enabled, all shift registers get updated simultaneously. But if the shift values for even and odd planes differ, we have two copy events. When the shift value for odd planes matches, shift registers 1,3, and 5 are filled. When the shift value for even planes matches, shift registers 2,4, and 6 are filled. is this correct? (My emulator is doing this wrong at the moment).
dirkwhoffmann is offline  
Old 21 November 2021, 13:24   #11
dirkwhoffmann
Dirk Hoffmann
 
dirkwhoffmann's Avatar
 
Join Date: Jun 2019
Location: Karlsruhe
Posts: 33
@losso: Do you mind if I add your program to my regression test suite for vAmiga? It's a public repo on GitHub: https://github.com/dirkwhoffmann/vAmigaTS
dirkwhoffmann is offline  
Old 21 November 2021, 13:46   #12
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,504
btw, I did some quick tests how hires<>lores changes work and it looks like OCS Denise, ECS Denise and AGA all have slightly different behavior (few pixels during change have "undocumented" behavior). Going to examine this more after 4.9 is out.

Quote:
Originally Posted by dirkwhoffmann View Post
- When BPLCON1 shift matches horizontal counter, only currently active planes are copied to shift register.

Quick question: This means that if BPLCON1 contains the same shift values for even and odd planes and assuming that all bitplanes are enabled, all shift registers get updated simultaneously. But if the shift values for even and odd planes differ, we have two copy events. When the shift value for odd planes matches, shift registers 1,3, and 5 are filled. When the shift value for even planes matches, shift registers 2,4, and 6 are filled. is this correct? (My emulator is doing this wrong at the moment).
Yes. Odd and even planes are always processed separately (even if not dual playfield mode).
Toni Wilen is online now  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
BPLCON1 Scroll Left & Right DanielAllsopp Coders. Asm / Hardware 6 13 February 2020 15:01
Change in behavior in recent VASM upgrade Hannibal Coders. Asm / Hardware 0 20 October 2019 23:28
Filter mask on the fly change weird behavior mcbpete support.WinUAE 2 04 September 2018 20:47
Mid-line bitplane pointer change? NorthWay Coders. Asm / Hardware 10 26 September 2015 13:45
a painting program that let you change the palette per scanline Michael Parent request.Apps 1 26 October 2009 22:09

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 19:37.

Top

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