Docsity

ASCII Code Conversion and String Length Instructions for IA-32 Assembly, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
Web code:
ECE 267, Fall 2006 Semester
HW5 โ€“ due Friday, Oct. 6, 2006.
Last name:
First name:
1. Examine the ASCII code table that is found inside the back cover of our
textbook. Based on the codes for each alphabetic and numeric character
given there, answer these questions:
a. Write one assembly language instruction, involving a Boolean
operation, that may be used to convert the ASCII code of a numeric
character (โ€œ0โ€ through โ€œ9โ€) to the unsigned code for that value in
register AL:
b. Write one assembly language instruction, involving a Boolean
operation, that may be used to convert the unsigned code for values
0 โ€“ 9 in register AL to the ASCII code for the corresponding
numeric character (โ€œ0โ€ through โ€œ9โ€):
c. Write one assembly language instruction, involving a Boolean
operation, that may be used to capitalize the ASCII code for a
lowercase alphabetic character (โ€œaโ€ through โ€œzโ€) in register AL:
d. Write one assembly language instruction, involving a Boolean
operation, that may be used to make lowercase the ASCII code for
an uppercase alphabetic character (โ€œAโ€ through โ€œZโ€) in register AL:
Grading stamp
pf2

Partial preview of the text

Download ASCII Code Conversion and String Length Instructions for IA-32 Assembly and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Web code: ECE 267, Fall 2006 Semester HW5 โ€“ due Friday, Oct. 6, 2006. Last name:

First name:

  1. Examine the ASCII code table that is found inside the back cover of our textbook. Based on the codes for each alphabetic and numeric character given there, answer these questions:

a. Write one assembly language instruction, involving a Boolean operation, that may be used to convert the ASCII code of a numeric character (โ€œ0โ€ through โ€œ9โ€) to the unsigned code for that value in register AL:

b. Write one assembly language instruction, involving a Boolean operation, that may be used to convert the unsigned code for values 0 โ€“ 9 in register AL to the ASCII code for the corresponding numeric character (โ€œ0โ€ through โ€œ9โ€):

c. Write one assembly language instruction, involving a Boolean operation, that may be used to capitalize the ASCII code for a lowercase alphabetic character (โ€œaโ€ through โ€œzโ€) in register AL:

d. Write one assembly language instruction, involving a Boolean operation, that may be used to make lowercase the ASCII code for an uppercase alphabetic character (โ€œAโ€ through โ€œZโ€) in register AL:

Grading stamp

  1. Repeat all parts of Problem 1, this time using addition and subtraction assembly language instructions instead of Boolean operations:

a. Convert the ASCII code of a numeric character (โ€œ0โ€ through โ€œ9โ€) to the unsigned code for that value in register AL:

b. Convert the unsigned code for values 0 โ€“ 9 in register AL to the ASCII code for the corresponding numeric character (โ€œ0โ€ through โ€œ9โ€):

c. Capitalize the ASCII code for a lowercase alphabetic character (โ€œaโ€ through โ€œzโ€) in register AL:

d. Make lowercasethe ASCII code for an uppercase alphabetic character (โ€œAโ€ through โ€œZโ€) in register AL:

  1. Given the address to an ASCIIZ string in register EDX, write a few lines of IA-32 code that will find the length of this string and place it in register EAX. Note: the string may have length zero (only null code).