1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

6800 assembly code

Discussion in 'Assembly Language Programming (ALP) Forum' started by a1dogtraining, May 20, 2009.

  1. a1dogtraining

    a1dogtraining New Member

    Joined:
    May 20, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Training Dogs, Student
    Location:
    Banora Point NSW
    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
    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
     
    Last edited by a moderator: May 20, 2009

Share This Page