Relaunch has none of the the old code that I wrote over 10 years ago. New code based off of jsNES, but with a ton of improvements to make it lots faster, uber fast 2x zooming, fixed a bunch of bugs, expanded mapper support, and google search integrated for lots of roms w/out the legal hastle!
http://zelex.net/nezulator
w00t!
Zelex wrote:
Relaunch has none of the the old code that I wrote over 10 years ago. New code based off of jsNES, but with a ton of improvements to make it lots faster, uber fast 2x zooming, fixed a bunch of bugs, expanded mapper support, and google search integrated for lots of roms w/out the legal hastle!
http://zelex.net/nezulatorw00t!
I get about 8-10FPS running SMB1 on my Intel core i5 @ 2.6GHz. Is this expected?
I guess speed largely depends on the browser you're using. It probably runs much faster on Chrome, since it compiles JavaScript IIRC.
58-60Fps is what it says for me on Chrome 10, but it still runs very choppy. Good job though. Although, I think a interface like jsNES would be nicer.
Yeah, definitely run in chrome. Firefox and Opera are over twice as slow -- and believe me that this emulator pushes the boundaries of what is possible in javascript. Its a really... really slow language.
I'm working on some changes to squeeze out another 5 fps or so, but it makes a world of difference for my laptop. Hopefully be done this weekend sometime
I got around 6fps in Firefox but a perfect 60 in Chrome. The sound was badly out of sync though, but I didn't even expect it to have any sound. How did you implement sound with JavaScript anyway? This is pretty amazing.
Nezulator wrote:
A is Z
B is X
Nope. A is X. B is Z.
tokumaru wrote:
I got around 6fps in Firefox
Firefox 3 or Firefox 4?
tokumaru wrote:
How did you implement sound with JavaScript anyway?
This page might explain: make a .wav file, base64 encode it as a data: URI, and put it in an <audio> element. The other way is to use an
experimental browser-specific audio stream API.
Kasumi wrote:
Nezulator wrote:
A is Z
B is X
Nope. A is X. B is Z.
woops. my bad. fixing now
tokumaru wrote:
I got around 6fps in Firefox but a perfect 60 in Chrome. The sound was badly out of sync though, but I didn't even expect it to have any sound. How did you implement sound with JavaScript anyway? This is pretty amazing.
Chrome and Firefox have a raw sound api that allows you to do it. It also uses a flash based fallback if your not in firefox. (currently implementing the chrome api). The flash based fallback is why the sound is delayed a bit. Working on implementing the chrome api soon.
Cool. I'm surprised nobody has made a decent emulator for the NES specifically for Chrome and put it on the Chrome Experiments page. I forgot to mention earlier but I also had delayed sound, but apparently you know.
And it'd be nice to add the buttons WSADGHKL as Up,Down,Left,Right,Select,Start,B,A. It's a lot more natural to play that way.
And a option to select a file on your computer to play would be needed, as....well...the search sucks. Typed in Mario and the first result was: NES****DiskDude!x¡* *√óÄ Ä* ܪpá*ä*áäæê.......That's not good.
3gengames wrote:
Cool. I'm surprised nobody has made a decent emulator for the NES specifically for Chrome and put it on the Chromium projects. I forgot to mention earlier but I also had delayed sound, but apparently you know.
And it'd be nice to add the buttons WSADGHKL as Up,Down,Left,Right,Select,Start,B,A. It's a lot more natural to play that way.
Thats a good idea! I wonder if its hard to put it up there?
My $2 : Making an emulator for a specific browser is, in my opinion as dumb as making a game for a specific emulator.
You're right....lets use IE6 as the basis for all web development and not move forward with open source and high quality 21st technology. But I think we are mainly talking HTML5 tech, not just Chrome alone.
Bregalad wrote:
My $2 : Making an emulator for a specific browser is, in my opinion as dumb as making a game for a specific emulator.
Unlike the NES, the web browser is an evolving platform. Browser-specific APIs like this are often testbeds for APIs that will be put in the next version of HTML. So if your emulator supports both the Firefox and Chrome APIs, you're covered if either one gets accepted into the next version of HTML. So to continue the NES analogy, it's like making a game for a specific mapper.
3gengames wrote:
You're right....lets use IE6 as the basis for all web development and not move forward with open source and high quality 21st technology. But I think we are mainly talking HTML5 tech, not just Chrome alone.
I'm not sure if I got the sarcasm/irony of your post, but I'm not using IE6, nor is Chrome open source as far as I know. On the other hand, Chrome is run by a company even more powerful than Microsoft. If you are against ultra-large-companies-sitting-on-their-monopoly you'd avoid Chrome even more then IE.
Not that I am opposed against chrome, I haven't ever tried it. I was just not sure what you were talking about.
Chrome is based off the Chromium browser, it's open source.
But point aside....can we please get ROM loading from a file? I want to see some other stuff on this.
3gengames wrote:
Chrome is based off the Chromium browser, it's open source.
But point aside....can we please get ROM loading from a file? I want to see some other stuff on this.
Yup, np
Zelex wrote:
3gengames wrote:
Chrome is based off the Chromium browser, it's open source.
But point aside....can we please get ROM loading from a file? I want to see some other stuff on this.
Yup, np
Woah, totally awesome, can't wait for this update!
Also, I think the MMC3 mapper code or CPU code will need fixing. VNES was never to emulate Crystalis correctly. I don't know if you've fixed/upgraded the CPU at all, but something is off there in it's inner workings.
3gengames wrote:
Woah, totally awesome, can't wait for this update!
Also, I think the MMC3 mapper code or CPU code will need fixing. VNES was never to emulate Crystalis correctly. I don't know if you've fixed/upgraded the CPU at all, but something is off there in it's inner workings.
Yeah, I had to make a bunch of improvements to fix crystalis, super mario 3, and a bunch of others. AFAIK crystalis is working, but I haven't played all the way through.
Zelex wrote:
3gengames wrote:
Woah, totally awesome, can't wait for this update!
Also, I think the MMC3 mapper code or CPU code will need fixing. VNES was never to emulate Crystalis correctly. I don't know if you've fixed/upgraded the CPU at all, but something is off there in it's inner workings.
Yeah, I had to make a bunch of improvements to fix crystalis, super mario 3, and a bunch of others. AFAIK crystalis is working, but I haven't played all the way through.
Woah, seems like you're on it. I think it was just nametables and IRQ being off. But I haven't played it all the way through on vNES, but it's probably fine.
I should say that there are some very very minor graphical glitches due to some IRQ timing issues, but they are hardly a problem imo and cause a 1 scanline error upon entering a chat w/ somebody. The majority of the timing is pretty accurate -- walking around causes no issues.
ok, just drag a .nes file onto the emulator window and it will load it. I'll add instructions soon.
just finished support for SRAM
now I don't have to start at the beginning anymore! yay!
Cool. Does it do HTML5 localStorage for it? I think that should be added, so you can keep all your saves inside it....Just a feature I think would be cool.
Also, are you sure the emulators FPS counter is going by screen updates? It really hits a lot of drags, but still says in the 50-60FPS are, but is just......bad.
3gengames wrote:
Cool. Does it do HTML5 localStorage for it? I think that should be added, so you can keep all your saves inside it....Just a feature I think would be cool.
Also, are you sure the emulators FPS counter is going by screen updates? It really hits a lot of drags, but still says in the 50-60FPS are, but is just......bad.
Yup, HTML5 local storage
no, I haven't verified the FPS counter yet.
Okay, awesome. Emulation in the 21st century now!
Wow, it seems pretty accurate from what I see right now. Next up, some battletoads...
It seems to play battletoads, but them emulator allows left+right, probably up+down to.
So I had a legal question. Is it illegal if you do what NEZulator does and use google and other search methods to find roms that other people host publicly on the internet and then load them up in the emulator?
I mean, wouldn't google itself be infringing on copyrights if that is the case?
Possibly. If I were you, I'd only support games vNES uses and shares off their mirrors. You should be able to compile a list and a way to generate URL's for every game. I know sometimes when I needed ROM's, I got them off of vNES.
I've read over VirtualNes.com's legal info, and I made some modifications to the site to prohibit the downloading of roms found by searching. I believe that will make the site legally compatible.
Could anything be done to stop the return of crapped on ROMS? [DiskDude!]
I couldn't tell a difference from the search, but it's yet to return a ROM that was what I searched for. They're narly all hacks. >.<
How can that site (virtualnes.com) be even possibly legal? Just because a typical user can't save the files doesn't mean they aren't transmitted in full, and can't be retrieved from the browser cache, packet dumps, or process RAM.
If a user goes around the standard operation of a program or website and hacks to do something illegal, its not the fault of the program or website assuming reasonable measures were taken.
Dwedit wrote:
How can that site (virtualnes.com) be even possibly legal? Just because a typical user can't save the files doesn't mean they aren't transmitted in full, and can't be retrieved from the browser cache, packet dumps, or process RAM.
They aren't saved as a .NES file, they're just a file. I think that's their only catch? And plus that it works on the premise of "lending" the games code to you to play probably. Hence why they need each cart for it to have the game. But games that they don't have aren't in those mirror sites, so watch out.
This is amazing, I never though javascript could run fast enough to allow NES emulation. Great job.
just finished implementing game genie codes
Anybody have any contact info for the VirtualNES.com developers?
The forums?
3gengames wrote:
The forums?
hehe, was thinking email address. But forums might work. I'll try. Already tried their contact page and got nothing back.
this is pretty damn cool! it's actually got excellent compatibility and accuracy.
edit: some of the text displays in marble madness use the wrong nametable, but even some of the best emus out there mess that one up. battletoads seems to work well.
ahhh, mid-scanline nametable changing -- yes definitely doesn't support that. I wonder if that is what is wrong with Earth Bound Zero as well
Not only this runs slowly as hell in Opera, but also it's extremely impractical to have 'X' and 'Z' the A and B key when one is at the other side of the keyboard of the other (german keyboard).
the slow part you need to blame Opera. The other part....not sure. Mappable keys would be awesome, but only if he wants to.
Bregalad wrote:
(german keyboard)
Man, what a weird keyboard... Everything else (except for special characters, of course) is like a normal QWERTY keyboard, only Y and Z are swapped!
But yeah, there are different keyboard layouts around the world, and hardcoding keys is bad not only because of that, but even people who use the same keyboard layout do not have the same preferences. This should be an easy fix... He's emulating a freaking NES in JavaScript, I'm sure he can make the keycodes configurable.
tokumaru wrote:
Bregalad wrote:
(german keyboard)
Man, what a weird keyboard... Everything else (except for special characters, of course) is like a normal QWERTY keyboard, only Y and Z are swapped!
That's why I don't use it most of the time...(Yes, I'm from Germany btw)
My laptop has a QWERTY keyboard and I love it for the bigger shift-keys and it is also way better for programming since the special characters are somewhat "easier" to use...it's hard to explain but programming for me felt always more natural with a QWERTY keyboard than with the german QWERTZ one.
But there are more changes than you think: The "greater than" and "smaller than" are on a seperate key and the questionmark is where you would expect the hyphen to be.(They traded places as well)
Also the forward-slash is somewhat hard to reach (Shift + 7 key)
The weirdest thing is the Alt-Gr key which is used to put even more characters on one key. That's actually wouldn't be to bad, but you actually type EVEN more characters by using Shift+Alt-Gr+any key! It's like if they thought that we will need greek letters every day when we use our computer...
But yeah, it would be awesome if you could map the keys for yourself!
Yeah, I can pretty easily put in keyboard maps. I'll do it as soon as I'm done implementing MMC2 for Punch out. (which is a PIA btw.. automatic mid-scanline nametable switching... )
Zelex wrote:
Yeah, I can pretty easily put in keyboard maps. I'll do it as soon as I'm done implementing MMC2 for Punch out. (which is a PIA btw.. automatic mid-scanline nametable switching... )
i've never been able to get the punch out mapper working quite right in my emulator, i didn't know about the auto nametable switching and i havent seen it in any docs. what exactly does it do?
Basically, whenever the PPU or CPU reads/writes from some specific addresses, a bank change happens automatically at that point. This alleviates the CPU's need to do the bank switches manually.
So far I have the backgrounds behaving properly, but the sprites are not working 100% correctly. Unsure of the exact cause at the moment.
Just got everything mostly working. Still a few glitches here and there that I'm working on, but otherwise very playable and enjoyable
also just through in basic support for fire emblem, seeing as its nearly identical to MMC2. Still some graphical issues to work out however.
looks pretty good. do you have a link to the doc you used to implement those automatic bank switches?
i would kill to get punch out going correctly in my emu! right now it runs the ROM, but there is graphical garbage everywhere. half the screens are barely recognizable, and then it locks up as you start the fight with glass joe.
here's what i get:
the second pic is the frame it locks up on.
Waiting for a Sprite 0 hit I presume...
I primarilly referenced yoshi's doc and the nesdev wiki. The rest was just fiddling with things trying to figure out how the game actually uses the mapper.
One key point that the docs just brush upon, but don't really stress is that punch out *requires* that you to actually render the off-screen 33rd tile. It uses that tile to trigger the latch and switch VRAM banks.
Other than that. While your rendering the scan-line, every time it accesses < 0x2000 name tables, just do your latch calculations to possibly switch banks.
Example code:
Code:
Nezulator.Mappers[9].prototype.reset = function() {
Nezulator.Mappers[0].prototype.reset.apply(this);
this.latch_a = 0xFE;
this.latch_b = 0xFE;
this.latchFD0 = 0;
this.latchFE0 = 4;
this.latchFD1 = 0;
this.latchFE1 = 0;
this.numTiles = 33;
};
Nezulator.Mappers[9].prototype.write = function(address, value) {
// Writes to addresses other than MMC registers are handled by NoMapper.
if (address < 0x8000) {
Nezulator.Mappers[0].prototype.write.apply(this, arguments);
return;
}
switch(address >> 12) {
case 0xA:
this.load8kRomBank(value, 0x8000);
break;
case 0xB:
this.latchFD0 = value;
if(this.latch_a == 0xFD) {
this.loadVromBank(this.latchFD0, 0x0000);
}
break;
case 0xC:
this.latchFE0 = value;
if(this.latch_a == 0xFE) {
this.loadVromBank(this.latchFE0, 0x0000);
}
break;
case 0xD:
this.latchFD1 = value;
if(this.latch_b == 0xFD) {
this.loadVromBank(this.latchFD1, 0x1000);
}
break;
case 0xE:
this.latchFE1 = value;
if(this.latch_b == 0xFE) {
this.loadVromBank(this.latchFE1, 0x1000);
}
break;
case 0xF:
if(value & 0x1) {
this.nes.ppu.setMirroring(this.nes.rom.HORIZONTAL_MIRRORING);
} else {
this.nes.ppu.setMirroring(this.nes.rom.VERTICAL_MIRRORING);
}
break;
default:
break;
}
};
Nezulator.Mappers[9].prototype.loadROM = function(rom) {
if (!this.nes.rom.valid) {
alert("MMC2: Invalid ROM! Unable to load.");
return;
}
// Load PRGUROM:
// Swappable
this.load8kRomBank(0, 0x8000);
// Hard-wired
this.load8kRomBank((this.nes.rom.romCount * 2) - 3, 0xA000);
this.load8kRomBank((this.nes.rom.romCount * 2) - 2, 0xC000);
this.load8kRomBank((this.nes.rom.romCount * 2) - 1, 0xE000);
// Load CHR-ROM:
this.loadVromBank(4, 0x0000);
this.loadVromBank(0, 0x1000);
// Do Reset-Interrupt:
this.nes.cpu.requestIrq(this.nes.cpu.IRQ_RESET);
};
Nezulator.Mappers[9].prototype.latchAccess = function(address) {
address &= 0x1FF0;
if(address === 0x0FD0 && this.latch_a != 0xFD) {
this.latch_a = 0xFD;
this.loadVromBank(this.latchFD0, 0x0000);
} else if(address == 0x0FE0 && this.latch_a != 0xFE) {
this.latch_a = 0xFE;
this.loadVromBank(this.latchFE0, 0x0000);
} else if(address == 0x1FD0 && this.latch_b != 0xFD) {
this.latch_b = 0xFD;
this.loadVromBank(this.latchFD1, 0x1000);
} else if(address == 0x1FE0 && this.latch_b != 0xFE) {
this.latch_b = 0xFE;
this.loadVromBank(this.latchFE1, 0x1000);
}
};
I should mention that Yoshi's doc is wrong. My code is right.
Fixed most of the graphical glitches early this morning. Still one left w/ scanlines and sprites. Probably a timing issue.
Sprite character fetches happen during "hblank time", not during background render time.
I tried on rekonq and Firefox (both linux) too. On rekonq, like in Opera, the drag and drop doesn't even have any effect and the google search is not working so I don't know how it works.
In firefox, it runs even 1000 times slower than in Opera (where it was already slow), the whole computer slowed down completely and the mouse was barely moving anymore, I'm glad it didn't crash.
Bregalad wrote:
In firefox, it runs even 1000 times slower
Firefox 3 or Firefox 4? If the latter, please report it to bugzilla.mozilla.org.
I just tested Nezulator on my Chu Chu Rocket game. The joypad reading code fails on that emulator.
Dwedit wrote:
I just tested Nezulator on my Chu Chu Rocket game. The joypad reading code fails on that emulator.
Just in case, make sure you click on the emulator first before trying the controls.
That being said, I did notice that one of the homebrew test roms didn't work with the emulator's joystick code. I'm really not sure why. Perhaps its using some kind of hacky trick to read the input? I haven't looked into it yet as every game I've ever tested has never had the issue. Email me the rom and I'll take a peak at it. jon.olick [at] gmail.com
Bregalad wrote:
I tried on rekonq and Firefox (both linux) too. On rekonq, like in Opera, the drag and drop doesn't even have any effect and the google search is not working so I don't know how it works.
In firefox, it runs even 1000 times slower than in Opera (where it was already slow), the whole computer slowed down completely and the mouse was barely moving anymore, I'm glad it didn't crash.
Yeah, in order for drag and drop to work, they have to implement the HTML5 file api. I haven't really looked into other browsers support of the file api as performance is so horrible in anything non-chrome.
I'll temporarily re-enable the search real quick, but I have to turn it off until I can assert the legal status of it. Some people over at emulation collective said it could be construed as hotlinking and as such be illegal. I'm not too sure about that assertion, but for a $100,000 lawsuit... I'll stay on the conservative side till my IP lawyer gets back to me.
(Specifically, the reason I do not think its hot-linking is that it requires user-action in order to actually load the rom -- therefore not hot linking. Hot linking is where the user has no choice but to download the content.)
Turning Search back off in a few hours btw.
Well have you talked to them about using their mirrors?
Dwedit wrote:
Sprite character fetches happen during "hblank time", not during background render time.
That sounds pretty likely then. I'll take a look at that a bit later today. Thanks for the tip!
The joypad problem:
Chu Chu Rocket writes 1 to 4016 strobe the joystick, then immediately reads from 4016, which reads the state of the first button of the joystick without shifting it. Then it writes 0 to 4016 to allow shifting. If emulated incorrectly, the joystick reads will be wrong.
You can download Chu Chu Rocket from
my website.
So, in Reqonk it runs about the same as in opera, very slow but now nearly as bad as Firefox (3.6)
Why don't you just upgrade to Chrome? It's your browsers problems you keep complaining about. Switch from the browser you're using that apparently sucks at javascript processing. If your using Opera, you'll probably like Chrome.
Again, how slow is it in Firefox 4?
tepples wrote:
Again, how slow is it in Firefox 4?
still very slow. I've spoken to one of the js performance guys at Mozilla about it and he opened a ticket (
bug 654410 on b.m.o) so that he can track it. He's going to analyze the perf of the program in his tools and give some suggestions and more than likely that he will put improvements into the next firefox revision for it.
Good deal. Feel free to
create a b.m.o account (if you haven't), zip up a copy of the emulator, and attach it to the ticket. This way they can test even if your site is down.
Dwedit wrote:
The joypad problem:
Chu Chu Rocket writes 1 to 4016 strobe the joystick, then immediately reads from 4016, which reads the state of the first button of the joystick without shifting it. Then it writes 0 to 4016 to allow shifting. If emulated incorrectly, the joystick reads will be wrong.
You can download Chu Chu Rocket from
my website.
I know whats going on now. The joystick reads as 0x40 for no button pressed and 0x41 for button pressed. I believe your code doesn't mask off the lowest bit. Is it standard functionality to just return a 1 or 0 without bit 7 set?
On an NES with an ordinary Game Pak[1] inserted, bits 4-0 (mask $1F) come from the controller port, while bits 7-5 (mask $E0) come from the last byte that was on the data bus (due to capacitance of the wires, commonly called "open bus"). In the vast majority of cases, this previous byte will be $40, so you'd return 0x40 | control_bits for reads.
[1] Some developer boards such as the PowerPak have resistors on the data bus, which pull the voltages toward one value. A few Mindscape games rely on the open bus behavior and need patches to work on the PowerPak.
I'm using this code to read the joystick:
Code:
ldx #1
stx $4016 ;strobe joypad
lda $4016 ;test read, should not shift joypad value
dex
stx $4016 ;clear strobe, now it's okay to shift joypad value
and #$FC
tax
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
eor #$FF
Not your typical code, since it uses CPX instead of LDA to read the register.
But it should still work even if $4016 reads as 0 or 1, since it did a test read, then masks that off to see what it needs to compare with.
I added support to specify a ROM to load on the URL. so you can give people a direct link to play your game!
http://zelex.net/nezulator/?rom=www.dwe ... item%3D298
PS. Also fixed the emulator to not have bit 7 set.
tepples wrote:
[1] Some developer boards such as the PowerPak have resistors on the data bus, which pull the voltages toward one value. A few Mindscape games rely on the open bus behavior and need patches to work on the PowerPak.
This was fixed in the latest beta mappers.
Zelex wrote:
I added support to specify a ROM to load on the URL. so you can give people a direct link to play your game!
http://zelex.net/nezulator/?rom=www.dwe ... item%3D298PS. Also fixed the emulator to not have bit 7 set.
FCEU and Nintendulator set bit #6 (#$40) when reading from 4016, and the game runs perfectly on those emulators. Something else must be up.
3gengames wrote:
Why don't you just upgrade to Chrome? It's your browsers problems you keep complaining about. Switch from the browser you're using that apparently sucks at javascript processing. If your using Opera, you'll probably like Chrome.
Why should I be ordered to switch to a specific browser just for this thing ? As I've already stated before this is foolish. Especially since if I want to play an emulated NES game I'd just rather use normal PC NES emulators !
By the way I don't want to be spied by google whenever possible.
Dwedit wrote:
I'm using this code to read the joystick:
Code:
ldx #1
stx $4016 ;strobe joypad
lda $4016 ;test read, should not shift joypad value
dex
stx $4016 ;clear strobe, now it's okay to shift joypad value
and #$FC
tax
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
cpx $4016
ror a
eor #$FF
Not your typical code, since it uses CPX instead of LDA to read the register.
But it should still work even if $4016 reads as 0 or 1, since it did a test read, then masks that off to see what it needs to compare with.
I found the problem & fixed it
Read number 9 from the joypad was returning 0, and not 0x40 -- causing subsequent frame after the first to put the wrong value in ACC for the CPX compares.
Fixed
some kind of sprite problem with the mouse pointer though... hmm.
Could be the same issue as the punch-out sprite bug.
Yeah, I noticed that earlier and didn't post. Sorry.
Also, breglad, you're being spied on by every web page you use anyway [By google!] why dos using their browser change anything? It only adds the logging of the search bar searches AFAIK anyway. Plus, the default of the browser is to not sent statistics to google. And if that doesn't suffice, use Chromium. I put the new version of opera on my laptop and it did strides better in Javascript than what you said. [Although that is with JSNes, but it also is a vNES port.] Maybe download opera 11.10 and try that.
I just use SRWare Iron, so Google can spy on me slightly less.
Search is back up on Nezulator. I believe its entirely legal now. I went out and bought a ton of cartridges (more on the way). According to EC, this is the only real legal way to do it. (that and to allow streaming only - no rom downloads)
Also, do you have any ideas as to what the cause of the sprite issue is? I tried making sure sprite rendering happened durring h-blank, and that didn't fix it.
I notice that sprite rendering fails after it bankswitches CHR banks. And the effect is that it's dropping several scanlines worth of sprites.
Dwedit wrote:
I notice that sprite rendering fails after it bankswitches CHR banks. And the effect is that it's dropping several scanlines worth of sprites.
fixed
Thanks for the tip
Anybody know where I can find some info to get Dragon Warrior 3 and Dragon Warrior 4 carts to work?
(512kb prg-rom and 1Mb prg-rom)
Dragon Warrior III and IV are 512 KiB
SUROM. Anything bigger
is an overdump. SUROM is like SNROM (MMC1 + CHR RAM + PRG RAM), except that the CHR A16 output goes to PRG A18. This means bit 4 of the value written to the CHR bank register ($A000) switches between the first and second half of the PRG ROM. Even the otherwise "fixed" bank at $C000-$FFFF changes when this line is switched.
Just added custom control configs (they save in between visits to the page)
hmmm.... next I think I'll work on sound sync again. Then DW3/4
Proper sound sync looks like its probably a no go until Chrome 12.
http://code.google.com/p/chromium/issue ... l?id=81445
Firefox already does, but runs dog slow... sigh. Can't wait for newer browsers to come out!
Tried it today. Impressive for the fact that it runs in javascript, something which would have not thought to be possible a few years ago.
Runs well (except audio bug) in chromium, doesn't work well in ff4 like mentioned.
Even thought you don't link to roms, you should at the least remove all the remaining links in the javascript from the main web page since I could download them (I'm a programmer and I like snooping around, you know
).
You can download Chrome 12 to develop it. I had the beta/dev version for a long time. One day they let a flash bug get through and it was kinda annoying, so I went back to the stable version. From what I can tell though Chrome 12 is on the beta channel I believe.
Banshaku wrote:
Tried it today. Impressive for the fact that it runs in javascript, something which would have not thought to be possible a few years ago.
Runs well (except audio bug) in chromium, doesn't work well in ff4 like mentioned.
Even thought you don't link to roms, you should at the least remove all the remaining links in the javascript from the main web page since I could download them (I'm a programmer and I like snooping around, you know
).
Planning on doing my own custom file format tonight, so it doesn't matter if you can download, cuz you can't use them.
Might also encrypt the files. Should be a pretty good deterrent -- and also makes it legal. If you find a way around the encryption, thats technically your bad, not mine and is against the DMCA for you to do. Not like I'm going to go after you for it, but it covers me legally should anybody sue me.
Does the emulating the CPU or emulating the PPU take up more processor time? Idle Loop skipping could save lots of time from emulating the CPU.
Dwedit wrote:
Does the emulating the CPU or emulating the PPU take up more processor time? Idle Loop skipping could save lots of time from emulating the CPU.
Its all slow. I'll take whatever speedups I can get. What do you recommend? look for a JMP absolute to self, and skip it?
Dwedit wrote:
Does the emulating the CPU or emulating the PPU take up more processor time?
A PPU emulator has to process 168 fetches, 256 background pixels, and 64 sprite pixels on each scanline. A CPU emulator has to handle only 113 or so memory accesses and about 30 to 40 instruction decodes.
Quote:
Idle Loop skipping could save lots of time from emulating the CPU.
Now I know why you ask: The emulator that you maintain(ed?) high-level-emulates the PPU using the host platform's similarly architected PPU, and a CPU-saving technique translates into a higher percentage than it would in a pure software emulator.
Two common loops to skip:
- Some games, such as Super Mario Bros., run entirely in the NMI and IRQ handlers, and the main thread is just a repeated JMP absolute to self, BCC back 2, etc.
- Other games do much of their processing in the main thread, and the NMI handler notifies the main thread that a vertical blank has occurred by writing to a variable. The pattern here is to LDA, LDX, LDY, CMP, CPX, CPY, or BIT that variable and then branch back by 4 or 5 bytes.
I'd look for a loop that is something like this:
LDA FrameVaraible
WaitForEndframe:
CMP FrameVariable
BEQ WaitForEndFrame
that's on possibility to wait for VBlank. Also check for BIT $2002 instruction and skip that....and I can't think of any other situation but there's lot more (and better) ways to wait for the frame.
For 99% of games, a loop spinning on $2002 whose branch is BPL will finish within five frames or so after reset. Those are usually waiting for the PPU to stabilize, not waiting for vertical blanking during gameplay, due to the
NMI race. But spinning on $2002 is more likely in a loop whose branch is BVC or BVS, as that's a wait for sprite 0 to split the screen.
The first step is to predict on what cycle the next "interesting" event is likely to occur. You'll need a predictor for sprite 0 hit, vblank NMI, APU frame IRQ, and DPCM playback finish IRQ, and one for the scanline counter and cycle counter of each mapper that has such functionality. When in doubt, underestimate. Then you'll know how many cycles to run your idle loop skip.
bam, ROMs are encrypted.
Need to work on the method a bit more though, files are about twice as big as they should be. Tomorrow night for that.
darn, some of these cartridges are not cheap! Bubble Bobble 2 cost me over $100!
You can take you time, you know?
Buy the crappy crappy copies.... Maybe even give paul on NintendoAGE a mail for any crappy doubles he'd be willing to part with.
tepples wrote:
Dragon Warrior III and IV are 512 KiB
SUROM. Anything bigger
is an overdump. SUROM is like SNROM (MMC1 + CHR RAM + PRG RAM), except that the CHR A16 output goes to PRG A18. This means bit 4 of the value written to the CHR bank register ($A000) switches between the first and second half of the PRG ROM. Even the otherwise "fixed" bank at $C000-$FFFF changes when this line is switched.
The switch happens immediately on A000? (pretty sure that is a yes)
From Disch's mapper docs:
Quote:
Special Variant -- SUROM:
--------------------------
Example Games:
Dragon Warrior 4
Dragon Quest 4
The MMC1 PRG reg is only 4 bits wide. This means that normally, page $0F is the highest page number you can
access. With 16k pages... this limits typical MMC1 to 256k PRG ($10 pages * $4000 per page). SUROM
"hijacks" one of the bits from the CHR registers and uses it as an additional PRG bit. This allows for
access to $1F pages, allowing 512k PRG.
Code:
$A000-BFFF: [...C CCCC] CHR reg 0
[...P ....] hijacked PRG bit
$C000-DFFF: [...C CCCC] CHR reg 1
[...P ....] hijacked PRG bit
When in 4k CHR mode, 'P' in both $A000 and $C000 *must* be set to the same value, or else pages will
constantly be swapped as graphics render! In 8k CHR mode (which is what DQ4 uses), $C000 is irrelevent
since it is ignored, and $A000 is used exclusively.
The hijacked PRG bit selects which 256k block is used for *ALL* PRG... *including* fixed pages. Meaning
fixed page $0F @ $C000 can swap between page $0F and $1F.
So after the 5th write to A000, it looks at the last bit, and uses that as a 256k selection.
I'd bet the games would avoid 4k CHR mode to avoid all those potential problems, that and they use CHR-ROM and don't want bankswitching there anyway.
Dragon Warrior 4 works!
DW3 -- doesn't
Not sure why
Are there any other SUROM games?
SUROM was used for
DW3, DW4, and a Japan-only game. SXROM is SUROM with more PRG RAM, used for
two Japan-only games.
tepples wrote:
SUROM was used for
DW3, DW4, and a Japan-only game. SXROM is SUROM with more PRG RAM, used for
two Japan-only games.
thanks!
I wish Blargg's CPU tests were a bit more specific.
http://blargg.parodius.com/nes-tests/
It helped me find one bug, but the next one is pretty ambiguous and could be in any one of 10 different instructions.
Update: It actually is specific. It turns out that they are all wrong, lol
wow, castlevania 3 is like the ultimate test of emulator accuracy.
And Battletoads...which seems to run fine, besides the LEFT+RIGHT and UP+DOWN at the same time.
3gengames wrote:
And Battletoads...which seems to run fine, besides the LEFT+RIGHT and UP+DOWN at the same time.
right. Whats the proper way to handle that?
First one down just accept it but not the other. If both down same refresh after not having one selected first, I'd say pick one. ^_^
You might make it optional. Holding UP+DOWN or LEFT+RIGHT is a common trick used to glitch a lot of games.
how do I go about making my own roms from cartridges?
Grab them offline since they'll be exactly the same? But if you want to go through dumping all your carts to make the iNES file as commonly found online, then I'd get a CopyNES for that quantity.
One of the ways to host games (not roms) legally, is to host them directly from the cart itself. (really this is the only 100% legal way that I know of). So I'm looking into what it would take to get some hardware to hook up a cart directly to my computer, from which I can host it.
I've been chatting w/ my lawyer and this is the only way to do it without violating any copyright laws. In essense, what you would be doing is making the internet one giant NES player.
(Lots of people argue fair-use, but fair-use is always decided by the courts on a case by case basis and never is a right to begin with. That means that you can get sued even if its technically fair use. While you may win the lawsuit, you'll lose your shirt doing it.)
Zelex wrote:
So I'm looking into what it would take to get some hardware to hook up a cart directly to my computer
You'll need an authentic front-loading NES Control Deck, solder, and the
genitals of a law enforcement officer.
been working on firefox performance. I got it at 60fps with minefield. Still working on Firefox 4.0
btw, sound is significantly better in firefox due to the native audio api
On my Firefox 3.6 or whatever it is, I get 7FPS and then degrades to .02 FPS as it goes on. It also made my laptop overheat, although I was running FCEUX in the background and it for some reason keeps my fan on when minimized. But it probably didn't make much of a difference.
lol
yeah minefield is their nightly-build.
http://ftp.mozilla.org/pub/mozilla.org/ ... est-trunk/
I'm working on getting firefox 4.0 more speedy and making some progress. I have to re-write the CPU core in order to do it though -- kind of a lengthy process.
Just got it another 50% faster in FF4. Need to do that two more times for this slow computer to run at 60 fps. Desktop already does.
There's always the PAL version of Elite, which was released as freeware by its author. But you need to emulate a PAL system with decent accuracy, otherwise it will shake a lot.
Zelex wrote:
btw, is there a list of free games - free of copyright restrictions that any emulator can use somewhere?
http://www.zophar.net/pdroms/nes.html
Zelex wrote:
btw, is there a list of free games - free of copyright restrictions that any emulator can use somewhere?
Zophar.net looks a bit out of date. I'd recommend
PDRoms.de.
Full disclosure: I say this based on having looked for my own games.
I've improved the sound code a bit. Should have much less lag than before.
I've timed it to be < 0.25 seconds lag now actually
Awesomeness
Also made it so you can specify games databases to search through. Otherwise, you can't search for games. It also searches twitter so that people can tweet various databases they put up on the internet.
Read through an article about my latest posts here and I want to clear a few things up.
1) I'm not publicly hosting any copyrighted content on zelex.net. The legal section is out of date - Nor do I tell people where to get copyrighted content. The google search is still in there, but its not very good IMO. I have added the ability however to specify a games database to search through. More on what that is exactly in a bit.
2) I have not abandoned the legal emulation approach which involves custom code and a CopyNES. In fact it is well under way, but it will be many months of setup and I got bored. So this is whats new in the mean-time.
3) What is a games database? Its a javascript file that is specially formatted to be read by Nezulator. Inside the games database file is a list of ROMS, and their URLs where they can be found. I do not provide a games database - they must be provided by the users of Nezulator. It is intended that braver individuals than I host a database (not roms, just a database), post that to twitter so that others may benefit from their ROM URL gathering efforts.
4) Alternatively, you can post to twitter a url to a single ROM file so that people can play that with a single click. I'll be making that easier to set up in the near future. Example:
http://zelex.net/nezulator/?rom=http%3A%2F%2Fzelex.net%2Fnezulator%2Froms%2Fdpadhero2.nes
Quote:
you can post to twitter a url to a single ROM file so that people can play that with a single click.
Nice. I ought to put that on lj65.org sometime.