为什么内存只写了三个字?汇编语言

why only three word is write on the memory ? assembly language

.model small

.stack 200h

.data   

string1 db 'wahab $'

.code

main proc 

    mov ax,@data
    mov ds,ax
    mov ax,0b800h 

    mov es,ax  

    mov ax,offset string1 
    mov si,ax 
    mov di,0

    l1:

    mov ax,[si]

    mov es:[di],ax 
    inc si
    inc di

    cmp ax,'$'
    jne l1           

    main endp

屏幕或显存上只显示三个字符?

视频内存是字对齐的。偶字节是要显示的字符,奇字节是颜色属性。因此,当您对视频内存段执行 mov [es:di], ax 时,AL 包含要显示的字符,并且 AH - 该字符的颜色。

l1:

mov al,[si]

mov es:[di],al 
inc si
add di, 2

cmp al,'$'
jne l1