- UID
- 67426
注册时间2010-5-27
阅读权限8
最后登录1970-1-1
初入江湖
该用户从未签到
|
本帖最后由 qwangwei 于 2011-1-20 21:49 编辑
- assume cs:code
- stack segment
- dw 100h dup(0)
- stack ends
- data segment
- dd 123456789,0
- nstr db 10h dup(0)
- data ends
- code segment
- _showstr:
- push bp
- mov bp,sp
- push cx
- push dx
- push bx
- push si
- mov ax,0b800h
- mov es,ax
- xor ax,ax
- mov al,[bp+7]
- mov cx,80*2
- mul cl
- xor dx,dx
- mov dl,[bp+6]
- add dl,dl
- add ax,dx
- mov si,ax
- mov bx,[bp+4]
- mov ah,4
- _s_show:
- mov al,[bx]
- cmp al,0
- jz _s_over
- mov es:[si],ax
- inc bx
- inc si
- inc si
- jmp _s_show
- _s_over:
- pop si
- pop bx
- pop dx
- pop cx
- mov sp,bp
- pop bp
- retn
- div_over:
- push bp
- mov bp,sp
- push di
- push si
- push bx
- push dx
- push cx
- mov di,[bp+4]
- mov si,[bp+6]
- add di,10h
- ww:
- mov ax,[si+2]
- mov dx,0
- mov bx,10
- div bx
- mov [si+2],ax
- cmp dx,0
- jz ww1
- mov ax,[si]
- div bx
- mov [si],ax
- mov cx,dx
- add cx,48
- mov [di],cl
- dec di
- jmp ww
- ww1:
- mov ax,[si]
- cmp ax,0
- jz over
- mov dx,0
- div bx
- mov [si],ax
- mov cx,dx
- add cx,48
- mov [di],cl
- dec di
- jmp ww
- over:
- add di,1
- mov ax,di
- pop cx
- pop dx
- pop bx
- pop si
- pop di
- mov sp,bp
- pop bp
- retn
-
- start:
- mov ax,stack
- mov ss,ax
- mov sp,200h
-
- mov ax,data
- mov ds,ax
-
- mov ax,0
- push ax
- mov ax,offset nstr
- push ax
- call div_over
- add sp,4
- mov bx,ax
-
- mov ax,0a14h
- push ax
- mov ax,bx
- push ax
- call _showstr
- add sp,4
- mov ax,4c00h
- int 21H
- code ends
- end start
复制代码 |
评分
-
查看全部评分
|