Re: LZ: routine help
[Prev][Next][Index][Thread]
On 20 Sep 96 at 16:01, 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.
>
> NO, DAA is used AFTER a subtraction or addition to return A as two
> BCD digits instead of a hex number. This routine works. (I haven't
> tested it though)
I _DO_ know what I'm talking about! It won't work. Try it! You haven't been
adding or subtracting BCD-numbers here, have you??
<pre>
--
Mattias Lindqvist
d96mli@efd.lth.se
www.efd.lth.se/~d96mli
</pre>
References: