当前位置:天才代写 > Assembly代写 > C语言汇编程代写 | CS520 FALL 2019 | computer science科目

C语言汇编程代写 | CS520 FALL 2019 | computer science科目

2019-11-08 13:45 星期五 所属: Assembly代写 浏览:27

C语言汇编程代写 The goal of this assignment is to write a two-pass assembler for the assembly language for the vm520 virtual machine.

CS520 FALL 2019

PROGRAM 3

DUE DATE: OCT 16, 2019

Description

 The goal of this assignment is to write a two-pass assembler for the assembly language for the vm520 virtual machine.

 

Your work must be done in the context of our assembler “front-end” and conform to the interfaces I have defined for your code and our code to utilize to interact. The code base you are to work within is available in ~cs520/public/program3.

 

You must implement the following three functions:

 

  • initAssemble: This function will be called once at program start-up to allow you to initialize any data structures, such as the symbol
  • assemble: This function is called on both the first pass and the second pass for every line of the input that contains either a label definition or an instruction (or both). The first parameter to this function is the label being defined, if there is one. The second parameter contains the opcodeand operands for the instruction, if there is one. The details of how instructions are represented are contained in the file h.
  • betweenPasses: This function is called once, after the first pass completes and before the second pass begins. Its single parameter is the file pointer (FILE*) where you should write the output,the object file that will be written during the second pass. This function should return the count of the number of errors detected during the first pass. Our part of the code will not execute the second pass if errors were detected during the first pass. The goal for full credit on this assignment is to detect all errors during the first pass or the call to the betweenPasses 

 

Stubs for these three functions are present in assemble.c. All your code for this assignment should be placed in this single file. Do not edit any of the other distributed files!

 

Understand that a vm520 object file is not an ASCII file. You will want to use od to examine output files to be sure they are correct. I recommend using the flag -tx4 to show the file in hex as a sequence of 32-bit words, since an object file is a sequence of 32-bit words.

 

Points will be awarded for this assignment in the following manner:

 

  • 50 points: Determining addresses for labels in a correct input file. Have the function betweenPasses write the defined labels and their addresses to stdout, one label per lane, with the label name being first on the line, followed by one space and the address printed in decimal. The labels should be printed in ascending order of label names. You should implement the symbol table using the hash table you constructed for Lab
  • 15 points: Detecting all input errors (except errors concerning the importing or exporting of symbols), during the first pass or in the betweenPasses Call the function error (in message.c) to report all errors*. This function will ensure a common format for all error messages, including reporting the line number of theerror.
  • 25 points: Generating the object file for correct input
  • 10 points: Properly handling import and export directives, including detecting errors and generating entries in the insymbol and outsymbol sections of the output

 

Your program will be graded primarily by testing it for correct functionality. In addition, however, you may lose points if your program is not properly structured and documented. Decompose sub-problems appropriately into functions and do incremental testing. Leave your debugging output in your code, but disabled, when you do your final assignment submission.

 

You will only submit assemble.c and symtab.c. This, of course, means you should not edit any of the other distributed files.

 

 

 

*example of a .asm file with errors and the error messages printed by the assembler

C语言汇编程代写
C语言汇编程代写
C语言汇编程代写
C语言汇编程代写

 

最先出自天才代写 cs代写 作业代写 代写c
合作:幽灵代写

 

 


天才代写-代写联系方式