u9050728@cs.uow.edu.au (Shane Kelvin Richards) (04/18/91)
One thing that always got me was near the beginning of the Modulae Demo, just after the words haved scrolled around in a circular demo, the Modulae Control Panel is scrolled up the screen. I didn't think it possible to move so much data so smoothly and quickly, how are they doing it? -- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Shane Richards u9050728@cs.uow.edu.au +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
meekins@tortoise.cis.ohio-state.edu (timothy lee meekins) (04/18/91)
In article <1991Apr18.040333.2738@cs.uow.edu.au> u9050728@cs.uow.edu.au (Shane Kelvin Richards) writes: > > One thing that always got me was near the beginning of the Modulae >Demo, just after the words haved scrolled around in a circular demo, the >Modulae Control Panel is scrolled up the screen. I didn't think it possible >to move so much data so smoothly and quickly, how are they doing it? > he he he. That's my favorite part of Modulae. But it's alo pretty simple to do. What's needed is a fast way (ie. ONE instruction) which can copy a byte from one row to another. The one that comes to mind id PEA. What FTA then does is to map the direct page to the source scanline and map the stack to the right-hand side of the destination scanline. Then by executing the following statements, and entire scanline will get scrolled up one scanline (or two or three if you map them differently). pea $BE pea $BC pea $BA pea $B8 ... pea $02 pea $00 This will scroll one scanline. Repeat this 199 times (remapping the DP and stack each time) to scroll the entire screen. -tim -- +---------------------------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 <<>> /|
daveh@ccwf.cc.utexas.edu (Dave Huang) (04/19/91)
In article <109414@tut.cis.ohio-state.edu> meekins@tortoise.cis.ohio-state.edu (timothy lee meekins) writes: >What's needed is a fast way (ie. ONE instruction) which can copy a byte from >one row to another. The one that comes to mind id PEA. What FTA then does is Do you mean PEI?? >to map the direct page to the source scanline and map the stack to the >right-hand side of the destination scanline. Then by executing the following >statements, and entire scanline will get scrolled up one scanline (or two or >three if you map them differently). How do you do that? I thought the DP and stack have to be in bank $00, while the screen is in bank $E1 or $01 if you shadow... > pea $BE > pea $BC > pea $BA > pea $B8 If you do that, won't it just push $00BE, $00BC .... onto the screen? That's why I was wondering if you mean PEI... >-- >+---------------------------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 <<>> /| BTW, is the last line of your .sig missing? I seem to remember that there was a line that said "SHAREWARE" (appropriatly spaced with "-"s, of course :-) -- David Huang | Internet: daveh@ccwf.cc.utexas.edu | "How much is that hamster UUCP: ..!ut-emx!ccwf.cc.utexas.edu!daveh | in the window?" America Online: DrWho29 |
meekins@tortoise.cis.ohio-state.edu (timothy lee meekins) (04/19/91)
In article <47417@ut-emx.uucp> daveh@ccwf.cc.utexas.edu (Dave Huang) writes: > >Do you mean PEI?? 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. > > >BTW, is the last line of your .sig missing? I seem to remember that >there was a line that said "SHAREWARE" (appropriatly spaced with "-"s, >of course :-) If you know a way of conning PNews into allowing a .sig with >4 lines of text then let me know. You used to see all 5 lines, but that was when I was using my mailer to post messages. The only problem was that 8 out of 10 posts would bounce back. My best bet is designing a new sig. >-- >David Huang | >Internet: daveh@ccwf.cc.utexas.edu | "How much is that hamster >UUCP: ..!ut-emx!ccwf.cc.utexas.edu!daveh | in the window?" >America Online: DrWho29 | -- +---------------------------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 <<>> /|
daveh@ccwf.cc.utexas.edu (Dave Huang) (04/19/91)
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? >If you know a way of conning PNews into allowing a .sig with >4 lines of >text then let me know. You used to see all 5 lines, but that was when I No, I guess not... You could manually insert your .sig file into your article and not have Pnews do it, but that would get pretty tedious after a while. >+---------------------------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 <<>> /| -- David Huang | Internet: daveh@ccwf.cc.utexas.edu | "How much is that hamster UUCP: ..!ut-emx!ccwf.cc.utexas.edu!daveh | in the window?" America Online: DrWho29 |
meekins@tortoise.cis.ohio-state.edu (Tim Meekins) (04/20/91)
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 <<>> /|
toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (04/20/91)
meekins@tortoise.cis.ohio-state.edu (Tim Meekins) writes: >And for today's installment of Hacking With Tim: >"Mapping the Stack and Direct Page for Sneaky Tricks" which just so happens to be the title of today's installment of Todd Fixes Your Code.... >map something on bank 0 to bank 1 or $E1? Well, we use a trick that goes back >to the //e architecture (I think). That's right. They wanted more than 64K to be available, and decided to do truly evil bank-switching -- an entire extra memory space. The Double-res video buffers occupied the same memory areas, but went out to the screen twice as fast, with the first half of each 1 microsecond video cell coming from the 'auxiliary' 64K and the second half from the 'main' 64K. It was a truly spiffy hack, but by this time chip technnology had progressed to the point where it shouldn't have been necessary (especially not for Apple). Memory quirks in the // series make great hacking legends but are not good for practical programming -- except in this case... >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). Aighh!! This is totally wrong. The memory mapping switches that were available were: 80STORE, for accessing the auxiliary video buffers ONLY RAMRD, for memory reads from $200-$BFFF RAMWRT, for memory writes from $200-$BFFF ALTZP, for bank-switching $0-$1FF AND $D000-$FFFF simultaneously STATEREG does work, you just need to set RAMWRT instead of ALTZP. In fact, your bitmask of $30 below is the correct one for setting both RAMRD and RAMWRT. >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 Nitpick note- C069 is reserved, so you should be using 8 bit access. There's no guarantee it will be a RMW register if it is ever defined. >Now all we need to do is point to the SHR area to "modify" > lda #$2000+160-2 > tcs > lda #$2000+160 > tcd That should be -1 but otherwise ok >now to scroll line 1 to line 0 [correct pei's deleted] >and now we can clean everything up: > lda >$E1C068 > and #$FFCF > sta >$E1C068 > txs > pld This is fine. One last problem: >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. Tim, you are not making me happy. You ARE AVOIDING PISSING ME OFF BECAUSE APPLETALK CRASHES YOUR DEMO. You should ALWAYS put a php/sei, plp pair around code that changes the bank-switched memory state like this or points the stack at data instead of stack stuff. If you do not then anybody with AppleTalk Installed will not be able to run your programs, and any interrupts (like sound or VBL) that occur while you are drawing to the screen will use your remapped stack as a tiny temporary buffer. Tim is lucky to have survived so long programming things this way. Todd Whitesel toddpw @ tybalt.caltech.edu P.S. At least he gets them done, though. I finally have a more or less free weekend, so LHG watchers take heart.
daveh@ccwf.cc.utexas.edu (Dave Huang) (04/20/91)
In article <110011@tut.cis.ohio-state.edu> meekins@tortoise.cis.ohio-state.edu (Tim Meekins) writes: >And for today's installment of Hacking With Tim: > >"Mapping the Stack and Direct Page for Sneaky Tricks" Cool! Thanks for the tips! I moved from a 64K ][+ to a 256K GS, so I missed out on all the good stuff about auxillary memory... >-- >+---------------------------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 <<>> /| -- David Huang | Internet: daveh@ccwf.cc.utexas.edu | "How much is that hamster UUCP: ..!ut-emx!ccwf.cc.utexas.edu!daveh | in the window?" America Online: DrWho29 |
6600prao@ucsbuxa.ucsb.edu (Parik Rao) (04/20/91)
Also a small note; you only want to pei up to $A0. Beyond that,you will have massive problems aligning the stack/DP (since each is page-based, ie you can only go from $00-FF). By going to $A0, you can just pop them both up/down by 160 bytes (320 pixels) each loop. There are some other tricks to use, like having the stack mapped from $00->$01->$E1 [read from bank 0, write to bank 1, shadow to bank e1], using precompiled shapes, updating only what you change on the screen, folding the stack so that only a certain width & height is updated, and so forth. The registers $e0c029,e0c035,and e0c068 are your friends. -- Apple II Forever | 6600prao@ucsbuxa.ucsb.edu | IBMs get the job done Parik Rao | Amiga - for the creative mind | Class of 1994 Macintosh - buy it or Apple will sue you.