A83: Re: djnz


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

A83: Re: djnz




djnz:		Decrement B, and jump to xx if not zero.

for example here's a program I wrote that uses it...
  xor  a		;acc to 0
  call _clrLCDFull
  ld   a,16		;Character set starts at 16.
outer:
  ld   b,7		;7 lines w/o scrolling possible.
inner:
  push af		;Remember A
  call _putc		;ASCII character of A.
  ld   l,a		;Load a to l.
  ld   h,0d		;0 to h.
  call _disphl	;Display hl!
  call _newline	;New line...
  pop  af		;Recall a.
  inc  a		;Increment it.
  cp   242d		;If its 242 then...
  jr   z,exit		;Exit!
  djnz inner		;Else, repeat.

  push af		;Getkey screws up acc.
  call _getkey	;Wait for a key.
  pop  af		;Recall a, repeat...
  jr   outer		;...from outer loop
exit:
  ret

.end
END

James.

____________________

James Matthews.
E-mail (family):    matthews@tkb.att.ne.jp
E-mail (private):  james_matthews@hotmail.com

Homepage:  http://home.att.ne.jp/gold/tomcat21/index.html
ICQ:  7413754
____________________________________

----------
> From: ZaMaddOne@aol.com
> To: assembly-83@lists.ticalc.org
> Subject: A83: djnz
> Date: Sunday, June 07, 1998 7:04 AM
> 
> 
> what's djnz do?