. = 0x8c010000 .entry . ; r0 = ptr to video ram ; r1 = ptr to end of video ram to write ; r2 = bits to write, in storebits ; r3 = loop counter, in storebits ; r4 = r0 working copy ; r5 = scratch ; r6 = ; r7 = loop counter, in main line ; r8 = saved pr, in store_010 ; r9 = scratch ; set up r0 mov.l vidbeg,r0 mov.l vidend,r1 mainloop: bsr store_010 mov r0,r4 mov #32,r7 1: shll r4 bsr storebit rotcl r2 dt r7 bf 1b bsr store_010 nop mov #40-[3+32+3],r7 1: bsr storebit mov #0,r2 dt r7 bf 1b cmp/hi r1,r0 bf mainloop 1: nop bra 1b nop .align 4 vidbeg: .long 0xa5000000 a520a000 vidend: .long 0xa5400000 - [640*4] store_010: ; Stores 000000000000000011111111111111110000000000000000 pattern. ; Input - r0, pr ; Output - r0 advanced, r2/r3/r8/pr destroyed sts pr,r8 bsr storebits mov #0,r2 bsr storebits mov #-1,r2 bsr storebits mov #0,r2 jmp @r8 nop storebit: ; Stores 1010000000001010 or 1010111111111010 into next 32 pixels. ; Middle 8 bits come from low bit of r2 on input. ; Input - r0, r2, pr ; Output - r0 advanced, r2/r3/r9/macl destroyed mov #1,r9 and r9,r2 mov.w 2f,r9 mul.l r9,r2 sts macl,r2 mov.w 1f,r9 bra storebits or r9,r2 .align 2 1: .word 0x5005 2: .word 0x0ff0 .align 2 ; Store 16 bits from r2 into the next 16 (16-bit) pixels, LSB first ; Input - r0, r2, pr ; Output - r0 advanced, r2/r3 destroyed storebits: mov #16,r3 1: shlr r2 bt 2f bra 3f mov #0,r9 2: mov #-1,r9 3: mov.w r9,@r0 add #2,r0 dt r3 bf 1b rts nop