Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROCESSOR 6502
- ORG $c000
- temp1 EQU $fc
- temp2 EQU $fd
- a EQU $fe
- b EQU $61
- tmpi EQU $63
- s EQU $65
- sm EQU $67
- fi EQU $69
- ; init vars
- lda #$00
- sta s
- sta sm
- ; bg color
- lda $d021
- sta $d020
- ; clear the screen
- lda #$a0
- ldx #$00
- loop:
- sta $0400,x
- sta $0500,x
- sta $0600,x
- sta $06e8,x
- inx
- bne loop
- ; seed randomizer
- lda $a1
- sta random
- lda $a2
- sta random+1
- ; initialize a
- lda <#1500
- sta a
- lda >#1500
- sta a+1
- ; poke a,4
- lda #$04
- ldy #$00
- sta (a),y
- line_110
- ; j=rnd*4
- jsr RND
- lda random
- and #%00000011
- sta j
- sta x
- ; if s>sm then sm=s
- lda s
- cmp sm
- beq line_120
- bmi then2
- jmp line_120
- then2
- lda s
- sta sm
- ; fi=b
- lda b
- sta fi
- lda b+1
- sta fi+1
- line_120
- ; b = a+a(j)
- lda a
- sta b
- lda a+1
- sta b+1
- ldx j
- lda aarr,x
- bmi sub
- clc
- adc b
- sta b
- bcc skip
- inc b+1
- jmp skip
- sub
- eor #$ff
- sta temp1
- sec
- lda b
- sbc temp1
- sta b
- bcs skip
- dec b+1
- skip
- ; if peek(b) = 160
- ldy #$00
- lda (b),y
- cmp #160
- beq then
- jmp line_130
- then
- ; poke b,j
- lda j
- sta (b),y
- ; poke a+a(j)/2,32
- lda a
- sta tmpi
- lda a+1
- sta tmpi+1
- ldx j
- lda aarr,x
- bmi negative
- lsr
- clc
- adc tmpi
- sta tmpi
- bcc skip2
- inc tmpi+1
- skip2
- jmp now_poke
- negative
- eor #$ff
- lsr
- sta temp1
- lda tmpi
- sec
- sbc temp1
- sta tmpi
- bcs now_poke
- dec tmpi+1
- now_poke
- lda #32
- ldy #0
- sta (tmpi),y
- ; a=b:s=s+1
- lda b
- sta a
- lda b+1
- sta a+1
- inc s
- ; goto 110
- jmp line_110
- line_130
- ; j=j+1 and 3
- inc j
- lda #3
- and j
- sta j
- ; if j<>x then 120
- cmp x
- beq line_140
- jmp line_120
- line_140
- ; j = peek(a)
- ldy #$00
- lda (a),y
- sta j
- ; poke a,32
- lda #32
- sta (a),y
- ; s=s-1
- dec s
- ; if j<4
- lda j
- cmp #4
- bcc then3
- jmp line_150
- then3
- ; then a=a-a(j)
- ldx j
- lda aarr,x
- bmi neg
- sta temp1
- lda a
- sec
- sbc temp1
- sta a
- bcs skip3
- dec a+1
- skip3
- jmp line_110
- neg
- eor #$ff
- sta temp1
- lda a
- clc
- adc temp1
- sta a
- bcc skip6
- inc a+1
- skip6
- ; goto 110
- jmp line_110
- line_150
- ; poke a,1:poke fi,2
- ldy #$00
- lda #1
- sta (a),y
- lda #2
- sta (fi),y
- jmp *
- RND SUBROUTINE
- lda random+1
- sta temp1
- lda random
- asl
- rol temp1
- asl
- rol temp1
- clc
- adc random
- pha
- lda temp1
- adc random+1
- sta random+1
- pla
- adc #$11
- sta random
- lda random+1
- adc #$36
- sta random+1
- rts
- aarr DC.B 253, 175, 2, 80
- sc DC.W 1024
- j DC.B 0
- x DC.B 0
- random
- DC.B %10011101,%01011011
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement