6502 Assembly Language Lab (Old Version)

From CDOT Wiki
Revision as of 00:22, 16 September 2021 by Chris Tyler (talk | contribs) (Writing Code, Part 2)
Jump to: navigation, search
Important.png
This is a draft only!
It is still under construction and content may change. Do not rely on this information.
Lab icon.png
Purpose of this Lab
In this lab, you will learn some of the basics of 6502 assembly language, in preparation for learning more complex x86_64 and AArch64 assembly language.

Resources

Lab 1

Setup

  1. Enter the breakout room assigned to you.
  2. Select one person to be the "Driver", who will type/operate the computer for the group.
  3. The driver will open the 6502 Emulator at [1] (and, ideally, this lab page as well).
Idea.png
Sharing Results
Decide how group results will be shared between the members of the group. (Suggestion: consider using a git repository).
Important.png
Save Your Work
The emulator does not save your work. Remember to periodically save it to a file (copy-and-paste the code).

Bitmap Code

3. Paste this code into the emulator:

	lda #$00	; set a pointer at $40 to point to $0200
	sta $40
	lda #$02
	sta $41

	lda #$07	; colour number

	ldy #$00	; set index to 0

loop:	sta ($40),y	; set pixel at the address (pointer)+Y

	iny		; increment index
	bne loop	; continue until done the page

	inc $41		; increment the page
	ldx $41		; get the current page number
	cpx #$06	; compare with 6
	bne loop	; continue until done all pages

4. Test the code by pressing the Assemble button, then the Run button. If the there are any errors assembling (compiling) the code, they will appear in the message area at the bottom of the page. Make sure the code is running correctly and that everyone in your group understands how it works.

Writing Code, Part 1

5. Write code to draw a green line across the top of the bitmap screen and a blue line across the bottom.

Writing Code, Part 2

6. Extend the previous code to draw a yellow line down the left side of the screen and a purple line down the right side.

Write-Up

Post an entry on your blog describing your experiments in this lab. Include:

  1. An introduction, so that someone who happens across your blog will understand the context of what you're writing about.
  2. The results from the Bitmap Code portion of the lab, describing what happened in each case and the reasons for it.
  3. The results from the two Writing Code portions of the lab, including the code, a description of how the code works, and the results produced.
  4. Your experiences with this lab -- your impressions of the Assembly Language, what you learned, and your reflections of the process.

Remember to follow the Blog Guidelines as you write.