Posts

Showing posts from February, 2025

Lab 2 - 6502 Math Lab

Introduction In this blog post, I will share my experience working on the second lab of the SPO (Systems Programming and Operating Systems) course. The goal of this lab was to create a subroutine in 6502 Assembly Language that draws an image on a bitmapped screen and then animate it by making it bounce around the screen. The lab involved writing code to move a graphic diagonally across the screen and then modifying it to make the graphic bounce off the edges of the screen. The Code   The initial code provided draws a 5x5 pixel image (either an "O" or an "X") on the screen and moves it diagonally from the top-left corner to the bottom-right corner. The image is cleared and redrawn in a new position to create the illusion of movement. The code uses a delay loop to slow down the animation so that it is visible to the human eye. Here is the initial code: ; ; draw-image-subroutine.6502 ; ; This is a routine that can place an arbitrary ; rectangular image on to the scree...

Lab-1 Challenges

Image
Introduction: In this lab, we explored the 6502 assembly language using an online emulator. The primary goal was to understand how to manipulate the bitmapped display, calculate the performance of our code, and optimize it for faster execution. We started by filling the entire screen with a solid color (yellow) and then modified the code to experiment with different colors, patterns, and performance optimizations. Finally, we tackled some optional challenges to further deepen our understanding of the 6502 assembly language and its capabilities. Challenges: Challenge 1: Set all of the display pixels to the same color, except for the middle four pixels, which will be drawn in another color. To achieve this, we need to modify the original code to fill the entire screen with one color and then change the color of the middle four pixels. The middle four pixels are located at the center of the screen, which can be calculated based on the screen resolution.     lda #$00    ...

Lab-1 Experiment: Exploring Visual Effects with 6502 Assembly

Image
  Introduction In this section of Lab 1, we will experiment with the original bitmap code to observe how small changes in the assembly instructions can create different visual effects on the bitmapped display. We will learn more about how the 6502 processor manages data manipulation and how these operations translate into visual output by changing the code and examining the outcomes. We can investigate the connection between memory addressing, assembly instructions, and the final graphical display with the aid of these experiments. Experiment 1: Adding "tya" Instruction Objective:  Add the "tya" instruction after the loop: label and before the "sta ($40),y" instruction. Observe the visual effect and explain why it occurs. Observation: The screen displays a gradient of colors instead of a solid yellow. The gradient repeats every 16 pixels horizontally. Explanation: The TYA instruction transfers the value of the Y register (which ranges from 0 to 255) into t...