DEV Community

Hyporos
Hyporos

Posted on

SPO600 - Lab 2

Hey guys, to whoever's reading this, here's some context.
This is my 2nd lab for my course SPO600 (open source development). This lab involves assembly language, specifically 6502.

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

        lda #$05        ; green color
        ldy #$00        ; set index to 0

top:  
        sta ($40), y    ; set first y pixel to green
        iny             ; increment y
        cpy #$20        ; stop when it hits y20

        bne top     

        sta $41         ; point at last page 

        ldy #$e0        ; set index to last row
        lda #$06        ; blue color

bottom: 

        sta ($40), y    ; set pixel to blue
        iny             ; increment y  

        bne bottom  

left_right: 

    lda #$07         ; yellow color 
        sta ($40), y     ; set pixel to yellow 

        tya              ; transfer y to a  

        clc              ; clear carry
        adc #$1f         ; add with carry

        tay              ; transfer a to y  

        lda #$04         ; purple color 

        sta ($40), y     ; set pixel to purple          
        iny              ; increment y 

        bne left_right

        inc $41           ; increment page    
        ldx $41           ; get current page number  
        cpx #$06          ; compare with 6

        bne left_right    ; continue until done all pages
Enter fullscreen mode Exit fullscreen mode

This is the result produced:
Image description

I gained a lot of experience into assembly language from this lab. It was very difficult at first but the more I looked into it, the simpler it got.

Top comments (0)