Guest User

Untitled

a guest
Jun 20th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Here: BRSET PortM, $04, Here ; Branch, if PM2 is SET, to HERE
  2.     ;code to run when PM2 = LOW ; If we get here PM2 is LOW
  3.           LDAA $00,X        ;Store first value in table into ACCA
  4.           INX               ;Point to the next value stored in the table
  5.           STAA PortT        ;Output the first value of the table stored in ACCA
  6.           LDAA COUNT        ;Load value of count into ACCA
  7.           INCA              ;Increment value stored in ACCA
  8.           STAA COUNT        ;Store Value from A into COUNT
  9.           JSR DELAY         ;Set the delay
  10.           BSET PortM,$02    ;Enables latch
  11.           NOP               ;No op
  12.           NOP               ;No op
  13.           BCLR PortM,$02    ;Disables latch
  14.           LDAB #$08         ;Set value $08 in ACCB
  15.           CBA               ;Compare value in B to A
  16.     Here1:BRCLR PortM, $04, Here1
  17.           BEQ LOOP2         ;If value in B is the same as A branch to loop2
  18.           JMP Here          ;Jump back to beginning of loop here
  19.          
  20.          
  21.          
  22.      Here: BRSET PortM, $04, Here ; Poll for button press
  23.           LDAB  COUNT       ;Load counter value into ACCB
  24.           LDAA  #$0A        ;Compare COUNT to 9
  25.           CBA               ;Compare B (COUNT) to A (9)
  26.           BEQ   NINE        ;Branch to NINE if Equal
  27.           LDAB  COUNT       ;Load Count into ACCB
  28.           LDX   #Table
  29.           ABX               ;Add B to X to offset pointer. Solution in X
  30.           LDAA  $00, X      ;Store new address' value into ACCA
  31.           STAA  PortT       ;Move solution into PortT's address
  32.           BSET  PortM, $02  ;Enable Right latch
  33.           NOP               ;Waste time
  34.           NOP               ;Waste time
  35.           BCLR  PortM, $02  ;Disable Right latch
  36.           LDAB  COUNT       ;Load COUNT into B
  37.           INCB              ;
  38.           STAB  COUNT       ;Incriment COUNT upon completed iteration
  39.          
  40.           JSR   Delay
  41.           JMP   Here
  42.          
  43.             ;First lets take care of updating the left latch
  44.             ;If the left display is also a 9 we need to reset it and it's counters along with the right display
  45.      NINE:  LDAA    #$09
  46.             LDAB    COUNT2
  47.             CBA
  48.             BEQ     REDO
  49.             LDX     #Table
  50.             LDAB    COUNT2      ;Load value of COUNT2 into ACCB
  51.             INCB                ;Incriment value of COUNT2
  52.             STAB    COUNT2
  53.             ABX                 ;Add B to X to offset pointer. Solution in X
  54.             LDAA    $00,X       ;Store new address' value into ACCA
  55.             STAA    PortT       ;Move solution into PortT's Address
  56.             BSET    PortM, $01  ;Enable Left latch
  57.             NOP                 ;Waste time
  58.             NOP                 ;Waste time
  59.             BCLR    PortM, $01  ;Disable right latch
  60.             LDAA    #$3F        ;Load binary sequence for ZERO into A
  61.             STAA    PortT       ;Store into PortT's address
  62.             BSET    PortM, $02  ;Enable right latch
  63.             NOP
  64.             NOP
  65.             BCLR    PortM, $02 ;Disable right latch
  66.             JMP     RIGHT
  67.            
  68.      REDO:  LDAA    $#3F
  69.             STAA    PortT
  70.             BSET    PORTM, $01
  71.             NOP
  72.             NOP
  73.             BCLR    PORTM, $01
  74.             JMP     MAINLOOP
  75.            
  76.            
  77.             ;Now lets take care of updating the right latch, which we assume is 9 at this point
  78.      RIGHT: LDAA    #$3F        ;Load bit sequence for ZERO into ACCA
  79.             STAA    PortT       ;Store it into Port T's address
  80.             BSET    PortM, $02  ;Enable Right latch
  81.             NOP                 ;Waste time
  82.             NOP                 ;Waste time
  83.             BCLR    PortM, $02  ;Disable Right latch
  84.             JSR     Delay
  85.            
  86.             ;If the left display is also a 9 we need to reset it and it's counters along with the right display
  87.            
  88.            
  89.             ;So now we should have both displays updated but we need to reset COUNT because it's at 9
  90.             LDAA    #$01
  91.             STAA    COUNT       ;Reset the loop counter
  92.             JMP     Here
Add Comment
Please, Sign In to add comment