Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #346

Fastest method to copy/process a range of bytes?

From Egan Ford <datajerk@gmail.com>
Newsgroups comp.sys.apple2.programmer
Subject Fastest method to copy/process a range of bytes?
Date 2012-08-07 16:53 -0600
Organization XMission http://xmission.com/
Message-ID <jvs69d$qa1$1@news.xmission.com> (permalink)

Show all headers | View raw


This is the fastest I could come up with.  It aligns with what I have 
read online as well as in books.  The draw back is that I have to use x 
and y, it's long, and the (copy in this case) code has to be declared twice.

Any suggestions or tricks on doing this faster?

Thanks.


Assume length, ptr, and ptr_mp have already be set.

copy_mp:
         ldy     #0              ; init block counter
         ldx     length+1        ; do full blocks first,
				; ldx with number of full blocks
         beq     copy_mp1        ; if 0, no full blocks
:
         lda     (ptr),y         ; load it
         sta     (ptr_mp),y      ; store it
         iny                     ; next y
         bne     :-              ; still in block? go again
         inc     ptr+1           ; next block of 256
         inc     ptr_mp+1        ; next block of 256
         dex                     ; if more blocks
         bne     :-              ; back to :
copy_mp1:
         ldx     length          ; remainder of array
         beq     copy_mp2        ; no remainder (full blocks only)
:                               ; same as before, Y should be 0
         lda     (ptr),y         ; load it
         sta     (ptr_mp),y      ; store it
         iny                     ; count up address
         dex                     ; count down length of array
         bne     :-              ; back to :
copy_mp2:
         rts

Back to comp.sys.apple2.programmer | Previous | NextNext in thread | Find similar


Thread

Fastest method to copy/process a range of bytes? Egan Ford <datajerk@gmail.com> - 2012-08-07 16:53 -0600
  Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-07 18:57 -0700
    Re: Fastest method to copy/process a range of bytes? Daniel Kruszyna <dan@krue.net> - 2012-08-08 15:28 +0000
  Re: Fastest method to copy/process a range of bytes? aiiadict@gmail.com - 2012-08-07 22:07 -0700
  Re: Fastest method to copy/process a range of bytes? "Michael J. Mahon" <mjmahon@aol.com> - 2012-08-08 10:49 -0700
    Re: Fastest method to copy/process a range of bytes? "Michael J. Mahon" <mjmahon@aol.com> - 2012-08-08 10:59 -0700
  Re: Fastest method to copy/process a range of bytes? "Anton Treuenfels" <teamtempest@yahoo.com> - 2012-08-08 21:27 -0500
    Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-08 22:12 -0700
      Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-08 22:23 -0700
        Re: Fastest method to copy/process a range of bytes? "Anton Treuenfels" <teamtempest@yahoo.com> - 2012-08-09 18:35 -0500
          Re: Fastest method to copy/process a range of bytes? Jerry <awanderin@yahoo.ca> - 2012-08-11 01:03 -0600
            Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-11 11:33 -0700
    Re: Fastest method to copy/process a range of bytes?  mmphosis <mmphosis@macgui.com> - 2012-08-09 06:09 +0000
      Re: Fastest method to copy/process a range of bytes?  mmphosis <mmphosis@macgui.com> - 2012-08-09 09:40 +0000
      Re: Fastest method to copy/process a range of bytes? "Anton Treuenfels" <teamtempest@yahoo.com> - 2012-08-09 18:54 -0500
        Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-09 17:48 -0700
        Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-09 17:46 -0700
          Re: Fastest method to copy/process a range of bytes? Michael J. Mahon <mjmahon@aol.com> - 2012-08-10 15:25 -0500
            Re: Fastest method to copy/process a range of bytes? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-10 14:23 -0700
    Re: Fastest method to copy/process a range of bytes? Egan Ford <datajerk@gmail.com> - 2012-08-12 08:56 -0600
      Re: Fastest method to copy/process a range of bytes? "Anton Treuenfels" <teamtempest@yahoo.com> - 2012-08-12 23:27 -0500
        Re: Fastest method to copy/process a range of bytes? Egan Ford <datajerk@gmail.com> - 2012-08-13 11:18 -0600
  Re: Fastest method to copy/process a range of bytes? Egan Ford <datajerk@gmail.com> - 2012-08-11 15:58 -0600
    Re: Fastest method to copy/process a range of bytes? Egan Ford <datajerk@gmail.com> - 2012-08-11 16:16 -0600

csiph-web