Jump to content



0

stella flickers, z26 seems ok


5 replies to this topic

#1 xucaen OFFLINE  

xucaen

    Star Raider

  • 94 posts
  • Looking for new owner for commodore 64
  • Location:Ma

Posted Sun Jan 16, 2005 7:00 PM

Hi, I'm playing with playfield registers and doing a simple exercise. When I run this in stella the screen flickers, but it looks OK in z26. Has anyon else noticed differences between these two emulators? Is there something wrong with my code?


    processor 6502

    include vcs.h

    include macro.h

    SEG

    org $F000



VarPf = $80



Reset


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   ; Clear RAM and all TIA registers



       ldx #0

       lda #0

Clear  sta 0,x

       inx

       bne Clear

      ;total 9 bytes!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



       ;load test playfield bits

        LDA #%10001000

        STA VarPf

StartOfFrame



       ;/////////////////////////////////////////////////

        VERTICAL_SYNC   

       ;////////////////////////////////////////////////



        ldx #37    ; 37 scanlines of vertical blank...

vblankloop

        sta WSYNC

        dex

        bne vblankloop



        LDA #%00000001

        STA CTRLPF

        LDA #0

        STA VBLANK
;draw the viewable screen



        ldx 192

        LDA VarPf

        LDY #$16

        STY COLUPF

        sta PF0

        sta PF1

        sta PF2

DrawLoop        

        sta WSYNC

        dex

        bne DrawLoop





        LDA #%01000010     ; Disable TIA Output

        STA VBLANK


;overscan


;initialize graphics

        LDA     #$00   ; put $00 in A

        STA WSYNC

        STA     PF0; clear out first playfield section

        STA     PF1; clear out second playfield section

        STA     PF2; clear out third playfield section

        STA     GRP0   ; clear out player graphic 0

        STA     GRP1   ; clear out player graphic 1

        STA     ENAM0  ; clear out missile 0

        STA     ENAM1  ; clear out missile 1

        STA     ENABL  ; clear out ball

        STA     COLUP0 ; set player 0 to black

        STA     COLUP1 ; set player 1 to black

        STA     COLUPF ; set playfield to black

        STA     COLUBK ; set background to black
;end initialize graphics



        ldx  #30 

overscanLoop

        sta WSYNC

        dex

        bne overscanLoop





        JMP StartOfFrame



       ;this is the end. change origin to the end of the 4k rom

        org $FFFA

TheEnd

        .word Reset    ;NMI;used in 7800?

        .word Reset    ;RESET

        .word Reset    ;IRQ;used in 7800?



       ;end of file

        END


thanks,

Jim

#2 Jacob Rose OFFLINE  

Jacob Rose

    Dragonstomper

  • 540 posts
  • Location:Fairfax, Virginia

Posted Sun Jan 16, 2005 8:06 PM

I've definitely noticed differences between Stella and z26. I think Stella usually displays better; qb's flicker is less noticeable in Stella, as is the flicker in the copyright screen in the game I'm working on (slowly, as time permits). I loaded your code onto my 2600 via Supercharger and it flickered, there, too, but then went gray and stopped. I think there might be a timing problem with your code? I'm a novice at this myself. I use the scanline-counting switch in z26 to check that the display is properly aligned.

#3 Robert M OFFLINE  

Robert M

    Stargunner

  • 1,481 posts
  • Rootbeer!
  • Location:Western NY state

Posted Sun Jan 16, 2005 9:25 PM

Hi,

Looking at your code, I don't see the 3 lines of vertical sync needed at the start of each frame. It might be why its flickering in Stella.

Cheers!

#4 xucaen OFFLINE  

xucaen

    Star Raider

  • 94 posts
  • Looking for new owner for commodore 64
  • Location:Ma

Posted Sun Jan 16, 2005 9:59 PM

criminal unbeliever said:

II use the scanline-counting switch in z26 to check that the display is properly aligned.

Hi, I did that and it shows my example runninfg 45 FPS and 343 lines. Yikes!

After careful examination I found what I did wrong:

;draw the viewable screen



        ldx 192;<-- I forgot the '#' symbol

               ;    so I was moving junk from address 192

               ;    instead of the value 192

        LDA VarPf

        LDY #$16

        STY COLUPF

        sta PF0

        sta PF1

        sta PF2

DrawLoop

        sta WSYNC

        dex

        bne DrawLoop




This is one hell of a gotcha! Is there an emoticon for embarrased? :ponder:

Jim

#5 Jacob Rose OFFLINE  

Jacob Rose

    Dragonstomper

  • 540 posts
  • Location:Fairfax, Virginia

Posted Mon Jan 17, 2005 1:03 PM

I made the same sort of mistake and posted it on AA myself; you're not alone. =)

#6 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!

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

Posted Mon Jan 17, 2005 1:30 PM

Forgetting the '#' is a very common mistake which happens to (almost ;)) everybody.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users