Posts

Showing posts from January, 2025

Lab 2 - 6502 Math Lab

Image
Introduction This blog entry documents my journey in implementing a diagonal bouncing animation using 6502 Assembly . The objective was to make a 5x5 pixel graphic move diagonally across the screen and bounce off the edges in a smooth and continuous loop . At first glance, this seemed like a simple task, but it turned out to be quite challenging, requiring: • Dynamic coordinate updates for smooth movement • Precise boundary detection • Reversing direction correctly upon hitting an edge • Maintaining perfect diagonal motion over multiple bounces In this post, I will break down the development process, from the initial approach to debugging and optimizing the final solution. Initial Approach 🔹  Initial Approach: Using provided code At the start of this project, we were given a base code that allowed an object to move diagonally across the screen. The original implementation simply incremented both XPOS and YPOS values every frame, causing the object t...

Lab 1 - 6502 Assembly Language

Image
Introduction In this post, I'll share my experience working on a fun and challenging lab about 6502 assembly language. Assembly language is a low-level programming language, and in this lab, I explored how it works by writing code to manipulate a simple pixel display. My goal was to learn how to calculate performance, optimize code, and modify it to create interesting visual effects on the display. Bitmap Code This code:     - Starts at memory address $0200 (the beginning of the display)     - Loops through all 1536 pixels (6 pages of 256 pixels each)     - Sets each pixel to yellow ($07) lda #$00 ; set a pointer in memory location $40 to point to $0200 sta $40 ; ... low byte ($00) goes in address $40 lda #$02 sta $41 ; ... high byte ($02) goes into address $41 lda #$07 ; colour number ldy #$00 ; set index to 0 loop: sta ($40),y ; set pixel colour at the address (pointer)+Y iny ; increment index bne loop ; continue until done the page...