汇编实现屏保功能

data segment
x dw 0
y dw 0
x1 dw 0
y1 dw 0
col dw 0
row dw 1
ser dw 1
data ends
stack segment
db 20 dup (?)
stack ends
code segment
assume cs:code,ds:data,ss:stack
start:mov ax,data
mov ds,ax
mov ah,1
int 21h
and ax,0fh
mov x,ax

mov ah,1
int 21h
and ax,0fh
mov y,ax

mov cx,y
mov ax,640
mov dx,0
div x
mov x1,ax
mov dx,0
mov ax,480
div y
mov y1,ax
mov ax,012h
int 10h
mov cx,y
l3:push cx
mov cx,y1
l2:push cx
mov cx,x
mov di,ser
l1:push cx
mov cx,x1
mov si,di
mov dx,row
l0:push cx
mov ax,si
mov ah,0ch
mov bh,0
mov cx,col
mov bl,1
add col,bx
int 10h
pop cx
loop l0

inc di
pop cx
loop l1

pop cx
mov bx,1
add row,bx
mov ax,0
mov col,ax
loop l2

pop cx
mov bx,1
add ser,bx
loop l3

mov ah,1
int 21h
mov ax,03
int 10h
mov ah,4ch
int 21h
code ends
end start

    MOV AH,4CH
    INT 21H
CODES ENDS
    END START

感谢来访,共同学习!
原文地址:https://www.cnblogs.com/dingxiaowei/p/3058779.html