Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Screen Swap and Screen Offset timing  (Read 212 times)

adrazar

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Generic Amiga User
Screen Swap and Screen Offset timing
« on: August 31, 2017, 01:36:13 PM »

Hi,
I have a double buffered screen which I scroll using Screen Offset. The problem is that I can't seem to switch buffer AND change offset within a single vertical blank. I've tried rearranging the order of the commands, even introducing amal to do the offset (which actually worked quite well, until I tried to enforce a frame rate reduction). Then I've tried thinking instead of just experimenting, and this is what I figured would be the lay of the land:

* Screen Offset redefines what part of the bitmap is to be considered the upper left corner of the display. Calling Screen Offset in the middle of a screen rendering does not disturb the subsequent part of the current display. There are two possible reasons for this: either amos delays updating the offset-variable until next vertical blank OR the only time this variable is read is once during each vertical blank. I do not know which is true, but I have more faith in the latter.

* Screen Swap changes the bitmap starting pointer to the other buffer. Calling Screen Swap in the middle of a screen rendering will, like Screen Offset, leave the subsequent parts of the display undisturbed. Hence the bitmap starting pointer is treated the same way as the offset variable.

Now, the conclusion I draw from this is that writing
"Screen Offset N,X,Y : Screen Swap : Wait Vbl" or
"Screen Swap : Screen Offset N,X,Y : Wait Vbl"
should work equally well, but it turns out neither does. The most obvious explanation to this disagreement between theory and practice is that my reasoning is flawed or incomplete. I don't know if anyone here knows more about this stuff than I do, but here you go. :)


[A few words on the problem I'm experiencing: I'm having the player (a bob) move on top of a background scrolling at constant speed. Ideally the bob should appear fixed on the screen while the background rolls underneath, but as default the bob seems to prefer being a shaky blur instead.

I need the player object to be a bob in order to achieve a special colour-mixing effect, thus converting it to a sprite would not be the answer I seek.]
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 827
  • Compile-time wierdo
Re: Screen Swap and Screen Offset timing
« Reply #1 on: August 31, 2017, 03:17:56 PM »

Screen offset should come before Screen Swap because it is supposed to affect the logical screen, though both commands really just affect the Copper list.  What settings are you doing at the beginning of the code?  (Particularly regarding Bob redraws and autoback.)
Logged

adrazar

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Generic Amiga User
Re: Screen Swap and Screen Offset timing
« Reply #2 on: August 31, 2017, 04:12:29 PM »

Bob Update Off, Synchro Off, Autoback 0. I use Synchro to move the bobs and Bob Clear/Bob Draw to redraw them.
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 827
  • Compile-time wierdo
Re: Screen Swap and Screen Offset timing
« Reply #3 on: August 31, 2017, 05:47:26 PM »

Hmmm...  That's not the culprit.
Logged

adrazar

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Generic Amiga User
Re: Screen Swap and Screen Offset timing
« Reply #4 on: September 07, 2017, 04:02:40 PM »

I have created a minimal example showing what I'm talking about (download the attatchment or type it into amos):

Code: [Select]
Bob Update Off
Screen Open 0,640,200,16,Lowres
Screen Display 0,128,50,320,200

Get Bob 1,0,0 To 16,16
Cls 0

Double Buffer : Autoback 0

Repeat
   Bob 0,X+160,100,1
   Bob Clear : Bob Draw
   Wait 50
   Screen Offset 0,X,0
   Screen Swap
   Wait Vbl
   Add X,4,0 To 319
Until Mouse Click

The bob clearly jumps to the right. This indicates that screen swap happens first, then one frame later the offset is changed.

Screen offset should come before Screen Swap because it is supposed to affect the logical screen, though both commands really just affect the Copper list.

I know almost nothing about what a regular Copper list actually does.. What I know is that it is possible to change colours quite often during a single screen rendering by filling it with instructions manipulating "the colour registers". I guess there are other registers, but which are the relevant ones in this context?
« Last Edit: September 07, 2017, 04:11:45 PM by adrazar »
Logged
Pages: [1]   Go Up