Search code examples
assemblyintelmicroprocessors8085

I need some help improving this 8085 code


Sorry for the vague title, I'm trying to move in the 8085 sim the right led from left to right and viceversa. I did it but I realised that the led is moving with "intermitences", is not an instant movement. I want to remove those intermitences.

This is my code:

   MVI A,80
   OUT 00

   DCH: RRC
   OUT 00
   CPI 01
   JZ IZQ
   JMP DCH

   IZQ: RLC
   OUT 00
   CPI 80
   JZ DCH
   JMP IZQ

where DCH is right and IZQ is left


Solution

  • I don't know your simulator but I assume that the simulator simulates an 8-bit latch at I/O port 0 (out 0) with 8 LEDs connected.

    You want to implement a bi-directional chase like in this animation in Wikipedia.

    If you used a real setup with a real 8085, a real latch and real LEDs your code should work perfectly.

    However you would have to use a very, very low CPU frequency in this case. Even when using a CPU frequency of 1 kHz (1/2000 of the nominal frequency) the program would run so fast that you would need a high-speed camera to observe the LEDs.