Lowres and medres at the same time

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

joska
Hardware Guru
Hardware Guru
Posts: 3877
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Lowres and medres at the same time

Postby joska » Fri Jun 12, 2015 11:09 am

I'm using Timer B to split the screen in one medres-part (top 160 lines) and one lowres-part (last 40 lines). It sort of works, but quite often - several times per second actually - it does not actually switch resolution but shifts the screen to the left instead. But this only happens when I run some code with lots of muls and divs, i.e. long instructions. Do I have to switch resolution at a certain point on the scanline to prevent this problem? It happens on both my STM and STE.

Btw. the Timer B routine in question looks like this:

Code: Select all

hbl:      clr.b   $ff8260   ; Low res

         move.l   palette+00,$ff8240
         move.l   palette+04,$ff8240+4
         move.l   palette+08,$ff8240+8
         move.l   palette+12,$ff8240+12
         move.l   palette+16,$ff8240+16
         move.l   palette+20,$ff8240+20
         move.l   palette+24,$ff8240+24
         move.l   palette+28,$ff8240+28

         clr.b   $fffffa1b.w      ; Stop timer B
         move.b   #0,$fffffa21
         move.b   #8,$fffffa1b.w

         bclr   #0,$fffffa0f.w
         rte


Timer C is switched off, but IKBD interrupt is still active.
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
AdamK
Captain Atari
Captain Atari
Posts: 254
Joined: Wed Aug 21, 2013 8:44 am

Re: Lowres and medres at the same time

Postby AdamK » Fri Jun 12, 2015 11:46 am

Yes, there is a timing window to do this, and if long instructions make you miss it - it will not work.
Atari: FireBee, Falcon030 + CT60e + SuperVidel + SvEthlana, TT, 520ST + 4MB ST RAM + 8MB TT RAM + CosmosEx + SC1435, 1040STFM + UltraSatan + SM124, 1040STE 4MB ST RAM + 8MB TT RAM + CosmosEx + NetUSBee + SM144 + SC1224, 65XE + U1MB + VBXE + SIDE2, Jaguar, Lynx II, 2 x Portfolio (HPC-006)

Adam Klobukowski [adamklobukowski@gmail.com]

joska
Hardware Guru
Hardware Guru
Posts: 3877
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Lowres and medres at the same time

Postby joska » Fri Jun 12, 2015 12:15 pm

Thanks. I added some crude code to the interrupt to wait for the next line (just waiting for the contents of $fa21 to change) and then switch resolution. Works perfectly :)
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Lowres and medres at the same time

Postby AtariZoll » Fri Jun 12, 2015 1:10 pm

I solved it by performing first Timer B interrupt 1 line earlier, then executing just nop-s , while set 1 line for next Timer B. Then it will happen at time, for sure. Or not - if for instance TOS keyboard/mouse reading code takes too long. In that case using own, much faster code for input helped.
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

joska
Hardware Guru
Hardware Guru
Posts: 3877
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Lowres and medres at the same time

Postby joska » Sat Jun 13, 2015 8:08 am

As for the IKBD issue - I found this somewhere on the net, maybe here.

Code: Select all

newikbd:
         move d0,-(sp)
         move sr,d0
         and #$f8ff,d0
         or #$500,d0
         move d0,sr
         move (sp)+,d0
         dc.w $4ef9
oldikbd:
         dc.l 0


It replaces the original IKBD interrupt handler and jumps to it after doing some stuff that prevents it from interfering with the Timer B interrupt. I haven't studied what it does, but it work and allows me to use VDI mouse/keyboard without messing up the rasters.
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

wietze
Captain Atari
Captain Atari
Posts: 198
Joined: Fri Mar 01, 2013 10:52 pm

Re: Lowres and medres at the same time

Postby wietze » Sat Jun 13, 2015 10:01 am

General approach for me to deal with `jitter' cycles is;
break with timer b one moment earlier, then do a hardsync to end of line (when timer b hits, stop interrupts, check for end of line), and then you know exactly where you're at.

something along the lines of:

Code: Select all

my_hard_synced_timer_b
   move.w #$2700,sr
   clr.b      $FFFFFA1B.w
      move.b  #2,$FFFFFA21.w
      move.b  #8,$FFFFFA1B.w
      move.w  D0,-(SP)
   move.b  $FFFFFA21.w,D0
tb_sync:       
   cmp.b   $FFFFFA21.w,D0  ; wait for end of the line
    beq.s   tb_sync
    move.w  (SP)+,D0
    .... do my magic  here or something...
    rte

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Lowres and medres at the same time

Postby AtariZoll » Sat Jun 13, 2015 10:22 am

Common way is to read Video pointer - to see end of line. But that is not reliable with 68030 CPU because pipeline , so I guess that reading Timer B registers is not reliable too.
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 2 guests