Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here: BRSET PortM, $04, Here ; Branch, if PM2 is SET, to HERE
- ;code to run when PM2 = LOW ; If we get here PM2 is LOW
- LDAA $00,X ;Store first value in table into ACCA
- INX ;Point to the next value stored in the table
- STAA PortT ;Output the first value of the table stored in ACCA
- LDAA COUNT ;Load value of count into ACCA
- INCA ;Increment value stored in ACCA
- STAA COUNT ;Store Value from A into COUNT
- JSR DELAY ;Set the delay
- BSET PortM,$02 ;Enables latch
- NOP ;No op
- NOP ;No op
- BCLR PortM,$02 ;Disables latch
- LDAB #$08 ;Set value $08 in ACCB
- CBA ;Compare value in B to A
- Here1:BRCLR PortM, $04, Here1
- BEQ LOOP2 ;If value in B is the same as A branch to loop2
- JMP Here ;Jump back to beginning of loop here
- Here: BRSET PortM, $04, Here ; Poll for button press
- LDAB COUNT ;Load counter value into ACCB
- LDAA #$0A ;Compare COUNT to 9
- CBA ;Compare B (COUNT) to A (9)
- BEQ NINE ;Branch to NINE if Equal
- LDAB COUNT ;Load Count into ACCB
- LDX #Table
- ABX ;Add B to X to offset pointer. Solution in X
- LDAA $00, X ;Store new address' value into ACCA
- STAA PortT ;Move solution into PortT's address
- BSET PortM, $02 ;Enable Right latch
- NOP ;Waste time
- NOP ;Waste time
- BCLR PortM, $02 ;Disable Right latch
- LDAB COUNT ;Load COUNT into B
- INCB ;
- STAB COUNT ;Incriment COUNT upon completed iteration
- JSR Delay
- JMP Here
- ;First lets take care of updating the left latch
- ;If the left display is also a 9 we need to reset it and it's counters along with the right display
- NINE: LDAA #$09
- LDAB COUNT2
- CBA
- BEQ REDO
- LDX #Table
- LDAB COUNT2 ;Load value of COUNT2 into ACCB
- INCB ;Incriment value of COUNT2
- STAB COUNT2
- ABX ;Add B to X to offset pointer. Solution in X
- LDAA $00,X ;Store new address' value into ACCA
- STAA PortT ;Move solution into PortT's Address
- BSET PortM, $01 ;Enable Left latch
- NOP ;Waste time
- NOP ;Waste time
- BCLR PortM, $01 ;Disable right latch
- LDAA #$3F ;Load binary sequence for ZERO into A
- STAA PortT ;Store into PortT's address
- BSET PortM, $02 ;Enable right latch
- NOP
- NOP
- BCLR PortM, $02 ;Disable right latch
- JMP RIGHT
- REDO: LDAA $#3F
- STAA PortT
- BSET PORTM, $01
- NOP
- NOP
- BCLR PORTM, $01
- JMP MAINLOOP
- ;Now lets take care of updating the right latch, which we assume is 9 at this point
- RIGHT: LDAA #$3F ;Load bit sequence for ZERO into ACCA
- STAA PortT ;Store it into Port T's address
- BSET PortM, $02 ;Enable Right latch
- NOP ;Waste time
- NOP ;Waste time
- BCLR PortM, $02 ;Disable Right latch
- JSR Delay
- ;If the left display is also a 9 we need to reset it and it's counters along with the right display
- ;So now we should have both displays updated but we need to reset COUNT because it's at 9
- LDAA #$01
- STAA COUNT ;Reset the loop counter
- JMP Here
Add Comment
Please, Sign In to add comment