#irony of new location
14-Nov-94 03:56:47
Sb: #843-#irony of new location
Fm: Nils Pipenbrinck 100121,2450
To: Geoffrey S. Kane 74537,1220
Hi Geoffrey,
Why don't you use Modex? Of cause, drawing the pixels is slower, but you can
use the multiple bitplane-writes to speed up the Clear-Page-Mechanism up to 4
times.
And you can use tripple-buffering (paging) for flicker-free animation.
I think it's worth the approach.
By the way, I wouldn't use a bresenham-line-algorithm.. I used a smaller
algorithm, which is much faster.. I'll post the source here..
; ============================ Prozeduren =============================== ;
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD Proc
BuildLineTable near ; ; Aufruf: p1=AX:BX p2=CX:DX ; calculates for all
Y-values between Y1 and Y2 the corresponding x-vals ; values will be stored
into the arrays minbuf and maxbuf ;
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
local x1:word, y1:word, y2:word, x2:word
uses si, di
cmp cx, ax ; Vergleiche X2 und X1
jz v_line ; Gleich? Vertikale Linie
jg nichtdrehen ; das x1 links liegt
xchg ax, cx
xchg bx, dx
nichtdrehen:
cmp bx, dx
jz h_line ; Horizontale Linie
mov [x1], ax
mov [y1], bx
mov [x2], cx
mov [y2], dx
xchg ax, cx
sub ax, cx
xor dx, dx ; HI-Word auf 0
mov cx, [y2] ; Delta-Y berechnen
sub cx, [y1]
js reverseline ; Delta-Y negativ?
; ——————– Code fr die '\'-Linie ————————–
mov di, cx ; DeltaY merken
idiv cx
mov [byte ptr cs:cm1+2], dl ; Div-Rest in den Code
schreiben
mov [byte ptr cs:ueberlauf], INC_BX
mov bx, [x1]
mov si, [y1] ; Offset-Zeiger in den
Tabellen
add si, si
shr dx, 1
inc cx
lineloop: StoreXVal bx ; Tabelle aktualisieren
add bx, ax ; Steigung addieren cm1:
add dx, BYTEDUMMY ; Div-Rest addieren
cmp dx, di ; mit DELTAY vergleichen
jae ueberlauf ; Rest -> Deltay?
add si, 2 ; Zeiger erhhen
loop lineloop
ret
ueberlauf: inc bx
sub dx, di ; Rest wiederherstellen
add si, 2
loop lineloop
ret
; ———————- Code fr die '/'-linie ————————–
reverseline: neg cx ; DeltaY negieren
mov di, cx ; DeltaY merken
idiv cx
mov [byte ptr cs:cm1+2], dl ; Div-Rest in den Code
schreiben
mov [byte ptr cs:ueberlauf], DEC_BX
mov bx, [x2]
mov si, [y2] ; Offset-Zeiger in den
Tabellen
add si, si
neg ax ; Quotient negieren
inc cx ; Zhler erhhen
shr dx, 1
jmp lineloop ; normale Line berechnen
; ———————— Horizontale Linie ——————————-
h_line: mov si, bx
add si, bx
StoreXval ax ; X-Werte fr Xmin aktualisieren
StoreXval cx ; X-Werte fr Xmax aktualisieren
ret
; ———————– Vertikale Linie —————————- v_line:
cmp bx, dx ; Vergleiche y2 mit y1
jl v_marke1
xchg bx, dx ; Tauschen, wenn bx>dx v_marke1:
mov si, bx
add si, bx ; Offset berechnen v_loop:
StoreXval ax ; Tabelle aktualisieren
add si, 2
inc bx
cmp bx, dx
jbe v_loop v_lineende: ret Endp
I apologize for the bad format and the german comments… if you have problems
(I only what to show you how it works) ask me… By the way, I use
code-manipulation, you have to define the opcodes for inc_bx ect.
Regards,
Nils