Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assembly Programming Question. Read keystroke, reverse case and display, stop on

ID: 649854 • Letter: A

Question

Assembly Programming Question. Read keystroke, reverse case and display, stop on ESC.

Also relevant:

Also relevant:

Also relevant (though you cant use Irvine16.inc):

Assembly Programming Question. Read keystroke, reverse case and display, stop on ESC. Assembly Programming Question. Read keystroke, reverse case and display, stop on ESO. 3. Write a program that reads a user keystroke and if it?s an alphabetical character, reverses it case then displays it. The program should stop when the user hits the ESC key (1Bh). Also relevant: 6.2.2.1 Converting Characters to Upper Case The AND instruction provides an easy way to translate a letter from lowercase to uppercase. If we compare the ASCII codes of capital A and lowercase a. it becomes clear that only bit 5 is different: The rest of t1 alphabetic characters have the same relationship. If we AND any character with 1101111 binary, all bits are unchanged except for bit 5, which is cleared. In the following example, all characters in an array are converted to uppercase: Also relevant: . The FORC directive repeats a statement block by iterating over a string of characters. 10.6 Programming Exercises 1. mReadkey Macro This exercise requires reading Section 5.2.2. The program must run in Real-address mode. Create a macro that waits for a keystroke and returns the key that was pressed. The macro should include parameters for the ASCII code and keyboard scan code. For example, the following code waits for a key; when it returns, the two arguments contain the ASCII code and scan code: Also relevant (though you cant use Irvine16.inc):

Explanation / Answer

using System;

class Example
{
   public static void Main()
   {
      ConsoleKeyInfo cki;
      // Prevent example from ending if CTL+C is pressed.
      Console.TreatControlCAsInput = true;

      Console.WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key.");
      Console.WriteLine("Press the Escape (Esc) key to quit: ");
      do
      {
         cki = Console.ReadKey();
         Console.Write(" --- You pressed ");
         if((cki.Modifiers & ConsoleModifiers.Alt) != 0) Console.Write("ALT+");
         if((cki.Modifiers & ConsoleModifiers.Shift) != 0) Console.Write("SHIFT+");
         if((cki.Modifiers & ConsoleModifiers.Control) != 0) Console.Write("CTL+");
         Console.WriteLine(cki.Key.ToString());
       } while (cki.Key != ConsoleKey.Escape);
    }
}
// This example displays output similar to the following:
//       Press any combination of CTL, ALT, and SHIFT, and a console key.
//       Press the Escape (Esc) key to quit:
//      
//       a --- You pressed A
//       k --- You pressed ALT+K
//       ? --- You pressed CTL+P
//         --- You pressed RightArrow
//       R --- You pressed SHIFT+R
//                --- You pressed CTL+I
//       j --- You pressed ALT+J
//       O --- You pressed SHIFT+O
//      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote