RE: A82: Thanx.


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

RE: A82: Thanx.



On Tuesday, July 08, 1997 9:38 AM, Dean May[SMTP:dmay@freenet.columbus.oh.us] wrote:
> Thanks, Ryan and Sam. Its amazing how well your ASM works when you write
> it correctly! =)
> So on that rooter program, the getkey routine works =)
> But now I need to know: if I want to have the user input a number between
> 0 and ? , could I use a getkey, then multiply it by 10, add the next
> pushed number, multiply total by 10...etc.. or is there an easier way?

Yes, that's the best way to do it...
	ld HL, 0
Loop:
	add	HL, HL	;HL = HL * 2
	ld	D, H		;DE = HL
	ld	E, L
	add	HL, HL	;HL = HL * 2
	add	HL, HL	;HL = HL * 2
	add	HL, DE	;HL = HL + DE
	;The result is the original HL*10
	;;;store the value of the entered digit in DE;;;
	add	HL, DE
	djnz	Loop

This is kind of rough, but it's basically what should be done...
	Sam
-- 
Sam Davies <sdavies@mail.trilogy.net>