. = 0x8c010000 VIDBEG = 0xa520a000 VIDSTRIDE = 640 * 4 DOTWD = 32 ; bytes (implicitly known in putdot) DOTHT = 16 ; lines XDOT = VIDSTRIDE / DOTWD .entry . ; r0 = scratch ; r1 = video ram base ; r2 = row stride, in bytes ; r3 = pointer to data for next dot to store ; r4 = number of dots remaining to store ; r5 = dot X ; r6 = dot Y ; r7 = dot V ; r8 = scratch ; r9 = scratch mov.l vidbeg,r1 mov.l vidstride,r2 mov.l dotptr,r3 mov.l ndots,r4 mainloop: 1: mov.b @r3+,r5 mov.b @r3+,r6 bsr putdot mov.b @r3+,r7 dt r4 bf 1b 1: nop bra 1b nop .align 4 vidbeg: .long VIDBEG vidstride: .long VIDSTRIDE dotptr: .long dots ndots: .long [enddots-dots]/3 putdot: ; Stores dot of all 0s or all 1s, depending on low bit of r7, at (r5,r6) ; Destroys r0, r8, r9 mov #DOTWD,r0 mul.l r0,r5 sts macl,r8 ; X offset in bytes mov.l 9f,r0 mul.l r0,r6 sts macl,r0 ; Y offset in bytes add r8,r0 add r1,r0 mov r7,r9 shlr r9 bt 1f bra 2f mov #0,r8 1: mov #-1,r8 2: mov #DOTHT,r9 3: ; This sequence knows DOTWD is 32 mov.l r8,@r0 mov.l r8,@(4,r0) mov.l r8,@(8,r0) mov.l r8,@(12,r0) mov.l r8,@(16,r0) mov.l r8,@(20,r0) mov.l r8,@(24,r0) mov.l r8,@(28,r0) dt r9 bf/s 3b add r2,r0 rts nop .align 4 9: .long DOTHT * VIDSTRIDE dots: ; y\x 0 1 2 3 4 5 6 7 ; 0 . . . . . . . . ; 1 . * * * * * * . ; 2 . * . . . * . . ; 3 . . . . * . . . ; 4 . . . . * . . . ; 5 . . . . * . . . ; 6 . * * * * * * . ; 7 . . . . . . . . ; x, y, v .byte 0, 0, 0 .byte 1, 0, 0 .byte 2, 0, 0 .byte 3, 0, 0 .byte 4, 0, 0 .byte 5, 0, 0 .byte 6, 0, 0 .byte 7, 0, 0 .byte 0, 1, 0 .byte 1, 1, 1 .byte 2, 1, 1 .byte 3, 1, 1 .byte 4, 1, 1 .byte 5, 1, 1 .byte 6, 1, 1 .byte 7, 1, 0 .byte 0, 2, 0 .byte 1, 2, 1 .byte 2, 2, 0 .byte 3, 2, 0 .byte 4, 2, 0 .byte 5, 2, 1 .byte 6, 2, 0 .byte 7, 2, 0 .byte 0, 3, 0 .byte 1, 3, 0 .byte 2, 3, 0 .byte 3, 3, 0 .byte 4, 3, 1 .byte 5, 3, 0 .byte 6, 3, 0 .byte 7, 3, 0 .byte 0, 4, 0 .byte 1, 4, 0 .byte 2, 4, 0 .byte 3, 4, 0 .byte 4, 4, 1 .byte 5, 4, 0 .byte 6, 4, 0 .byte 7, 4, 0 .byte 0, 5, 0 .byte 1, 5, 0 .byte 2, 5, 0 .byte 3, 5, 0 .byte 4, 5, 1 .byte 5, 5, 0 .byte 6, 5, 0 .byte 7, 5, 0 .byte 0, 6, 0 .byte 1, 6, 1 .byte 2, 6, 1 .byte 3, 6, 1 .byte 4, 6, 1 .byte 5, 6, 1 .byte 6, 6, 1 .byte 7, 6, 0 .byte 0, 7, 0 .byte 1, 7, 0 .byte 2, 7, 0 .byte 3, 7, 0 .byte 4, 7, 0 .byte 5, 7, 0 .byte 6, 7, 0 .byte 7, 7, 0 enddots: