159.253
Tutorial topic6
Assembly #2
[2001 Final]
1When the 8051 processor is reset, interrupts are…
(A)Only acknowledged after an “ORG” assembler directive
(B)Loaded automatically in priority order
(C)Pushed onto the stack
(D)Disabled
[1]
[2001 Final]
2When performing serial I/O with the 8051, the TI bit is used to ensure…
(A)That data is not received faster than it is transmitted
(B)That the data in the SBUF register isn’t overwritten by new received serial data
(C)The data being transmitted isn’t overwritten by new data to be sent
(D)The receiver is ready – it’s the “Transmit Initiate” bit
[1]
[2000 Final]
3The sbuf register is sometimes critical to the correct functioning of a program. This would be when:
(A)the single bit underflow flag is used instead of the carry bit.
(B)it is necessary to move segments of memory between data and code memory.
(C)the program uses the global string buffer.
(D)serial I/O routines are used.
[1]
[1996 Final Modified]
4Write an 8051 assembly language subroutine to count the number of double letters in a character string. For example, 'hello world' has one double letter, and ‘abbbc’ has two double letters.
Assume that the character string is stored with a terminating null character
(ascii code 0) and that its address is passed to the subroutine as a parameter.
Show the code for the subroutine and a fragment of code to show how the subroutine should be called. (You need not produce a complete program).
Explain clearly how you have chosen to pass the parameter to the subroutine and how the result is returned to the calling routine.
[15]
[2001 Final]
5A simplified version of the C strcmp function, which has the following prototype:
int function strcmp(char *S1, char *S2)
is needed for an 8051 project. It has the following functional specification:
The function takes two pointer parameters
The value it returns has the following meanings:
Return value : / MeaningZero / the strings are different
FFh / the strings are byte-for-byte the same, and have the same length.
The format of the string is NOT null terminated as in C, but instead each string starts with a single byte indicating its length (in binary not ascii) and then as many bytes as necessary to store the string.
Write the code for this function in 8051assembler. Provide an example of its use to compare two strings, one starting at 40h and the second starting at 60h. If the value returned by the function is true (non-zero), put a “T” into the accumulator, otherwise put an “F” at location 20h.
Note the loading of the”T” and “F” are NOT part of the strcmp function, but are part of the calling routine.
[10]
[Random Questions]
6Write an algorithm using 8051 assembly language to simulate
a)multi-byte addition
b)multi-byte subtraction