Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!hybrid!torag!utdoe!generic!pnet91!ericmcg From: ericmcg@pnet91.cts.com (Eric Mcgillicuddy) Newsgroups: comp.sys.apple2 Subject: Re: help optimizing asm routine (and help with GetCaretTime) Message-ID: <769@generic.UUCP> Date: 25 May 91 07:15:06 GMT Sender: root@generic.UUCP Organization: People-Net [pnet91], Etobicoke, ON Lines: 24 Do you want them optimized for speed or memory? Both right? Anyhow, the scroll_offscreen_grafport can be sped up considerably by using the MVP instruction. This is off the top of my head and untested, so..... :6 lda #num_bytes_2_move-1 ;159? _set_8_bit registers_XY ldx offimage+2 ;zero page variable sta move+1 ldx immage+2 stx move+2 ;self modifying code (note stx move+1) _set_16_bit_registers_XY ldx offimage ;holds address of LAST byte to move ldy image ;holds address of LAST byt of mvp #0,#0 ;destination - #0,#0 are dummy numbers That should do the copy much faster, 7 cycles per byte rather than 14 cycles per byte. A limitation is that the source and destination not cross banks. Use the same code with MVN to scroll DOWN. (or vice versa, it's late right now) Hope this is useful. UUCP: bkj386!pnet91!ericmcg INET: ericmcg@pnet91.cts.com