Path: news.uiowa.edu!chi-news.cic.net!arclight.uoregon.edu!news.uoregon.edu!cie-2.uoregon.edu!nparker From: nparker@cie-2.uoregon.edu (Neil Parker) Newsgroups: comp.sys.apple2.programmer Subject: Re: Help needed with various Apple II technical questions! Date: 6 Jun 1996 01:18:05 GMT Organization: University of Oregon Campus Information Exchange Lines: 117 Message-ID: <4p5bkd$b6j@pith.uoregon.edu> References: <4p2r17$1t6@homer.alpha.net> NNTP-Posting-Host: cie-2.uoregon.edu In article <4p2r17$1t6@homer.alpha.net> Andrew Werner writes: >Howdy all. I am planning to do a little project on my Apple ][ plus >for which I will need to know the following information: All these questions can be answered by looking in the appropriate manuals. Since not everybody has access to the manuals these days, I'll try to answer the simpler ones here. >(1) What are the memory addresses into which I can store characters >for display on the screen? The reason I need to know this is that I >can find the start of text and low resolution graphics page 1, but >are only 960 possible positions on the text screen and 1024 possible >locations on this page. Any pointers to this information would be >MUCH appreciated. Each row of the screen display occupies 40 consecutive bytes of memory. The rows themselves are scrambled, though, so that the first byte of the second row does *not* follow immediately after the last byte of the first row. Row Starting address --- ---------------- 0 $0400 (1024) 1 $0480 (1152) 2 $0500 (1280) 3 $0580 (1408) 4 $0600 (1536) 5 $0680 (1664) 6 $0700 (1792) 7 $0780 (1920) 8 $0428 (1064) 9 $04A8 (1192) 10 $0528 (1320) 11 $05A8 (1448) 12 $0628 (1576) 13 $06A8 (1704) 14 $0728 (1832) 15 $07A8 (1960) 16 $0450 (1104) 17 $04D0 (1232) 18 $0550 (1360) 19 $05D0 (1488) 20 $0650 (1616) 21 $06D0 (1744) 22 $0750 (1872) 23 $07D0 (2000) The eight 8-byte chunks of memory starting at $0478, $04F8, $0578, $05F8, $0678, $06F8, $0778, and $07F8 are not used by the screen display. They're usually known as the "screen holes," and they're reserved for the use of peripheral cards. If you'll look carefully at the table above, you notice that the order of lines in memory is 0, 8, 16, hole, 1, 9, 17, hole, 2, 10, 18, hole, and so forth. BASIC programmers can use this function to find the starting address of a row on the screen: DEF FN RA(Y) = 1024 + 128 * Y - 984 * INT (Y / 8) Then, whenever you need a row address, you can just say something like "AD = FN RA(R)", where "R" is a row number from 0 to 23. (I originally found that function in an old Beagle Bros Tip Book.) Machine-language programmers can do this: LDA ROWNUMBER ; (0...23) JSR $FBC1 This leaves the starting address of the row in memory locations $28 (low byte) and $29 (high byte). >(2) What is the memory usage of ProDOS without BASIC.SYSTEM? Again, >any answers of pointers to any of this information would be >appreciated. The ProDOS kernel reserves the language card memory (i.e. everything above $D000), and $BF00...$BFFF. The ProDOS Thunderclock driver makes temporary use of the first few bytes at $0200 (third-party clock drivers might also do so), and the QUIT code uses memory starting at $0280 to store the name of the program being launched. You might be able to get away with using language card memory from $D000 through $D0FF in the second bank (the one you get by doing LDA $C083; LDA $C083). If you have 128K (or more) of memory, the picture gets more complicated. The rules for which parts of the auxiliary bank you can use vary depending on whether or not /RAM installed. Since the rules are complicated and I don't have them memorized, I'll let somebody else answer this part of the question. >(3) What are the numerical values for all of the 6502 instructions >(like A0 is LDA #$XX, etc.)? Yet again, any pointers to this would >be appreciated, though this is not as crucial as the above queries. I'm not even going to try answering this question here...it's far too much typing. Fortunately, this information is available online (albeit in a condensed form). If you have access to FTP or a Web browser, connect by anonymous FTP to ftp.comlab.ox.ac.uk, and in the directory /pub/Cards you'll find a file called "6502.Z" and a file called "65C02.Z". These contain summaries of the 6502 and 65C02 instruction sets (I think the FTP server will automatically uncompress them if you type "get 6502" or "get 65C02"). Also look at http://www.comlab.ox.ac.uk/archive/cards.html. It provides a nice interface to the instruction set files. - Neil Parker -- Neil Parker | No cute quote, no cute ASCII art, no cute nparker@cie-2.uoregon.edu | disclaimer, no deposit, no return.... nparker@cie.uoregon.edu | (This space intentionally left blank: http://cie-2.uoregon.edu/~nparker | )