So, my goal is the write a subroutine that when called hangs until the user has entered a string terminated by <return>
, which it then returns(probably by writing it to an address specified by the user).
My problem lies in how i best get individual characters from the keyboard. As I see it there are 3 ways:
Listen for interrupts from the keyboard and get the character in response to those. This would mean that the logic performed by
getline
would be in the interrupt handler, which seem to cause some problems. i.e. how do you return fromgetline
in response to a press on the<return>
key? You don't have the return address handy when in the interrupt handler. Also the pattern of putting too much specific logic in the interrupt handler seems to me... wrong... even though I'm very inexperienced in low level coding.Just keep pulling the keyboard for key presses.
Implementing the old 1.1 behavior with the interrupt handler, by loading all characters pressed into a circular buffer(possibly of length 1).
Some more perspective on these options would be nice.