0% found this document useful (0 votes)
117 views2 pages

Lec 22

This document discusses an assembly language program that takes string input from the user and displays it on the console. The program stores each input character in a string location in memory, compares it to a line feed character, and loops to get additional input. It then loads each character from the string location, displays it on the console, compares it to a line feed, and loops to output all characters before halting the program.

Uploaded by

vipulugale
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT or read online on Scribd
0% found this document useful (0 votes)
117 views2 pages

Lec 22

This document discusses an assembly language program that takes string input from the user and displays it on the console. The program stores each input character in a string location in memory, compares it to a line feed character, and loops to get additional input. It then loads each character from the string location, displays it on the console, compares it to a line feed, and loops to output all characters before halting the program.

Uploaded by

vipulugale
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT or read online on Scribd
You are on page 1/ 2

Computer Programming TA C162

Topics to discuss…

•Assembly Programs Examples

1
Computer Programming TA C162

Program to display input string on console


.ORIG x3000
LD R1, Ekey
NOT R1, R1
ADD R1, R1, #1
LD R2, Strg
input IN
STR R0, R2, #0 ; Store the input char at x4000
ADD R3, R1, R0 ; Compare with x0A
BRz oput ; If it is x0A input is terminated
ADD R2, R2, #1 ; Pointer goes to next location in memory
BRnzp input ; Loop
; Display output
oput LD R2, Strg ; Load x4000 in R2
oputl LDR R0, R2, #0 ; Load character in R0
OUT ; Display current char in R0
ADD R3, R1, R0 ; Compare with x0A
BRz Done ; If char is x0A program terminates
ADD R2, R2, #1 ; Goto next location
BRnzp oputl ; Loop
Done HALT
Ekey .FILL x0A
Strg .FILL x4000
.END 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy