English Amiga Board


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

 
 
Thread Tools
Old 15 December 2014, 19:43   #1
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,336
VPOSW LOF bit

How does the VPOSW LOF bit work? I know that when the BPLCON0 LACE bit is set, it toggles on/off for successive frames/fields. But what about setting the bit manually, when using a non-interlaced display mode?

I did some testing with WinUAE. I booted to a non-interlaced Workbench and dumped the system copperlist. There were no writes to VPOSW, so I thought that if I write VPOSW once, the LOF bit state would remain at 0 or 1 (depending on the value written).

A single write to VPOSW with LOF=1 seemingly does nothing. Busy-looping setting LOF=1 also seems to do nothing.

A single write to VPOSW with LOF=0 causes some log output:
NTSC mode V=53.6424Hz H=21760.0920Hz (163x405+0) IDX=11 (NTSC) D=0 RTG=0/0
NTSC mode V=53.8143Hz H=21760.0920Hz (163x405+1) IDX=11 (NTSC) D=0 RTG=0/0
(that example done while using a non-interlaced HighGfx mode Workbench)

Looping setting LOF=0 causes this log output:
NTSC mode V=53.6424Hz H=21760.0920Hz (163x405+0) IDX=11 (NTSC) D=0 RTG=0/0
NTSC mode V=53.6424Hz H=21760.0920Hz (163x405+0) IDX=11 (NTSC) D=0 RTG=0/0
NTSC mode loflace V=53.6424Hz H=21760.0920Hz (163x405+0) IDX=11 (NTSC) D=0 RTG=0/0

and the output image becomes one scanline shorter. (And from the "loflace" text, WinUAE thinks the video signal is interlaced.)


Next I tested using an interlaced Workbench:
- Looping setting LOF=1 causes one field to be displayed in both odd and even output scanlines. (So the opposite field is never shown)
- Looping setting LOF=0 does the same for the opposite field.
That happens even when WinUAE's interlaced line mode is set to "double, fields+"...


The effect on real hardware must be noticeably different. Perhaps running one of the test programs will show similar output to WinUAE's "single" interlaced line mode: output image non-interlaced, frames alternating between the odd and even scanlines of WB screen?
Attached Files
File Type: lha LOF_tests.lha (979 Bytes, 118 views)
mark_k is online now  
Old 15 December 2014, 19:58   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
My crystal ball says you use KS 3.1. It resets LOF in vblank interrupt. (EDIT: Which actually broke some games that partially take over the system and tries to enable interlace or switch it off)

Last edited by Toni Wilen; 15 December 2014 at 20:05.
Toni Wilen is offline  
Old 15 December 2014, 20:45   #3
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,336
You're right.

I did some more testing (with Kickstart 2.05 this time). Running the loop to set (or clear) the LOF bit causes the display to become non-interlaced, with only odd (or only even) field lines showing. Does that match real hardware? I guess it could, if the system vertical blank interrupt routine reads VPOSR and sets the copperlist pointer based on that.
mark_k is online now  
Old 16 December 2014, 14:01   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Small correction to my previous post: graphics.library vblank routine only sets LOF bit if current mode (by checking its internal bplcon0 mirror register) is not interlace and LOF is not already set.

I guess it is workaround for interlace to non-lace mode switch that could leave field mode to short fields if interlace was switched off during short field.
Toni Wilen is offline  
Old 13 February 2015, 17:57   #5
Seoman
Registered User
 
Join Date: Nov 2007
Location: Spain
Posts: 29
Then, if I'm using KS 3.1, ¿how can I set up an interlaced screen if I can't use LOF to check odd and even scanlines?.
Seoman is offline  
Old 13 February 2015, 18:08   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Quote:
Originally Posted by Seoman View Post
Then, if I'm using KS 3.1, ¿how can I set up an interlaced screen if I can't use LOF to check odd and even scanlines?.
a) Let OS do it. Don't try to do any tricks, don't hit the hardware.
b) Properly take over the system and hit the hardware normally.

If you don't want to take over the system but still want to directly use (display) hardware:

c) Use OS routines to open interlaced screen first. This way OS knows mode really is interlaced and it does not try to fix it.
Toni Wilen is offline  
Old 13 February 2015, 18:46   #7
Seoman
Registered User
 
Join Date: Nov 2007
Location: Spain
Posts: 29
Thanks Toni.

Can anyone give me an example in assembler to set up an interlaced screen in a OS friendly way?
Seoman is offline  
Old 15 February 2015, 22:21   #8
Blueberry
Registered User
 
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
So THIS is why the sound in my demos sometimes crackles!

I always thought non-interlaced frames were always long. Based on this assumption, I write 573 samples each frame to my circular sound buffer and play it with period 124. 573*124 = 71052 is so close to a long frame, 227*313 = 71051, as to make no difference in practice, and when the frames are indeed long, this works perfectly. However, if the frames are short (which they can be for instance if the demo is started from an interlaced screenmode), this of course breaks horribly...
Blueberry is offline  
Old 25 February 2015, 23:53   #9
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
i did wonder if it would be possible to achieve sub-pixel vertical scrolling by writing to this bit
Mrs Beanbag is offline  
Old 26 February 2015, 13:45   #10
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Mrs Beanbag View Post
i did wonder if it would be possible to achieve sub-pixel vertical scrolling by writing to this bit
yes, you can.. I've done that in the past.. works a treat and looks really nice.. at least on a 15KHz CRT

edit: I think it was in the end scroller of this one I used it: http://janeway.exotica.org.uk/release.php?id=185

Last edited by hooverphonique; 26 February 2015 at 13:52.
hooverphonique is offline  
Old 26 February 2015, 14:21   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Quote:
Can anyone give me an example in assembler to set up an interlaced screen in a OS friendly way?
I don't have any good enough examples, sorry. But normal 1.x NewScreen structure should work fine. Perhaps 3.0+ PAL_MONITOR or NTSC_MONITOR monitor tag is probably also good idea to force RTG off if in use.

Quote:
edit: I think it was in the end scroller of this one I used it
No interlace or vposw writes in that demo.

It still would be normal interlace mode, no need for manual VPOSW writes.

It is display device that decides vertical start position and it is decided during early part of vertical blanking. Modifying VPOSW during visible portition of display does nothing.
Toni Wilen is offline  
Old 26 February 2015, 15:02   #12
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Toni Wilen View Post
No interlace or vposw writes in that demo.

It still would be normal interlace mode, no need for manual VPOSW writes.
I must've remembered incorrectly then.. It is the correct intro, however..

you are right about the interlace part, of course - it's just interlace mode, but using the same bitplane pointers for both fields, and then scrolling the buffer one line every other field (i.e. no manual writes to VPOSW).

Last edited by hooverphonique; 26 February 2015 at 15:21.
hooverphonique is offline  
Old 26 February 2015, 15:07   #13
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,336
Quote:
Originally Posted by Seoman View Post
Can anyone give me an example in assembler to set up an interlaced screen in a OS friendly way?
If you don't want to use Intuition to do it but go directly to graphics.library, there's a good example in the RKM: Libraries. I think that's neater if you intend to kill the system anyway.

Quote from that:
** The following example creates a View consisting of one ViewPort set
** to an NTSC, high-resolution, interlaced display mode of nominal
** dimensions. This example shows both the old 1.3 way of setting up
** the ViewPort and the new method used in Release 2.
mark_k 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
Best Way to Convert 32-bit Signed Value to 16 Bit? AGS Coders. Asm / Hardware 31 29 December 2013 13:58
32-bit access on 16-bit bus? NorthWay Coders. Asm / Hardware 7 04 September 2013 00:46
REQ: 17-Bit Artwork 2 (1988-04)(17-Bit Software) Sea7 request.Demos 5 13 May 2011 01:07
8 bit to optimized 6 bit palette histogram improvements needed NovaCoder Coders. General 0 14 April 2011 02:13
My A500 is dying bit by bit :( Old Fool support.Hardware 3 03 July 2009 17:12

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 06:44.

Top

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