ontext('2d');
var imageData = context.getImageData(0, 0, 256, 240);
$("#emulator").append(screen);

var nes = null;
var player = 0;

function clearScreen() {
  context.fillStyle = "black";
  context.fillRect(0, 0, 256, 240);
  for (var i = 3; i < imageData.data.length-3; i += 4) {
    imageData.data[i] = 0xFF;
  }
}

function createNes() {
  nes = new JSNES({});
  nes.ui.writeFrame = function (buffer, prevBuffer) {
    var data = imageData.data;
    var pixel, i, j;
    for (i=0; i<256*240; i++) {
        p