| ST interleaved-planar rect-copy spans -- 68000 hand-rolled (NATIVE-PERF
| Phase 7, #3). Replaces the per-row memcpy CALL in jlpSurfaceCopyRect
| (src/atarist/hal.c) for the small clean-buffer windows: gameFrameClean
| erases three 16x16 rects from the clean surface, i.e. 8 bytes/row (2
| longs) x 16 rows x 3 = 48 memcpy calls where mintlib memcpy's
| frame+length-dispatch dwarfs the two move.l. This is the ST (no-blitter)
| analogue of the Amiga W3 blitter copyRect that deleted the same
| call-overhead class (+76% at its landing). Large rows keep memcpy in C
| (its movem path beats a move.l loop past the crossover), so this only
| ever sees short spans.
|
| void stCopyRectSpans68k(uint8_t *dst, const uint8_t *src,
|                         int longsPerRow, int numRows);
| Copies numRows rows of longsPerRow longs each, both pointers strided by
| ST_BYTES_PER_ROW (160) between row STARTS. dst/src are long-aligned
| (group-snapped from long-aligned bases); longsPerRow >= 1, numRows >= 1,
| longsPerRow*4 <= 160. cdecl; d2-d7/a2-a6 callee-save (only d2/d3 used).

                .text

                .globl  _stCopyRectSpans68k

_stCopyRectSpans68k:
                movem.l %d2/%d3,-(%sp)         | 8 bytes saved
                move.l  12(%sp),%a1            | dst
                move.l  16(%sp),%a0            | src
                move.l  20(%sp),%d1            | longsPerRow
                move.l  24(%sp),%d2            | numRows
                | fixup = 160 - longsPerRow*4  (row-end -> next row start)
                move.w  %d1,%d0
                lsl.w   #2,%d0                 | rowBytes = longsPerRow*4
                neg.w   %d0
                add.w   #160,%d0               | d0 = 160 - rowBytes (>= 0)
                subq.w  #1,%d2                 | dbra numRows times
.rowLoop:
                move.w  %d1,%d3
                subq.w  #1,%d3                 | dbra longsPerRow times
.longLoop:
                move.l  (%a0)+,(%a1)+
                dbra    %d3,.longLoop
                adda.w  %d0,%a0                | stride to next row start
                adda.w  %d0,%a1
                dbra    %d2,.rowLoop
                movem.l (%sp)+,%d2/%d3
                rts
