ld hl,(256*5)+10 ;row 5, col 10
ld (_penCol),hl
ld hl,stupid_string ;string to display
call _vputs ;display it
ld hl,(256*(5+7))+10 ;row 12, col 10
;each line is
; 7 pixels
ld (_penCol),hl
ld hl,stupid_string
jp _vputs ;display it & return
It was good that we used hl to load up
our coordinates, but there is some redundancy in that
we do ld hl,stpuid_string ,
call jp _vputs , and ld
(_penCol),hl twice. We could make a universal call
that would load the coordinates, load the string, and
display the string. One of the keys to optimization
is looking for redundancies. The second routine saves
4 bytes in the end.
| ld hl,256*5+10 ;1st coords
call display ;put first string
ld hl,(256*(5+7))+10 ;second coords
display:
ld (_penCol),hl ;load what's in hl
; as coordinates
ld hl,stupid_string ;display same string
; both times
jp _vputs ;display it and
; return from our
; call the 1st time
; and from our
; routien the 2nd
| |