Re: A86: beginner Quesion


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

Re: A86: beginner Quesion




1) To move something down (or up), you should modify the _curRow
coordinate, not the _curCol.
2) When you call _puts, it will display the string, and then it updates
_curCol to reflect the number of characters printed, so it is ready to
display the next string right after the first instead of right on top of
it.  Thus, every time you loop you need to preserve the column coords.
3) It is more efficient to work with both coordinates at once.  You can
do this with 16-bit loads, like <<LD HL, (_curRow)>>, since the row and
column coordinates are in adjacent memory locations.

down:
  call _clrLCD			;clear screen
  ld hl, (_curRow)		;get both row and col coords
  inc l				;l=row, increment it to move down
  ld (_curRow), hl		;update coords
  push hl				;store it on the stack
  ld hl, string			;point to string
  call _puts			;display string
  pop hl				;recall coords
  ld (_curRow), hl		;put coords back
  jr loop				;reloop

Cassady Roop

cws wrote:
> 
>     I'm very new at assembly programing so forgive me if I ask some
> questions that may seem dumb. Here's my problem, I am trying to make a
> program that allows you to move a string around the screen with the
> arrows, but it isn't working correctly. It doesn't move the way I want
> it to. here's a part of my code:
> 
> down:
>  call _clrLCD
>  ld a,(_curCol)
>  inc a
>  ld (_curCol),a
>  ld hl,string
>  call _puts
>  jr loop


References: