Re: LZ: routine help


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

Re: LZ: routine help



On 19 Sep 96 at 16:11, Ed Plese, Jr. wrote:


> > I want to store a 2 or 3 digit number in "a".  Then I want to extract
> > the digit in the one's place and compare it to a number.  Here's what I
> > hope will work:
> > 
> > ld a,39
> > 
> > ld hl,a
> > ROM_CALL(UNPACK_HL)
> > cp $9
> > jr z, loop
> > ret
> > 
> > If this won't work, can somebody give me a routine that will?
> 
> Here's a routine that will store the digit in the one's place to A to 
> A:
> 
> ld  a,39
> daa
> and %00001111
> 


Hmm.. That won't work. You only use DAA when you want to add two BCD
numbers. DAA checks if the second nibble is more than 9, and if it is
it adds 1 to the first nibble and subtracts 6 from the second.


<pre>
--
 Mattias Lindqvist
 d96mli@efd.lth.se
 www.efd.lth.se/~d96mli
</pre>


References: