LZ: RE: LZ-Adv: A bit of a quandry I'm in...


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

LZ: RE: LZ-Adv: A bit of a quandry I'm in...



On Monday, July 07, 1997 10:22 PM, Ryan Myers[SMTP:rmyers@inetarena.com] wrote:
> Anyone out there have a good idea on how to implement
> a less-than/greater-than test in assembly?  I've
> racked my brains for nearly two days now without
> any ideas.
> 
> BTW, the application requires that one of the two-byte
> registers (DE,BC,HL, or maybe a shadow register?) be
> preserved.  Thanx.


To compare stuff, simply do a CP, and if the zero flag is set, A and the argument were equal, else if the carry is set the argument was greater, and finally, if neither is set, then A must be greater... got it?
	(BTW, CP does nothing to the registers, only the F (flag) register is changed -- and you can always PUSH/POP a register if you don't want it destroyed.)
	Sam
-- 
Sam Davies <sdavies@mail.trilogy.net>