mirror of
https://github.com/trebonian/visual6502.git
synced 2024-12-21 21:29:16 +00:00
[dev]externalise testprogram
This commit is contained in:
parent
0773a9e7cf
commit
971bbd03e3
@ -10,6 +10,7 @@
|
|||||||
<script src="chipsim.js"></script>
|
<script src="chipsim.js"></script>
|
||||||
<script src="memtable.js"></script>
|
<script src="memtable.js"></script>
|
||||||
<script src="macros.js"></script>
|
<script src="macros.js"></script>
|
||||||
|
<script src="testprogram.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function handleOnload() {
|
function handleOnload() {
|
||||||
|
25
macros.js
25
macros.js
@ -21,27 +21,34 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var memory = Array();
|
var memory = Array();
|
||||||
var code = [0xa9, 0x00, 0x20, 0x10, 0x00, 0x4c, 0x02, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0xe8, 0x88, 0xe6, 0x40, 0x38, 0x69, 0x02, 0x60];
|
|
||||||
var cycle = 0;
|
var cycle = 0;
|
||||||
var trace = Array();
|
var trace = Array();
|
||||||
var logstream = Array();
|
var logstream = Array();
|
||||||
var running = false;
|
var running = false;
|
||||||
|
|
||||||
function loadProgram(){
|
function loadProgram(){
|
||||||
|
// a moderate size of static testprogram might be loaded
|
||||||
|
if(testprogram.length!=0 && testprogramAddress != undefined)
|
||||||
|
for(var i=0;testprogram[i]!=undefined;i++){
|
||||||
|
var a=testprogramAddress+i;
|
||||||
|
mWrite(a, testprogram[i]);
|
||||||
|
if(a<0x200)
|
||||||
|
setCellValue(a, testprogram[i]);
|
||||||
|
}
|
||||||
|
// a small test program or patch might be passed in the URL
|
||||||
if(userCode.length!=0)
|
if(userCode.length!=0)
|
||||||
code=userCode;
|
for(var i=0;i<userCode.length;i++){
|
||||||
|
if(userCode[i] != undefined){
|
||||||
|
mWrite(i, userCode[i]);
|
||||||
|
if(i<0x200)
|
||||||
|
setCellValue(i, userCode[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
// default reset vector will be 0x0000 because undefined memory reads as zero
|
// default reset vector will be 0x0000 because undefined memory reads as zero
|
||||||
if(userResetLow!=undefined)
|
if(userResetLow!=undefined)
|
||||||
mWrite(0xfffc, userResetLow);
|
mWrite(0xfffc, userResetLow);
|
||||||
if(userResetHigh!=undefined)
|
if(userResetHigh!=undefined)
|
||||||
mWrite(0xfffd, userResetHigh);
|
mWrite(0xfffd, userResetHigh);
|
||||||
for(var i=0;i<code.length;i++){
|
|
||||||
mWrite(i, code[i]);
|
|
||||||
if(i<0x200)
|
|
||||||
setCellValue(i, code[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function go(){
|
function go(){
|
||||||
|
15
testprogram.js
Normal file
15
testprogram.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// This file testprogram.js can be substituted by one of several tests
|
||||||
|
// which may not be redistributable
|
||||||
|
// for example
|
||||||
|
// cbmbasic loaded at 0xa000 with entry point 0xe394
|
||||||
|
// test6502 (by Bird Computer) loaded at 0x8000 with entry point 0x8000
|
||||||
|
//
|
||||||
|
// (can use xxd -i to convert binary into C include syntax, as a starting point)
|
||||||
|
//
|
||||||
|
testprogramAddress=0x0000;
|
||||||
|
|
||||||
|
testprogram = [
|
||||||
|
0xa9, 0x00, 0x20, 0x10, 0x00, 0x4c, 0x02, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe8, 0x88, 0xe6, 0x40, 0x38, 0x69, 0x02, 0x60
|
||||||
|
];
|
Loading…
Reference in New Issue
Block a user