Simple, not optimized Plot256 (x,y,color)
Quote from Mikele on 27th December 2018, 2:28 pmIf someone is still looking for 256 color Plot here is a simple version:
SUB Plot256(x as ubyte, y as ubyte, color as ubyte)
asm
push hl
push ix
LD b, (IX+7) ;Y =d
LD c, (IX+5) ;X =e
LD a,b
and 63
LD h,a
LD a,c
ld l,a
LD a, (IX+9) ;color
ld e,a
; bc = y/x
ld a,b
and 192
or 3
ld bc,LAYER2_ACCESS_PORT
out (c),a
;(x + 256 * y)
ld a,e
ld (hl),a
pop ix
pop hl
end asmend sub
sub Box(x as ubyte, y as ubyte, x1 as ubyte, y1 as ubyte, color as ubyte)
dim m as ubyte
FOR m=x to x1
Plot256(m,y, color)
Plot256(m,y1, color)
next m
for m=y to y1
Plot256(x,m, color)
Plot256(x1,m, color)
next mend sub
A video example (BOX subroutine is used) : https://www.youtube.com/watch?v=D9L0DBkLVU8
An another example: https://www.youtube.com/watch?v=ofgWFYswmIY
If someone is still looking for 256 color Plot here is a simple version:
SUB Plot256(x as ubyte, y as ubyte, color as ubyte)
asm
push hl
push ix
LD b, (IX+7) ;Y =d
LD c, (IX+5) ;X =e
LD a,b
and 63
LD h,a
LD a,c
ld l,a
LD a, (IX+9) ;color
ld e,a
; bc = y/x
ld a,b
and 192
or 3
ld bc,LAYER2_ACCESS_PORT
out (c),a
;(x + 256 * y)
ld a,e
ld (hl),a
pop ix
pop hl
end asmend sub
sub Box(x as ubyte, y as ubyte, x1 as ubyte, y1 as ubyte, color as ubyte)
dim m as ubyte
FOR m=x to x1
Plot256(m,y, color)
Plot256(m,y1, color)
next m
for m=y to y1
Plot256(x,m, color)
Plot256(x1,m, color)
next mend sub
A video example (BOX subroutine is used) : https://www.youtube.com/watch?v=D9L0DBkLVU8
An another example: https://www.youtube.com/watch?v=ofgWFYswmIY
Uploaded files:Quote from em00k on 2nd February 2019, 2:55 amVery nice! The New version has PlotL2(x,y,colour) and PointL2(x.y) for layer 2 🙂
They are very fast, as the sub is a fastcall which means we don need to use the slow IX+ and stacking.
Very nice! The New version has PlotL2(x,y,colour) and PointL2(x.y) for layer 2 🙂
They are very fast, as the sub is a fastcall which means we don need to use the slow IX+ and stacking.