bm_Depth            equ     $5
_LVOWaitBlit        equ     -$E4
_LVOClipBlit        equ     -$228
bm_Planes           equ     $8
rp_BitMap           equ     $4
************************************************************************

                    movem.l   d0-d7/a0-a5,-(sp)
                    move.l    rp_BitMap(a1),a3
                    moveq     #0,d1
                    move.b    bm_Depth(a3),d1
                    lsl.w     #2,d1
                    lea       bm_Planes(a3),a0
                    ext.l     d2                     ;width
                    add.w     #15,d2
                    and.w     #$FFF0,d2
                    move.l    d2,d4
next_16_bytes       move.l    d4,d3
                    sub.l     d2,d3
                    lea       $10(a2,d3.l),a3
                    lsr.l     #3,d3
                    move.l    (a3),d6           ; what do you think
                    move.l    4(a3),d7          ; these are for? :-)
                    move.l    8(a3),a4          ; they were meant to backup
                    move.l    12(a3),a5         ; the data...
                    moveq     #0,d0
next_plane          move.l    0(a0,d0.w),a1
                    lea       0(a1,d3.l),a1
                    moveq     #0,d5
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    move.b    -(a3),d5
                    ror.l     #1,d5
                    move.b    d5,(a3)
                    lea       $10(a3),a3
                    swap      d5
                    move.w    d5,(a1)+
                    addq.b    #4,d0
                    cmp.b     d0,d1
                    bgt.s     next_plane
                    move.l    d6,(a3)             ; ...and these to restore
                    move.l    d7,4(a3)            ; them. Unfortunately,
                    move.l    a4,8(a3)            ; someone made a mistake.
                    move.l    a5,12(a3)
                    subq.l    #8,d2
                    subq.l    #8,d2
                    bgt       next_16_bytes
                    moveq     #0,d0
                    moveq     #0,d1
                    movem.l   (sp),d2-d4
                    moveq     #1,d5
                    moveq     #3,d6
                    rol.l     #6,d6
                    movem.l   $20(sp),a0/a1
                    exg       a0,a1
                    jsr       _LVOClipBlit(a6)
                    jsr       _LVOWaitBlit(a6)
                    movem.l   (sp)+,d0-d7/a0-a5
                    move.l    d2,d0
                    rts

                    end