From 845adb0f58e41b4f33d0a78b4e2b408fe439d67a Mon Sep 17 00:00:00 2001 From: lux Date: Wed, 4 Oct 2017 16:23:55 +0200 Subject: [PATCH] rework spelling --- src/helper.h | 20 ++++++++++---------- src/main.c | 12 ++++++------ src/toy.c | 14 +++++++------- src/toy.h | 14 +++++++------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/helper.h b/src/helper.h index 0f416aa..becf472 100644 --- a/src/helper.h +++ b/src/helper.h @@ -2,27 +2,27 @@ #define DEBUG_H /** -* get2compl(): interprets the transfer value as tow's complement -* Return: tow's complement value between -32768 and 32767 +* get2compl(): interprets the transfer value as two's complement +* Return: two's complement value between -32768 and 32767 */ int32_t get2compl(uint16_t value); /** - * fprintBits(): interprets an integer value as a binary pattern.(little endian) - * if you pass the datatype and the address of an integer, - * the funktion will supply the binary representation. - * (give "stdout" as the last parameter for standard output, - * otherwise hand over a filepointer) + * fprintBits(): interprets an integer value as a binary pattern.(Little-Endian) + * if you transfer the datatype and the address of an integer, + * the function will supply the binary representation. + * (enter "stdout" as the last parameter for standard output, + * otherwise enter a file pointer) * Return: none */ void fprintBits(size_t const size, void const * const ptr, FILE *file_pointer); /** - * makeHexDump(): writes the RAM content to a textfile. - * if you pass true to base_2, binary code is written to the textfile, - * otherwise hexcode. + * makeHexDump(): writes the RAM content to a text file. + * if you enter true for base_2, binary code is written to the text file, + * otherwise hex code. * Return: none */ diff --git a/src/main.c b/src/main.c index 2a25fd2..166ac8a 100644 --- a/src/main.c +++ b/src/main.c @@ -17,9 +17,9 @@ int main(int argc, char *argv[]) uint16_t ir=0; //Instruction Register uint8_t op_code; //CPU Operation Code uint16_t pc = 0; //Program Counter - uint16_t data_addr=0; //Adress of the 2nd operand (1. is ACCU) + uint16_t data_addr=0; //Address of the 2nd operand (1. is ACCU) int quit='n'; //Helper for program-flow exit (not part of CPU) - bool run = true; //CPU halt and reset.(make better a coredamp befor) + bool run = true; //CPU halt and reset.(Nb: make a coredump beforehand) printf("\n+++++++++++++++++++++++++++++++++++++++++++++++\n+Boot: "CPU_TYPE " with %zu x %zu Bit RAM.+\n+++++++++++++++++++++++++++++++++++++++++++++++\n\n" @@ -27,13 +27,13 @@ int main(int argc, char *argv[]) if(initialise_ram(ram,argc,argv)==-1) return 1; /*load data from command line into RAM (-1 in case of error, - else number of correct read worts)*/ + else number of correctly read words)*/ while(run) { ir = ram[pc]; //get instruction from RAM op_code = get_opcode(ir); //determine the instruction form data_addr=get_data(ir); /*locate the 2nd operand - (ignord from OP_Code 8 to 15)*/ + (undefined for OP_Codes 8 to 15)*/ //handle user output printf("\ninstruction:\t"); fprintBits(sizeof(*ram), ram+pc,stdout); @@ -45,11 +45,11 @@ int main(int argc, char *argv[]) printf("\ninstruction result:\n"); //CPU control flow - if(execute(op_code,data_addr,ram)) //EXECUTE instruction, jump if ALU says + if(execute(op_code,data_addr,ram)) //EXECUTE instruction,jump on ALU pc=get_data(ir); else pc++; - if(pc>=RAM_SIZE) pc %= RAM_SIZE; //TOY_CPU can only address 12 Bit + if(pc>=RAM_SIZE) pc %= RAM_SIZE; //TOY_CPU can only address 12 bits //handle user output printf("ACCU: %d\n",get2compl(*ACCU)); diff --git a/src/toy.c b/src/toy.c index e601f6f..b66c425 100644 --- a/src/toy.c +++ b/src/toy.c @@ -32,10 +32,10 @@ void print_instructionSet(void) "\t| OP-CODE |\t\tADDRESS\t |\n" "\t---------------------------------------\n\n"); printf("This machine has the following registers:\n" - "16 BIT Instruction Register(4 BIT OP, 12 BIT Adr)\n" + "16 BIT Instruction Register(4 BIT OP, 12 BIT Addr)\n" "16 BIT Accumulator\n" "12 BIT Program Counter\n\n"); - printf("Example: 0001000000001010 on RAM position 0\n" + printf("Example: 0001000000001010 at RAM position 0\n" "0001 means: LOAD the content of ADDRESS 000000001010 into the ACCU\n\n"); printf("This is an interpreter for the Koopman_TOY_CPU by\n" "\tmichael.krause@uni-leipzig.de\n"); @@ -68,13 +68,13 @@ void print_instruction(uint8_t opcode) int initialise_ram(uint16_t *ram, int argc, char **argv ) { - //open and check the input stream + //opens and checks the input stream FILE *fp; int int_cache=0; size_t j=0; char tempS[CPU_WORD_SIZE+1]; //+1 for "\0 - for(size_t i=0;i