Forums Forums (
-   Kenbak-1 (
-   -   Emulator/Debugger (

drichardson 12-04-2008 07:23 PM

I wrote a simple Kenbak-1 emulator and debugger over the holiday and thought I'd share it.

It's written in javascript, so there isn't anything to download,
click here to try it out.

I've tested it with Internet Explorer 5.5 and 7 and Firefox 2 and 3. It should be usable at resolutions as low as 800x600.

Let me know what you think.

Cappellanus 12-07-2008 11:37 PM

Wow!!! Cool emulator....
I'm amazed. After trying the very clever and fun 8088 assembly language emulator, I too had thought it would be cool to have a Java web-based emulator with great graphics, which would be machine independent (and easy to modify/fix since I can't do 8088 assembly code well.)

I've seen the HP vintage calculator emulators, which also show a real picture of the calculators with buttons you can press and slide-switches you can slide. An example is here...
but my time and programming skills don't allow me to do it. I'm glad you did.

A few comments/questions:

I like the picture of the Kenbak-1, but not sure where you got it. I haven't seen this picture before, unless you pasted pictures of the screws over holes, and mocked-up the top of the case. It looks great, but it's missing the extruded aluminum handles on the sides, which we've come to expect and love. Is there anyway you could cut-and-paste some extruded handles onto the emulator? It looks kinda like a face with the ears missing.

I like how you did the "load" function. I guess we can cut-and-paste programs into the little input buffer, and I like how the text in a "pseudo-listing-file" documented code file could be skipped over. That allows us to have documentation in our program files, so we can easilly look at it. Great thinking. Now if we only had a simple assembler which would make this format automatically (sure, we pretty much hand-assemble our Kenbak-1 code ourself, so it's not really needed.)

I'm a bit confused by the display showing either location 200 or 377 in run mode. I'm actually not sure at this point how the real Kenbak-1 handles this, but as I like interactive programs, it would be nice if this was correctly handled. I have some interactive programs around someplace, and hope to be able to try them out, when I have some free time.

I looked at the code, or what I think is the code by looking at the source file. Is this the entire source code? Of course, it doesn't have the images and such. It would be nice if the full code was available for bug-fixing or understanding it, before I put too much time into trying to test it all out.

With the loading input buffer, of course the next step would be to have an "Assemble" button which would read in the assembly/machine code mnemonics, and generate the codes. Now *that* would be great. That would be a whole development system, you could add in a code easilly, assemble it, and run it, and modify it. You wouldn't mind adding an assembler, would you? ;) (just joking.)

I'll run more programs when I have time... but that may not be until after x-mas.

Cappellanus 12-08-2008 12:06 AM

Wow!!! Cool emulator....
Ah, I think I figured out the image part.

Kenbak1_base.jpg has the background of the machine, and this is the part that could have the extruded handles added, but the existing jpg doesn't have enough extra room on the sides to add it. I guess if extruded handles were added, all the pixel locations of other buttons and lights would have to be shifted over, in fact, maybe even windows would have to be widened.

The white lights look a bit "fake" especially where the lights are yellow. I can imagine making on-lights a bit more "glowing" by a graduated brightness function, which makes even the surrounding front panel show a little bit of a bright halo. Ah, I see where you handled the button press... just one pixel?

As someone who's been trying to learn Java, this looks like great code. I wish I had a holiday weekend to play with this, even add in an assembler, but with my job, I tend to work more around holidays than during regular year.

Keep up the great work!!! This is great fun to play with! I need more time to play with this...

Oh, and do you have a Kenbak-1?

drichardson 12-08-2008 11:30 PM

I'm glad you like it. I suppose that's excuse enough to keep up on the development.

To answer your questions:

1) The picture is a sketch I made using Macromedia Flash 8. I had planned on making an SVG from the final image, but I got very lazy and just took a screen capture. If I get some extra time I'll add the side rails.

2) An assembler would be a neat feature. Perhaps I can put one together over the next holiday.

3) According to PR-20 of the Programming Reference Manual:

Entry can occur during the Run state. Normally, the Console Data Lamps are displaying the contents of location 200 during the Run state. During the actual interval while the Clear or Console Data Pushbuttons are depressed, the Console Data Lamps will predominantly display the contents of location 377. In the background, as a fainter light, the contents of location 200 will also be displayed.
4) Yes, all the code is (rather inelegantly) jammed into a single source file. My goal was to write the program as quickly as possible, and the results are not pretty. It's an ugly, inefficient, and unmaintainable mess. I'm planning on addressing the code quality issue over Christmas.

5) The lights really are horrid, aren't they? I had thought of making a better 'glowing light' image, but the only suitable format would be PNG, which IE has trouble rendering properly. There is a fix online, but I didn't think of it at the time. I'll be sure to add "better lights" to the list of things to do.

6) Yes, just one pixel on the button push. I tried a few different things and this solution gave the buttons the best 'feel'. Let me know if you come up with a better movement.

7) Unfortunately, I don't own a Kenbak-1. I am, however, accepting donations of any Kenbak-1 hardware (for the improvement of this software, of course!) :) At present, I have only the manuals to guide me.

Thanks for the excellent feedback. The next release should be very much improved. I'll be sure to credit you.

Per 12-11-2008 09:13 PM

Nice emulator.

My notes:
1. Some of the light conditions are not right. as of I understand, pressing any of the Input buttons will allways turn on the Input light.

2. Would have been great if I could do memory loading from the binaries in a file (mainly for compability reasons, if sombody wrote an assembler for Kenbak Op-codes).

I find this a good start/beta, and I am curious in how it is going to be.

drichardson 12-13-2008 01:34 AM

I'm glad you approve. I really didn't want to step on your toes. I had hoped that my project was 'different' enough to avoid conflict.

1) Yes, I'm not certain how all the lights properly behave. The manual helped quite a bit, as did the demo video online. I've made the change. If you notice any other problems, please let me know!

2) For very good reasons, javascript isn't allowed access to the local file system. I could get around it with a tiny java applet, but it would only work if you ran the program locally. If I get around to writing an assembler this won't be a major problem.

In the mean time, I've written two small programs bin2oct.exe and oct2bin.exe (download them here)

As an example, running bin2oct kenbakd1.ram > kenbakd1.txt from the command line produces a text file that you can copy/paste into the loader. Copy/paste the text from the memory viewer into a file and run oct2bin to produce a binary.

If anyone wants the C source, or a Linux (i386) binary, let me know and I'll upload them.

All times are GMT. The time now is 12:41 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2022, vBulletin Solutions, Inc.