implemented most of the logic behind the cpu instructions but needs testing.