微机原理程序
- 格式:pdf
- 大小:29.11 KB
- 文档页数:20
实验二:循环程序设计
2.
DA TA SEGMENT
x db -78,127,-128,-125,88
y db 32,-43,76,95,1
S db 5 dup(?)
data ends
Code segment
Assume cs:code,ds:data Start:mov ax,data
Mov ds,ax
Mov cx,5
Mov bx,0
L1:mov al,x[bx]
Add al,y[bx]
Inc bx
Loop L1
MOV AH,4CH
INT 21H
CODE ENDS
END START
3.
DA TA SEGMENT
Y DB 68H,24H,90H,57H,13H HX DB 67H,34H,12H,90H,57H S DB 5 DUP(?)
DA TA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DA TA START:MOV AX,DATA
MOV DS,AX
MOV CX,5
MOV SI,OFFSET X
MOV DI,OFFSET Y
LP:MOV AL,[SI]
MOV AH,[DI]
ADC AL,AH
DAA
MOV S[SI],AL
INC SI
INC DI
LOOP LP
MOV AH,4CH
INT 21H
END START
4.
DA TA SEGMENT
LIST DB 0,1,2,3,4,5,6,7,8,9
COUNT EQU $-LIST
DA TA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DA TA
START:MOV AX,DATA
MOV DS,AX
MOV CX,COUNT-1
LOOP1:MOV DX,CX
MOV BX,0
LOOP2:MOV AX,LIST[BX]
CMP AX,LIST[BX+1]
MOV LIST[BX],AX
LOOP3:INC BX
LOOP LOOP2
MOV CX,DX
LOOP LOOP1
MOV AX,4CH
INT 21H
CODE ENDS
END START
实验三:子程序调用程序设计
DA TA SEGMENT
NUM DB 85,77,126,-1,-43,37,-128,11,-19,13 DA TA ENDS
ADDITION SEGMENT
NUM1 DB 10 DUP(?)
ADDITION ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DA TA,ES:ADDITION START:AX,DATA
MOV DS,AX
MOV AX,ADDITION
MOV ES,AX
CALL ORDER
CALL COPY
MOV AH,4CH
INT 21H
ORDER PROC
MOV CX,9
MOV DX,CX
LP1:MOV AL,NUM[BX]
CMP AL,NUM[BX+1]
JLE NEXT
XCHG AL,NUM[BX+1]
MOV NUM[BX],AL
NEXT:ADD BX,1
DEC DX
JNZ LP1
LOOP LP2
RET
ORDER ENDP
COPY PROC
MOV CX,10
MOV BX,0
LP:MOV AL,NUM[BX]
MOV ES:NUM1[BX],AL
INC BX
LOOP LP
RET
COPY ENDP
CODE ENDS
END START
实验四:DOS功能系统调用
1.
DA TA SEGMENT
DUF DB 10 DUP(?)
DA TA ENDS
STACK SEGMENT
SA DB 100 DUP(?)
TOP LABEL WORD
STACK ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE,SS:STACK START:MOV AX,STACK
MOV SS,AX
MOV SP,OFFSET TOP
PUSH DS
SUB AX,AX
PUSH AX
MOV AX,DATA
MOV DS,AX
MOV CX,05H
S1:MOV AH,1
INT 21H
PUSH AX
LOOP S1
MOV DL,0DH
MOV AH,02H
INT 21H
MOV DL,0AH
MOV AH,02H
INT 21H
MOV CX,05H
MOV BX,4
S2:POP AX
MOV DUF[BX],AL
DEC BX
LOOP S2
MOV BX,0
MOV CX,05H
S3:MOV DL,DUF[BX]
INC BX
MOV AH,2
INT 21H
LOOP3
INC AL
MOV AH,4CH
INT 21H
CODE ENDS
END START
2.
DA TA SEGMENT
BUFF DB 50
DB ‘?’
LETTER DB 50 DUP(‘?’)
DA TA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DA TA START:MOV AX,DATA
MOV DS,AX
LEA DX,BUFF
MOV AH,0AH
INT 21H
MOV DL,0DH
MOV AH,02H