Re: A83: Re: Re: Displaying hex.


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

Re: A83: Re: Re: Displaying hex.





Hey, this looks quite long and complex.
Why don't you rather do :

; PutBin - Prints the binary digits held by reg. C
PutBin:
 ld hl, buffer        ; buffer must be 9 bytes long (8 digits + #0)
 ld b, 8              ; 8 digits in a byte
PB_loop:
 xor a
 rl c                 ; Now CF = last MSB (most significant bit)
 adc a, '0'           ; put a '0' if CF=0, a '1' if CF=1
 ld (hl), a
 inc hl               ; next digit
 djnz PB_loop         ; continue if should do
 ld (hl), 0           ; ASCIIZ string : zero-terminated
 jp _puts             ; CALL _puts / RET

; End of rutine

This works cool for me. You can also use _vputs if you want. I hope this 
could help you

- Florent
jldhordain@nordnet.fr
fdhordain@hotmail.com


>From: "Trey Jazz" <joemama@minot.com>
>To: <assembly-83@lists.ticalc.org>
>Subject: A83: Re: Re: Displaying hex.
>Date: Tue, 5 May 1998 03:09:32 -0500
>Reply-To: assembly-83@lists.ticalc.org
>
>
>i assume in asm since its on this list. for a binary number you will 
have to
>do some bit testing and output the correct value to the screen as you 
go
>
>ex:
> ld a,(number)
> push af
> bit 0,a
> call z,one
> call nz,zero
> pop af
> bit 1,a
> call z,one
> call nz,zero
>.
>.
>.
>zero:
> ld a,'0'
> call _putc (not sure what its called for the 83 inc files but u know 
the
>one that puts the character in a)
>one
> ret
>one:
> ld a,'1'
> call _putc
> ret
>
>if you want to store the number in a string then do the same but use hl 
to
>load the numbers into the string+offset
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com