Page 10 of 10

Re: question about mmc1 and mmc3

Posted: Tue Sep 19, 2006 6:00 pm
by tepples
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?

Posted: Wed Sep 20, 2006 12:17 pm
by mattmatteh
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.

question about MMC3! and DD3

Posted: Sun Oct 15, 2006 5:17 pm
by lord_Chile
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...

Posted: Sun Oct 15, 2006 10:36 pm
by mattmatteh
what is so hard about starting a new thread ?

Posted: Mon Oct 16, 2006 3:01 pm
by commodorejohn
It makes more little threads to scroll through when looking for a specific old thread. Trust me, he's doing us all a favor.

mat

Posted: Tue Oct 17, 2006 1:30 pm
by lord_Chile
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

Posted: Tue Oct 17, 2006 2:20 pm
by Bregalad
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.

Question about directdraw 7

Posted: Mon Oct 30, 2006 12:35 pm
by lord_Chile
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

Re: Question about directdraw 7

Posted: Mon Oct 30, 2006 2:31 pm
by Quietust
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).