[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:
>
>
> 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 :-)

Undoubtedly :-)

So, updated again:

    ld    b,00h
    ld    a,(8008h)
    rra          ; divide by 2
    rl    b
    rra          ; once again
    rl    b
    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
    xor   3
    ld    (contrast_sublev),a
    ld    hl,contrastTxt
    bcall(_vputs)
    ret
contrastTxt:
    .db   "Contrast is "
contrast:
    .db   0," "
contrast_sublev:
    .db   0,"/4",0

Tijl Coosemans



References: