Re: LZ: routine help


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

Re: LZ: routine help



> 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)


his routine really won't work... (for a start ld hl,a ??????)




> 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...)
> 
>
for decimal (which i think he wants..)


  and $0f
  cp 9
  jr nc,Under9
  sub a,10
Under9
 .... a now contains lower decimal digit of number


Rob Taylor MAIL - mailto:rtaylor@ticalc.org 
           WEB  - http://www.u-net.com/~rtaylor/    


References: