Question
char line[1000]; //array holding every line of file Writing in c, an assembler that takes in assembly code and outputs in machine code. R-type code
char line[1000]; //array holding every line of file Writing in c, an assembler that takes in assembly code and outputs in machine code. R-type code is displayed here, based on this code, how would you create I-type (lw, sw, beq)?
if(strcmp(tok, "nand") == 0) { while(tok != NULL) { if(currentreg == 1) { destreg = atoi(tok); }//1 if(currentreg == 2) { registera = atoi(tok); }//2 if(currentreg == 3) { registerb = atoi(tok); }//3
tok = strtok(NULL, whitespace); currentreg = currentreg + 1; }//while
opcode = 0 << 22; registera = registera << 19; registerb = registerb << 16; finalnumber = opcode | registera | registerb | destreg; if(fflag) {fprintf(outputfile, "%i ", finalnumber);} else {printf("%i ", finalnumber);} }//nand
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started