Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper VIC RASTER ($D012) register behaviour in NTSC mode #362

Open
FeralChild64 opened this issue Feb 9, 2021 · 2 comments
Open

Improper VIC RASTER ($D012) register behaviour in NTSC mode #362

FeralChild64 opened this issue Feb 9, 2021 · 2 comments
Labels
bug Confirmed bug.
Milestone

Comments

@FeralChild64
Copy link

In PAL mode, the RASTER ($D012) register goes from $00 to $FF, afterwards from $00 to $38, and repeats; it's OK, this gives 312 lines.

In NTSC mode, it goes from $00 to $FF, and repeats (next cycle goes from $00 to $FF again) - this is wrong, the next cycle should go from $00 to $05 (if MOS 6567R56A is implemented) or $06 (if MOS 6567R8 is implemented). Real world result: Open ROMs fails to start in NTSC mode, it gets stuck at the beginning of the video system test, see https://github.com/MEGA65/open-roms/blob/master/src/kernal/init/setup_pal_ntsc.s

Code snipped I used to detect the actual behavior:

	; Fill-in $C000-$C0FF with 0's, leave 0 in .X

	lda #$00
	ldx #$00
@0:
	sta $C000,x
	inx
	bne @0

	; Wait till raster is $FF
@1:
	lda VIC_RASTER ; $D012
	cmp #$FF
	bne @1

	; Wait till raster is $00
@2:
	lda VIC_RASTER
	bne @1
	sta $C000,x
	inx

	; Store all the rasters different than previous ones
@3:
	cmp VIC_RASTER
	beq @3
	lda VIC_RASTER
	sta $C000,x
	lbeq MONITOR
	inx
	lbeq MONITOR
	bra @3

	; The routine ends with launching the integrated monitor; type 'M C000' inside for the results
@gardners
Copy link
Contributor

gardners commented Feb 9, 2021

Ok. Weird. I'll have to have a look at what could be causing that.

@lydon42 lydon42 added the bug Confirmed bug. label Jan 3, 2022
@lydon42 lydon42 added this to the near future milestone Oct 18, 2022
@lydon42 lydon42 modified the milestones: near future, far future May 2, 2023
@ki-bo
Copy link
Member

ki-bo commented Sep 23, 2023

The problem is actually different: in NTSC, the raster counter jumps from 261 to 7, not to 0. It just remains longer at value 261. Therefore, the lbeq MONITOR is not triggered as expected. This is a bug in VIC-IV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug.
Projects
None yet
Development

No branches or pull requests

4 participants