Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   6800 assembly code (http://www.go4expert.com/forums/6800-assembly-code-t17622/)

a1dogtraining 20May2009 14:42

6800 assembly code
Hi everyone. I have a little problem. I have some versions of the same code I would like you to have a look at. The task is to display the amount of X's across the screen and the same amount of lines, that corresponding to the the key you press. eg
if the key press is 2 then it will display
I have got an idea of how to do it. But when I try and store the key presss in the variable at the start of the code after I get the keypress it stops my programming working probably. I have declared a variable called keyPress .byte 0
Here is one version of the code.

; Initialise constants
lowerBound .equ '1
upperBound .equ '9
count .equ '0
spaces .equ 54
; Get keypressed from keyboard
 ldx #$FFFF  ;keyboard
;Load the key pressed into AccA
 ldaa 0,x
; staa keyPressed
 cmpa #lowerBound
 blt finish ; branch to finish if key press is less than lowerBound
 cmpa #upperBound
 bgt finish
 ldx #$FB00
 ldaa #'X
loop1 staa 0,x
 inc count1
 cmpb #count
 bne loop1
loop2 ldab #spaces
 inc count1
 cmpb count1
 bne loop2
count1 .byte 0 ; to compare spaces
keyPressed .byte 0
lineCount .byte 0
finish .end

All times are GMT +5.5. The time now is 12:40.