1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-31 04:30:59 +00:00

Fix lines in all directions

This commit is contained in:
David Schmenk 2019-12-27 17:51:31 -08:00
parent a056e00e93
commit 8a960f018b
3 changed files with 28 additions and 17 deletions

View File

@ -655,17 +655,12 @@ export asm hgrHLin(x1, x2, y)#0
LDA ESTKH+1
CMP ESTKH+2
BNE +
LDA ESTKL+0
STA ESTKL+1
LDA ESTKH+0
STA ESTKH+1
INX
end
asm _hgrHLinA
JMP $F000
JSR $F000
INX
RTS
+ LDY ESTKL+0,X ; Y COORD
CPY #192
BCS +
end
asm _hgrHLinB
LDA $8000,Y ; HGRSCANL

View File

@ -174,7 +174,9 @@ export def linespans(x1, y1, x2, y2)#0
fin
if dx >= dy
if sx < 0
x1, x2 = x2, x1; sy = -sy
y1, y2 = y2, y1
x1, x2 = x2, x1
sy = -sy
fin
if dy == 0
hspan(x1, x2, y1)#0; return
@ -205,7 +207,9 @@ export def linespans(x1, y1, x2, y2)#0
majorline(x1, x1 + halflen, x2, y1, sy, hspan)
else
if sy < 0
x1, x2 = x2, x1; sx = -sx
x1, x2 = x2, x1
y1, y2 = y2, y1
sx = -sx
fin
if dx == 0
vspan(y1, y2, x1)#0; return
@ -251,7 +255,9 @@ export def line(x1, y1, x2, y2)#0
fin
if dx2 >= dy2
if sx < 0
sy = -sy; x1, x2 = x2, x1
x1, x2 = x2, x1
y1, y2 = y2, y1
sy = -sy
fin
err = dy2 - dx2 / 2
for x = x1 to x2
@ -264,7 +270,9 @@ export def line(x1, y1, x2, y2)#0
next
else
if sy < 0
sx = -sx; y1, y2 = y2, y1
y1, y2 = y2, y1
x1, x2 = x2, x1
sx = -sx
fin
err = dx2 - dy2 / 2
for y = y1 to y2

View File

@ -21,11 +21,11 @@ def testline#0
setlinespans(@hgrHlin, @hgrVlin)
hgrColor(7)
for i = 0 to 191 step 8
linespans(0, 0, 279, i)
for i = 0 to 191 step 16
linespans(0, i, 279, 191 - i)
next
for i = 0 to 279 step 8
linespans(0, 0, i, 191)
for i = 0 to 279 step 14
linespans(i, 0, 279 - i, 191)
next
end
def testblt(sprtnum)#0
@ -78,7 +78,15 @@ spriteAdd(4, spriteDup(sprtBall))
spriteAdd(5, spriteDup(sprtBall))
spriteAdd(6, spriteDup(sprtBall))
spriteAdd(7, spriteDup(sprtBall))
testblt(8)
spriteAdd(8, spriteDup(sprtBall))
spriteAdd(9, spriteDup(sprtBall))
spriteAdd(10, spriteDup(sprtBall))
spriteAdd(11, spriteDup(sprtBall))
spriteAdd(12, spriteDup(sprtBall))
spriteAdd(13, spriteDup(sprtBall))
spriteAdd(14, spriteDup(sprtBall))
spriteAdd(15, spriteDup(sprtBall))
testblt(16)
getc
txtMode
done