It seems to be the simplest task for the input-output of a string, but, for some reason, there is no conditional transition when a string reaches a certain length. As I just did not try: through, and through. He does not interrupt the cycle. Here is one of the broken implementations of the problem procedure:

Input: mov ah,2 mov dh,[string] mov dl,[column] mov bh,2 int 10h mov si,[len] mov di,line inputLoop: mov ah,0 int 16h cmp al,13 jz endInput mov [di],al mov ah,9 mov bh,2 mov bl,[color] mov cx,1 int 10h add di,2 inc dx mov ah,2 mov bh,2 int 10h dec si cmp si,0 jnz inputLoop endInput: ret 
  • Or maybe just can not see anything? The conclusion is on page 2. - user6550
  • @klopp, you see. There is an input of characters, their entry into the array and output. The output is visible, only it should be interrupted at one moment, when the zero flag is raised cmp si, 0 - kuler94

1 answer 1

Perhaps you are just spoiling the code or the memory with this: add di,2 . After that, everything goes wrong. Here is a perfectly working example (I didn’t fix the obvious shortcomings).

 .model tiny .code org 100h Input: mov ah,2 mov dh,[string] mov dl,[column] mov bh,2 int 10h mov si,len mov di,offset line inputLoop: mov ah,0 int 16h cmp al,13 jz endInput mov [di],al mov ah,9 mov bh,2 mov bl,[color] mov cx,1 int 10h inc di; add di,2 inc dx mov ah,2 mov bh,2 int 10h dec si jnz inputLoop endInput: ret string db 1 column db 2 color db 7 line db 0,0,0 len equ $-offset line END Input 

And finally learn to use the debugger! In it, you will find answers to all your questions where faster than guessing on the coffee grounds here.

alt text

  • The problem is that I still do not understand how to handle interrupts in TD. - kuler94
  • And what side interruption here? Well you do not want to say that the code does not work because of interrupts :) - user6550
  • mov si, len There was a problem in this line. len, in bytes, was recorded in SI, in 2 bytes. Thus, the high byte SI remained unchanged, and the number in it turned out very large. - kuler94
  • I wonder what kind of assembler devoured such a design? I don’t know about masm and fasm, but tasm and nasm will not compile mov si,[len] if len defined as byte. And nasm in general mov si,len (without brackets) is always interpreted as mov si,offset len . - user6550