jslinux 简单分析:用JavaScript写出一个PC模拟器,下面运行Linux

jslinux 简单分析:用JavaScript写出一个PC模拟器,上面运行Linux。
jslinux 简单分析

jslinux:用JavaScript写出一个PC模拟器,上面运行Linux

1、主页面 (http://bellard.org/jslinux/) 很简单,主要调用了 如下两个 js 文件。

http://bellard.org/jslinux/term.js
http://bellard.org/jslinux/cpux86.js

2、term.js 里也没有发现什么特殊的地方;

3、cpux86.js 使用到一个 load_binary 的函数,查看了一下实现,是通过 XMLHttpRequest 来取如下三个 bin 文件:
http://bellard.org/jslinux/vmlinux26.bin
http://bellard.org/jslinux/root.bin
http://bellard.org/jslinux/linuxstart.bin

通过迅雷来看,这三个文件,总大小 3.6M 以上。因为网站在国外,很卡。

通过代理下载成功。在本地试了一下,不错。

1 楼
topcss
2011-05-18  

确实不错。。。

2 楼
kran
2011-05-22  

不清楚 到底 通过js怎么操作二进制文件。
代码又不能读。
博主清楚吗?

3 楼
zwhc
2011-05-23  

最下方有个链接,点开后进入
http://bellard.org/jslinux/tech.html

The code is written in pure Javascript using Typed Arrays which are available in recent browsers. It was tested with Firefox 4 and Google Chrome 11 on Linux, Window and Mac (it does not work with Chrome 12 beta. As far as I know, it is a bug in the browser). In any case, a fast Javascript engine is needed to have good performance.

Typed Arrays 就是用于操作二进制文件的。

http://www.khronos.org/registry/typedarray/specs/latest/

Abstract

This specification provides an API for interoperability with native binary data. It defines a generic fixed-length buffer type, as well as accessor types that allow access to the data stored within the buffer.

The functionality described here originated in the WebGL specification [WEBGL].

4 楼
kran
2011-05-24  

感谢博主 :)

5 楼
javavsnet
2011-05-25  

才知道javascript也能访问二进制代码

6 楼
ww2000e
2011-10-18  

打开只有一个光标闪

jslinux 简单分析:用JavaScript写出一个PC模拟器,下面运行Linux

相关文章:

你感兴趣的文章:

标签云: