۲۲-اردیبهشت-۱۳۹۱, ۰۲:۱۰:۲۳
کد:
; multi-segment executable file template.
data segment
; add your data here!
X DW 2185,103,25,651,2,1286,9,99,123,7
COUNT DB 10 DUP(0)
COU DB 0
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
LEA SI,X
LEA DI,COUNT
MOV CX,10
L3:
MOV COU,0
MOV AX,[SI]
L1:
MOV BL,10
DIV BL
INC COU
CMP AL,0
JE L2
MOV AH,0
JMP L1
L2:
MOV DL,COU
MOV [DI],DL
INC SI
INC SI
INC DI
LOOP L3
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.