Jump to content
IGNORED

Problems with playfield


Serguei2

Recommended Posts

I gave it a try to make my own playfield.

 

I got strange results:

 

;Scrolling color border thingy  

 

 

           processor 6502  

           include "vcs.h"  

           include "macro.h"  

 

 

           SEG  

           ORG $F000  

 

Reset  

; Clear RAM and all TIA registers  

 

               ldx #0  

               lda #0  

Clear           sta 0,x  

               inx  

               bne Clear  

 

       ;------------------------------------------------  

       ; Once-only initialisation...  

 

               ;lda #0  

               lda #$45  

               sta COLUPF              ; set the playfield colour  

               lda #$1F  

               sta COLUBK              ; set the playfield colour  

 

               lda #%00000001  

               sta CTRLPF              ; reflect playfield  

 

StartOfFrame  

 

   ; Start of vertical blank processing  

 

           lda #0  

           sta VBLANK  

 

           lda #2  

           sta VSYNC  

           

               ; 3 scanlines of VSYNCH signal...  

 

               sta WSYNC  

               sta WSYNC  

               sta WSYNC  

 

           lda #0  

           sta VSYNC            

           sta WSYNC  

 

 

 

       ; 37 scanlines of vertical blank...  

     

       ldx #0  

VerticalBlank  sta WSYNC  

       inx  

       cpx #36 ; Now waiting 36 lines  

       bne VerticalBlank  

 

DrawField    

       ldx #0         ; this counts our scanline number  

 

       lda #%11111111  

       ;lda #%00000000  

       sta PF0  

       sta PF1  

       sta PF2  

 

 

Top2

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #15  

     bne Top2

     lda #%11111111

     sta PF0  

     sta PF1  

     sta PF2  

 

Top3

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #30  

     bne Top3

     lda #%11111111

     sta PF0  

     lda #%11111111

     sta PF1  

     lda #%00001111

     sta PF2  

 

Top4

     sta WSYNC    

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #45  

     bne Top4

     lda #%11111111

     sta PF0  

     sta PF1  

     lda #%00000000

     sta PF2  

 

Top5    

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #60  

     bne Top5

     lda #%11111111

     sta PF0  

     lda #%11110000

     sta PF1  

     lda #%00000000

     sta PF2  

 

Middle        

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #105  

     bne Middle  

     lda #%00000000

     sta PF0  

     sta PF1  

     sta PF2  

 

Bottom1        

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #120

     bne Bottom1    

     lda #%11111111

     sta PF0  

     lda #%11110000

     sta PF1  

     lda #%00000000

     sta PF2  

 

Bottom2        

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #135  

     bne Bottom2    

     lda #%11111111

     sta PF0  

     sta PF1  

     lda #%00000000

     sta PF2  

 

Bottom3        

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #150  

     bne Bottom3    

     lda #%11111111

     sta PF0  

     sta PF1  

     lda #%00001111

     sta PF2  

 

Bottom4        

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #165  

     bne Bottom4

     lda #%11111111

     sta PF0  

     sta PF1  

     sta PF2  

 

Bottom5        

     sta WSYNC  

     lda #$45  

     sta COLUPF  

     lda #0  

     inx  

     cpx #192  

     bne Bottom5

     lda #%0

     ;lda #%11111111

     sta PF0  

     sta PF1  

     sta PF2  

 

   

       ;------------------------------------------------  

 

 

     ;lda #%01000010  

     sta VBLANK           ; end of screen - enter blanking  

 

   ; 30 scanlines of overscan...  

 

               ldx #0  

Overscan        sta WSYNC  

               inx  

               cpx #30  

               bne Overscan  

 

               jmp StartOfFrame  

 

 

;------------------------------------------------------------------------------  

 

           ORG $FFFA  

 

InterruptVectors  

 

           .word Reset           ; NMI  

           .word Reset           ; RESET  

           .word Reset           ; IRQ  

 

      END

post-1196-1077039512_thumb.jpg

Link to comment
Share on other sites

Later I add more lines and I got a better results:

 

;Scrolling color border thingy

 

 

processor 6502

include "vcs.h"

include "macro.h"

 

 

SEG

ORG $F000

 

Reset

; Clear RAM and all TIA registers

 

ldx #0

lda #0

Clear sta 0,x

inx

bne Clear

 

;------------------------------------------------

; Once-only initialisation...

 

;lda #0

lda #$45

sta COLUPF ; set the playfield colour

lda #$1F

sta COLUBK ; set the playfield colour

 

lda #%00000001

sta CTRLPF ; reflect playfield

 

StartOfFrame

 

; Start of vertical blank processing

 

lda #0

sta VBLANK

 

lda #2

sta VSYNC

 

; 3 scanlines of VSYNCH signal...

 

sta WSYNC

sta WSYNC

sta WSYNC

 

lda #0

sta VSYNC

sta WSYNC

 

 

 

; 37 scanlines of vertical blank...

 

ldx #0

VerticalBlank sta WSYNC

inx

cpx #36 ; Now waiting 36 lines

bne VerticalBlank

 

DrawField

ldx #0 ; this counts our scanline number

 

lda #%11111111

;lda #%00000000

sta PF0

sta PF1

sta PF2

 

 

Top2

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #15

bne Top2

lda #%11111111

sta PF0

sta PF1

sta PF2

 

Top3

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #30

bne Top3

lda #%11111111

sta PF0

lda #%11111111

sta PF1

lda #%00001111

sta PF2

 

Top4

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #45

bne Top4

lda #%11111111

sta PF0

sta PF1

lda #%00000000

sta PF2

 

Top5

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #60

bne Top5

lda #%11111111

sta PF0

lda #%11110000

sta PF1

lda #%00000000

sta PF2

 

Middle

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #75

bne Middle

lda #%00000000

sta PF0

sta PF1

sta PF2

 

Middle2

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #90

bne Middle2

lda #%00000000

sta PF0

sta PF1

sta PF2

 

Middle3

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #105

bne Middle3

lda #%00000000

sta PF0

sta PF1

sta PF2

 

Bottom1

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #120

bne Bottom1

lda #%11111111

sta PF0

lda #%11110000

sta PF1

lda #%00000000

sta PF2

 

Bottom2

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #135

bne Bottom2

lda #%11111111

sta PF0

sta PF1

lda #%00000000

sta PF2

 

Bottom3

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #150

bne Bottom3

lda #%11111111

sta PF0

sta PF1

lda #%00001111

sta PF2

 

Bottom4

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #165

bne Bottom4

lda #%11111111

sta PF0

sta PF1

sta PF2

 

Bottom5

sta WSYNC

lda #$45

sta COLUPF

lda #0

inx

cpx #192

bne Bottom5

lda #%0

;lda #%11111111

sta PF0

sta PF1

sta PF2

 

 

;------------------------------------------------

 

 

;lda #%01000010

sta VBLANK ; end of screen - enter blanking

 

; 30 scanlines of overscan...

 

ldx #0

Overscan sta WSYNC

inx

cpx #30

bne Overscan

 

jmp StartOfFrame

 

 

;------------------------------------------------------------------------------

 

ORG $FFFA

 

InterruptVectors

 

.word Reset ; NMI

.word Reset ; RESET

.word Reset ; IRQ

 

END

 

 

I'm wondering if I have problem with DASM or 2600 works this way?

 

 

Serguei2

post-1196-1077039683_thumb.jpg

Link to comment
Share on other sites

So what's wrong with Middle codes?

I've added some comments to your code.

Middle 

sta WSYNC 

lda #$45 

sta COLUPF 

lda #0 

inx 

cpx #105 

bne Middle 

lda #%00000000; we are at line 105 now

sta PF0       ; and *now* we start drawing the middle    

sta PF1 

sta PF2       



Bottom1 

sta WSYNC 

lda #$45 

sta COLUPF 

lda #0 

inx 

cpx #120      ; middle lasts until line 120

bne Bottom1 

lda #%11111111; here the bottom starts

sta PF0 

lda #%11110000 

sta PF1 

lda #%00000000 

sta PF2

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...