// SetFlags sets the processor status flags
//
// see page 51 for rule for register translation (16/8)
SetFlags sets the processor status flags

see page 51 for rule for register translation (16/8)
// SetFlags sets the processor status flags // // see page 51 for rule for register translation ( 16 / 8 )
func (cpu *CPU) SetFlags(flags byte) {
	cpu.C = (flags >> 0) & 1
	cpu.Z = (flags >> 1) & 1
	cpu.I = (flags >> 2) & 1
	cpu.D = (flags >> 3) & 1
	if cpu.E == 1 {
		cpu.X = 1 
		cpu.M = 1 
	} else {
		oldX := cpu.X
		oldM := cpu.M
		cpu.X = (flags >> 4) & 1
		cpu.M = (flags >> 5) & 1
		if oldX != cpu.X {
			cpu.ChangeRegisterSizes_X()
		}
		if oldM != cpu.M {
			cpu.ChangeRegisterSizes_M()
		}
	}
	cpu.V = (flags >> 6) & 1
	cpu.N = (flags >> 7) & 1
}
func ( cpu * CPU ) SetFlags ( flags byte ) { cpu . C = ( flags >> 0 ) & 1 cpu . Z = ( flags >> 1 ) & 1 cpu . I = ( flags >> 2 ) & 1 cpu . D = ( flags >> 3 ) & 1 if cpu . E == 1 { cpu . X = 1 cpu . M = 1 } else { oldX := cpu . X oldM := cpu . M cpu . X = ( flags >> 4 ) & 1 cpu . M = ( flags >> 5 ) & 1 if oldX != cpu . X { cpu . ChangeRegisterSizes_X ( ) } if oldM != cpu . M { cpu . ChangeRegisterSizes_M ( ) } } cpu . V = ( flags >> 6 ) & 1 cpu . N = ( flags >> 7 ) & 1 }
SetFlags sets the processor status flags
SetFlags sets the processor status flags
// maybe it should be changed to  // "no change if E==1" - X/M are forced when E 0->1