Changes

Jump to: navigation, search

6502 Assembly Language Lab (Old Version)

1,954 bytes added, 10:41, 13 January 2020
Created page with "Category:SPO600 Labs{{Admon/lab|Purpose of this Lab|In this lab, you will learn some of the basics of 6502 assembly language, in preparation for learning more complex..."
[[Category:SPO600 Labs]]{{Admon/lab|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 ==
* [[6502]]
* [[6502 Emulator]]
* [[6502 Emulator Example Code]]

== Lab 1 ==

=== Setup ===
# Organize a group of 4-6 students around one of the monitor/whiteboard groups in the classroom. Arrange the furniture so that everyone has a comfortable view of the display.
# Gather these supplies:
#* HDMI cable
#* Whiteboard markers
# Select one person to be the "Driver". That person should connect a device (laptop, table) to the HDMI display and open the [[6502 Emulator]] at [http://6502.cdot.systems] as well as this page.

{{Admon/important|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 ===
# 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

ldy #$00 ; set index to 0

loop: sta ($40),y ; set pixel

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

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

# Test the code. Make sure everyone in your group understands how it works.
# Add this instruction after the <code>loop:</code> label and before the <code>sta ($40),y</code> instruction:
tya
# What visual effect does this cause? Why?
# Add this instruction after the <code>tya</code>:
lsr
# What visual effect does this cause? Why?
# Add a second <code>lsr</code> and observe the effect. Add a third one and test again. What is the effect produced in each case? Why?
# Remove the <code>lsr</code> instructions and replace them with one, two, then three <code>asl</code> instructions. What is the effect produced? Why?

Navigation menu