if the key press is 2 then it will display
XX
XX
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.
Code:
; Initialise constants lowerBound .equ '1 upperBound .equ '9 count .equ '0 spaces .equ 54 ; ; Get keypressed from keyboard ldx #$FFFF ;keyboard wai ; ;Load the key pressed into AccA ldaa 0,x ; staa keyPressed clrb tab ; 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 inx inc count1 decb cmpb #count bne loop1 ; loop2 ldab #spaces inx inc count1 cmpb count1 bne loop2 ; ; count1 .byte 0 ; to compare spaces keyPressed .byte 0 lineCount .byte 0 ; finish .end
