Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; This program should demonstrate
- ;; writing to the bitmap using a buffer -
- ;; the bitmap buffer will be at $038000
- ;; and it will write to the bitmap at $006000
- ;; It's all rather crude and is simply a
- ;; proof-of-principle at the moment.
- ;; Maybe it will eventually turn into something
- ;; more substantial?
- ;;
- ;; Format: Commodore 64 + SuperCPU (native 65816)
- ;; Author: Shaun B
- ;; Version: 1.0.0.1a
- ;; Date: 2013-01-14
- ;; Todo: Lots of stuff!
- ;;
- screen = $0400
- colour = $d800 ; Currently redundant
- *= $001000 ; Start with sys 4096
- .65816 ; Tells the assembler that we're
- ; in 65816 mode
- .as ; Accumulator short (8-bits)
- .rl ; Registers long (16-bits)
- ; Just to make sure that we're not
- ; in emulation mode:
- clc
- xce
- ; This will set to 16-bit x/y regs
- rep #%00010000
- ; Set border colour to zero
- stz $d020
- ; Sets the VIC-II bank to look at
- ; location $6000 for the bitmap
- lda $d011
- ora #%00100000
- sta $d011
- lda $dd00
- and #%11111100
- ora #%00000010
- sta $dd00
- lda #$5c
- sta $0288
- lda #$79
- sta $d018
- ; Now we'll clear the bitmap screen and
- ; buffer:
- lda #$00
- ldx #$1f40 ; Number of bytes to clear
- clearboth
- sta $037fff,x ; Buffer location
- stz $5fff,x ; Bitmap area
- dex
- ; When it reaches zero, it'll drop out
- ; of the loop, so there's a one-byte
- ; off-set above
- bne clearboth
- ; This will set up the colour nybbles:
- ldx #$03e8 ; Number of nybbles to set
- lda #$e2 ; Foreground/background
- setcol
- sta $5bff,x ; Colour nybbles
- dex
- ; Again, comparing to zero, so one-byte
- ; off-set (same below)
- bne setcol
- ; Now lets draw something to the back
- ; buffer (just a repeated pattern for
- ; now as this is a crude proof of
- ; principle):
- lda #%11000011
- ldx #$1f40
- tobackbuffer
- sta $037fff,x
- dex
- bne tobackbuffer
- ; Now we'll move the back buffer to
- ; our bitmap area:
- rep #%00110000 ;set 16 bit acc/xy regs
- .al
- lda #$1f40 ; Number of bytes to move
- ldx #$8000 ; Source (buffer)
- ldy #$6000 ; Destination (bitmap)
- mvn $03,$00 ; From bank 3 to zero
- infinite
- ; Loop around for now
- jmp infinite
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement