Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!microsoft!brianw From: brianw@microsoft.UUCP (Brian Willoughby) Newsgroups: comp.sys.apple Subject: Re: Really small question Message-ID: <9542@microsoft.UUCP> Date: 15 Dec 89 03:50:31 GMT References: Reply-To: brianw@microsoft.UUCP (Brian Willoughby) Organization: Microsoft Corp., Redmond WA Lines: 50 rnf@shumv1.ncsu.edu (Rick Fincher) writes: >gt0t+@andrew.cmu.edu (Gregory Ross Thompson) writes: >> >> I'm working on a small ML program that does some SHR stuff in bank $00, >>just to prep the screen, and stuff like that. I need to move all this >>stuff into bank $E1 (obviously). Will the move routine at $FE20 move >>memory across banks? >> >> Also, is there an easy way to store with STA into bank E1? > >You can move the data by turning shadowing on then LDA and STA each >word back to its original location. This puts the data in bank E1 >and is faster than the memory moves you were talking about, if you >keep your loop overhead low. Hey, this has to be a GS if you are using SHR? (Unless you have a Video Overlay card) Why not just use the 24 bit address features of the 65C816? There are a couple of ways of doing this. You could reload the Data Bank register before doing the bank $00 prep, and then the stuff would already be in bank $E1. I think you would do LDA #01 (or $E1), PHA, PLB. After selecting a new data bank, code still executes from the current bank and data accesses work in the Data Bank with the normal 16 bit address supplying the least significant bits. Also, remember LDA (zp) ? The 65C816 has LDA [dp] and/or LDA [dp],y These allow pseudo address registers in the direct page to use 24 bit addresses, with the LSB first and the MSB in the third byte. You could use these indirect pointers to either create the image directly in the alternate video bank OR you could copy between banks after setting up full 24 bit pointers. Thirdly (did I say there were only a couple of ways? shame on me), you could use the VERY fast MVP instruction, which is as fast as DMA (for a given memory speed) if you are willing to move <= 64K in one shot. The MVP instruction uses all three 16 bit registers (A, X, Y) for length of move, source address and destination address (NOT respectively, don't trust my memory - look it up). Since you need to specify the full 24 bit address, MVP has two bytes of operands: the source Bank and destination Bank. You would probably use MVP 00,01 Actually I have a 65C802 in my ][ Plus, so I haven't copied between banks. But I have used a lot of 65C802 specific instructions when I really need speed. Brian Willoughby UUCP: ...!{tikal, sun, uunet, elwood}!microsoft!brianw InterNet: microsoft!brianw@uunet.UU.NET or: microsoft!brianw@Sun.COM Bitnet brianw@microsoft.UUCP