hack-emulator-js
Version:
a hack emulator for the nand2tetris project
61 lines (53 loc) • 1.69 kB
HTML
<html>
<head>
<title>Hack emulator written in javascript</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
</head>
<style>
#screen {
border: 1px solid;
}
.control {
cursor: pointer
}
#asm {
height: 200px;
width: 50%
}
#opcodes,
#milli {
max-width: 50%
}
</style>
<script>
// 24576 KBD
var cpu
</script>
<script src="./bundle.js"></script>
<body>
<div class="container">
<div class="row">
<div class="column">
<h3>Hack emulator</h3>
<canvas id="screen" width=512 height=256></canvas>
<div id="controls">
<span class="control" id="run">Run ▶</span>
<span class="control" id="stop">Stop ⏸</span>
<span id="numOpcodes">0</span><b> Cycles</b>
</div>
<form>
<label for="opcodes">Opcodes</label>
<input type="text" id="opcodes" value="50000">
<label for="opcodes">Per milli seconds</label>
<input type="text" id="milli" value="100">
<label for="asm">Assemble code (e.g. Copy and insert <a href="pong.txt">Pong</a>)</label>
<textarea id="asm"></textarea>
</form>
</div>
</div>
</div>
</body>
</html>