PORTA equ 0 PORTB equ 1 DDRA equ 2 DDRB equ 3 org 0800h movb #$ff,DDRA movb #$00,DDRB clr PORTA wait_1: ldab PORTB andb #3 beq wait_1 decb beq more less: dec PORTA bra wait_2 more: inc PORTA wait_2: ldab PORTB andb #3 bne wait_2 bra wait_1