双字的数值转10进制字符串asm
偷懒了。/:16 没有输出到显存,直接打印来的。。。。assume cs:code,ds:data,ss:stack
stack segment
db 200H dup(0)
stack ends
data segment
dd 35345345,123456789,987654321,0ffffffffh
str db 20 dup(0)
enter db 0dh,0ah,'$'
data ends
code segment
start: mov ax,stack
mov ss,ax
mov ax,data
mov ds,ax
xor bx ,bx
mov ax,200h
mov sp,ax
mov cx,4
xor si,si
again:
mov ax,
push ax
mov ax,
push ax
call itoa
mov dx,offset str
mov ax,0900h
int 21h
mov dx,offset enter
mov ax,0900h
int 21h
inc si
inc si
inc si
inc si
loop again
mov ax, 4c00h
int 21h
itoa:
push bp
mov bp,sp
push dx
push cx
push bx
push si
xor di,di
xor si,si
mov bx,offset str
mov dx,
mov ax,
start_check:
mov cx,0AH
call div_it
add cx,30h
push cx
inc di
test ax,ax
jnz start_check
mov cx,di
end_check:
pop ax
mov ,al
inc si
loop end_check
mov al,'$'
mov ,al
pop si
pop bx
pop cx
pop dx
pop bp
retn 4
div_it:
push bx
push ax
mov ax,dx
xor dx,dx
div cx
mov bx,ax
pop ax
div cx
mov cx,dx
mov dx,bx
pop bx
retn
code ends
end start 真的是很用功,佩服了! 回复 1# zaas
下回得吼出来/:09
页:
[1]