Improve Lab 2
In this post, I will enhance the Lab 2. The previous work can be found here.
This post will cover two main parts:
1. Improving the calculation performance.
2. Sharing experiences and reflections
Improving the calculation performance
Detailed information about the calculation performance can be found in this post.
Following the professor's feedback, it was identified that the previous fast version had a issue that it destroys all memory. Consequently, I have updated the code.
To reduce the execution time, the iterated part(loop) should be used as minimum as possible.
Each sta ($40), y command that utilizes indirect indexed addressing is repeated a total of six times. Instead of using indirect indexed addressing, replacing it with absolute addressing might significantly reduce the execution time.
The following is the code with the applied changes.
lda #$07 ldy #$00 loop: sta $0200,y iny sta $0300,y iny sta $0400,y iny sta $0500,y bne loop
Considering that the original version took 11.299 ms, it can be observed that this method has been effective in reducing the execution time.
Sharing experiences and reflections
In parallel, color manipulation experiments were conducted, including changing the primary color from yellow to light blue and experimenting with different color sequences on each display page. Introducing color variations and employing bitwise operations like logical shift right (lsr) added visual differences, providing insights into color representation nuances in 6502 assembly language. While working with assembly language presented challenges, such as optimizing code without compromising functionality, these hurdles became opportunities for enhancing problem-solving skills and code optimization strategies.
Comments
Post a Comment