A83: can you check this code:


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

A83: can you check this code:




I learned alot since that last one I made, if you see anything wrong,
like the codes for the keys, tell me.

-Phelan 'Amen' Wolf

SOURCE:
 .org 9327h
 ld c,0
start_it:
 call _clrLCDFULL ;clear the screen
 call _runIndicOff ;turn off the run indicator
 call _homeUp ;set pencol and penrow to 0,0
 ld a,0  ;set accumalator to zero
 ld b,0  ;set registor b to zero
get_key:
 call _getKey ;get the next key
 ld b,01h  ;set b to the up arrow
 push a  ;put a on the stack
 sub a,b  ;check if a is the up arrow
 jp z,going_up ;if a=b goto going_up
 ld b,04h  ;set b to the down arrow
 sub a,b  ;check if a is the down arrow
 jp z,going_down ;if a=b goto going_down
 call _clrLCDFULL ;clear the screen
 jp get_key ;if a not up or down goto get_key
draw_char:
 ld a,c  ;set a to c
 call _putc  ;print char a
 call _getKey ;pause
 jp start_it  ;goto the beginning
going_up:
 ld d,FFh  ;set upper bound
 push c  ;put c on the stack
 sub c,d  ;check if c=255
 jp z,up_not ;if c=d goto up_not
 pop c  ;get c off the stack
 inc c  ;goto next char
 jp draw_char ;draw the character
up_not:
 ld c,0  ;set c to the first char
 jp draw_char ;draw the character
going_down:
 ld d,0  ;set lower bound
 push c  ;put c on the stack
 sub c,d  ;check if c=0
 jp z,down_not ;if c=d goto down_not
 pop c  ;get c off the stack
 dec c  ;goto prev char
 jp draw_char ;draw the character
down_not:
 ld c,255  ;set c to the last char
 jp draw_char ;draw the character
.end
END


Follow-Ups: