Printing out a number in assembly language?

后端 未结 10 1941
感动是毒
感动是毒 2020-12-03 04:39
mov al,10
add al,15

How do I print the value of \'al\'?

10条回答
  •  情话喂你
    2020-12-03 05:14

    AH = 09 DS:DX = pointer to string ending in "$"

    returns nothing
    
    
    - outputs character string to STDOUT up to "$"
    - backspace is treated as non-destructive
    - if Ctrl-Break is detected, INT 23 is executed
    

    ref: http://stanislavs.org/helppc/int_21-9.html


    .data  
    
    string db 2 dup(' ')
    
    .code  
    mov ax,@data  
    mov ds,ax
    
    mov al,10  
    add al,15  
    mov si,offset string+1  
    mov bl,10  
    div bl  
    add ah,48  
    mov [si],ah  
    dec si  
    div bl  
    add ah,48  
    mov [si],ah  
    
    mov ah,9  
    mov dx,string  
    int 21h
    

提交回复
热议问题