gavrasm Gerd's AVR assembler version 1.0 (C)2004 by DG4FAC
----------------------------------------------------------
Source file: newled.asm
Hex file:    newled.hex
Eeprom file: newled.eep
Compiled:    09.11.2004, 20:03:48
Pass:        2
     1: ;***************************************************************************
     2: ; Application:  Led flasher
     3: ; Author:       Dan Williams
     4: ; Date:         
     5: ; Assembler:    AVR Studio 4.07.
     6: ; Target:       Atmel ATtiny13.
     7: ;***************************************************************************
     8: 
     9: .device ATtiny13 
    10: 
    11: ; ------------- Memory locations ---------------
    12: ;
    13: ;  .def bar =r01 ; one byte ram location
    14: ;
    15: ; ----------------------------------------------
    16: 
    17: .def A          = r16    
    18: .def B          = r17            ; and logic instructions
    19: .def C          = r18
    20: .def D          = r19
    21: 
    22: ; ------------- Equates ------------------
    23: 
    24: .equ INPUT      = 0
    25: .equ OUTPUT     = 1
    26: 
    27: ;========================| SYSTEM VECTORS |===========================
    28: ;
    29: .cseg                                   ;CODE segment
    30: .org 0x0000
    31: 000000   C009  rjmp    init   ; RESET 
    32: 000001   9518  reti           ; EXT_INT0  
    33: 000002   9518  reti           ; PCINT0   (pin change)
    34: 000003   9518  reti           ; TIM0_OVF  
    35: 000004   9518  reti           ; EE_RDY  
    36: 000005   9518  reti           ; ANA_COMP  
    37: 000006   9518  reti           ; TIM0_COMPA  
    38: 000007   9518  reti           ; TIM0_COMPB  
    39: 000008   9518  reti           ; WATCHDOG  
    40: 000009   9518  reti           ; ADC  
    41: 
    42: ;=============================| MAIN |================================
    43: ;
    44: 
    45: .org 0x000A
    46: init:   
    47:         ; Set up stack
    48: 00000A   E90F  ldi     A,   low(RAMEND)       ; load low address of ram to R16...
    49: 00000B   BF0D  out        SPL, A                 ; Set Stack Pointer to top of RAM
    50: 
    51:         ; Disable interrupts
    52: 00000C   94F8  cli        
    53: 
    54:         ; Set up io ports
    55: 00000D   E004  ldi   A,    (0<<PORTB5)|(0<<PORTB4)|(0<<PORTB3)|(1<<PORTB2)|(0<<PORTB1)|(0<<PORTB0)
    56: 00000E   BB08  out   PORTB, A
    57: 00000F   E004  ldi   A,    (INPUT<<DDB5)|(INPUT<<DDB4)|(INPUT<<DDB3)|(OUTPUT<<DDB2)|(INPUT<<DDB1)|(INPUT<<DDB0)
    58: 000010   BB07  out   DDRB,  A
    59: 
    60: MainLoup:
    61:        ; ldi     A, $00                  ; set tempport bit 0 low
    62:        ; out     PORTB, A                ; write to port
    63: 
    64: 000011   9AC2  sbi     PORTB, 2
    65: 
    66: 000012   D003  rcall   wait                        ; do the wait thing
    67: 
    68:        ; ldi     A, $04                ; set tempport bit to high
    69:        ; out     PORTB, A                ; write to port
    70:        
    71: 000013   98C2  cbi      PORTB, 2
    72: 
    73: 000014   D001  rcall   wait                        ; do the wait thing
    74: 
    75: 000015   CFFB  rjmp    MainLoup                ; go back and do it all over again
    76: 
    77: 
    78: ;========================| SUBROUTINES |==============================
    79: ;
    80: 
    81: wait:    
    82: 000016   E013  ldi     B, 3              ; load count1 with decimal 200
    83: 
    84: d1:
    85: 000017   EC28  ldi     C, 200              ; load count2 with decimal 200
    86: 
    87: d2:
    88: 000018   EC38  ldi     D, 200
    89: 
    90: d3:
    91: 000019   953A  dec     D
    92: 00001A   F7F1  brne    d3
    93: 00001B   952A  dec     C                  ; decrement count2
    94: 00001C   F7D9  brne    d2                 ; loop if not zero              
    95: 00001D   951A  dec     B                  ; decrement count1 if count2 is zero
    96: 00001E   F7C1  brne    d1                 ; do inside loop again if count2 nz
    97: 00001F   9508  ret
    98:     
    99: 
   100: 

Program             :       32 words.
Constants           :        0 words.
Total program memory:       32 words.
Eeprom space        :        0 bytes.
Data segment        :        0 bytes.
Compilation completed, no errors.
Compilation endet 09.11.2004, 20:03:48
