[comp.sys.apple] // screen memory question

matthew@uiucme.UUCP (12/02/86)

How do you create windows on the //e (or //c) in 80 column mode?  What I would
like to do is save the area that I want to write the window to, plop the
window there and when I am done with the window, replace the window with
the original stuff.  I have no trouble doing this on my pc because I know 
where screen memory starts.  I can't find reference to this in any of the
manuals that I have.

Any help will be appreciated...

Matt

UUCP    {ihnp4,seismo,pur-ee,convex}!uiucdcs!uiucme!matthew
-or-    ihnp4!uiucuxc!uiucme!matthew
BITNET  matthew%uiucme@uiucuxc 
CSNET   matthew%uiucme@uiuc.csnet
ARPANET matthew%uiucme@uxc.cso.uiuc.edu

keeshu@nikhefk.UUCP (Kees Huyser) (12/04/86)

In article <18800002@uiucme> matthew@uiucme.UUCP writes:
>
>How do you create windows on the //e (or //c) in 80 column mode?  What I would
>like to do is save the area that I want to write the window to, plop the
>window there and when I am done with the window, replace the window with
>the original stuff.  I have no trouble doing this on my pc because I know 
>where screen memory starts.  I can't find reference to this in any of the
>manuals that I have.
>
>Matt
>
>UUCP    {ihnp4,seismo,pur-ee,convex}!uiucdcs!uiucme!matthew
>-or-    ihnp4!uiucuxc!uiucme!matthew

One of the ways is to get XtraK from Beagle Bros, which will do a screen move
for you. The XtraK program has a windows facility which is easy to install.

Another thing is to do all the moves yourself. Working on a //e or //c in 80
column mode means you still have access to the /RAM virtual disk in ProDOS.

Try the following (I've not tried this so dont blame me if it doesn't work
exactly this way...) :

	/* before saving anything else on /RAM /*

	BSAVE /RAM/SCREEN1,A$2000,L$FFFE /* HiResScreen #1 /*
	BSAVE /RAM/SCREEN2,A$4000,L$FFFE /* HiResScreen #2 /*

	/* You now have to files in your /RAM disk, on the spot
	   where in normal life the Double HiRes second page would be /*

	/* Now move your screens between the normal HiResScreen and the
	   files on the /RAM disk. Since these BSAVE's and BLOAD's are
	   in effect memory moves, they ought to go reasonably fast /*

As I said before, I've never tried this, but I've read an article about these
moves in which this technique was described. As I don't have a copy of the 
aricle with me, I can't give more details.

I hope this helps you out someway or another.

-- Kees

|  Kees Huyser 
|  UUCP	: keeshu@nikhefk.uucp  or : {[wherever]!seismo}!mcvax!nikhefk!keeshu
|  BITNET : U00212@hasara5.bitnet
|  FIDO via unix : {decvax}!vaxine!spark!500!11!kees_huyser
|  FIDO via fido : kees huyser at net 500 node 11

ranger@ecsvax.UUCP (Rick N. Fincher) (12/04/86)

In article <18800002@uiucme>, matthew@uiucme.UUCP writes:
> 
> 
> 
> How do you create windows on the //e (or //c) in 80 column mode?  What I would
> like to do is save the area that I want to write the window to, plop the
> window there and when I am done with the window, replace the window with
> the original stuff.  I have no trouble doing this on my pc because I know 
> where screen memory starts.  I can't find reference to this in any of the
> manuals that I have.

The 80 column screen resides in two separate banks of 1memory of 1K
each.  The mapping scheme is rather bizarre, so what you describe is not
simple.  However, Apple has a toolkit that will make this job simpler.
It is the mousetext toolkit available from developer support.  It will
let you create windows on an Apple //e with the new Roms and on the //c.
You can use the kit from Basic with & commands or from Apple Pascal and
assembler.  If you don't want to go that route, I would suggest getting
a book like "Inside the Apple //e" by Gary Little.  He goes into depth
about how the 80 column screen is mapped to the memory.  He doesn't  
have anything about windows, but it is good as a reference.  You might
also check Nibble magazine.  A few months back they published a simple
window manager program.  You can get this program on disk from them if you liif         
you like, the address is in the magazine.

Rick Fincher
ranger@ecsvax

sdh@joevax.UUCP (Retief of the CDT) (12/04/86)

> How do you create windows on the //e (or //c) in 80 column mode?  What I would
> like to do is save the area that I want to write the window to, plop the
> window there and when I am done with the window, replace the window with
> the original stuff.  I have no trouble doing this on my pc because I know 
> where screen memory starts.  I can't find reference to this in any of the
> manuals that I have.
> 
> Any help will be appreciated...
> Matt

Don't know how much this will help, but here goes.

In 40 column mode, the page 1 one of the text screen starts at $400, and
ends at $7ff, with page 2 following it from $800 to $bff.  If memory serves
me correctly, the dual pages are combined to produce one 80 column screen.
So the first 40 characters on one the top line go from $400 to $427, and the
second 40 go from $800 to $827.

This makes good sense because programs that were written in 40 column mode and
access the screen directly will still operate normally.  The only problem I
have is that Applesoft programs generally start at $800, and I know from
experience that it takes a bit of twiddling to get them to start elsewhere.

How to test this:  without anything important  in memory, turn on 80 column
mode and start changing bytes of screen memory.  If the second half of the
screen does not start at $800, most likely it is being taken out of one of
the banks of extended memory.

The //e reference manual should give memory maps of all screen memory.

One other caveat:
There are several bytes that go undisplayed on the text screen.  These are
used by DOS to remember the position of the R/W head.  If you change these
bytes, drive will not be able to find what its looking for the next time
around and will have to re-align itself (the icky grinding noise).  I don't
know where these bytes are.  I think they are the last few bytes.  Its been
so long, I forget.  It makes sense though.  One text screen is 1024 bytes.
Divide that by 40 characters and you should get the number of lines of
text on a screen: 25.6, not quite, but close.

Good luck
Steve Hawley
bellcore!sdh

sdh@joevax.UUCP (Retief of the CDT) (12/05/86)

> Try the following (I've not tried this so dont blame me if it doesn't work
> exactly this way...) :
> 
> 	/* before saving anything else on /RAM /*
> 
> 	BSAVE /RAM/SCREEN1,A$2000,L$FFFE /* HiResScreen #1 /*
> 	BSAVE /RAM/SCREEN2,A$4000,L$FFFE /* HiResScreen #2 /*
> 
> 	/* You now have to files in your /RAM disk, on the spot
> 	   where in normal life the Double HiRes second page would be /*
> 
> 	/* Now move your screens between the normal HiResScreen and the
> 	   files on the /RAM disk. Since these BSAVE's and BLOAD's are
> 	   in effect memory moves, they ought to go reasonably fast /*
>

DO NOT TRY TO DO THIS!

First of all, the save only does the hires screen, not the text screen,
as was wanted.  Second the length for both is off by a factor of 8!
the most efficient save of a hires screen is using L$1FF8 (the last 8
bytes are not displayed, so why save them?).  Using length $FFFE saves
64K (8 times the length of the hires screen).

Steve Hawley
joevax!sdh
 

scotto@pnet01@crash.UUCP (Scott O'Connell) (12/06/86)

x
 
How do you create windows on the //e (or //c) in 80 column mode?  What I
would
like to do is save the area that I want to write the window to, plop the
window there and when I am done with the window, replace the window with
the original stuff.  I have no trouble doing this on my pc because I know 
where screen memory starts.  I can't find reference to this in any of the
manuals that I have.
 
Any help will be appreciated...
 
Matt
 
x

I have a basic program typed in from Nibble.  I'm not sure where it is, but
I'll be glad to look for it if you want.

-- Scott O'Connell              ihnp4!crash!pnet01!scotto

rudolf@unirot.UUCP (Rudy Rumohr) (12/07/86)

The way I understand it, it goes like this:

The scheme is indeed braindamaged--the 80 column screen was designed 'around'
the original 40 column one.  The way they decided to do this was to mesh
two 40-col. areas into one 80-col. area.  The EVEN columns of the screen
are stored in the auxilliary bank starting at $400, and the ODD columns are 
in main memory starting also at $400.

Now, to access the main and aux. video memory, you've gotta flip a couple of
soft-switches.  The important ones are 80STOREON ($C001) and 80STOREOFF ($C000)
along with PAGE2ON ($C055) and PAGE2OFF ($C054).  Normal mode for the 80STORE
switch is OFF, which allows the PAGE2 switch to select either Page 1 or Page2,
the two Apple text screens.  But that is not what we want to do.  So, we write
to 80STOREON, which allows PAGE2ON to select auxilliary video memory (even
columns) and PAGE2OFF to select main video memory (odd columns).  The PAGE2 
switches are activated by either read or write.

Now comes the fun part.  Not only are there holes in screen memory that prevent
it from being contiguous, the screen LINES are not mapped in consecutive order.
For example, line 7 starts at $780 and line 8 starts at $428 (assuming you
call the top line of the screen line 0).  The mapping scheme is thus:  if you
express the line number you want in binary, the bits will look like this
     000abcde
Then, the base address of that line (the address in screen memory where the
line begins) is specified by
     000001cd eabab000    in binary.
Makes sense, eh?  Luckily, there is a monitor routine which can compute the base
address of the line you want.  Just stick the line number desired in the
accumulator and call BASCALC ($FBC1).  It returns its answer in BASL/BASH 
($28/$29)

This has all been tried and tested (by me) on my //c, and it seems to work OK.
Sorry about the length of this post, but if it helps anyone, it'll be worth it.
Good luck, and happy windowing.

{most places}!rutgers!unirot!rudolf

-- 
Rudy Rumohr Jr.			UUCP: ...!topaz!caip!unirot!rudolf
				USSnail: P.O. Box 3442, Wallington, NJ 07057
				Voice: (201) 933-0258