HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
ubercomp
jslm32
JavaScript2012–2013
ubercomp / jslm32

jslm32

Javascript emulator for the LatticeMico platform

3Distinct people
7Mentions
0Explicit recommenders
170GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Javascript emulator for the LatticeMico platform

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by month7 dated mentions

Observed mentions: 2012-03-28 19:41:51 UTC to 2013-04-20 21:33:02 UTC.

01232012-03-01 00:00:00 UTC to 2012-04-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 commentsMar 20122012-04-01 00:00:00 UTC to 2012-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-01 00:00:00 UTC to 2012-06-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-06-01 00:00:00 UTC to 2012-07-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-07-01 00:00:00 UTC to 2012-08-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2012-08-01 00:00:00 UTC to 2012-09-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-09-01 00:00:00 UTC to 2012-10-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsSep 20122012-10-01 00:00:00 UTC to 2012-11-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2012-11-01 00:00:00 UTC to 2012-12-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-12-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2013-01-01 00:00:00 UTC to 2013-02-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2013-02-01 00:00:00 UTC to 2013-03-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2013-03-01 00:00:00 UTC to 2013-04-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2013-04-01 00:00:00 UTC to 2013-05-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 2013

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Mar 20122012-03-01 00:00:00 UTC2012-04-01 00:00:00 UTC303
Apr 20122012-04-01 00:00:00 UTC2012-05-01 00:00:00 UTC000
May 20122012-05-01 00:00:00 UTC2012-06-01 00:00:00 UTC000
Jun 20122012-06-01 00:00:00 UTC2012-07-01 00:00:00 UTC000
Jul 20122012-07-01 00:00:00 UTC2012-08-01 00:00:00 UTC101
Aug 20122012-08-01 00:00:00 UTC2012-09-01 00:00:00 UTC000
Sep 20122012-09-01 00:00:00 UTC2012-10-01 00:00:00 UTC000
Oct 20122012-10-01 00:00:00 UTC2012-11-01 00:00:00 UTC101
Nov 20122012-11-01 00:00:00 UTC2012-12-01 00:00:00 UTC000
Dec 20122012-12-01 00:00:00 UTC2013-01-01 00:00:00 UTC000
Jan 20132013-01-01 00:00:00 UTC2013-02-01 00:00:00 UTC000
Feb 20132013-02-01 00:00:00 UTC2013-03-01 00:00:00 UTC000
Mar 20132013-03-01 00:00:00 UTC2013-04-01 00:00:00 UTC101
Apr 20132013-04-01 00:00:00 UTC2013-05-01 00:00:00 UTC101

What Hacker News says

7 sources
> There are some real ports of Linux for "limited" architectures, like uClinux reginaldo (a guy who posted his emulator (jslm32) last time this was on HN) actually uses uClinux on LatticeMico32. [1]: https://github.com/ubercomp/jslm32 I'm considering trying to get this to compile on Emscripten. It's so self-contained that I think it will be fairly unproblematic. Emscripten's 64-bit math emulation surely won't be needed. Does anyone know if a ARM emulator in JavaScript exists already?
In Linux on an 8-bit micro
Yes, you're right. For my OS class when I was in school, instead of doing the proposed homework, I convinced the professor to let me do a x86 OS. We were a group of 3. I started doing everything in C with as little as assembly as possible, but the other two decidet to do an all-assembly little monster. At the end of the course, we had only the boot loader and a little command interpreter, aside from FAT-12 support. Then, much later, I messed with OS by playing with the code from the Minix Book [1]. Last year I wrote a little emulator for a virtually unknown architecture that can run uClinux on a modern browser (i.e., Chrome)[2]. [1] Operating System Design and Implemenation: http://www.amazon.com/Operating-Systems-Design-Implementatio... [2] https://github.com/ubercomp/jslm32/
In Operating System Development
> - how did you find what to optimise? - what approach did you use? I used profilers: Chrome developer tools and Firebug. The Chrome profiler is very nice and easy to use, but it looks like it is a statistical profiler. When the usual invocation takes less than 1ms, it might get the times wrong (there might be a bottleneck that Chrome profiler is not showing). The Firebug profiler is more precise, I believe it traces every executing instruction, which also makes it much slower to run you program in, but does sometime gives you interesting insights. Also, there's intuition. I wanted to keep the code readable. The interpreter loop is basically something to the effect of while(true) { op = decode(mmu.read_32(cs.pc)); cs.pc += 4; (optable[opcode])(op); } which I believe is very readable, but it counters everything one expects
Read the rest
about writing fast javascript code that runs in a tight loop. Bellard told me he thinks my "dynamic interpreted" version might be slower than a throughly optimized interpreter version, and he might very well be true. But I found the readability of the interpreter to be of the upmost importance, at least until I had a working "dynamic recompilation" version. To optimize the interpreter version, the profiler showed me that basically three things take most (about 65, 70% of the time: * Instruction decoding * Memory access There's not much I found to make instruction decoding faster , but the memory access time could be improved. In the beginning, I used the form mmu.read_32(addr) to read from any region of the memory, including RAM. Most of the accesses are of course from RAM, so it made sense to optimize for this fact (despite it being bad for readability). So nowadays I do: op = (v8[rpc] << 24) | (v8[rpc + 1] << 16) | (v8[rpc + 2] << 8) | (v8[rpc + 3]); For memory accesses. Some other things I found randomly. The processor in the board I'm emulating has a 75Mhz clock. With that emulated frequency, Linux was spending a lot of time on the "idle task". Whan I told the emulator that the frequency was about 8Mhz, the problem went away. Then, I thought to myself: it would be neat if I could implement parts of the libc in Javascript. That's how https://github.com/ubercomp/jslm32/blob/master/src/lm32_libc... came to be. So I implemented some string.h functions in javascript (memcpy, memmove, and memset), and voilá, the boot time went down about 3 times. But in the end of the day, lm32_libc_dev is a hack with very negative consequences. I would have to modify every program I wanted to run on the emulated board to use my libc functions instead. I did this with the linux kernel and it was a bad experience. So I focused my energy on the dynamic code generation side of things. I can tell you I have succeeded as the jslibc thing is now deleted on my local source three and I didn't experience any slowdowns whatsoever.
In Show HN: Open Source emulator in Javascript that runs Linux
Since there seems to be some interest on the subject, and I don't want to kidnap the great thread about the worst Linux PC ever [1], I decided to submit on a separate thread. Some things do keep in mind: 1. Very early stage. Runs better on Chrome. 2. If you think this sucks, you're probably comparing my code to Fabrice Bellard's Jslinux[2], and as Bellard is a genius his code (which is unfortunately still not available in readable form) is probably much better than mine. But progress is being made. 3. Still, the potential is there, soon it will be possible to have a somewhat standard programming stack and write GUI applications that run off a canvas, as I said in [3]. 4. For Chrome there is a nice terminal emulator (hterm) I lifted from the Chromium source tree. The rest use textarea. 5. The code, of course: https://github.com/ubercomp/js
Read the rest
lm32/ If anyone has questions, I'll be happy to answer them. [1] http://news.ycombinator.com/item?id=3767410 [2] http://bellard.org/jslinux [3] http://news.ycombinator.com/item?id=3769486 EDIT: Added itens 4 and 5.
In Show HN: Open Source emulator in Javascript that runs Linux
These crazy projects are the most fun. As Richard Feynman notoriously said: "What I cannot create, I do not understand". shameless plug below: Last year, inspired by Bellard's jslinux, I too wrote an emulator that can run Linux on the browser. Only I was lazy and emulated the vastly easier LatticeMico32 processor. Anyways, the result was very intellectually satisfying. After writing the interpreter, I went ahead and wrote a version that generates Javascript code on the fly (and captures up to 3 backwards jumps to the same block), for massive speed ups. Anyways, it doesn't serve any purposes, but boy was it fun... The code is at: https://github.com/ubercomp/jslm32/ And there's a demo running on: http://www.ubercomp.com/jslm32/src/ BEWARE: It only works well on Chrome (takes download time + 10s to boot on my machine). If anyone is intereste
Read the rest
d in this stuff, just ask and I'll write a post describing what I did to take boot time from 2.5 minutes to 10 seconds.
In Building the worst Linux PC ever: 6 hours to boot Ubuntu

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.