Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,389 Programmers. There are 1,361 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

ASSEMBLY LC-3

 
Reply to this topicStart new topic

ASSEMBLY LC-3, NEW TRAP SERVICE ROUTINE

blurr_001
post 29 Apr, 2008 - 07:07 AM
Post #1


New D.I.C Head

*
Joined: 14 Mar, 2008
Posts: 9



i need help doing this i am slightly confused as to how to do this....Please help

Assembly language programming: input and output. The TRAP service routines GETC and IN each collect only a single character of input at a time. However, the TRAP service routines OUT and PUTS, generate one or a string characters of output, respectively. Write an LC-3 assembly language program that collects many characters of input at a time. In other words, write a service routine (GETS) that gets a string of characters from the keyboard, stores the string in a contiguous block of memory, and loads R0 with the memory address of the beginning of the string. The end of the character string is indicated by a newline character, which is generated when the user presses the ENTER key on the keyboard. Your program should not use any TRAP service routines other than HALT. Update the trap vector table to define trapvector x26, and make a home for your GETS subroutine a memory location x0600. Finally, write a program that uses TRAP x26 to make sure it works.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


PsychoCoder
post 29 Apr, 2008 - 07:27 AM
Post #2


ToCode || !ToCode

Group Icon
Joined: 26 Jul, 2007
Posts: 5,858

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.


Please don't be making duplicate threads regarding the same question. Doing this will not get you help any faster. Please refer to the Forum Rules regarding this behavior and other rules of the community smile.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

blurr_001
post 29 Apr, 2008 - 10:48 AM
Post #3


New D.I.C Head

*
Joined: 14 Mar, 2008
Posts: 9

[code]

.ORIG X3000
AND R0, R0, #0
AND R1, R1, #0
AND R2, R2, #0
AND R3, R3, #0
AND R4, R4, #0
LEA R0, MSG1
PUTS

AGAIN GETC; write the code getc
ST R0, CHARS
OUT; write the code for out function
ADD R2, R0, #0
LD R3, NUMBERS
ADD R2, R2, R3
BRz STOP

BRnzp AGAIN
STOP

LD R0, CHARS

OUT
HALT ;STOP PROGRAM
;*************************************...
MSG1 .STRINGZ "Please enter a character string >"
MSG2 .STRINGZ "Forward string >"
MSG3 .STRINGZ "Backward string >"
CHARS .BLKW 10
ASCII .FILL #-48
NUMBERS .FILL #-10
.END
[code/]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/17/08 04:53AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month