Howdy, Stranger!

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

Categories

Using Interrupt 0x10 to display a string

hkcwkinhkcwkin Member Posts: 22
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

  • marlo_1981marlo_1981 Member Posts: 9
    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
  • Andre YoungAndre Young USAMember Posts: 0

    ______ // http://forcoder.org // free video tutorials and ebooks about ( Delphi, JavaScript, MATLAB, C#, R, C, Java, Python, Scratch, Objective-C, Perl, PHP, Visual Basic .NET, Swift, Ruby, Go, PL/SQL, Visual Basic, Assembly, C++ Hack, D, Ada, Kotlin, Bash, Prolog, VBScript, Scala, Erlang, Fortran, Awk, FoxPro, ML, Julia, Crystal, F#, Scheme, Transact-SQL, ABAP, Rust, LabVIEW, Clojure, Dart, Lua, COBOL, Alice, Lisp, SAS, Apex, Logo ) ___

Sign In or Register to comment.