12 void Computer::executeSLA(
const InstructionWord& instruction) {
13 int32_t address = getIndexedAddress(instruction);
14 int32_t shift = (address + 10000) % 5;
16 for (
int i = 1; i <= (5 - shift); ++i) {
17 rA[i] =
rA[i + shift];
19 for (
int i = 6 - shift; i <=5; ++i) {
26 void Computer::executeSRA(
const InstructionWord& instruction) {
27 int32_t address = getIndexedAddress(instruction);
28 int32_t shift = (address + 10000) % 5;
30 for (
int i = 5; i > shift; --i) {
31 rA[i] =
rA[i - shift];
33 for (
int i = shift; i > 0; --i) {
40 void Computer::executeSLAX(
const InstructionWord& instruction) {
41 int32_t address = getIndexedAddress(instruction);
42 int32_t shift = (address + 10000) % 10;
44 for (
int i = 1; i <= (10 - shift); ++i) {
45 setAX(i, getAX(i + shift));
47 for (
int i = 11 - shift; i <= 10; ++i) {
54 void Computer::executeSRAX(
const InstructionWord& instruction) {
55 int32_t address = getIndexedAddress(instruction);
56 int32_t shift = (address + 10000) % 10;
58 for (
int i = 10; i > shift; --i) {
59 setAX(i, getAX(i - shift));
61 for (
int i = shift; i > 0; --i) {
68 void Computer::executeSLC(
const InstructionWord& instruction) {
69 int32_t address = getIndexedAddress(instruction);
70 int32_t shift = (address + 10000) % 10;
72 auto swap = [&](
int start,
int stop) {
73 int mid = start + (stop - start) / 2;
74 for (
int i = start; i < mid; ++i) {
75 int oppsite = stop - 1 - (i - start);
76 uint8_t temp = getAX(i);
77 setAX(i, getAX(oppsite));
88 void Computer::executeSRC(
const InstructionWord& instruction) {
89 int32_t address = getIndexedAddress(instruction);
90 int32_t shift = (address + 10000) % 10;
92 auto swap = [&](
int start,
int stop) {
93 int mid = start + (stop - start) / 2;
94 for (
int i = start; i < mid; ++i) {
95 int oppsite = stop - 1 - (i - start);
96 uint8_t temp = getAX(i);
97 setAX(i, getAX(oppsite));
102 swap(11 - shift, 11);
112 void Computer::executeMOVE(
const InstructionWord& instruction) {
113 int32_t originAddress = getIndexedAddress(instruction);
114 int32_t targetAddress =
rI1.
value();
115 uint8_t amount = instruction.field();
116 for (uint8_t i = 0; i < amount; ++i) {
117 int32_t target = targetAddress + i;
118 int32_t origin = originAddress + i;
124 rI1.
set(targetAddress + amount);