From fddcbeb865f0b8021806d3c9d99b0cfec3746776 Mon Sep 17 00:00:00 2001 From: Preston Skupinski Date: Thu, 31 May 2012 10:43:02 -0400 Subject: [PATCH] fix support for requiring the cpu as a node.js module and a problem in the javascript in example page --- cpu.js | 5 +++-- index.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cpu.js b/cpu.js index 7022b30..731c217 100755 --- a/cpu.js +++ b/cpu.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Preston Skupinski + * Copyright (c) 2011-2012, Preston Skupinski * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -3937,4 +3937,5 @@ window.CPU_65816 = function() { this.cycle_count = 0; }; }; -})(this); +})((typeof module !== 'undefined' && + typeof module.exports !== 'undefined')?module.exports:this); diff --git a/index.html b/index.html index b4012d3..3652545 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@ $(document).ready(function() { }); $("#load").click(function() { cpu.reset(); - cpu.load_program($("#hex").val()); + cpu.load_binary($("#hex").val()); updateFields(); can_step = true; $("#step").removeAttr("disabled");