|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 今天不聊天 于 2012-2-28 15:28 编辑
ASSUME CS:CODE,DS : DATA
DATA SEGMENT
DB 'WELCOME TO MASM!',0
DATA ENDS
CODE SEGMENT
START:
MOV AX,CS
MOV DS,AX
MOV SI,OFFSET SHOW
MOV AX,0
MOV ES,AX
MOV DI,200H
MOV CX,OFFSET SHOWEND-OFFSET SHOW
CLD
REP MOVSB
MOV WORD PTR ES:[7CH*4],200H
MOV WORD PTR ES:[7CH*4+2],0
MOV DH,10
MOV DL,10
MOV CL,2
MOV AX,DATA
MOV DS,AX
MOV SI,0
MOV AX,0B800H
MOV ES,AX
MOV AL,DH
MOV CH,160
MUL CH
MOV DI,AX
ADD DI,9*2
S:
CMP BYTE PTR [SI],0
JE OK
MOV AL,[SI]
MOV ES:[DI],AL
MOV ES:[DI+1],CL
INC SI
ADD DI,2
MOV BX,OFFSET S-OFFSET OK
INT 7CH
OK:
MOV AX,4C00H
INT 21H
SHOW:
PUSH BP
MOV BP,SP
DEC CX
JCXZ OK1
ADD [BP+2],BX
OK1:
POP BP
IRET
SHOWEND:
NOP
CODE ENDS
END START
——————————————————————————————————————————————————————————————————————————————————————————————————————————————
ASSUME CS:CODE,DS : DATA
DATA SEGMENT
DB 'WELCOME TO MASM!',0
DATA ENDS
CODE SEGMENT
START:
MOV AX,CS
MOV DS,AX
MOV SI,OFFSET SHOW
MOV AX,0
MOV ES,AX
MOV DI,200H
MOV CX,OFFSET SHOWEND-OFFSET SHOW
CLD
REP MOVSB
MOV WORD PTR ES:[7CH*4],200H
MOV WORD PTR ES:[7CH*4+2],0
MOV DH,10
MOV DL,10
MOV AX,DATA
MOV DS,AX
MOV SI,0
MOV AX,0B800H
MOV ES,AX
MOV AL,DH
MOV CH,160
MUL CH
MOV DI,AX
ADD DI,9*2
S:
CMP BYTE PTR [SI],0
JE OK
MOV AL,[SI]
MOV ES:[DI],AL
MOV CL,2
MOV ES:[DI+1],CL
INC SI
ADD DI,2
MOV BX,OFFSET S-OFFSET OK
INT 7CH
OK:
MOV AX,4C00H
INT 21H
SHOW:
PUSH BP
MOV BP,SP
DEC CX
JCXZ OK1
ADD [BP+2],BX
OK1:
POP BP
IRET
SHOWEND:
NOP
CODE ENDS
END START
应该把红色的指令移到后来的程序那里,这样实验13(1)才是完美的解决方案!(自认为的)嘻嘻!
|
|