Web-based OSI Emulator

jeffpar
Posts: 10
Joined: Tue Jul 31, 2012 11:19 pm

Web-based OSI Emulator

Post by jeffpar »

I'm new to this forum, so maybe I should write a brief intro at some point, but I'm excited to share a project I've been working on the past month:

http://ecpsim.org/c1p

It's more-or-less a complete simulation of the Challenger 1P, written in JavaScript, so it should run well in any modern web browser (I mostly use Safari, but I've also occasionally tested it in Firefox, Chrome and IE9). It also meets another one of my criteria: running well on iOS devices (iPad and iPhone). I don't have an Android device, but hopefully it runs well there, too.

This started as a port of a Win32-based emulator I posted around 14 years ago at http://www.doublebit.com. I was looking for an excuse to learn JavaScript, and I wanted to see how much performance could be squeezed out of it. Although this experience has not made me much of a fan of JavaScript the *language*, there's no longer any question in my mind that JavaScript is a viable *platform* for projects like this.

I'd like to make this simulation even better by adding more hardware support (like disk drive support), making it easy for people to embed it on their own web pages, linking to their own collections of software, and ultimately adding support for other 6502-based platforms. The C1P was my first choice, because I still have mine, and it still works. I will be very sad when the day comes that I flip the power switch and nothing happens....

Collaborators on this JavaScript project would be great, so if anyone has any serious interest in making helping make this even better, let me know. I plan to release the code under GPL -- it's clean, commented, and FAST.

I also have a small collection of software that I wrote for the OSI from 1978-1981, some of it in BASIC and some in machine language, and the app is able to automatically LOAD and RUN both kinds of software. I'll be adding links to those soon, too.

Thanks for reading, and I look forward to hearing what people think about this simulator.

Cheers,
Jeff
billdrom
Posts: 55
Joined: Sat Dec 26, 2009 4:08 pm
Location: Somerdale,New Jersey

Re: Web-based OSI Emulator

Post by billdrom »

I like it. Good work.
I tried it on my Android phone. I didn't have a lot of luck though.
The emulator ran just fine but I could only use the fixed buttons like break and run.
I could not get it to accept virtual keyboard entry of the letter C, for example.
I am using a Verizon Motorola Razr Maxx with Android version 4.0.4 loaded.
I tried the default browser and firefox.

I am kind of new to the phone so it could just be me.

Bill
jeffpar
Posts: 10
Joined: Tue Jul 31, 2012 11:19 pm

Re: Web-based OSI Emulator

Post by jeffpar »

Give it another try on Android, I think it'll work better now.

I downloaded the Android SDK this morning, tried the C1P emulator in the Android emulator's web browser, and discovered that it has the same problem as iOS devices: these mobile keyboards try to be clever and "auto-capitalize" things, which means the keys arrive as if the user is holding the SHIFT key. But of course, a SHIFT-C on a C1P keyboard when the SHIFT-LOCK is also locked (which I lock by default) isn't what the boot code is expecting.

Thanks for trying it.
dave
Site Admin
Posts: 710
Joined: Tue Sep 09, 2008 5:24 am

Re: Web-based OSI Emulator

Post by dave »

Jeff,

This is really cool! I am traveling at the moment, and just found it this morning. I checked it out, looks like a C1P! Impressive.

If you are thinking about adding disk emulation support, let me know, because I'm interested in coming up with a good way to archive OSI disks that would be lightweight, human readable/editable, preserve the "raw" format for programs such as disk copiers, and would also allow easy translation between pure hex images and disk images. Perhaps something XML based with blocks of intel-hex format hex dumps, and track/sector metadata.

Thanks for sharing!

Dave
jeffpar
Posts: 10
Joined: Tue Jul 31, 2012 11:19 pm

Re: Web-based OSI Emulator

Post by jeffpar »

Thanks. Definitely interested! To start, it would be great to work with someone who's already got the disk emulation working -- I'll share all my code with them if they do the same. Any volunteers? If not, I'll start working on disk emulation support shortly -- I just need to find the necessary tech specs, as I'm not familiar with the actual hardware. I've written disk emulation layers before, but only for PCs.

And we can work out an XML-based disk format in parallel -- I haven't looked into that yet, but I wouldn't be surprised if there are already similar efforts we can learn from, for other platforms.

Cheers,
Jeff
jeffpar
Posts: 10
Joined: Tue Jul 31, 2012 11:19 pm

Re: Web-based OSI Emulator

Post by jeffpar »

I just finished adding disk controller emulation to the C1P-JS simulation. It only supports reading disk images at the moment. I've added one disk image named "OS65D33" to the configuration at:

http://cpusim.org/c1p

Click the LOAD button next to the image name, start the simulation with either RUN or BREAK, and then press "D". The simulation will automatically reconfigure itself from a C1P/Model 600 simulation to a Model 540/542 simulation, since that's what OS-65D seemed to expect. I never had disk drives on my C1P, so I don't have any experience OS-65D, but I was a little surprised that it assumed the video and keyboard hardware was different--or maybe my simulation just doesn't properly fake it.

As for the disk image format it expects: it does not actually read raw disk image files. It passes the disk image file to a converter, which returns the image data in neatly-formatted JSON, organized as an array of heads, each of which is an array of tracks, each of which is an array of sectors, each of which is an array of bytes. For example, the disk image used in the above configuration is:

http://cpusim.org/disks/other/c1p/OS65D33.IMG

which is passed to:

http://cpusim.org/bin/convdisk.php?disk ... S65D33.IMG

The convdisk.php script supports some other options, but the only one C1P-JS uses is "compact=1" which generates a much smaller but less human-readable JSON file.

That's all for now, but I'm sure I'll have more to share later.
Cheers,
Jeff
jeffpar
Posts: 10
Joined: Tue Jul 31, 2012 11:19 pm

Re: Web-based OSI Emulator

Post by jeffpar »

I have another demo to share -- this one I call the OSI "Server Array" demo:

http://cpusim.org/devices/other/c1p/array.xml

Cheers,
Jeff
dave
Site Admin
Posts: 710
Joined: Tue Sep 09, 2008 5:24 am

Re: Web-based OSI Emulator

Post by dave »

Hi Jeff,

This sounds fantastic. Unfortunately, when I try to access the site, I get an error: "Error loading stylesheet: Parsing an XSLT stylesheet failed."

Your ASCII file format is pretty much what I had in mind. Although I had suggested XML, JSON is perhaps simpler and easier to work with, and appears to be widely supported.

Dave
nama
Posts: 357
Joined: Wed Mar 30, 2011 9:44 am
Location: New Zealand
Contact:

Re: Web-based OSI Emulator

Post by nama »

I dont have any problem loading either site on my Mac using Safari.

Phil

2P (1mhz 32k) - 502 + 8k + CEGMON + garbage collector fix BASIC, D&N MEM-CM9 + 24k, 540 (mono) [SOLD]
4PMF (2mhz 24k) - 505, 540, 527, D13 + 5.25" + Gotek
Superboard RevD - CEGMON + 610 board 24k + D13
Spares - 3 x 527, 1 x 505, Backplane
jeffpar
Posts: 10
Joined: Tue Jul 31, 2012 11:19 pm

Re: Web-based OSI Emulator

Post by jeffpar »

Hi Dave-
Let me know what brand and version of browser you're using, and I'll try to reproduce the error. Do you have an alternative browser you can try in the meantime?
I tend to prefer XML for most things as well, but in this case, JSON was the logical choice, because it's trivial for JavaScript to ingest. But if someone wants to define a companion XML format, I'm happy to support that as well.
Thanks,
Jeff
Post Reply