String length calculation and print in emu8086

31 views Asked by At

I start newly learning emu8086, trying to code string length calculation and print, below the code

name "Text-Size"
code segment;(Segment code)
assume CS:Code, Ds:Code,SS:Code,ES:Code

org 100h
jmp start
start:
     mov ax, code
     mov ds,ax
     mov ah, 9
     mov dx, offset text
     mov bl,0
     int 21h
     
     count_length:
         mov [dx], al; saving input in string
         inc dx
         inc bl
         cmp dx,ah
         int 21h
         jmp print_lenght:

print_lenght:
    mov dl,bl
    mov ah,2
    add dl,48
    int 21h
ret

text DB 'Hello world',0DH,'$'
code ends

I am getting the error: wrong parameters MOV[dx],al probably it s undefined var [dx]

enter image description here

I am expecting to have String length calculated and printed.

0

There are 0 answers