Lab 1
6502 Assembly Language Lab
In this lab, I explored the 6502 Emulator to manipulate the bitmapped display using assembly language. The goal was to fill the screen with colors, experiment with random pixel values, and optimize execution time.
Task 1: Filling the Screen with Yellow
The initial code filled the screen with a solid yellow color. Here's the snippet:
Execution Time Calculation
- Each pixel requires 11 cycles (6 cycles for
sta
, 2 cycles foriny
, 3 cycles forbne
). - For 256 pixels: cycles per page.
- For 4 pages: cycles.
At a clock speed of 1 MHz:
Execution Time = 11264 cycles/1000000 cycles per sec = 0.011264 Seconds
To reduce execution time, I explored alternatives like replacing loops with unrolled code segments and optimizing memory access patterns, I nearly halved the execution time. The final optimized code executed in approximately
Change to Light Green:
Replacing the color code (#$07
) with #$0D
resulted in a light green display:
Comments
Post a Comment