m820241127003EXTINT.asm

; (C) David Vajda
; Externes Interrupt Input Switch on/off
; 2024-11-27

.include "m8def.inc"

.org 0x000
rjmp RESET
.org INT0addr
rjmp ExtInt0
.org INT1addr
rjmp ExtInt1

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

ldi r16, 0xff
out DDRB, r16

ldi r16, 0x00
out DDRD, r16

ldi r16, (1 << INT1) | (1 << INT0)
out GICR, r16
ldi r16, (1 << ISC11) | (1 << ISC10) | (1 << ISC01) |  (1 << ISC00)
out MCUCR, r16

sei

end: rjmp end

ExtInt0:
ldi r16, 0x00
out PORTB, r16
reti

ExtInt1:
ldi r16, 0xff
out PORTB, r16
reti