mirror of
https://github.com/trudnai/Steve2.git
synced 2024-12-22 06:29:15 +00:00
80d6190fa1
- Some fine tunings - Stack PUSH/POP address fix - DispatchWorkItem to be able to kill emulator thread
91 lines
2.4 KiB
C
91 lines
2.4 KiB
C
//
|
|
// main.c
|
|
// 6502
|
|
//
|
|
// Created by Tamas Rudnai on 7/14/19.
|
|
// Copyright © 2019 GameAlloy. All rights reserved.
|
|
//
|
|
|
|
#ifndef __6502_INSTR_COMPARE_TEST_H__
|
|
#define __6502_INSTR_COMPARE_TEST_H__
|
|
|
|
/**
|
|
BIT Test Bits in Memory with Accumulator
|
|
|
|
bits 7 and 6 of operand are transfered to bit 7 and 6 of SR (N,V);
|
|
the zeroflag is set to the result of operand AND accumulator.
|
|
|
|
A AND M, M7 -> N, M6 -> V N Z C I D V
|
|
M7 + - - - M6
|
|
|
|
addressing assembler opc bytes cyles
|
|
--------------------------------------------
|
|
zeropage BIT oper 24 2 3
|
|
absolute BIT oper 2C 3 4
|
|
|
|
**/
|
|
static inline void BIT( uint8_t imm ) {
|
|
dbgPrintf("BIT(%02X) ", imm);
|
|
set_flags_NV(imm);
|
|
set_flags_Z(m6502.A & imm);
|
|
}
|
|
|
|
/**
|
|
CMP Compare Memory with Accumulator
|
|
|
|
A - M N Z C I D V
|
|
+ + + - - -
|
|
|
|
addressing assembler opc bytes cyles
|
|
--------------------------------------------
|
|
immidiate CMP #oper C9 2 2
|
|
zeropage CMP oper C5 2 3
|
|
zeropage,X CMP oper,X D5 2 4
|
|
absolute CMP oper CD 3 4
|
|
absolute,X CMP oper,X DD 3 4*
|
|
absolute,Y CMP oper,Y D9 3 4*
|
|
(indirect,X) CMP (oper,X) C1 2 6
|
|
(indirect),Y CMP (oper),Y D1 2 5*
|
|
**/
|
|
static inline void CMP( uint8_t imm ) {
|
|
dbgPrintf("CMP(%02X) ", imm);
|
|
set_flags_NZC( (int)m6502.A - imm );
|
|
}
|
|
|
|
/**
|
|
CPX Compare Memory and Index X
|
|
|
|
X - M N Z C I D V
|
|
+ + + - - -
|
|
|
|
addressing assembler opc bytes cyles
|
|
--------------------------------------------
|
|
immidiate CPX #oper E0 2 2
|
|
zeropage CPX oper E4 2 3
|
|
absolute CPX oper EC 3 4
|
|
**/
|
|
static inline void CPX( uint8_t imm ) {
|
|
dbgPrintf("CPX(%02X) ", imm);
|
|
set_flags_NZC( (int)m6502.X - imm );
|
|
}
|
|
|
|
/**
|
|
CPY Compare Memory and Index Y
|
|
|
|
Y - M N Z C I D V
|
|
+ + + - - -
|
|
|
|
addressing assembler opc bytes cyles
|
|
--------------------------------------------
|
|
immidiate CPY #oper C0 2 2
|
|
zeropage CPY oper C4 2 3
|
|
absolute CPY oper CC 3 4
|
|
**/
|
|
static inline void CPY( uint8_t imm ) {
|
|
dbgPrintf("CPY(%02X) ", imm);
|
|
set_flags_NZC( (int)m6502.Y - imm );
|
|
}
|
|
|
|
#endif // __6502_INSTR_COMPARE_TEST_H__
|
|
|