Jump to content



0

Problems with playfield


7 replies to this topic

#1 Serguei2 OFFLINE  

Serguei2

    Moonsweeper

  • 284 posts
  • Location:Canada

Posted Tue Feb 17, 2004 11:38 AM

I gave it a try to make my own playfield.

I got strange results:

Quote

;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

Attached Thumbnails

  • z2602.gif


#2 Serguei2 OFFLINE  

Serguei2

    Moonsweeper

  • 284 posts
  • Location:Canada

Posted Tue Feb 17, 2004 11:41 AM

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

[quote];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[/quote]


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


Serguei2[/quote]

Attached Thumbnails

  • z2603.gif


#3 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!

  • 16,745 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany

Posted Tue Feb 17, 2004 12:14 PM

If you want it to look like the lower picture, your problem is, that you first wait and then draw (Middle). But you have to draw first, and then wait until you change the pattern again.

#4 Serguei2 OFFLINE  

Serguei2

    Moonsweeper

  • 284 posts
  • Location:Canada

Posted Tue Feb 17, 2004 2:34 PM

Hi Thomas

I used Andrew's tutorial 15 to make my own playfield.


Quote

you first wait and then draw (Middle)

But the Middle codes looks like the other codes (Top2, Top3...) they work.

So what's wrong with Middle codes?


Serguei2

#5 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!

  • 16,745 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany

Posted Tue Feb 17, 2004 3:06 PM

Serguei2 said:

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


#6 Serguei2 OFFLINE  

Serguei2

    Moonsweeper

  • 284 posts
  • Location:Canada

Posted Tue Feb 17, 2004 4:07 PM

Thanks Thomas

I'll check it out.


Serguei

#7 Serguei2 OFFLINE  

Serguei2

    Moonsweeper

  • 284 posts
  • Location:Canada

Posted Tue Feb 17, 2004 4:08 PM

Thanks Thomas

I'll check it out.


Serguei


Oops...

#8 Serguei2 OFFLINE  

Serguei2

    Moonsweeper

  • 284 posts
  • Location:Canada

Posted Tue Feb 17, 2004 5:33 PM

Big thanks Thomas

It works.


Serguei2




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users