実験室2

1671 ワード

ねえ人々、これを読んでいる誰にとっても、若干の前後関係.
これは私のコースSpo 600(オープンソース開発)のための私の第2のラボです.このラボはアセンブリ言語、特に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
結果は以下の通りです.

私はこの研究室からアセンブリ言語に多くの経験を得たが、最初は非常に困難でしたが、私はそれを見て、より簡単にそれを見た.