Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

print string using video interrup


hello guys,
I am using int video interrupt 10h to display a string hello world, it runs infinit loop and
terminate with error message, cpu encountered an illegual operation... will close.

here is main proc

[code]
.model compact
.stack 100h
.data
msg DB 'Hello World!', 0 ; null terminated string.
.code
main proc
mov ax,@data
mov ds,ax
mov bh,0
CALL printstring
mov ah,4ch
int 20
main endp
[/code]

Comments

  • punjabian263punjabian263 Member Posts: 7
    code of procedure printstring

    [code]
    printstring PROC
    mov si,offset msg ;moves offset of string defined in .data
    next_char: ;label
    CMP [SI], 0 ; check for zero to stop
    JE stop ;
    MOV AL, [SI] ; next get ASCII char.
    MOV AH, 0Eh ; teletype function number.
    INT 10h ; using interrupt to print a char in AL.
    inc si ; advance index of string array.
    JMP next_char ; go back, and type another char.
    stop:
    RET ; return to caller.
    printstring ENDP

    [/code]
  • sigma_zksigma_zk Member Posts: 68
    [b][red]This message was edited by sigma_zk at 2004-5-2 16:10:18[/red][/b][hr]
    :
    : hello guys,
    : I am using int video interrupt 10h to display a string hello world, it runs infinit loop and
    : terminate with error message, cpu encountered an illegual operation... will close.
    :
    : here is main proc
    :
    : [code]
    : .model compact
    : .stack 100h
    : .data
    : msg DB 'Hello World!', 0 ; null terminated string.
    : .code
    : main proc
    : mov ax,@data
    : mov ds,ax
    : mov bh,0
    : CALL printstring
    : mov ah,4ch
    : int 20 [red]I believe the exit function is 21h, not 20t[/red]
    : main endp
    : [/code]
    :







Sign In or Register to comment.