All my questions are here.. ;o)

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

tepples
Posts: 22375
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: question about mmc1 and mmc3

Post by tepples » Tue Sep 19, 2006 6:00 pm

lord_Chile wrote:1.- mmc1 ports are 1 bit.. But if i wanna reset register 0 i would write eight times to register 0, no? But what values are written to bits 5 and 6 (unknow bits)??
MMC1 ports are 1-bit, but you write five times to register 0. The upper bit just resets the shift register and twiddles some bits in register 0.
$8000 - $9FFF (Register 0)

RxxCFHPM

When i write first 5 bits, register is ready to execute.. i think..
Someone can explain this to me, please?
That depiction is misleading. There's nothing 8-bit about any of the MMC1 registers. The wiki article is easier to understand IMHO.
2.- mmc3 bankwitch are 8kb for prg.... but i have problems switching vrom..

If command is 3, The $8001 page number assume 1024kb vroms pages??
by example if rom have 2 pages of chr, each one 8kb, Then max value for $8001 is (2*8)-1=15???
A lot of the mapper docs out there are severely outdated. Does the wiki agree?

mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago
Contact:

Post by mattmatteh » Wed Sep 20, 2006 12:17 pm

why are all these questions in 1 long thread? having different smaller threads with topics makes it alot easier to search. but..... the search is broke.... maybe 1 indefinite thread is better.

User avatar
lord_Chile
Posts: 120
Joined: Thu Feb 02, 2006 7:07 am
Location: Chile (South America), Quilpué
Contact:

question about MMC3! and DD3

Post by lord_Chile » Sun Oct 15, 2006 5:17 pm

Hi. Today my question is about mapper MMC3. My emu fails to execute double dragon 3 (sacred stones).
My emu executes all good (title screen) until where it is starting to say press start. I did debug my emu.
Problem I think is that bankswitch in order that BANK_A=$1A000 never is completed.. Then take a look to my
comments in debug:

(Note: branches are ok, they are relative, but i did a simple debug
and i want minus kb for the file, then any op dont have registers or addresses)
Only the most importants parts for understand are here.

We are executing code

Code: Select all

$FF25: A9 LDA #$1             A:0 X:BC Y:5F P:32
$FF27: 8D STA $6D8               A:1 X:BC Y:5F P:30
$FF2A: A9 LDA #$7             A:1 X:BC Y:5F P:30
$FF2C: 8D STA $A2               A:7 X:BC Y:5F P:30
$FF2F: 8D STA $8000               A:7 X:BC Y:5F P:30
(We can see that STA $8000 is sended with command number 7, then i will be waiting STA $8001 to select BANK A)..
Theorically for select bank A=$1A000, i have to send value 13 ($0D) because DD3 has around(8*2)=16 banks of 8kb..

But after $FF2F is executed, one NMI is triggered!
***NMI TRIGGERED***

Code: Select all

$FF5F: 24 BIT $A3               A:7 X:BC Y:5F P:34
$FF61: 10 BPL 
$FF6B: 50 BVC 
$FF6D: 4C JMP $E070               A:7 X:BC Y:5F P:76
$E070: 48 PHA 
$E071: 8A TXA 
$E072: 48 PHA 
$E073: 98 TYA 
$E074: 48 PHA 
$E075: 20 JSR $FE75               A:5F X:BC Y:5F P:74
$FE75: A9 LDA #$0             A:5F X:BC Y:5F P:74
$FE77: 8D STA $2003               A:0 X:BC Y:5F P:76
$FE7A: A9 LDA #$2             A:0 X:BC Y:5F P:76
$FE7C: 8D STA $4014               A:2 X:BC Y:5F P:74
$FE7F: 60 RTS 
$E078: E6 INC $A8               A:2 X:BC Y:5F P:74
$E07A: A6 LDX $AB               A:2 X:BC Y:5F P:74
*
$FC59: 20 JSR $FF1B               A:5 X:FF Y:0 P:74
*
* We still in NMI, i think that this code is called from NMI, too
$FF2F: 8D STA $8000               A:7 X:FF Y:0 P:74
$FF32: BA TSX 
$FF33: BD LDA $1ED,X               A:7 X:EB Y:0 P:F4
$FF36: A ASL A 
$FF37: 9 ORA #$1             A:2 X:EB Y:0 P:74 (registers before opcode processed)
$FF39: 8D STA $8001               A:3 X:EB Y:0 P:74  (registers before opcode processed)
(here STA $8001 send 3 in order to BANK_A=$6000

$FF3C: A9 LDA #$6             A:3 X:EB Y:0 P:74
$FF3E: 8D STA $A2               A:6 X:EB Y:0 P:74
$FF41: 8D STA $8000               A:6 X:EB Y:0 P:74
$FF44: BD LDA $1ED,X               A:6 X:EB Y:0 P:74
$FF47: A ASL A 
$FF48: 8D STA $8001               A:2 X:EB Y:0 P:74
$FF4B: A9 LDA #$0             A:2 X:EB Y:0 P:74
$FF4D: 8D STA $6D8               A:0 X:EB Y:0 P:76
$FF50: 68 PLA 
$FF51: AA TAX 
$FF52: 68 PLA 
$FF53: CD CMP $BFFF               A:1 X:FF Y:0 P:74
$FF56: D0 BNE 
$FF58: 60 RTS 
$FC52: 60 RTS 
$E0A2: 4C JMP $E169               A:1 X:FF Y:0 P:77
$E169: 68 PLA 
$E16A: A8 TAY 
$E16B: 68 PLA 
$E16C: AA TAX 
$E16D: 68 PLA 
$E16E: 40 RTI
***NMI ENDS***
$FF32: BA TSX 
$FF33: BD LDA $1F9,X               A:7 X:F7 Y:5F P:A0
$FF36: A ASL A 
$FF37: 9 ORA #$1             A:C X:F7 Y:5F P:20
$FF39: 8D STA $8001               A:D X:F7 Y:5F P:20
(Here is right value=13 to select in bank A. Remember $8000 at start of code (It is the complement of this!),
but since NMI was triggered. NMI did send value 3 to $8001, also NMI change $8000 command number to 6!
and now BANK_A=$6000 (3*8192) (incorrect address), then game crashes)

How can i repair it?.
If i write to $8000 command 7, but just after it NMI is triggered and i cannot complete my next $8001
to execute command. And NMI uses $8000 and $8001 newly. what can i do?. My problem is bad timing?
I am ok with nmi supression.

Know guys?, when dd3 rom crashes, i patch it doing PC=$FF53 and manually doing a bankswitch using $0D for A=$1A000
and game run good!, but i dont like patches...
Good day to nesdev people. Lord..
Author of nothing =P
UTFSM Sansano programmer.. lord_Chile
Saludos a la Sede JMC de la UTFSM... Viña del Mar, CHILE

mattmatteh
Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago
Contact:

Post by mattmatteh » Sun Oct 15, 2006 10:36 pm

what is so hard about starting a new thread ?

User avatar
commodorejohn
Posts: 194
Joined: Mon Sep 11, 2006 6:48 pm
Location: Moose Lake, Minnesota

Post by commodorejohn » Mon Oct 16, 2006 3:01 pm

It makes more little threads to scroll through when looking for a specific old thread. Trust me, he's doing us all a favor.

User avatar
lord_Chile
Posts: 120
Joined: Thu Feb 02, 2006 7:07 am
Location: Chile (South America), Quilpué
Contact:

mat

Post by lord_Chile » Tue Oct 17, 2006 1:30 pm

since im newbie, i dont want many threads with my basic questions, it is more easy for nesdev people read all my basic questions in this only thread.

Please answer my question about double dragon 3
Good day to nesdev people. Lord..
Author of nothing =P
UTFSM Sansano programmer.. lord_Chile
Saludos a la Sede JMC de la UTFSM... Viña del Mar, CHILE

User avatar
Bregalad
Posts: 8034
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad » Tue Oct 17, 2006 2:20 pm

Your problem is quite bizare. It looks just like a bug in the game (normally, the game would disable NMI while writing to the mapper just like MMC1 games does when writing to the serial ports).
Maybe your speed isn't exact, maybe you're emulating the PAL card in NTSC or vice-versa.
Useless, lumbering half-wits don't scare us.

User avatar
lord_Chile
Posts: 120
Joined: Thu Feb 02, 2006 7:07 am
Location: Chile (South America), Quilpué
Contact:

Question about directdraw 7

Post by lord_Chile » Mon Oct 30, 2006 12:35 pm

Hi, a question. Im newbie in directx, i did read many things about directx, then i think use directx 7 for my emulator. I dont want to use direct3d (direct8), then i will use directdraw 7 for now. But i did start my emu using GDI. In GDI i send RGB Colors (32 bit long values) to one matrix of pixels and then i use one function to show it on screen. It is slow, but i dont know how to start with directx. I understand surfaces, backbuffer and primary buffer, flipping, rects. I did search 2d directdraw examples in visual basic 6, but all examples create one surface from file (to load sprites and backgrounds from bmp files). You know that in emulators sprites and background are taken and we send pixels to screen in runtime.

Then surfaces only accept bitmaps?... i did think in create bitmaps at start of the game reading the chr. But the problem is when game uses chr ram and another problem is how i change the palette of created bitmap?. Can you give me one logic pseudocode to make it?, how you implement directdraw in your emu?, I dont want directdraw code, i know it, but i want that you can give me one idea about how sending 32 bit (Long RGB) pixels in runtime to one surface in order to show it one screen. there is a method for make something similar like when i did use GDI?:

1.- sending rgb values to one matrix
2.- show it on screen using Blt
Good day to nesdev people. Lord..
Author of nothing =P
UTFSM Sansano programmer.. lord_Chile
Saludos a la Sede JMC de la UTFSM... Viña del Mar, CHILE

User avatar
Quietust
Posts: 1784
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Question about directdraw 7

Post by Quietust » Mon Oct 30, 2006 2:31 pm

lord_Chile wrote:1.- sending rgb values to one matrix
2.- show it on screen using Blt
If you're using DirectDraw7 windowed, it's pretty much exactly as you described - you Lock() the secondary surface, write raw RGB data into the array provided (lpSurface), Unlock() it, then finally Blt() it into the primary surface (or Flip(), if you're doing fullscreen).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

Post Reply