|
|
|
|
*** Die Weltschnellste Kreisroutine in 680x0-Assembler *** Mich haben schon einige Leute gefragt wie ich so schnell Kreise zeichnen kann, hier des Rätsels Lösung. Keine Multiplikationen, komplett asynchrones Design, passt auch in den Cache des 68030. *** Download *** ;
;$VER: TurboCircle.asm 1.3 am 7.2.95 (c) Holger.Hippenstiel.org - lynxx@uni.de
;
;Geschrieben weil die orginal EGS-Funktion so furchtbar langsam war,
;610 Kreise mit (68030/50Mhz/WSpeed/EGS-Spektrum Zorro II) getestet.
;Mit dieser Routine 111111 Kreise d.h diese Routine ist 182 mal schneller.
;Später folgten noch einige andere Routinen, die dann alle zusammen in EGS-Turbo
;(siehe Aminet) landeten. Die Routine kann bei jeglichen Chunky-Screens verwendet werden.
;Gib mir Credits falls Du sie verwenden willst.
;
;Assembler-Kompabilität:
;+AsmOne, AsmPro, DevPac [Default Type = word], MasterSeka & Profimat
;+Mindest 68010-Assemblier-Modi erforderlich.
;-Ungetestet: A68k
;
;d0=X, d1=Y, d2=Color, d5=Size (max 2048), d6=ScreenWidth, d7=ScreenHeight (max 2048), a0=Screen
TurboCircle:
movem.l d0-d7/a0-a6,-(a7)
add d0,a0 ;X
move d1,a2 ;Y
ext.l d5
lea Multab(pc),a1
move.l (a1),d4
subq #1,d7
bmi.b .MulTabOk
cmp -4(a1),d7 ;Multab-Height = ScreenHeight ?
bne.b .NotSameHeight
cmp d4,d6 ;Multab-Width = ScreenWidth ?
beq.b .MulTabOk
.NotSameHeight:
move d7,-4(a1) ;Store new Screen-Height
ext.l d6
move.l a1,a3
move.l d6,d0
.MakeMul:
move.l d0,(a3)+ ;Make new Multab
add.l d6,d0
dbf d7,.MakeMul
move.l d6,d4
.MulTabOk:
lea (a1,a2.w*4),a1
move.l a0,a3
moveq #0,d7
add.l (a1,d5.w*4),a3
move.l a0,a4
moveq #0,d0
add.l (a1),a4
move.l d5,d3
move.l a0,a6
neg.l d3
add.l (a1,d3.w*4),a6
lea .IncX0(pc),a5
moveq #2,d1
add.l (a1),a0
move.l d3,d6
sub.l d5,d1
jmp (a5)
cnop 0,4
.IncX0: move.l a0,a1
.IncX1: add.l d5,a1
move.b d2,(a1) ;X+,Y-
move.l a4,a1
add.l d0,d1 ;X inc
add.l d5,a1
move.b d2,(a1) ;X+,Y+
move.l a0,a1
add.l d3,a1
move.b d2,(a1) ;X-,Y-
move.l a4,a1
addq.l #1,d6
add.l d3,a1
move.b d2,(a1) ;X-,Y+
move.l a6,a1
add.l d4,a4
add.l d0,a1
move.b d2,(a1) ;X+,Y-
move.l a6,a1
sub.l d4,a0
add.l d7,a1
move.b d2,(a1) ;X-,Y-
move.l a3,a1
add.l d7,a1
subq.l #1,d7
move.b d2,(a1) ;X-,Y+
move.l a3,a1
add.l d0,a1
addq.l #1,d0
move.b d2,(a1) ;X+,Y+
move.l a0,a1
addq.l #1,d1
bmi.b .IncX1
.CircleLoop:
addq.l #2,d6
cmp.l d0,d5
ble.b .CircEnd
move.l a0,a1
subq.l #1,d5
add.l d5,a1
move.b d2,(a1) ;X+,Y-
move.l a4,a1
addq.l #1,d3
add.l d5,a1
move.b d2,(a1) ;X+,Y+
move.l a0,a1
sub.l d4,a3
add.l d3,a1
move.b d2,(a1) ;X-,Y-
move.l a4,a1
add.l d4,a6
add.l d3,a1
move.b d2,(a1) ;X-,Y+
move.l a6,a1
add.l d4,a4
add.l d0,a1
move.b d2,(a1) ;X+,Y-
move.l a6,a1
sub.l d4,a0
add.l d7,a1
move.b d2,(a1) ;X-,Y-
move.l a3,a1
add.l d7,a1
move.b d2,(a1) ;X-,Y+
move.l a3,a1
subq.l #1,d7
add.l d0,a1
addq.l #1,d0
move.b d2,(a1) ;X+,Y+
add.l d6,d1
bpl.b .CircleLoop
jmp (a5) ;Else bra.w
.CircEnd:
movem.l (a7)+,d0-d7/a0-a6
rts
cnop 0,4
dc.l 0 ;Multab-Height
Multab: dc.l 0 ;Multab-Width
ds.l 2048
|