📄 graph.asm
字号:
setiom macro x,y,z,l,m,n
mov x,y
z l,m
int n
endm
pushr macro x,y,z,w
push x
push y
push z
push w
endm
popr macro x,y,z,w
pop w
pop z
pop y
pop x
endm
stacks segment
dw 256 dup(?)
stacks ends
data segment
string1 db 'I LOVE NATURE,LET US GO AIRING'
strlen1 equ $-string1
flower db 23
db 'w',0ah,0,0
db 'w',0ah,0,1
db 'w',0ah,0,1
db 'w',0ah,0,1
db 'w',0ah,0,1
db ')',0ah,1,0
db '_',0ah,0,-1
db '_',0ah,0,-1
db '_',0ah,0,-1
db '(',0ah,0,-1
db 'Y',0ah,1,2
db '|',06h,1,0
db '/',0ah,0,1
db '\',0ah,0,-2
db '|',06h,1,1
db '/',0ah,0,1
db '|',06h,1,-1
db '\',0ah,0,-1
db '|',06h,1,1
db '/',06h,0,1
db '/',06h,0,1
db '\',06h,0,-3
db '\',06h,0,-1
bird db 5
db 1ah,06h,0,0
db 1ah,06h,0,1
db 1ah,06h,1,0
db 1ah,06h,0,1
db 20h,00h,0,1
car db 8
db 23h,7,0,0
db 0b1h,7,0,1
db 0dbh,7,0,1
db 0dbh,7,0,1
db 4fh,7,1,0
db 4fh,7,0,-3
db 1,7,-2,1
db 20h,0,0,1
count dw 0
pointer dw 0
line db 0
column db 0
tree db 5,0ah
freq dw 196,220
dw 262,262,262,262,262,220,196
dw 262,262,262,262,294,262,220,262
dw 294,294,294,294,294,262,220
dw 294,294,294,294,330,294,330,392
dw 440,440,392,440,392,330
dw 294,294,330,294,262,220,196,220
dw 262,262,262,262,262,220
dw 262,196,220
dw 440,440,392,440,524,440
dw 392,392,392,440,392,330,294
dw 262,262,262,262,294
dw 330,330,294
dw 262,262,262,262,524,440
dw 392,392,392,440,392,330,392
dw 440,524,524,440,392
dw 392,330,392
dw 440,440,440,440,524,440
dw 392,392,392,440,392,330,294
dw 262,262,262,262,392
dw 330,330,294
dw 262,262,262,262,294,330
dw 392,392,330,392,330,392
dw 440
dw 9,9,196,660,294,294,262
dw 262,1
time dw 400,400
dw 400,200,400,400,800,400,400
dw 400,200,400,200,200,800,400,400
dw 400,200,400,400,800,400,400
dw 400,200,400,200,200,800,400,400
dw 400,800,400,800,400,400
dw 400,200,200,400,400,800,400,400
dw 400,200,400,400,800,800
dw 1600,800,800
dw 400,800,400,800,400,400
dw 400,400,400,400,800,400,400
dw 400,800,400,800,400,200
dw 2400,400,400
dw 400,800,400,800,400,400
dw 400,800,200,200,200,800,400,400
dw 400,800,400,800,800
dw 2400,400,400
dw 400,800,400,800,400,400
dw 400,800,200,200,800,400,400
dw 800,400,800,400,200
dw 2400,400,400
dw 400,800,400,800,400,400
dw 400,800,200,200,800,400,400
dw 400,800,400,800,800
dw 2400,400,400
dw 400,800,400,800,400,400
dw 400,800,400,800,400,400
dw 3200
dw 800,400,400,400,400,400,400
dw 4000
data ends
codes segment
assume cs:codes,ds:data,es:data,ss:stacks
start:
mov ax,data
mov ds,ax
mov es,ax
setiom ah,0,mov al,3,10h
call clear
call write1
call delay2
call clear
call movebird
call movecar
call music
call clear
mov ax,4c00h
int 21h
write1 proc
mov dx,0512h
call hua
mov dx,051bh
call hua
mov dx,052eh
call hua
pushr ax,bx,cx,dx
lea bp,string1
mov cx,strlen1
mov dx,0e13h
mov bh,0
mov bl,84h
setiom al,0,mov,ah,13h,10h
popr ax,bx,cx,dx
ret
write1 endp
movebird proc
call drawtree
call drawtre1
mov dx,063ch
call hua
lea si,bird
mov dx,1403h
pushr ax,bx,cx,dx
push si
xor ch,ch
mov cl,[si]
inc si
mov count,cx
mov pointer,si
mov line,dh
mov column,dl
nextb:
add dh,[si+2]
add dl,[di+3]
cmp dl,60h
jb writeb
pop si
popr ax,bx,cx,dx
ret
writeb:
mov ah,2
int 10h
mov al,[si]
mov bl,[si+1]
push cx
mov ah,9
mov cx,1
int 10h
pop cx
add si,4
loop nextb
call delay
call erasebird
jmp short nextb
movebird endp
erasebird proc
mov cx,count
mov si,pointer
mov dh,line
mov dl,column
LB:
add dh,[si+2]
mov ah,2
add dl,[si+3]
int 10h
mov al,[si]
mov bl,0
push cx
setiom ah,9,mov,cx,1,10h
pop cx
add si,4
loop LB
mov cx,count
mov si,pointer
cmp line,5h
ja subt
jmp ad
ad:
inc line
jmp move
subt:
sub line,2
move:
mov dh,line
inc column
mov dl,column
ret
erasebird endp
movecar proc
lea di,car
mov dx,1300h
pushr ax,bx,cx,dx
push di
xor ch,ch
mov cl,[di]
inc di
mov count,cx
mov pointer,di
mov line,dh
mov column,dl
nextc:
add dh,[di+2]
add dl,[di+3]
cmp dl,89
jb writec
pop di
popr ax,bx,cx,dx
ret
writec:
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov ah,9
mov cx,1
int 10h
pop cx
add di,4
loop nextc
call delay
call erasecar
jmp short nextc
movecar endp
erasecar proc
mov cx,count
mov di,pointer
mov dh,line
mov dl,column
ll:
add dh,[di+2]
mov ah,2
add dl,[di+3]
int 10h
mov al,[di]
mov bl,0
push cx
mov ah,9
mov cx,1
int 10h
pop cx
add di,4
loop ll
mov cx,count
mov di,pointer
mov dh,line
cmp dl,80
jae endl
inc column
mov dl,column
endl:
ret
erasecar endp
drawtree proc
pushr ax,bx,cx,dx
mov dx,1608h
mov cx,26
mov al,tree
mov bl,tree+1
tre:
mov ah,2
int 10h
push cx
setiom ah,9,mov,cx,1,10h
add dl,2
pop cx
loop tre
popr ax,bx,cx,dx
ret
drawtree endp
drawtre1 proc
pushr ax,bx,cx,dx
mov dx,1011h
mov cx,26h
mov al,tree
mov bl,tree+1
tre1:
mov ah,2
int 10h
push cx
setiom ah,9,mov,cx,1,10h
add dl,2
pop cx
loop tre1
popr ax,bx,cx,dx
ret
drawtre1 endp
hua proc
lea di,flower
pushr ax,bx,cx,dx
xor ch,ch
mov cl,[di]
inc di
nexth:
add dh,[di+2]
add dl,[di+3]
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov ah,9
mov cx,1
int 10h
pop cx
add di,4
loop nexth
popr ax,bx,cx,dx
ret
hua endp
music proc
pushr ax,bx,cx,dx
mov si,offset freq
mov di,offset time
l1:
mov cx,[si]
cmp cx,1
je exit
mov bx,[di]
push dx
mov al,0b6h
out 43h,al
mov dx,08h
mov ax,3208h
div cx
out 42h,al
mov al,ah
out 42h,al
in al,61h
mov ah,al
or al,3
out 61h,al
l2:
push dx
push ax
mov dx,8h
mov ax,0f05h
s1:
sub ax,1
sbb dx,0
jnz s1
pop ax
pop dx
dec bx
jnz l2
mov al,ah
out 61h,al
pop dx
add si,2
add di,2
jmp l1
exit:
popr ax,bx,cx,dx
ret
music endp
delay proc
pushr ax,bx,cx,dx
mov dx,7000
go:
mov cx,20000
repeat1:
loop repeat1
dec dx
jne go
popr ax,bx,cx,dx
ret
delay endp
delay2 proc
pushr ax,bx,cx,dx
mov dx,50000
go2:
mov cx,50000
repeat2:
loop repeat2
dec dx
jne go2
popr ax,bx,cx,dx
ret
delay2 endp
clear proc
pushr ax,bx,cx,dx
mov bh,7
mov dx,184fh
mov ax,0600h
mov cx,0
int 10h
popr ax,bx,cx,dx
ret
clear endp
codes ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -