西电微机基础原理上机课后复习完整编辑版.doc
-/班级:021113 学号:02111283姓名:范亚男 指导老师:董玫上机作业(一)指令SRC寻址方式SRC的地址AX推算值AX实际值MOV AX, CX 寄存器寻址00050005MOV AX, 500H 立即寻址05000500MOV AX, TABLE 直接寻址1541:0004A5A4A5A4MOV AX, ES:BX 寄存器间接寻址1542:0004C5C4C5C4MOV AX, BX+05H 寄存器相对寻址1541:0009AAA9AAA9MOV AX, SS:BX+03H 寄存器相对寻址153F:0007B8B7B8B7MOV AX, TABLE BX 寄存器相对寻址1541:0008A9A8A9A8MOV AX, 07H BX 寄存器相对寻址1541:000BACABACABMOV AX, BP 寄存器间接寻址153F:0003B4B3B4B3MOV AX, TABLE BP 寄存器相对寻址1541:0007A8A7A8A7MOV AX, 08H BP 寄存器相对寻址153F:000BBCBBBCBBMOV AX, BP+06H 寄存器相对寻址153F:0009BAB9BAB9MOV AX, DS:BP+03H 寄存器相对寻址1541:0006A7A6A7A6MOV AX, BP+05H 寄存器相对寻址153F:0008B9B8B9B8MOV AX, ES: SI+03H 寄存器相对寻址1542:0005C6C5C6C5MOV AX, DI+06H 寄存器相对寻址1541:0007A8A7A8A7MOV AX, DI+05H 寄存器相对寻址1541:0006A7A6A7A6MOV AX, TABLE SI 寄存器相对寻址1541:0006A7A6A7A6MOV AX, SI 寄存器间接寻址1541:0002A3A2A3A2MOV AX, TABLE DI 寄存器相对寻址1541:0005A6A5A6A5MOV AX, SI+05H 寄存器相对寻址1541:0007A8A7A8A7MOV AX, BX DI+01H 基址变址且相对寻址1541:0006A7A6A7A6MOV AX, BX SI+03H 基址变址且相对寻址1541:0009AAA9AAA9MOV AX, TABLE BX SI 基址变址且相对寻址1541:000AABAAABAAMOV AX, ES:BX DI 基址变址寻址1542:0005C6C5C6C5MOV AX, BP DI+02H 基址变址且相对寻址153F:0006B7B6B7B6MOV AX, TABLE BP DI 基址变址且相对寻址1541:0008A9A8A9A8MOV AX, ES:BP SI 基址变址寻址1542:0005C6C5C6C5MOV AX, BP SI+05H 基址变址且相对寻址153F:000ABBBABBBAMOV AX, 03H BP DI 基址变址且相对寻址153F:0007B8B7B8B7MOV AX, BP SI 基址变址寻址153F:0005B6B5B6B5MOV AX, BP+02H DI+03H 基址变址且相对寻址153F:0009BAB9BAB9MOV AX, TABLE BP+02H DI+03H 基址变址且相对寻址1541:000DAEADAEAD1. 编写求十进制数12678532与21736543之和的程序,并将和以十进制数的形式送屏幕显示。STACK SEGMENT STACK STACKDW 100H DUP(?)TOP LABEL WORDSTACK ENDS ;堆栈段DATA SEGMENTADD1 DD 12678532HADD2 DD 21736543HSUM DD ?DATA ENDS ;数据段CODE SEGMENT ;代码段 ASSUME CS:CODE,DS:DATA,SS:STACKSTART: MOV AX,DATA MOV DS,AX MOV AX,STACK MOV SS,AX LEA SP,TOP LEA SI,ADD1 LEA DI,ADD2 MOV AL,SI ADD AL,DI DAA MOV BYTE PTR SUM,AL MOV AL,SI+1 ADC AL,DI+1 DAA MOV BYTE PTR SUM+1,AL MOV AL,SI+2 ADC AL,DI+2 DAA MOV BYTE PTR SUM+2,AL MOV AL,SI+3 ADC AL,DI+3 DAA MOV BYTE PTR SUM+3,AL MOV AX,WORD PTR SUM+2 CALL DISPAX MOV AX,WORD PTR SUM CALL DISPAX MOV AH,4CH INT 21H DISPAL PROC NEAR PUSH AX PUSH CX PUSH DX PUSH AX MOV CL,4 SHR AL,CL CALL CHANG MOV AH,02 MOV DL,AL INT 21H POP AX AND AL,0FH CALL CHANG MOV AH,02 MOV DL,AL INT 21H POP DX POP CX POP AX RETDISPAL ENDPCHANG PROC NEAR CMP AL,10 JNGE CHANG1 ADD AL,7CHANG1: ADD AL,30H RETCHANG ENDPDISPAX PROC NEAR XCHG AL,AH CALL DISPAL XCHG AH,AL CALL DISPAL RETDISPAX ENDPCODE ENDS END START2. 有一个首地址为A的N字数组,请编程序使该数组中的数按从大到小的次序排列。STACK SEGMENT STACK DB 256 DUP(?)STACK ENDSDATA SEGMENTDATA1 DW 7800H,6832H,0000H,87H,1275H,0EC34HSTRING1 DB input number:,0DH,0AH,$STRING2 DB The numbers from large to small is:,0DH,0AH,$DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACKSTART: MOV AX,DATA MOV DS,AX MOV ES,AX MOV AX,STACK MOV SS,AX LEA DX,STRING1 MOV AH,09H INT 21H MOV CX,6 LEA SI,DATA1L1: MOV AX,SI ADD SI,2 CALL DISPAX CALL DISPCR LOOP L1 MOV CX,5 LEA SI,DATA1 ADD SI,10LP1: PUSH CX PUSH SILP2: MOV AX,SI CMP AX,SI-2 JBE NOXCHG XCHG AX,SI-2 MOV SI,AXNOXCHG: DEC SI DEC SI LOOP LP2 POP SI POP CX LOOP LP1 LEA DX,STRING2 MOV AH,09H INT 21H MOV CX,6 LEA SI,DATA1L2: MOV AX,SI ADD SI,2 CALL DISPAX CALL DISPCR LOOP L2 MOV AH,4CH INT 21HDISPAL PROC PUSH AX PUSH CX PUSH DX PUSH AX MOV CL,4 SHR AL,CL CALL CHANG MOV AH,02H MOV DL,AL INT 21HPOP AX AND AX,0FH CALL CHANG MOV AH,02H MOV DL,AL INT 21H POP DX POP CX POP AX RETDISPAL ENDPCHANG PROC CMP AL,10 JNGE CHANG1 ADD AL,7CHANG1: ADD AL,30H RETCHANG ENDP DISPAX PROC XCHG AL,AH CALL DISPAL XCHG AH,AL CALL DISPAL RETDISPAX ENDPDISPCR PROC PUSH AX PUSH DX MOV AH,2 MOV DL,0AH INT 21H MOV AH,2 MOV DL,0DH INT 21H POP DX POP AX RETDISPCR ENDPCODE ENDS END START3.编写如下程序,并在机器上调试成功。程序采用菜单式选择,可以接收用户从键盘输入的四个命令(1-4),各命令功能分别为:(1)按下“1”键,完成字符串小写字母变成大写字母。(2)按下“2”键,完成找最大值(3)按下“3”键,完成排序(4)按下“4”键,结束程序运行,返回系统提示符。DISPL MACRO STR PUSH DX PUSH AX LEA DX,STR MOV AH,09H INT 21H POP AX POP DXENDMISCONTINUE MACRO L DISPS 15,10,SMENU MOV AH,08H INT 21H CMP AL,1BH JNE L JMP MAINENDMCURSOR MACRO CURX,CURY PUSH AX PUSH BX PUSH DX MOV AH,02H MOV DH,CURX MOV DL,CURY MOV BH,0 INT 10H POP DX POP BX POP AXENDMDISPS MACRO X,Y,STR PUSH AX PUSH BX PUSH DX MOV AH,02H MOV BH,00H MOV DH,X MOV DL,Y INT 10H LEA DX,STR MOV AH,09H INT 21H POP DX POP BX POP AXENDMSCROLL MACRO N,ULR,ULC,LRR,LRC,ATT PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,06H MOV AL,N MOV CH,ULR MOV CL,ULC MOV DH,LRR MOV DL,LRC MOV BH,ATT INT 10H POP DX POP CX POP BX POP AXENDMPREP MACRO T LEA SI,INBUF+1 LEA DI,OUTBUF SCROLL 21,2,0,22,79,0FH DISPS 3,20,T DISPS 6,2,CAPION DISPS 8,2,INCAP MOV AH,0AH INT 21H MOV CH,0 MOV CL,SI INC SI ENDMSTACK SEGMENT STACK STACK DB 100H DUP(?)TOP LABEL WORDSTACK ENDSDATA SEGMENTBASE DW MAIN,LTC,FMV,SORTS,EXITWELCM DB Welcome to this program!$MMENUC DB Please input the number!$MMENU1 DB 1 -Lowercase Letters To Capital Letters$MMENU2 DB 2 -Find The Maximum figure$MMENU3 DB 3 -Sort$MMENU4 DB 4 -Exit!$ SMENU DB Press Any Key To restart,Press ESC To Return To Main Menu!$WROCAP DB WRONG! You have press key! Please input a number between 1 and 4!$CAPION DB Please Input Your Strings and End With Enter Key!$INCAP DB Your Input Is: $INBUF DB 100 DB ? DB 100 DUP(?)OUTCAP DB My Output Is: $OUTBUF DB 100 DUP(?)MAXCAP DB The char of max ASCII is: .$ERRINF DB ERROR! Please check the format you input!$TDINV DB Invalid time data! Input again!$ NODATCAP DB You have input nothing!$TIME DB 8 DUP (:),12 DUP ( )DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACKSTART: MOV AX,DATA MOV DS,AX MOV ES,AX MOV AX,STACK MOV SS,AX LEA SP,TOP LEA DX,INBUF CLCMAIN: SCROLL 0,0,0,24,79,0 SCROLL 25,0,0,24,79,50H SCROLL 21,2,0,22,79,0FH DISPS 8,20,MMENUC DISPS 10,20,MMENU1 DISPS 12,20,MMENU2 DISPS 14,20,MMENU3 DISPS 16,20,MMENU4ML: CURSOR 19,1DH MOV AH,01H INT 21H CMP AL,31H JL ERROR CMP AL,35H JG ERROR AND AX,00FH LEA BX,BASE SHL AL,1 ADD BX,AX JMP WORD PTR BX ; CMP AL,1 ; JE LTC ; CMP AL,2 ; JE FMV ; CMP AL,3 ; JE SORTS ; CMP AL,4 ; JE EXIT ERROR: CMP AL,0DH JE MCR MOV WROCAP+23,AL ;Other char MOV WROCAP+24, JMP DMCR: MOV WORD PTR WROCAP+23,RCD: DISPS 20,5,WROCAP ;Show the wrong information JMP MLLTC: CALL LLTOCL ISCONTINUE LTCFMV: CALL FMAXV ISCONTINUE FMVSORTS: CALL SORT ISCONTINUE SORTSEXIT: SCROLL 0,0,0,24,79,0 MOV AH,4CH INT 21H LLTOCL PROC REFLASHL:PREP MMENU1 CMP CL,0 JE REFLASHLLL1: MOV AL,SI CMP AL,a JB MTOB ;NO CHANGE CMP AL,z JA MTOB SUB AL,20H ;ConvertMTOB: MOV DI,AL INC SI INC DI LOOP LL1 MOV BYTE PTR DI,$ DISPS 10,2,OUTCAP DISPS 10,17,OUTBUF RETLLTOCL ENDPFMAXV PROC PUSH BXREFLASHF:PREP MMENU2 CMP CL,0 JE REFLASHF MOV AL,0FL1: CMP AL,SI JA NEXT MOV AL,SINEXT: INC SI LOOP FL1 MOV MAXCAP+26,AL DISPS 10,2,MAXCAP POP BX RET FMAXV ENDPSORT PROC PREP MMENU3 DEC CX ADD SI,CX MOV BYTE PTR SI+1,$LP1: PUSH CX PUSH SILP2: MOV AL,SI CMP AL,SI-1 JBE NOXCHG XCHG AL,SI-1 MOV SI,ALNOXCHG: DEC SI LOOP LP2 POP SI POP CX LOOP LP1 DISPS 10,2,OUTCAP DISPS 10,17,INBUF2 RETSORT ENDPBCDASC PROC NEAR PUSH BX CBW MOV BL,10 DIV BL ADD AL,30H MOV TIMESI,AL INC SI ADD AH,30H MOV TIMESI,AH INC SI POP BX RETBCDASC ENDPCODE ENDSEND START按下4键
收藏
- 资源描述:
-
-/
班级:021113
学号:02111283
姓名:范亚男
指导老师:董玫
上机作业(一)
指令
SRC寻址方式
SRC的地址
AX推算值
AX实际值
MOV AX, CX
寄存器寻址
0005
0005
MOV AX, 500H
立即寻址
0500
0500
MOV AX, TABLE
直接寻址
1541:0004
A5A4
A5A4
MOV AX, ES:[BX]
寄存器间接寻址
1542:0004
C5C4
C5C4
MOV AX, [BX+05H]
寄存器相对寻址
1541:0009
AAA9
AAA9
MOV AX, SS:[BX]+03H
寄存器相对寻址
153F:0007
B8B7
B8B7
MOV AX, TABLE [BX]
寄存器相对寻址
1541:0008
A9A8
A9A8
MOV AX, 07H [BX]
寄存器相对寻址
1541:000B
ACAB
ACAB
MOV AX, [BP]
寄存器间接寻址
153F:0003
B4B3
B4B3
MOV AX, TABLE [BP]
寄存器相对寻址
1541:0007
A8A7
A8A7
MOV AX, 08H [BP]
寄存器相对寻址
153F:000B
BCBB
BCBB
MOV AX, [BP+06H]
寄存器相对寻址
153F:0009
BAB9
BAB9
MOV AX, DS:[BP+03H]
寄存器相对寻址
1541:0006
A7A6
A7A6
MOV AX, [BP]+05H
寄存器相对寻址
153F:0008
B9B8
B9B8
MOV AX, ES: [SI+03H]
寄存器相对寻址
1542:0005
C6C5
C6C5
MOV AX, [DI+06H]
寄存器相对寻址
1541:0007
A8A7
A8A7
MOV AX, [DI]+05H
寄存器相对寻址
1541:0006
A7A6
A7A6
MOV AX, TABLE [SI]
寄存器相对寻址
1541:0006
A7A6
A7A6
MOV AX, [SI]
寄存器间接寻址
1541:0002
A3A2
A3A2
MOV AX, TABLE [DI]
寄存器相对寻址
1541:0005
A6A5
A6A5
MOV AX, [SI]+05H
寄存器相对寻址
1541:0007
A8A7
A8A7
MOV AX, [BX] [DI+01H]
基址变址且相对寻址
1541:0006
A7A6
A7A6
MOV AX, [BX] [SI]+03H
基址变址且相对寻址
1541:0009
AAA9
AAA9
MOV AX, TABLE [BX] [SI]
基址变址且相对寻址
1541:000A
ABAA
ABAA
MOV AX, ES:[BX] [DI]
基址变址寻址
1542:0005
C6C5
C6C5
MOV AX, [BP] [DI+02H]
基址变址且相对寻址
153F:0006
B7B6
B7B6
MOV AX, TABLE [BP] [DI]
基址变址且相对寻址
1541:0008
A9A8
A9A8
MOV AX, ES:[BP] [SI]
基址变址寻址
1542:0005
C6C5
C6C5
MOV AX, [BP] [SI+05H]
基址变址且相对寻址
153F:000A
BBBA
BBBA
MOV AX, 03H [BP] [DI]
基址变址且相对寻址
153F:0007
B8B7
B8B7
MOV AX, [BP] [SI]
基址变址寻址
153F:0005
B6B5
B6B5
MOV AX, [BP+02H] [DI+03H]
基址变址且相对寻址
153F:0009
BAB9
BAB9
MOV AX, TABLE [BP+02H] [DI+03H]
基址变址且相对寻址
1541:000D
AEAD
AEAD
1. 编写求十进制数12678532与21736543之和的程序,并将和以十进制数的形式送屏幕显示。
STACK SEGMENT STACK STACK
DW 100H DUP(?)
TOP LABEL WORD
STACK ENDS ;堆栈段
DATA SEGMENT
ADD1 DD 12678532H
ADD2 DD 21736543H
SUM DD ?
DATA ENDS ;数据段
CODE SEGMENT ;代码段
ASSUME CS:CODE,DS:DATA,SS:STACK
START: MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
LEA SP,TOP
LEA SI,ADD1
LEA DI,ADD2
MOV AL,[SI]
ADD AL,[DI]
DAA
MOV BYTE PTR SUM,AL
MOV AL,[SI+1]
ADC AL,[DI+1]
DAA
MOV BYTE PTR SUM+1,AL
MOV AL,[SI+2]
ADC AL,[DI+2]
DAA
MOV BYTE PTR SUM+2,AL
MOV AL,[SI+3]
ADC AL,[DI+3]
DAA
MOV BYTE PTR SUM+3,AL
MOV AX,WORD PTR SUM+2
CALL DISPAX
MOV AX,WORD PTR SUM
CALL DISPAX
MOV AH,4CH
INT 21H
DISPAL PROC NEAR
PUSH AX
PUSH CX
PUSH DX
PUSH AX
MOV CL,4
SHR AL,CL
CALL CHANG
MOV AH,02
MOV DL,AL
INT 21H
POP AX
AND AL,0FH
CALL CHANG
MOV AH,02
MOV DL,AL
INT 21H
POP DX
POP CX
POP AX
RET
DISPAL ENDP
CHANG PROC NEAR
CMP AL,10
JNGE CHANG1
ADD AL,7
CHANG1: ADD AL,30H
RET
CHANG ENDP
DISPAX PROC NEAR
XCHG AL,AH
CALL DISPAL
XCHG AH,AL
CALL DISPAL
RET
DISPAX ENDP
CODE ENDS
END START
2. 有一个首地址为A的N字数组,请编程序使该数组中的数按从大到小的次序排列。
STACK SEGMENT STACK
DB 256 DUP(?)
STACK ENDS
DATA SEGMENT
DATA1 DW 7800H,6832H,0000H,87H,1275H,0EC34H
STRING1 DB input number:,0DH,0AH,$
STRING2 DB The numbers from large to small is:,0DH,0AH,$
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV AX,STACK
MOV SS,AX
LEA DX,STRING1
MOV AH,09H
INT 21H
MOV CX,6
LEA SI,DATA1
L1: MOV AX,[SI]
ADD SI,2
CALL DISPAX
CALL DISPCR
LOOP L1
MOV CX,5
LEA SI,DATA1
ADD SI,10
LP1: PUSH CX
PUSH SI
LP2: MOV AX,[SI]
CMP AX,[SI-2]
JBE NOXCHG
XCHG AX,[SI-2]
MOV [SI],AX
NOXCHG: DEC SI
DEC SI
LOOP LP2
POP SI
POP CX
LOOP LP1
LEA DX,STRING2
MOV AH,09H
INT 21H
MOV CX,6
LEA SI,DATA1
L2: MOV AX,[SI]
ADD SI,2
CALL DISPAX
CALL DISPCR
LOOP L2
MOV AH,4CH
INT 21H
DISPAL PROC
PUSH AX
PUSH CX
PUSH DX
PUSH AX
MOV CL,4
SHR AL,CL
CALL CHANG
MOV AH,02H
MOV DL,AL
INT 21H
POP AX
AND AX,0FH
CALL CHANG
MOV AH,02H
MOV DL,AL
INT 21H
POP DX
POP CX
POP AX
RET
DISPAL ENDP
CHANG PROC
CMP AL,10
JNGE CHANG1
ADD AL,7
CHANG1: ADD AL,30H
RET
CHANG ENDP
DISPAX PROC
XCHG AL,AH
CALL DISPAL
XCHG AH,AL
CALL DISPAL
RET
DISPAX ENDP
DISPCR PROC
PUSH AX
PUSH DX
MOV AH,2
MOV DL,0AH
INT 21H
MOV AH,2
MOV DL,0DH
INT 21H
POP DX
POP AX
RET
DISPCR ENDP
CODE ENDS
END START
3.编写如下程序,并在机器上调试成功。程序采用菜单式选择,可以接收用户从键盘输入的四个命令(1-4),各命令功能分别为:
(1)按下“1”键,完成字符串小写字母变成大写字母。
(2)按下“2”键,完成找最大值
(3)按下“3”键,完成排序
(4)按下“4”键,结束程序运行,返回系统提示符。
DISPL MACRO STR
PUSH DX
PUSH AX
LEA DX,STR
MOV AH,09H
INT 21H
POP AX
POP DX
ENDM
ISCONTINUE MACRO L
DISPS 15,10,SMENU
MOV AH,08H
INT 21H
CMP AL,1BH
JNE L
JMP MAIN
ENDM
CURSOR MACRO CURX,CURY
PUSH AX
PUSH BX
PUSH DX
MOV AH,02H
MOV DH,CURX
MOV DL,CURY
MOV BH,0
INT 10H
POP DX
POP BX
POP AX
ENDM
DISPS MACRO X,Y,STR
PUSH AX
PUSH BX
PUSH DX
MOV AH,02H
MOV BH,00H
MOV DH,X
MOV DL,Y
INT 10H
LEA DX,STR
MOV AH,09H
INT 21H
POP DX
POP BX
POP AX
ENDM
SCROLL MACRO N,ULR,ULC,LRR,LRC,ATT
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV AH,06H
MOV AL,N
MOV CH,ULR
MOV CL,ULC
MOV DH,LRR
MOV DL,LRC
MOV BH,ATT
INT 10H
POP DX
POP CX
POP BX
POP AX
ENDM
PREP MACRO T
LEA SI,INBUF+1
LEA DI,OUTBUF
SCROLL 21,2,0,22,79,0FH
DISPS 3,20,T
DISPS 6,2,CAPION
DISPS 8,2,INCAP
MOV AH,0AH
INT 21H
MOV CH,0
MOV CL,[SI]
INC SI
ENDM
STACK SEGMENT STACK STACK
DB 100H DUP(?)
TOP LABEL WORD
STACK ENDS
DATA SEGMENT
BASE DW MAIN,LTC,FMV,SORTS,EXIT
WELCM DB Welcome to this program!$
MMENUC DB Please input the number!$
MMENU1 DB 1 -Lowercase Letters To Capital Letters$
MMENU2 DB 2 -Find The Maximum figure$
MMENU3 DB 3 -Sort$
MMENU4 DB 4 -Exit!$
SMENU DB Press Any Key To restart,Press "ESC" To Return To Main Menu!$
WROCAP DB WRONG! You have press " " key! Please input a number between 1 and 4!$
CAPION DB Please Input Your Strings and End With "Enter" Key!$
INCAP DB Your Input Is: $
INBUF DB 100
DB ?
DB 100 DUP(?)
OUTCAP DB My Output Is: $
OUTBUF DB 100 DUP(?)
MAXCAP DB The char of max ASCII is: .$
ERRINF DB ERROR! Please check the format you input!$
TDINV DB Invalid time data! Input again!$
NODATCAP DB You have input nothing!$
TIME DB 8 DUP (:),12 DUP ( )
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV AX,STACK
MOV SS,AX
LEA SP,TOP
LEA DX,INBUF
CLC
MAIN: SCROLL 0,0,0,24,79,0
SCROLL 25,0,0,24,79,50H
SCROLL 21,2,0,22,79,0FH
DISPS 8,20,MMENUC
DISPS 10,20,MMENU1
DISPS 12,20,MMENU2
DISPS 14,20,MMENU3
DISPS 16,20,MMENU4
ML: CURSOR 19,1DH
MOV AH,01H
INT 21H
CMP AL,31H
JL ERROR
CMP AL,35H
JG ERROR
AND AX,00FH
LEA BX,BASE
SHL AL,1
ADD BX,AX
JMP WORD PTR [BX]
; CMP AL,1
; JE LTC
; CMP AL,2
; JE FMV
; CMP AL,3
; JE SORTS
; CMP AL,4
; JE EXIT
ERROR: CMP AL,0DH
JE MCR
MOV [WROCAP+23],AL ;Other char
MOV [WROCAP+24],
JMP D
MCR: MOV WORD PTR [WROCAP+23],RC
D: DISPS 20,5,WROCAP ;Show the wrong information
JMP ML
LTC: CALL LLTOCL
ISCONTINUE LTC
FMV: CALL FMAXV
ISCONTINUE FMV
SORTS: CALL SORT
ISCONTINUE SORTS
EXIT: SCROLL 0,0,0,24,79,0
MOV AH,4CH
INT 21H
LLTOCL PROC
REFLASHL:PREP MMENU1
CMP CL,0
JE REFLASHL
LL1: MOV AL,[SI]
CMP AL,a
JB MTOB ;NO CHANGE
CMP AL,z
JA MTOB
SUB AL,20H ;Convert
MTOB: MOV [DI],AL
INC SI
INC DI
LOOP LL1
MOV BYTE PTR [DI],$
DISPS 10,2,OUTCAP
DISPS 10,17,OUTBUF
RET
LLTOCL ENDP
FMAXV PROC
PUSH BX
REFLASHF:PREP MMENU2
CMP CL,0
JE REFLASHF
MOV AL,0
FL1: CMP AL,[SI]
JA NEXT
MOV AL,[SI]
NEXT: INC SI
LOOP FL1
MOV [MAXCAP+26],AL
DISPS 10,2,MAXCAP
POP BX
RET
FMAXV ENDP
SORT PROC
PREP MMENU3
DEC CX
ADD SI,CX
MOV BYTE PTR [SI+1],$
LP1: PUSH CX
PUSH SI
LP2:
MOV AL,[SI]
CMP AL,[SI-1]
JBE NOXCHG
XCHG AL,[SI-1]
MOV [SI],AL
NOXCHG: DEC SI
LOOP LP2
POP SI
POP CX
LOOP LP1
DISPS 10,2,OUTCAP
DISPS 10,17,INBUF[2]
RET
SORT ENDP
BCDASC PROC NEAR
PUSH BX
CBW
MOV BL,10
DIV BL
ADD AL,30H
MOV TIME[SI],AL
INC SI
ADD AH,30H
MOV TIME[SI],AH
INC SI
POP BX
RET
BCDASC ENDP
CODE ENDS
END START
按下4键
展开阅读全文