JSNes and running your rom in a browser.

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

Post Reply
User avatar
battagline
Posts: 152
Joined: Wed Sep 05, 2018 11:13 am
Location: Colorado
Contact:

JSNes and running your rom in a browser.

Post by battagline » Sat Nov 10, 2018 9:27 am

I'm not sure if anyone here is familiar with JSNes.org. I've been going through the open source project JSNes and trying to get it working with some of my roms on one of my websites, but I've been running into issues. It looks like you should be able to get it running without using React, but the example they use JSNes-web uses React, so I'm trying to figure out how to get it working without React.

Anyway, I suspect this is something I'm going to have to do on my own, but I wanted to ask if anyone else has done this before I waste a few days trying to figure it out. So if you've worked with JSNes in the past, and don't mind me asking you a few questions, please give me a shout.

Thanks,
Rick
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com

User avatar
samophlange
Posts: 46
Joined: Sun Apr 08, 2018 11:45 pm
Location: Southern California

Re: JSNes and running your rom in a browser.

Post by samophlange » Sat Nov 10, 2018 11:30 am

Have you tried contacting the developer? He's on twitter, and looks like a very experienced web developer. He could probably give you some good advice.

User avatar
battagline
Posts: 152
Joined: Wed Sep 05, 2018 11:13 am
Location: Colorado
Contact:

Re: JSNes and running your rom in a browser.

Post by battagline » Sun Nov 11, 2018 8:42 am

samophlange wrote:Have you tried contacting the developer? He's on twitter, and looks like a very experienced web developer. He could probably give you some good advice.
I tried sending him an email, but he never got back to me. I can figure this stuff out, it's just a lot more time consuming. I figured it was kind of a long shot asking if anyone here had worked with it, but you never know.

Thanks for the suggestion
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com

User avatar
slembcke
Posts: 170
Joined: Fri Nov 24, 2017 2:40 pm

Re: JSNes and running your rom in a browser.

Post by slembcke » Mon Nov 12, 2018 8:43 am

I spent like a day or so on it a year ago. Ran into the same issues mostly. I tried contacting the dev as well, but maybe it wasn't an active email or something?

User avatar
battagline
Posts: 152
Joined: Wed Sep 05, 2018 11:13 am
Location: Colorado
Contact:

Re: JSNes and running your rom in a browser.

Post by battagline » Wed Nov 14, 2018 9:07 pm

Got it working, but it seems to have some problems with sprites that are smaller than 8x8. By smaller I mean they have transparent pixels all the way around the edge so that they are effectively smaller than 8x8.

https://www.embed.com/nes/nesteroids.html

the controls are arrow keys for the d-pad and asdf for select, start, b, a Next week I'm on vacation. The week after that I'll try to get my jsnes helper out... I'll also need to try and figure out why jsnes has issues with the smaller than 8x8 sprites.
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com

cppchriscpp
Posts: 93
Joined: Fri Dec 27, 2013 4:28 pm

Re: JSNes and running your rom in a browser.

Post by cppchriscpp » Fri Nov 16, 2018 9:08 pm

I had a bit of luck using a different emulator: https://github.com/peteward44/WebNES (It's MIT licensed) ... might be worth trying to see if it avoids your bug. There's a demo site you can load your rom in w/o setting it up to see: http://peteward44.github.io/WebNES


The version they use for their demo is a lot easier to look at: https://github.com/peteward44/WebNES/tree/gh-pages -- if you look at the index_app.html, that shows how to embed it and use it.


I'm using it for my starter kit app here if you want another demo: https://cppchriscpp.github.io/nes-starter-kit/ -- I stripped out a lot of the formatting around it to make it simpler.

Hope this helps!

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: JSNes and running your rom in a browser.

Post by thefox » Sat Nov 17, 2018 4:17 am

I would go for an Emscripten-based emulator (asm.js/WebAssembly) such as https://github.com/ryanwmoore/fceux for better performance.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
slembcke
Posts: 170
Joined: Fri Nov 24, 2017 2:40 pm

Re: JSNes and running your rom in a browser.

Post by slembcke » Mon Nov 19, 2018 7:46 pm

I made a more stripped down version here:
http://files.slembcke.net/temp/nes-embe ... stack.html

At 100 lines, someone might find it a bit easier to embed in their own pages. I haven't gotten sound working yet though. The example version throws a ton of errors in the console for me so I was going to try something else. (edit: sound is working now, but like the original, it ignores sampling rate and changes game speed based on it. Bleh)

@thefox Performance isn't *really* an issue, ease of embedding is what I wanted. Also, that one doesn't work for me in the two browsers I bothered to try. (shrugs)

User avatar
battagline
Posts: 152
Joined: Wed Sep 05, 2018 11:13 am
Location: Colorado
Contact:

Re: JSNes and running your rom in a browser.

Post by battagline » Sun Nov 25, 2018 12:07 pm

slembcke wrote:I made a more stripped down version here:
http://files.slembcke.net/temp/nes-embe ... stack.html

At 100 lines, someone might find it a bit easier to embed in their own pages. I haven't gotten sound working yet though. The example version throws a ton of errors in the console for me so I was going to try something else. (edit: sound is working now, but like the original, it ignores sampling rate and changes game speed based on it. Bleh)

@thefox Performance isn't *really* an issue, ease of embedding is what I wanted. Also, that one doesn't work for me in the two browsers I bothered to try. (shrugs)

I'd give it a try. Do you have it on github?
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com

User avatar
slembcke
Posts: 170
Joined: Fri Nov 24, 2017 2:40 pm

Re: JSNes and running your rom in a browser.

Post by slembcke » Tue Nov 27, 2018 11:13 am

I sent a pull request to the original author as well, but never heard back:
https://github.com/slembcke/jsnes/tree/master/example

It doesn't fix any of the timing issues due to audio audio sampling rate from the original though.

Post Reply