Quantcast
Channel: Cemetech
Viewing all articles
Browse latest Browse all 75829

z80 Assembly :: More code confusion

$
0
0
Author: shundra9
Subject: More code confusion
Posted: 04 Nov 2012 01:41:37 am (GMT -5)

Once again, a seemingly simple programming task has me baffled... The program below should make the message "Hello!" display diagonally down and right on the screen, starting from the top-left corner. When I run the program on an emulator, it does successfully output the text, however the text doesn't start in the top-left, and some extra pixels get activated in a pattern that means nothing to me. What's more, the emulator seems to go into an endless loop, and I can't understand why my loop structures never work. Suggestions please!!


Code:

;Display the text "Hello!" diagonally across the screen

#include    "ti83plus.inc"
.org   $9D93
.db    $BB, $6D
   
   bcall(_clrlcdfull)   ;Clear screen
   
   ld hl, curRow      ;initialize curRow and curCol to 0
   ld (hl), $0000

   ld b, msg      ;b will point to the next character of the string

loop:
   ld a, (b)
   bcall(_putC)   ;Display the character in msg at location a

   inc b      ;increment the character counter
   inc (hl)   ;increment the row counter

   cp 0      ;if the null-character at the end of msg is reached, end program
   jr nz, loop

   ret

msg:
   .db "Hello!",0

.end


Viewing all articles
Browse latest Browse all 75829

Latest Images

Trending Articles



Latest Images