diff --git a/Code.update.txt b/Code.update.txt new file mode 100644 index 0000000..0467b19 --- /dev/null +++ b/Code.update.txt @@ -0,0 +1,40 @@ +#include +#include + +int main(int argc, char *argv[]) +{ FILE *fp, *fp1 ; + int i ; + unsigned char buf [256] ; //this will hold contents of a page + unsigned short int Addresses[512] ; //these are the randomly generated logical //addresses //against which you will run your code + unsigned short int Current ; //current logical address generated by "CPU" + + srand(9) ; // all get same addresses + + for(i = 0; i < 512 ; i++) //generate/print addresses. Print not necessary + { + Addresses[i] = rand() % 65535 ; + printf("Address is %u \n", Addresses[i]) ; + } + + //declare RAM and init to 0s + + unsigned char RAM [64][256] = { [0 ... 63] = { [0 ... 255] = 0 } }; + + // initialize contents of page + + for (i = 0 ; i < 256 ; i++) + buf[i] = (unsigned char) i ; + + // fill in backing store ('disk'), implemented as a binary external file, with 256 pages + + fp = fopen("Back.bin", "wb") ; + for (i = 0; i < 256 ; i++) + fwrite(buf,256, 1, fp) ; + + fclose(fp) ; + fp = fopen("Back.bin", "rb") ; + + // do your thing!! + + for(i = 0 ; i < 512 ; i++) + { Current = Addresses[I] ; //rest of program diff --git a/HW4.Post.pdf b/HW4.Post.pdf new file mode 100644 index 0000000..6a124df Binary files /dev/null and b/HW4.Post.pdf differ diff --git a/Requirements.Expectations.pdf b/Requirements.Expectations.pdf new file mode 100644 index 0000000..95dd0d4 Binary files /dev/null and b/Requirements.Expectations.pdf differ diff --git a/required program output.pdf b/required program output.pdf new file mode 100644 index 0000000..b3b4d25 Binary files /dev/null and b/required program output.pdf differ