3

I've been working on this bit of code to take a string of input and to have it displayed after I hit the enter key, but it doesn't work for some reason and I can't figure out where I'm going wrong at all. I would love some help to figure this one out.

      LD  R1, RT
      LEA R2, ARRAY
INPUT GETC           ;read the input character 
      OUT            ;echoes the character
      ADD R3, R0, R1
      BRz ENDINPUT
      STR R0, R2, #0
      ADD R2, R2, #1
      BR  INPUT
ENDINPUT
      STR R3, R2, #0
      LEA R0, ARRAY         ;outputs the string of characters
      PUTS
nishanthshanmugham
  • 2,967
  • 1
  • 25
  • 29
user2293344
  • 77
  • 1
  • 3

1 Answers1

1

Late response, but in case it's still haunting you, hope these help!

  • Check that the value in location RT is correct. If you are checking for a 'LF' when you hit 'Enter', R2 should have the value of negative 'LF'. In 2s-complement this is 0xFFFFFFF0.

  • Make sure your ARRAY is large enough to hold your inputs. Check your .BLKW line – I'm assuming you didn't post these lines in your post.

nishanthshanmugham
  • 2,967
  • 1
  • 25
  • 29