[A83] Re: number _vputs and black-out a piece of screen
[Prev][Next][Index][Thread]
[A83] Re: number _vputs and black-out a piece of screen
> > How can I output a number stored in a with _vputs?
> > It has to be a small font.
> >
> > ld a,(8008h) ;the place in RAM for the contrast
>
> Since your dealing with the contrast here, it might be better to just
> display a number from 0 to 9, so just divide the byte in 8008h by 4 and add
> 30h to it, then put it in a string and display it.
IMHO, It would be nice to display the quarters of a level to.
Updated code:
>
ld b,00h
ld a,(8008h)
bit 1,b ; copy the first 2 bits of a into b
jr z,next_bit
set 1,b
next_bit:
bit 2,a
jr z,bits_done:
set 2,b
bits_done:
rra ; divide by 2
rra ; once again
and 0Fh ; not sure if this is necessary, but I think it is.
add 30h ; 30h is the character '0'
ld (contrast),a
ld a,b
ld (contrast_sublev),a
ld hl,contrastTxt
bcall(_vputs)
ret
contrastTxt:
.db "Contrast is "
contrast:
.db 0," "
contrast_sublev:
.db 0,"/4",0
this should display something like:
Contrast is 5 2/4
NOTE:
This could undoubdetly be don more efficient with a bitmask, but I've
already written this code :-)
--Peter-Martijn Kuipers
> Tijl Coosemans
>
>
Follow-Ups:
References: