Newsgroups: comp.sys.apple2 Subject: Re: Memory Map for IIe (64K & 128K versions?) From: dempson@actrix.gen.nz (David Empson) Date: Sat, 24 Oct 1998 19:02:28 +1300 Message-ID: <1dheyl1.14t0uv91017fl4N@dempson.actrix.gen.nz> References: <70gk3q$o4k$1@news.ametro.net> <362ED81F.F67D3C17@swbell.net> Organization: Empsoft X-Newsreader: MacSOUP 2.3 NNTP-Posting-Host: 202.49.157.176 X-Trace: 24 Oct 1998 19:01:51 -1300, 202.49.157.176 Lines: 254 Path: news1.icaen!news.uiowa.edu!NewsNG.Chicago.Qual.Net!nyd.news.ans.net!newsfeeds.ans.net!news.idt.net!newsfeed.cwix.com!203.97.37.7!newsfeed.clear.net.nz!news.iprolink.co.nz!news.actrix.gen.nz!dempson Xref: news1.icaen comp.sys.apple2:140889 Rubywand wrote: > SOFTSWITCHES > > KEYBOARD = $C000 ;keyboard data (latched) (RD-only) Bit 7 is set to indicate a keypress is waiting, with the ASCII code in bits 6-0. > CLR80COL = $C000 ;use 80-column memory mapping (WR-only) > SET80COL = $C001 > > CLRAUXRD = $C002 ;read from auxilliary 48K > SETAUXRD = $C003 [snip] > CLRALTCH = $C00E ;use alternate character set ROM > SETALTCH = $C00F Note that all the $C000-$C00F mode switches are write-only. > STROBE = $C010 ;strobe (unlatch) keyboard data This can be read or written for the unlatch function. If read, it also provides an "any key down" flag in bit 7, with the keycode in the remaining bits. (These features only apply to the IIe and later machines.) [snip] There is one missing in here: reading $C020 toggles the cassette output. > SPEAKER = $C030 ;toggle speaker diaphragm There is one missing in here: reading $C040 generates a 0.5 microsecond pulse on the STROBE pin in the game port (IIe and ][+ only, not available on the IIgs). > CLRTEXT = $C050 ;enable text-only mode > SETTEXT = $C051 The comment is a little misleading. CLRTEXT enables graphics mode, SETTEXT enables text mode. > CLRMIXED = $C052 ;enable graphics/text mixed mode > SETMIXED = $C053 Ditto (and this switch is only effective if graphics mode is enabled). > TXTPAGE1 = $C054 ;select page1/2 (or page1/1x) > TXTPAGE2 = $C055 The Page 1/1X reference is to the 80-column bank-switching: if the SET80STORE (SET80COL as written here) switch is active, then seleting page 2 gives you the auxiliary bank corresponding to the text or graphics screens. Also note that these are called PAGE1 and PAGE2, not TXTPAGE1/2. They switch both graphics and text pages. > CLRHIRES = $C056 ;enable Hi-res graphics > SETHIRES = $C057 Again the comment is on the wrong line. If HIRES is clear then low resolution graphics are enabled. > SETAN0 = $C058 ;4-bit annunciator inputs > CLRAN0 = $C059 > SETAN1 = $C05A > CLRAN1 = $C05B > SETAN2 = $C05C > CLRAN2 = $C05D > SETAN3 = $C05E > CLRAN3 = $C05F The annunciators are outputs, not inputs. Also note that while these names are correct (according to some Apple documentation), the "SET" locations cause the output to go to 0V, and the "CLR" locations cause the output to go to +5V. I prefer to name them the other way around, corresponding to normal positive logic. Note also that annunciator 3 is used in conjunction with the 80VID switch to enable double lo-res and double hi-res graphics. > OPNAPPLE = $C061 ;open apple (command) key data > CLSAPPLE = $C062 ;closed apple (option) key data These are actually the first two game switch inputs (SW0 and SW1), which are borrowed by the Open Apple and Closed Apple keys. Bit 7 is set in these locations if the game switch or corresponding key is pressed. $C063 reads SW2, which has an option to be connected to the shift key on the keyboard. If the game switch is pressed, bit 7 is set, but if the modification is applied then the shift key causes bit 7 to be clear (and the power supply is shorted out if switch 2 and the shift key are pressed at the same time, unless a series resistor was used in the modification). The list is missing $C060, which is the cassette input location, and $C064-$C067, which are paddles 1 to 4 (bit 7 set when the paddle circuit times out). > PDLTRIG = $C070 ;trigger paddles Read this to start paddle countdown, then time the period until $C064-7 bit 7 become set to determine the paddle position. This takes up to three milliseconds if the paddle is at its maximum extreme (reading of 255 via the standard firmware routine). > For WR-enable LC RAM, the softswitch REQUIRES two successive reads > > $C080 ;RD LC RAM bank2, WR-protect LC RAM > ROMIN = $C081 ;RD ROM, WR-enable LC RAM > $C082 ;RD ROM, WR-protect LC RAM > LCBANK2 = $C083 ;RD LC RAM bank2, WR-enable LC RAM $C084-$C087 are echoes of $C080-$C083, so there is no point documenting or using them. Ditto for $C08C-$C08F with respect to $C088-$C08B. > > $C088 ;RD LC RAM bank1, WR-protect LC RAM > $C089 ;RD ROM, WR-enable LC RAM > $C08A ;RD ROM, WR-protect LC RAM > LCBANK1 = $C08B ;RD LC RAM bank1, WR-enable LC RAM "Bank 1" and "Bank 2" here refer to the 4K bank at locations $D000-$DFFF. The remaining area from $E000-$FFFF is the same for both sets of switches. The locations from $C090-$C0FF are divided into 16 byte chunks, one for each slot. The purpose of these locations varies depending on the card installed in each slot. Be very careful with these locations, because if you don't know what the card is you could damage something (especially in the case of a disk controller - the disk contents can be wiped if you play with the soft switches). The locations $C100-$C7FF are divided into 256 byte pages, one for each slot. This is normally used for the firwmare on each card, though some cards also have I/O in this area. Slot 3 is handled specially: the firmware for the 80-column card is on the motherboard, and a soft-switch determines whether this or the slot firwmare is accessed. The $C800 space (see below) is also affected by this. In addition, $C100-$C2FF and $C400-$C7FF can be switched to internal ROM through a softswitch. They contain monitor firmware extensions and self-test code. > CLRC8ROM = $CFFF ;switch out slot C8 ROM Reading any location from $Cn00-$CnFF (where n is the slot) will enable the $C800-$CFFF area for that card, if the card supports this feature. Reading $CFFF disables this area for all cards. The $C800 space is a further 2K area normally used for firmware expansion by cards that can't fit their code in 256 bytes (most of them). Some cards have RAM and/or I/O in this area, and some use internal bank switching to get even more space. > $0300 --------------- > > Mainly Open area-- a nice place to load in short machine language > routines (like sound routines, etc.) Roughly the upper 32 bytes > are used for holding Reset, IRQ, ... vectors and some DOS vectors. 48 bytes ($3D0 - $3FF), though only $3ED-$3FF are important if you are writing a ProDOS SYS file (the lower ones are used by BASIC.SYSTEM or DOS 3.3). > $0400 --------------- > > Text "Page" 1 (or LoRes "Page" 1)-- Place where most TEXT you see on > a 40-col display is located (40 chars x 24 lines). If in Graphics > mode, you see a 16-color LoRes display (40 x 48). If in Graphics > mode with Full Graphics set, you see just LoRes. If in Graphics > mode with Mixed set, you get 40 lines of Lores with 4 lines of > TEXT at the bottom. (On a 128k Apple II, this can be used as half of > the 80-col. Text "Page" 1 or half of the Double-LoRes "Page" 1.) It is also very important to note that there are a total of 64 locations in 8 groups of 8 bytes scattered through the text screen, which are used by the firmware and by slot-based cards. These locations must be left alone by applications. They are the last 8 bytes in each 128 bytes, i.e. $0478-$047F, $04F8-$04FF, etc. > $8000 --- (Approximately)--- This is the typical 'safe' upper limit > for the BASIC program area (i.e. for Program + variables) when > DOS or ProDOS are also present. DOS 3.3 usually allows going a > bit higher. The upper limit is actually $9600 for both operating systems, unless you need to open files under ProDOS. ProDOS automatically manages the HIMEM limit as required (moving variables out of the way), so the usable upper limit will vary depending on your file access requirements. With DOS 3.3 you have to explicitly set the maximum number of open files, and memory availability is adjusted accordingly. Note also that some third-party versions of DOS 3.3 live in the language card, so all of $9600-BEFF (roughly) is available for BASIC programs. The same applies if you are writing a SYS file under ProDOS, since BASIC.SYSTEM is not there to use up this space. > $D000 --------------- > > Usually employed for BASIC in-ROM or for one of two 4kB "Language > Card" banks of RAM. > > $E000 --------------- > > Usually employed for BASIC in-ROM (continued) and the Monitor in-ROM or > for one 8kB "Language Card" bank. > > In-ROM BASIC runs from $D000-$F7FF > > The In-ROM Monitor runs from $F800-$FFFF The IIe monitor also uses code in the $C100-$C2FF area. > > $FFFF --------------- End of 64kB "Main Bank" memory Note that the entire language card is used by the ProDOS kernel. As for a 128KB IIe, there is a second 64K "auxiliary" bank of memory which mirrors the first one. There are several soft-switches that select which bank is accessed in various areas, and some firmware routines provided by the 80-column firmware to copy data and transfer control between the banks. Text and Hi-res graphics page 1 can be switched between main and auxiliary using annunciator 3 and the 80STORE, page1/2 and HIRES soft switches as required. Another pair of switches determines which bank is being read and which bank is being written for the $0200-$BFFF area (exluding the text and hires graphics pages, if the 80STORE switch is enabled). These switches may be set independently, allowing reading from one bank while writing to the other. Another switch determines which bank is being accessed for the $0000-$01FF and $D000-$FFFF area (including both language card banks). -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand