+xucaen Posted January 17, 2005 Share Posted January 17, 2005 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 Quote Link to comment Share on other sites More sharing options...
Jacob Rose Posted January 17, 2005 Share Posted January 17, 2005 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. Quote Link to comment Share on other sites More sharing options...
Robert M Posted January 17, 2005 Share Posted January 17, 2005 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! Quote Link to comment Share on other sites More sharing options...
+xucaen Posted January 17, 2005 Author Share Posted January 17, 2005 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? Jim Quote Link to comment Share on other sites More sharing options...
Jacob Rose Posted January 17, 2005 Share Posted January 17, 2005 I made the same sort of mistake and posted it on AA myself; you're not alone. =) Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted January 17, 2005 Share Posted January 17, 2005 Forgetting the '#' is a very common mistake which happens to (almost ) everybody. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.