Dwedit's Board

Enjoy the board

You are not logged in.

Announcement

Welcome, fellow visitors from other websites!
Whenever you download a file, I'd appreciate it if you posted a nice "Thank You" message, then tell me which site you came from. Thanks.
- Dwedit

#1 2009-09-21 11:15:41 am

morbid27
Shigeru Miyamoto
Shigeru Miyamoto
Registered: 2008-06-13
Posts: 104

What exacly does this fix - 6502.s code

I`m Thinking this will fix Final Fantasy 2 and EB0 take a look

ntsc_pal_reset
;---NTSC/PAL
	stmfd sp!,{globalptr,lr}
	ldr globalptr,=GLOBAL_PTR_BASE
	
	ldr r0,emuflags
	tst r0,#PALTIMING
	ldreq r1,=256*CYCLE		;NTSC		(113+2/3)*3
	ldrne r1,=240*CYCLE		;PAL		(106+9/16)*3
	str r1,cyclesperscanline1
	ldreq r1,=85*CYCLE		;NTSC		(113+2/3)*3
	ldrne r1,=80*CYCLE		;PAL		(106+9/16)*3
	str r1,cyclesperscanline2
	ldreq r1,=261			;NTSC
	ldrne r1,=311			;PAL

Specifically this:
[b]
	str r1,lastscanline
	ldreq r1,cyclesperscanline1_modify_ntsc
	ldrne r1,cyclesperscanline1_modify_pal
	ldr r0,=cyclesperscanline1_modify
	str r1,[r0]
	ldreq r1,cyclesperscanline2_modify_ntsc
	ldrne r1,cyclesperscanline2_modify_pal
	ldr r0,=cyclesperscanline2_modify
	str r1,[r0]
	ldreq r1,scroll_threshhold_mod_ntsc
	ldrne r1,scroll_threshhold_mod_pal
	ldr r0,=scroll_threshhold_mod
	str r1,[r0]
	
	
	mov r0,#0
	strb r0,PAL60
	
	ldrb r0,mapper_number
	cmp r0,#69
	IMPORT mapper69_ntsc_pal_reset
	bl mapper69_ntsc_pal_reset
	
	ldmfd sp!,{globalptr,lr}
	bx lr

cyclesperscanline1_modify_ntsc	add cycles,cycles,#256*CYCLE
cyclesperscanline1_modify_pal	add cycles,cycles,#240*CYCLE
cyclesperscanline2_modify_ntsc	add cycles,cycles,#85*CYCLE
cyclesperscanline2_modify_pal	add cycles,cycles,#80*CYCLE
scroll_threshhold_mod_ntsc	cmp r1,#(251-3*3)*CYCLE
scroll_threshhold_mod_pal	cmp r1,#227*CYCLE
[/b]

if you could elaborate what this fixes.

Offline

#2 2009-09-21 4:51:27 pm

Dwedit
Princess Lapis of Sorcerland (Administrator)
From: Chicago
Registered: 2004-12-12
Posts: 906
Website

Re: What exacly does this fix - 6502.s code

That code selects whether we're using NTSC or PAL timing.  It has nothing to do with NTSC only games like FF2 and EB0.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#3 2009-09-22 5:08:30 am

morbid27
Shigeru Miyamoto
Shigeru Miyamoto
Registered: 2008-06-13
Posts: 104

Re: What exacly does this fix - 6502.s code

Hmm must be the way you set up the dirty tile system and that new bg renderer than.
Iv'e used all your mappers along with half of 6502 in nesds but these games still dont work.
Kinda thought it was the threshhold mod ect. anyways just studying this project has taught me so much about coding without reading my C for dummies book LOL.
Thanks

Offline

#4 2009-09-22 5:15:32 am

Dwedit
Princess Lapis of Sorcerland (Administrator)
From: Chicago
Registered: 2004-12-12
Posts: 906
Website

Re: What exacly does this fix - 6502.s code

"Scroll Threshold" has to do with vertical scrolling.
At a certain PPU pixel (#251), the Y scroll gets incremented.  So if a game writes to Y scroll at certain times during the scanline, it will shake status bars up and down if the emulator doesn't get the timing right.
So the code there makes it so that a write beginning at 242 (should be 239), which would finish past 251, would not have the Y position increment after the write.
In PAL mode (European NES), the CPU is slower relative to the PPU, so it uses a different threshold.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#5 2009-09-24 12:13:20 am

morbid27
Shigeru Miyamoto
Shigeru Miyamoto
Registered: 2008-06-13
Posts: 104

Re: What exacly does this fix - 6502.s code

Got it cool. One more question so what might i add to stop the bad graphic jumps in final fanatasy 2 then.

Offline

#6 2009-09-24 12:22:51 am

morbid27
Shigeru Miyamoto
Shigeru Miyamoto
Registered: 2008-06-13
Posts: 104

Re: What exacly does this fix - 6502.s code

This is a problem i believe you fixed in your pocknes versions.

Offline

#7 2009-09-24 4:03:16 am

Dwedit
Princess Lapis of Sorcerland (Administrator)
From: Chicago
Registered: 2004-12-12
Posts: 906
Website

Re: What exacly does this fix - 6502.s code

Are you talking about things related to scrolling?  Vertical scrolling used to be broken for a while, since it did not follow the way the NES does it.  Clash at Demonhead is a notable example (Pause the game and watch it flicker like crazy)


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#8 2009-09-26 10:33:57 am

morbid27
Shigeru Miyamoto
Shigeru Miyamoto
Registered: 2008-06-13
Posts: 104

Re: What exacly does this fix - 6502.s code

So which parts of vertical scrolling did you make the code for to follow properly could you lead me to the examples? that would be great.

Basically what i would add in Nesds i already got your mappers and the top half of the 6502 file compiling.

Last edited by morbid27 (2009-09-26 10:49:56 am)

Offline

Quick reply

Write your message and submit

Board footer

Powered by FluxBB