A83: Re: two preesing questions


[Prev][Next][Index][Thread]

A83: Re: two preesing questions




You guys need to check acz.org for this stuff :)

This routine will return HL as a pointer to the number that was in HL as a
string.  It kills OP1, but could point to anywhere that you have up to 6
bytes of free space you don't mind nuking.  It doesn't print leading zero's.
If you want them like in ZTetris or Galaxian for whatever reason, just
change it to loop five times and skip the check (a bit shorter).

Example to call it:

 ld hl,12345
 call FormatHL
 call _vputs

This can be used with _puts or _vputs, if you want to print a big font
number anywhere, for example.  _dispHL is pretty limited, imho.  And this
works if you need to print numbers in grayscale, too (oops, this is the 83,
hehe).

FormatHL:
 ld c,'0'
 ld de,_OP1         ; correct equate?  needs to be 6 bytes of temp ram
 sub a
 ld (de),a
FormatHLloop:
 call _divHLby10  ; (might be different name on 83)  HL /= 10, A = HL % 10
 dec de
 add a,c
 ld (de),a
 ld a,h
 or l
 jr nz,FormatHLloop:
 ex de,hl
 ret

>
> I really need to know how to display a register in small fonts (like
> _vputs) of variable length, _dispop1a isn't working for this! I also
> need to know what needs to be done to preserve the screen, meaning when
> I display text on the screen then draw to the screen, how do I keep the
> text?!?! Please help me here, I bet these both have simple answers, but
> I need the answers soon. Please answer if you know.
>
> --
> "What, behind the rabbit?"-King Arthur
> The Heat Index   Nathang@firstva.com
>       http://users.firstva.com/Nathang
>  (\\_
> o(_;
>
>
>
>



Follow-Ups: References: