DATAS SEGMENT
string
db
"Please
input
a
number(0number(0-10000):" ,0dh,0ah wrongstring db " A number please! ",0ah,0dh,'$' inputbuffer db 6,?,6 dup(?) c10 dw 10 n dw ? m dw ? c dw ? i dw ? ;输入时进制转换的数 ;输入时进制转换的数 ;
要求
对教师党员的评价套管和固井爆破片与爆破装置仓库管理基本要求三甲医院都需要复审吗
阶乘的数 ;要求阶乘的数 ;步长 ;步长 ;进位 ;
outputbuffer dw 30000 dup(?) ;
DATAS ENDS ;************************************************** ***************************** STACKS SEGMENT ;此处输入堆栈段代码 STACKS ENDS ;************************************************** ;************************************************** *****************************
CODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKS START: MOV AX,DATAS MOV DS,AX ; ;
;-----------------------------------------------------main proc
call input fractor call fractor mov cx,di routput: push cx mov di,cx call output ; pop cx dec cx cmp cx,0 jge routput displaylength:
; ;
;循环输出 ;循环输出 ; ;
mov dl,0dh mov ah,2 int 21h mov dl,0ah mov ah,2 int 21h
exit: ; mov ah,07h int 21h mov ax,4c00h INT 21H ; ; ; ; ; main endp ;
;------------------------------------------------------
;------------------------------------------------------input proc near
lea bx,string mov cx, 33 disstring: mov dl,[bx] mov ah,2 int 21h inc bx loop disstring jmp inputinit
wronginput:
lea dx,wrongstring mov ah,9 int 21h
inputinit:
lea dx,inputbuffer mov ah,0ah int 21h
;装载输入缓冲区首地址 ;装载输入缓冲区首地址 ;输入功能代码 ;输入功能代码 ;从键盘输入一个数, ;从键盘输入一个数,以回 从键盘输入一个数
车键结束 mov ax,0 mov cl,inputbuffer+1 mov ch,0 bx,inputbuffer+2 lea bx,inputbuffer+2 inputone: ; mul c10 mov dl,[bx] cmp dl,'0' jb wronginput cmp dl,'9' ja wronginput and dl,0fh add al,dl adc ah,0 inc bx loop inputone mov n,ax mov dl,0dh mov ah,2 int 21h ; ; ; ; ; ; ; ;装载字符存放区首地址 ;装载字符存放区首地址 ;累加器清 ;累加器清 0 ;循环次数 ;循环次数
mov dl,0ah mov ah,2 int 21h ; ret ; input endp ;
;---------------------------------------------------fractor proc mov cx,n mov i,1d mov m,0d ; push dx mov di,0d mov ax,di mov bx,2d mul bx mov si,ax pop dx ; ; ; ; ; near ; ;
; mov outputbuffer[si],1d ctrli: mov c,0 mov di,0d ; ; ;
ctrldi: ; cmp di,m jbe done jmp cmpc done: push dx mov ax,di mov bx,2d mul bx mov mov si,ax pop dx ; mov ax,outputbuffer[si] mov bx,i mul bx ; ; ; ; ; ; ; ; ; ;
add ax,c; adc dx,0; mov bx,10000 div bx mov c,ax
; ; ; ;
push dx mov ax,di mov bx,2d mul bx mov si,ax pop dx mov outputbuffer[si],dx inc di
; ; ; ;
; ; ;
jmp ctrldi cmpc: cmp c,0 ja three1
; ; ; ; ; ; ;
jmp next three1: inc m
mov ax,c mov outputbuffer[si+2],ax ;
;
; next:
inc i cmp cx,0 jng if0 loop ctrli if0: mov di,m ret ; ; ; ; ; fractor endp ; ;
;---------------------------------------------------output proc C2: near ;
push dx
;
mov ax,di mov bx,2d mul bx mov si,ax pop dx
; ; ;
; mov bx,outputbuffer[si] ;
bid proc
mov cx,10000 mov ax,bx mov dx,0 div cx mov bx,dx
; ; ; ; ;
; cx,1000 mov cx,1000 call ddiv mov cx,100 call ddiv mov cx,10 call ddiv mov cx,1 ; ; ; ; ; ;
call ddiv ret ; bid endp
;
;
;--------------------------------ddiv proc mov ax,bx mov dx,0 div cx mov bx,dx mov dl,al add dl,30h mov ah,02h int 21h ret ; ddiv endp ; ; ret output endp ; ; ; ; ; ; ; ; ; ; ;
;---------------------------------------------------------------------------------------
CODES ENDS END START
; ;