[comp.sys.cbm] C64 text screen

lechner@ucscb.UCSC.EDU (Eric Lechner) (12/08/88)

I am writing an assembly language "life" program and would like to do this:
It needs to alternate between two screens, without copying the screen (due to
time considerations. I am trying to optimize running time).
I would like to keep each screen in a different place in memory, so
that I need only change the pointer to the text screen.

I have tried the 128 programmer's reference guide, and have tried
altering location 648 (a page pointer to the top of the text screen) but
the display does not change when I change that pointer.

What am I doing wrong?  Is there a pointer in the video chip that I need to
alter as well as the other pointer?  Am I overlooking anything else, as well?

Any help will be appreciated.
		Eric
-------------------------------------------------------------------------------
	     Eric Lechner 115 Seton Way   Santa Cruz, CA  95060
            lechner@ucscb.ucsc.edu   ...ucbvax!ucscc!ucscb!lechner

Geoffrey.Welsh@isishq.FIDONET.ORG (Geoffrey Welsh) (12/12/88)

 > From: lechner@ucscb.UCSC.EDU (Eric Lechner)
 > Message-ID: <5673@saturn.ucsc.edu>
 
 > I would like to keep each screen in a different place in
 > memory, so
 > that I need only change the pointer to the text screen.
 
   I assume that this is running in C64 mode? The location you mentioned 

(648 decimal) is for the C64 ROMs, and all it does is tell BASIC where 

to put the screen. If you're going to be using BASIC PRINT routines, 
then you'll want to update that byte, too, but the bytes you;re looking 
for are on the VIC chip. First of all, you'll have to set bits 1 and 
zero to the 16K block number that your intended screen is in. NOTE: 
If I rememer correctly, the character generator ROM is only visible 
to the VIC-II chip if its bank is set to 0 or 2 (!). If both of your 
screens are in the first 16K of memory, then you don;t have to worry 
about changing these two bits.
 
   Next you'll have to set bits 7 through 4 of the memory pointer register 

at $D018 to match bits 13 through 10 of the base address of your screen.
 
   Summary: Take the base address of the screen you want to display; 

put bits 15 and 14 of that address into bits 1 and 0 of $DD00. Put 
bits 13 though 10 of the address into bits 7 through 4 of $D018. That 
SHOULD make the VIC-II chip display your intended screen. It will not, 
however, update all the pointers the BASIC and KERNAL routines need 
to print stuff to the screen - I suggest that, if you're going to go 
this far you might as well do all of your own direct screen writes 
anyway.
 
   Geoff ( watmath!isishq!izot )


--  
 Geoffrey Welsh - via FidoNet node 1:221/162
     UUCP: ...!watmath!isishq!Geoffrey.Welsh
 Internet: Geoffrey.Welsh@isishq.FIDONET.ORG

fred@cbmvax.UUCP (Fred Bowen) (12/14/88)

In article <5673@saturn.ucsc.edu> lechner@ucscb.UCSC.EDU (Eric Lechner) writes:
>I am writing an assembly language "life" program and would like to do this:
>It needs to alternate between two screens, without copying the screen (due to
>time considerations. I am trying to optimize running time).
>I would like to keep each screen in a different place in memory, so
>that I need only change the pointer to the text screen.
>
>I have tried the 128 programmer's reference guide, and have tried
>altering location 648 (a page pointer to the top of the text screen) but
>the display does not change when I change that pointer.
>
>What am I doing wrong?  Is there a pointer in the video chip that I need to
>alter as well as the other pointer?  Am I overlooking anything else, as well?
>
>	     Eric Lechner 115 Seton Way   Santa Cruz, CA  95060
>            lechner@ucscb.ucsc.edu   ...ucbvax!ucscc!ucscb!lechner

I don't know where you found "648"- if that's decimal, you're poking around in
the C128 input buffer, and if that's hex, you're poking the VIC screen.
Here's a little thing I did many, many moons ago:

0 REM  *******************************
1 REM  * MOVING THE C128 TEXT SCREEN *
2 REM  *                             *
3 REM  *  SCREENS MAY BE PLACED IN   *     <<<<<< note these conditions
4 REM  *  THE BITMAP RAM AREA.       *
5 REM  *  ALL SCREENS SHARE THE SAME *
6 REM  *  LINE LINK TABLE AND COLOR  *
7 REM  *  RAM.                       *
8 REM  *******************************
9 :
10 GRAPHIC1,1:GRAPHIC0,1:REM ALLOC RAM
12 V1=DEC("0A2C"):REM  ED -> $D018
14 SP=DEC("0A3B"):REM  ED SCREEN PAGE
16 TRAP9000
19 :
30 REM  CLEAR AND PRINT ON EACH SCREEN
40 GOSUB100:A$="$0800":GOSUB500:SLEEP1
50 GOSUB200:A$="$2000":GOSUB500:SLEEP1
60 GOSUB300:A$="$2400":GOSUB500:SLEEP1
69 :
70 REM  CYCLE THRU SCREENS
80 FORK=1TO3:ONKGOSUB100,200,300:SLEEP1:NEXT:GOTO80
99 :
100 REM NORMAL SCREEN AT $0400
120 POKEV1,DEC("14")
130 POKESP,DEC("04")
190 RETURN
199 :
200 REM ALTERNATE SCREEN AT $2000
220 POKEV1,DEC("84")
230 POKESP,DEC("20")
290 RETURN
299 :
300 REM ALTERNATE SCREEN AT $2400
320 POKEV1,DEC("94")
330 POKESP,DEC("24")
390 RETURN
399 :
500 REM  PRINT TEXT ON SCREEN
510 PRINT"<^s><^q><^q>":FORK=1TO8:PRINT"<^q>        THIS SCREEN IS AT "A$:NEXT
590 RETURN
599 :
9000 REM TRAP TO NORMAL SCREEN
9010 GOSUB100:TRAP:STOP
--
--
-- 
Fred Bowen			uucp:	{uunet|rutgers|pyramid}!cbmvax!fred
				arpa:	cbmvax!fred@uunet.uu.net
				tele:	215 431-9100

Commodore Electronics, Ltd.,  1200 Wilson Drive,  West Chester,  PA,  19380