Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .nolist
- .list
- .dseg
- RAM_TAB: .byte 256
- .cseg
- jmp RESET ; Reset Handler
- ; Interrupts vector table / change to your procedure only when needed
- jmp EXT_INT0 ; IRQ0 Handler
- jmp EXT_INT1 ; IRQ1 Handler
- jmp EXT_INT2 ; IRQ2 Handler
- jmp EXT_INT3 ; IRQ3 Handler
- jmp EXT_INT4 ; IRQ4 Handler
- jmp EXT_INT5 ; IRQ5 Handler
- jmp EXT_INT6 ; IRQ6 Handler
- jmp EXT_INT7 ; IRQ7 Handler
- jmp TIM2_COMP ; Timer2 Compare Handler
- jmp TIM2_OVF ;Timer2 Overflow Handler
- jmp TIM1_CAPT ;Timer1 Capture Handler
- jmp TIM1_C0MPA ;Timer1 CompareA Handler
- jmp TIM1_C0MPB ;Timer1 CompareB Handler
- jmp TIM1_0VF ;Timer1 Overflow Handler
- jmp TIM0_COMP ;Timer0 Compare Handler
- jmp TIM0_OVF ;Timer0 Overflow Handler
- jmp SPI_STC ;SPI Transfer Complete Handler
- jmp USART0_RXC ;USART0 RX Complete Handler
- jmp USART0_DRE ;USART0,UDR Empty Handler
- jmp USART0_TXC ;USART0 TX Complete Handler
- jmp ADC1 ;ADC Conversion Complete Handler
- jmp EE_RDY ;EEPROM Ready Handler
- jmp ANA_COMP ;Analog Comparator Handler
- jmp TIM1_C0MPC ;Timer1 CompareC Handler
- jmp TIM3_CAPT ;Timer3 Capture Handler
- jmp TIM3_COMPA ;Timer3 CompareA Handler
- jmp TIM3_COMPB ; Timer3 CompareB Handler
- jmp TIM3_COMPC ;Timer3 CompareC Handler
- jmp TIM3_OVF ;Timer3 Overflow Handler
- jmp USART1_RXC ;USART1 RX Complete Handler
- jmp USART1_DRE ;USART1,UDR Empty Handler
- jmp USART1_TXC ;USART1 TX Complete Handler
- jmp TWI ;Two-wire Serial Interface Interrupt Handler
- jmp SPM_RDY ;SPM Ready Handler
- ;//////////////////////////////////////////////////////////////////////////////
- EXT_INT0: ; IRQ0 Handler
- EXT_INT1: ; IRQ1 Handler
- EXT_INT2: ; IRQ2 Handler
- EXT_INT3: ; IRQ3 Handler
- EXT_INT4: ; IRQ4 Handler
- EXT_INT5: ; IRQ5 Handler
- EXT_INT6: ; IRQ6 Handler
- EXT_INT7: ; IRQ7 Handler
- TIM2_COMP: ; Timer2 Compare Handler
- TIM2_OVF: ;Timer2 Overflow Handler
- TIM1_CAPT: ;Timer1 Capture Handler
- TIM1_C0MPA: ;Timer1 CompareA Handler
- TIM1_C0MPB: ;Timer1 CompareB Handler
- TIM1_0VF: ;Timer1 Overflow Handler
- TIM0_COMP: ;Timer0 Compare Handler
- TIM0_OVF: ;Timer0 Overflow Handler
- SPI_STC: ;SPI Transfer Complete Handler
- USART0_RXC: ;USART0 RX Complete Handler
- USART0_DRE: ;USART0,UDR Empty Handler
- USART0_TXC: ;USART0 TX Complete Handler
- ADC1: ;ADC Conversion Complete Handler
- EE_RDY: ;EEPROM Ready Handler
- ANA_COMP: ;Analog Comparator Handler
- TIM1_C0MPC: ;Timer1 CompareC Handler
- TIM3_CAPT: ;Timer3 Capture Handler
- TIM3_COMPA: ;Timer3 CompareA Handler
- TIM3_COMPB: ; Timer3 CompareB Handler
- TIM3_COMPC: ;Timer3 CompareC Handler
- TIM3_OVF: ;Timer3 Overflow Handler
- USART1_RXC: ;USART1 RX Complete Handler
- USART1_DRE: ;USART1,UDR Empty Handler
- USART1_TXC: ;USART1 TX Complete Handler
- TWI: ;Two-wire Serial Interface Interrupt Handler
- SPM_RDY: ;SPM Ready Handler
- reti ; return from all no used
- ;//////////////////////////////////////////////////////////////////////////////
- ; Program start
- RESET:
- cli ; disable all interrupts
- ; Set stack pointer to top of RAM
- ldi R16, HIGH(RAMEND)
- out SPH, R16
- ldi R16, LOW(RAMEND)
- out SPL, R16
- ldi r16, 0x00 ;do r16 ładujemy 00000000 binarnie
- out DDRA, r16
- ldi r16, 0xFF ;do r16 ładujemy 11111111 binarnie
- out DDRB, r16
- ;ładujemy adres tablicy ROM
- ldi r16, byte3(ROM_TAB<<1)
- out RAMPZ, r16
- ldi r30, low(ROM_TAB<<1)
- ldi r31, high(ROM_TAB<<1)
- ldi r28, low(RAM_TAB)
- ldi r29, high(RAM_TAB)
- kopiujZRomDoRam:
- elpm r16, Z+
- cpi r16, 0
- brne kopiujBajt
- elpm r16, Z
- cpi r16, 0
- breq koniec
- sbiw Z, 1
- elpm r16, Z+
- kopiujBajt:
- st Y+, r16 ;kopiujemy wartość i przechodzimy do kolejnej komórki tablicy ramu
- jmp kopiujZRomDoRam ;jeśli większa od 0 , czyli mamy więcej niż 255 elementów
- koniec:
- rjmp koniec
- ROM_TAB: .db 0x74, 0x74, 0x74, 0x73, 0x00, 0x74, 0x74, 0x74, 0x00, 0x00
- .exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement