📄 wyd.asm
字号:
Disp macro op0,op1,op2,op3,op4,op5
mov al,op0
mov ah,6
mov ch,op1
mov cl,op2
mov dh,op3
mov dl,op4
mov bh,op5
int 10h
endm
stack segment para
db 100 dup('stack...')
stack ends
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
data segment
char db 7
db 52h,70h,0,0
db 0b1h,70h,0,1
db 0dbh,7,0,1
db 0dbh,7,1,0
db 04fh,7,1,0
db 04fh,7,0,-3
db 2,7,-2,1
pointer dw ?
line_on db ?
col_on db ?
flag db 0
cout dw 150
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
mus_freq dw 5 dup(523),587,659,784,784,784,659,784
dw 880,659,659,659,587,587,659,659,22000,659,587
dw 523,440,440,440,659,587,523,440,440,440,440,523
dw 4 dup(587),659,587,784
dw 5 dup(523),587,659,784,784,784,659,784
dw 880,659,659,659,659,587,587,659,659,22000,659,587
dw 523,440,440,440,659,587,523,440,440,440,440,523
dw 587,587,587,587,587,392,440,440
dw 880,880,880,880,659,784,784,784,784,659,587
dw 523,523,523,587,523,659
dw 880,880,880,880,988,880,784,784,784,659,784
dw 880,659,587,523,784,784,22000
dw 5 dup(523),587,659,784,784,784,659,784
dw 880,659,659,659,587,587,659,659,22000,659,587
dw 523,440,440,440,659,587,523,440,440,440,440,523
dw 5 dup(587),392,440
dw 659,587,523,440,440,440,659,587,523,440,440
dw 440,440,523,5 dup(587),784,880,880,-1
mus_time dw 50,75,50,75,50,50,75,50,50,75,50,50
dw 75,6 dup(50),125,75,50,50
dw 75,50,50,75,50,50,75,50,50,75,50,50
dw 50,75,50,50,50,75,225
dw 50,75,50,75,50,50,75,50,50,75,50,50
dw 8 dup(50),125,75,50,50
dw 4 dup(75,50,50)
dw 4 dup(50),75,50,50,225
dw 50,75,50,75,3 dup(75,50),50
dw 75,75,50,75,50,225
dw 50,75,50,75,3 dup(75,50),50
dw 75,75,75,50,50,125,125
dw 50,75,50,75,50,50,75,50,50,75,50,50
dw 75,6 dup(50),125,75,50,50
dw 4 dup(75,50,50)
dw 50,50,50,50,75,75,225
dw 50,50
dw 3 dup(75,50,50)
dw 75,6 dup(50),75,75,125,125
leng dw $-mus_time
choose db 1
save_si dw 0
save_cx dw 0
save_al db 0
data ends
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
code segment
assume cs:code,ds:data,es:data
main proc far
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov al,1ch
mov ah,35h
int 21h
push es
push bx
push ds
mov dx,offset music
mov ax,seg music
mov ds,ax
mov al,1ch
mov ah,25h
int 21h
pop ds
sti
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
call clear_screen
Disp 0,6,0,18,79,70
mov cx,1000h
mov ah,1
int 10h
lea di,char
mov dh,12
mov dl,20
call move_shape
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
pop dx
pop ds
mov al,1ch
mov ah,25h
int 21h
mov ax,4c00h
int 21h
main endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
move_shape proc near
push ax
push bx
push cx
push dx
push di
push si
mov ah,0fh
int 10h
sub ch,ch
mov cl,[di]
inc di
mov pointer,di
mov line_on,dh
mov col_on,dl
jude:
cmp dl,15
jnz n1
mov flag,0
shr cout,1
n1: cmp dl,60
jnz l1
mov flag,1
l1:
call display
mov bx,cout
call delay
call erase
mov ah,0bh
int 21h
inc al
jnz short jude
exit:
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
move_shape endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
display proc near
push cx
plot_next:
add dh,[di+2]
cmp flag,0
jz dis
sub dl,[di+3]
jmp dnext
dis: add dl,[di+3]
dnext: mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,09
int 10h
pop cx
add di,4
loop plot_next
pop cx
ret
display endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
erase proc near
push cx
mov di,pointer
mov dh,line_on
mov dl,col_on
erase_next:
add dh,[di+2]
cmp flag,0
jz er1
sub dl,[di+3]
jmp enext
er1: add dl,[di+3]
enext: mov ah,2
int 10h
mov al,0
mov bl,0
push cx
mov cx,1
mov ah,9
int 10h
pop cx
add di,4
loop erase_next
mov di,pointer
mov dh,line_on
cmp flag,0
jz er2
dec col_on
jmp enext2
er2: inc col_on
enext2: mov dl,col_on
pop cx
ret
erase endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
delay proc near
push cx
push bx
back: mov cx,500
call waitf
dec bx
jnz back
pop bx
pop cx
ret
delay endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
waitf proc near
push ax
waitf1:
in al,61h
and al,10h
cmp al,ah
je waitf1
mov ah,al
loop waitf1
pop ax
ret
waitf endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
music proc near
push ax
push bx
push cx
push dx
push si
push di
mov ax,data
mov ds,ax
sti
mov al,choose
cmp al,1
je ring
cmp al,2
je delay_t
cmp al,3
je stop
ring:
mov choose,2
mov si,save_si
mov di,mus_freq[si]
cmp di,0
jz delay_t
mov al,0b6h
out 43h,al
mov dx,12h
mov ax,348ch
div di
out 42h,al
mov al,ah
out 42h,al
in al,61h
mov save_al,al
or al,3
out 61h,al
mov cx,mus_time[si]
mov save_cx,cx
jmp the_end
delay_t:
sub save_cx,8
cmp save_cx,12
ja the_end
mov choose,3
jmp the_end
stop:
mov choose,1
mov al,save_al
out 61h,al
add save_si,2
mov bx,save_si
cmp bx,leng
jb the_end
mov save_si,0
the_end:
cli
pop di
pop si
pop dx
pop cx
pop bx
pop ax
iret
music endp
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
clear_screen proc near
push ax
push bx
push cx
push dx
mov al,0
mov ah,6
mov cx,0
mov bh,14h
mov dh,24
mov dl,79
int 10h
pop dx
pop cx
pop bx
pop ax
ret
clear_screen endp
code ends
end main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -