lab 3 part1

For lab 3 there were 5 options a group could chose my group chose the bouncing graphic. The reason I supported this chose is because making things move properly is hard and probably needs to be used quite often.

We got to pieces of code done a code that rights a graphic and a code that moves a green dot to the right.

Here are the codes with comments so you understand them.

Smile face                                                                                           Move to right, color over with other color
define WIDTH     7 ; width of graphic                                                lda #$0
define HEIGHT     7 ; height of graphic                                             sta $f0         
     lda #$25    ; create a pointer at $10                                                sta $f7    
     sta $10        ;   which points to where                                             lda #$10    ; set a pointer at middle   
     lda #$02    ;   the graphic should be drawn                                     sta $40    
     sta $11                                                                                             lda #$04                                                    
     lda #$00    ; number of rows we've drawn                                      sta $41               
     sta $12        ;   is stored in $12                                                        lda #$0f    ; set a pointer at middle          
     ldx #$00    ; index for data                                                              sta $42                        
     ldy #$00    ; index for screen column                                             lda #$04   
draw:    lda data,x                                                                                sta $43 ; 
     sta ($10),y                                                                                       ldy #$00    ; set index to 0  
     inx                                                                                                    
     iny                                                                                                   lda #$05    ; colour = GREEN    loop:                                                                                                     sta ($40),y    ; set pixel   
     cpy #WIDTH                                                                                  lda #$03    ; colour = BLUE   
     bne draw                                                                                         sta ($42),y    ; set pixel        
     inc $12        ; increment row counter                                                                                        
     lda #HEIGHT    ; are we done yet?                                                loop:           
     cmp $12                                                                                                   delay: dec $f0  ;slow down graphics 
     beq done    ; ...exit if we are                                                                              bne delay       
     lda $10        ; load pointer                                                                                 dec $f7      ; time slowed down 
     clc                                                                                                                      bne delay      
     adc #$20    ; add 32 to drop one row                                                        lda #$05    ; colour = GREEN 
     sta $10                                                                                                      sta ($40),y    ; set pixel                   
     lda $11    ; carry to high byte if needed                                                    lda #$03    ; colour = BLUE   
     adc #$00                                                                                                   sta ($42),y    ; set pixel
     sta $11                                                                                                      iny;  increase y axis so pixels move
     ldy #$00                                                                                                     cpy#$10
     beq draw                                                                                                    bne loop    ;
                                                                                          
done:    brk        ; stop when finished                                                                                         
                                                                                          
data:                                                                                         
dcb 00,03,03,03,03,03,00  ; by changing the colors
dcb 03,02,03,03,03,02,03  ; here you can create many                                                                                           
dcb 03,03,03,03,03,03,03  :differnt graphics in a 7 by 7 area.                                                                        
dcb 03,03,03,03,03,03,03                                                                                         
dcb 03,02,03,03,03,02,03                                                                                         
dcb 03,03,02,02,02,03,03                                                                                         
dcb 00,03,03,03,03,03,00                                                                                         
_____________________________________________________________________________________ 




  

Comments

Popular Posts