代写MCD4700 Introduction to Computer Systems, Networks and Security – T1 2025 Assignment 2帮做R语言

- 首页 >> C/C++编程

MCD4700 Introduction to Computer Systems, Networks and Security - T1 2025

Assignment 2 - Processes and MARIE Programming_Instruction

Purpose

Processes and programs are what makes computers do what we want them to do. In the first part of this assignment, students will investigate the processes running on their computers. The second part is about programming in MARIE assembly language. This will allow students to demonstrate their comprehension of the

fundamental way a processor works.

The assignment relates to Unit Learning Outcomes 2, 3 and 4.

Your task

For part 1, you will write a short report describing the processes that are running on your computer.

For part 2, you will implement a simple game in the MARIE assembly language.

Value

20% of your total marks for the unit

The assignment is marked out of 100 marks.

Word Limit

See individual instructions

Due Date

11:55 pm Friday 11 April 2025 (Week7)

Submission

●   Via Moodle Assignment Submission.

●   Turnitin will be used for similarity checking of all submissions.

●   This is an individual assignment (group work is not permitted).

Handwritten work is not accepted. docx for the written tasks.

MARIE files for the second part

DRAFT submission is not assessed.

●   You will need to explain your code in an interview.

Assessment Criteria

Part 1 is assessed based on correctness and completeness of the descriptions. Part 2 is assessed based on correctness of the code, documentation/comments, and test cases.

See instructions for details.

1.  Processes                                                                                   (15 marks)

Calculate the turnaround time for the following processes and subsequently calculate their average turnaround time

Process

Processing Time

P1

3

P2

5

P3

6

P4

2

P5

7

P6

1

P7

4

P8

2

a-   In FCFS first-come first-served

Process

Processing Time

turnaround time

b-   In SJF shortest job first

Process

Processing Time

turnaround time

c-   In Round Robin with slice time=3

Process

Processing Time

turnaround time

Time

step

2.  MARIE (65 marks)

In this task you will develop a MARIE application that performs some manipulation of characters, strings and numbers. We will break it down into small steps for you. Most of the tasks require you to write code and test cases. The code must contain proper comments and well indented. You submit it as .mas files together with the rest of your assignment. The test cases should also be working, self-contained MARIE assembly files (without requiring much input from the user).

In-Class interviews: You will be required to demonstrate your code to your tutor after the submission deadIine. FaiIure to demonstrate wiII Iead to “zero marks” being awarded to the

entire programming part of this assignment.

Background - Lists of data

This section introduces the concepts you need for the rest of the assignment. A string is a sequence of characters. It,s the basic data structure for storing text in a computer. There are several different ways of representing a string in memory and how to deal with strings of arbitrary length.

For this assignment, we will use the following string representation:

●   A string is represented in contiguous memory locations, with each address containing one character.

●   The characters are encoded using the ASCII encoding.

●    End of a string is marked by the ASCII character 6., (i.e. dot or fuII-stop).

●   A string can be of any arbitrary Iength, and wiII be terminated by a ,.,, and it may contain any of the following: alphabets (A-Z, a-z), numbers (0-9), ASCII Space Character (Hex 020) and New Line (Hex 00A).

Here  is  an  exampIe.  A  string  “Dong  Satria.”    wiII  be  represented  in  memory  (written  as hexadecimal numbers):

044

06F

06E

067

020

053

061

074

072

069

061

02E

D

o

n

g

S

a

t

r

i

a

.

Note that, in the above example, for a string with 10 characters, we need (10+2) words of MARIE memory in order to store all the characters beIonging to that string (incIuding a space and a 6., characters).

In MARIE assembly language programming, we can make use of the ADR command, the HEX keyword and a label “myString” to put this string into memory:

myStringAddr,   ADR  myString

myString,      HEX 044    /’D’

HEX 06F    /’o’

HEX 06E    /’n’

HEX 067    /’g’

HEX 020    /Space

HEX 053    /’S’

HEX 061    /’a’

HEX 074    /’t’

HEX 072    /’r’

HEX 069    /’i’

HEX 061    /’a’

HEX 02E    /’.’

2.1.    Your name as a MARIE string                                             (5 marks)

The following example of a MARIE string “myString” encodes a name and an ID using ASCII characters. The “name” is separated from the ID by an ASCII character “Hex 00A” (New Line).

Different parts of a name are separated by another ASCII character “Hex 020” (Space). And the entire string, consisting of a name and an ID, is terminated by a dot ‘ .’ character.

Please see the example below. The label “myStringAddr” holds the address of the first character of the string. You need to follow this MARIE string while solving the task given below.

Prepare a MARIE program to encode a string that includes your full name (first name and last name) and your student ID using ASCII characters. Following the above example, you need to use two IabeIs, one IabeI (e.g. “myString”) to store the first character of the string, and another IabeI (e.g. “myStringAddr”) to store the address of the first character of the same string.

You need to submit a MARIE file that contains codes, using the ADR command and HEX keywords (like the above example), so that after assembling, your name, ID and the address (of the first character of the string) is stored in MARIE memory. The codes must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate).

2.2.     Printing string                                                                       (10 marks)

Prepare a MARIE program that can print the ASCII 6., terminated string of your name and your student ID that you have impIemented in task 2.1. You may use the “Output” instruction to print characters in the MARIE output space. The program should be able to print any string that terminated with 6.,.

Hint: In your program, you need to use a label “myString” that holds the start address of the string (like, myStringAddr) that you want to print. Then, you should load a character from the address “myString” , print the character, then increment the address by one, and keep doing that up to the character Ioaded from the address is a 6., (which signaIs the end of the string). The output may look similar to the output below. The codes must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate).

Inside the Memory

Dong Satria

21839900

Figure 1: Print your name and ID

2.3 Subroutine to Display Digits                                                           (25 marks)

Before reading this section, you should familiarize yourself with bit-mapped displays. Please refer toAppendix Afor more information.

Your task is to prepare a MARIE program that includes a subroutine named displayDigits. This subroutine will accept a hexadecimal value between 0 and FFFF as input. Based on the    input value, the subroutine should paint pixels in the graphics memory with the corresponding   colour to represent the last four digits of your student ID.

You are required to perform. the following:

1. Main Program:

o  Continuously prompt the user to enter a value.

o  Call the displayDigits subroutine to paint the corresponding the four digits in the graphics memory.

o  If the user enters any value other than 0, the digits should be drawn in the value’s colour. The program should then prompt the user to enter another value.

o  If the user enters the value 0, the program should clear the display area and exit.

2. Subroutine:

o  Create a subroutine called displayDigits using the JNS instruction to call it.

o  The subroutine should:

Paint the last four digits of your student ID in the specified colour.

o  The program should continue running and processing inputs until user enters the

value 0. At this point, it should clear the graphics memory and exit. SeeAppendix B for further clarification.

Code Requirements:

•     The code should be well-commented to explain its functionality.

•     Ensure clarity and efficiency by structuring the code properly and avoiding duplication and unnecessary statements.

•     Implement graphics routines to draw at least a 5x6 pixel grid for each digit in the specified colour.

Note: Some parts of the program may already be provided to you. Feel free to retain and build upon them as necessary.

Figure 2: Read a value and display four digits using the value as the colour and assuming that ID ended with 4036.

站长地图