@@ -295,25 +295,30 @@ private void LoadKnownInstructions()
295
295
RegisterKnownInstruction ( 0xFC , GenericInst ( Hardware . OpCodes . JSR , Hardware . AddressingModes . Absolute , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I2 ) ) ;
296
296
297
297
// LDA
298
- RegisterKnownInstruction ( 0xA1 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndexedIndirect , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
299
- RegisterKnownInstruction ( 0xA3 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . StackRelative , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
300
- RegisterKnownInstruction ( 0xA5 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . Direct , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
301
- RegisterKnownInstruction ( 0xA7 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirectLong , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
302
- RegisterKnownInstruction ( 0xA9 , GenericInstCustom ( OpCodes . LDA , AddressingModes . ImmediateMemoryFlag , ( sender , p1 , p2 ) => { CPU_LoadInto ( ref CPU . ACC , p1 ) ; } ,
298
+ Action < Instruction , int , int > operation_LDA = ( Instruction sender , int p1 , int p2 ) =>
299
+ {
300
+ CPU_LoadInto ( ref cpu . ACC , sender . ResolveArgument ( p1 ) ) ;
301
+ } ;
302
+
303
+ RegisterKnownInstruction ( 0xA1 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndexedIndirect , operation_LDA , ArgumentType . I1 ) ) ;
304
+ RegisterKnownInstruction ( 0xA3 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . StackRelative , operation_LDA , ArgumentType . I1 ) ) ;
305
+ RegisterKnownInstruction ( 0xA5 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . Direct , operation_LDA , ArgumentType . I1 ) ) ;
306
+ RegisterKnownInstruction ( 0xA7 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirectLong , operation_LDA , ArgumentType . I1 ) ) ;
307
+ RegisterKnownInstruction ( 0xA9 , GenericInstCustom ( OpCodes . LDA , AddressingModes . ImmediateMemoryFlag , operation_LDA ,
303
308
( GenericInstruction . DecodeArgumentsFunctionDelegate ) delegate ( GenericInstruction sender , Memory . MemoryBin bin , ref InstructionDecodeContext context , ref int offset , ref int p1 , ref int p2 )
304
309
{
305
310
p1 = sender . DecodeI1I2ArgumentForMFlag ( bin , ref offset , ref context ) ;
306
311
} ) ) ;
307
- RegisterKnownInstruction ( 0xAD , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . Absolute , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I2 ) ) ;
308
- RegisterKnownInstruction ( 0xAF , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteLong , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I3 ) ) ;
309
- RegisterKnownInstruction ( 0xB1 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirectIndexed , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
310
- RegisterKnownInstruction ( 0xB2 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirect , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
311
- RegisterKnownInstruction ( 0xB3 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . StackRelativeIndirectIndexed , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
312
- RegisterKnownInstruction ( 0xB5 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndexedX , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
313
- RegisterKnownInstruction ( 0xB7 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirectIndexedLong , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
314
- RegisterKnownInstruction ( 0xB9 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteIndexedY , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I2 ) ) ;
315
- RegisterKnownInstruction ( 0xBD , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteIndexedX , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I2 ) ) ;
316
- RegisterKnownInstruction ( 0xBF , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteIndexedLong , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I3 ) ) ;
312
+ RegisterKnownInstruction ( 0xAD , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . Absolute , operation_LDA , ArgumentType . I2 ) ) ;
313
+ RegisterKnownInstruction ( 0xAF , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteLong , operation_LDA , ArgumentType . I3 ) ) ;
314
+ RegisterKnownInstruction ( 0xB1 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirectIndexed , operation_LDA , ArgumentType . I1 ) ) ;
315
+ RegisterKnownInstruction ( 0xB2 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirect , operation_LDA , ArgumentType . I1 ) ) ;
316
+ RegisterKnownInstruction ( 0xB3 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . StackRelativeIndirectIndexed , operation_LDA , ArgumentType . I1 ) ) ;
317
+ RegisterKnownInstruction ( 0xB5 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndexedX , operation_LDA , ArgumentType . I1 ) ) ;
318
+ RegisterKnownInstruction ( 0xB7 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . DirectIndirectIndexedLong , operation_LDA , ArgumentType . I1 ) ) ;
319
+ RegisterKnownInstruction ( 0xB9 , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteIndexedY , operation_LDA , ArgumentType . I2 ) ) ;
320
+ RegisterKnownInstruction ( 0xBD , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteIndexedX , operation_LDA , ArgumentType . I2 ) ) ;
321
+ RegisterKnownInstruction ( 0xBF , GenericInst ( Hardware . OpCodes . LDA , Hardware . AddressingModes . AbsoluteIndexedLong , operation_LDA , ArgumentType . I3 ) ) ;
317
322
318
323
// LDX
319
324
RegisterKnownInstruction ( 0xA2 , GenericInstCustom ( Hardware . OpCodes . LDX , Hardware . AddressingModes . ImmediateMemoryFlag , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } ,
@@ -349,7 +354,7 @@ private void LoadKnownInstructions()
349
354
RegisterKnownInstruction ( 0x44 , GenericInst ( Hardware . OpCodes . MVP , Hardware . AddressingModes . BlockMove , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 , ArgumentType . I1 ) ) ;
350
355
351
356
// NOP
352
- RegisterKnownInstruction ( 0xEA , new InstructionNOP ( cpu ) ) ;
357
+ RegisterKnownInstruction ( 0xEA , GenericInst ( Hardware . OpCodes . NOP , AddressingModes . Implied , ( sender , p1 , p2 ) => { } ) ) ;
353
358
354
359
// ORA
355
360
RegisterKnownInstruction ( 0x01 , GenericInst ( Hardware . OpCodes . ORA , Hardware . AddressingModes . DirectIndexedIndirect , ( sender , p1 , p2 ) => { throw new NotImplementedException ( ) ; } , ArgumentType . I1 ) ) ;
@@ -537,7 +542,12 @@ private void LoadKnownInstructions()
537
542
RegisterKnownInstruction ( 0x42 , new InstructionWDM ( cpu ) ) ;
538
543
539
544
// XBA
540
- RegisterKnownInstruction ( 0xeb , new InstructionXBA ( cpu ) ) ;
545
+ RegisterKnownInstruction ( 0xeb , GenericInst ( Hardware . OpCodes . XBA , AddressingModes . Implied , ( sender , p1 , p2 ) =>
546
+ {
547
+ var b_value = cpu . B ;
548
+ cpu . B = cpu . ACC ;
549
+ CPU_LoadInto ( ref cpu . ACC , b_value ) ;
550
+ } ) ) ;
541
551
542
552
// XCE
543
553
RegisterKnownInstruction ( 0xfb , new InstructionXCE ( cpu ) ) ;
0 commit comments