Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 16 (20 points) Complete the following assembly, by filling the numbered blanks, to implement a function that gets a string of characters from the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Question 16 (20 points) Complete the following assembly, by filling the numbered blanks, to implement a function that gets a string of characters from the keyboard using polling. Assume the following memory-mapped keyboard registers: Address 7 6 5 4 3 2 1 0 Ox4000 KBD_DATA Ox4004 KIN KIRQ KBD_STATUS 0x4008 KIE KBD_CONT Assume the following C function prototypes: // reads a string from the keyboard into buf, terminating when CR is read, and returns its length int gets (char* buf); // returns a character read from the keyboard char getc(); Further assume: That function parameters are passed and values returned in RO. KBD_DATA stores the most recently typed character KIN is set to indicate data is ready to be read; KIRQ is set to indicate that an interrupt has been requested KIE is set to enable interrupts CR (13) is the carriage return character kbd: .word 0x00004000 buf: .space 80 .equ CR, 13 main: LDR A1, gets 11 (1) // (2) gets: // (3) 11 (4) MOV MOV vi, V2, #0 getc: // (7) // (8) getcLoop: LDR Vi, LDRB A1, [V1, #4] TST A1, #2 BEQ getcLoop LDRB // (9) // (10) BX LR Blank # 1 Blank #2 Blank # 3 Blank #4 Blank # 5 Blank # 6 Blank #7 Blank #8 Blank #9 Blank # 10 Question 16 (20 points) Complete the following assembly, by filling the numbered blanks, to implement a function that gets a string of characters from the keyboard using polling. Assume the following memory-mapped keyboard registers: Address 7 6 5 4 3 2 1 0 Ox4000 KBD_DATA Ox4004 KIN KIRQ KBD_STATUS 0x4008 KIE KBD_CONT Assume the following C function prototypes: // reads a string from the keyboard into buf, terminating when CR is read, and returns its length int gets (char* buf); // returns a character read from the keyboard char getc(); Further assume: That function parameters are passed and values returned in RO. KBD_DATA stores the most recently typed character KIN is set to indicate data is ready to be read; KIRQ is set to indicate that an interrupt has been requested KIE is set to enable interrupts CR (13) is the carriage return character kbd: .word 0x00004000 buf: .space 80 .equ CR, 13 main: LDR A1, gets 11 (1) // (2) gets: // (3) 11 (4) MOV MOV vi, V2, #0 getc: // (7) // (8) getcLoop: LDR Vi, LDRB A1, [V1, #4] TST A1, #2 BEQ getcLoop LDRB // (9) // (10) BX LR Blank # 1 Blank #2 Blank # 3 Blank #4 Blank # 5 Blank # 6 Blank #7 Blank #8 Blank #9 Blank # 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago