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

Atari coding BBS
 
Setting color at specific line
Posted by: Sdw Aug,21.2013-17:57 

I'm trying to change the background color at raster line 172.
So far I've come up with that the way to do this is to use the timer B interrupt, as it seems to count lines. With some bits and pieces found on the net, this is what I have:

setup:
clr.b $fffa1b ; disable Timer B
move.l #hblank,$120 ; put our routine into MFP timer B interrupt vector (HBL counter)
...


vbl:
movem.l d0-a6,-(sp) ; Save registers during interrupt
clr.b $fffa1b ; Disable Timer B
bset #0,$fffa07 ; Timer B enable A
bset #0,$fffa13 ; Timer B mask A
move.b #172,$fffa21 ; Set event at 172 scanlines
move.b #8,$fffa1b ; Set Timer B to event count mode
movem.l (sp)+,d0-a6 ; Restore registers after interrupt
rte

hblank:
move.w #$0344,$ffff8240.w
bclr #0,$fffffa0f
rte

To be honest, I'm not quite sure if all that is correct, but it seems to work OK, I get a change of the background color at the line I want....almost all the time.
Sometimes it seems to move up (or perhaps down, hard to tell) for a frame or so.
How can I get it stable?

Also, what are the correct way to handle the $120 vector for the OS, do I need to store it and set it back as i do with $70, or is it OK to just overwrite?
In my testing in Hatari so far, it is OK to overwrite, but I must remember to disable the timer (clr.b $fffa1b) before returning to OS, otherwise it craps out.







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

Topic Posted by  Date 
Setting color at specific line Sdw Aug,21.2013-17:57
  Re: Setting color at specific line damo Aug,21.2013-18:19
    Re: Setting color at specific line Sdw Aug,21.2013-21:50
  Re: Setting color at specific line grazey Aug,21.2013-18:39
    Re: Setting color at specific line defjam Aug,24.2013-18:17
  Re: Setting color at specific line evil Aug,21.2013-19:10
    Re: Setting color at specific line Sdw Aug,21.2013-21:55
      Re: Setting color at specific line evil Aug,22.2013-10:47
        Re: Setting color at specific line Cyprian Aug,22.2013-16:43
          Re: Setting color at specific line evil Aug,22.2013-16:58
            Re: Setting color at specific line ggn Aug,22.2013-23:31
              Re: Setting color at specific line evil Aug,23.2013-14:54
            Re: Setting color at specific line Cyprian Aug,23.2013-15:37


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