From e1f827b446761bb3b427d36ad49a0125fb3c296b Mon Sep 17 00:00:00 2001 From: Preston Skupinski Date: Sat, 31 Dec 2011 19:41:24 -0500 Subject: [PATCH] use cpu_lib.addressing.Absolute_indexed_x for LDY_absolute_indexed_x --- cpu.js | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/cpu.js b/cpu.js index 6318ab0..8c214e0 100755 --- a/cpu.js +++ b/cpu.js @@ -2969,34 +2969,11 @@ var LDY_const = { } }; -var LDY_absolute_indexed_x = { - bytes_required:function() { - return 3; - }, - execute:function(cpu, bytes) { - cpu.cycle_count+=4; - - var original_location = (bytes[1]<<8)|bytes[0], - memory_location = original_location + cpu.r.x; - - if((original_location&0xff00)!==(memory_location&0xff00)) - cpu.cycle_count++; - - if(cpu.p.e||cpu.p.x) { - cpu.r.y = cpu.mmu.read_byte(memory_location); - cpu.p.n = cpu.r.y >> 7; - } else { - cpu.cycle_count++; - - cpu.r.y = cpu.mmu.read_word(memory_location); - cpu.p.n = cpu.r.y >> 15; - } - cpu_lib.r.p.check_z(cpu, cpu.r.y); - } -}; - var LDY_absolute = new cpu_lib.addressing.Absolute(LDY_const); +var LDY_absolute_indexed_x = + new cpu_lib.addressing.Absolute_indexed_x(LDY_absolute); + var LDY_direct_page = new cpu_lib.addressing.Direct_page(LDY_const); var LDY_direct_page_indexed_x =