home *** CD-ROM | disk | FTP | other *** search
- Here is a part of the source i use when i want *fast* lines.
- It uses the blitter and writes directly to the DFF regs
- (no flames please, i *did* call Ownblitter first)
- There are som things left out, like where how to find the address of the
- bitplane to draw in, and where the coordinates comes from, but that
- should be easy to fill in.
- /$DR.HEX$
-
-
- DMACONR=2
- BLTCON0=$40
- BLTCON1=$42
- BLTAMOD=$64
- BLTBMOD=$62
- BLTCMOD=$60
- BLTAPT=$50
- BLTCPT=$48
- BLTDPT=$54
- BLTADAT=$74
- BLTBDAT=$72
- BLTAFWM=$44
- BLTSIZE=$58
-
- OwnBlitter=-456
- DisownBlitter=-462
-
- width=80 ;80 bytes = 640 pixels
-
-
-
- Draw_all_lines:
- move.l 4.w,a6
- move.l (a6),a6
- move.l (a6),a6 ;get base of Gfxlib
- jsr OwnBlitter(a6)
-
- lea $dff000,a6
- move #$8000,BLTADAT(a6)
- move #-1,BLTAFWM(a6)
- move #width,BLTCMOD(a6)
- move #$FFFF,BLTBDAT(a6) ;$FFFF=draw , $0000=clear
- ;These values are the same for all lines, no need to tell
- ;the blitter about them more than once
-
- move.l <startaddress of bitplane>,a0
- moveq #<numlines-1>,d7
- bsr.s drawem
- move.l 4.w,a6
- move.l (a6),a6
- move.l (a6),a6
- jmp DisOwnBlitter(a6)
-
-
- drawem: move <X0>,d0
- move <Y0>,d1
- move <X1>,d2
- move <Y1>,d3
-
- moveq #width,d4
- mulu d1,d4
- ;This could be sped up by reading a table with values
- ;0,width,width*2,width*3 etc.
- moveq #-16,d5
- and d0,d5
- lsr #3,d5
- add d5,d4
- add.l a0,d4
- moveq #0,d5
- sub d1,d3
- roxl.b #1,d5
- tst d3
- bge.s y2gy1
- neg d3
- y2gy1: sub d0,d2
- roxl.b #1,d5
- tst d2
- bge.s x2gx1
- neg d2
- x2gx1: move d3,d1
- sub d2,d1
- bge.s dygdx
- exg d2,d3
- dygdx: roxl.b #1,d5
- move.b table(pc,d5.w),d5
- add d2,d2
- wait: btst #6,DMACONR(a6)
- bne.s wait
- move d2,BLTBMOD(a6)
- sub d3,d2
- bge.s signn1
- or.b #$40,d5
- signn1: move d2,BLTAPT+2(a6)
- sub d3,d2
- move d2,BLTAMOD(a6)
- and #15,d0
- ror #4,d0
- or #$bca,d0
- move d0,BLTCON0(a6)
- move d5,BLTCON1(a6)
- move.l d4,BLTCPT(a6)
- move.l d4,BLTDPT(a6)
- addq #1,d3
- lsl #6,d3
- addq #2,d3
- move d3,BLTSIZE(a6) ;GO!
- dbra d7,drawem ;do next line
- rts
-
- table: dc.b 1,17,9,21,5,25,13,29
-
-