1 Replies - 2932 Views - Last Post: 14 November 2012 - 05:31 AM

#1 jazzz66  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-November 12

LC-3 Assembly: Storing Output in an Array?

Posted 08 November 2012 - 03:12 PM

Hi, So I am writing a code for a lab and I have figured out most everything except for astoring my output in a specific array. I have been able to store in the input, but I was able to get that from the keyboard entry. I have tried to use the same algorithm as was used for the input but can't figure out what exactly should be changed. Feel like the answer is right in front of me but for some reason I fail to see it clearly.
; LOAD STRING INTO ARRAY (ROW MAJOR), COUNT # OF CHARACTERS
; R3 IS NUMBER OF COLUMNS (CHARS) IN ARRAY
; R1 IS CIPHER INPUT
;
STRNG	LEA R0,NEWL
	PUTS
	ADD R3,R3,#0	;if Decrypt flag is set, find negative of cipher
	BRz STRNG1	
	NOT R1,R1
	ADD R1,R1,#1
STRNG1	LD R0,ADD3	;ask for string 
	PUTS
	LD R2,ADD9	;load starting address of array, row0
	LD R6,ADD9
	LD R4,COLN
	ADD R6,R4,R6	;starting address of array, row1
	AND R3,R3,#0	;R3 keeps track of # of char in array (column #)
STRNG2	GETC
	LD R4,LFNEG	;check for enter key
	ADD R4,R4,R0
	BRz PRINT
	OUT
	STR R0,R2,#0	;store original input into first row of array
	JSR CHKA
STORE	STR R0,R6,#0	;store en/decrypted char in next row, same column of array
	ADD R2,R2,#1	;inc row0 array add.
	ADD R6,R6,#1	;inc row1 array add.
	ADD R3,R3,#1	;inc # of chars in array
	LD R4,NCOLN
	ADD R5,R4,R3
	BRp SRY
	BR STRNG2


Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: LC-3 Assembly: Storing Output in an Array?

#2 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 615
  • Joined: 03-April 12

Re: LC-3 Assembly: Storing Output in an Array?

Posted 14 November 2012 - 05:31 AM

So what seems to be the problem? HOW does it not work?
I have never tried LC-3, but I think I understand most of your code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1