Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!ucbvax!tut.cis.ohio-state.edu!tortoise.cis.ohio-state.edu!meekins From: meekins@tortoise.cis.ohio-state.edu (Tim Meekins) Newsgroups: comp.sys.apple2 Subject: Re: FTA Modulae Keywords: Animation Message-ID: <110011@tut.cis.ohio-state.edu> Date: 19 Apr 91 20:23:17 GMT References: <47417@ut-emx.uucp> <109615@tut.cis.ohio-state.edu> <47484@ut-emx.uucp> Sender: news@tut.cis.ohio-state.edu Organization: The Ohio State University, Department of Computer and Information Science Lines: 89 In article <47484@ut-emx.uucp> daveh@ccwf.cc.utexas.edu (Dave Huang) writes: >In article <109615@tut.cis.ohio-state.edu> meekins@tortoise.cis.ohio-state.edu (timothy lee meekins) writes: >>I'm blushing right now. You're right. I really meant to say PEI but caught >>up in the excitement of answering a question I knew and mistakenly typed >>PEA. Thanks for noticing this before someone else gets really screwed-up >>trying to figure out what I was doing. > >Okie dokie :) But how do you go about mapping the stack and DP to the >SHR screen? Don't those have to stay in bank $00 while the SHR screen >is in bank $E1 and/or $01? > And for today's installment of Hacking With Tim: "Mapping the Stack and Direct Page for Sneaky Tricks" First off, you're right that the stack and direct page reside in bank $00 and the SHR screen reside in bank $E1 and/or $01. So, how can you possibly map something on bank 0 to bank 1 or $E1? Well, we use a trick that goes back to the //e architecture (I think). Bank $01 on the IIgs is treated like the alternate 64K bank on a 128K Apple //e. Since the 6502 cannot perform 24-bit addressing like a 65816, you can only use one bank or the other. So, there are a set of soft swicthes that can be set to determine which bank is being used. IN ADDITION, a soft switch was added to allow the Zero Page to be used on either bank. So, on a IIgs, we can access this switch (ALTZP) to move the DP/S to bank $00 or bank $01. In the code I'm showing below, I'll be using the STATEREG ($C068) to modify ALTZP. You can also use SETSTDZP ($C008) and SETZLTZP ($C009). So, in a typical routine, I'd use the following code "header": phd ;Save the direct page lda >$E1C068 ora #$0030 ;Set ALTZP sta >$E1C068 tsx ;Save the stack in X register Now all we need to do is point to the SHR area to "modify" lda #$2000+160-2 tcs lda #$2000+160 tcd now to scroll line 1 to line 0 pei (158) pei (156) pei (154) ... pei (0) and now we can clean everything up: lda >$E1C068 and #$FFCF sta >$E1C068 txs pld If you need to store X somewhere, there are some great screen holes available to use from $9E00+200 to $9E00+255. Also, mapping the DP/S can sometimes cause some funny things to happen to certain resources, so, if you want to make Todd happy, add a SEI/CLI pair and turn off interrupts before running this code. So, is this technique good for anything besides scrolling? YES!!!!!! For example, in Z3D I map the DP/S to the same scanline and issue PEI's to shadow the screen. I also clear the screen by mapping the DP then issuing STZ dp for the scanlines. If you a particular sequence of bytes you wish to place on the screen, you can PEA them directly to the screen. Happy Hacking! And until next time... -Tim Meekins -- +---------------------------S-U-P-P-O-R-T-----------------------------------+ |/ Tim Meekins <<>> Snail Mail: <<>> Apple II \| |> meekins@cis.ohio-state.edu <<>> 8372 Morris Rd. <<>> Forever! <| |\ timm@pro-tcc.cts.com <<>> Hilliard, OH 43026 <<>> /|