ʵ ѭ 2ѧʱ
ʵĿġ
1.յѭƵķ 2.ȷʹüĴ 3.տѭķ
ʵݡ
1ƳʵֽLISTеֵMAXԪĻʾֵԪΪݣݸCNTԪС :,ɰѵһȷAXĴ,AXеCNT-1бȽ,AXеС,λ;AXеڵȽϵ,λ,ڱȽϹ,AXʼձֽϴ,ȽCNT-1,߱AX,AXеMAXԪ
ο(ͬѧDzʾ) DATAS SEGMENT
out1 db 10 dup(?)
list dw 10,59,421,6,8 ;˴ݶδ cn dw ($-list)/2 max dw ?
DATAS ENDS
STACKS SEGMENT
;˴ջδ STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
MOV AX,DATAS MOV DS,AX
lea si,list;˴ݶδ mov cx,cn mov ax,[si] dec cx add si,2 a1:cmp ax,[si]
jae small mov ax,[si]
33
small:
add si,2 loop a1 mov max,ax lea si,out1+3 next:
mov dx,0 mov bx,10
div bx;(ax)=,(dx)= or dl,30h
mov out1[si],dl dec si cmp ax,0 jnz next
mov out1+4,byte ptr'$' lea dx,out1 mov ah,9 int 21h MOV AH,4CH INT 21H CODES ENDS
END START
н 421
2NBUFΪִַ洢СԱдͳ6λΪȫ1ĸͳƽĻʾ DATAS SEGMENT
buf dw 5678,5946,0fc41h,1234;˴ݶδ cn dw ($-buf)/2 DATAS ENDS
STACKS SEGMENT
;˴ջδ STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
MOV AX,DATAS MOV DS,AX
lea si,buf;˴ݶδ mov cx,cn mov dl,0 poa:mov ax,[si]
34
and ax,0fc00h cmp ax,0fc00h jnz next
inc dl;(ͳƸ6λΪ1) next:add si,2 loop poa mov al,dl mov ah,0 mov bl,10
div bl;(al)=ʮλ (ah)=λ mov bh,ah or al,30h mov dl,al mov ah,2 int 21h or bh,30h mov dl,bh mov ah,2 int 21h MOV AH,4CH INT 21H CODES ENDS
END START н 01
3дһûṩַָASCIIijҪûҪ֪ijһַASCII룬Ӽַ̼ʱַASCII밴ʮʽʾʾʽʾ THE ASCII CODE OF A IS 41H THE ASCII CODE OF 7 IS 37H THE ASCII CODE OF CRس)
ǻسʱʾASCII𣬽ִУDOS״̬ עĸA7ǴӼ롣 DATAS SEGMENT
tab db '0123456789ABCDEF';˴ݶδ OUT1 DB 0DH,0AH,'THE ASCII CODE 0F $' OUT2 DB 'IS',0,0,'H$' DATAS ENDS
STACKS SEGMENT
;˴ջδ STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
35
START:
MOV AX,DATAS MOV DS,AX
LEA BX,TAB;˴ݶδ LOP:LEA DX,OUT1 MOV AH,9 INT 21H MOV AH,1 INT 21H CMP AL,0DH JE EXIT MOV DH,AL AND AL,0FH XLAT
MOV OUT2+3,AL MOV AL,DH MOV CL,4 SHR AL,CL XLAT
MOV OUT2+2,AL LEA DX,OUT2 MOV AH,9 INT 21H JMP LOP EXIT:
MOV AH,4CH INT 21H CODES ENDS END START
4ԱдBUFAΪַֽڴ洢ŵ10δѹBCD ˳͵BUFBΪַֽڴ洢У洢еִʾ
Ĵ£
CXѭֵΪ10
SIȡָ룬ֵָBUFAÿѭһֵ֮1 DIָ룬ֵָBUFB+9ÿѭһֵ֮1 DLҪ͵
ԤϰҪ
1ϸĶαӦ̲ġ
2ճͼԴöݣԹУ顣
ʵ鲽衿
1ȷ㷨ͼ
36