-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPU_6502_TXS.go
48 lines (36 loc) · 1.11 KB
/
CPU_6502_TXS.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package CPU_6502
import "fmt"
// TXS Transfer Index X to Stack Register
//
// X -> SP N Z C I D V
// - - - - - -
//
// addressing assembler opc bytes cyles
// --------------------------------------------
// implied TXS 9A 1 2
func opc_TXS(bytes uint16, opc_cycles byte) {
// Update Global Opc_cycles value
Opc_cycles = opc_cycles
// Print internal opcode cycle
debugInternalOpcCycle(opc_cycles)
// Just increment the Opcode cycle Counter
if Opc_cycle_count < opc_cycles {
Opc_cycle_count++
// After spending the cycles needed, execute the opcode
} else {
SP = X
// Print Opcode Debug Message
opc_TXS_DebugMsg(bytes)
// Increment PC
PC += bytes
// Reset Internal Opcode Cycle counters
resetIntOpcCycleCounters()
}
}
func opc_TXS_DebugMsg(bytes uint16) {
if Debug {
opc_string := debug_decode_opc(bytes)
dbg_show_message = fmt.Sprintf("\n\tOpcode %s [Mode: Implied]\tTXS Transfer Index X to Stack Pointer.\tSP = X (%d)\n", opc_string, SP)
fmt.Println(dbg_show_message)
}
}