How to make string input in Assembly language?

前端 未结 2 1855
情话喂你
情话喂你 2020-12-31 21:12

Please, does anybody know how to code string input in assembly language? I\'m using int 21 to display and input characters.

2条回答
  •  灰色年华
    2020-12-31 22:13

    A string is just a series of characters, so you can use your int 21 code inside of a loop to get a string, one character at a time. Create a label in the data segment to hold your string, and each time you read a character, copy it to that label (incrementing an offset each time so your characters get stored sequentially). Stop looping when a certain character is read (perhaps enter).

    Doing all this manually is tedious (think about how backspace will work) but you can do it. Alternatively, you can link against stdio, stdlib, etc. and call library functions to do much of the work for you.

提交回复
热议问题