diff options
Diffstat (limited to 'hacks/images/m6502')
34 files changed, 5204 insertions, 0 deletions
diff --git a/hacks/images/m6502/amiga.asm b/hacks/images/m6502/amiga.asm new file mode 100644 index 0000000..3195d4b --- /dev/null +++ b/hacks/images/m6502/amiga.asm @@ -0,0 +1,120 @@ +; super mega amiga emulator :) :) :) +; (c)by Thorex +start: + lda #$b + jsr setcol + jsr delay + lda #$f + jsr setcol + jsr delay + lda #$1 + jsr setcol + jsr delay + + ldx #0 +cp: + lda pic,x + sta $200,x + lda pic2,x + sta $300,x + lda pic3,x + sta $400,x + lda pic4,x + sta $500,x + dex + bne cp + rts + +setcol: + ldx #0 +s:sta $200,x + sta $300,x + sta $400,x + sta $500,x + dex + bne s + rts + +delay: + ldy #29 +d1: + ldx #0 +d2: + dex + bne d2 + dey + bne d1 + rts + +pic: + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 + dcb 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,0,$e,$e,$e,$e,0,$f,$f,$f + dcb $f,$f,$f,$f,0,0,0,$f,0,$e,$e,0,1,1,1,1 + dcb 1,1,1,1,1,1,1,0,$e,$e,$e,$e,0,$f,$f,$f + dcb $f,$f,$f,$f,0,$e,0,$f,0,$e,$e,$e,0,1,1,1 + dcb 1,1,1,1,1,1,1,0,$e,$e,$e,$e,0,$f,$f,$f + dcb $f,$f,$f,$f,0,$e,0,$f,0,$e,$e,$e,$e,0,1,1 + dcb 1,1,1,1,1,1,1,0,$e,$e,$e,$e,0,$f,$f,$f + dcb $f,$f,$f,$f,0,0,0,$f,0,$e,$e,$e,$e,0,1,1 + dcb 1,1,1,1,1,1,1,0,$e,$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 0,$f,1,0,1,$f,1,0,1,1,0,$e,$e,0,1,1 + dcb 1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0 + dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1 + dcb 1,0,1,1,1,1,1,1,1,1,1,0,1,1,0,0 + dcb 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,1 + dcb 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1 + dcb 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + +pic4: + dcb 1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,0 + dcb 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,0,1,1,1,1,1,1,0,0,0,0,0,1,1,0 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,0,1,1,1,1,1,1,0,1,1,1,0,0,0,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +
\ No newline at end of file diff --git a/hacks/images/m6502/breakout.asm b/hacks/images/m6502/breakout.asm new file mode 100644 index 0000000..a0fa694 --- /dev/null +++ b/hacks/images/m6502/breakout.asm @@ -0,0 +1,195 @@ +; Brick Out by Blake Ramsdell <blaker@gmail.com> http://www.blakeramsdell.com + +; A poor attempt at brick out with no player involved. Maybe someday I'll +; let you play it, or you can view this as an exercise for the reader to put +; in a paddle that is user-controlled. + +; I guess this is Copyright (C) 2007 Blake Ramsdell, and you have a license to +; do whatever you want with it, just tell me what you did and give me a +; mention. If you want to sell it, and you make a billion dollars, then good +; for you. You might at least throw a party and invite me. + +; The gist of it is pretty simple -- you have a ball, and the ball has an X +; and a Y velocity. When it hits something, it bounces off of it. If the thing +; that it hits is not a wall, then it erases it. Pretty dead-simple behavior. + +; I don't like the vertical movement -- there's a shortcut in here somewhere +; to make it less computationally expensive I think. Right now it just does a +; two byte add and subtract of $20. + +; The ball motion is also a bit weird looking. I don't know if this is an +; artifact of the simulation environment combined with a normal tearing +; artifact related to refresh or what. + +; Blake Ramsdell, May 2007 + +init: + lda #$fe + sta $2 ; X velocity (0 = fast, ff = slow) + ; (low bit is direction, 0 = down or right, 1 = up or left) + lda #$ee + sta $3 ; Y velocity + +drawbox: + lda #0 ; Use $0-$1 as a screen address for drawing the field + sta $0 + lda #2 + sta $1 + + ldx #$20 ; Loop $20 times +boxloop: + lda #2 ; Line color (red) + sta $1ff,x ; Top line + sta $5df,x ; Bottom line + ldy #0 + sta ($0),y ; Left line + ldy #$1f + sta ($0),y ; Right line + + cpx #$1 ; If we're just before the bottom line... + beq noblocks ; Don't draw any blocks there + + + lda #3 ; First block for this row, Cyan in color + ldy #$17 ; It's at X position $17 + sta ($0),y ; Draw it + + lda #4 ; Second block for this row, Purple in color + iny ; It's at the next X position + sta ($0),y ; Draw it + + lda #5 ; Third block for this row, Green in color + iny ; It's at the next X position + sta ($0),y ; Draw it + + lda #6 ; Fourth block for this row, Blue in color + iny ; It's at the next X position + sta ($0),y ; Draw it + + +noblocks: + clc ; Get ready to increment the row, clear the carry for add + lda $0 ; Get the low byte + adc #$20 ; Add $20 to it for the next row + sta $0 ; Put it back + lda $1 ; Get the high byte + adc #0 ; Factor in the carry + sta $1 ; Put it back + + dex ; Decrement the loop counter + bne boxloop ; Do it again unless it's zero + + ldx $2 ; Load the X velocity + ldy $3 ; Load the Y velocity + + lda #$44 ; Pick a start point + sta $0 ; Ball position low + lda #$02 + sta $1 ; Ball position high + +drawball: + txa ; Preserve X + pha + lda #1 ; Ball color (white) + ldx #0 ; Clear X for indirect addressing for writing to screen + sta ($0,x) ; Draw the ball + pla ; Restore X + tax + +decloop: + dex ; Decrement the X velocity + beq updatexpos ; If it's zero, time to adjust X + dey ; Decrement the Y velocity + bne decloop ; If it's not zero, loop, otherwise fall through to adjust Y + +updateypos: + txa ; Preserve X + pha + jsr clearball ; Put background over the current ball position +updateyposnoclear: + lda $3 ; Get the Y velocity + and #1 ; See if it's down + bne moveup ; If not, then it's up, otherwise fall through to down + +movedown: + clc ; Prepare for moving to the next Y line and doing the add + lda $0 ; Low byte of the current ball position + adc #$20 ; Next row + sta $0 ; Put it back + bcc ycollision ; If no carry, go on to check for collision + inc $1 ; Had a carry, fix the high byte of the address + bne ycollision ; Z flag is always clear ($1 will never be zero) + +moveup: + sec ; Prepare for moving to the previous Y line and subtracting + lda $0 ; Low byte of the current ball position + sbc #$20 ; Previous row + sta $0 ; Put it back + lda $1 ; High byte + sbc #$0 ; Factor out the carry + sta $1 ; Put it back + +ycollision: + ldx #0 ; Prepare for indirect read + lda ($0,x) ; Get the current pixel at the new ball position + bne ycollided ; If it's not zero (the background color) then we hit + ldy $3 ; Otherwise, load up the current Y velocity + pla ; Restore the X velocity + tax + jmp drawball ; Back to the top + +ycollided: + cmp #$2 ; Border color? + beq ycollided2 ; If so, then we just bounce, don't eat a brick + + ; Erase brick + lda #0 ; Background color (black) + sta ($0,x) ; Erase it + +ycollided2: + lda #1 ; Get ready to change direction + eor $3 ; Flip the low bit on the Y velocity (change direction) + sta $3 ; Put it back + jmp updateyposnoclear ; Go back to make sure we didn't hit anything else + +updatexpos: + jsr clearball ; Put background over the current ball position +updatexposnoclear: + lda $2 ; Get the current X velocity + and #1 ; See if it's right by testing the low bit + bne moveleft ; If not, move left + +moveright: + inc $0 ; Move right + bne xcollision ; Z flag is always clear + +moveleft: + dec $0 ; Move left + +xcollision: + ldx #0 ; Prepare for indirect read + lda ($0,x) ; Get the current pixel at the new ball position + bne xcollided ; If it's not zero (the background color) then we hit + ldx $2 ; Otherwise, load up the current X velocity + jmp drawball ; Back to the top + +xcollided: + cmp #$2 ; Border color? + beq xcollided2 ; If so, then we just bounce, don't eat a brick + + ; Erase brick + lda #0 ; Background color (black) + sta ($0,x) ; Erase it + +xcollided2: + lda #1 ; Get ready to change direction + eor $2 ; Flip the low bit on the X velocity (change direction) + sta $2 ; Put it back + jmp updatexposnoclear ; Go back to make sure we didn't hit anything else + +clearball: + lda #0 ; Background color (black) + tax ; Clear X for indirect + sta ($0,x) ; Black out the ball + rts ; Return to caller + diff --git a/hacks/images/m6502/byterun.asm b/hacks/images/m6502/byterun.asm new file mode 100644 index 0000000..848b5c9 --- /dev/null +++ b/hacks/images/m6502/byterun.asm @@ -0,0 +1,100 @@ +; testing byterun compression + +start: + lda #<logo + sta $0 + lda #>logo + sta $1 + lda #$00 + sta $2 + lda #$02 + sta $3 + +decrunchLoop: + lda $3 + cmp #$6 + bne moreWork + rts +moreWork: + ldy #0 + lda ($0),y + cmp #$ff + bne notCrunched + iny + lda ($0),y ; repeat # + sta $4 + iny + lda ($0),y ; color + ldy $4 +drawLoop: + ldx #0 + sta ($2,x) + jsr nextPixel + dey + bne drawLoop + jsr getNextByte + jsr getNextByte + jmp decrunchLoop +notCrunched: + ldx #0 + sta ($2,x) + jsr nextPixel + jsr getNextByte + jmp decrunchLoop + +getNextByte: + inc $0 + lda $0 + cmp #$00 + bne notHi + inc $1 +notHi: + rts + +nextPixel: + inc $2 + ldx $2 + cpx #$00 + bne notNextLine + inc $3 +notNextLine: + rts + + +logo: + dcb $ff,43,1,$f,$f,$f,$c,$f,$f,$f,$ff,24,1,$c,$f,$c,0 + dc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c,$f,1,1,$c,$f,1,1,0,$f + dcb $f,0,1,1,0,$f,$f,0,$f,1,0,$f,1,1,1,1 + dcb 1,1,1,$c,0,$c,0,0,1,1,0,$f,1,1,0,$c + dcb $c,0,$f,1,0,$f,0,$f,1,1,0,$f,1,1,1,1 + dcb 1,1,1,0,$c,$f,$f,0,$f,1,$c,$f,1,$c,$c,$f + dcb $f,$c,$c,1,0,1,$f,$c,1,1,0,$f,1,1,1,1 + dcb 1,1,$f,0,1,1,1,$c,$c,1,0,$f,1,0,$f,1 + dcb 1,$f,0,1,0,$f,1,0,$f,1,0,$f,$ff,16,1 + dcb $f,$ff,5,1,$f,1,1,1,$f,$ff,38,1 + + diff --git a/hacks/images/m6502/cellular-30.asm b/hacks/images/m6502/cellular-30.asm new file mode 100644 index 0000000..2439561 --- /dev/null +++ b/hacks/images/m6502/cellular-30.asm @@ -0,0 +1,67 @@ +; Rule 30 cellular automata +; by D.S. + + lda #1 + sta $20f + +l3: + lda #2 + sta 3 + sta 5 + sta 7 + lda #1 + sta 9 + sta 6 + lda #255 + sta 8 + lda #0 + sta 2 + lda #32 + sta 4 + ldx #30 +l1: + ldy #31 + +l2: + lda ($2),y + ora ($6),y + eor ($8),y + sta ($4),y + dey + bpl l2 + + lda $2 + adc #32 + sta $2 + lda $3 + adc #0 + sta $3 + lda $4 + adc #32 + sta $4 + lda $5 + adc #0 + sta $5 + lda $6 + adc #32 + sta $6 + lda $7 + adc #0 + sta $7 + lda $8 + adc #32 + sta $8 + lda $9 + adc #0 + sta $9 + dex + bpl l1 + + ldy #31 +l4: + lda ($2),y + sta $200,y + dey + bpl l4 + + jmp l3 diff --git a/hacks/images/m6502/cellular-600.asm b/hacks/images/m6502/cellular-600.asm new file mode 100644 index 0000000..db5497c --- /dev/null +++ b/hacks/images/m6502/cellular-600.asm @@ -0,0 +1,209 @@ +; Code 600 cellular automata - by D.S. + lda #1 + sta $22f + +l3: + ldy #29 + +l2: + lda $220,y + adc $221,y + adc $222,y + tax + lda rule,x + sta $201,y + dey + bpl l2 + + ldy #$c0 + sec +ll2: + lda $503,y + sta $523,y + sta $53b,y + lda $504,y + sta $524,y + sta $53a,y + lda $505,y + sta $525,y + sta $539,y + lda $506,y + sta $526,y + sta $538,y + lda $507,y + sta $527,y + sta $537,y + lda $508,y + sta $528,y + sta $536,y + lda $509,y + sta $529,y + sta $535,y + lda $50a,y + sta $52a,y + sta $534,y + lda $50b,y + sta $52b,y + sta $533,y + lda $50c,y + sta $52c,y + sta $532,y + lda $50d,y + sta $52d,y + sta $531,y + lda $50e,y + sta $52e,y + sta $530,y + lda $50f,y + sta $52f,y + tya + adc #$df + tay + bcs ll2 + + ldy #$e0 + sec +ll3: + lda $403,y + sta $423,y + sta $43b,y + lda $404,y + sta $424,y + sta $43a,y + lda $405,y + sta $425,y + sta $439,y + lda $406,y + sta $426,y + sta $438,y + lda $407,y + sta $427,y + sta $437,y + lda $408,y + sta $428,y + sta $436,y + lda $409,y + sta $429,y + sta $435,y + lda $40a,y + sta $42a,y + sta $434,y + lda $40b,y + sta $42b,y + sta $433,y + lda $40c,y + sta $42c,y + sta $432,y + lda $40d,y + sta $42d,y + sta $431,y + lda $40e,y + sta $42e,y + sta $430,y + lda $40f,y + sta $42f,y + tya + adc #$df + tay + bcs ll3 + + ldy #$e0 + sec +ll4: + lda $303,y + sta $323,y + sta $33b,y + lda $304,y + sta $324,y + sta $33a,y + lda $305,y + sta $325,y + sta $339,y + lda $306,y + sta $326,y + sta $338,y + lda $307,y + sta $327,y + sta $337,y + lda $308,y + sta $328,y + sta $336,y + lda $309,y + sta $329,y + sta $335,y + lda $30a,y + sta $32a,y + sta $334,y + lda $30b,y + sta $32b,y + sta $333,y + lda $30c,y + sta $32c,y + sta $332,y + lda $30d,y + sta $32d,y + sta $331,y + lda $30e,y + sta $32e,y + sta $330,y + lda $30f,y + sta $32f,y + tya + adc #$df + tay + bcs ll4 + + + ldy #$e0 + sec +ll1: + lda $203,y + sta $223,y + sta $23b,y + lda $204,y + sta $224,y + sta $23a,y + lda $205,y + sta $225,y + sta $239,y + lda $206,y + sta $226,y + sta $238,y + lda $207,y + sta $227,y + sta $237,y + lda $208,y + sta $228,y + sta $236,y + lda $209,y + sta $229,y + sta $235,y + lda $20a,y + sta $22a,y + sta $234,y + lda $20b,y + sta $22b,y + sta $233,y + lda $20c,y + sta $22c,y + sta $232,y + lda $20d,y + sta $22d,y + sta $231,y + lda $20e,y + sta $22e,y + sta $230,y + lda $20f,y + sta $22f,y + tya + adc #$df + tay + bcs ll1 + + jmp l3 + +; Rules, uncomment only one line of the following. +rule: + dcb 0,2,0,1,1,2,0 ; CODE 600 +; dcb 0,2,1,0,2,0,0 ; CODE 177 +; dcb 0,1,2,0,2,0,1; CODE 912
\ No newline at end of file diff --git a/hacks/images/m6502/colors.asm b/hacks/images/m6502/colors.asm new file mode 100644 index 0000000..2097f7a --- /dev/null +++ b/hacks/images/m6502/colors.asm @@ -0,0 +1,46 @@ +; submitted by Anonymous + + jmp $700 + *=$700 + ldx #0 + ldy #0 + ;init screen + lda #0 + sta $0 + sta $3 + lda #2 + sta $1 +loop: + lda colors,x + bpl ok + inc $0 + ldx #0 + lda colors,x +ok: + inx + sta ($0),y + iny + bne ok2 + inc $1 + lda $1 + cmp #6 + beq end +ok2: + jmp loop +end: + inc $3 + lda $3 + and #$3f + tax + ldy #0 + lda #2 + sta $1 + sty $0 + jmp loop + +colors: +dcb 0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,7,1,7,7,8,7,8 +dcb 8,2,8,2,2,0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,1,1 +dcb 1,1,1,1,7,1,7,7,8,7,8,8,2,8,2,2,255 + + diff --git a/hacks/images/m6502/crunch6502.asm b/hacks/images/m6502/crunch6502.asm new file mode 100644 index 0000000..56ea507 --- /dev/null +++ b/hacks/images/m6502/crunch6502.asm @@ -0,0 +1,292 @@ +;; Show "6502" on the screen waving up and down. +;; Jeremy English 29-December-2007 +;; +;; Each digit is stored as a pattern of vertical bits. +;; For example: +;; +;; 111111 This is the digit six. We think of the digit +;; 111111 by it's column pattern. The column patterns +;; 110000 are labeled at the bottom of the example. +;; 110000 Pattern B is 1100110011. The basic algorithm +;; 111111 is that we get the pattern, paint the first +;; 111111 bit (1 foreground, 0 background) then dec y +;; 110011 and get the next bit. +;; 110011 +;; 111111 The pattern for each digit is: +;; 111111 6 = AABBCC +;; ------ 5 = DDBBCC +;; AABBCC 0 = AAEEAA +;; 2 = CCBBDD + +;; Addresses $0 and $1 are used by the paint subroutine. +;; Addresses $2 through $6 are used by the display pattern subroutine +;; Address $7 is used in the main loop +;; Address $8 through $1a are used for the start positions +;; Address $1b is used by the display pattern subroutine +;; Address $1c is used as the color row offset. +;; Addresses $d0 through $ef store the font table + +jmp init_font_table +start: + +;; Initialize the pointers to the start position. +lda #<y_start_pos1 +sta $b +lda #>y_start_pos1 +sta $c +lda #<y_start_pos2 +sta $d +lda #>y_start_pos2 +sta $e +lda #<y_start_pos3 +sta $f +lda #>y_start_pos3 +sta $10 +lda #<y_start_pos4 +sta $11 +lda #>y_start_pos4 +sta $12 +lda #<y_start_pos5 +sta $13 +lda #>y_start_pos5 +sta $14 +lda #<y_start_pos4 +sta $15 +lda #>y_start_pos4 +sta $16 +lda #<y_start_pos3 +sta $17 +lda #>y_start_pos3 +sta $18 +lda #<y_start_pos2 +sta $19 +lda #>y_start_pos2 +sta $1a + + +lda #0 ; start position to use +sta $8 + +main_loop: +inc $1c ; increment the color offset. +inc $1d ; increment the starting x position +ldy $8 ; load the current start position index +ldx $b,y ; get the lsb from the table +txa +sta $9 ; store the msb of the start position pointer +iny ; move to the next position in the table +ldx $b,y ; get the msb from the table +txa +sta $a ; store the lsb of the start position pointer +iny ; move the index up by one +tya +cmp #$10 ; have we looked at all 16 start positions? +bne store_idx ; if not then keep the index and store it +lda #0 ; set the index back to zero +store_idx: +sta $8 ; save the index back in memory + +ldy #0 +lda #$ff +sta $4 ; initialize the column to FF +display_loop: + inc $4 ; increment the column + ldx $d0,y ; load the lsb from the font table + stx $2 + iny + ldx $d0,y ; load the msb from the font table + stx $3 + sty $7 ; save y in memory + jsr dis_pat ; Jump to the display pattern subroutine. + inc $4 ; increment the column + jsr dis_pat ; Each pattern gets painted twice so we have a thicker font + ldy $7 ; get y out of memory + iny ; increment the index + tya + cmp #$20 ; Did we display all of the columns? + bne display_loop ;if not continue +jmp main_loop +rts + +init_font_table: + ;;Setup a table in the zero page that contains the string "6502" + lda #<pattern_a ;start with digit 6. It's pattern is aabbcc + sta $d0 + lda #>pattern_a + sta $d1 + lda #<pattern_b + sta $d2 + lda #>pattern_b + sta $d3 + lda #<pattern_c + sta $d4 + lda #>pattern_c + sta $d5 + lda #<pattern_null ;We want to space everything out with blanks + sta $d6 + lda #>pattern_null + sta $d7 + lda #<pattern_d ;load memory for digit 5 ddbbcc + sta $d8 + lda #>pattern_d + sta $d9 + lda #<pattern_b + sta $da + lda #>pattern_b + sta $db + lda #<pattern_c + sta $dc + lda #>pattern_c + sta $dd + lda #<pattern_null + sta $de + lda #>pattern_null + sta $df + lda #<pattern_a ;load memory for digit 0 aaeeaa + sta $e0 + lda #>pattern_a + sta $e1 + lda #<pattern_e + sta $e2 + lda #>pattern_e + sta $e3 + lda #<pattern_a + sta $e4 + lda #>pattern_a + sta $e5 + lda #<pattern_null + sta $e6 + lda #>pattern_null + sta $e7 + lda #<pattern_c ;load memory for digit 2 ccbbdd + sta $e8 + lda #>pattern_c + sta $e9 + lda #<pattern_b + sta $ea + lda #>pattern_b + sta $eb + lda #<pattern_d + sta $ec + lda #>pattern_d + sta $ed + lda #<pattern_null + sta $ee + lda #>pattern_null + sta $ef + jmp start + + +;; Display a pattern on the screen. The pattern to use is +;; stored at $2 and $3. The current column is stored at $4. +dis_pat: + ldy $4 ; Load the current column into y + lda ($9),y ; Get the start position for y + tay + sty $5 ; Store the starting position in memory + ldy #0 ; We have 12 bits that need to be painted +dis_pat_loop: + lda ($2),y ; get a bit from the pattern + pha ; save the color on the stack + tya ; move the index into the accumulator + clc ; clear the carry + adc $5 ; add the starting position to the index + sty $6 ; store the index + tay ; The calculated y position + ldx $4 ; The x position is the current column + pla ; pop the color off of the stack + beq go_paint ; black just paint it + clc ; get rid of any carry bit + sty $1b ; save the y coordinate + tya + clc + adc $1c ; add the color offset + and #$7 ; make sure the look up is in range + tay ; move the new index into y so we can look up the color + lda color_row,y ; if not black get the row color + ldy $1b ; restore the y coordinate +go_paint: + jsr paint ; paint the pixel on the screen + ldy $6 ; get the index out of memory + iny ; increment the index + tya + cmp #12 ; Have we looked at all of the bits? + bne dis_pat_loop ; if not then continue looking + rts ; else return from the subroutine + +;; Paint - Put a pixel on the screen by using the x registry for +;; the x position, the y registry for the y position and +;; the accumulator for the color. +paint: + pha ; Save the color + lda yl,y ; Get the LSB of the memory address for y + sta $0 ; Store it first + lda yh,y ; Get the MSB of the memory address for y + sta $1 ; Store it next + txa ; We want x in the y registry so we transfer it to A + tay ; and then A into y. + pla ; Pop the color off of the stack + sta ($0),y ; Store the color at the correct y + x address. + rts ; return from the subroutine. + +;; Paint uses the following two tables to look up the +;; correct address for a y coordinate between +;; 0 and 31. + +;; Y cord MSB +yh: + dcb $02, $02, $02, $02, $02, $02, $02, $02 + dcb $03, $03, $03, $03, $03, $03, $03, $03 + dcb $04, $04, $04, $04, $04, $04, $04, $04 + dcb $05, $05, $05, $05, $05, $05, $05, $05 +;; Y cord LSB +yl: + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + +;; A zero is on the end of each pattern to clean up +;; residue left by waving. +pattern_a: + dcb 0,1,1,1,1,1,1,1,1,1,1,0 + +pattern_b: + dcb 0,1,1,0,0,1,1,0,0,1,1,0 + +pattern_c: + dcb 0,1,1,0,0,1,1,1,1,1,1,0 + +pattern_d: + dcb 0,1,1,1,1,1,1,0,0,1,1,0 + +pattern_e: + dcb 0,1,1,0,0,0,0,0,0,1,1,0 + +pattern_null: + dcb 0,0,0,0,0,0,0,0,0,0,0,0 + +;; Table that store the current start position +;; of each y column. +y_start_pos1: + dcb 10,10,9,9,8,8,7,7,6,6,7,7,8,8,9,9,10,10,9,9,8,8,7,7 + dcb 6,6,7,7,8,8 + +y_start_pos2: + dcb 9,9,8,8,8,8,8,8,7,7,8,8,8,8,8,8,9,9,8,8,8,8,8,8 + dcb 7,7,8,8,8,8 + +y_start_pos3: + dcb 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + dcb 8,8,8,8,8,8 + +y_start_pos4: + dcb 7,7,8,8,8,8,8,8,9,9,8,8,8,8,8,8,7,7,8,8,8,8,8,8 + dcb 9,9,8,8,8,8 + +y_start_pos5: + dcb 6, 6,7,7,8,8,9,9,10,10,9,9,8,8,7,7, 6, 6,7,7,8,8,9,9 + dcb 10,10,9,9,8,8 + +color_row: + dcb $7,$8,$9,$2,$4,$6,$e,$3,$d,$5 diff --git a/hacks/images/m6502/demoscene.asm b/hacks/images/m6502/demoscene.asm new file mode 100644 index 0000000..fdd9361 --- /dev/null +++ b/hacks/images/m6502/demoscene.asm @@ -0,0 +1,457 @@ + +start: + ldx #0 +c:lda bottombar,x + cmp #$ff + beq init + sta $4e0,x + sta $5e0,x + inx + jmp c +init: + jsr initDraw + lda #0 + sta $10 ; scrptr + sta $11 ; txtptr +loop: + jsr drawMain + jsr putfont + jsr scrollarea + jmp loop + +scrollarea: + ldx #0 +g:lda $521,x + sta $520,x + lda $541,x + sta $540,x + lda $561,x + sta $560,x + lda $581,x + sta $580,x + lda $5a1,x + sta $5a0,x + inx + cpx #31 + bne g + rts + +putfont: + lda $10 ; scrptr + cmp #0 + bne noNext + inc $11 + ldx $11 + lda scrolltext,x + tax + lda fontSize,x + sta $10 +noNext: + dec $10 + ldx $11 + lda scrolltext,x + cmp #$ff + bne notResetText + lda #0 + sta $10 + sta $11 + rts + +notResetText: + asl + tax + lda fontlookup,x + sta $2 + inx + lda fontlookup,x + sta $3 + lda #<fonts + clc + adc $2 + sta $0 + lda #>fonts + adc $3 + sta $1 + ldy $10 + lda ($00),y + sta $53f + tya + clc + adc #6 + tay + lda ($00),y + sta $55f + tya + clc + adc #6 + tay + lda ($00),y + sta $57f + tya + clc + adc #6 + tay + lda ($00),y + sta $59f + tya + clc + adc #6 + tay + lda ($00),y + sta $5bf + rts + +initDraw: + lda #<picture + sta $20 + lda #>picture + sta $21 + lda #$00 + sta $22 + lda #$02 + sta $23 + ldx #$0 + rts +drawMain: + ldx #0 + lda ($20,x) + cmp #$ff + beq done + sta ($22,x) + inc $20 + lda $20 + cmp #$00 + bne n1 + inc $21 +n1: + inc $22 + lda $22 + cmp #$00 + bne done + lda $23 + cmp #$05 + beq done + inc $23 +done: + rts + +picture: + dcb 0,0,0,0,0,0,0,0,0,$b,$b,$c,$f,$f,$f,$f + dcb $f,$b,0,0,0,$b,$b,$c,$c,$f,$f,$b,0,0,0,0 + dcb 0,0,0,0,0,0,0,0,0,$b,$c,$c,$f,$c,$f,$f + dcb $b,$b,$b,$b,$b,0,$b,$b,$c,$f,$f,$c,0,0,0,0 + dcb 0,0,0,0,0,0,0,$b,0,$c,$b,$f,$c,$f,$f,$c + dcb $c,$b,0,$b,$c,$c,$c,$f,$f,1,$f,$c,$b,0,0,0 + dcb 0,0,0,0,0,0,0,0,$b,$b,$c,$c,$c,$f,$f,$f + dcb $c,$c,$c,$c,$c,$c,$f,$c,$f,$f,$f,$f,$b,0,0,0 + dcb 0,0,0,0,0,0,0,$b,0,0,$b,$c,$c,$f,$f,$f + dcb $f,$c,$f,$f,$f,$f,$f,$f,$f,1,$f,$f,$c,0,0,0 + dcb 0,0,0,0,0,0,0,0,0,$b,$b,$b,$c,$f,$f,1 + dcb $f,$f,$c,$f,$f,$f,1,$f,$f,$f,$f,$f,$f,0,0,0 + dcb 0,0,0,0,0,0,0,0,0,$b,$b,$b,$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,$f,$f,$f,$f + dcb $f,$f,$f,$f,$f,1,$f,$c,$b,$f,$c,$f,$c,$f,$c,$b + dcb 0,0,0,0,0,$b,$c,$c,$c,$c,$f,$f,$f,$f,$f,$f + dcb $f,$f,$f,$f,$f,$c,$b,$c,$c,$c,$f,$f,$c,$f,$c,$c + dcb 0,0,0,0,0,$b,$b,$c,$c,$c,$c,$c,$f,$f,$f,$f + dcb $f,$f,$f,$c,$b,$b,$c,$c,$c,$f,$c,$f,$f,$f,$c,$b + dcb 0,0,0,0,0,$b,$b,$b,$b,$c,$c,$f,$c,$f,$f,$f + dcb $c,$c,$b,$b,$b,$c,$b,$b,$c,$c,$f,$c,$c,$f,$c,$c + dcb 0,0,0,0,0,0,$b,$b,$c,$b,$c,$c,$c,$c,$c,$c + dcb $b,$b,$b,$b,$c,$b,$b,$c,$c,$f,$f,$f,$c,$c,$c,$b + dcb 0,0,0,0,0,0,0,0,$b,$b,$b,$c,$c,$c,$c,$c + dcb $c,$c,$b,$b,$b,$b,$c,$c,$f,$f,$f,$c,$c,$c,$c,$c + dcb $ff + + +fontSize: + dcb 5,5,5,5,5,5,5,5 ;abcdefgh + dcb 2,5,5,5,6,6,5,5 ;ijklmnop + dcb 6,5,5,4,5,6,6,6 ;qrstuvwx + dcb 6,5,2,3 ;yz.[SPACE] + +; +; a=0, b=1, c=2, d=3.... +; + +scrolltext: + dcb 0 + + dcb 14,13,11,24,27 ; "only " + dcb 03,04,15,19,07,27 ; "depth " + dcb 12,0,10,4,18,27 ; "makes " + dcb 8,19,27 ; "it " + dcb 15,14,18,18,8,1,11,4 ; "possible" + dcb 26,26,26 ; "..." + dcb 19,7,8,18,27 ; "this " + dcb 8,18,27 ; "is " + dcb 19,7,4,27 ; "the " + dcb 5,8,17,18,19,27 ; "first " + dcb 3,4,12,14,27 ; "demo " + dcb 12,0,3,4,27 ; "made " + dcb 8,13,27 ; "in " + dcb 19,7,8,18,27 ; "this " + dcb 4,13,21,26,26,26,26,27 ; "env.... " + dcb 7,14,15,4,27 ; "hope " + dcb 24,14,20,27 ; "you " + dcb 11,8,10,4,27 ; "like " + dcb 8,19,26,26,26,27,27 ; "it... " + dcb 22,22,22,26 ; "www." + dcb 3,4,15,19,7,26 ; "depth." + dcb 14,17,6,27,27,27,27,27 ; "org " + + dcb $ff ; end of text + +fontlookup: + dcb $00,$00 ;a + dcb $20,$00 ;b + dcb $40,$00 ;c + dcb $60,$00 ;d + dcb $80,$00 ;e + dcb $a0,$00 ;f + dcb $c0,$00 ;g + dcb $e0,$00 ;h + dcb $00,$01 ;i + dcb $20,$01 ;j + dcb $40,$01 ;k + dcb $60,$01 ;l + dcb $80,$01 ;m + dcb $a0,$01 ;n + dcb $c0,$01 ;o + dcb $e0,$01 ;p + dcb $00,$02 ;q + dcb $20,$02 ;r + dcb $40,$02 ;s + dcb $60,$02 ;t + dcb $80,$02 ;u + dcb $a0,$02 ;v + dcb $c0,$02 ;w + dcb $e0,$02 ;x + dcb $00,$03 ;y + dcb $20,$03 ;z + dcb $40,$03 ;. + dcb $60,$03 ;" " + +fonts: + dcb 0,1,1,0,0,0 + dcb 1,0,0,1,0,0 + dcb 1,1,1,1,0,0 + dcb 1,0,0,1,0,0 + dcb 1,0,0,1,0,0 + dcb 0,0 + + dcb 0,1,1,1,0,0 + dcb 1,0,0,1,0,0 + dcb 0,1,1,1,0,0 + dcb 1,0,0,1,0,0 + dcb 0,1,1,1,0,0 + dcb 0,0 + + dcb 0,1,1,0,0,0 + dcb 1,0,0,1,0,0 + dcb 0,0,0,1,0,0 + dcb 1,0,0,1,0,0 + dcb 0,1,1,0,0,0 + dcb 0,0 + + dcb 0,1,1,1,0,0 + dcb 1,0,0,1,0,0 + dcb 1,0,0,1,0,0 + dcb 1,0,0,1,0,0 + dcb 0,1,1,1,0,0 + dcb 0,0 + + dcb 1,1,1,1,0,0 + dcb 0,0,0,1,0,0 + dcb 0,1,1,1,0,0 + dcb 0,0,0,1,0,0 + dcb 1,1,1,1,0,0 + dcb 0,0 +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0,0 + dcb 0,0,0,0,0,0 + dcb 1,0,0,0,0,0 + dcb 0,0 + + dcb 0,0,0,0,0,0 ; " " + dcb 0,0,0,0,0,0 + dcb 0,0,0,0,0,0 + dcb 0,0,0,0,0,0 + dcb 0,0,0,0,0,0 + dcb 0,0 + +bottombar: + dcb $b,$9,$b,9,8,9,8,$a,8,$a,7,$a,7,1,7,1,1 + dcb 7,1,7,$a,7,$a,8,$a,8,9,8,9,$b,9,$b + dcb $ff + diff --git a/hacks/images/m6502/disco.asm b/hacks/images/m6502/disco.asm new file mode 100644 index 0000000..bc69d70 --- /dev/null +++ b/hacks/images/m6502/disco.asm @@ -0,0 +1,23 @@ +; DISCO DISCO +; submitted by Anonymous + +start: + inx + txa + sta $200, y + sta $300, y + sta $400, y + sta $500, y + iny + tya + cmp 16 + bne do + iny + jmp start +do: + iny + iny + iny + iny +jmp start + diff --git a/hacks/images/m6502/dmsc.asm b/hacks/images/m6502/dmsc.asm new file mode 100644 index 0000000..9a0ae6b --- /dev/null +++ b/hacks/images/m6502/dmsc.asm @@ -0,0 +1,130 @@ +; +; 6502 Assembler Demo. +; Copyright (C) 2007 Daniel Serpell <daniel.serpell@gmail.com> +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; +; 1. Redistributions of source code must retain the above copyright notice, +; this list of conditions and the following disclaimer. +; +; 2. Redistributions in binary form must reproduce the above copyright notice, +; this list of conditions and the following disclaimer in the documentation +; and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; +; By DMSC - daniel.serpell@gmail.com +; +; See xscreensaver/hacks/images/m6502/dsmc.txt for the source +; + dcb 76, 94, 11,133, 32,162, 8,160, 8,145, 16,136,208,251,165, 16 + dcb 24,105, 32,133, 16,165, 17,105, 0,133, 17,165, 32,202,208,231 + dcb 96,230, 48,165, 48, 41, 63,133, 48,170,189,106, 6,170,189, 8 + dcb 3,105, 1, 41, 3,157, 8, 3,138, 73,231,170,189, 0, 2,105 + dcb 1, 41, 3,157, 0, 2,165, 48, 73, 63,170,189,106, 6, 73,224 + dcb 170,189, 8, 2,105, 1, 41, 3,157, 8, 2,138, 73,231,170,189 + dcb 0, 3,105, 1, 41, 3,157, 0, 3, 96,224,192,160,128, 96,225 + dcb 64,193,161,226,129, 32,194, 97,162,227,195,130,228, 65,163,196 + dcb 98,229,131,164,197,230,231,132,165,198, 99, 66, 33, 0,199,166 + dcb 133,100,167, 67,134,101,135, 34, 68,102,103, 69, 35, 70, 71, 36 + dcb 1, 37, 38, 39, 2, 3, 4, 5, 6, 7,166, 48,189,198, 6,170 + dcb 254, 24, 3, 73, 7,170,254, 16, 3, 73,231,170,254, 24, 2, 73 + dcb 7,170,254, 16, 2, 96, 0, 32, 1, 33, 64, 2, 65, 34, 96, 66 + dcb 3, 97, 35, 98, 67,128, 4,129, 36, 99,130, 68,160, 5,161,131 + dcb 100, 37,162, 69,132,192,163,101, 6,193, 38,194, 70,164,133,195 + dcb 102,224, 7,225, 39,165,226,196,134, 71,227,103,197,166,228,135 + dcb 198,229,167,230,199,231,166, 49,189, 21, 7,170,189, 0,160,157 + dcb 0, 5,230, 49, 96,195,227,194,162,228, 97,226,128,129,130,225 + dcb 64,161,163,224, 96,160,193,196, 32, 98,192, 65, 0,131,229,164 + dcb 33, 99,197, 66,132, 1,230, 34,165, 67,100,198, 2, 3, 68, 6 + dcb 35,133,166, 5,101, 4,199, 7, 36,231, 69,134,167, 37, 38,102 + dcb 135, 70,232, 71, 39,103,136,200,168, 8, 11, 10,169,233,104, 9 + dcb 12,137,201, 13, 40, 44, 72, 43,170, 42, 45, 41,105, 73,202, 14 + dcb 138,234, 74, 75,106,203, 76,171, 46, 77,235,107,139, 15,108,172 + dcb 174,140,173,141,142,204,109,206,207,205, 78,175, 47,236,239,143 + dcb 237,238,110,240,241,111,208, 16, 79,176,209,242, 48,144,243, 80 + dcb 177,244,112,210, 17, 49,178,179, 52, 53,147, 18, 81,211,145, 19 + dcb 146, 51, 85,180, 20, 54,113,148, 22, 50, 84,212, 21, 55,115,245 + dcb 83,114,116, 23, 82, 86, 88, 89, 87,118,117,119,149,213, 56, 57 + dcb 181,214, 90,121,122,150,151,182,183,215,246, 58,120,247, 24,153 + dcb 184,152,216, 25, 26, 59, 91,248,123,185, 27, 60,217,154, 28, 92 + dcb 249, 29,155,186, 61,218, 93,124,250,187, 30,251, 62,156, 94,125 + dcb 219,188, 31,252,254,220,253, 63,126,255,157,221, 95,159,191,222 + dcb 127,189,223,158,190,165, 66, 41,224,208, 72,165, 66, 24,105, 1 + dcb 41, 31,133, 66,165, 67,240, 7,198, 67,169, 0, 76, 97, 8,198 + dcb 69,240,247, 16, 37,166, 64,230, 64,189,177, 9, 16, 15, 41,127 + dcb 133, 67, 73,127,208,228,169, 1,133, 70, 76, 42, 8,170,189,117 + dcb 8,133, 69,234,234,189,181, 8,133, 65,166, 65,230, 65,189,245 + dcb 8,133, 68,165, 66, 24,105,224,133, 66,166, 66,169, 1,102, 68 + dcb 42,157, 0,160, 96, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 + dcb 3, 2, 3, 3, 3, 3, 3, 1, 2, 3, 1, 5, 3, 3, 3, 3 + dcb 3, 2, 2, 3, 3, 5, 4, 3, 3, 5, 4, 4, 4, 3, 3, 4 + dcb 4, 1, 3, 4, 3, 5, 5, 5, 4, 5, 4, 4, 3, 4, 4, 7 + dcb 4, 4, 4, 2, 1, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30 + dcb 32, 35, 35, 38, 40, 43, 46, 49, 50, 52, 4, 55, 55, 60, 63, 65 + dcb 68, 71, 73, 75, 78, 78, 33, 83, 86, 89, 94, 98,102,106,109,112 + dcb 116, 94,120,123,127,130,134,139,144,148,153,157,161,164,167,171 + dcb 178,171,182,186, 5, 56, 68, 56, 36,124, 4, 76, 84, 36, 68, 84 + dcb 40, 24, 40,124,100, 84, 88, 56, 84, 72, 76, 80, 96, 40, 84, 40 + dcb 36, 84, 56, 44, 28,124, 36, 24, 24, 36,124, 24, 52, 16, 60, 80 + dcb 24, 37, 30,124, 32, 28,188, 1,190,124, 24, 36, 60, 32, 28, 32 + dcb 28, 24, 36, 24, 63, 36, 24, 36, 63, 60, 16, 32, 52, 44,120, 36 + dcb 56, 4, 60, 56, 4, 56, 4, 56, 57, 6, 56, 44, 52, 36, 12, 48 + dcb 208, 48, 12,252,164,164, 88,120,132,132, 72,252,132,132,120,252 + dcb 164,132,252,160,128,120,132,164, 56,252, 32, 32,252, 8, 4,248 + dcb 252, 48, 80,140,252, 4, 4,252, 64, 60, 64,252, 64, 48, 8,252 + dcb 120,132,132,132,120,252,144,144, 96,120,132,134,133,120,252,144 + dcb 144,108, 68,164,164,152,128,252,128,248, 4, 4,248, 4, 8,240 + dcb 224, 28, 16,224, 28, 16,224,204, 48, 48,204,140,148,164,196, 0 + dcb 0,133, 41, 10, 28, 29, 63, 63, 63,136, 15, 10, 28, 29, 14, 27 + dcb 63, 63, 63,132, 55, 17, 18, 28, 62, 18, 28, 62, 10,136, 27, 14 + dcb 10, 21, 21, 34,143, 15, 10, 28, 29,142, 39, 40, 48, 50,149,145 + dcb 10, 23, 13, 62, 23, 24, 32,136, 28, 24, 22, 14,136, 11, 14, 10 + dcb 30, 29, 18, 15, 30, 21,128, 14, 15, 15, 14, 12, 29, 28, 63, 63 + dcb 63,144,159,255, 55, 17, 18, 28, 62, 18, 28, 62, 10, 21, 21,129 + dcb 15, 24, 27, 62, 23, 24, 32,136, 11, 34, 14, 63, 63, 63,141, 63 + dcb 63, 63, 11, 34, 14,150,159,143, 11, 34, 62, 39, 48, 54, 38, 2 + dcb 0, 0, 7, 63, 5, 63, 2, 9, 11, 34, 62, 39, 48, 54, 38, 2 + dcb 0, 0, 7, 63, 5, 63, 2, 9, 11, 34, 62, 39, 48, 54, 38, 2 + dcb 0, 0, 7, 63, 5, 63, 2, 9,143,159,255,169, 0,133, 42,169 + dcb 1,133, 44,133, 45,169, 0,133, 32,169,160,133, 33,165, 42,133 + dcb 43,162, 15,160, 15,145, 32, 24,101, 44,230, 44,136, 16,246,165 + dcb 32, 24,105, 32,133, 32,165, 33,105, 0,133, 33,169, 1,133, 44 + dcb 165, 43, 24,101, 45,133, 43,230, 45,202, 16,215,169, 0,133, 32 + dcb 169,160,133, 33,169,224,133, 34,169, 3,133, 35,169, 0,133, 36 + dcb 169, 4,133, 37,169,240,133, 38,169, 3,133, 39,169, 16,133, 40 + dcb 169, 4,133, 41,169, 15,133, 46,160, 15,177, 32, 74, 74, 74, 74 + dcb 170,189, 62, 11,209, 34,240, 18,145, 34,145, 36,170,152, 73, 15 + dcb 168,138,145, 38,145, 40,152, 73, 15,168,136, 16,221,165, 32, 24 + dcb 105, 32,133, 32,165, 33,105, 0,133, 33,165, 34, 24,105,224,133 + dcb 34,165, 35,105,255,133, 35,165, 36, 24,105, 32,133, 36,165, 37 + dcb 105, 0,133, 37,165, 38, 24,105,224,133, 38,165, 39,105,255,133 + dcb 39,165, 40, 24,105, 32,133, 40,165, 41,105, 0,133, 41,198, 46 + dcb 16,150,230, 42,165, 42, 41, 63,240, 3, 76, 95, 10, 96, 0, 11 + dcb 12, 15, 1, 15, 12, 11, 0, 11, 12, 15, 1, 15, 12, 11, 0, 11 + dcb 12, 15, 1, 15, 12, 11, 0, 11, 12, 15, 1, 15, 12, 11,169, 1 + dcb 162,255,134, 16,162, 1,134, 17, 32, 3, 6,169, 2,162, 7,134 + dcb 16,162, 2,134, 17, 32, 3, 6,169, 3,162, 7,134, 16,162, 3 + dcb 134, 17, 32, 3, 6,169, 31,133, 66,169, 0,133, 70,133, 67,133 + dcb 64,169, 1,141,109, 8,169, 0,141,114, 8,169,160,141,115, 8 + dcb 169, 63,133, 48,169,128,133, 49,169, 3,141,109, 8,169, 0,170 + dcb 157, 0,160,232,208,250, 32, 33, 6, 32,170, 6, 32, 6, 7, 32 + dcb 21, 8,165, 66, 73, 31,208, 13,173,109, 8, 24,105, 2, 41, 3 + dcb 105, 3,141,109, 8,165, 49,208,221,173, 17, 7, 73, 1,141, 17 + dcb 7,165, 70,240,209, 32, 29, 12, 32, 91, 10,169, 31,133, 66,169 + dcb 0,133, 70,133, 67,141,109, 8,169, 0,141,114, 8,169, 3,141 + dcb 115, 8, 32, 29, 12, 32, 21, 8,165, 66, 73, 31,208,247,173,115 + dcb 8, 73, 7,141,115, 8,165, 70,240,235, 76, 94, 11,169, 0,170 + dcb 157, 0, 2,157, 0, 3,157, 0, 4,157, 0, 5,232,208,241, 96 + diff --git a/hacks/images/m6502/dmsc.txt b/hacks/images/m6502/dmsc.txt new file mode 100644 index 0000000..7e19f6b --- /dev/null +++ b/hacks/images/m6502/dmsc.txt @@ -0,0 +1,768 @@ +; +; 6502 Assembler Demo. +; Copyright (C) 2007 Daniel Serpell <daniel.serpell@gmail.com> +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; +; 1. Redistributions of source code must retain the above copyright notice, +; this list of conditions and the following disclaimer. +; +; 2. Redistributions in binary form must reproduce the above copyright notice, +; this list of conditions and the following disclaimer in the documentation +; and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; + +; Variable definitions + temp0 = $20 + temp1 = $21 + temp2 = $22 + temp3 = $23 + temp4 = $24 + temp5 = $25 + + param0 = $10 + param1 = $11 + param2 = $12 + param3 = $13 + + +; Output file + !to "all.bin", plain + +; Start of code + *= $600 + jmp main + +; Used in "gira" and "circ" + + gira_pos = $30 + gira_scr = $200 + circ_pos = $30 + circ_scr = $210 + show_pos = $31 + show_source = $a000 + show_dest = $500 + text_state = $40 + text_scr = $a000 +; text_scr = $480 + moire_buf = $a000 + moire_scr = $200 + moire_temp = $20 + +; Include routines and macros + +: =========================================================================== +: !source "fillRect.asm" +: =========================================================================== + + !zone { + +; Uses the following: +; params: param0, param1 +; temps: temp0 + + +; Locals + .color = temp0 + +; Params + fillRect_buffer = param0 + .buf = fillRect_buffer + +; fillRect: +; Fill a rectangle of 8x8 pixels with a color. +; input: A = color index +; .buffer = output buffer (address) + !macro fillRect .buffer { + ldx #<.buffer + stx fillRect_buffer + ldx #>.buffer + stx fillRect_buffer+1 + jsr fillRect_code + } + +; fillRect: +; Fill a rectangle of 8x8 pixels with a color. +; input: .color = color index +; .buffer = output buffer (address) + !macro fillRect .buffer, .color { + lda #.color + +fillRect .buffer + } + +fillRect_code: + sta .color + ldx #8 +-- + ldy #8 +- + sta (.buf),y + dey + bne - + + lda .buf + clc + adc #32 + sta .buf + lda .buf+1 + adc #0 + sta .buf+1 + lda .color + dex + bne -- + + rts + +} + + +: =========================================================================== +: !source "gira.asm" +: =========================================================================== + + !zone { + +; +; define "gira_pos" and "gira_scr" before including +; + .pos = gira_pos + .scr00 = gira_scr + .scr01 = gira_scr + $8 + .scr10 = gira_scr + $100 + .scr11 = gira_scr + $108 + +; gira: + !macro gira { + jsr gira_code + } + +; init code: + !macro giraInit { + +fillRect gira_scr-1, 1 + +fillRect gira_scr+7, 2 + +fillRect gira_scr+$107, 3 + } + +gira_code: + + inc .pos + lda .pos + and #63 + sta .pos + tax + + lda .tabla,x + tax + lda .scr11,x + adc #1 + and #3 + + sta .scr11,x + txa + eor #$E7 + tax + lda .scr00,x + adc #1 + and #3 + sta .scr00,x + + lda .pos + eor #63 + tax + lda .tabla,x + eor #$E0 + tax + lda .scr01,x + adc #1 + and #3 + sta .scr01,x + + txa + eor #$E7 + tax + lda .scr10,x + adc #1 + and #3 + sta .scr10,x + + rts + +.tabla + !byte 224, 192, 160, 128, 96, 225, 64, 193, 161, 226, 129, 32, 194, 97, 162, 227 + !byte 195, 130, 228, 65, 163, 196, 98, 229, 131, 164, 197, 230, 231, 132, 165, 198 + !byte 99, 66, 33, 0, 199, 166, 133, 100, 167, 67, 134, 101, 135, 34, 68, 102 + !byte 103, 69, 35, 70, 71, 36, 1, 37, 38, 39, 2, 3, 4, 5, 6, 7 + +} + +: =========================================================================== +: !source "circ.asm" +: =========================================================================== + + !zone { +; +; define "circ_pos" before including +; + + .pos = circ_pos + .scr00 = circ_scr + .scr01 = circ_scr + $8 + .scr10 = circ_scr + $100 + .scr11 = circ_scr + $108 + +; circ: + !macro circ { + jsr circ_code + } + +circ_code: + + ldx .pos + lda .tabla,x + tax + inc .scr11,x + eor #07 + tax + inc .scr10,x + eor #$e7 + tax + inc .scr01,x + eor #07 + tax + inc .scr00,x + + rts + +.tabla + !byte 0, 32, 1, 33, 64, 2, 65, 34, 96, 66, 3, 97, 35, 98, 67, 128 + !byte 4, 129, 36, 99, 130, 68, 160, 5, 161, 131, 100, 37, 162, 69, 132, 192 + !byte 163, 101, 6, 193, 38, 194, 70, 164, 133, 195, 102, 224, 7, 225, 39, 165 + !byte 226, 196, 134, 71, 227, 103, 197, 166, 228, 135, 198, 229, 167, 230, 199, 231 + +} + + +: =========================================================================== + !source "mapcopy.asm" +: =========================================================================== + + !zone { + +; +; define "show_pos" and "show_scr" before including +; + .pos = show_pos + .source = show_source + .dest = show_dest + +; show: + !macro show { + jsr show_code + } + +show_code + ldx .pos + lda .tabla,x + tax +.source_label + lda .source,x +.dest_label + sta .dest,x + inc .pos + rts + + show_source_addr = .source_label + 1 + show_dest_addr = .dest_label + 1 + +.tabla + !byte 195, 227, 194, 162, 228, 97, 226, 128, 129, 130, 225, 64, 161, 163, 224, 96 + !byte 160, 193, 196, 32, 98, 192, 65, 0, 131, 229, 164, 33, 99, 197, 66, 132 + !byte 1, 230, 34, 165, 67, 100, 198, 2, 3, 68, 6, 35, 133, 166, 5, 101 + !byte 4, 199, 7, 36, 231, 69, 134, 167, 37, 38, 102, 135, 70, 232, 71, 39 + !byte 103, 136, 200, 168, 8, 11, 10, 169, 233, 104, 9, 12, 137, 201, 13, 40 + !byte 44, 72, 43, 170, 42, 45, 41, 105, 73, 202, 14, 138, 234, 74, 75, 106 + !byte 203, 76, 171, 46, 77, 235, 107, 139, 15, 108, 172, 174, 140, 173, 141, 142 + !byte 204, 109, 206, 207, 205, 78, 175, 47, 236, 239, 143, 237, 238, 110, 240, 241 + !byte 111, 208, 16, 79, 176, 209, 242, 48, 144, 243, 80, 177, 244, 112, 210, 17 + !byte 49, 178, 179, 52, 53, 147, 18, 81, 211, 145, 19, 146, 51, 85, 180, 20 + !byte 54, 113, 148, 22, 50, 84, 212, 21, 55, 115, 245, 83, 114, 116, 23, 82 + !byte 86, 88, 89, 87, 118, 117, 119, 149, 213, 56, 57, 181, 214, 90, 121, 122 + !byte 150, 151, 182, 183, 215, 246, 58, 120, 247, 24, 153, 184, 152, 216, 25, 26 + !byte 59, 91, 248, 123, 185, 27, 60, 217, 154, 28, 92, 249, 29, 155, 186, 61 + !byte 218, 93, 124, 250, 187, 30, 251, 62, 156, 94, 125, 219, 188, 31, 252, 254 + !byte 220, 253, 63, 126, 255, 157, 221, 95, 159, 191, 222, 127, 189, 223, 158, 190 + +} + + +: =========================================================================== + !source "text.asm" +: =========================================================================== + + !zone { + +; +; define: +; "text_state": 8 bytes of internal state +; "text_scr" : output screen address +; "text_data" : text character data +; + text_char = text_state + 0 + .fps = text_state + 1 + text_pixel = text_state + 2 + text_skip = text_state + 3 + .cb = text_state + 4 + .fsz = text_state + 5 + text_endFlag = text_state + 6 + .scr = text_scr + .data = text_data + + ; abbreviations + .pos = text_char + .cxy = text_pixel + .skp = text_skip + +; "pos" pointer to the next character +; "cxy" screen position +; "fps" position in font data of current character +; "fsz" remaining bytes of current character +; "skp" skip data, used in spaces, begining and ending +; "cb" current output byte (8 bits, one column) + +; text: + !macro text { + jsr text_code + } + + !macro textInit1 { + lda #$1f + sta text_pixel + lda #0 + sta text_endFlag + sta text_skip + sta text_char + lda #1 + sta text_base_color + lda #<text_scr + sta text_dest_addr + lda #>text_scr + sta text_dest_addr+1 + } + + !macro textInit2 .scrOut { + lda #$1f + sta text_pixel + lda #0 + sta text_endFlag + sta text_skip + sta text_base_color + lda #<.scrOut + sta text_dest_addr + lda #>.scrOut + sta text_dest_addr+1 + } + + +text_code + + lda .cxy + and #$e0 + bne .putpixel ; If we have more pixels, put them + + ; To next x coord + lda .cxy + clc + adc #1 + and #$1f + sta .cxy + + ; If we are in "skip" mode, skip :-) + lda .skp + beq .noskip + +.doSkip + ; skip this step (filling with blanks) + dec .skp + +.storeColumn0 + lda #0 + jmp .storeColumn + +.noskip + ; Continue font data + dec .fsz + + ; Skip just one column if just at the end of character + beq .storeColumn0 + + bpl .nextcolumn ; More columns + + ; Get next character + ldx .pos + inc .pos + lda .data, x + bpl .fontdata + + ; A > 128, skip "A-128" characters + and #$7F + sta .skp + + ; If skip == 127 (value=255), signal the end of text data + eor #$7F + bne .storeColumn0 + + lda #1 + sta text_endFlag + jmp .storeColumn0 + +.fontdata + tax + lda .font_size,x + sta .fsz + dec .fsz + + lda .font_pos,x + sta .fps + +.nextcolumn + ldx .fps + inc .fps + lda .font_data, x + +.storeColumn + sta .cb + ; skip over to putpixel + +.putpixel + lda .cxy + clc + adc #$e0 + sta .cxy + ldx .cxy +.base_color + lda #1 + ror .cb + rol +.dest_label + sta .scr,x + rts + + text_base_color = .base_color + 1 + text_dest_addr = .dest_label + 1 + +; font +.font_size: + !byte 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 3, 3, 3, 3, 3, 1, 2, 3, 1 + !byte 5, 3, 3, 3, 3, 3, 2, 2, 3, 3, 5, 4, 3, 3, 5, 4, 4, 4, 3, 3, 4, 4 + !byte 1, 3, 4, 3, 5, 5, 5, 4, 5, 4, 4, 3, 4, 4, 7, 4, 4, 4, 2, 1 +.font_pos: + !byte 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 32, 35 + !byte 35, 38, 40, 43, 46, 49, 50, 52, 4, 55, 55, 60, 63 + !byte 65, 68, 71, 73, 75, 78, 78, 33, 83, 86, 89, 94, 98 + !byte 102, 106, 109, 112, 116, 94, 120, 123, 127, 130, 134, 139, 144 + !byte 148, 153, 157, 161, 164, 167, 171, 178, 171, 182, 186, 5 +.font_data: + !byte 56, 68, 56, 36,124, 4, 76, 84, 36, 68, 84, 40, 24, 40,124,100 + !byte 84, 88, 56, 84, 72, 76, 80, 96, 40, 84, 40, 36, 84, 56, 44, 28 + !byte 124, 36, 24, 24, 36,124, 24, 52, 16, 60, 80, 24, 37, 30,124, 32 + !byte 28,188, 1,190,124, 24, 36, 60, 32, 28, 32, 28, 24, 36, 24, 63 + !byte 36, 24, 36, 63, 60, 16, 32, 52, 44,120, 36, 56, 4, 60, 56, 4 + !byte 56, 4, 56, 57, 6, 56, 44, 52, 36, 12, 48,208, 48, 12,252,164 + !byte 164, 88,120,132,132, 72,252,132,132,120,252,164,132,252,160,128 + !byte 120,132,164, 56,252, 32, 32,252, 8, 4,248,252, 48, 80,140,252 + !byte 4, 4, 252, 64, 60, 64,252, 64, 48, 8,252,120,132,132,132,120 + !byte 252,144,144, 96,120,132,134,133,120,252,144,144,108, 68,164,164 + !byte 152,128,252,128,248, 4, 4,248, 4, 8,240,224, 28, 16,224, 28 + !byte 16,224,204, 48, 48,204,140,148,164,196, 0, 0 + + +text_data + !byte (128+5), 41, 10, 28, 29, 63, 63, 63 + !byte (128+8), 15, 10, 28, 29, 14, 27, 63, 63, 63 + !byte (128+4), 55, 17, 18, 28, 62, 18, 28, 62, 10 + !byte (128+8), 27, 14, 10, 21, 21, 34 + !byte (128+15), 15, 10, 28, 29 + !byte (128+14), 39, 40, 48, 50 + !byte (128+21) + !byte (128+17), 10, 23, 13, 62, 23, 24, 32 + !byte (128+8), 28, 24, 22, 14 + !byte (128+8), 11, 14, 10, 30, 29, 18, 15, 30, 21 + !byte (128+0), 14, 15, 15, 14, 12, 29, 28, 63, 63, 63 + !byte (128+16) + !byte (128+31) + !byte 255 + !byte 55, 17, 18, 28, 62, 18, 28, 62, 10, 21, 21 + !byte (128+1), 15, 24, 27, 62, 23, 24, 32 + !byte (128+8), 11, 34, 14, 63, 63, 63 + !byte (128+13), 63, 63, 63, 11, 34, 14 + !byte (128+22) + !byte (128+31) + !byte (128+15), 11, 34, 62, 39, 48, 54, 38 + !byte 2, 0, 0, 7, 63, 5, 63, 2, 9 + !byte 11, 34, 62, 39, 48, 54, 38 + !byte 2, 0, 0, 7, 63, 5, 63, 2, 9 + !byte 11, 34, 62, 39, 48, 54, 38 + !byte 2, 0, 0, 7, 63, 5, 63, 2, 9 + !byte (128+15) + !byte (128+31) + !byte 255 + +} + + +: =========================================================================== + !source "moireSmooth.asm" +: =========================================================================== + + !zone { + +; Parameters (consts) + .scr = moire_scr + .buf = moire_buf +; Variables + .p1 = moire_temp + .o1 = moire_temp + 2 + .o2 = moire_temp + 4 + .o3 = moire_temp + 6 + .o4 = moire_temp + 8 + .iter = moire_temp + 10 + .valStartX = moire_temp + 11 + .deltaX = moire_temp + 12 + .deltaY = moire_temp + 13 + .yPos = moire_temp + 14 + +; moire!: + !macro moire { + jsr moire_code + } + + !macro add16 .var, .value { + lda .var + clc + adc #<.value + sta .var + lda .var+1 + adc #>.value + sta .var+1 + } + + !macro sto16 .var, .value { + lda #<.value + sta .var + lda #>.value + sta .var+1 + } + +moire_code: + + lda #0 + sta .iter + +.loop: + + lda #1 + sta .deltaX + sta .deltaY + + +sto16 .p1, .buf + + lda .iter + sta .valStartX + + ldx #15 +-- + ldy #15 +- + sta (.p1),y + clc + adc .deltaX + inc .deltaX + dey + bpl - + + +add16 .p1, $0020 + + lda #1 + sta .deltaX + + lda .valStartX + clc + adc .deltaY + sta .valStartX + inc .deltaY + + dex + bpl -- + + +; update screen + +sto16 .p1, .buf + +sto16 .o1, .scr + $01E0 + +sto16 .o2, .scr + $0200 + +sto16 .o3, .scr + $01F0 + +sto16 .o4, .scr + $0210 + + lda #15 + sta .yPos +-- + ldy #15 +- + lda (.p1),y + lsr + lsr + lsr + lsr + tax + lda .tabCol,x + + cmp (.o1),y + beq .noCopy + sta (.o1),y + sta (.o2),y + tax + tya + eor #15 + tay + txa + sta (.o3),y + sta (.o4),y + tya + eor #15 + tay +.noCopy: + dey + bpl - + + +add16 .p1, $0020 + +add16 .o1, $FFE0 + +add16 .o2, $0020 + +add16 .o3, $FFE0 + +add16 .o4, $0020 + + dec .yPos + bpl -- + + inc .iter + lda .iter + and #$3f + beq + + jmp .loop ++ + rts + +.tabCol + !byte 0,11,12,15,1,15,12,11 + !byte 0,11,12,15,1,15,12,11 + !byte 0,11,12,15,1,15,12,11 + !byte 0,11,12,15,1,15,12,11 + +} + +: =========================================================================== + + +; Main loop + +main + + +giraInit + +textInit1 + lda #63 + sta gira_pos + + ; Start show-pos from middle of screen + lda #128 + sta show_pos + + ; First color is 3 + lda #3 + sta text_base_color + + ; Clear old text image + lda #0 + tax +- + sta text_scr,x + inx + bne - + +loop + +gira + +circ + +show + +text + + lda text_pixel + eor #$1f + bne notChangeTextColor + lda text_base_color + clc + adc #2 + and #3 + adc #3 + sta text_base_color + +notChangeTextColor + + lda show_pos + bne loop + + lda show_dest_addr+1 + eor #1 + sta show_dest_addr+1 + + lda text_endFlag + beq loop + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; End of first text, do moire! + jsr clearScr + +moire + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; End of moire, do ending text + +textInit2 $300 + jsr clearScr + +; loop text output +- + +text + + lda text_pixel + eor #$1f + bne - + lda text_dest_addr+1 + eor #7 + sta text_dest_addr+1 + + lda text_endFlag + beq - + + jmp main + +clearScr + ; Clear screen + lda #0 + tax +- + sta $200,x + sta $300,x + sta $400,x + sta $500,x + inx + bne - + rts + diff --git a/hacks/images/m6502/dragon-fractal.asm b/hacks/images/m6502/dragon-fractal.asm new file mode 100644 index 0000000..ce05ad4 --- /dev/null +++ b/hacks/images/m6502/dragon-fractal.asm @@ -0,0 +1,49 @@ +;; dmsc +;; +;; PostPosted: Thu Dec 13, 2007 11:57 pm Post subject: Dragon curve +;; fractal +;; +;; +;; Hi! +;; +;; This draws the dragon curve fractal (really a "twin dragon"): + +lda #0 + sta $0 + +lop: + lda $0 + sta $1 + lda #3 + sta $6 + lda #232 + sta $5 + + ldx #0 +lpN: + lsr $1 + bcc nos + lda $5 + clc + adc tL,x + sta $5 + lda $6 + adc tH,x + sta $6 +nos: + inx + lda $1 + bne lpN + inx + txa + ldy #0 + sta ($5),y + + inc $0 + bne lop + rts + +tL: + dcb 32, 31, 254, 190, 128, 132, 8, 8 +tH: + dcb 0, 0, 255, 255, 255, 255, 0, 1 diff --git a/hacks/images/m6502/fullscreenlogo.asm b/hacks/images/m6502/fullscreenlogo.asm new file mode 100644 index 0000000..6f9b079 --- /dev/null +++ b/hacks/images/m6502/fullscreenlogo.asm @@ -0,0 +1,107 @@ +;
+; draw image
+;
+
+start:
+ lda #<logo
+ sta $0
+ lda #>logo
+ sta $1
+
+ lda #$00
+ sta $2
+ lda #$02
+ sta $3
+
+ ldx #$0
+l:
+ lda ($0,x)
+ sta ($2,x)
+
+ inc $00
+ lda $00
+ cmp #$00
+ bne notReset1
+ inc $01
+notReset1:
+
+ inc $02
+ lda $02
+ cmp #$00
+ bne notReset2
+ lda $03
+ cmp #$05
+ beq done
+ inc $03
+notReset2:
+
+ jmp l
+done:
+ rts
+
+logo:
+ dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,6,6,6
+ dcb 6,6,6,6,1,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,1,1,1,1,1,6,6,6,6,6,6
+ dcb 6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,1,1,1,6,6,6,6,6,6,6,6
+ dcb 6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,1,1,6,6,6,6,6,6,6,6,6
+ dcb 6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,1,6,6,6,6,6,6,6,6,6,6
+ dcb 6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1
+ dcb 1,1,1,1,1,6,6,6,6,6,6,6,6,6,6,6
+ dcb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ynetic +;Jeremy English 2013 + +lda #$0 +sta $0 +lda #$2 +sta $1 + +start: +lda $1 +cmp #$6 +bne randOffset +lda #$2 +sta $1 + +randOffset: +;move position by some random offset +clc +lda $fe +adc $0 +sta $0 +lda $1 +adc #$0 +sta $1 +cmp #$06 ;Did we go out of range +bne setRect ;Nope +lda #$02 ;Start back at the top +sta $1 + +setRect: +lda $fe +and #$f +tax +inx ;at least 1 +stx $2 ;width +stx $3 ;working copy +lda $fe +and #$f +tax +inx ;at least 1 +stx $4 ;height + +lda $fe +sta $5 ;color + +ldy #0 +draw: +lda $5 +sta ($0), y +dec $3 +beq down + +lda $0 +clc +adc #$1 +sta $0 +lda $1 +adc #$0 +sta $1 +cmp #$06 ;Did we go out of range +beq done ;yes +jmp draw + +down: + +;;Move back to the start of this row +ldx $2 ;The width of the rectangle +dex +lda $0 +stx $0 +sec +sbc $0 +sta $0 +lda $1 +sbc #$0 +sta $1 + +;;Move down one row +dec $4 +beq done ;;Are we done drawing? + +lda $2 +sta $3 ;reset the width counter + +lda $0 +clc +adc #$20 +sta $0 +lda $1 +adc #$0 +sta $1 +cmp #$06 ;Did we go out of range +beq done ;yes +jmp draw +done: +jmp start diff --git a/hacks/images/m6502/keftal.asm b/hacks/images/m6502/keftal.asm new file mode 100644 index 0000000..efb2982 --- /dev/null +++ b/hacks/images/m6502/keftal.asm @@ -0,0 +1,82 @@ +; awfully slow.. be patient + +init: + ldx #0 + stx $0 + inx + stx $2 + stx $3 + inx + stx $1 + +loop: + lda $2 + cmp #$20 + bne notIncF2 + inc $3 + lda #0 + sta $2 +notIncF2: + inc $2 + +; CALCULATE START + + lda $2 + sta $f1 + lda $2 + sta $f2 + jsr multiply + + lda $f4 + sta $f8 + + lda $3 + sta $f1 + lda $3 + sta $f2 + jsr multiply + +; CALCULATE STOP + + lda $f4 + clc + adc $f8 + + lsr + lsr + lsr + lsr + lsr + ldx #0 + sta ($0,x) + inc $0 + lda $0 + cmp #$00 + bne notNextY + inc $1 + lda $1 + cmp #6 + beq exit +notNextY: + jmp loop +exit: + rts + +multiply: + lda #0 + sta $f4 + sta $f5 + ldx #8 +a:asl $f4 + rol $f5 + asl $f2 + bcc b + clc + lda $f4 + adc $f1 + sta $f4 + bcc b + inc $f5 +b:dex + bne a + rts
\ No newline at end of file diff --git a/hacks/images/m6502/life.asm b/hacks/images/m6502/life.asm new file mode 100644 index 0000000..6454812 --- /dev/null +++ b/hacks/images/m6502/life.asm @@ -0,0 +1,127 @@ +; Conway\'s Game of Life +; http://rosettacode.org/wiki/Conway\'s_Game_of_Life +; Submitted by Anonymous + +randfill: stx $01 ;$200 for indirect + ldx #$02 ;addressing + stx $02 +randloop: lda $fe ;generate random + and #$01 ;pixels on the + sta ($01),Y ;screen + jsr inc0103 + cmp #$00 + bne randloop + lda $02 + cmp #$06 + bne randloop + + +clearmem: lda #$df ;set $07df-$0a20 + sta $01 ;to $#00 + lda #$07 + sta $02 +clearbyte: lda #$00 + sta ($01),Y + jsr inc0103 + cmp #$20 + bne clearbyte + lda $02 + cmp #$0a + bne clearbyte + + +starttick: +copyscreen: lda #$00 ;set up source + sta $01 ;pointer at + sta $03 ;$01/$02 and + lda #$02 ;dest pointer + sta $02 ;at $03/$04 + lda #$08 + sta $04 + ldy #$00 +copybyte: lda ($01),Y ;copy pixel to + sta ($03),Y ;back buffer + jsr inc0103 ;increment pointers + cmp #$00 ;check to see + bne copybyte ;if we\'re at $600 + lda $02 ;if so, we\'ve + cmp #$06 ;copied the + bne copybyte ;entire screen + + +conway: lda #$df ;apply conway rules + sta $01 ;reset the pointer + sta $03 ;to $#01df/$#07df + lda #$01 ;($200 - $21) + sta $02 ;($800 - $21) + lda #$07 + sta $04 +onecell: lda #$00 ;process one cell + ldy #$01 ;upper cell + clc + adc ($03),Y + ldy #$41 ;lower cell + clc + adc ($03),Y +chkleft: tax ;check to see + lda $01 ;if we\'re at the + and #$1f ;left edge + tay + txa + cpy #$1f + beq rightcells +leftcells: ldy #$00 ;upper-left cell + clc + adc ($03),Y + ldy #$20 ;left cell + clc + adc ($03),Y + ldy #$40 ;lower-left cell + clc + adc ($03),Y +chkright: tax ;check to see + lda $01 ;if we\'re at the + and #$1f ;right edge + tay + txa + cpy #$1e + beq evaluate +rightcells: ldy #$02 ;upper-right cell + clc + adc ($03),Y + ldy #$22 ;right cell + clc + adc ($03),Y + ldy #$42 ;lower-right cell + clc + adc ($03),Y +evaluate: ldx #$01 ;evaluate total + ldy #$21 ;for current cell + cmp #$03 ;3 = alive + beq storex + ldx #$00 + cmp #$02 ;2 = alive if + bne storex ;c = alive + lda ($03),Y + and #$01 + tax +storex: txa ;store to screen + sta ($01),Y + jsr inc0103 ;move to next cell +conwayloop: cmp #$e0 ;if not last cell, + bne onecell ;process next cell + lda $02 + cmp #$05 + bne onecell + jmp starttick ;run next tick + + +inc0103: lda $01 ;increment $01 + cmp #$ff ;and $03 as 16-bit + bne onlyinc01 ;pointers + inc $02 + inc $04 +onlyinc01: inc $01 + lda $01 + sta $03 + rts diff --git a/hacks/images/m6502/lines.asm b/hacks/images/m6502/lines.asm new file mode 100644 index 0000000..152d5fb --- /dev/null +++ b/hacks/images/m6502/lines.asm @@ -0,0 +1,313 @@ +; -*- mode: c; tab-width: 4; fill-column: 128 -*- +; vi: set ts=4 tw=128: + +; Lines, Copyright (c) 2018 Dave Odell <dmo2118@gmail.com> +; +; Permission to use, copy, modify, distribute, and sell this software and its +; documentation for any purpose is hereby granted without fee, provided that +; the above copyright notice appear in all copies and that both that +; copyright notice and this permission notice appear in supporting +; documentation. No representations are made about the suitability of this +; software for any purpose. It is provided "as is" without express or +; implied warranty. + +; Another port of 20 year old QBasic code. + + + +main_loop: + lda #$00 + sta $0 + +y_loop: + ldx $0 + + lda #1 + bit $1 + beq left_right + + ; Up-down. Skip all blank columns. + lda x_px0,x + and #1 + bne fill + jmp next_y ; next_y is too far to conditional-branch from here. + +clear: + ldx #1 + lda $0 + clc + adc #$20 + tay + + sec +clear_loop: + lda #0 ; $fe + sta $0200,y + sta $0240,y + sta $0280,y + sta $02c0,y + sta $0300,y + sta $0340,y + sta $0380,y + sta $03c0,y + sta $0400,y + sta $0440,y + sta $0480,y + sta $04c0,y + sta $0500,y + sta $0540,y + sta $0580,y + sta $05c0,y + tya + sbc #$20 + tay + dex + bpl clear_loop + jmp next_y + +left_right: + ; Repaint columns that were previously on. + lda x_px0,x + bit const_two + beq next_y + lda x_px0,x + and #1 + beq clear + ;jmp fill + +fill: + ldx #1 + lda $0 + clc + adc #$20 + tay + + sec +fill_loop: + ; 3 * 2 * 16 = 96 bytes + lda y_px0,x + sta $0200,y + lda y_px1,x + sta $0240,y + lda y_px2,x + sta $0280,y + lda y_px3,x + sta $02c0,y + lda y_px4,x + sta $0300,y + lda y_px5,x + sta $0340,y + lda y_px6,x + sta $0380,y + lda y_px7,x + sta $03c0,y + lda y_px8,x + sta $0400,y + lda y_px9,x + sta $0440,y + lda y_pxa,x + sta $0480,y + lda y_pxb,x + sta $04c0,y + lda y_pxc,x + sta $0500,y + lda y_pxd,x + sta $0540,y + lda y_pxe,x + sta $0580,y + lda y_pxf,x + sta $05c0,y + tya + sbc #$20 + tay + dex + bpl fill_loop + ;jmp next_y + +next_y: + inc $0 + lda #32 + cmp $0 + beq shift + jmp y_loop + +shift: + lda $fe + and #$3 + sta $1 ; Left, down, right, up. + beq shift_x1 + + cmp #2 + bmi shift_y1 + beq shift_x0 + +shift_y0: + ldx #0 +shift_y0_loop: + lda y_px0,x + eor y_px00,x + sta y_px0,x + inx + cpx #31 + bne shift_y0_loop + jmp main_loop + +shift_y1: + ldx #30 +shift_y1_loop: + lda y_px00,x + eor y_px0,x + sta y_px00,x + dex + bpl shift_y1_loop + jmp main_loop + +shift_x0: + ldx #0 +shift_x0_loop: + ; px[0] = ((px[0] ^ px[1]) & 1) | (px[1] << 1) + lda x_px0,x + eor x_px00,x + lsr ; Save EOR bit in carry flag. + lda x_px00,x + rol ; Restore EOR bit. + sta x_px0,x + inx + cpx #31 + bne shift_x0_loop + jmp main_loop + +shift_x1: + ldx #30 +shift_x1_loop: + lda x_px00,x + eor x_px0,x + lsr + lda x_px0,x + rol + sta x_px00,x + dex + bpl shift_x1_loop + jmp main_loop + +y_px0: + dcb 0 +y_px00: + dcb 0 +y_px1: + dcb 0, 0 +y_px2: + dcb 0, 0 +y_px3: + dcb 0, 0 +y_px4: + dcb 0, 0 +y_px5: + dcb 0, 0 +y_px6: + dcb 0, 0 +y_px7: + dcb 0, 0 +y_px8: + dcb 1, 0 +y_px9: + dcb 0, 0 +y_pxa: + dcb 0, 0 +y_pxb: + dcb 0, 0 +y_pxc: + dcb 0, 0 +y_pxd: + dcb 0, 0 +y_pxe: + dcb 0, 0 +y_pxf: + dcb 0, 0 + + ; Bit 0: black row, bit 1: changed row +x_px0: + dcb 0 +x_px00: + dcb 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + dcb 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +const_two: ; lolz + dcb 2 + +;#include "screenhack.h" +; +;struct _lines +;{ +; unsigned width, height; +; unsigned long delay; +; GC gc; +;}; +; +;static void *lines_init(Display *display, Window window) +;{ +; struct _lines *self = malloc(sizeof(*self)); +; XGCValues gcv; +; XWindowAttributes xgwa; +; +; if(!self) +; abort(); +; +; XGetWindowAttributes(display, window, &xgwa); +; self->width = xgwa.width; +; self->height = xgwa.height; +; +; self->delay = get_integer_resource(display, "delay", "Integer"); +; +; gcv.function = GXxor; +; gcv.foreground = get_pixel_resource(display, xgwa.colormap, "foreground", "Foreground"); +; self->gc = XCreateGC(display, window, GCFunction | GCForeground, &gcv); +; +; XDrawPoint(display, window, self->gc, xgwa.width >> 1, xgwa.height >> 1); +; +; return self; +;} +; +;static unsigned long lines_draw(Display *display, Window window, void *self_raw) +;{ +; struct _lines *self = self_raw; +; static const XPoint xy[] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; +; const XPoint *p = xy + NRAND(4); +; +; XCopyArea(display, window, window, self->gc, 0, 0, self->width, self->height, p->x, p->y); +; return self->delay; +;} +; +;static void lines_reshape(Display *display, Window window, void *self_raw, unsigned width, unsigned height) +;{ +; struct _lines *self = self_raw; +; self->width = width; +; self->height = height; +;} +; +;static Bool lines_event(Display *display, Window window, void *self_raw, XEvent *event) +;{ +; return False; +;} +; +;static void lines_free(Display *display, Window window, void *self_raw) +;{ +; struct _lines *self = self_raw; +; XFreeGC(display, self->gc); +; free(self); +;} +; +;static const char *lines_defaults[] = +;{ +; "*fpsSolid: true", +; "*delay: 30000", +; 0 +;}; +; +;static XrmOptionDescRec lines_options [] = +;{ +; {"-delay", ".delay", XrmoptionSepArg, 0}, +; {0, 0, 0, 0} +;}; +; +;XSCREENSAVER_MODULE ("Lines", lines) diff --git a/hacks/images/m6502/matrix.asm b/hacks/images/m6502/matrix.asm new file mode 100644 index 0000000..0ec27a7 --- /dev/null +++ b/hacks/images/m6502/matrix.asm @@ -0,0 +1,67 @@ +;;Matrix :) + +loop: + lda $fe + and #$1f + tay + tax + lda matrix,y + sta $1 + tay + lda #0 + jsr paint + inc $1 + lda $1 + and #$1f + sta matrix,y + tay + lda #5 + jsr paint + lda $fe + and #$1f + tay + tax + lda matrix,y + sta $1 + tay + lda #$d + jsr paint + lda $fe + and #$1f + tay + tax + lda matrix,y + sta $1 + tay + lda #$5 + jsr paint + jmp loop + +paint: + pha + lda yl,y + sta $2 + lda yh,y + sta $3 + txa + tay + pla + sta ($2),y + rts + +yh: + dcb $02, $02, $02, $02, $02, $02, $02, $02 + dcb $03, $03, $03, $03, $03, $03, $03, $03 + dcb $04, $04, $04, $04, $04, $04, $04, $04 + dcb $05, $05, $05, $05, $05, $05, $05, $05 + +yl: + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + +matrix: + dcb 5,16,19,19,17,26,10,14,11,4,1,2,20,1,8,30 + dcb 17,26,19,19,31,21,11,19,3,24,4,24,13,8,8,26 + diff --git a/hacks/images/m6502/noise.asm b/hacks/images/m6502/noise.asm new file mode 100644 index 0000000..32447d7 --- /dev/null +++ b/hacks/images/m6502/noise.asm @@ -0,0 +1,16 @@ +; static noise + +start: ldy #$ff + ldx #$0 +loop: lda $fe + sta $200,x + and #$7 + sta $300,x + and #$3 + sta $400,x + and #$1 + sta $500,x + inx + dey + bne loop + rts diff --git a/hacks/images/m6502/random-walk.asm b/hacks/images/m6502/random-walk.asm new file mode 100644 index 0000000..4c3bd15 --- /dev/null +++ b/hacks/images/m6502/random-walk.asm @@ -0,0 +1,82 @@ + ;; Jeremy English Dec 11 2007 + ;; Random walk + lda #16 + sta $0 ; The current x pos + sta $1 ; The current y pos + lda $fe ; Get random color + sta $5 ; Store the color + lda $fe ; Amount of time to use this color + sta $6 + +loop: + ldx $0 + ldy $1 + lda $5 + jsr paint + jsr walk + dec $6 + bne loop + ;; get a new color + lda $fe + sta $5 + ;; get a new duration + lda $fe + sta $6 + jmp loop + +walk: + lda $fe + and #3 + cmp #0 + beq right + cmp #1 + beq left + cmp #2 + beq up + jmp down + +right: + inc $0 + jmp done +left: + dec $0 + jmp done +up: + dec $1 + jmp done +down: + inc $1 + jmp done +done: + lda $0 + and #31 + sta $0 + lda $1 + and #31 + sta $1 + rts + +paint: + pha + lda yl,y + sta $2 + lda yh,y + sta $3 + txa + tay + pla + sta ($2),y + rts + + ;; Y cord MSB +yh: + dcb $02, $02, $02, $02, $02, $02, $02, $02 + dcb $03, $03, $03, $03, $03, $03, $03, $03 + dcb $04, $04, $04, $04, $04, $04, $04, $04 + dcb $05, $05, $05, $05, $05, $05, $05, $05 + ;; Y cord LSB +yl: + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 diff --git a/hacks/images/m6502/random.asm b/hacks/images/m6502/random.asm new file mode 100644 index 0000000..9ff5d2d --- /dev/null +++ b/hacks/images/m6502/random.asm @@ -0,0 +1,11 @@ +loop: lda $fe ; A=rnd
+ sta $00 ; ZP(0)=A
+ lda $fe
+ and #$3 ; A=A&3
+ clc ; Clear carry
+ adc #$2 ; A+=2
+ sta $01 ; ZP(1)=A
+ lda $fe ; A=rnd
+ ldy #$0 ; Y=0
+ sta ($00),y ; ZP(0),ZP(1)=y
+ jmp loop
diff --git a/hacks/images/m6502/random2.asm b/hacks/images/m6502/random2.asm new file mode 100644 index 0000000..c209f9f --- /dev/null +++ b/hacks/images/m6502/random2.asm @@ -0,0 +1,11 @@ + lda $fe ; A=rnd
+ sta $00 ; ZP(0)=A
+ lda $fe
+ and #$3 ; A=A&3
+ clc ; Clear carry
+ adc #$2 ; A+=2
+ sta $01 ; ZP(1)=A
+ lda $fe ; A=rnd
+ ldy #$0 ; Y=0
+ sta ($00),y ; ZP(0),ZP(1)=y
+ jmp $600
diff --git a/hacks/images/m6502/rorschach.asm b/hacks/images/m6502/rorschach.asm new file mode 100644 index 0000000..c5591f0 --- /dev/null +++ b/hacks/images/m6502/rorschach.asm @@ -0,0 +1,124 @@ +; "Rorschach test" +; Not at all what it was supposed to be, +; but it turns out pretty cool and can +; create some interesting patterns. + + lda #8 + tax +dr: + sta $3cb,x + sta $40b,x + dex + bpl dr + sta $3f3 + sta $3eb + + lda #1 + sta $3ec + + ldx #255 +mk: + lda $fe + sta $1200,x + lda $fe + sta $1300,x + lda $fe + sta $1400,x + lda $fe + sta $1500,x + dex + cpx #$ff + bne mk + +; smooth it + + ldy #0 +re: + lda #1 + sta $3ec,y + + ldx #255 +sm: + lda $1201,x + adc $11ff,x + adc $1220,x + adc $11e0,x + lsr + lsr + sta $1200,x + + lda $1301,x + adc $12ff,x + adc $1320,x + adc $12e0,x + lsr + lsr + sta $1300,x + + lda $1401,x + adc $13ff,x + adc $1420,x + adc $13e0,x + lsr + lsr + sta $1400,x + + lda $1501,x + adc $14ff,x + adc $1520,x + adc $14e0,x + lsr + lsr + sta $1500,x + + dex + cpx #$ff + bne sm + iny + cpy #7 + bne re + + lda #1 + sta $3f0 + + ;copy it + + clc + ldx #255 +cp: + lda $1200,x + lsr + lsr + tay + lda colors,y + sta $200,x + + lda $1300,x + lsr + lsr + tay + lda colors,y + sta $300,x + + lda $1400,x + lsr + lsr + tay + lda colors,y + sta $400,x + + lda $1500,x + lsr + lsr + tay + lda colors,y + sta $500,x + + dex + cpx #$ff + bne cp + rts + +colors: + dcb 0,0,0,0,0,$9,$9,1,1,0,0,0,0,0 + diff --git a/hacks/images/m6502/santa.asm b/hacks/images/m6502/santa.asm new file mode 100644 index 0000000..be47502 --- /dev/null +++ b/hacks/images/m6502/santa.asm @@ -0,0 +1,142 @@ +start: +ldx #0 +cs: +lda $2000,x +sta $500,x +dex +bne cs + +stx $20 + +loop: + +inc $20 +lda $20 +and #$7f +tay +and #$1f +tax +lda sinus,x +tax + +d: + +lda #0 +sta $1e0,x +sta $2e0,x +lda $1000,y +sta $200,x +lda $1080,y +sta $220,x +lda $1100,y +sta $240,x +lda $1180,y +sta $260,x +lda $1200,y +sta $280,x +lda $1280,y +sta $2a0,x +lda $1300,y +sta $2c0,x +lda $1380,y +sta $2c0,x +inx +iny +txa +and #$1f +bne d + +jmp loop + +; 32 ($20) long +sinus: +dcb 0,0,0,0,$20,$20,$20 +dcb $40,$40,$60,$80,$a0,$a0,$c0,$c0,$c0 +dcb $e0,$e0,$e0,$e0,$c0,$c0,$c0 +dcb $a0,$a0,$80,$60,$40,$40,$20,$20,$20 + +*=$1000 +santa: +dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,0,0,0,0,0,$a,$a,0,0,0,0,0,0 +dcb 0,0,0,0,0,$a,$a,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,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 index 0000000..f7bb646 --- /dev/null +++ b/hacks/images/m6502/selfmodify.asm @@ -0,0 +1,12 @@ +; A very simple example of +; self-modifying code +; and code entry points + + lda $fe + sta $1001 + jmp $1000 + + *=$1000 + lda #$00 + sta $3ef + jmp $600 diff --git a/hacks/images/m6502/sflake.asm b/hacks/images/m6502/sflake.asm new file mode 100644 index 0000000..cbb72e8 --- /dev/null +++ b/hacks/images/m6502/sflake.asm @@ -0,0 +1,320 @@ +;; Jeremy English 01-December-2008 +;; Snowflakes + +;; Main loop Count +lda #7 +sta $f + +;; pattern number +lda #0 +sta $10 + +;;Cells +lda #$00 +sta $4 +lda #$10 +sta $5 + +;;Tmp +lda #$00 +sta $6 +lda #$11 +sta $7 + +;;Init Cells Buffer +;;------------------------------------------------------------ +ldy #$ff +initCells: +lda #0 +sta ($4),y +sta ($6),y +dey +bne initCells + +;;Set start position +ldy #115 +lda #1 +sta ($4),y + +;;Setup offset +lda #15 +sta $d +lda #16 +sta $e + +;;Start of main loop +;;------------------------------------------------------------ +mainloop: + +;;init indent +;;We want to indent every other line +lda #0 +sta $a + +lda #0 +sta $9 + +;; Display Cells +;;------------------------------------------------------------ +;; 248 is the total number of cells +ldy #248 +display: + +lda #0 +sta $8 + +lda $a +beq stop16 +lda #15 +sta $b +lda #1 +sta $8 +jmp toggle +stop16: +lda #16 +sta $b +toggle: +lda $a +eor #1 +sta $a + +;; Set the stop position +ldx $b +inner_display: +dex +txa +pha + +dey +tya +pha +lda ($4),y + +beq display_continue +ldx $8 +ldy $9 +lda #1 +jsr paint +ldx $8 +ldy $9 +inx +jsr paint +ldx $8 +ldy $9 +iny +jsr paint +ldx $8 +ldy $9 +inx +iny +jsr paint +display_continue: +inc $8 +inc $8 + +;;Life Cycle +;;------------------------------------------------------------ +pla +tay +pha ;;Store y on the stack + +tax +dey +lda ($4),y +iny +iny +clc +adc ($4),y +sta $c + +txa +sec +sbc $d +tay +lda $c +clc +adc ($4),y +sta $c + +txa +sec +sbc $e +tay +lda $c +clc +adc ($4),y +sta $c + +txa +clc +adc $d +tay +lda $c +clc +adc ($4),y +sta $c + +txa +clc +adc $e +tay +lda $c +clc +adc ($4),y +sta $c + +pla +tay ;;Pull Y off of the stack + +lda $c +and #1 +beq dontset +sta ($6),y +dontset: + +pla +tax ;;Pull x off of the stack +beq exit_inner_display +jmp inner_display +exit_inner_display: +inc $9 +inc $9 +tya +beq display_exit +jmp display +display_exit: + + +;;Copy Temporary Buffer +;;------------------------------------------------------------ +ldy #248 +copybuf: +dey +lda ($6),y +sta ($4),y +tya +bne copybuf + +dec $f +lda $f +beq reset_main +jmp mainloop + +;;Reset main counter +;;------------------------------------------------------------ +reset_main: +lda #7 +sta $f + +lda #$ff ;;Delay Count +sta $11 +delay: +ldy #$a0 +inner_delay: +nop +dey +bne inner_delay +dec $11 +lda $11 +bne delay + +;; init buffer +;; and clear screen +clrscr: +lda $fe +and $f +cmp #1 +beq clrscr ;We don't want a white background +ldy #$00 +ldx #$0 +cs_loop: +sta $200,x +sta $300,x +sta $400,x +sta $500,x +pha +lda #0 +sta ($6),y +sta ($4),y +pla +inx +dey +bne cs_loop + +;; Setup new pattern +;;------------------------------------------------------------ +inc $10 +lda $10 +and #3 +sta $10 +cmp #0 +beq pattern1 +cmp #1 +beq pattern2 +cmp #2 +beq pattern3 +cmp #3 +beq pattern4 + +pattern1: +ldy #114 +lda #1 +sta ($4),y +ldy #115 +lda #1 +sta ($4),y +ldy #116 +lda #1 +sta ($4),y +jmp mainloop + +pattern2: +ldy #113 +lda #1 +sta ($4),y +ldy #118 +lda #1 +sta ($4),y +jmp mainloop + +pattern3: +ldy #115 +lda #1 +sta ($4),y +jmp mainloop + +pattern4: +ldy #102 +lda #1 +sta ($4),y +ldy #128 +lda #1 +sta ($4),y +jmp mainloop + +;;Paint subroutine +;;------------------------------------------------------------ +paint: + pha + lda yl,y + sta $2 + lda yh,y + sta $3 + txa + tay + pla + sta ($2),y + rts + + ;; Y cord MSB +yh: + dcb $02, $02, $02, $02, $02, $02, $02, $02 + dcb $03, $03, $03, $03, $03, $03, $03, $03 + dcb $04, $04, $04, $04, $04, $04, $04, $04 + dcb $05, $05, $05, $05, $05, $05, $05, $05 + ;; Y cord LSB +yl: + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 + dcb $00, $20, $40, $60, $80, $a0, $c0, $e0 diff --git a/hacks/images/m6502/sierpinski.asm b/hacks/images/m6502/sierpinski.asm new file mode 100644 index 0000000..2d21905 --- /dev/null +++ b/hacks/images/m6502/sierpinski.asm @@ -0,0 +1,24 @@ +; Sierpinski +; Submitted by Anonymous + +start: + lda #$e1 + sta $0 + lda #$01 + sta $1 + ldy #$20 + +write: + ldx #$00 + eor ($0, x) + sta ($0),y + + inc $0 + bne write + inc $1 + ldx $1 + cpx #$06 + bne write + + rts + diff --git a/hacks/images/m6502/sierpinsky.asm b/hacks/images/m6502/sierpinsky.asm new file mode 100644 index 0000000..6a67906 --- /dev/null +++ b/hacks/images/m6502/sierpinsky.asm @@ -0,0 +1,131 @@ +; 6502 assembler Sierpinsky Triangle ver.2 +; by Magnus Wedmark 2007-05-02 +; This program is especially written for +; the 6502asm.com competition and +; uses the 32*32 pixel display used in that +; virtual platform. The sierpinsky +; fractal is one of the simplest to +; implement. Here is a walk-through: +; 1) Specify 3 points that form a triangle +; 2) Choose one of them as a starting point +; 3) Choose one of them as targetpoint randomly +; 4) Set the new current position half-way +; between the current point and the target +; point. +; 5) Goto 3 + + LDX #0 + LDY #0 +new_rnd: + LDA $FE ; random 0-255 + AND #3 ; only 0-3 left + CMP #3 + BNE good_rnd + JMP new_rnd +good_rnd: +; random = 0-2 + PHA +; transform X and Y values according to: +; X=X/2+(P*8) and Y=Y/2+(P*16) + ASL + ASL + ASL + STA $F3 ; P*8 + PLA + AND #1 + ASL + ASL + ASL + ASL + STA $F4 ; (P AND 1)*16 + TXA + LSR + ADC $F3 + TAX + TYA + LSR + ADC $F4 + TAY + JSR set_point ; use and restore regs + JMP new_rnd + +set_point: ; uses both X,Y,A and restores them + PHA ; backup all reg-value (X,Y,A) + TXA + PHA + TYA + PHA + PHA + PHA ; triple Y push, two for int. use + STX $F2 ; transfer X to Y using $F2 + LDY $F2 + LDA #0 + STA $F0 + LDA #$2 + STA $F1 ; set base vector to $200 + LDA #0 + PLA ; transfer the pushed Y-coord to A + AND #$07 ; the value %0000'0111 + ASL + ASL + ASL + ASL + ASL + CLC + ADC $F0 + STA $F0 + BCC no_carry + INC $F1 +no_carry: + CLC + PLA ; transfer the pushed Y-coord to A + AND #$18 + LSR + LSR + LSR + ADC $F1 + STA $F1 + + CLC + TYA + ADC $F0 + ADC $F1 + + LDA #1 ;1 = white for trouble-shooting + JSR set_toning_point ; use for shading + STA ($F0),Y ; set pixel + PLA ; restore all reg-value (X,Y,A) + TAY + PLA + TAX + PLA + RTS + +; sub routine to shade the current pixel ($F0),Y +; lighter on a scale: $0, $B, $C, $F, $1 +; Black, DarkGrey, Grey, LightGrey, White +set_toning_point: + LDA ($F0),Y + CMP #$00 + BNE not_black + LDA #$0B + RTS +not_black: + CMP #$0B + BNE not_dgrey + LDA #$0C + RTS +not_dgrey: + CMP #$0C + BNE not_grey + LDA #$0F + RTS +not_grey: + CMP #$0F + BNE not_lgrey + LDA #$01 + RTS +not_lgrey: +; white stays white + RTS + diff --git a/hacks/images/m6502/softsprite.asm b/hacks/images/m6502/softsprite.asm new file mode 100644 index 0000000..eab6d67 --- /dev/null +++ b/hacks/images/m6502/softsprite.asm @@ -0,0 +1,132 @@ +; software sprites +; by PJP + +loop: + ldx $90 + inx + stx $90 + + lda #4 ; *** NUMBER OF SPRITES + sta $3 + lda #0 + sta $4 + +multiple: + lda $90 + clc + adc $4 + tax + + lda sinus,x + ldy cosinus,x + asl + tax + lda ypos,x + sta $00 + inx + lda ypos,x + sta $01 + ldx #0 + lda #5 ; **** HEIGHT OF EACH SPRITE + sta $2 +draw: + lda image,x + sta ($0),y + inx + iny + lda image,x + sta ($0),y + inx + iny + lda image,x + sta ($0),y + inx + iny + lda image,x + sta ($0),y + inx + iny + lda image,x + sta ($0),y + + + tya + clc + adc #28 + tay + inx + dec $2 + bne draw + + lda $4 + clc + adc #18 ; *** DISTANCE BETWEEN SPRITES (FROM TABLE) + sta $4 + + dec $3 + bne multiple + + jmp loop + +; SINUS (AND COSINUS) + +sinus: + dcb $0e, $0e, $0e, $0f, $0f, $0f, $10, $10, $10, $11 + dcb $11, $11, $12, $12, $12, $13, $13, $13, $14, $14 + dcb $14, $14, $15, $15, $15, $16, $16, $16, $16, $17 + dcb $17, $17, $17, $18, $18, $18, $18, $19, $19, $19 + dcb $19, $19, $1a, $1a, $1a, $1a, $1a, $1a, $1a, $1b + dcb $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b + dcb $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b +cosinus: + dcb $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b + dcb $1a, $1a, $1a, $1a, $1a, $1a, $19, $19, $19, $19 + dcb $19, $18, $18, $18, $18, $18, $17, $17, $17, $17 + dcb $16, $16, $16, $15, $15, $15, $15, $14, $14, $14 + dcb $13, $13, $13, $12, $12, $12, $11, $11, $11, $10 + dcb $10, $10, $0f, $0f, $0f, $0e, $0e, $0e, $0d, $0d + dcb $0d, $0c, $0c, $0c, $0b, $0b, $0b, $0a, $0a, $0a + dcb $09, $09, $09, $08, $08, $08, $07, $07, $07, $06 + dcb $06, $06, $06, $05, $05, $05, $04, $04, $04, $04 + dcb $03, $03, $03, $03, $03, $02, $02, $02, $02, $02 + dcb $01, $01, $01, $01, $01, $01, $00, $00, $00, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $01, $01, $01 + dcb $01, $01, $01, $01, $02, $02, $02, $02, $02, $03 + dcb $03, $03, $03, $04, $04, $04, $04, $05, $05, $05 + dcb $05, $06, $06, $06, $07, $07, $07, $07, $08, $08 + dcb $08, $09, $09, $09, $0a, $0a, $0a, $0b, $0b, $0b + dcb $0c, $0c, $0c, $0d, $0d + + dcb $0e, $0e, $0e, $0f, $0f, $0f, $10, $10, $10, $11 + dcb $11, $11, $12, $12, $12, $13, $13, $13, $14, $14 + dcb $14, $14, $15, $15, $15, $16, $16, $16, $16, $17 + dcb $17, $17, $17, $18, $18, $18, $18, $19, $19, $19 + dcb $19, $19, $1a, $1a, $1a, $1a, $1a, $1a, $1a, $1b + dcb $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b + dcb $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b + dcb $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b, $1b + dcb $1a, $1a, $1a, $1a, $1a, $1a, $19, $19, $19, $19 + +; 5x5 BYTES + +image: + dcb $0,$0,$0,$0,$0 + dcb $0,$c,$c,$c,$0 + dcb $0,$c,$1,$c,$0 + dcb $0,$c,$c,$c,$0 + dcb $0,$0,$0,$0,$0 + +; YPOS LOOKUP TABLE + +ypos: + dcb $00,$02,$20,$02,$40,$02,$60,$02 + dcb $80,$02,$a0,$02,$c0,$02,$e0,$02 + dcb $00,$03,$20,$03,$40,$03,$60,$03 + dcb $80,$03,$a0,$03,$c0,$03,$e0,$03 + dcb $00,$04,$20,$04,$40,$04,$60,$04 + dcb $80,$04,$a0,$04,$c0,$04,$e0,$04 + dcb $00,$05,$20,$05,$40,$05,$60,$05 + dcb $80,$05,$a0,$05,$c0,$05,$e0,$05 + diff --git a/hacks/images/m6502/spacer.asm b/hacks/images/m6502/spacer.asm new file mode 100644 index 0000000..bdecbb5 --- /dev/null +++ b/hacks/images/m6502/spacer.asm @@ -0,0 +1,235 @@ +; "spacer", move a space ship through an
+; endless tunnel. You die once you hit
+; the walls.
+;
+; Controls:
+;
+; W - move up
+; X - move down
+; Any other key will stop the ship
+;
+; Ps: this game runs awfully slow =)
+;
+
+start:
+ jsr init
+
+loop:
+ ;; jsr drawShip
+ jsr drawMap
+ jsr genMap
+ jsr readKeys
+ jmp loop
+
+;--
+
+drawShip:
+ lda $82 ; mychange
+; asl
+ tay
+
+ lda ypos,y
+ sta $00
+ iny
+ lda ypos,y
+ sta $01
+
+ ldx #42
+ lda ($00,x)
+ cmp #0
+ beq noCrash
+ cmp #5
+; bne crashed
+;my changes
+noCrash:
+ lda #5
+ sta ($00,x)
+
+ lda $60
+ cmp $61
+ beq ret
+
+ lda $61
+ asl
+ tay
+ lda ypos,y
+ sta $00
+ iny
+ lda ypos,y
+ sta $01
+ lda #0
+ ldx #42
+ sta ($00,x)
+
+ lda $60
+ sta $61
+ret:
+ rts
+
+;--
+
+crashed:
+ lda $fe
+ sta ($00,x)
+ jmp crashed
+
+;--
+
+readKeys:
+ lda $ff
+ cmp #119
+ bne notUp
+ dec $60
+ rts
+notUp:
+ cmp #120
+ bne noMove
+ inc $60
+noMove:
+ rts
+
+;--
+
+init:
+ ldx #0
+drawLogo:
+ lda bottomLogo,x
+ sta $500,x
+ inx
+ cpx #0
+ bne drawLogo
+
+ lda #10
+ sta $60
+ sta $61
+
+ ldx #0
+ lda #$c
+c:sta $200,x
+ sta $400,x
+ dex
+ cpx #0
+ bne c
+
+ lda #16
+ sta $80 ; origin
+ ldx #15
+set:
+ sta $81,x ; target
+ dex
+ bpl set
+ rts
+
+;--
+
+drawMap:
+ lda #0
+ sta $78
+ lda #32
+ sta $79
+ lda #192
+ sta $7a
+ lda #224
+ sta $7b
+
+ ldx #15
+drawLoop:
+ lda $81,x
+ sta $82,x
+ tay
+ lda ypos,y
+ sta $00
+ iny
+ lda ypos,y
+ sta $01
+
+ lda #$c
+ ldy $78
+ sta ($00),y
+ iny
+ sta ($00),y
+
+ ldy $7b
+ sta ($00),y
+ iny
+ sta ($00),y
+
+ ldy $79
+ lda #0
+ sta ($00),y
+ iny
+ sta ($00),y
+
+ ldy $7a
+ sta ($00),y
+ iny
+ sta ($00),y
+
+ inc $78
+ inc $79
+ inc $7a
+ inc $7b
+ inc $78
+ inc $79
+ inc $7a
+ inc $7b
+ dex
+ bpl drawLoop
+ rts
+
+;---
+
+genMap:
+ lda $80
+ cmp $81
+ beq done
+ lda $80
+ clc
+ sbc $81
+ bpl plus
+ bmi minus
+done:
+ lda $fe
+ and #$f
+ asl
+ sta $80
+ rts
+minus:
+ dec $81
+ dec $81
+ rts
+plus:
+ inc $81
+ inc $81
+ rts
+
+ypos:
+ dcb $00,$02,$20,$02,$40,$02,$60,$02
+ dcb $80,$02,$a0,$02,$c0,$02,$e0,$02
+ dcb $00,$03,$20,$03,$40,$03,$60,$03
+ dcb $80,$03,$a0,$03,$c0,$03,$e0,$03
+ dcb $00,$04,$20,$04,$40,$04,$60,$04
+ dcb $80,$04,$a0,$04,$c0,$04,$e0,$04
+ dcb $00,$05,$20,$05,$40,$05,$60,$05
+ dcb $80,$05,$a0,$05,$c0,$05,$e0,$05
+
+bottomLogo:
+ dcb $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
+ dcb $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
+ dcb $0,$0,$0,$0,$0,$0,$1,$1,$1,$6,$1,$1,$1,$0
+ dcb $0,$6,$1,$1,$6,$0,$0,$1,$1,$1,$6,$0,$1,$1
+ dcb $1,$0,$1,$1,$1,$6,$0,$0,$6,$1,$6,$0,$6,$0
+ dcb $1,$0,$6,$1,$6,$1,$6,$0,$1,$0,$1,$0,$6,$0
+ dcb $6,$1,$6,$0,$6,$0,$1,$0,$6,$1,$6,$0,$0,$6
+ dcb $1,$1,$6,$6,$1,$1,$1,$0,$6,$1,$0,$0,$1,$0
+ dcb $1,$6,$0,$6,$6,$1,$1,$1,$0,$6,$1,$0,$6,$1
+ dcb $0,$6,$6,$6,$6,$6,$1,$6,$1,$1,$6,$6,$6,$1
+ dcb $1,$1,$1,$6,$1,$6,$6,$6,$6,$1,$6,$6,$6,$6
+ dcb $1,$1,$1,$6,$6,$6,$6,$1,$1,$1,$1,$e,$1,$1
+ dcb $e,$6,$6,$1,$1,$6,$1,$6,$1,$1,$1,$1,$e,$1
+ dcb $1,$1,$1,$6,$1,$1,$6,$1,$6,$6,$6,$1,$1,$1
+ dcb $6,$e,$1,$1,$6,$e,$6,$1,$1,$e,$1,$e,$6,$1
+ dcb $1,$1,$6,$e,$1,$1,$1,$e,$1,$1,$6,$1,$6,$e
+ dcb $e,$e,$6,$e,$e,$6,$e,$e,$6,$e,$e,$6,$e,$e
+ dcb $6,$e,$e,$6,$e,$e,$6,$e,$e,$6,$e,$e,$6,$e
+ dcb $e,$6,$e,$e
diff --git a/hacks/images/m6502/starfield2d.asm b/hacks/images/m6502/starfield2d.asm new file mode 100644 index 0000000..4c26efe --- /dev/null +++ b/hacks/images/m6502/starfield2d.asm @@ -0,0 +1,50 @@ +; 2d starfield +; Submitted by Anonymous + +i:ldx #$7 +g:lda $fe + and #3 + adc #1 + sta $0,x + lda $fe + and #$1f + sta $20,x + dex + bpl g +f: + lda #$ff + sta $10 + delay: + nop + dec $10 + bne delay + + lda #$00 + sta $80 + lda #$02 + sta $81 + ldx #$7 +l:lda $20,x + pha + clc + sbc $00,x + and #$1f + sta $20,x + lda $20,x + tay + lda #1 + sta ($80),y + pla + tay + lda #0 + sta ($80),y + lda $80 + clc + adc #$80 + bne n + inc $81 +n:sta $80 + dex + bpl l + jmp f + diff --git a/hacks/images/m6502/texture.asm b/hacks/images/m6502/texture.asm new file mode 100644 index 0000000..b63d0a2 --- /dev/null +++ b/hacks/images/m6502/texture.asm @@ -0,0 +1,393 @@ +; -*- mode: c; tab-width: 4; fill-column: 128 -*- +; vi: set ts=4 tw=128: + +; Texture, Copyright (c) 2017 Dave Odell <dmo2118@gmail.com> +; +; Permission to use, copy, modify, distribute, and sell this software and its +; documentation for any purpose is hereby granted without fee, provided that +; the above copyright notice appear in all copies and that both that +; copyright notice and this permission notice appear in supporting +; documentation. No representations are made about the suitability of this +; software for any purpose. It is provided "as is" without express or +; implied warranty. + +; A port of 20 year old QBasic code to a much more modern platform. + + + + + + lda $fe + sta src_row + + ldy #0 +top_loop: + lda $fe + and #$f + sbc #$8 + adc src_row,y + iny + sta src_row,y + cpy #31 + bne top_loop + +lda #$00 +sta $0 +lda #$02 +sta $1 + +init_loop: + jsr tex + clc + lda $0 + adc #$20 + sta $0 + lda $1 + adc #0 + sta $1 + cmp #$06 + bne init_loop + +lda #$e0 +sta $0 +lda #$05 +sta $1 + +loop: + ;jmp skip_blit + + clc + lda #0 + blit_loop2: + tay + lda $0220,y + sta $0200,y + lda $0221,y + sta $0201,y + lda $0222,y + sta $0202,y + lda $0223,y + sta $0203,y + lda $0224,y + sta $0204,y + lda $0225,y + sta $0205,y + lda $0226,y + sta $0206,y + lda $0227,y + sta $0207,y + + tya + adc #8 + bne blit_loop2 + + clc + lda #0 + blit_loop3: + tay + lda $0320,y + sta $0300,y + lda $0321,y + sta $0301,y + lda $0322,y + sta $0302,y + lda $0323,y + sta $0303,y + lda $0324,y + sta $0304,y + lda $0325,y + sta $0305,y + lda $0326,y + sta $0306,y + lda $0327,y + sta $0307,y + + tya + adc #8 + bne blit_loop3 + + clc + lda #0 + blit_loop4: + tay + lda $0420,y + sta $0400,y + lda $0421,y + sta $0401,y + lda $0422,y + sta $0402,y + lda $0423,y + sta $0403,y + lda $0424,y + sta $0404,y + lda $0425,y + sta $0405,y + lda $0426,y + sta $0406,y + lda $0427,y + sta $0407,y + + tya + adc #8 + bne blit_loop4 + + lda #0 + blit_loop5: + tay + lda $0520,y + sta $0500,y + lda $0521,y + sta $0501,y + lda $0522,y + sta $0502,y + lda $0523,y + sta $0503,y + lda $0524,y + sta $0504,y + lda $0525,y + sta $0505,y + lda $0526,y + sta $0506,y + lda $0527,y + sta $0507,y + + tya + clc + adc #8 + cmp #$e0 + bne blit_loop5 + + skip_blit: + + jsr tex +jmp loop + +tex: + lda $fe + and #$f + sbc #$8 + adc src_row + sta src_row + + ldy #0 + tax + lda pal0,x + sta ($0),y + tex_loop0: + lda $fe + and #$f + sbc #$8 + ;clc + adc src_row,y + iny + ;clc + adc src_row,y + ror + sta src_row,y + + tax + lda pal0,x + sta ($0),y + + cpy #31 + bne tex_loop0 + rts + +pal0: + dcb $00, $00, $00, $00, $00, $00, $00, $00 + dcb $00, $00, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0b, $0b, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0c, $0c, $0c, $0c, $0c, $0c, $0c, $0c + dcb $0c, $0c, $0c, $0c, $0c, $0c, $0c, $0c + dcb $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f + dcb $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f + dcb $0f, $01, $01, $01, $01, $01, $01, $01 + dcb $01, $01, $01, $01, $01, $01, $01, $01 + dcb $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f + dcb $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f + dcb $0f, $0c, $0c, $0c, $0c, $0c, $0c, $0c + dcb $0c, $0c, $0c, $0c, $0c, $0c, $0c, $0c + dcb $0c, $0b, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0b, $0b, $0b, $0b, $0b, $0b, $0b, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $00 + dcb $0b, $0b, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0b, $0b, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0b, $0b, $0b, $0b, $0b, $0b, $05, $05 + dcb $05, $05, $05, $05, $05, $05, $05, $05 + dcb $05, $05, $05, $05, $05, $05, $05, $05 + dcb $0d, $0d, $0d, $0d, $0d, $0d, $0d, $0d + dcb $0d, $0d, $0d, $0d, $0d, $0d, $0d, $0d + dcb $0d, $05, $05, $05, $05, $05, $05, $05 + dcb $05, $05, $05, $05, $05, $05, $05, $05 + dcb $05, $05, $05, $0b, $0b, $0b, $0b, $0b + dcb $0b, $0b, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0b, $0b, $0b, $0b, $0b, $0b, $0b, $0b + dcb $0b, $00, $00, $00, $00, $00, $00, $00 + dcb $00, $00, $00, $00, $00, $00, $00, $00 + +src_row: + ; (32 bytes) + +; A full-resolution version of the same thing. Not perhaps the most interesting thing to look at. + +;#include "screenhack.h" +; +;#include <inttypes.h> +; +;struct texture +;{ +; unsigned width, height; +; Colormap colormap; +; GC gc; +; unsigned long palette[128]; +; XImage *image; +; uint8_t *row; +; unsigned graininess; +; unsigned lines; +;}; +; +;#define GRAIN(self) (NRAND((self)->graininess * 2 + 1) - (self)->graininess) +; +;static void _put_line(struct texture *self, Display *dpy, Window window, unsigned y) +;{ +; unsigned x; +; for(x = 0; x != self->width; ++x) +; { +; unsigned c1 = self->row[x]; +; unsigned c0 = c1; +; if(c0 & 64) +; c0 ^= 127; +; XPutPixel(self->image, x, 0, self->palette[(c0 & 63) | ((c1 & 0x80) >> 1)]); +; } +; +; XPutImage(dpy, window, self->gc, self->image, 0, 0, 0, y, self->width, 1); +; +; *self->row += GRAIN(self); +; +; for(x = 1; x != self->width; ++x); +; { +; unsigned avg = self->row[x - 1] + self->row[x]; +; self->row[x] = ((avg + ((avg & 2) >> 1)) >> 1) + GRAIN(self); +; } +; +; +;} +; +;static void texture_reshape(Display *dpy, Window window, void *self_raw, unsigned w, unsigned h) +;{ +; struct texture *self = self_raw; +; unsigned x, y; +; +; if(w == self->width && h == self->height) +; return; +; +; self->image->bytes_per_line = 0; +; self->image->width = w; +; XInitImage(self->image); +; +; free(self->row); +; self->row = malloc(w); +; free(self->image->data); +; self->image->data = malloc(w * self->image->bytes_per_line); +; +; self->width = w; +; self->height = h; +; +; *self->row = NRAND(0xff); +; for(x = 1; x != self->width; ++x) +; self->row[x] = self->row[x - 1] + GRAIN(self); +; +; for(y = 0; y != self->height; ++y) +; _put_line(self, dpy, window, y); +;} +; +;static void *texture_init(Display *dpy, Window window) +;{ +; static const XGCValues gcv_src = {GXcopy}; +; XGCValues gcv = gcv_src; +; struct texture *self = malloc(sizeof(*self)); +; XWindowAttributes xwa; +; unsigned i; +; +; XGetWindowAttributes(dpy, window, &xwa); +; self->width = 0; +; self->height = 0; +; self->colormap = xwa.colormap; +; +; self->graininess = get_integer_resource(dpy, "graininess", "Graininess"); +; self->lines = get_integer_resource(dpy, "speed", "Speed"); +; +; for(i = 0; i != 64; ++i) +; { +; XColor color; +; unsigned short a = i * (0x10000 / 64); +; +; color.red = a; +; color.green = a; +; color.blue = a; +; if(!XAllocColor(dpy, xwa.colormap, &color)) +; abort(); +; self->palette[i] = color.pixel; +; +; color.red = 0; +; color.green = a; +; color.blue = 0; +; if(!XAllocColor(dpy, xwa.colormap, &color)) +; abort(); +; self->palette[i | 64] = color.pixel; +; } +; +; self->gc = XCreateGC(dpy, window, GCFunction, &gcv); +; self->image = XCreateImage(dpy, xwa.visual, xwa.depth, ZPixmap, 0, NULL, 0, 1, 32, 0); +; self->row = NULL; +; +; texture_reshape(dpy, window, self, xwa.width, xwa.height); +; +; return self; +;} +; +;static unsigned long texture_draw(Display *dpy, Window window, void *self_raw) +;{ +; struct texture *self = self_raw; +; unsigned y; +; XCopyArea(dpy, window, window, self->gc, 0, self->lines, self->width, self->height - self->lines, 0, 0); +; for(y = 0; y != self->lines; ++y) +; _put_line(self, dpy, window, self->height - self->lines + y); +; return 16667; +;} +; +;static Bool texture_event (Display *dpy, Window window, void *self_raw, XEvent *event) +;{ +; return False; +;} +; +;static void texture_free(Display *dpy, Window window, void *self_raw) +;{ +; struct texture *self = self_raw; +; +; XFreeGC(dpy, self->gc); +; XFreeColors(dpy, self->colormap, self->palette, 128, 0); +; XDestroyImage(self->image); +; free(self->row); +; free(self); +;} +; +;static const char *texture_defaults[] = +;{ +; "*speed: 2", +; "*graininess: 1", +; "*fpsSolid: True", +; "*fpsTop: True", +; 0 +;}; +; +;static XrmOptionDescRec texture_options[] = +;{ +; {"-speed", ".speed", XrmoptionSepArg, 0}, +; {"-graininess", ".graininess", XrmoptionSepArg, 0}, +; {0, 0, 0, 0} +;}; +; +;XSCREENSAVER_MODULE("Texture", texture) diff --git a/hacks/images/m6502/wave6502.asm b/hacks/images/m6502/wave6502.asm new file mode 100644 index 0000000..b40ea66 --- /dev/null +++ b/hacks/images/m6502/wave6502.asm @@ -0,0 +1,164 @@ +;;; 6502 logo Jeremy English 12-January-2008 + +start: +ldx #0 +stx $20 +lda #5 +sta $21 +lda $fe +sta $22 + +loop: +dec $21 +lda $21 +beq randcolor +jmp pastrandcolor + +randcolor: +lda #5 +sta $21 +ldx #33 +inc $22 +lda $22 +and #7 +tay +rl: +lda $1000,x +beq pastcolor1 +lda color_row,y +sta $1000,x + +pastcolor1: +lda $1040,x +beq pastcolor2 +lda color_row,y +sta $1040,x + +pastcolor2: +lda $1080,x +beq pastcolor3 +lda color_row,y +sta $1080,x + +pastcolor3: +lda $10c0,x +beq pastcolor4 +lda color_row,y +sta $10c0,x + +pastcolor4: +lda $1100,x +beq pastcolor5 +lda color_row,y +sta $1100,x + +pastcolor5: +lda $1140,x +beq pastcolor6 +lda color_row,y +sta $1140,x + +pastcolor6: +lda $1180,x +beq pastcolor7 +lda color_row,y +sta $1180,x + +pastcolor7: +lda $11C0,x +beq pastcolor8 +lda color_row,y +sta $11C0,x + +pastcolor8: +lda $1200,x +beq pastcolor9 +lda color_row,y +sta $1200,x + +pastcolor9: +inx +txa +and #$3f +bne rl + +pastrandcolor: + +inc $20 +lda $20 +and #$3f +tay +and #$1f +tax +lda sinus,x +tax + +d: + +lda #0 +sta $2e0,x +sta $3e0,x +lda $1000,y +sta $300,x +lda $1080,y +sta $320,x +lda $1100,y +sta $340,x +lda $1180,y +sta $360,x +lda $1200,y +sta $380,x +lda $1280,y +sta $3a0,x +lda $1300,y +sta $3c0,x +lda $1380,y +sta $3c0,x +inx +iny +txa +and #$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,1,0,0,1,1,1,1,1,1 +dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1 +dcb 0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,1 +dcb 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1 +dcb 0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1 +dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1 +dcb 0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1 + diff --git a/hacks/images/m6502/zookeeper.asm b/hacks/images/m6502/zookeeper.asm new file mode 100644 index 0000000..b3e3bd2 --- /dev/null +++ b/hacks/images/m6502/zookeeper.asm @@ -0,0 +1,109 @@ +; We all love zookeeper !!!! +; muhmi Nov 13, 2007 9:45 am + +ldx #0 +lda #0 +hupsu: +sta $200,x +sta $300,x +sta $400,x +sta $500,x +bne hupsu + + +lda #1 +ldx #0 +fill: +txa +tay +lda seko,x +tax +lda kuva,x +sta $200,x +lda kuva_0,x +sta $300,x +lda kuva_1,x +sta $400,x +lda kuva_2,x +sta $500,x +tya +tax +inx +bne fill + +rts + +seko: +dcb 46,93,219,97,168,170,196,63,204,201,206 +dcb 56,238,25,2,186,209,191,138,226,80,128 +dcb 58,171,81,115,42,44,102,193,69,231,107 +dcb 78,5,218,103,11,13,221,130,149,16,227 +dcb 105,213,232,182,17,255,27,190,205,137,192 +dcb 222,233,94,52,229,96,18,220,202,122,166 +dcb 43,153,131,246,177,4,70,22,7,86,173 +dcb 141,151,164,32,143,40,156,185,121,132,165 +dcb 62,249,252,139,154,251,85,236,12,134,245 +dcb 184,39,195,119,242,244,162,74,1,77,51 +dcb 33,75,35,76,34,10,89,47,189,237,71 +dcb 159,9,38,101,180,116,147,140,183,157,123 +dcb 14,19,126,199,100,45,241,28,125,210,155 +dcb 41,254,31,144,55,247,111,95,57,53,223 +dcb 152,108,203,36,214,37,113,200,66,67,197 +dcb 29,250,20,212,68,87,207,163,145,211,48 +dcb 136,24,98,215,169,83,124,224,181,187,142 +dcb 84,240,54,110,234,59,243,79,50,30,114 +dcb 6,178,0,172,148,146,179,120,60,225,65 +dcb 230,208,15,72,117,248,198,106,129,92,127 +dcb 175,160,49,216,176,133,64,109,112,82,90 +dcb 235,104,158,194,8,161,167,88,91,174,23 +dcb 73,118,150,3,99,61,217,26,239,21,253 +dcb 135,188,228 + +kuva: +dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 +dcb 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1 +dcb 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 +dcb 0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1 +dcb 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,11,11 +dcb 11,0,0,0,0,0,0,1,0,0,0,11,11,11,0,0,0,0,0,1,1,1,1,1 +dcb 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +dcb 0,0,0,1,1,1,1,1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