Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!unirot!rudolf From: rudolf@unirot.UUCP (Rudy Rumohr) Newsgroups: comp.sys.apple Subject: Re: // screen memory question Message-ID: <193@unirot.UUCP> Date: Sat, 6-Dec-86 22:54:14 EST Article-I.D.: unirot.193 Posted: Sat Dec 6 22:54:14 1986 Date-Received: Sun, 7-Dec-86 05:20:26 EST References: <18800002@uiucme> <72@nikhefk.UUCP> <373@joevax.UUCP> Reply-To: rudolf@unirot.UUCP (Rudy Rumohr) Organization: Public Access Unix, Piscataway NJ Lines: 42 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