Author: Hans (co82747-a.almel1.ov.nl.home.com)
Date: 03-24-2001 11:03
Damion Jones wrote:
-------------------------------
> I cannot get the screen on the TT to switch.
>
> I have setup 2 screens in RAM, and in order to get smooth effects, I am trying
> to swap them. Obvious so far yes?
>
> But, the system crashes all the time?
> Why is this? I am using the same routines that I have always used, but I cannot
> do it on the TT?
How are you doing the switches, using the OS or going directly to the hardware?
What programming language are you using?
Screen swapping works just like the ST. But... You have to make sure your screen memory is in ST RAM and not in FAST RAM. Also be aware that in TT resolutions the screen memory is 153600 bytes instead of the usual 32000 bytes for the ST.
When going directly to the hardware the only way to crash the computer on a screen switch is not being in super mode.
Doing by OS calls there are doubtless lots of possebilities to crash the program. But XBIOS will still work the way it worked on the ST
> Ok, so perhaps the TT needs to have its screens on a 256byte boundary, and
> so I think I have ensured this, so why is this happening?
No screen memory on a TT has to start on a 8 byte boundary. The TT has the same hardware registers available for setting the screen adress as the STe.
> Perhaps my formula for doing this is wrong, so can anyone show me a reliable
> formula for doing this ( In any language - its all the same in the end - Dont be
> cocky though! )
Well, I shall mutter some powerfull incantations.
assembly:
; hardware
; processror is in supervisor mode
; D0: screen adress
move.b d0,$ffff820c.w ; low byte
lsr.l #8,d0
move.b d0,$ffff8203.w ; med byte
lsr.l #8,d0
move.b d0,$ffff8201.w ; high byte
; OS
; D0: screen adress
move.w -1,-(sp) ; stay in the same resolution
move.l d0,-(sp) ; physical location
move.l d0,-(sp) ; logical location
move.w #5,-(sp) ; xbios 5
trap #14 ; call
lea $c(sp),sp ; correct stack
Same thing in C:
{ /* hardware registers */
void *scr = screen_adress; /* screen adress */
unsigned long tmp;
tmp = (unsigned long) scr; /* cast adress into a long */
*(char *)0xffff820c = (char)(tmp & 0xff);
tmp >>=8;
*(char *)0xffff8203 = (char)(tmp & 0xff);
tmp >>=8;
*(char *)0xffff8201 = (char)(tmp & 0xff);
}
{ /* OS */
void *scr = screen_adress; /* screen adress */
Setscreen(scr, scr, -1);
/* prototype: Setscreen(void *logLoc, void *physLoc, WORD res); */
}
I haven't compiled any of the code above, but take are give a typo it should work.
Hans
|