没有用堆栈的实验9
利用BX做了内循环……自鸣得意中 ^^看了很多解答,觉得偏移地址和电脑屏幕比例有关,自行修改数据段中PY即可。
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
PY DW 680H,7C0H,900H
SR DB 'welcome to masm!'
BG DB 2,24H,71H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV AX,0B800H
MOV ES,AX
MOV SI,0
MOV DI,0
MOV CX,16
MOV BX,4 ;计数三次显示串&同时负责切换行(自下而上)
STRING:MOV AL,BYTE PTR SR
MOV BP,WORD PTR PY
MOV ES:BYTE PTR,AL
ADD SI,2
INC DI
LOOP STRING
MOV CX,16
MOV SI,0
MOV DI,0
SUB BX,2
JNC STRING
MOV BX,4
MOV CX,16
MOV SI,0
MOV DI,2
BACKGD:INC SI ;显示背景属性
MOV AL,BYTE PTR BG
MOV BP,WORD PTR PY
MOV ES:BYTE PTR ,AL
INC SI
LOOP BACKGD
MOV CX,16
MOV SI,0
DEC DI
SUB BX,2
JNC BACKGD
MOV AX,4C00H
INT 21H
CODE ENDS
END START
页:
[1]