LD D, 10000000B LD E, 00000001B LD B, 07H ; 8 LED's = 7 rotation cycles ; Display initial state LD A, D OUT (02), A LD A, E OUT (03), A LD A, 01010101B OUT (00), A REPEAT: ; ; 8-bit rotation in D and E ; SCF RL E ; Rotate E left, bit 7 goes to Carry Flag and CF to bit 0 ;SET 0, E SCF RR D ; Rotate D right, Carry Flag with E(b7) goes to bit 7, D(b0) goes to CF ;SET 7, D CPL OUT (00), A PUSH AF LD A, D OUT (02), A LD A, E OUT (03), A POP AF DJNZ REPEAT