Re: A86: first program


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

Re: A86: first program



The reason it moves up when you display in the lower-right corner is that it
wraps around to the next line and actually scrolls the screen up!  Try
displaying some other stuff and then doing that and you'll see what I mean.  
You can temporarily disable scrolling by doing
 res appAutoScroll,(iy+appFlags)
at the beginning of the program.  But be sure to do
 set appAutoScroll,(iy+appFlags)
before the ret statement or else your calculator will crash at the home
screen when it needs to scroll!

As for the character not changing, I'm not entirely sure, but I would suggest
changing all your _clrLCD's to _clrScrn's, since _clrScrn clears out the text
shadow (which keeps track of all the characters that are currently displayed
on the screen), so it may be interfering...


In a message dated 2/18/2001 8:17:00 PM Eastern Standard Time,
cws@madison.tds.net writes:


I recently wrote this program that moves a character around the
screen.  When you press prgm, the character changes.  I am having a few
problems with it though. 1. When I move to the 6th row in the last
collumn, it moves up one. After the next move it goes to where it should
be.  Any ideas why?  2. the character change part works fine on vti, but
not on my calculator.  When I press prgm, the character changes but the
next time I move, it changes back to what it was originaly 'Y'.  These
are probably just be dumb beginner mistakes, but if someone could help
that would be great.

#include "ti86asm.inc"

.org _asm_exec_ram


   call _clrLCD        
   call _homeup      
   ld hl,(_curRow)     
   jr output          
Loop:
   call _getkey        
   cp kRight           
   jr z,move_right     
   cp kDown          
   jr z,move_down     
   cp kLeft           
   jr z,move_left  
   cp kUp             
   jr z,move_up      
   cp kPrgm          
   jr z,change_char    
   cp kExit           
   jr nz,Loop        
   ret                 
   
move_right:       
   ld hl,(_curRow)
   ld a,h
   cp 20
   jr z,Loop
   inc h
   jr output

move_down:            
   ld hl,(_curRow)
   ld a,l
   cp 7
   jr z,Loop
   inc l
   jr output
   
move_left:          
   ld hl,(_curRow)
   ld a,h
   cp 0
   jr z,Loop
   dec h
   jr output
   
move_up:             
   ld hl,(_curRow)
   ld a,l
   cp 0
   jr z,Loop
   dec l
   jr output
   
output:           
   ld (_curRow),hl
   push hl
   call _clrLCD
   ld hl,string
   call _puts
   pop hl
   ld (_curRow),hl
   jr Loop

change_char:
   ld a,(string)      
   inc a              
   ld (string),a      
   ld hl,(_curRow)     
   jr output          
   
   
string:            
   .db "Y",0           





----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org