function ADD(reg) { // ADD A, reg
		var temp = registers[0] + registers[reg]
		flags[2] = (((registers[0]&0xF) + (registers[reg]&0xF)))>>4
		flags[3] = temp>>8
		registers[0] = temp & 0xFF
		flags[0] = (registers[0] == 0)?1:0;
		flags[1] = 0;
	}
//Arithmetic (third quarter of instructions)
Arithmetic (third quarter of instructions)
Arithmetic ( third quarter of instructions )
function ADD(reg) { 
		var temp = registers[0] + registers[reg]
		flags[2] = (((registers[0]&0xF) + (registers[reg]&0xF)))>>4
		flags[3] = temp>>8
		registers[0] = temp & 0xFF
		flags[0] = (registers[0] == 0)?1:0;
		flags[1] = 0;
	}
function ADD ( reg ) { var temp = registers [ 0 ] + registers [ reg ] flags [ 2 ] = ( ( ( registers [ 0 ] & 0xF ) + ( registers [ reg ] & 0xF ) ) ) >> 4 flags [ 3 ] = temp >> 8 registers [ 0 ] = temp & 0xFF flags [ 0 ] = ( registers [ 0 ] == 0 ) ? 1 : 0 ; flags [ 1 ] = 0 ; }
Arithmetic (third quarter of instructions)
Arithmetic ( third quarter of instructions )
// ADD A, reg