[Prev][Next][Index][Thread]
A85: Have you ever seen this?
"This routine replaces FIND_PIXEL and was written by Jim Kuzma. It is
functionally and operationally compatible with FIND_PIXEL; the only
difference is that HL is returned with the "physical" address instead of
the offset. BC and DE are preserved. Jim Kuzma took a look at the
FIND_PIXEL routine in the ROM and can say that this is better optimized
for plotting. It automatically handles plotting."
You can contact Jim Kuzma at 104165.456@compuserve.com
The function is called plotxy
;*******************************************************
; plotxy
; Routine to turn on or off a single pixel. Enter with
; reg BC containing the X, Y value, X = 0-127 Y = 0-63
; Origin (0,0) is lower left of screen.
; If reg A is zero, clear the pixel, if not, turn it on
; Returns with HL pointing at the LCD byte, reg A ; containing the
byte.
; BC and DE are preserved.
;*******************************************************
plotxy: push de ;preserve reg
push af ; preserve on/off flag
ld a,7
and b
lookupref: ld hl,(PROGRAM_ADDR)
ld de, lookup8
add hl,de ;a ZShell relocate
ld d,0
ld e,a
add hl,de
ld l,(hl) ;translate into bit
;preserve it in l
ld a,63
sub c ;invert ypos (63-0)
ld d,a
ld a,b ;invert xpos (127-0)
rlca ;double xpos, clear carry
srl d
rra
srl d
rra
srl d
rra
srl d
rra ;16bit shift right four bits
;through carry of da
ld e,a ;de contains offset into LCD mem
pop af
and a
jr nz,setpxl ;if reg nonzero set pixel
;zero clears pixel
ld a,l ;get back the bit
cpl ;invert the byte
ld hl,$fc00 ;point at LCD
add hl,de ;point at correct byte
and (hl) ;clear the bit
ld (hl),a ;write it back
pop de
ret
setpxl: ld a,l ;get back the bit
ld hl,$fc00 ;point at LCD
add hl,de ;point at correct byte
or (hl) ;set the bit
ld (hl),a ;write it out
pop de
ret
lookup8: .db 128
.db 64
.db 32
.db 16
.db 8
.db 4
.db 2
.db 1
This shows there are better optimized routines other than those in the
ROM. Remember I didn't write this Jim Kuzma did. He probably knows more
about Z80 than anyone on this list.
Mordant
egillespie@juno.com
erik_gillespie_1096@gwgate.kvcc.edu
"Just because you're paranoid don't mean they're not after you." -Kurt
Cobain
_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]
Follow-Ups: