Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We want to implement a circular queue which can hold 8 integers (2 bytes each) in an 8086 processor based system. The data structure
We want to implement a circular queue which can hold 8 integers (2 bytes each) in an 8086 processor based system. The data structure is placed in the data segment with label DQ. It includes the data buffer as well as an index in the buffer where new data should be entered and an index from where data should be picked. We also maintain a count of the number of entries in the queue. Both indices and the count are byte sized and initialized to zero at the beginning, indicating an empty queue. Data insert and retrieve functions have to be written for this queue in 8086 assembly language, assuming the small model. Your code should be clear and well commented. Vague and poorly commented code will incur marks penalty. a) Write the insert function for this queue, which receives an integer as input in AX and copies it to the insert index position in the buffer. Then it increments the insert index, as well as data count. If the insert index is at 7, it should be incremented to 0. All gen- eral purpose registers must be preserved. b) Write the retrieve function for this queue which receives the ad- dress of a byte flag in BX. If there are non-zero entries in the queue, the flag byte is cleared. Otherwise, the flag is set to -1 and the function returns. If the buffer is not empty, the function copies an integer from the buffer at the retrieve index to the AX register and then decrements the retrieve index as well as the data count. (If the retrieve index is 0, it should be decremented to 7). All general purpose registers except AX should be preserved. (Note: in a real queue, the retrieve function should also increment its index but the question asked you to decrement it. Full credit will be given if your code in fact increments this index as it should be done in a real queue or decrements it as asked in the question.) The function is:
Step by Step Solution
★★★★★
3.38 Rating (154 Votes )
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