From 6eb02301dcf6e202b46e26ccb9758415b623ea35 Mon Sep 17 00:00:00 2001 From: Preston Skupinski Date: Thu, 9 Aug 2012 22:49:47 -0400 Subject: [PATCH] switch tests to use strictEqual rather than equal and perform some cleanup --- test/tests.js | 1513 +++++++++++++++++++++++++------------------------ 1 file changed, 765 insertions(+), 748 deletions(-) diff --git a/test/tests.js b/test/tests.js index c7268e2..6eed967 100644 --- a/test/tests.js +++ b/test/tests.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 @@ -15,6 +15,7 @@ */ function run_tests() { + test_cpu_load_binary(); test_lda(); test_inc(); test_inx(); @@ -30,7 +31,6 @@ function run_tests() { test_subroutines(); test_mvn_and_mvp(); test_emulation_mode(); - test_cpu_load_binary(); test_cpu_memory_mapped_io_devices(); } @@ -41,26 +41,25 @@ function test_lda() { var cpu = new CPU_65816(); cpu.load_binary("18fba9ff", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff, "The accumulator should be 0xff when 0xff is "+ - "given as its argument in 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.m, 1, "m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be "+ - "0 for native mode"); + strictEqual(cpu.r.a, 0xff, "The accumulator should be 0xff when 0xff is "+ + "given as its argument in 8-bit memory/accumulator mode."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode"); }); test("Make sure LDA with a constant properly loads a 16-bit value in "+ "16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ffff", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff when 0xffff is "+ - "given as its argument in 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.m, 0, "m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be "+ - "0 for native mode"); + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff when "+ + "0xffff is given as its argument in 16-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode"); }); test("Make sure LDA with a direct page address loads an 8-bit value in "+ @@ -68,52 +67,52 @@ function test_lda() { var cpu = new CPU_65816(); cpu.load_binary("18fba90185fea5fe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 1, "The accumulator should be 1 when 1 is "+ - "loaded from $fe(direct page) in 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.m, 1, "m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode"); + strictEqual(cpu.r.a, 1, "The accumulator should be 1 when 1 is "+ + "loaded from $fe(direct page) in 8-bit memory/accumulator "+ + "mode."); + strictEqual(cpu.p.m, 1, "m flag of the p status register should be 1 for "+ + "8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The Hidden e flag of the p status register "+ + "should be 0 for native mode"); }); test("Make sure LDA with a direct page address loads a 16-bit value in "+ "16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a901ff85fea5fe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff01, "The accumulator should be 0xff01 when 0xff01 "+ - "is loaded from $fe(direct page) in 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.m, 0, "m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xff01, "The accumulator should be 0xff01 when "+ + "0xff01 is loaded from $fe(direct page) in 16-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Make sure LDA with an absolute address loads an 8-bit value in "+ "8-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fe8dff0aa900adff0a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfe, "The accumulator should be 0xfe when 0xfe is "+ - "loaded from $0aff(absolute) in 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.m, 1, "m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfe, "The accumulator should be 0xfe when 0xfe is "+ + "loaded from $0aff(absolute) in 8-bit memory/accumulator "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Make sure LDA with an absolute address loads a 16-bit value in "+ "16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ffff8dff0aa90000adff0a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff when 0xffff "+ - "is loaded from $0aff and $0b00(absolute) in 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.m, 0, "m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff when "+ + "0xffff is loaded from $0aff and $0b00(absolute) in 16-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.m, 0, "m flag of the p status register should be 0 for "+ + "16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "Hidden e flag of the p status register should "+ + "be 0 for native mode."); }); test("Make sure LDA with a direct page address indexed with the x "+ "register loads an 8-bit value in 8-bit memory/accumulator mode.", @@ -121,17 +120,17 @@ function test_lda() { var cpu = new CPU_65816(); cpu.load_binary("18fba201a9ff85ffa900b5fe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff, "The accumulator should be 0xff when 0xff "+ - "is loaded from direct page address $fe indexed "+ - "with x(which is 1) and thus loaded from $ff in "+ - "8-bit memory/accumulator mode."); - equal(cpu.r.x, 1, "The x register should be 1 in order to be used as "+ - "an index with the base address to get to the "+ - "desired address."); - equal(cpu.p.m, 1, "m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xff, "The accumulator should be 0xff when 0xff "+ + "is loaded from direct page address $fe indexed "+ + "with x(which is 1) and thus loaded from $ff in "+ + "8-bit memory/accumulator mode."); + strictEqual(cpu.r.x, 1, "The x register should be 1 in order to be used "+ + "as an index with the base address to get to the desired "+ + "address."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Make sure LDA with a direct page address indexed with the x "+ "register loads a 16-bit value in 16-bit memory/accumulator mode.", @@ -139,185 +138,183 @@ function test_lda() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a201a9ffff85fea90000bdfd", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff when 0xffff "+ - "is loaded from direct page addresses $fe and "+ - "$ff after $fd is indexed with the x register("+ - "which is 1) in 16-bit memory/accumulator mode."); - equal(cpu.r.x, 1, "The x register should be 1 in order to be used as "+ - "an index with the base address to get to the "+ - "desired address."); - equal(cpu.p.m, 0, "m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff when "+ + "0xffff is loaded from direct page addresses $fe and $ff "+ + "after $fd is indexed with the x register(which is 1) in "+ + "16-bit memory/accumulator mode."); + strictEqual(cpu.r.x, 1, "The x register should be 1 in order to be used "+ + "as an index with the base address to get to the desired "+ + "address."); + strictEqual(cpu.p.m, 0, "m flag of the p status register should be 0 for "+ + "16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Make sure LDA indirect given a direct page address loads an 8-bit "+ "value in 8-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9ff85fea90a85ffa9068dff0aa900b2fe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 6, "The accumulator should be 6 when LDA loads an 8-bit "+ - "value using an indirect address in 8-bit mode "+ - "memory/accumulator mode."); - equal(cpu.p.m, 1, "m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 6, "The accumulator should be 6 when LDA loads an "+ + "8-bit value using an indirect address in 8-bit mode "+ + "memory/accumulator mode."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Make sure LDA indirect given a direct page address loads a 16-bit "+ "value in 16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ff0a85fea9ffff8dff0aa90000b2fe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff when LDA loads "+ - "a 16-bit value using an indirect address "+ - "loaded from a direct page address."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff when "+ + "LDA loads a 16-bit value using an indirect address loaded "+ + "from a direct page address."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be "+ + "0 for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute indexed by the x register works for 8-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fa8dff0aa201a900bdfe0a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfa, "The accumulator should be 0xfa when LDA loads "+ - "an 8-bit value using absolute indexed x mode "+ - "from $0aff"); - equal(cpu.r.x, 1, "The x register should be 1 to properly load "+ - "the value added to the base address."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfa, "The accumulator should be 0xfa when LDA loads "+ + "an 8-bit value using absolute indexed x mode from $0aff"); + strictEqual(cpu.r.x, 1, "The x register should be 1 to properly load "+ + "the value added to the base address."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be "+ + "1 for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute indexed by the x register works for 16-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9fefa8dff0aa203bdfc0a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ - "loads a 16-bit value from $0aff using "+ - "absolute indexed x addressing mode."); - equal(cpu.r.x, 3, "The x register should be 3 to properly load "+ - "the value added to the base address."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ + "loads a 16-bit value from $0aff using absolute indexed x "+ + "addressing mode."); + strictEqual(cpu.r.x, 3, "The x register should be 3 to properly load "+ + "the value added to the base address."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute indexed by the y register works for 8-bit "+ "memory/acccumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fe8dff0aa002a900b9fd0a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfe, "The accumulator should be 0xfe when LDA loads an "+ - "8-bit value from $0aff using absolute indexed y "+ - "addressing mode."); - equal(cpu.r.y, 2, "The y register should be 2 to properly load the "+ - "value added to the base address."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfe, "The accumulator should be 0xfe when LDA "+ + "loads an 8-bit value from $0aff using absolute indexed y "+ + "addressing mode."); + strictEqual(cpu.r.y, 2, "The y register should be 2 to properly load the "+ + "value added to the base address."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute indexed by the y register works for 16-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9fefa8dff0aa003a90000b9fc0a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA loads "+ - "a 16-bit value from $0aff using absolute "+ - "indexed y addressing mode."); - equal(cpu.r.y, 3, "The y register should be 3 to properly load the "+ - "value added to the base address."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ + "loads a 16-bit value from $0aff using absolute indexed y "+ + "addressing mode."); + strictEqual(cpu.r.y, 3, "The y register should be 3 to properly load the "+ + "value added to the base address."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA stack relative works for 8-bit memory/accumulator "+ "mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fe48a90148a900a302", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfe, "The accumulator should be 0xfe when LDA loads "+ - "an 8-bit value from the stack using LDA stack "+ - "relative addressing mode."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfe, "The accumulator should be 0xfe when LDA loads "+ + "an 8-bit value from the stack using LDA stack relative "+ + "addressing mode."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA stack relative works for 16-bit memory/accumulator "+ "mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9fefa48a9010048a90000a303", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ - "loads a 16-bit value from the stack using LDA "+ - "stack relative addressing mode."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ + "loads a 16-bit value from the stack using LDA stack "+ + "relative addressing mode."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute long works for 8-bit memory/accumulator "+ "mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fa8fffeeaaa900afffeeaa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfa, "The accumulator should be 0xfa when LDA "+ - "loads an 8-bit value from $aaeeff using "+ - "absolute long addressing mode."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfa, "The accumulator should be 0xfa when LDA "+ + "loads an 8-bit value from $aaeeff using absolute long "+ + "addressing mode."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute long works for 16-bit memory/accumulator "+ "mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9fefa8fffeeaaa90000afffeeaa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ - "loads a 16-bit value from $aaeeff using "+ - "absolute long addressing mode."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ + "loads a 16-bit value from $aaeeff using absolute long "+ + "addressing mode."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute long indexed by the x register works for "+ "8-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fe8fffeeaaa202a900bffdeeaa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfe, "The accumulator should be 0xfe when LDA "+ - "loads an 8-bit value from $aaeeff using "+ - "absolute long indexed x addressing mode."); - equal(cpu.r.x, 2, "The x register should be 2 in order to be used as "+ - "an index to reach the correct address."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfe, "The accumulator should be 0xfe when LDA "+ + "loads an 8-bit value from $aaeeff using absolute long "+ + "indexed x addressing mode."); + strictEqual(cpu.r.x, 2, "The x register should be 2 in order to be used "+ + "as an index to reach the correct address."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Ensure that LDA absolute long indexed by the x register works for "+ "16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9fefa8fffeeaaa203a90000bffceeaa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ - "loads a 16-bit value from $aaeeff using "+ - "absolute long indexed x addressing mode."); - equal(cpu.r.x, 3, "The x register should be 3 in order to be used as "+ - "an index to reach the correct address."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "Hidden e flag of the p status register should be 0 "+ - "for native mode."); + strictEqual(cpu.r.a, 0xfafe, "The accumulator should be 0xfafe when LDA "+ + "loads a 16-bit value from $aaeeff using absolute long "+ + "indexed x addressing mode."); + strictEqual(cpu.r.x, 3, "The x register should be 3 in order to be used "+ + "as an index to reach the correct address."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); } @@ -327,78 +324,84 @@ function test_inc() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fe1a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff, "The accumulator should be 0xff after "+ - "incrementing 0xfe by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.n, 1, "The n flag should be one to represent a negative "+ - "number."); - equal(cpu.p.z, 0, "The z flag should be zero to represent a non-zero"+ - "number."); + strictEqual(cpu.r.a, 0xff, "The accumulator should be 0xff after "+ + "incrementing 0xfe by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.n, 1, "The n flag should be one to represent a negative "+ + "number."); + strictEqual(cpu.p.z, 0, "The z flag should be zero to represent a non-zero"+ + "number."); cpu.reset(); cpu.load_binary("18fba9ff1a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after "+ + strictEqual(cpu.r.a, 0, "The accumulator should be zero after "+ "incrementing 0xff by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.n, 0, "The n flag should be zero to represent a non-negative "+ - "number."); - equal(cpu.p.z, 1, "The z flag should be one to represent zero."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.n, 0, "The n flag should be zero to represent a "+ + "non-negative number."); + strictEqual(cpu.p.z, 1, "The z flag should be one to represent zero."); }); test("Test INC accumulator for 16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9feff1a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff after "+ - "incrementing 0xfffe by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.z, 0, "The z flag should be zero to represent a non-zero "+ - "number."); - equal(cpu.p.n, 1, "The n flag should be one to represent a negative "+ - "number."); + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff after "+ + "incrementing 0xfffe by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.z, 0, "The z flag should be zero to represent a "+ + "non-zero number."); + strictEqual(cpu.p.n, 1, "The n flag should be one to represent a negative "+ + "number."); cpu.reset(); cpu.load_binary("18fbc220a9ffff1a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after incrementing "+ - "0xffff by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.z, 1, "The z flag should be one to represent zero."); - equal(cpu.p.n, 0, "The n flag should be zero to represent a non-negative "+ - "number."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after "+ + "incrementing 0xffff by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.z, 1, "The z flag should be one to represent zero."); + strictEqual(cpu.p.n, 0, "The n flag should be zero to represent a "+ + "non-negative number."); }); test("Test INC absolute for 8-bit memory/accumulator mode", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9fe8d0070ee0070af0070", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff, "The accumulator should be 0xff after loading "+ - "from memory a value that was originally 0xfe "+ - "and incremented by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); - equal(cpu.p.n, 1, "The n flag should be one for a negative number."); + strictEqual(cpu.r.a, 0xff, "The accumulator should be 0xff after loading "+ + "from memory a value that was originally 0xfe "+ + "and incremented by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); + strictEqual(cpu.p.n, 1, "The n flag should be one for a negative number."); }); test("Test INC absolute for 16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9feff8d0070ee0070af0070", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff after loading "+ - "from memory a value that was originally 0xfffe "+ - "and incremented by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff after "+ + "loading from memory a value that was originally 0xfffe "+ + "and incremented by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ "memory/accumulator mode."); - equal(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); - equal(cpu.p.n, 1, "The n flag should be one for a negative number."); + strictEqual(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); + strictEqual(cpu.p.n, 1, "The n flag should be one for a negative number."); }); } @@ -408,48 +411,53 @@ function test_inx() { var cpu = new CPU_65816(); cpu.load_binary("18fba2fee8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.x, 0xff, "The x register should be 0xff after incrementing "+ - "0xfe by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.x, 1, "The x flag should be one for 8-bit "+ - "index register mode."); - equal(cpu.p.n, 1, "The n flag should be one to represent a negative "+ - "number."); - equal(cpu.p.z, 0, "The z flag should be zero to represent a non-zero "+ - "number."); + strictEqual(cpu.r.x, 0xff, "The x register should be 0xff after "+ + "incrementing 0xfe by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.x, 1, "The x flag should be one for 8-bit "+ + "index register mode."); + strictEqual(cpu.p.n, 1, "The n flag should be one to represent a negative "+ + "number."); + strictEqual(cpu.p.z, 0, "The z flag should be zero to represent a "+ + "non-zero number."); cpu.reset(); cpu.load_binary("18fba2ffe8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.x, 0, "The x register should be zero after incrementing "+ - "0xff by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.x, 1, "The x flag should be one for 8-bit "+ - "index register mode."); - equal(cpu.p.z, 1, "The z flag should be one for zero."); - equal(cpu.p.n, 0, "The n flag should be zero to represent a "+ - "non-negative number."); + strictEqual(cpu.r.x, 0, "The x register should be zero after incrementing "+ + "0xff by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.x, 1, "The x flag should be one for 8-bit "+ + "index register mode."); + strictEqual(cpu.p.z, 1, "The z flag should be one for zero."); + strictEqual(cpu.p.n, 0, "The n flag should be zero to represent a "+ + "non-negative number."); }); test("Test INX for 16-bit index register mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc210a2feffe8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.x, 0xffff, "The x register should be 0xffff after "+ - "incrementing 0xfffe by one."); - equal(cpu.p.x, 0, "The x flag of the p status register should be zero "+ - "for 16-bit index register mode."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); - equal(cpu.p.n, 1, "The n flag should be one for a negative number."); + strictEqual(cpu.r.x, 0xffff, "The x register should be 0xffff after "+ + "incrementing 0xfffe by one."); + strictEqual(cpu.p.x, 0, "The x flag of the p status register should be "+ + "zero for 16-bit index register mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); + strictEqual(cpu.p.n, 1, "The n flag should be one for a negative number."); cpu.reset(); cpu.load_binary("18fbc210a2ffffe8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.x, 0, "The x register should be zero after incrementing "+ - "0xffff by one."); - equal(cpu.p.x, 0, "The x flag of the p status register should be zero "+ - "for 16-bit index register mode."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.n, 0, "The n flag should be zero for a non-negative number."); - equal(cpu.p.z, 1, "The z flag should be one for zero."); + strictEqual(cpu.r.x, 0, "The x register should be zero after incrementing "+ + "0xffff by one."); + strictEqual(cpu.p.x, 0, "The x flag of the p status register should be "+ + "zero for 16-bit index register mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.n, 0, "The n flag should be zero for a non-negative "+ + "number."); + strictEqual(cpu.p.z, 1, "The z flag should be one for zero."); }); } @@ -459,37 +467,41 @@ function test_iny() { var cpu = new CPU_65816(); cpu.load_binary("18fba0fec8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.y, 0xff, "The y register should be 0xff after incrementing "+ - "0xfe by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.x, 1, "The x flag should be one for 8-bit index register "+ - "mode."); + strictEqual(cpu.r.y, 0xff, "The y register should be 0xff after "+ + "incrementing 0xfe by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.x, 1, "The x flag should be one for 8-bit index "+ + "register mode."); cpu.reset(); cpu.load_binary("18fba0ffc8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.y, 0, "The y register should be zero after incrementing "+ - "0xff by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.x, 1, "The x flag should be one for 8-bit index register "+ - "mode."); + strictEqual(cpu.r.y, 0, "The y register should be zero after incrementing "+ + "0xff by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.x, 1, "The x flag should be one for 8-bit index "+ + "register mode."); }); test("Test INY for 16-bit index register mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc210a0feffc8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.y, 0xffff, "The y register should be 0xffff after "+ - "incrementing 0xfffe by one."); - equal(cpu.p.x, 0, "The x flag of the p status register should be zero "+ - "for 16-bit index register mode."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); + strictEqual(cpu.r.y, 0xffff, "The y register should be 0xffff after "+ + "incrementing 0xfffe by one."); + strictEqual(cpu.p.x, 0, "The x flag of the p status register should be "+ + "zero for 16-bit index register mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); cpu.reset(); cpu.load_binary("18fbc210a0ffffc8", 0x8000); cpu.execute(0x8000); - equal(cpu.r.y, 0, "The y register should be zero after incrementing "+ - "0xffff by one."); - equal(cpu.p.x, 0, "The x flag of the p status register should be zero "+ - "for 16-bit index register mode."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); + strictEqual(cpu.r.y, 0, "The y register should be zero after incrementing "+ + "0xffff by one."); + strictEqual(cpu.p.x, 0, "The x flag of the p status register should be "+ + "zero for 16-bit index register mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); }); } @@ -499,51 +511,57 @@ function test_dec() { var cpu = new CPU_65816(); cpu.load_binary("18fba9013a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after decrementing "+ - "one by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.z, 1, "The z flag should be one for zero."); - equal(cpu.p.n, 0, "The n flag should be zero for a non-negative number."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after "+ + "decrementing one by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.z, 1, "The z flag should be one for zero."); + strictEqual(cpu.p.n, 0, "The n flag should be zero for a non-negative "+ + "number."); }); test("Test DEC accumulator decrementing zero by one behavior for 8-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9003a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff, "The accumulator should be 0xff after decrementing "+ - "zero by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); - equal(cpu.p.n, 1, "The n flag should be one for a negative number."); + strictEqual(cpu.r.a, 0xff, "The accumulator should be 0xff after "+ + "decrementing zero by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); + strictEqual(cpu.p.n, 1, "The n flag should be one for a negative number."); }); test("Test DEC accumulator for 16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a901003a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after decrementing "+ - "one by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + strictEqual(cpu.r.a, 0, "The accumulator should be zero after "+ + "decrementing one by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ "memory/accumulator mode."); - equal(cpu.p.z, 1, "The z flag should be one for zero."); - equal(cpu.p.n, 0, "The n flag should be zero for a non-negative number."); + strictEqual(cpu.p.z, 1, "The z flag should be one for zero."); + strictEqual(cpu.p.n, 0, "The n flag should be zero for a non-negative "+ + "number."); }); test("Test DEC accumulator decrementing zero by one behavior for 16-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a900003a", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "The accumulator should be 0xffff after "+ - "decrementing zero by one."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag sholud be zero for 16-bit "+ + strictEqual(cpu.r.a, 0xffff, "The accumulator should be 0xffff after "+ + "decrementing zero by one."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag sholud be zero for 16-bit "+ "memory/accumulator mode."); - equal(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); - equal(cpu.p.n, 1, "The n flag should be one for a negative number."); + strictEqual(cpu.p.z, 0, "The z flag should be zero for a non-zero number."); + strictEqual(cpu.p.n, 1, "The n flag should be one for a negative number."); }); } @@ -553,85 +571,93 @@ function test_stz() { var cpu = new CPU_65816(); cpu.load_binary("18fba9ff85fa64faa5fa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from a "+ - "direct page addresss that has had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from a direct page addresss that has had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ "memory/accumulator mode."); }); test("Test STZ direct page for 16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ffff85fa64faa5fa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from a "+ - "direct page address that had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from a direct page address that had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + "memory/accumulator mode."); }); test("Test STZ absolute for 8-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9ff8d34129c3412ad3412", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from an "+ - "absolute address that had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from an absolute address that had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); }); test("Test STZ absolute for 16-bit memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ffff8d34129c3412ad3412", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from an "+ - "absolute page address that had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from an absolute page address that had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + "memory/accumulator mode."); }); test("Test STZ direct page indexed by the x register for 8-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9ff85fb85faa20174faa5fb", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from a "+ - "direct page addresss that has had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from a direct page addresss that has had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); }); test("Test STZ direct page indexed by the x register for 16-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ffff85faa20274f8a5fa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from a "+ - "direct page address that had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from a direct page address that had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + "memory/accumulator mode."); }); test("Test STZ absolute indexed by the x register for 8-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fba9ff8dbbaa8dbaaaa2019ebaaaadbbaa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from an "+ - "absolute address that had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 1, "The m flag should be one for 8-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from an absolute address that had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 1, "The m flag should be one for 8-bit "+ + "memory/accumulator mode."); }); test("Test STZ absolute indexed by the x register for 16-bit "+ "memory/accumulator mode.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220a9ffff8dbbaaa2029eb9aaadbbaa", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "The accumulator should be zero after loading from an "+ - "absolute page address that had zero stored to it."); - equal(cpu.p.e, 0, "The hidden e flag should be zero for native mode."); - equal(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ - "memory/accumulator mode."); + strictEqual(cpu.r.a, 0, "The accumulator should be zero after loading "+ + "from an absolute page address that had zero stored to it."); + strictEqual(cpu.p.e, 0, "The hidden e flag should be zero for native "+ + "mode."); + strictEqual(cpu.p.m, 0, "The m flag should be zero for 16-bit "+ + "memory/accumulator mode."); }); } @@ -642,10 +668,10 @@ function test_emulation_mode() { var cpu = new CPU_65816(); cpu.load_binary("a9fe8d0001a90068", 0x8000); cpu.execute(0x8000); - equal(cpu.r.s, 0, "The stack register should be 0 after the pull "+ - "operation."); - equal(cpu.r.a, 0xfe, "The accumulator should be 0xfe after the pull "+ - "operation."); + strictEqual(cpu.r.s, 0, "The stack register should be 0 after the pull "+ + "operation."); + strictEqual(cpu.r.a, 0xfe, "The accumulator should be 0xfe after the pull "+ + "operation."); }); } @@ -656,19 +682,17 @@ function test_mvn_and_mvp() { cpu.load_binary("18fbe230a9ab8dff0fa9cd8d0010c230a90100a20010a00020440000", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xffff, "After executing the example program the "+ - "accumulator should've underflowed and "+ - "resulted in 0xffff."); - equal(cpu.r.x, 0x0ffe, "After executing the example program the x "+ - "register should be 0x0ffe."); - equal(cpu.r.y, 0x1ffe, "After executing the example program the y "+ - "register should be 0x1ffe."); + strictEqual(cpu.r.a, 0xffff, "After executing the example program the "+ + "accumulator should've underflowed and resulted in 0xffff."); + strictEqual(cpu.r.x, 0x0ffe, "After executing the example program the x "+ + "register should be 0x0ffe."); + strictEqual(cpu.r.y, 0x1ffe, "After executing the example program the y "+ + "register should be 0x1ffe."); var byte_one = cpu.mmu.read_byte(0x1fff); var byte_two = cpu.mmu.read_byte(0x2000); - equal(byte_one, 0xab, "After executing the example program 0x001fff "+ - "in memory should contain 0xab."); - equal(byte_two, 0xcd, "After executing the example program 0x002000 "+ - "in memory should contain 0xcd."); + strictEqual(byte_one, 0xab, "After executing the example program 0x001fff "+ "in memory should contain 0xab."); + strictEqual(byte_two, 0xcd, "After executing the example program 0x002000 "+ + "in memory should contain 0xcd."); }); } @@ -680,8 +704,8 @@ function test_subroutines() { // effectively halts the program. cpu.load_binary("18fbc23018a9ffff200e804cffff3a60", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xfffe, "The subroutine should execute exactly once, "+ - "decrementing 0xffff to 0xfffe."); + strictEqual(cpu.r.a, 0xfffe, "The subroutine should execute exactly once, "+ + "decrementing 0xffff to 0xfffe."); }); } @@ -691,27 +715,27 @@ function test_cmp() { var cpu = new CPU_65816(); cpu.load_binary("18fbe23018a901c9ff", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x01, "CMP should not change the value of the "+ - "accumulator"); - equal(cpu.p.z, 0, "When comparing 0x01 and 0xff the zero(z) bit "+ - "should not be set (0x01 != 0xff)"); - equal(cpu.p.n, 0, "When comparing 0x01 and 0xff the negative(n) bit "+ - "should not be set"); - equal(cpu.p.c, 0, "When comparing 0x01 and 0xff the carry(c) bit "+ - "should not be set (0x01 < 0xff)"); + strictEqual(cpu.r.a, 0x01, "CMP should not change the value of the "+ + "accumulator"); + strictEqual(cpu.p.z, 0, "When comparing 0x01 and 0xff the zero(z) bit "+ + "should not be set (0x01 != 0xff)"); + strictEqual(cpu.p.n, 0, "When comparing 0x01 and 0xff the negative(n) bit "+ + "should not be set"); + strictEqual(cpu.p.c, 0, "When comparing 0x01 and 0xff the carry(c) bit "+ + "should not be set (0x01 < 0xff)"); }); test("Compare two 16-bit numbers, 0xff01 and 0xfeff", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc23018a901ffc9fffe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xff01, "CMP should not change the value of the "+ - "accumulator"); - equal(cpu.p.n, 0, "When comparing 0xff01 and 0xfeff the negative(n) "+ - "bit should not be set"); - equal(cpu.p.z, 0, "When comparing 0xff01 and 0xfeff the zero(z) bit "+ - "should not be set (0xff01 != 0xfeff)"); - equal(cpu.p.c, 1, "When comparing 0xff01 and 0xfeff the carry(c) bit "+ - "should be set (0xff01 >= 0xfeff)"); + strictEqual(cpu.r.a, 0xff01, "CMP should not change the value of the "+ + "accumulator"); + strictEqual(cpu.p.n, 0, "When comparing 0xff01 and 0xfeff the negative(n) "+ + "bit should not be set"); + strictEqual(cpu.p.z, 0, "When comparing 0xff01 and 0xfeff the zero(z) bit "+ + "should not be set (0xff01 != 0xfeff)"); + strictEqual(cpu.p.c, 1, "When comparing 0xff01 and 0xfeff the carry(c) "+ + "bit should be set (0xff01 >= 0xfeff)"); }); } @@ -722,16 +746,16 @@ function test_sbc() { var cpu = new CPU_65816(); cpu.load_binary("18fbe230a90138e901", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "0x01 - 0x01 should result in zero when using "+ - "SBC"); - equal(cpu.p.z, 1, "0x01 - 0x01 should set the zero(z) bit when "+ - "using SBC"); - equal(cpu.p.n, 0, "0x01 - 0x01 should not set the negative(n) bit "+ - "when using SBC"); - equal(cpu.p.v, 0, "0x01 - 0x01 should not set the overflow(v) bit "+ - "when using SBC"); - equal(cpu.p.c, 1, "0x01 - 0x01 should set the carry(c) bit when using "+ - "SBC"); + strictEqual(cpu.r.a, 0, "0x01 - 0x01 should result in zero when using "+ + "SBC"); + strictEqual(cpu.p.z, 1, "0x01 - 0x01 should set the zero(z) bit when "+ + "using SBC"); + strictEqual(cpu.p.n, 0, "0x01 - 0x01 should not set the negative(n) bit "+ + "when using SBC"); + strictEqual(cpu.p.v, 0, "0x01 - 0x01 should not set the overflow(v) bit "+ + "when using SBC"); + strictEqual(cpu.p.c, 1, "0x01 - 0x01 should set the carry(c) bit when "+ + "using SBC"); }); test("Test normal subtraction of two 16-bit numbers that don't cause a "+ @@ -739,138 +763,138 @@ function test_sbc() { var cpu = new CPU_65816(); cpu.load_binary("18fbc230a9010038e90100", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0, "0x0001 - 0x0001 should result in zero when using "+ - "SBC"); - equal(cpu.p.z, 1, "0x0001 - 0x0001 should set the zero(z) bit when "+ - "using SBC"); - equal(cpu.p.n, 0, "0x0001 - 0x0001 should not set the negative(n) bit "+ - "when using SBC"); - equal(cpu.p.v, 0, "0x0001 - 0x0001 should not set the overflow(v) bit "+ - "when using SBC"); - equal(cpu.p.c, 1, "0x0001 - 0x0001 should set the carry(c) bit when "+ - "using SBC"); + strictEqual(cpu.r.a, 0, "0x0001 - 0x0001 should result in zero when using "+ + "SBC"); + strictEqual(cpu.p.z, 1, "0x0001 - 0x0001 should set the zero(z) bit when "+ + "using SBC"); + strictEqual(cpu.p.n, 0, "0x0001 - 0x0001 should not set the negative(n) "+ + "bit when using SBC"); + strictEqual(cpu.p.v, 0, "0x0001 - 0x0001 should not set the overflow(v) "+ + "bit when using SBC"); + strictEqual(cpu.p.c, 1, "0x0001 - 0x0001 should set the carry(c) bit when "+ + "using SBC"); }); test("Test subtraction that triggers a borrow with 8-bit numbers", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbe230a9d038e9ef", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xe1, "0xd0 - 0xef should set the accumulator to 0xe1 "+ - "when using SBC"); - equal(cpu.p.n, 1, "0xd0 - 0xef should set the negative(n) bit when "+ - "using SBC"); - equal(cpu.p.v, 0, "0xd0 - 0xef should not set the overflow(v) bit "+ - "when using SBC"); - equal(cpu.p.z, 0, "0xd0 - 0xef should not set the zero(z) bit when "+ - "using SBC"); - equal(cpu.p.c, 0, "0xd0 - 0xef should not set the carry(c) bit when "+ - "using SBC"); + strictEqual(cpu.r.a, 0xe1, "0xd0 - 0xef should set the accumulator to "+ + "0xe1 when using SBC"); + strictEqual(cpu.p.n, 1, "0xd0 - 0xef should set the negative(n) bit when "+ + "using SBC"); + strictEqual(cpu.p.v, 0, "0xd0 - 0xef should not set the overflow(v) bit "+ + "when using SBC"); + strictEqual(cpu.p.z, 0, "0xd0 - 0xef should not set the zero(z) bit when "+ + "using SBC"); + strictEqual(cpu.p.c, 0, "0xd0 - 0xef should not set the carry(c) bit when "+ + "using SBC"); }); test("Test subtraction that triggers a borrow with 16-bit numbers", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc230a900d038e900ef", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0xe100, "0xd000 - 0xef00 should set the accumulator to "+ - "0xe0ff when using SBC"); - equal(cpu.p.n, 1, "0xd000 - 0xef00 should set the negative(n) bit when "+ - "using SBC"); - equal(cpu.p.v, 0, "0xd000 - 0xef00 should not set the overflow(v) bit "+ - "when using SBC"); - equal(cpu.p.z, 0, "0xd000 - 0xef00 should not set the zero(z) bit when "+ - "using SBC"); - equal(cpu.p.c, 0, "0xd000 - 0xef00 should not set the carry(c) bit when "+ - "using SBC"); + strictEqual(cpu.r.a, 0xe100, "0xd000 - 0xef00 should set the accumulator "+ + "to 0xe0ff when using SBC"); + strictEqual(cpu.p.n, 1, "0xd000 - 0xef00 should set the negative(n) bit "+ + "when using SBC"); + strictEqual(cpu.p.v, 0, "0xd000 - 0xef00 should not set the overflow(v) "+ + "bit when using SBC"); + strictEqual(cpu.p.z, 0, "0xd000 - 0xef00 should not set the zero(z) bit "+ + "when using SBC"); + strictEqual(cpu.p.c, 0, "0xd000 - 0xef00 should not set the carry(c) bit "+ + "when using SBC"); }); test("Test subtraction with decimal mode on with two single digit 8-bit "+ "numbers.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbf8a90938e905", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 4, "The accumulator should be 4 after subtracting 0x5 "+ - "0x9 with decimal mode on with 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ - "triggered."); - equal(cpu.p.m, 1, "The m flag of the p status register should be one "+ - "for 8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be zero for native mode."); + strictEqual(cpu.r.a, 4, "The accumulator should be 4 after subtracting "+ + "0x5 0x9 with decimal mode on with 8-bit memory/accumulator "+ + "mode."); + strictEqual(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ + "triggered."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be "+ + "one for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be zero for native mode."); }); test("Test subtraction with decimal mode on with two double digit 8-bit "+ "numbers.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbf8a99038e949", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x41, "The accumulator should be 41 after subtracting 0x49 "+ - "from 0x90 with decimal mode on with 8-bit "+ - "memory/accumulator mode."); - equal(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ - "triggered."); - equal(cpu.p.m, 1, "The m flag of the p status register should be one "+ - "for 8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be zero for native mode."); + strictEqual(cpu.r.a, 0x41, "The accumulator should be 0x41 after "+ + "subtracting 0x49 from 0x90 with decimal mode on with 8-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ + "triggered."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be "+ + "one for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be zero for native mode."); }); test("Test subtraction with decimal mode on with 8-bit numbers that causes "+ "a borrow.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbf8a91038e920", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x90, "The accumulator should be 0x90 after subtracting "+ - "0x20 from 0x10 with decimal and 8-bit "+ - "memory/accumulator modes."); - equal(cpu.p.c, 0, "The carry bit should be clear after a borrow is "+ - "triggered."); - equal(cpu.p.m, 1, "The m flag of the p status register should be one "+ - "for 8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be zero for native mode."); + strictEqual(cpu.r.a, 0x90, "The accumulator should be 0x90 after "+ + "subtracting 0x20 from 0x10 with decimal and 8-bit "+ + "memory/accumulator modes."); + strictEqual(cpu.p.c, 0, "The carry bit should be clear after a borrow is "+ + "triggered."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be "+ + "one for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be zero for native mode."); }); test("Test subtraction of two single digit 16-bit numbers with decimal "+ "mode set.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220f8a9050038e90200", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x03, "The accumulator should be 0x03 after subtracting "+ - "0x02 from 0x05 with decimal and 16-bit "+ - "memory/accumulator modes."); - equal(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ - "triggered."); - equal(cpu.p.m, 0, "The m flag of the p status register should be zero "+ - "for 16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be zero for native mode."); + strictEqual(cpu.r.a, 0x03, "The accumulator should be 0x03 after "+ + "subtracting 0x02 from 0x05 with decimal and 16-bit "+ + "memory/accumulator modes."); + strictEqual(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ + "triggered."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be "+ + "zero for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be zero for native mode."); }); test("Test subtraction of two four digit 16-bit numbers with decimal "+ "mode set.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220f8a9999938e91111", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x8888, "The accumulator should be 0x8888 after "+ - "subtracting 0x1111 from 0x9999 with decimal "+ - "and 16-bit memory/accumulator modes."); - equal(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ - "triggered."); - equal(cpu.p.m, 0, "The m flag of the p status register should be zero "+ - "for 16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be zero for native mode."); + strictEqual(cpu.r.a, 0x8888, "The accumulator should be 0x8888 after "+ + "subtracting 0x1111 from 0x9999 with decimal "+ + "and 16-bit memory/accumulator modes."); + strictEqual(cpu.p.c, 1, "The carry bit should be set after no borrow is "+ + "triggered."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be "+ + "zero for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be zero for native mode."); }); test("Test subtraction of two four digit 16-bit numbers with decimal "+ "mode set that causes a borrow.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc220f8a9111138e99999", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x1112, "The accumulator should be 0x1112 after "+ - "subtracting 0x9999 from 0x1111 with decimal "+ - "and 16-bit memory/accumulator modes."); - equal(cpu.p.c, 0, "The carry bit should be clear after a borrow is "+ - "triggered."); - equal(cpu.p.m, 0, "The m flag of the p status register should be zero "+ - "for 16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be zero for native mode."); + strictEqual(cpu.r.a, 0x1112, "The accumulator should be 0x1112 after "+ + "subtracting 0x9999 from 0x1111 with decimal and 16-bit "+ + "memory/accumulator modes."); + strictEqual(cpu.p.c, 0, "The carry bit should be clear after a borrow is "+ + "triggered."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be "+ + "zero for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be zero for native mode."); }); } @@ -881,32 +905,32 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18c230a90100690100", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 2, "0x0001 + 0x0001 should result in 0x0002 when using "+ - "ADC"); - equal(cpu.p.n, 0, "0x0001 + 0x0001 does not result in a negative "+ - "two's complement number when adding with ADC."); - equal(cpu.p.c, 0, "0x0001 + 0x0001 should not set the carry(c) bit when "+ - "adding with ADC"); - equal(cpu.p.z, 0, "0x0001 + 0x0001 should not set the zero(z) bit when "+ - "adding with ADC"); - equal(cpu.p.v, 0, "0x0001 + 0x0001 should not set the overflow(v) bit "+ - "when adding with ADC"); + strictEqual(cpu.r.a, 2, "0x0001 + 0x0001 should result in 0x0002 when "+ + "using ADC"); + strictEqual(cpu.p.n, 0, "0x0001 + 0x0001 does not result in a negative "+ + "two's complement number when adding with ADC."); + strictEqual(cpu.p.c, 0, "0x0001 + 0x0001 should not set the carry(c) "+ + "bit when adding with ADC"); + strictEqual(cpu.p.z, 0, "0x0001 + 0x0001 should not set the zero(z) bit "+ + "when adding with ADC"); + strictEqual(cpu.p.v, 0, "0x0001 + 0x0001 should not set the overflow(v) "+ + "bit when adding with ADC"); }); test("Test normal addition of two 8-bit numbers that don't cause an "+ "overflow (m bit is 1)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18e230a9016901", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 2, "0x01 + 0x01 should result in 0x02 when using "+ - "ADC"); - equal(cpu.p.n, 0, "0x01 + 0x01 does not result in a negative "+ - "two's complement number when adding with ADC."); - equal(cpu.p.c, 0, "0x01 + 0x01 should not set the carry(c) bit when "+ - "adding with ADC"); - equal(cpu.p.z, 0, "0x01 + 0x01 should not set the zero(z) bit when "+ - "adding with ADC"); - equal(cpu.p.v, 0, "0x01 + 0x01 should not set the overflow(v) bit "+ - "when adding with ADC"); + strictEqual(cpu.r.a, 2, "0x01 + 0x01 should result in 0x02 when using "+ + "ADC"); + strictEqual(cpu.p.n, 0, "0x01 + 0x01 does not result in a negative "+ + "two's complement number when adding with ADC."); + strictEqual(cpu.p.c, 0, "0x01 + 0x01 should not set the carry(c) bit "+ + "when adding with ADC"); + strictEqual(cpu.p.z, 0, "0x01 + 0x01 should not set the zero(z) bit when "+ + "adding with ADC"); + strictEqual(cpu.p.v, 0, "0x01 + 0x01 should not set the overflow(v) bit "+ + "when adding with ADC"); }); test("Test that overflow sets the carry flag and works in general with two"+ @@ -914,16 +938,16 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18c230a9ffff690100", 0x8000); cpu.execute(0x8000); - equal(cpu.p.c, 1, "0xffff + 0x0001 should set the carry bit when using "+ - "ADC"); - equal(cpu.r.a, 0, "0xffff + 0x0001 should result in the accumulator "+ - "being 0 when using ADC"); - equal(cpu.p.n, 0, "0xffff + 0x0001 should not set the negative(n) bit "+ - "when using ADC"); - equal(cpu.p.z, 1, "0xffff + 0x0001 should set the zero(z) bit when using "+ - "ADC"); - equal(cpu.p.v, 0, "0xffff + 0x0001 should not set the overflow(v) bit "+ - "when using ADC"); + strictEqual(cpu.p.c, 1, "0xffff + 0x0001 should set the carry bit when "+ + "using ADC"); + strictEqual(cpu.r.a, 0, "0xffff + 0x0001 should result in the accumulator "+ + "being 0 when using ADC"); + strictEqual(cpu.p.n, 0, "0xffff + 0x0001 should not set the negative(n) "+ + "bit when using ADC"); + strictEqual(cpu.p.z, 1, "0xffff + 0x0001 should set the zero(z) bit when "+ + "using ADC"); + strictEqual(cpu.p.v, 0, "0xffff + 0x0001 should not set the overflow(v) "+ + "bit when using ADC"); }); test("Test that overflow sets the carry flag and works in general with two"+ @@ -931,111 +955,111 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18e230a9ff6901", 0x8000); cpu.execute(0x8000); - equal(cpu.p.c, 1, "0xff + 0x01 should set the carry bit when using "+ - "ADC"); - equal(cpu.r.a, 0, "0xff + 0x01 should result in the accumulator "+ - "being 0 when using ADC"); - equal(cpu.p.n, 0, "0xff + 0x01 should not set the negative(n) bit when "+ - "using ADC"); - equal(cpu.p.z, 1, "0xff + 0x01 should set the zero(z) bit when using "+ - "ADC"); - equal(cpu.p.v, 0, "0xff + 0x01 should not set the overflow(v) bit when "+ - "using ADC"); + strictEqual(cpu.p.c, 1, "0xff + 0x01 should set the carry bit when using "+ + "ADC"); + strictEqual(cpu.r.a, 0, "0xff + 0x01 should result in the accumulator "+ + "being 0 when using ADC"); + strictEqual(cpu.p.n, 0, "0xff + 0x01 should not set the negative(n) bit "+ + "when using ADC"); + strictEqual(cpu.p.z, 1, "0xff + 0x01 should set the zero(z) bit when "+ + "using ADC"); + strictEqual(cpu.p.v, 0, "0xff + 0x01 should not set the overflow(v) bit "+ + "when using ADC"); }); test("Test signed overflow with two 8-bit numbers (m bit is 1)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18e230a97f6901", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ + "using ADC"); + strictEqual(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ + "using ADC"); + strictEqual(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ + "using ADC"); + strictEqual(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ + "using ADC"); + strictEqual(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ + "using ADC"); }); test("Test signed overflow with two 16-bit numbers (m bit is 0)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18c230a9ff7f690100", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 "+ + "when using ADC"); + strictEqual(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit "+ + "when using ADC"); + strictEqual(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit "+ + "when using ADC"); + strictEqual(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit "+ + "when using ADC"); + strictEqual(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit "+ + "when using ADC"); }); test("Test ADC direct page with 8-bit numbers (m bit is 1)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18e230a90185ffa97f65ff", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ + "using ADC"); + strictEqual(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ + "using ADC"); + strictEqual(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ + "using ADC"); + strictEqual(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ + "using ADC"); + strictEqual(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ + "using ADC"); }); test("Test ADC direct page with 16-bit numbers (m bit is 0)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18c230a9010085fea9ff7f65fe", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 "+ + "when using ADC"); + strictEqual(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit "+ + "when using ADC"); + strictEqual(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit "+ + "when using ADC"); + strictEqual(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit "+ + "when using ADC"); + strictEqual(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit "+ + "when using ADC"); }); test("Test ADC absolute with 8-bit numbers (m bit is 1)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18e230a9018dffffa97f6dffff", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ + "using ADC"); + strictEqual(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ + "using ADC"); + strictEqual(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ + "using ADC"); + strictEqual(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ + "using ADC"); + strictEqual(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ + "using ADC"); }); test("Test ADC absolute with 16-bit numbers (m bit is 0)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18c230a901008dffffa9ff7f6dffff", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 "+ + "when using ADC"); + strictEqual(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit "+ + "when using ADC"); + strictEqual(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit "+ + "when using ADC"); + strictEqual(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit "+ + "when using ADC"); + strictEqual(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit "+ + " when using ADC"); }); test("Test ADC direct page indirect with 8-bit numbers (m bit is 1)", @@ -1043,32 +1067,32 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18e230a90185ffa9ff85fd64fea97f72fd", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x80, "0x7f + 0x01 should result in 0x80 when "+ + "using ADC"); + strictEqual(cpu.p.v, 1, "0x7f + 0x01 should set the overflow(v) bit when "+ + "using ADC"); + strictEqual(cpu.p.c, 0, "0x7f + 0x01 should not set the carry(c) bit when "+ + "using ADC"); + strictEqual(cpu.p.z, 0, "0x7f + 0x01 should not set the zero(z) bit when "+ + "using ADC"); + strictEqual(cpu.p.n, 1, "0x7f + 0x01 should set the negative(n) bit when "+ + "using ADC"); }); test("Test ADC direct page indirect with 16-bit numbers (m bit is 0)", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18c230a901008500a9000085bba9ff7f72bb", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 when "+ - "using ADC"); - equal(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit when "+ - "using ADC"); - equal(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit when "+ - "using ADC"); - equal(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit when "+ - "using ADC"); - equal(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit when "+ - "using ADC"); + strictEqual(cpu.r.a, 0x8000, "0x7fff + 0x0001 should result in 0x8000 "+ + "when using ADC"); + strictEqual(cpu.p.v, 1, "0x7fff + 0x0001 should set the overflow(v) bit "+ + "when using ADC"); + strictEqual(cpu.p.c, 0, "0x7fff + 0x0001 should not set the carry(c) bit "+ + "when using ADC"); + strictEqual(cpu.p.z, 0, "0x7fff + 0x0001 should not set the zero(z) bit "+ + "when using ADC"); + strictEqual(cpu.p.n, 1, "0x7fff + 0x0001 should set the negative(n) bit "+ + "when using ADC"); }); test("Test that ADC handles decimal mode with legal BCD numbers in 8-bit "+ @@ -1076,32 +1100,32 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18f8a9056905", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x10, "0x05 + 0x05 should result in 0x10 with decimal "+ - "mode on and with 8-bit memory/accumulator mode."); - equal(cpu.p.c, 0, "The carry flag of the p status register should be "+ - "clear after no decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x10, "0x05 + 0x05 should result in 0x10 with "+ + "decimal mode on and with 8-bit memory/accumulator mode."); + strictEqual(cpu.p.c, 0, "The carry flag of the p status register should "+ + "be clear after no decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 8-bit "+ "memory/accumulator mode with double digit numbers.", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb18f8a9156926", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x41, "0x15 + 0x26 should result in 0x41 with decimal "+ - "mode on and with 8-bit memory/accumulator mode."); - equal(cpu.p.c, 0, "The carry flag of the p status register should be "+ - "clear after no decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x41, "0x15 + 0x26 should result in 0x41 with "+ + "decimal mode on and with 8-bit memory/accumulator mode."); + strictEqual(cpu.p.c, 0, "The carry flag of the p status register should "+ + "be clear after no decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 8-bit "+ "memory/accumulator mode with double digit numbers with the carry "+ @@ -1109,17 +1133,17 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb38f8a9156926", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x42, "0x15 + 0x26 should result in 0x42 with decimal "+ - "mode on and with 8-bit memory/accumulator mode "+ - "and the carry bit set."); - equal(cpu.p.c, 0, "The carry flag of the p status register should be "+ - "clear after no decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x42, "0x15 + 0x26 should result in 0x42 with "+ + "decimal mode on and with 8-bit memory/accumulator mode and "+ + "the carry bit set."); + strictEqual(cpu.p.c, 0, "The carry flag of the p status register should "+ + "be clear after no decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 8-bit "+ "memory/accumulator mode when adding two numbers that cause an "+ @@ -1127,16 +1151,16 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18f8a9556960", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x16, "0x55 + 0x60 should result in 0x16 with decimal "+ - "mode on and with 8-bit memory/accumulator mode."); - equal(cpu.p.c, 1, "The carry flag of the p status register should be "+ - "set after the decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 1, "The m flag of the p status register should be 1 for "+ - "8-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x16, "0x55 + 0x60 should result in 0x16 with "+ + "decimal mode on and with 8-bit memory/accumulator mode."); + strictEqual(cpu.p.c, 1, "The carry flag of the p status register should "+ + "be set after the decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 1, "The m flag of the p status register should be 1 "+ + "for 8-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 16-bit "+ "memory/accumulator mode when adding two single digit numbers.", @@ -1144,17 +1168,16 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18f8c220a90100690900", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x10, "0x0001 + 0x0009 should result in 0x0010 with "+ - "decimal mode on and with 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.c, 0, "The carry flag of the p status register should be "+ - "clear after no decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x10, "0x0001 + 0x0009 should result in 0x0010 with "+ + "decimal mode on and with 16-bit memory/accumulator mode."); + strictEqual(cpu.p.c, 0, "The carry flag of the p status register should "+ + "be clear after no decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 16-bit "+ "memory/accumulator mode when adding two four digit numbers.", @@ -1162,17 +1185,17 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18f8c220a90110699939", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x5000, "0x1001 + 0x3999 should result in 0x5000 with "+ - "decimal mode on and with 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.c, 0, "The carry flag of the p status register should be "+ - "clear after no decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x5000, "0x1001 + 0x3999 should result in 0x5000 "+ + "with decimal mode on and with 16-bit "+ + "memory/accumulator mode."); + strictEqual(cpu.p.c, 0, "The carry flag of the p status register should "+ + "be clear after no decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 16-bit "+ "memory/accumulator mode when adding two numbers that cause an "+ @@ -1180,17 +1203,17 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb18f8c220a99756699999", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x5697, "0x5697 + 0x9999 should result in 0x5697 with "+ - "decimal mode on and with 16-bit "+ - "memory/accumulator mode."); - equal(cpu.p.c, 1, "The carry flag of the p status register should be "+ - "set after decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x5697, "0x5697 + 0x9999 should result in 0x5697 "+ + "with decimal mode on and with 16-bit memory/accumulator "+ + "mode."); + strictEqual(cpu.p.c, 1, "The carry flag of the p status register should "+ + "be set after decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); test("Test that ADC handles decimal mode with legal BCD numbers in 16-bit "+ "memory/accumulator mode when adding two four digit numbers with the "+ @@ -1198,17 +1221,17 @@ function test_adc() { var cpu = new CPU_65816(); cpu.load_binary("18fb38f8c220a90110699939", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x5001, "0x1001 + 0x3999 should result in 0x5001 with "+ - "decimal mode on and with 16-bit "+ - "memory/accumulator mode and the carry flag set."); - equal(cpu.p.c, 0, "The carry flag of the p status register should be "+ - "clear after no decimal overflow."); - equal(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ - "register."); - equal(cpu.p.m, 0, "The m flag of the p status register should be 0 for "+ - "16-bit memory/accumulator mode."); - equal(cpu.p.e, 0, "The hidden e flag of the p status register should "+ - "be 0 for native mode."); + strictEqual(cpu.r.a, 0x5001, "0x1001 + 0x3999 should result in 0x5001 "+ + "with decimal mode on, with 16-bit "+ + "memory/accumulator mode and the carry flag set."); + strictEqual(cpu.p.c, 0, "The carry flag of the p status register should "+ + "be clear after no decimal overflow."); + strictEqual(cpu.p.d, 1, "Decimal mode should be set to 1 in the p status "+ + "register."); + strictEqual(cpu.p.m, 0, "The m flag of the p status register should be 0 "+ + "for 16-bit memory/accumulator mode."); + strictEqual(cpu.p.e, 0, "The hidden e flag of the p status register "+ + "should be 0 for native mode."); }); } @@ -1219,9 +1242,9 @@ function test_branching() { var cpu = new CPU_65816(); cpu.load_binary("8000", 0x8000); cpu.execute(0x8000); - equal(cpu.r.pc, 0x8003, "Make sure that the program counter isn't "+ - "incremented or decremented if BRA is given "+ - "0x00 as its argument."); + strictEqual(cpu.r.pc, 0x8003, "Make sure that the program counter isn't "+ + "incremented or decremented if BRA is given "+ + "0x00 as its argument."); }); test("Check that the branching operations properly treat the argument as "+ @@ -1230,33 +1253,31 @@ function test_branching() { // negative two's complement number 0xf0 = -16 cpu.load_binary("80f0", 0x8000); cpu.execute(0x8000); - equal(cpu.r.pc, (0x8003-16), "A branching operation when given a "+ - "negative two's complement number should "+ - "decrement the program counter by the "+ - "proper amount."); + strictEqual(cpu.r.pc, (0x8003-16), "A branching operation when given a "+ + "negative two's complement number should decrement the "+ + "program counter by the proper amount."); cpu.reset(); cpu.load_binary("8020", 0x8000); // positive two's complement number. cpu.execute(0x8000); - equal(cpu.r.pc, (0x8003+0x20), "A branching operation when given a "+ - "positive two's complement number should "+ - "increment the program counter by the "+ - "proper amount."); + strictEqual(cpu.r.pc, (0x8003+0x20), "A branching operation when given a "+ + "positive two's complement number should increment the "+ + "program counter by the proper amount."); }); test("Check that BPL works as expected", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc230a9fe7f1a10fd", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x8000, "Check that branching only occurs while the "+ - "number is a two's complement positive number."); + strictEqual(cpu.r.a, 0x8000, "Check that branching only occurs while the "+ + "number is a two's complement positive number."); }); test("Check that BMI works as expected", function() { var cpu = new CPU_65816(); cpu.load_binary("18fbc230a901803a30fd", 0x8000); cpu.execute(0x8000); - equal(cpu.r.a, 0x7fff, "Check that branching only occurs while the "+ - "number is a two's complement negative number."); + strictEqual(cpu.r.a, 0x7fff, "Check that branching only occurs while the "+ + "number is a two's complement negative number."); }); } @@ -1267,44 +1288,44 @@ function test_sep() { cpu.p.e = 0; cpu.load_binary("e230", 0x8000); cpu.execute(0x8000); - equal(cpu.p.m, 1, "'SEP #$30' should set the m status bit of the p "+ - "register to 1"); - equal(cpu.p.x, 1, "'SEP #$30' should set the x status bit of the p "+ - "register to 1"); - equal(cpu.p.n, 0, "'SEP #$30' should not set the n status bit of the p "+ - "register to 1."); - equal(cpu.p.c, 0, "'SEP #$30' should not set the c status bit of the p "+ - "register to 1."); - equal(cpu.p.z, 0, "'SEP #$30' should not set the z status bit of the p "+ - "register to 1."); - equal(cpu.p.d, 0, "'SEP #$30' should not set the d status bit of the p "+ - "register to 1."); - equal(cpu.p.v, 0, "'SEP #$30' should not set the v status bit of the p "+ - "register to 1."); - equal(cpu.p.i, 0, "'SEP #$30' should not set the i status bit of the p "+ - "register to 1."); + strictEqual(cpu.p.m, 1, "'SEP #$30' should set the m status bit of the p "+ + "register to 1"); + strictEqual(cpu.p.x, 1, "'SEP #$30' should set the x status bit of the p "+ + "register to 1"); + strictEqual(cpu.p.n, 0, "'SEP #$30' should not set the n status bit of "+ + "the p register to 1."); + strictEqual(cpu.p.c, 0, "'SEP #$30' should not set the c status bit of "+ + "the p register to 1."); + strictEqual(cpu.p.z, 0, "'SEP #$30' should not set the z status bit of "+ + "the p register to 1."); + strictEqual(cpu.p.d, 0, "'SEP #$30' should not set the d status bit of "+ + "the p register to 1."); + strictEqual(cpu.p.v, 0, "'SEP #$30' should not set the v status bit of "+ + "the p register to 1."); + strictEqual(cpu.p.i, 0, "'SEP #$30' should not set the i status bit of "+ + "the p register to 1."); }); test("Test 'SEP #$cf' not in emulation mode", function() { var cpu = new CPU_65816(); cpu.p.e = 0; cpu.load_binary("e2cf", 0x8000); cpu.execute(0x8000); - equal(cpu.p.m, 0, "'SEP #$cf' should not set the m status bit of the p "+ - "register to 1"); - equal(cpu.p.x, 0, "'SEP #$cf' should not set the x status bit of the p "+ - "register to 1"); - equal(cpu.p.n, 1, "'SEP #$cf' should set the n status bit of the p "+ - "register to 1."); - equal(cpu.p.c, 1, "'SEP #$cf' should set the c status bit of the p "+ - "register to 1."); - equal(cpu.p.z, 1, "'SEP #$cf' should set the z status bit of the p "+ - "register to 1."); - equal(cpu.p.d, 1, "'SEP #$cf' should set the d status bit of the p "+ - "register to 1."); - equal(cpu.p.v, 1, "'SEP #$cf' should set the v status bit of the p "+ - "register to 1."); - equal(cpu.p.i, 1, "'SEP #$cf' should set the i status bit of the p "+ - "register to 1."); + strictEqual(cpu.p.m, 0, "'SEP #$cf' should not set the m status bit of "+ + "the p register to 1"); + strictEqual(cpu.p.x, 0, "'SEP #$cf' should not set the x status bit of "+ + "the p register to 1"); + strictEqual(cpu.p.n, 1, "'SEP #$cf' should set the n status bit of the p "+ + "register to 1."); + strictEqual(cpu.p.c, 1, "'SEP #$cf' should set the c status bit of the p "+ + "register to 1."); + strictEqual(cpu.p.z, 1, "'SEP #$cf' should set the z status bit of the p "+ + "register to 1."); + strictEqual(cpu.p.d, 1, "'SEP #$cf' should set the d status bit of the p "+ + "register to 1."); + strictEqual(cpu.p.v, 1, "'SEP #$cf' should set the v status bit of the p "+ + "register to 1."); + strictEqual(cpu.p.i, 1, "'SEP #$cf' should set the i status bit of the p "+ + "register to 1."); }); } @@ -1324,22 +1345,22 @@ function test_rep() { cpu.p.z = 1; cpu.load_binary("c230", 0x8000); cpu.execute(0x8000); - equal(cpu.p.m, 0, "'REP #$30' should clear the m bit of the p status "+ - "register"); - equal(cpu.p.x, 0, "'REP #$30' should clear the x bit of the p status "+ - "register"); - equal(cpu.p.d, 1, "'REP #$30' should not clear the d bit of the p "+ - "status register"); - equal(cpu.p.i, 1, "'REP #$30' should not clear the i bit of the p "+ - "status register"); - equal(cpu.p.c, 1, "'REP #$30' should not clear the c bit of the p "+ - "status register"); - equal(cpu.p.z, 1, "'REP #$30' should not clear the z bit of the p "+ - "status register"); - equal(cpu.p.v, 1, "'REP #$30' should not clear the v bit of the p "+ - "status register"); - equal(cpu.p.n, 1, "'REP #$30' should not clear the n bit of the p "+ - "status register"); + strictEqual(cpu.p.m, 0, "'REP #$30' should clear the m bit of the p "+ + "status register"); + strictEqual(cpu.p.x, 0, "'REP #$30' should clear the x bit of the p "+ + "status register"); + strictEqual(cpu.p.d, 1, "'REP #$30' should not clear the d bit of the p "+ + "status register"); + strictEqual(cpu.p.i, 1, "'REP #$30' should not clear the i bit of the p "+ + "status register"); + strictEqual(cpu.p.c, 1, "'REP #$30' should not clear the c bit of the p "+ + "status register"); + strictEqual(cpu.p.z, 1, "'REP #$30' should not clear the z bit of the p "+ + "status register"); + strictEqual(cpu.p.v, 1, "'REP #$30' should not clear the v bit of the p "+ + "status register"); + strictEqual(cpu.p.n, 1, "'REP #$30' should not clear the n bit of the p "+ + "status register"); }); test("Test 'REP #$cf' not in emulation mode", function() { @@ -1356,22 +1377,22 @@ function test_rep() { cpu.p.z = 1; cpu.load_binary("c2cf", 0x8000); cpu.execute(0x8000); - equal(cpu.p.m, 1, "'REP #$cf' should not clear the m bit of the p "+ - "status register"); - equal(cpu.p.x, 1, "'REP #$cf' should not clear the x bit of the p "+ - "status register"); - equal(cpu.p.z, 0, "'REP #$cf' should clear the z bit of the p status "+ - "register"); - equal(cpu.p.n, 0, "'REP #$cf' should clear the n bit of the p status "+ - "register"); - equal(cpu.p.d, 0, "'REP #$cf' should clear the d bit of the p status "+ - "register"); - equal(cpu.p.v, 0, "'REP #$cf' should clear the v bit of the p status "+ - "register"); - equal(cpu.p.i, 0, "'REP #$cf' should clear the i bit of the p status "+ - "register"); - equal(cpu.p.c, 0, "'REP #$cf' should clear the c bit of the p status "+ - "register"); + strictEqual(cpu.p.m, 1, "'REP #$cf' should not clear the m bit of the p "+ + "status register"); + strictEqual(cpu.p.x, 1, "'REP #$cf' should not clear the x bit of the p "+ + "status register"); + strictEqual(cpu.p.z, 0, "'REP #$cf' should clear the z bit of the p "+ + "status register"); + strictEqual(cpu.p.n, 0, "'REP #$cf' should clear the n bit of the p "+ + "status register"); + strictEqual(cpu.p.d, 0, "'REP #$cf' should clear the d bit of the p "+ + "status register"); + strictEqual(cpu.p.v, 0, "'REP #$cf' should clear the v bit of the p "+ + "status register"); + strictEqual(cpu.p.i, 0, "'REP #$cf' should clear the i bit of the p "+ + "status register"); + strictEqual(cpu.p.c, 0, "'REP #$cf' should clear the c bit of the p "+ + "status register"); }); } @@ -1380,19 +1401,15 @@ function test_cpu_load_binary() { test("Make sure that load binary can work with hex strings", function() { var cpu = new CPU_65816(); cpu.load_binary("18fb", 0x8000); - equal(cpu.mmu.read_byte_long(0x8000, cpu.r.k), 0x18, - "$8000 should equal 0x18"); - equal(cpu.mmu.read_byte_long(0x8001, cpu.r.k), 0xfb, - "$8001 should equal 0xfb"); + strictEqual(cpu.mmu.read_byte_long(0x8000, cpu.r.k), 0x18); + strictEqual(cpu.mmu.read_byte_long(0x8001, cpu.r.k), 0xfb); }); test("Make sure that load_binary can work with arrays", function() { var cpu = new CPU_65816(); cpu.load_binary([0x18, 0xfb], 0x8000); - equal(cpu.mmu.read_byte_long(0x8000, cpu.r.k), 0x18, - "$8000 should equal 0x18"); - equal(cpu.mmu.read_byte_long(0x8001, cpu.r.k), 0xfb, - "$8001 should equal 0xfb"); + strictEqual(cpu.mmu.read_byte_long(0x8000, cpu.r.k), 0x18); + strictEqual(cpu.mmu.read_byte_long(0x8001, cpu.r.k), 0xfb); }); } @@ -1408,7 +1425,7 @@ function test_cpu_memory_mapped_io_devices() { cpu.mmu.add_memory_mapped_io_device(write_callback, null, 0, 1); cpu.load_binary("a9ff8501", 0x8000); cpu.execute(0x8000); - strictEqual(written_value, 0xff, "0xff should be the value received"); + strictEqual(written_value, 0xff); }); test("Make sure that memory mapped io devices can be read from properly", @@ -1421,7 +1438,7 @@ function test_cpu_memory_mapped_io_devices() { cpu.mmu.add_memory_mapped_io_device(null, read_callback, 0, 1); cpu.load_binary("a501", 0x8000); cpu.execute(0x8000); - strictEqual(cpu.r.a, read_value, "The accumulator should equal the value read from "+ - "the memory mapped io device, 0xee"); + strictEqual(cpu.r.a, read_value, "The accumulator should equal the value "+ + "read from the memory mapped io device, 0xee"); }); }