base:rol_starfield_using_d018
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:rol_starfield_using_d018 [2015-04-17 04:33] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== ROL Starfield using $D018 ====== | ||
+ | By Richard Bayliss | ||
+ | |||
+ | While I was programming a game called Hyper Duel. I wanted to do a simple star field. So I followed a note on one of the disks which had an example of the star field, and tried to implement one of my own. Here is the final result. < | ||
+ | ;The ROL Star Field animation by Richard/TND (From Hyper Duel) | ||
+ | |||
+ | |||
+ | !to " | ||
+ | starcontrol = $0340 | ||
+ | |||
+ | |||
+ | |||
+ | * = $0810 ;SYS2064 to start | ||
+ | |||
+ | jsr $ff81 | ||
+ | lda #$00 | ||
+ | sta $d020 | ||
+ | sta $d021 | ||
+ | |||
+ | ;Draw starfield to screen $0400 | ||
+ | |||
+ | ldx #$00 | ||
+ | .copyscreen | ||
+ | sta $0400,x | ||
+ | lda stardata+$100, | ||
+ | sta $0500,x | ||
+ | lda stardata+$200, | ||
+ | sta $0600,x | ||
+ | lda stardata+$2e8, | ||
+ | sta $06e8,x | ||
+ | lda #$0f ;Light grey stars for now | ||
+ | sta $d800,x | ||
+ | sta $d900,x | ||
+ | sta $da00,x | ||
+ | sta $dae8,x | ||
+ | inx | ||
+ | bne .copyscreen | ||
+ | |||
+ | lda #<.irq | ||
+ | sta $0314 | ||
+ | lda #>.irq | ||
+ | sta $0315 | ||
+ | lda #$7f | ||
+ | sta $dc0d | ||
+ | lda #$31 | ||
+ | sta $d012 | ||
+ | lda #$1b | ||
+ | sta $d011 | ||
+ | lda #$08 | ||
+ | sta $d016 | ||
+ | lda #$1c ;Char at $3000 | ||
+ | sta $d018 | ||
+ | lda #$01 | ||
+ | sta $d01a ;Interrupt is on! | ||
+ | cli | ||
+ | jmp * ; | ||
+ | |||
+ | .irq inc $d019 ;$D019 interrupt on | ||
+ | lda #$fc ; | ||
+ | sta $d012 | ||
+ | jsr .starfield | ||
+ | jmp $ea7e | ||
+ | |||
+ | ;Star field source: | ||
+ | ;Starfield | ||
+ | |||
+ | .starfield | ||
+ | lda .starcontrol | ||
+ | cmp #$03 | ||
+ | beq .doscroll | ||
+ | rts | ||
+ | .doscroll | ||
+ | sta .starcontrol | ||
+ | |||
+ | ldx #0 | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | ldx #1 | ||
+ | jsr .starscroll | ||
+ | ldx #2 | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | ldx #3 | ||
+ | jsr .starscroll | ||
+ | ldx #4 | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | ldx #5 | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | ldx #6 | ||
+ | jsr .starscroll | ||
+ | ldx #7 | ||
+ | jsr .starscroll | ||
+ | jsr .starscroll | ||
+ | rts | ||
+ | |||
+ | .starscroll | ||
+ | rol $3208,x | ||
+ | rol $3210,x | ||
+ | rol $3218,x | ||
+ | rol $3220,x | ||
+ | sta $3208,x | ||
+ | rts | ||
+ | |||
+ | ;The starfield char data here. Hell yeah! | ||
+ | ; | ||
+ | |||
+ | * = $3200 | ||
+ | | ||
+ | ;Shift + * (Blank it) | ||
+ | !byte %00000000 ;Weird eh? Those are for the stars | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | ;Shift + A | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00100000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %01000000 | ||
+ | ;Shift + B | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00010000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000100 | ||
+ | !byte %00000000 | ||
+ | ;Shift + C | ||
+ | !byte %00000000 | ||
+ | !byte %01000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00001000 | ||
+ | !byte %00000000 | ||
+ | ;Shift + D | ||
+ | !byte %00000010 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00010000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | !byte %00000000 | ||
+ | |||
+ | ;Now for the screen data | ||
+ | |||
+ | *=$4000 | ||
+ | stardata | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !scr" | ||
+ | !byte 0, | ||
+ | </ |
base/rol_starfield_using_d018.txt · Last modified: 2015-04-17 04:33 by 127.0.0.1