I'm trying to display 3 messages,one of them using a function.But that function never stops displaying the message. This is the code:

.model small
.data
message db "Hello from function!$"  
message1 db "Hello from the court!$" 
message2 db "Hello from the second court!$" 
.code
function proc
  mov dx,offset message;
  mov ah,9; 
int 21h;
endp


mov ax,@data;
mov ds,ax;

call function

lea dx,message1;
mov ah,9;
int 21;

call function

lea dx,message2;
mov ah,9;
int 21;

call function

mov ax,4c00h;
int 21h;
有帮助吗?

解决方案

You missed RET at the end of function:

function proc
  mov dx,offset message
  mov ah,9
  int 21h
  RET
endp

If you don't put the RET here you'll find that the recursion occures as function called multiple times (while the stack don't exceeded).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top