Re: A86: Looping


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

Re: A86: Looping



In a message dated 97-10-04 04:33:39 EDT, you write:

> 
>  OK, you've heard a lot from me, none of which had much to do with
Assembly.
>  So here's my first question, and thank goodness it should be an easy one.
>  Here's the program I wrote:
>  
>  ;~~~Beginning~~~
>  #include "asm86.h"
>  #include "ti86asm.inc"
>  .org _asm_exec_ram
>  
>  	call _clrLCD
>  	ld hl,$0000
>  	ld (_curRow),hl
>  	ld hl,hello
>  	call _puts
>  	ld b,100
>  
>  	ret
>  
>  hello:
>  	.db "TI-86 ASM is HARD    "
>  	.db "It makes no sense    "
>  	.db "sometimes, but it    "
>  	.db "is more powerful than"
>  	.db "easy-schmeezy BASIC. "
>  	.db "This program is     ",0
>  
>  
>  Loop:
>  	call _clrLCD
>  	call hello
>  	djnz Loop
>  
>  
>  .end
>  ;~~~End~~~
>  
>  (Note: The comments beginning and end were added for the purpose of the
>  message, and are not in the program)
>  
>  Anyway, the display works right. My problem is the delay loop. Either it's

> so
>  fast that I can't recognize it (I had it up to 255 at one point) or
>  something's not right. Hey, I'm used to basic where I did:
>  
>  25->lp
>  Lbl Loop
>  lp-1->lp
>  If lp>0:Goto Loop
>  
>  Is it just that the loop is unrecognizable? If so, how would I make it
>  longer?
>  Also, better yet, how would I get input? For example, do something like
this:
> 
>  
>  Lbl pause
>  Getkey->x
>  If x=0:Goto pause
>  
>  Also, if there is a command like getky, does it return the same numbers as
>  the ones that the BASIC getkey get?
>  
>  Thanks for your help!
>  
>  KUPO
>  

The label hello is not source code.  if you're making a call to it, you're
lucky that it doesn't freeze.  Also, It's often better to put all your data
at the end of your source, so it doesn't get in the way of your code.  With
the ret at the end of the first routine (no name - I usually use the label
Start at the beginning of mine), there's no way it would get to the Loop.
 Also, if you're clearing the screen and homeUp'ing (in which case, call
$4A95 is 2 bytes shorter, but probably takes a little longer...) you
shouldn't notice anything happen...  If you're wanting to do something like

:100/->/B
:Lbl A
:Disp "blah blah blah"
:B-1/->/B
:if B>0:Goto A

then the best thing would be:

	call _clrLCD
	call _homeUp  	
	ld b,100
Loop:
	ld hl,hello			;This may be unnecessary.  I'm not sure if puts changes hl.
 						;If not you could put it b4 the label
	call _puts

	ret
  
hello:
  	.db "TI-86 ASM is HARD    "
  	.db "It makes no sense    "
  	.db "sometimes, but it    "
  	.db "is more powerful than"
  	.db "easy-schmeezy BASIC. "
  	.db "This program is     ",0