Re: LZ: routine help


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

Re: LZ: routine help



Max Mansour wrote:
> 
> Steve Peterson wrote:
> >
> > Can anybody tell me if this will work?
> >
> > 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?
> 
> Try this (I don't know if your routine works, but anyway, this one
> should)
> 
> ld  a,$27               ;load any 8-bit hex number into a
> and $0F
>                         ;a now holds $07
> 
> (this is fine if you are working with hex numbers...)
> 


Actually what I'm doing is generating a random number and I need to be
able 
to discard it if it ends in a zero or a nine.


References: