begin: set r1, 128 // address of the LED set r2, 0 set r3, 1 set r4, 255 // outer counter limit loop: store r2, [r1] add r2, r2, r3 set r13, loop delay: set r10, 0 set r11, 0 delay_loop: add r10, r10, r3 bneq delay_loop // flag will be 1 when it wraps add r11, r11, r3 cmp r11, r4 bneq delay_loop set pc, loop