Lab 2
Lab 2 was are introduction to the 6052 Emulator and write coding about creating lines on the emulator.
In the introduction to the emulator we learned that the tya command switch the value in y to a leaving you with 16 vertical stripes. The lsr command leads to the amount of pixels doubling for example 1 lsr gives you pixels in groups of two 2 lsr gives you pixels in groups of 4 and so on. This happens because the lsr command is shifting all the binary bits one to the right then adding a zero at the front. Next we have the asl command that get rides of have the colors each time because the leftmost bit is erased and a zero added at the right end. Lastly the iny command files in the screen skipping how many pixels the increase is by until the loop reaches its end.
bne loop2 ; nope
In the introduction to the emulator we learned that the tya command switch the value in y to a leaving you with 16 vertical stripes. The lsr command leads to the amount of pixels doubling for example 1 lsr gives you pixels in groups of two 2 lsr gives you pixels in groups of 4 and so on. This happens because the lsr command is shifting all the binary bits one to the right then adding a zero at the front. Next we have the asl command that get rides of have the colors each time because the leftmost bit is erased and a zero added at the right end. Lastly the iny command files in the screen skipping how many pixels the increase is by until the loop reaches its end.
Code Green and Blue lines
This code draws a green line at the very top and a blue line at the very bottom
lda #$00 ; set a pointer at $40 to point to $0200 -top left of screen
sta $40
lda #$02
sta $41
lda #$e0 ; set a pointer at $40 to point to $0200 -bottom left of screen
sta $42
lda #$05
sta $43
ldy #$00 ; set index to 0
loop: lda #$05 ; colour = green
sta ($40),y ; set pixel
lda #$06 ; colour = blue
sta ($42),y ; set pixel
iny ; increment index
cpy #$20 ;
bne loop ; continue until done the page
Code Purple and Yellow lines
This code draws a green line at the very top, a blue line at the very bottom, a yellow line on the left side and a purple line on the right.
lda #$00 ; set a pointer at $40 to point to $0200 - top left of screen
sta $40
lda #$02
sta $41
lda #$e0 ; set a pointer at $42 to point to $05e0 - bottom left of screen
sta $42
lda #$05
sta $43
ldy #$00 ; set index to 0
loop: lda #$05 ; colour = GREEN
sta ($40),y ; set pixel
lda #$06 ; colour = BLUE
sta ($42),y ; set pixel
iny ; increment index
cpy #$20
bne loop ; continue until done the page
loop2: ldy #$0 ; left side
lda #$07 ; colour = YELLOW
sta ($40),y ; set pixel
ldy #$1F ; right side
lda #$04 ; colour = PURPLE
sta ($40),y ; set pixel
clc ; clear the carry before doing any additions
lda $40 ; get the low byte of the pointer
adc #$20 ; add 20 hex to move down one line
sta $40 ; save the new pointer
bcc loop2 ; if the carry bit is clear then we are still inside a page
inc $41 ; otherwise update the page pointer
lda $41 ; get the current page address
cmp #6 ; have we reached beyond the last page
Comments
Post a Comment