+1 (315) 557-6473 

Input A Character And Display It In Upper And Lower Case, And The Ascii Code In Hex And Decimal In Pep9 Assembly Language Assignment Solution.


Instructions

Objective
Write a program that allows users to type a character and display it in upper and lower case, and the ascii code in hex and decimal in Pep9 assembly language.

Requirements and Specifications

Write the following program using Pep9 using Assembly Language
  1. First load the value FFFF in the A register.
  2. Save the value in A to memory and display the value using decimal out. ( This should display a -1 then an LF )
  3. Next, get a character from the user using character input. For simplicity, we will assume that the user types in a lower case alpha character.
  4. Display the following properties of the character: Original Character then LF Character as Uppercase then LF Decimal ASCII value of the Character then LF Decimal ASCII value of the Uppercase Letter then LF Hex value of the original lowercase letter then LF Other requirements for this program: Put the data section in low memory and Branch around it. Use the A register. DO NOT use the X register Print a LF after each output. This program should work for any lowercase letter submitted by the user. This program should work running it several times changing the input. That is, it should not work only the first time you run it. Run it a couple of times changing the input each time Deliverables: Turn in the following electronically: file with your assembly code with the pep extension: eg. prog1.pep Hints: When you save the assembly code, it saves a .pep file. You may need to load and store 1 and 2 byte values using Load/Store and LoadByte and StoreByte. Remember to put a stop instruction at the end of your program to complete the assembly language assignment. Remember that you are to work individually on your programs. You should not discuss your ideas and algorithms with other people. Sample input/output: Input: j Output: -1 j J 106 74 006A *Note that this program should work for any lowercase input. (Not just lower case j)
Screenshots of output
input character display in upper lower case ascii code in hex decimal in Pep9 using assembly language
input character display in upper lower case ascii code in hex decimal in Pep9 using assembly language 1
Source Code
               BR start ; branch to start of program
number: .WORD 0 ; place to save number
lletter: .BYTE 0 ; place to save lower case letter
uletter: .BYTE 0 ; place to save upper case letter
start: LDWA 0xFFFF,i ; Load the value FFFF in the A register.
                STWA number,d ; save the number in A in memory
                DECO number,d ; display the value using decimal out
                LDBA 0xA,i ; load LF char
                STBA charOut,d ; display LF to change line
                LDBA charIn,d ; Read a character
                STBA lletter,d ; save character in memory
                SUBA 32,i ; convert letter to uppercase by subtracting 32
                STBA uletter,d ; save character in memory
                LDBA lletter,d ; load original character from memory
                STBA charOut,d ; display original char
                LDBA 0xA,i ; load LF char
                STBA charOut,d ; display LF to change line
                LDBA uletter,d ; load uppercase character from memory
                STBA charOut,d ; display uppercase char
                LDBA 0xA,i ; load LF char
                STBA charOut,d ; display LF to change line
                ANDA 0,i ; clear A to zero
                LDBA lletter,d ; load lowercase character from memory
                STWA number,d ; save the value as a 2 byte number
                DECO number,d ; display lowercase ASCII value
                LDBA 0xA,i ; load LF char
                STBA charOut,d ; display LF to change line
                LDBA uletter,d ; load uppercase character from memory
                STWA number,d ; save the value as a 2 byte number
                DECO number,d ; display uppercase ASCII value
                LDBA 0xA,i ; load LF char
                STBA charOut,d ; display LF to change line
                LDBA lletter,d ; load lowercase character from memory
                STWA number,d ; save the value as a 2 byte number
                HEXO number,d ; display lowercase char hex value
                LDBA 0xA,i ; load LF char
                STBA charOut,d ; display LF to change line
                STOP ; End the program
                .END