[A83] Re: variable horizontal line routine?
[Prev][Next][Index][Thread]
[A83] Re: variable horizontal line routine?
At 12:32 2001-06-01, you wrote:
>ok, this should work, and should be fast enough, if you want you could
I'm sorry, but that is a _really_ crappy horiz-line routine.
It is about as slow as you can make a horiz-lineroutine. It is even quite
possible that useing the rom linedrawingroutine is much faster.
what you should do is find the byte in screenram where the line should start,
with the formula x/8 + y*12 (12 is the width of the buffer in bytes)
then find wich pixel it starts on, and then fill this part of a byte, and
then do bytewrites directly to the mem.
something along these lines: (Sorry, havn't even touched an 83 in 2 years,
and almost not used any z80 so it could be a bit of here and there, but
approx this: (its heavily based on my pixelplotting routine I posted in
this list about 2½ years ago or so)
input: a=x e=y
ld d,0 ; Do y*12
sla e
sla e
ld hl,0
add hl,de
add hl,de
add hl,de
ld d,0 ; Do x/8
ld e,a
srl e
srl e
srl e
add hl,de
ld b,e ; save bytexpos in b too.
ld de,graphbuf <-- or whatever. the adress of the graphbuf
anyway.
add hl,de ; Add address to graphbuf
ld de,0007h ; Get the remainder of x/8
and e
ld e,a
ld IX,pixtable ; Look up in table where line should start
add IX,de
ld a,(IX+0) ; and load this
ld (HL),a
ld a,12 <--- maybe this should be 11 or something.
sub b
ld b,a
loop:
inc HL
ld (HL),0ffh <--- you can do this can't you?
djnz loop
ret
pixtable
.db 11111111b
.db 01111111b
.db 00111111b
.db 00011111b
.db 00001111b
.db 00000111b
.db 00000011b
.db 00000001b
------
Ok. this should work, untested now though. if it doesn't work it should
with just a minor bugfixing. (I can help you bugfix if you want)
And this can at least claim to be fast. Maybe you can do it even faster,
but I don't think it is possible to do it much faster.
///Olle
Follow-Ups:
References: