Jump to content
IGNORED

Beginner Timing Issues


Recommended Posts

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
Link to comment
Share on other sites

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.

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...