6502 Assembly Language Lab (Old Version)
Revision as of 09:41, 13 January 2020 by Chris Tyler (talk | contribs) (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...")
Contents
Resources
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 [1] as well as this page.
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
loop:
label and before thesta ($40),y
instruction:
tya
- What visual effect does this cause? Why?
- Add this instruction after the
tya
:
lsr
- What visual effect does this cause? Why?
- Add a second
lsr
and observe the effect. Add a third one and test again. What is the effect produced in each case? Why? - Remove the
lsr
instructions and replace them with one, two, then threeasl
instructions. What is the effect produced? Why?