Troy Fullwood Posted May 1, 2018 Share Posted May 1, 2018 My kernal timing is off by several scanlines; what am I doing wrong? NewFrame VERTICAL_SYNC lda #44 ;(37*76+13)/64=44 sta WSYNC sta TIM64T jsr VRoutine VWait lda INTIM bne VWait lda #0 sta VBLANK ldx #192 ;192 scanlines ScanLoop sta HMCLR ;Clear horiz. pos. dec M0_COUNT bpl SkipMoveM0 ;If M0_Count < 0, then move M0 lda #M0_SLOPE ;Reset M0_COUNT sta M0_COUNT lda #$F0 ;-1 nybble in two's complement sta HMM0 ;move 1 pixel left SkipMoveM0 sta WSYNC SkipWSYNC sta HMOVE dex bne ScanLoop Overscan lda #35 ;(30*76+13)/64=35 sta WSYNC sta TIM64T jsr ORoutine OWait lda INTIM bne OWait jmp NewFrame Quote Link to comment Share on other sites More sharing options...
+Karl G Posted May 1, 2018 Share Posted May 1, 2018 You are missing the lines for VSYNC, nor are you generating the signal in your display. You will want to add something like this before setting your vblank timer: lda #2 ; LoaD Accumulator with 2 so D1=1 sta WSYNC ; Wait for SYNC (halts CPU until end of scanline) sta VSYNC ; Accumulator D1=1, turns on Vertical Sync signal sta WSYNC ; Wait for Sync - halts CPU until end of 1st scanline of VSYNC sta WSYNC ; wait until end of 2nd scanline of VSYNC lda #0 ; LoaD Accumulator with 0 so D1=0 sta WSYNC ; wait until end of 3rd scanline of VSYNC sta VSYNC ; Accumulator D1=0, turns off Vertical Sync signal This was taken from this tutorial. Alternately, you can also set a shorter timer for the VSYNC time if you want to make use of those extra cycles. The tutorial series pinned to the "2600 Programming For Newbies" forum also describes TV timings, etc. in great detail. Quote Link to comment Share on other sites More sharing options...
TheHoboInYourRoom Posted May 1, 2018 Share Posted May 1, 2018 You are missing the lines for VSYNC, nor are you generating the signal in your display. No, Troy's code uses the VERTICAL_SYNC macro from, presumably, macro.h. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted May 2, 2018 Share Posted May 2, 2018 Ahh, good point. I can't see anything that would cause it, then, unless either the VRoutine or ORoutine use too many cycles. 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.