daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Start:
  2.    LDI R16, 0xFF;11111111
  3.    OUT DDRA, R16; PORTA НА ВЫВОД
  4.    OUT DDRB, R16
  5.    ;LDI R16, 0xF; 00001111: PC0-PC3 на ввод
  6.    OUT DDRC,R16
  7.    ;LDI R16, 0x00; PORTD на ввод
  8.    OUT DDRD, R16
  9.    
  10.    KEK:
  11.    CALL delay
  12.    IN R21, PIND
  13.    CPI R21,0
  14.    BRNE moving
  15.    CPI R20, 0;x
  16.    BREQ KEK
  17.    
  18.    moving:
  19.    MOV R20,R21
  20.    CPI R20,0
  21.    BREQ KEK
  22.    
  23.    OUT PORTA, R20
  24.    
  25.    MOV R29, R20
  26.    LSR R29
  27.    LSR R29
  28.    LSR R29
  29.    LSR R29
  30.    LSR R29
  31.    LSR R29
  32.    LSR R29
  33.    
  34.    ;ОБРАТНЫЙ КОД
  35.    MOV R30,R20
  36.    LDI R16,0XFF
  37.    EOR R30, R16
  38.    OUT PORTB, R30
  39.    
  40.    KEK1:
  41.    CALL delay
  42.    IN R27, PINC
  43.    CPI R27,0
  44.    BRNE moving1
  45.    CPI R26, 0
  46.    BREQ KEK1
  47.    
  48.    moving1:
  49.    MOV R26,R27
  50.    CPI R26,0
  51.    BREQ KEK1
  52.    
  53.    CPI R26, 1;PC0
  54.    BREQ INCR
  55.    CPI R26, 2;PC1
  56.    BREQ DOP2
  57.    CPI R26, 4;PC2
  58.    BREQ DOP1
  59.    CPI R26, 8;PC3
  60.    BREQ LEFT
  61.  
  62.    INCR:
  63.    CPI R29,0
  64.    BRNE DECR
  65.    INC R20
  66.    RJMP PRINT
  67.    
  68.    DECR:
  69.    DEC R20
  70.    RJMP PRINT
  71.  
  72.    DOP2:
  73.    LDI R16,0XFF
  74.    EOR R20, R16
  75.    INC R20
  76.    RJMP PRINT
  77.    
  78.    DOP1:
  79.    LDI R16,0XFF
  80.    EOR R20, R16
  81.    RJMP PRINT
  82.    
  83.    LEFT:
  84.    LSL R20
  85.    RJMP PRINT
  86.    
  87.    PRINT:
  88.    OUT PORTA, R20
  89.    MOV R30,R20
  90.    LDI R16,0XFF
  91.    EOR R30, R16
  92.    OUT PORTB, R30
  93.    rjmp PRINT
  94.    
  95.    delay:
  96.    LDI R25, 4; z
  97.    LDI R24, 14; y
  98.    LDI R23, 156; x
  99.    delay_sub:
  100.    DEC R23
  101.    BRNE delay_sub
  102.    SBIW R24, 1
  103.    BRNE delay_sub
  104.    ret
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top