Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Rock-steady HBL
Posted by: Per Almered (XiA) Jul,19.2009-10:22 

Hi guys!

I'm having problems with a little HBL routine that works fine in Steem and Hatari, but not on my real STE. (surprise!)

I'm trying to change both the screen address and FFFF8265 (STE horizontal scroll) every line. This is what my HBL does:

(copperlistpointer points to a list of values, containing for each row a longword with a screen address followed by a byte of scroll value, and finally a dummy byte so the next longword is on an even address)

movem.l a0/d0,-(sp)
move.l copperlistpointer,a0
move.l (a0)+,d0
move.b (a0),$ffff8265
lea $ffff8203,a0
movep.l d0,(a0)
add.l #6,copperlistpointer
movem.l (sp)+,a0/d0

... and then of course cleaning up, clearing Interrupt In-Service etc, but that's not important. :-)

Ok, so what happens in Steem is that everything works great, I've got my own little copper emulator 8-) ...but on my real STE, I get bitplanes jumping, which isn't pretty.

So I removed the scrolling, and ended up with this:

movem.l a0/d0,-(sp)
move.l copperlistpointer,a0
move.l (a0),d0
lea $ffff8203,a0
movep.l d0,(a0)
add.l #6,copperlistpointer
movem.l (sp)+,a0/d0

...and it ALMOST removed the bitplane jumping. But not quite, and when I insert a color checker:

move.w #$0f00,$ffff8240
move.w #$0fff,$ffff8240

at the end, I can see the color blocks jumping horizontally, which is fairly normal, a standard HBL doesn't trigger perfectly.

Ok, so one solution might be to use a standard "break upper border" thingy to place myself in full sync and then NOP myself down to the first line, change screen address etc, but that eats a shitload of CPU that I was hoping to use for other stuff. You know, like pointless animations and music 8-)

Is there a way to get a rock steady HBL without losing lots and lots of precious CPU time?

And even more importantly, is the code I'm using bloated and could be made faster?

I've considered three things: 1) Not saving a0 and d0. That might be ok, I can avoid those registers, but it means the maxYMiser player HAS to be done by the time the HBLs kick in, because I don't think gwEm will want to code me a special player that doesn't use those two registers... 8-)

2) Another option would be to place the screen data on an even 65536 boundary (i e within a 64Kb-block), so I wouldn't have to move an entire longword to set the screen address, just a word. Yes, it would certainly limit how much graphics I could use, but it might be enough to do cool stuff. But isn't moving a longword AS FAST as a word on the Atari?

3) Perhaps a bit of self-modifying code could solve it, perhaps that way I could save registers faster? Something like (untested code by crappy coder coming up):

move.l a0,savea0
move.l d0,saved0
move.l #00000000,d0
lea $ffff8203,a0
movep.l d0,(a0)
move.b #11,$ffff8265
move.l #22222222,a0
move.l #33333333,d0

...where "savea0" points to the immediate data "#22222222", "saved0" to "#33333333", etc etc, and I could just punch in the immediate values for screen address and scrolling from my other code. Sure, it would mean I would have to have a separate HBL routine for every single line, but it might be worth the extra work if it would make the effect possible.

(all this is to run on a standard STE, btw, no caches etc)

Any ideas guys? 8-)


Thanks in advance,

Per.







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
Rock-steady HBL Per Almered (XiA) Jul,19.2009-10:22
  Re: Rock-steady HBL evil Jul,19.2009-10:53
    Re: Rock-steady HBL evil Jul,19.2009-11:11
    Re: Rock-steady HBL Per Almered (XiA) Jul,19.2009-11:25
      Re: Rock-steady HBL evil Jul,19.2009-11:52
    Re: Rock-steady HBL Per Almered (XiA) Jul,19.2009-11:59
      Re: Rock-steady HBL Kalms Jul,19.2009-12:47
        Re: Rock-steady HBL Per Almered (XiA) Jul,19.2009-12:59
  Re: Rock-steady HBL Per Almered (XiA) Jul,19.2009-13:59
    Re: Rock-steady HBL ggn Jul,21.2009-08:09
  Re: Rock-steady HBL Nicolas Pomarede Jul,20.2009-00:33


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson