NoThisIsPanman

Untitled

Jan 12th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .EQU LED_PORT_1 = 0x033 ; port for output 1
  2. .EQU SWITCH_PORT_1 = 0x99 ; port for input 1
  3. .EQU LED_PORT_2 = 0xA7 ; port for output 2
  4. .EQU SWITCH_PORT_2 = 0x0B8 ; port for input 2
  5. .CSEG
  6. .ORG 0x01 ; program starts here
  7.  
  8. main:   IN  R0, SWITCH_PORT_1
  9.         LSR R0  ; shift right twice to divide by four
  10.         LSR R0
  11.         OUT R0, LED_PORT_1
  12.        
  13.         IN   R1, SWITCH_PORT_2
  14.         EXOR R1, 0xFF ; take two's compliment
  15.         ADD  R1, 0x01
  16.         OUT  R1, LED_PORT_2
  17.  
  18.         BRN main ; endless loop
Add Comment
Please, Sign In to add comment