Path: news1.icaen!news.uiowa.edu!uunet!in3.uu.net!206.229.87.25!news-peer.sprintlink.net!news.sprintlink.net!sprint!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!ais.net!visi.com!not-for-mail From: nathan@visi.com (Nathan Mates) Newsgroups: comp.sys.apple2.programmer Subject: Re: mvn Date: 21 Apr 1997 05:22:18 GMT Organization: Vector Internet Services, Inc. Lines: 84 Message-ID: <5jetia$sjb$1@darla.visi.com> References: <5j4g0e$10q$1@enyo.uwa.edu.au> <5jeoh5$gh5$1@enyo.uwa.edu.au> NNTP-Posting-Host: thumper.visi.com In article <5jeoh5$gh5$1@enyo.uwa.edu.au>, Joseph Turner wrote: > lda #0 >repeat inc ch+1 > inc ch+1 >ch tsb $2000 > beq repeat >But this code seems fairly silly, since the the two increment statements >take up 7 cycles, and so we are looking at a situation that isn't as >effeicent, or less efficient then the case I outilned above. Try a partially unrolled loop. But, since this is a case of slamming graphics thru from bank 01 to e1, the pei loop is one of the faster methods. It does turn off interrupts for a little bit, but if you do it with a fine enough granularity, you can get it so that background MOD players are not audibly affected. [Tested with Beatbox and an unreleased version of some of my Twilight II modules, just for fun :] Here's some rough code samples: tdc sta EntryDP tsc sta EntryStack shortm lda >$00c035 and #%11100111 ; shadowing on sta >$00c035 * Turn interrupts OFF while the stack is on the graphics screen, etc sei sta >$00c005 ; bank 1 stack/dp for write sta >$00c003 ; bank 1 stack/dp for read longm ldy #$2000 ; start on this page Loop tya tcd ; base of page clc adc #$FF ;put stack at top of page tcs inc a ; save adding $100 later tay pei $FE pei $FC * ... You get the drift pei $02 pei $00 cpy #$9D00 bge Done brl Loop ; More to do Done shortm sta >$00c004 ; bank 0 writing sta >$00c002 ; bank 0 reading longm lda EntryStack tcs lda EntryDP tcd cli ; let interrupts back on This slams thru the whole screen in one chunk. Making it do smaller chunks so as not to mess up interrupts as much is left as an exercise to the reader. Disclaimer: typed in while looking at code on my GS. Should work fine. If not, debug it. Nathan Mates -- <*> Nathan Mates http://www.visi.com/~nathan/ <*> # What are the facts? Again and again and again-- what are the _facts_? # Shun wishful thinking, avoid opinion, care not what the neighbors # think-- what are the facts, and to how many decimal places? -R.A. Heinlein Path: news1.icaen!news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!howland.erols.net!ix.netcom.com!visi.com!not-for-mail From: nathan@visi.com (Nathan Mates) Newsgroups: comp.sys.apple2.programmer Subject: Re: mvn Date: 21 Apr 1997 06:12:26 GMT Organization: Vector Internet Services, Inc. Lines: 22 Message-ID: <5jf0ga$2bd$1@darla.visi.com> References: <5j4g0e$10q$1@enyo.uwa.edu.au> <5jeoh5$gh5$1@enyo.uwa.edu.au> <5jetia$sjb$1@darla.visi.com> NNTP-Posting-Host: thumper.visi.com In article <5jetia$sjb$1@darla.visi.com>, Nathan Mates wrote: > pei $FE > pei $FC >* ... You get the drift > pei $02 > pei $00 I should add that according to the hardware geeks at Apple, inserting a nop after every 13 pei's speeds things up. I have not done any timing tests to validate this for myself, counterintuitive as it may seem. Some of the stuff people do for speed is just a black art with very few understanding every explanation... Nathan "Software hacker, not hardware" Mates -- <*> Nathan Mates http://www.visi.com/~nathan/ <*> # What are the facts? Again and again and again-- what are the _facts_? # Shun wishful thinking, avoid opinion, care not what the neighbors # think-- what are the facts, and to how many decimal places? -R.A. Heinlein