Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:32:10+00:00 2026-06-04T18:32:10+00:00

So, my goal is the write a subroutine that when called hangs until the

  • 0

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:

  1. 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 from getline 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.

  2. Just keep pulling the keyboard for key presses.

  3. 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:32:11+00:00Added an answer on June 4, 2026 at 6:32 pm

    when you call your getline it should setup the interrupt handler so it adds the typed keys to buffer and updates a index

    then start a busy loop until the end of the buffer has a new line and disable the interrupts from the keyboard

    getline: 
    set push B
    set push X
    ;--coming from interrupt dispatch
    SET B, buffer ;--address from argument
    SET C, bufferlength ;-- from argument
    SET PUSH, 0
    SET X, SP ;--address of counter
    SET A, startKeyInput
    INT softwareInterrupt
    
    IAQ 1;--restart interrupts
    startloop:
    SET A,buffer
    ADD A,SP
    IFN [A],'\n'
        set PC, startloop ;--busy loop
    IFL PEEK, X
        set PC, startloop ;-- stopping buffer overflow
    IAQ 0;--stop interrupts
    set A, stopKeyInput
    INT softwareInterrupt
    
    SET C,POP;-- C is return value
    SET X,POP
    SET B,POP
    FRI ;-- from interrupt
    

    and the interrupt handler adds the typed key to the buffer until it is full and adds 1 to the counter, this can be put in a interrupt handler itself but you’ll need to reactivate interrupts while in the busy loop

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My final goal is to write the program which can run on the Unix
Goal: I'm trying to refresh content inside a div so that if the user
My goal is to write a program that handles an arbitrary number of tasks
My goal is to write a custom camera view controller that: Can take photos
My goal is to write a custom camera view controller that: Can take photos
Goal: write a query that can bring back all the users of a company,
My goal is to write some sort of chatterbot that speaks in spanish. I've
my goal is to write a stored proc that can collect all field values
My ultimate goal is to write a sql script that selects data from a
So my goal is to write the method that solves a sudoku puzzle, we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.