Ein Zähler am Oszi - 2024-12-14


.include "m8def.inc"

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16

ldi r16, 0xff
out DDRD, r16
out DDRB, r16


ldi r16, 0x01
loop0:
ldi r18, 0x0a
loop2:
ldi r19, 0x0e
loop3:
ldi r20, 0xff
loop4:
push r16
mov r17, r16
andi r17, 0x01; 0
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 1
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 2
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 3
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 4
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 5
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 6
out PORTD, r17
lsr r16, 1
mov r17, r16
andi r17, 0x01; 7
out PORTD, r17
pop r16
dec r20
brne loop4
dec r19
brne loop3
dec r18
brne loop2
inc r16
rjmp loop0