Posts

Showing posts from January, 2025

Lab 03 - 6502 Program Lab (Revised)

Worm Game In this lab, I coded a game that would work within the 6520 Emulator while meeting specific criteria, including output to both the character and graphic screens, accepting keyboard input, and utilizing mathematical operations like addition and subtraction.  While building a classic worm game in Assembly, I ran into a few tricky errors that took some time to figure out. I want to share those mistakes and how I fixed them so you can avoid the same headaches.  On one particularly long night of coding, I decided to take on the challenge of re-building a classic Worm game! This game would be simple yet engaging, utilizing both the character screen and graphic screen for a fun experience. I found that  Specification The game starts with a worm moving across the screen, which is controlled using the keyboard. The worm body grows every time it "eats" a fruit, which is randomly placed on the screen. The user can control the worm's movement by pressing the W , A , S , or ...

Lab 2 - 6502 Math Lab

Image
The Mob Programming session emphasizes collaborative learning. Participants work in teams, designating a Driver (who types) and a Presenter (who explains the group's solution). The goal is to collectively understand and implement the 6502 Math Lab tasks. Steps for Collaboration: Join a Zoom breakout group and assign roles. Decide on a code-sharing method (Git, Pastebin, email, or Zoom chat). Use the 6502 Emulator ( http://6502.cdot.systems ) to run and test code. Follow structured coding suggestions where non-Drivers provide coding instructions. Switch roles periodically to ensure collective learning. .  The Setup  The code below moves a 5×5 graphic diagonally across the screen like the series of images above.  The speed can be adjusted with the speed slider. ; ; draw-image-subroutine.6502 ; ; This is a routine that can place an arbitrary ; rectangular image on to the screen at given ; coordinates. ; ; Chris Tyler 2024-09-17 ; Licensed under GPLv2+ ; ; ; The subroutine...

Lab 01 - 6502 Assembly Language Lab

Image
Bitmap Code We will discover the basics of 6502 Assembly Language by running and analyzing a program given on a web based simulator here .  The comments in each line of code explains what they do. 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 (256 pixels) inc $41 ; increment the page ldx $41 ; get the current page number cpx #$06 ; compare with 6 bne loop ; continue until done all pages When we assemble and run the code, the emulator's bitmapped result is filled with the colour yellow. There are no error messages displayed so we can dissect the code.  This code uses 25 bytes of memory. Calculate Performance  Assuming the CPU is running at 1M...