Hi guys, i am new at programming the 6502 processor ( i would like to develop on atari 2600),so im trying to practice up by writing some random stuff.
The question for you,expert programmers is the following one:
i have written a code,and i tried to add a player on the screen, also i used some variables for setting the y pos and the lines where the sprite can appear.
but,anyway,the sprite doesn't work,so i wonder if there is any mistake in the source code and in the opcodes usage. ( i use z26 as emulator)
here is the code i made
processor 6502
include "vcs.h"
include "macro.h"
SEG
ORG $F000
pline = $81
ypos = $80
; initializing, cleaning ram and tia registers
ldx #$FF
lda #0
clea sta $00,x
dex
bne clea
; setting color for player
lda #$18
sta COLUP0
; setting y pos for player 0
lda #80
sta ypos
Reset
StartOfFrame
; vsync
lda #2
sta VSYNC
sta VBLANK
sta WSYNC
sta WSYNC
sta WSYNC
lda #0
sta VSYNC
; 37 lines of vetical blank
lda #43
sta TIM64T
vb sta WSYNC
lda INTIM
bne vb
lda #0
sta VBLANK
; 192 lines of picture
ldy #3
lda #$70
sta COLUBK
lda #$1E
sta COLUPF
lda #%11000000
light sta PF0
nop
nop
lda #%00111000
sta PF1
sta PF2
sta WSYNC
dey
bne light
; void
ldy #15
lda #0
sta PF1
sta PF0
sta PF2
void sta WSYNC
dey
bne void
; palace
ldy #174
lda #$08
sta COLUPF
pic sta WSYNC
lda #%11111111
sta PF1
sta PF0
sta PF2
checkpl
cpy ypos
bne skip
lda #7
sta pline
skip
draw
ldx pline
beq final
lda Frame0,X
sta GRP0
dec pline
final
dey
bne pic
; over scan
ldx #0
lda #2
over sta VBLANK
sta WSYNC
inx
cpx #30
bne over
jmp StartOfFrame
Frame0
.byte #%10000001
.byte #%11000011
.byte #%01111110
.byte #%00111100
.byte #%00111100
.byte #%11111111
.byte #%10111101
.byte #%00111100
;finishing
org $FFFC
InterruptVectors
word. Reset
word. Reset
END