29 September 2019, 18:40 | #61 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Apologies for ressrecting this thread after a couple of years but after some testing with Rygar on much faster cards I came a cropper of this... basically very fast routines such as fades and transitions would screw up because they all trigger and run on line 303.
Code:
.vpos: move.l VPOSR(a5),d0 and.l #$1ff00,d0 cmp.l #303<<8,d0 ; Wait for line 303 bne.b .vpos rts I've modified the Wait for Vertical Blank routine to wait for the line and then to reach at least near to the end of the horizontal line. It seems OK but wondered if anyone else has insights on a better way, or even if this isn't a good way to do it? Code:
move.l VPOSR(a5),d0 and.l #$1ff00,d0 cmp.l #303<<8,d0 ; Wait for line 303 bne.b .vpos .hpos: move.w VHPOSR(a5),d0 cmp.b #208,d0 ; Horizontal position... blt.s .hpos Geezer |
29 September 2019, 19:06 | #62 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,587
|
I usually simply wait for line x and then wait until line is not x.
|
29 September 2019, 19:34 | #63 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
Code:
.vpos: move.l VPOSR(a5),d0 and.l #$1ff00,d0 cmp.l #303<<8,d0 ; Wait for line 303 bne.s .vpos .vposn: move.l VPOSR(a5),d0 and.l #$1ff00,d0 cmp.l #303<<8,d0 ; Wait till line 303 finished. beq.s .vposn |
|
29 September 2019, 21:55 | #64 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
I usually use this.
Code:
;----------------------------------------------------------------------------- ;; - wait for top of frame ; ;in a5 - _custom ;out - ;used d0/a0/a5 ; xdef HwWaitTopOfFrame HwWaitTopOfFrame: lea vposr(a5),a0 .1 moveq #1,d0 and.w (a0),d0 beq.b .1 .2 and.w (a0),d0 bne.b .2 rts ;----------------------------------------------------------------------------- Last edited by Asman; 01 October 2019 at 12:09. Reason: edit: correcting bugs - thanks to ross. |
29 September 2019, 22:11 | #65 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,510
|
Hi Asman!
This however does not wait for line 303 (although I don't know why line 303 ) |
29 September 2019, 22:15 | #66 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
Hi ross!
Yeah right, I've forgot about that 303 line , just wait for top of frame. You know I don't like wasting cycles. |
29 September 2019, 22:23 | #67 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,510
|
|
29 September 2019, 23:34 | #68 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 545
|
I use this:
Code:
wait_sync: btst.b #0,$dff005 beq.b wait_sync wait_sync_line: btst.b #0,$dff005 bne.b wait_sync_line |
30 September 2019, 08:26 | #69 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,375
|
If you really want to wait for the top of frame, why not just this :
Code:
move.w #$20,$dff09c .wait moveq #$20,d0 and.w $dff01e,d0 beq.s .wait |
30 September 2019, 10:21 | #70 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,510
|
Ok, if you are in the dark side of the force:
Code:
lea $dff004,a0 .l1 lsr (a0) bcc.b .l1 .l2 lsr (a0) bcs.b .l2 |
30 September 2019, 10:31 | #71 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,652
|
|
30 September 2019, 10:36 | #72 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,510
|
Quote:
In practice it does not hurt, but really annoying during debugging So don't try it at home! I have never logically used it, I have put it only as a working case study not to be used. |
|
30 September 2019, 14:04 | #73 | ||
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,748
|
Quote:
Quote:
So if code is executed after a raster busy wait in main, that relies on values set by the int, read them at EOF quickly before the int hits (and never re-read them later in the code), because they may be changed by the int mid-execution. Last edited by Photon; 30 September 2019 at 16:23. |
||
30 September 2019, 15:35 | #74 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,510
|
Quote:
But it seems you have made some confusion between vsync, vblank and VBI. Excluding the vsync signals, which at the moment are not of interest to us as they are generated by the Amiga hardware (for a standard PAL or NTSC signal), we are interested in vblank and VBI. Vblank because we have to exploit it to the maximum because nothing is put on video in that period, the VBI because it references us the position 0,0 of the internal video counters and the generation of a level 3 IRQ for the CPU. The vblank is between lines 0 and $19. The first visible line in maximum overscan is the $1a. The VBI is generated only once per frame at the beginning of line 0. The copper execute little before the CPU because the IRQ response requires some machine cycles. |
|
30 September 2019, 16:29 | #75 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,748
|
I've edited my post. I will measure the time in CPU instructions executed across the vblank, and then I'll know exactly. I guess it should correspond to the $1a scanlines, but the actual time it takes for the monitor vsync pulse should be ~576ms = 9 rasterlines.
I guess my main point is that if you have interrupts running that change values you rely on, results could vary depending on when the interrupt hits in your running main code. And that if you have interrupts or a BLTPRI=1 blit running during a VPOS check with beq, it could be skipped so that you get a stagger. Last edited by Photon; 02 October 2019 at 22:09. |
01 October 2019, 12:11 | #76 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
@ross - Thanks for pointing me that stupid bugs in HwWaitTopOfFrame (post #66). I corrected and checked. Now works correctly. Thanks
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Removing the IDE Wait on Kickstart 3.1 | Zetr0 | support.Hardware | 26 | 16 June 2010 08:31 |
'Wait' program that checks for a joy button press instead of 'Return' key... | Heavy Stylus | request.Apps | 7 | 10 May 2009 19:01 |
timed wait using CIAs | jotd | support.Other | 3 | 23 March 2008 14:55 |
HD won't boot now..wait failed returncode? | Amigan25 | project.ClassicWB | 2 | 08 June 2007 18:21 |
Wait a sec - what about Macs? | Computolio | Amiga scene | 10 | 02 June 2004 07:23 |
|
|