<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 06 Dec 2004 17:26:33 +0000
From   : Richard_Talbot-Watkins@...
Subject: Re: mode switching

JAMES WATSON wrote:

> I have a game running in mode 1 and have highscores table running in
mode7.
> Mode1 is slightly smaller  missing the bottom 2 character rows to
> accommodate the screen memory for mode 7
> How can I switch between mode 1 and mode 7 without clearing the screen
> memory in mode1?

Not easily, unfortunately.

Well, ok - it's easy enough to set up the various video registers to
provide the correct mode settings 'by hand', behind the OS's back.
Unfortunately, if you do this, the OS won't realise there's been a mode
change, so none of the display routines will work properly.  Even simple
old PRINT will make a stunning mess of things.  In order to sort this out,
the OS VDU variables also need to be initialised as per the selected mode,
but there really is no simple way of doing this, particularly since
different OSes use the VDU variables section of memory in subtly different
ways, and there is no OS entry point for setting up a mode *without* a
screen clear.

Most of Ultimate's games achieved exactly this by copying the segment of
code which does mode changes in OS1.20 into RAM, and replacing the final
jump to the screen clear code with a simple return.  However, this will
only work on OS1.20, and the same method can't even be easily applied on
the Master as its OS VDU driver code isn't normally visible to user apps.

If you are doing all your screen update via your own routines, rather than
using any OS calls (OSWRCH), it would be ok to ignore the VDU variable
setup, and do something like the following (untested):

.SelectMode1
SEI
\ set CRTC regs
LDX#13:.loop STX&FE00:STAmode1crtc,X:DEX:BPLloop
\ set video ULA
LDA#154:LDX#&D8:JSR&FFF4
\ set hardware scrolling wrap address
LDA#15:STA&FE42
LDA#13:STA&FE40:LDA#4:STA&FE40
\ set palette
LDX#3:.loop LDAmode1pal,X:EOR#7:STA&FE21
EOR#128:STA&FE21:EOR#64:STA&FE21
EOR#128:STA&FE21:DEX:BPLloop
\ ***1
CLI:RTS

.mode1crtc
EQUB127:EQUB80:EQUB98:EQUB40:EQUB38:EQUB0
EQUB32:EQUB34:EQUB0:EQUB7:EQUB32:EQUB8
EQUB&30/8:EQUB0

.mode1pal
EQUB0:EQUB1:EQUB3:EQUB7  \ palette - customise as reqd

.SelectMode7
SEI
\ set CRTC regs
LDX#13:.loop STX&FE00:STAmode7crtc,X:DEX:BPLloop
\ set video ULA
LDA#154:LDX#&4B:JSR&FFF4
\ ***2
CLI:RTS

.mode7crtc
EQUB63:EQUB40:EQUB51:EQUB36:EQUB30:EQUB2
EQUB25:EQUB27:EQUB163:EQUB18:EQUB32:EQUB19
EQUB&28:EQUB0

Labyrinth does something much like this.

If you need to be able to use the OS routines, it'd be possible to save the
set up block of VDU variables somewhere else in memory and copy it back
when the mode is changed.

e.g.

at startup:

DIM mode1vdu% 146, mode7vdu% 146
MODE 1
FOR N%=0 TO 127:N%?mode1vdu%=N%?&300:NEXT
FOR N%=0 TO 17:N%?(mode1vdu%+128)=N%?&D0:NEXT
MODE 7
FOR N%=0 TO 127:N%?mode7vdu%=N%?&300:NEXT
FOR N%=0 TO 17:N%?(mode7vdu%+128)=N%?&D0:NEXT

...and then at the place marked ***1 above:

LDX#127:.loop LDAmode1vdu%,X:STA&300,X:DEX:BPLloop
LDX#17:.loop LDAmode1vdu%+128,X:STA&D0,X:DEX:BPLloop

...and similarly at ***2:

LDX#127:.loop LDAmode7vdu%,X:STA&300,X:DEX:BPLloop
LDX#17:.loop LDAmode7vdu%+128,X:STA&D0,X:DEX:BPLloop

This is hideously cheesy!

Let us know if it works ok :)




**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
postmaster@...

This footnote also confirms that this email message has been checked
for all known viruses.

**********************************************************************
Sony Computer Entertainment Europe
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>