Language:EN
Pages: 24
Words: 4791
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
increment ecx and repeat the loopadd ecx

x86 Assembly System Implementation Help Needed

Jammie’s National Zoo is a wildlife park at the far end of the county of Brookeshire. Currently the only residents at the zoo are two families of badgers, who live in a complex of setts underneath the ground

The park is overseen by Jammie Zookeeper who knows every badger by name. However, Jammie has been asked to rehome three hundred extra badgers by next month. He is worried that he will not be able to keep track of all the new badgers and extra staff he will need in addition to the badgers he already has. Jammie has bought a fancy new computer to keep track of the new badgers and staff in his zoo. You have been called in to create some new software to help Jammie organise the residents and staff in his wildlife park. You will need to write a record keeping system to store information about all the badgers and people in Jammie’s Zoo.

Your system must be able to store the following information about staff members in the zoo:

• Surname • First Name • Staff ID • Department (can be any one of Park Keeper, Gift Shop or Cafe) • Starting annual salary in £ (whole £ only) • Year of joining • Email address Your system must allow the following operations: • Add/delete user • Add/delete badger • Display all users • Display all badgers • Search for and display a badger, given a badger ID • Search for and display a staff member, given a Staff ID

Answer With Explanation for Assembly System Implementation Outline

I can help you outline a high-level approach for implementing the system described in the specifications using 64-bit x86 assembly language. However, please note that implementing the entire system in assembly language is a significant task, and it would require a lot of code, which cannot be provided in a single response. Below is an outline of the main components and steps to get you started:

  1. Initialize the System:

ASSEMBLY CODE

current_year resb 4 ; Buffer to store the current year

section .text

; Initialize program here

; Prompt the user to input the current date

int 0x80

mov edx, current_year

; Convert the input to integers (you can use your own conversion code)

; Now, you have the current_month and current_year in memory

EXPLANATION OF THE ASSEMBLY CODE

    • Define data structures for badgers and staff members. These structures should have fields for all the required information mentioned in the specification. Ensure that you allocate enough memory to store the maximum allowed number of badgers and staff members.

ASSEMBLY CODE

here's an example of how you can define data structures for badgers and staff members in x86 assembly language:

badgers resb 64*max_badgers ; Array to store badger data (max 500 badgers)

staff resb 64*max_staff ; Array to store staff data (max 100 staff members)

; Your program continues here

EXPLANATION OF THE ASSEMBLY CODE

In this code, we're using the .data section to define constants for the maximum allowed number of badgers and staff members. Then, in the .bss section, we allocate memory for arrays to store the data of badgers and staff members. The size of each array is calculated as 64 bytes per data entry (as specified in your requirements) multiplied by the maximum allowed number of entries.

    • When deleting a staff member, remove them from the system.

ASSEMBLY CODE:

To implement functions for adding and deleting staff members in x86 assembly, you need to manage the staff data array and assign unique Staff IDs. Below is a simplified example that demonstrates how to add and delete staff members. You should adjust and expand upon this code to fit the full requirements of your system:

staff_data resb 64*max_staff

section .text

; Initialize program here

mov byte [staff_count], 0 ; Initialize staff count to 0

; Prompt the user to input staff member information

; Store the information in staff_data

.add_failed:

; Your code for handling a failed addition (e.g., array full)

; Your code for handling deletion (e.g., updating the array)

; Your program continues here

EXPLANATION OF THE ASSEMBLY CODE

  1. We increment the staff_count to reflect the addition of a new staff member.

  2. In the delete_staff_member section, we prompt the user to input the Staff ID of the staff member to be deleted.

    • When deleting a badger, remove them from the system.

ASSEMBLY CODE

To implement functions for adding and deleting badgers in x86 assembly, you need to manage the badger data array and assign unique Badger IDs. Below is a simplified example that demonstrates how to add and delete badgers. You should adjust and expand upon this code to fit the full requirements of your system:

badger_data resb 64*max_badgers

section .text

; Initialize program here

mov byte [badger_count], 0 ; Initialize badger count to 0

; Prompt the user to input badger information

; Store the information in badger_data

.add_failed:

; Your code for handling a failed addition (e.g., array full)

; Your code for handling deletion (e.g., updating the array)

; Your program continues here

EXPLANATION OF THE ASSEMBLY CODE

  1. We increment the badger_count to reflect the addition of a new badger.

  2. In the delete_badger section, we prompt the user to input the Badger ID of the badger to be deleted.

ASSEMBLY CODE

To implement a function that displays a list of all staff members and calculates the number of years of service and current salary for each staff member based on the input date, you can use the following code as a starting point:

section .data

staff_data resb 64*max_staff

input_month resb 2

extern scanf

main:

; Your code for displaying the header

; Loop through staff_data to display each staff member

; Load staff data for the current staff member

mov esi, ecx ; Offset into staff_data (64 bytes per entry)

; Display staff information, years of service, and current salary

; Your code for displaying staff information

; Your code for other functionality continues here

EXPLANATION OF THE ASSEMBLY CODE

In this code:

  1. Inside the loop, it calculates the number of years of service and current salary based on the input date (you need to implement this logic).

  2. Finally, it displays the staff information, years of service, and current salary for each staff member.

ASSEMBLY CODE

section .data

max_badgers equ 500

badger_count resb 1

badger_data resb 64*max_badgers

extern printf

extern scanf

; Display header for badger list (e.g., field names)

; Your code for displaying the header

jge .done ; If we've displayed all badgers, exit the loop

; Load badger data for the current badger

; Your code for calculating age and stripiness

; Display badger information, age, and stripiness

.done:

; Your code for other functionality continues here

EXPLANATION OF THE ASSEMBLY CODE

  1. It then enters a loop that goes through each badger in badger_data.

  2. Inside the loop, it calculates the age and stripiness for each badger based on the input date (you need to implement this logic).

ASSEMBLY CODE

To implement a function that allows the user to search for a specific badger by Badger ID, and then display the information, age, and stripiness for the selected badger, you can use the following code as a starting point:

section .data

badger_count resb 1

badger_data resb 64*max_badgers

global main

extern printf

search_badger_by_id:

; Prompt the user to input a Badger ID for the search

cmp ecx, [badger_count]

jge .not_found ; If we've searched all badgers, exit the loop

; If they match, display the information, age, and stripiness

; Your code for comparison and displaying information

; Your code for handling a badger not found

; Your code for other functionality continues here

EXPLANATION OF THE ASSEMBLY CODE

  1. We enter a loop that goes through each badger in badger_data.

  2. Inside the loop, we compare the input Badger ID with the Badger ID of each badger. If a match is found, we display the information, age, and stripiness for the selected badger.

ASSEMBLY CODE

To implement a function that allows the user to search for a specific staff member by Staff ID and display the information, years of service, and current salary for the selected staff member, you can use the following code as a starting point:

section .data

staff_count resb 1

staff_data resb 64*max_staff

global main

extern printf

search_staff_by_id:

; Prompt the user to input a Staff ID for the search

cmp ecx, [staff_count]

jge .not_found ; If we've searched all staff members, exit the loop

; If they match, display the information, years of service, and current salary

; Your code for comparison and displaying information

; Your code for handling a staff member not found

; Your code for other functionality continues here

EXPLANATION OF THE ASSEMBLY CODE

  1. We enter a loop that goes through each staff member in staff_data.

  2. Inside the loop, we compare the input Staff ID with the Staff ID of each staff member. If a match is found, we display the information, years of service, and current salary for the selected staff member.

DETAILED ASSEMBLY CODE

Creating user-friendly input and output procedures is crucial to ensure that your system is easy to use and understand. Below, I'll provide a sample code that demonstrates how to display prompts, accept user input, and present results in a clear and organized manner. You can customize and expand upon this code to match your system's specific requirements.

section .data

prompt_staff_not_found db "Staff member not found.", 0

display_header_staff db "Staff ID | Surname | First Name | Department | Salary | Year of Joining | Email", 0

global main

extern printf

mov edx, prompt_enter_date

call print_prompt

; Prompt the user to enter a Badger ID for the search

mov edx, prompt_enter_badger_id

; Your search logic here

; If found, display the badger information using print_badger_info

call print_prompt

call read_input

; If not found, display "Staff member not found."

display_all_staff:

display_all_badgers:

; Display header for badger list

; Print the prompt message

mov eax, 4 ; sys_write

ret

read_input:

mov edx, 20 ; Maximum input length

int 0x80

mov ebx, 1 ; File descriptor (1 for stdout)

mov ecx, edx ; Message to display

; Display staff member information

; Your code for printing staff information


EXPLANATION OF THE ASSEMBLY CODE

In this code:

  1. We define prompts and messages for user interaction.

  2. In the search_badger_by_id and search_staff_by_id sections, we prompt the user, read input, and display search results.

  3. The display_all_staff and display_all_badgers sections display lists of staff members and badgers.

Creating a comprehensive test plan for your system is a critical part of the development process to ensure that the software functions as expected. Below is a sample test plan that covers the functionality for adding, deleting, displaying, and searching for both staff members and badgers. You should execute these tests and document the results.

Detailed Test Plan for Staff Members

  1. Add Staff Member:

    • Verify that the staff member is removed from the system.

  2. Display All Staff Members:

    • Verify that the correct staff member's information is displayed.

  3. Search for Staff Member (Not Found):

    • Verify that the system handles adding staff members when the array is full.

  4. Delete Staff Member (Non-Existent):

    • Test adding a single badger with valid information.

    • Verify that the badger is added correctly.

    • Test displaying a list of all badgers.

    • Verify that all badgers' information is correctly displayed.

    • Test searching for a badger with an invalid Badger ID.

    • Verify that the system handles the case where the badger is not found.

    • Test deleting a badger that does not exist in the system.

    • Verify that the system handles the case where the badger is not found.

For each test case, document whether the test passed, failed, or had unexpected results. If a test fails, provide details about the failure, such as error messages or incorrect output. Make sure to note the date and time of the tests, any specific input values, and any other relevant information. This documentation is crucial for debugging and improving your system.

  1. Documentation and Comments:

    • Create a report that summarizes your implementation, highlights the assumptions, and presents the test results.

FINAL WORDS OF ADVICE

Please note that writing a complete assembly language program for this task can be quite extensive. You'll need to use registers for data storage, manage memory efficiently, and design robust input/output procedures. Additionally, you might want to use conditional statements, loops, and function calls to structure your code.

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Sr. Marcos Vinicius Fogaça

PageId: DOCE81CA6E