STACKS SEGMENT
;˴ջδ STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
MOV AX,DATAS MOV DS,AX lea dx,input mov ah ,9 int 21h
mov ah ,1;˴ݶδ int 21h
and al,0fh mov bl,al
mov dl,'+' mov ah,2 int 21h
mov buf ,al mov ah,1 int 21h
mov buf+2 ,al and al,0fh add al,bl daa
mov bl,al mov dl,'=' mov ah,2 int 21h mov al,bl mov cl,4 shr al,cl or al,30h
mov dl,al mov ah,2 int 21h
21
mov buf+4,al and bl,0fh or bl,30h
mov buf+5,al mov dl,bl mov ah,2 int 21h
MOV AH,4CH INT 21H CODES ENDS END START
н INPUT 0-9:4+5=09
2дʵִӼһַȻһʾ DATAS SEGMENT BUF DB 50 DB 0
DB 50 DUP(0)
CRLF DB 0DH,0AH,'$';˴ݶδ DATAS ENDS
STACKS SEGMENT
;˴ջδ STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
MOV AX,DATAS MOV DS,AX
LEA DX ,BUF;˴ݶδ MOV AH,10 INT 21H LEA DX,CRLF MOV AH,9 INT 21H
MOV BL,BUF+1 MOV BH,0
MOV BYTE PTR BUF+2[BX],'$' LEA DX,BUF+2 MOV AH,9
22
INT 21H MOV AH,4CH INT 21H CODES ENDS END START
н aihgeriu$ aihgeriu
3дʵԿոʼԿոһַһʾ ֲοͬѧDzʾΣ
DATAS SEGMENT
buffer db 80hdup(?) ;˴ݶδ flag db ?
crlf db 0dh,0ah,'$'
DATAS ENDS
STACKS SEGMENT
;˴ջδ STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
MOV AX,DATAS MOV DS,AX
mov bx,offset buffer mov flag,0
next: mov ah,01h int 21h
test flag,01h jnz follow cmp al,20h jnz exit mov flag,1 jmp next
follow: cmp al,20h jz exit
mov [bx],al inc bx jmp next exit: lea dx,crlf mov ah,9 int 21h
mov byte ptr buffer [bx],'$' lea dx,buffer mov ah,9
int 21h;˴ݶδ MOV AH,4CH
23
INT 21H CODES ENDS
END START н Abcdef Abcdef ԤϰҪ
1ϸĶαӦ̲ġ
2ճͼԴöݣԹУ顣
ʵ鲽衿
1ȷ㷨ͼ 2ı༭Դļ
3ûMASMԴ࣬γĿļ 4LINKĿļӣγɿִļ
5пִļдDEBUGе
˼⡿
1(AX)=2000H(BX)=1200H(SI)=0002H(DI)=0003H(DS)=3000H, (SS)=3000H(SP)=00000H(31200H)=50H(31201H)=02H(31202H)=0F7H, (31203H)=90HдиִָйؼĴ洢ԪݣָӰ־Ĵ״̬־SF,ZF,OF,CFֵ֮ 1 ADD AX, 1200 2 SUB AX, BX 3 MOV [BX], AX 4 PUSH AX
5 DEC BYTE PTR [1200H] 6 NEG WORD PTR [1200H] 7 SAR BYTE PTR 1200[SI]1 8 ROL BYTE PTR [BX+SI+1]1 9 MUL WORD PTR [BX][SI] 10 DIV BYTE PTR 1200[DI]
2ĴALBLCLݾΪ76H XOR AL0FH AND BL0FH OR CL0FH
ִָк:
AL=________ BL=________ CL=________
ʵ鱨Ҫ
1¼ʵ鲽ͳֵҪдʾԴע͡ 2Ƚʵ¼۷ĽǷͬͬҳԭ 3дʵ鱨棬㷨ͼпִļдн 4ش˼⣬ܽ᱾ʵᡣ
24