27 March 2019, 10:09 | #1 |
Registered User
Join Date: Jan 2017
Location: London, UK
Posts: 433
|
VWait
Odd question, but does anyone know how VWait works?
If I use it in AMIGA mode, then it works perfectly fine. If I use it in BLITZ mode, it never returns and the machine remains in a wait state. -edit- for clarification, this is not a problem with Blitz Basic. It is a problem with my machine, I'm wondering if Blitz uses some kind of copper list hack to wait for the VBL rather installing an IRQ handler or something. Last edited by bloodline; 27 March 2019 at 10:14. |
28 March 2019, 22:01 | #2 |
Registered User
Join Date: Jan 2017
Location: London, UK
Posts: 433
|
it seems the offending code is:
Code:
E ce8e0c: 0839 0000 00df f005 : btst #$0, $dff005.l E ce8e14: 6700 fff6 : beq ce8e0c -edit- actually quite simple, 0xDFF005 is the low byte of vposr, so Blitz is waiting for the vpos to reset, not entirely sure why it does that. Last edited by bloodline; 29 March 2019 at 01:35. |
07 April 2019, 12:05 | #3 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,543
|
With SetInt 5 you can define your own custom VBlank handler, I'm assuming Blitz doesn't use an Interrupt handler for VWait since it may interfere with whatever you've put in SetInt 5.
It's also possible to do this Code:
SetInt 5 Interrupted = true Endif While Interrupted=false Wend |
07 April 2019, 12:43 | #4 | |
Registered User
Join Date: Jan 2017
Location: London, UK
Posts: 433
|
Quote:
This is a pretty nice idea, but I needed to know what the command was doing as it was highlighting a bug in the Amiga Emulator I’m writing. As you can see, I found that Vwait actually busy waits for the vposr register to clear the lowest bit. I’m not 100% sure why it does that (I can think of a few reasons, but none compelling), but upon fixing my Emulator to ensure the bit is cleared properly with each new frame, vwait works as it should. |
|
07 April 2019, 12:52 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,368
|
I wonder if it uses different code for Blitz mode and Amiga mode maybe? The manual states that VWait should be used differently between the two modes. If so, busy waiting in Blitz mode is probably the simplest implementation, though I don't know why an interrupt-driven solution wouldn't be used for both.
|
07 April 2019, 13:05 | #6 | |
Registered User
Join Date: Jan 2017
Location: London, UK
Posts: 433
|
Quote:
|
|
07 April 2019, 13:07 | #7 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,368
|
Yeah, probably. In Blitz mode, there's no multitasking to care about so busy-looping is "acceptable".
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|