<ryanstout>
was it a lot of work to get it running in opal?
<chesterbr>
it is about 1/15 of the MRI speed, but this is the first attempt at coding, there are several optimizations to do
<chesterbr>
well, I had to do a couple of pull requests on Opal (dark corners like bit manipulation)
<ryanstout>
yea
<ryanstout>
hopefully there's some performance optimizations opal can do also
<chesterbr>
but the only *real* change in emulator code was to surround divisions with to_i (since Numeric->JavaScript doesn't have the concept of "integer division")
<ryanstout>
running a VM is probably not a common JS use case either
<ryanstout>
ah, yea
<chesterbr>
other than that, I have all but a few specs running (mostly because of RSpec dark magic that I have to fix)
mneorr has quit [Ping timeout: 245 seconds]
<chesterbr>
but I need to properly set up a loop that doesn't lock the browser main thread
<chesterbr>
I have to keep the console open to avoid it to freak, which is likely slowing things down
<ryanstout>
yea, I think when console is open in chrome a bunch of things get added which slow things down
<chesterbr>
anyway, my main goal was running on a browser (MRI is a bit odd to set up with graphic libs)
<chesterbr>
for sure
<ryanstout>
yea, I usually end up using jruby and some java stuff when I do graphics stuff (which also isn't ideal)
<chesterbr>
JRuby got me 2x the MRI performance, which was nice (it is still unplayable due to speed regardless of which Ruby)
<ryanstout>
did you have invoke dynamic and ire 7?
<chesterbr>
I believe so (last time I tried I was using JRE 7 and a quite recent JRuby, so I'd guess it would use that)
<ryanstout>
actually, for various reasons jruby doesn't use invoke-dynamic by default in Java 7
<ryanstout>
its a big performance improvement most of the time (over normal jruby)
<ryanstout>
you have to set a flag to enable it
<chesterbr>
ah, didn't know that!
<ryanstout>
yea, try it with: -Xcompile.invokedynamic=true
<chesterbr>
definitely worth trying - this is the kind of code that would surely benefit from less indirections
<ryanstout>
yea, I think jruby is getting really good at inlining more stuff
<chesterbr>
thanks for the tip, will test and let you know!
<ryanstout>
no prob
<ryanstout>
how long have you been working on ruby2600?
<chesterbr>
not long, I started toying with the idea around June last year (to present it at RubyConf BR in August). Since then it's been on-and-off (whenever I have time + some crazy idea like cross compiling to JS)
<chesterbr>
never had written an emulator before, so it was a *huge* learning experience
<ryanstout>
how many instructions are there?
<chesterbr>
if I recall correctly, the 6502 lists a bit less than 60, but variated opcodes grow the number to around 150
<ryanstout>
are they all used?
<chesterbr>
(actually a 6507, but software-wise it's the same thing, and people know the 6502 better because of C64/Apple II)
<chesterbr>
yep. games did *a lot* of trickery to squeeze performance
<chesterbr>
actually, the CPU was less of a problem
<chesterbr>
it is hugely well documented and has loads of sane test code
<chesterbr>
the biggest issue was the video chip (TIA)
<ryanstout>
interesting
<chesterbr>
which was custom-built for the 2600, and has no frame buffer
<chesterbr>
the game code pretty much controls the CRT beam colours as it gets drawn on the screen
<ryanstout>
humm
<ryanstout>
so is it fast enough with opal to play at a decent frame-rate?
<chesterbr>
so timing is a fundamental thing, and I can't do classic emulator tricks like skipping/caching frames
<chesterbr>
nope, even with JRuby it goes at around 2-3FPS (where I'd need 60)
<ryanstout>
bummer
<ryanstout>
just wait another 10 years :-)
<ryanstout>
jk
<chesterbr>
MRI gets 1-2. Opal is hard to say (I've *just* been able to render a frame that took 15s, but I'm sure it can be enhanced)
<chesterbr>
heh, actually this is one of the "strategies" I've discussed on the presentation :-D
<adambeynon>
seems to be a special case for each impl
mneorr has joined #opal
mneorr has quit [Ping timeout: 250 seconds]
Noldorin has joined #opal
ryanstout has joined #opal
mneorr has joined #opal
mneorr has quit [Ping timeout: 245 seconds]
<adambeynon>
hi ryanstout. I forget, why do all the values use underscores in volt?
elia has quit [Ping timeout: 250 seconds]
<ryanstout>
adambeynon: its to distinguish "properties" from methods, so when you call ._something, it returns nil, .something raises an exception
<ryanstout>
does that make since?
<ryanstout>
I may get rid of the _ stuff, but I think it saves a bunch of errors
<ryanstout>
because otherwise if you have a typo for a method name, it doesn't raise an exception
<ryanstout>
the models are going to have it where you can define your own classes for them
<adambeynon>
ahh, right. makes sense
<ryanstout>
I'm trying to think if there a better way. Probably the better way is to just have models use the hash accessor syntax. But there's a few things I don't like about that way.
e_dub has quit [Quit: It's a hard knock life]
DrShoggoth has joined #opal
Noldorin has quit []
mneorr_ has joined #opal
mneorr_ has quit [Remote host closed the connection]
mneorr has joined #opal
mneorr has quit [Ping timeout: 250 seconds]
mneorr has joined #opal
mneorr has quit [Remote host closed the connection]