2019-07-30 08:05:21 +00:00
|
|
|
//
|
|
|
|
// main.c
|
|
|
|
// 6502
|
|
|
|
//
|
|
|
|
// Created by Tamas Rudnai on 7/14/19.
|
|
|
|
// Copyright © 2019 GameAlloy. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef __6502_INSTR_TRANSFER_H__
|
|
|
|
#define __6502_INSTR_TRANSFER_H__
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
TAX Transfer Accumulator to Index X
|
|
|
|
|
|
|
|
A -> X N Z C I D V
|
2019-09-10 07:00:00 +00:00
|
|
|
+ + - - - -
|
2019-07-30 08:05:21 +00:00
|
|
|
|
|
|
|
addressing assembler opc bytes cyles
|
|
|
|
--------------------------------------------
|
|
|
|
implied TAX AA 1 2
|
|
|
|
**/
|
2019-09-15 11:02:22 +00:00
|
|
|
INLINE void TAX() {
|
|
|
|
dbgPrintf("TAX(%02X) ", m6502.A);
|
2019-09-22 08:31:09 +00:00
|
|
|
disPrintf(disassembly.inst, "TAX");
|
2019-09-12 01:36:30 +00:00
|
|
|
set_flags_NZ(m6502.X = m6502.A);
|
2019-07-30 08:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
TXA Transfer Index X to Accumulator
|
|
|
|
|
|
|
|
X -> A N Z C I D V
|
2019-09-10 07:00:00 +00:00
|
|
|
+ + - - - -
|
2019-07-30 08:05:21 +00:00
|
|
|
|
|
|
|
addressing assembler opc bytes cyles
|
|
|
|
--------------------------------------------
|
|
|
|
implied TXA 8A 1 2
|
|
|
|
**/
|
2019-09-15 11:02:22 +00:00
|
|
|
INLINE void TXA() {
|
|
|
|
dbgPrintf("TXA(%02X) ", m6502.X);
|
2019-09-22 08:31:09 +00:00
|
|
|
disPrintf(disassembly.inst, "TXA");
|
2019-09-12 01:36:30 +00:00
|
|
|
set_flags_NZ(m6502.A = m6502.X);
|
2019-07-30 08:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
TAY Transfer Accumulator to Index Y
|
|
|
|
|
|
|
|
A -> Y N Z C I D V
|
2019-09-10 07:00:00 +00:00
|
|
|
+ + - - - -
|
2019-07-30 08:05:21 +00:00
|
|
|
|
|
|
|
addressing assembler opc bytes cyles
|
|
|
|
--------------------------------------------
|
|
|
|
implied TAY A8 1 2
|
|
|
|
**/
|
2019-09-15 11:02:22 +00:00
|
|
|
INLINE void TAY() {
|
2019-07-30 08:05:21 +00:00
|
|
|
dbgPrintf("TAY ");
|
2019-09-22 08:31:09 +00:00
|
|
|
disPrintf(disassembly.inst, "TAY");
|
2019-09-12 01:36:30 +00:00
|
|
|
set_flags_NZ(m6502.Y = m6502.A);
|
2019-07-30 08:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
TYA Transfer Index Y to Accumulator
|
|
|
|
|
|
|
|
Y -> A N Z C I D V
|
2019-09-10 07:00:00 +00:00
|
|
|
+ + - - - -
|
2019-07-30 08:05:21 +00:00
|
|
|
|
|
|
|
addressing assembler opc bytes cyles
|
|
|
|
--------------------------------------------
|
|
|
|
implied TYA 98 1 2
|
|
|
|
**/
|
2019-09-15 11:02:22 +00:00
|
|
|
INLINE void TYA() {
|
|
|
|
dbgPrintf("TYA(%02X) ", m6502.Y);
|
2019-09-22 08:31:09 +00:00
|
|
|
disPrintf(disassembly.inst, "TYA");
|
2019-09-12 01:36:30 +00:00
|
|
|
set_flags_NZ(m6502.A = m6502.Y);
|
2019-07-30 08:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
TSX Transfer Stack Pointer to Index X
|
|
|
|
|
|
|
|
SP -> X N Z C I D V
|
2019-09-10 07:00:00 +00:00
|
|
|
+ + - - - -
|
2019-07-30 08:05:21 +00:00
|
|
|
|
|
|
|
addressing assembler opc bytes cyles
|
|
|
|
--------------------------------------------
|
|
|
|
implied TSX BA 1 2
|
|
|
|
**/
|
2019-09-15 11:02:22 +00:00
|
|
|
INLINE void TSX() {
|
|
|
|
dbgPrintf("TSX(%02X) ", m6502.SP);
|
2019-09-22 08:31:09 +00:00
|
|
|
disPrintf(disassembly.inst, "TSX");
|
2019-09-15 11:02:22 +00:00
|
|
|
set_flags_NZ(m6502.X = m6502.SP);
|
2019-07-30 08:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
TXS Transfer Index X to Stack Register
|
|
|
|
|
|
|
|
X -> SP N Z C I D V
|
2019-09-10 07:00:00 +00:00
|
|
|
- - - - - -
|
2019-07-30 08:05:21 +00:00
|
|
|
|
|
|
|
addressing assembler opc bytes cyles
|
|
|
|
--------------------------------------------
|
|
|
|
implied TXS 9A 1 2
|
|
|
|
**/
|
2019-09-15 11:02:22 +00:00
|
|
|
INLINE void TXS() {
|
|
|
|
dbgPrintf("TXS(%02X) ", m6502.X);
|
2019-09-22 08:31:09 +00:00
|
|
|
disPrintf(disassembly.inst, "TXS");
|
2019-09-15 11:02:22 +00:00
|
|
|
m6502.SP = m6502.X;
|
2019-07-30 08:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __6502_INSTR_TRANSFER_H__
|
|
|
|
|