Hi JnZn558! There are several methods to print the string "hello world!" on the screen in COM-file
1) .286
.model tiny
.code
org 100h
start: mov ah,9
mov dx,OFFSET string
int 21h
ret
string db 'Hello world!$'
END start
2) mov cx,sizeof string
mov si,offset string
@@: lodsb
int 29h
loop @b
3) push 0B800h
pop es
mov ax,3
int 10h
mov di,0
mov si,offset string
mov cx,sizeof string
mov ah,0Ch
@@: lodsb
stosw
loop @b
4) mov ah,40h
mov bx,1
mov cx,sizeof string
mov dx,offset string
int 21h
5) mov ah,13h
xor dx,dx
mov cx,sizeof string
mov bp,offset string
mov bx,0Ch
int 10h
6) mov ah,0Eh
mov si,offset string
next: lodsb
int 10h
test al,al
jnz next
ret
string db 'Hello world!',0
7) .286
.model tiny
.code
org 100h
start: mov bp,offset ABC
mov ax,1303h
mov bx,7
mov cx,16
xor DX,DX
int 10h
retn
ABC db 'H',0Ah,'e',0Bh,'l',0Dh,'l',0Ch
db 'o',0Bh,',',0Ah,' ',0Ah,'W',09h
db 'o',08h,'r',07h,'l',06h,'d',05h
db '!',02h,'!',02h,'!',02h
end start
8) .286
.model tiny
.code
org 100h
start: mov si,offset string
mov cx,N
mov ah,2
@@: lodsb
mov dl,al
int 21h
loop @b
retn
string db 'Hello, world!'
N = $ - string
end start
9) .286
.model tiny
.code
org 100h
start: mov si,offset string
mov cx,N
mov ah,6
@@: lodsb
mov dl,al
int 21h
loop @b
retn
string db 'Hello, world!'
N = $ - string
end start
10) .286
.model tiny
.code
org 100h
start: push offset RETURN
push cs
pushf
mov cl,9
mov dx,offset MESSAGE
db 0EAh,0C0h,0,0,0 ;jmp far ptr 0:0C0h
RETURN: mov ah,4Ch
int 21h
MESSAGE db 'Hello, world!$'
end start
11) .286
.model tiny
.code
org 100h
start: push 0
pop es
mov di,es:[21h*4]
mov si,es:[21h*4+2]
mov dx,offset string
mov ah,9
pushf
push cs
push offset @f
push si ;cs for int 21h
push di ;ip for int 21h
retf
@@: mov ah,4Ch
int 21h
string db 'Hello, world!$'
end start