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


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

Re: Fastest method to copy/process a range of bytes?

From aiiadict@gmail.com
Newsgroups comp.sys.apple2.programmer
Subject Re: Fastest method to copy/process a range of bytes?
Date 2012-08-07 22:07 -0700
Organization http://groups.google.com
Message-ID <0caa25b9-9dfc-48bc-8a69-bb6aa76f0060@googlegroups.com> (permalink)
References <jvs69d$qa1$1@news.xmission.com>

Show all headers | View raw


On Tuesday, August 7, 2012 3:53:32 PM UTC-7, datajerk wrote:

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

I looked at it and didn't see any ways to speed it up
(I'm not claiming any expertise)...

You might want to look at the auxmove routine?  should
be tight, fast code.  Also, prodos source code would be
good to look at for tight loops to move pages and partial
pages of memory.


length  dfw 0000 ;define 16bit word, length (of data to move)
ptr     equ $00 ;16 bit pointer to origin
ptr_mp  equ $02 ;16 bit pointer to destination

copy_mp:
         ldy     #0              ; init block counter
         ldx     length+1        ; do full blocks first,
                                 ;so get the hibyte of length
                                ; which is # of full blocks
         beq     copy_mp1        ; if 0, no full blocks
:
         lda     (ptr),y         ; load from origin
         sta     (ptr_mp),y      ; store to destination
         iny                     ; next y
         bne     :-              ; still in block? go again
         inc     ptr+1           ; next block of 256 (increment hibytes)
         inc     ptr_mp+1        ; next block of 256
         dex                     ; x contains LENGTH, # of full blocks
         bne     :-              ;if more blocks back to :


copy_mp1:                        ;y contains zero at this point
         ldx     length          ; remainder of array
         beq     copy_mp2        ; no remainder 
:                               ; 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 | NextPrevious in thread | Next 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