assume cs:code,ds:data,ds:color,,ds:zuobiao,ss:sta
data segment
db' a '
db' a a '
db'a a'
db' a a '
db' a '
data ends
color segment
db 77 ;
color ends
zuobiao segment
db 5,3,1,3,5,7,9,7,5 ;最低点1 最高点9 中间点5
zuobiao ends
sta segment ;作废,懒得写了
db 16 dup (0)
sta ends
code segment
start:
mov ax,data
mov ds,ax
mov ax,color
mov es,ax
mov dl,es:[0]
mov ax,0b872h
mov es,ax
mov cx,5
mov bx,0
s:
push cx
mov cx,5
f:
mov al,[bx]
mov es:[di],al
inc bx
inc di
mov al,dl
mov es:[di],al
inc di
loop f
sub di,10
add di,160
pop cx
loop s
;以上为建图
;--------------------------
;以下为光标循环
mov ax,0;在栈内创建一个空间用来存 循环状态码
push ax
mov bp,sp
all:mov di,0
mov si,0
mov ax,zuobiao
mov ds,ax
mov ax,0
mov dx,0
half:mov cx,4
fo:
push cx
mov ah,0
mov al,ds:[si]
add di,ax
inc si
mov byte ptr es:[di],byte ptr 77h;变白
call de;延迟
mov byte ptr es:[di],byte ptr 77 ;回复
sub di,ax
mov cx,ss:[bp]
jcxz jia
sub di,160 ;第一次运行该循环add向下 第二次运行sub向上
hui:pop cx
loop fo
inc dx ;以除法取余判断单双次运行循环
mov ax,dx
mov dh,2
div dh
mov ss:[bp],ah
mov dh,0
mov cx,ss:[bp]
jcxz all ;循环运行两次后从头再来
jmp half ;循环第一次运行 从一半开始
mov ax,4c00h;作废
int 21h
jia:add di,160
jmp hui
de:
MOV BX,0FH
D1: MOV CX,0FFFFH
D2: LOOP D2
DEC BX
JNZ D1
ret
code ends
end start