Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :BasicUpstart2(start)
- .const column = $a4
- .const diagonal = $a5
- .const toprow = $a6
- .const bottomrow = $a8
- start:
- jsr $e544 // clear screen
- sei // before messing up the keyboard buffer
- ldx #(init_end-init_a5)
- D7: // initialize zeropage pointers
- lda init_a5-1,x
- sta diagonal-1,x
- dex
- bne D7
- D8: // loop over rows
- lda #0
- sta column
- D0: // loop over columns
- ldy column
- ldx #$20 // space
- cpy #8
- bcc D1
- cpy diagonal
- bcs D1
- ldx #$2a
- D1:
- lda diagonal
- cmp #17
- bcc D2
- tya
- adc #16 // carry == 1 bc bcc above
- cmp diagonal
- bcc D2
- ldx #$2a // '*'
- D2:
- txa
- sta (toprow),y
- sta (bottomrow),y
- lda #32
- sec
- sbc column // mirroring, a = 32 - column
- tay
- txa
- sta (toprow),y
- sta (bottomrow),y
- inc column
- cpy #16
- bne D0
- lda toprow // top row pointer += 40
- adc #39 // c == 1 bc y>=$10 in cpy above
- sta toprow
- lda toprow+1
- adc #0 // carry from low byte adc
- sta toprow+1
- lda bottomrow // bottom row pointer -= 40
- sbc #39 // c == 0 bc adc above never overflows
- sta bottomrow
- lda bottomrow+1
- sbc #0 // carry from low byte sbc
- sta bottomrow+1
- inc diagonal
- lda diagonal
- cmp #26 // diagonal reached the center
- bne D8
- ldy #0
- tya
- C0: // clear sprites
- sta spr0bmp,y
- sta spr0bmp+$100,y
- iny
- bne C0
- //ldy #0 unnecessary
- C1: // loop over character shape
- lda asterisk,y
- ldx #(init_end-init_spriteptr)
- C2: // loop over pointers into sprites
- sta ($a8,x) // copy to sprites
- inc $a8,x // add 3 for next sprite row
- inc $a8,x
- inc $a8,x
- dex // next pointer
- dex
- bne C2
- iny
- cpy #5
- bne C1
- lda #spr0bmp>>6 // sprites 1 and 6 are always at $2c00
- sta $07f9
- sta $07fe
- lda #14 // sprite color
- ldx #8
- C8:
- sta $d026,x
- dex
- bne C8
- lda #$7e // enable sprites 1 through 6
- sta $d015
- M0:
- lda #240
- M1: // wait for scanline
- cmp $d012
- bne M1
- ldx #spr3bmp>>6 // bottom left, sprites 2 and 3 at $2cc0
- ldy #0
- jsr setsprites
- lda #249
- L2: // wait for scanline
- cmp $d012
- bne L2
- lda #$13 // clear RSEL
- sta $d011
- //lda #24 // we want scanline 280 (below the sprites), just ignoring the high bit
- lda #$1B // 283 will do, and it can be reused to set RSEL
- K0: // wait for scanline
- cmp $d012
- bne K0
- sta $d011 // set RSEL
- ldx #spr1bmp>>6 // top left, sprites 2 and 3 at $2c40
- ldy #8
- jsr setsprites
- beq M0 // z == 1 bc bne before rts in setsprites:
- setsprites:
- stx $07fa // pointers for sprites 2 and 3
- stx $07fb
- inx // pointers for sprites 4 and 5 follow
- stx $07fc
- stx $07fd
- ldx #pos_top-pos_bottom
- S1:
- txa
- and #1 // attempt to exclude x coordinates from the addition
- bne S2 // a == 1, x gets incremented by 1 when branch is taken
- tya // otherwise by y
- S2:
- clc
- adc pos_bottom-1,x
- bcc S3
- adc #31 // c == 1, increment by 32 when overflowed
- S3:
- sta $d001,x
- dex
- bne S1
- rts
- pos_bottom:
- .byte 111,251, 127,251, 111,11, 231,11, 215,251, 231,251
- //.byte 112,250, 128,250, 112,10, 232,10, 216,250, 232,250
- pos_top:
- //.byte 112,34, 128,34, 112,18, 232,18, 216,34, 232,34
- init_a5:
- .byte 13 // diagonal
- .word $0403 // top row start
- .word $07c3 // bottom row start
- init_spriteptr:
- .label spr0bmp = $2c00
- .label spr1bmp = spr0bmp+$40
- .label spr2bmp = spr1bmp+$40
- .label spr3bmp = spr2bmp+$40
- .label spr4bmp = spr3bmp+$40
- .word $2c00,$2c01,$2c18,$2c19
- .word $2c40,$2c58,$2c59
- .word $2c81,$2c98,$2c99
- .word $2cc0,$2cc1,$2cd8
- .word $2d00,$2d01,$2d19
- init_end:
- asterisk:
- .byte $66, $3c, $ff, $3c, $66
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement