Using Interrupt 0x10 to display a string

I try to use interrupt 0x10 to show a string on the screen, but it fails. I don't know WHY. Can anybody help me?

Compiler: NASM

;===START=======================================
[bits 16]

segment code
start:
;===============================================
; sets up DS to point to the
; data segment, and initialises
; SS and SP to point to the top
; of the provided stack.
;===============================================
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,stacktop

;===============================================
; print the string
;===============================================
;mov dx,hello
;mov ah,09h
;int 21h

mov ax,seg hello
mov es,ax
mov ax,0e01h
mov bx,0007h
mov cx,lmsg
mov dx,0000h
mov bp,hello
int 10h

;===============================================
; terminates the program
;===============================================
mov ax,4c00h
int 21h

segment data
hello db 'hello, world'
lmsg equ $-hello

segment stack stack
resb 64
stacktop:
;===END=========================================

Comments

  • Why not use int 21 ?

    org 100h
    start:
    mov ah,09h ; write string
    lea dx,Text ; string offset
    int 21h

    ret

    Text db 'This program prints some text on the screen. Program size is 9 bytes + text len.$'

    end
Sign In or Register to comment.

Howdy, Stranger!

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

Categories

In this Discussion