在Nasm中显示程序(汇编语言)

时间:2018-03-10 05:40:56

标签: assembly nasm

任何人都可以解释一下,这个程序是如何工作的?

disp32_proc:

    mov esi,char_count+7    ; load last byte address of char_count buffer in rsi
    mov ecx,8               ; number of digits

    cnt: 
    mov edx,0               ; make rdx=0 (as in div instruction rdx:rax/rbx)
    mov ebx,16              ; divisor=16 for hex
    div ebx
    cmp dl, 09h             ; check for remainder in RDX
    jbe add30
    add dl, 07h

    add30: 
    add dl,30h              ; calculate ASCII code 
    mov [esi],dl            ; store it in buffer 
    dec esi                 ; point to one byte back
    dec ecx                 ; decrement count 
    jnz cnt                 ; if not zero repeat

    print char_count,8      ; display result on screen 

ret

0 个答案:

没有答案