汇编作业
编程题A-3:设有三个字节变量Ⅹ、Y、Z,试找出X、Y有符号数中较大者送入Z中,编写程序。DATA SEGMENT
X DB 080H ;NEG
Y DB 7FH ;POS
Z DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV AL,X
CMP AL,Y;X COMPARE WITH Y
JGE NEXT;X>=Y,Y->Z
MOV AL,Y
NEXT:MOV Z,AL
MOV AH,4CH
INT 21H
CODE ENDS
END START编程题B-3:在以BUF为首址的字节单元中存放了 CoUnT个无符号数,编写程序找出其中最大数送MAX单元。
DATA SEGMENT
BUF DB 21,35,45,65,98,13,34,10
COUNT EQU $-BUF
MAX DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV CX,COUNT
MOV AL,0 ;AL--MAX NUM,INIT 0
ALOOP:MOV SI,CX
DEC SI
CMP AL,BUF;COMPARE WITH AL FROM LAST TO HEAD
JAE GOON
MOV AL,BUF
GOON:LOOP ALOOP
MOV MAX,AL
MOV AH,4CH ;code end function number
INT 21H
CODE ENDS
END START编程题C-1:已知在以BUF为首地址的字节存储区中,存放着一个以$作结束标志的字符串,试编写程序,在CRT上显示该字符串,并要求将小写字母以大写字母形式显示出来
DATA SEGMENT
BUF DB 'acEARN$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV SI,0 ;BUF POINT ADRESS
ALOOP: MOV DL,BUF ;BUF'S DATA->DL
CMP DL,'$';DL='$',EXIT
JE STOP
CMP DL,5AH ;Z
JBE UPPER ;PRINT UPPER WORD,SI++
SUB DL,20H ;PRINT LOWER WORD AFTER DL - 20H,SI++
UPPER: MOV AH,02H
INT 21H
INC SI
JMP ALOOP
STOP: MOV AH,4CH
INT 21H
CODE ENDS
END START
页:
[1]