int A[5] = {-1, 0, 1, 2, 4}; int x; x = A[0] - A[1] + A[2] - A[3] + A[4];You will encounter the usual problem that there's no way to gracefully end a program in SSI-0. To handle that for now, add a STOP instruction to the SSI-0 ISA (with opcode 3 and no operands).
int* vec1; int* vec2; int N; int index; int result; result = 0; for (index=0; index<N; index++) { result += vec1[index]*vec2[N-1-index]; }Assume that when your program is loaded into memory, vec1 and vec2 are initialized to point at two integer vectors (arrays) of N elements each, and that the PC is initialized to 0.
Give your program in assembly language - you don't need to translate it into machine code. (Plus, you can use labels, which is an enormous help as you're developing the program!) Don't be too worried about the details of syntax - no machine will be running your program.