[A83] check if positive


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

[A83] check if positive




I made this code(see bottom), I haven't assembled it yet cause I know there 
are some bnig mistakes in it, can someone tell me which. I made this routine 
to check if a variable is bigger(>) or smaller(<) then. You can also see 
that I had different ideas about how to do that, so the code has become 
inefficient as hell.
Maarten



mainloop:
        ld a,10; ld 10 into a
	ld b,57; store 57 in register part b
	sub b,a; substract a from b and return value in b
	xor a;accumulator minus accumulator
	cp b;check if b is positive(???you can't compare with a if b is 
positive???)
	jr p,positive;if positive jump to label positive
negative:
	call _homeup
	ld hl, neg
	call _puts
	jr mainloop
positive:
	call _homeup
	ld hl, pos
	call _puts
	jr mainloop

	ret
pos: ds. "Variable b is positive",0
neg: ds. "Variable b is negative",0
.end
END

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.