⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mwm.asm

📁 when enter different number from 1 to 8 the litte character on the screen can make different activ
💻 ASM
字号:
;**********
;the mvm.asm  by zhangyu
;----usage--
;when press a number from 1 to 8
;the litte character fairy can make different activities
;accompanied by 8 different voice!
;and the program will terminated 
;when you press the "enter " key
;**********
data segment
DAT DB 0, 45, 75, 100, 125, 157, 190, 222, 252
data ends
code segment
  assume cs:code,ds:data
start:
   mov ax,data
   mov ds,ax
   call clear
   call head
   call body
   call larm
   call rarm
   call leg
ch_a:
   sub ax,ax
   MOV AH,0h
   INT 16H
   cmp al,0dh  
   jz rexit   
   SUB AL,30H  
   MOV AH,0  
   MOV SI,AX
   MOV BX,OFFSET DAT
   XLAT  ;((bx)+(al))->(al)
   MOV DI,AX
   push ax
   mov al,0b6h;counter 2,mode 3,binary
   out 43h,al ;send it to reg
   pop ax
   MOV DX,12H    ;1.19318mhz/freq,time divisor
   MOV AX,34DCH
   DIV DI
   OUT 42H,AL ;send the low byte to counter2
   MOV AL,AH ;then the high byte
   OUT 42H,AL ;to couner2
   IN AL,61H ;get the current setting of port b
   mov ah,al ; save it
   OR AL,3  ;make pb0=1&pb1=1
   OUT 61H,AL ;turn the speaker on
delay:
   mov cx,2801 
del: loop del
     dec bx
     jnz delay
     mov al,ah  ;get the original setting of port b
     out 61h,al ;turn off the speaker
   
   mov ax,si
   add al,30h
   jz changing
    
changing:
   cmp al,31h
   jz change1
   cmp al,32h
   jz change2
   cmp al,33h
   jz change3
   cmp al,34h
   jz change4
    cmp al,35h
   jz change5
    cmp al,36h
   jz change6
   cmp al,37h
   jz change7
   cmp al,38h
   jz change8
   jmp exit
change1:
   call clear
   call head2
   call body
   call larm2
   call rarm
   call leg 
   jmp ch_a
change2:
  call clear
   call head
   call body2
   call larm
   call rarm
   call leg2
   jmp ch_a
change3:
   call clear
   call head2
   call body
   call larm
   call rarm
   call leg2
   jmp ch_a
 change4:
   call clear
   call head
   call body
   call larm
   call rarm2
   call leg
   jmp ch_a
change5:
   call clear
   call head
   call body2
   call larm
   call rarm2
   call leg2
   jmp ch_a
change6:
   call clear
   call head2
   call body
   call larm 
   call rarm2
   call leg2
   jmp ch_a
change7:
   call clear
   call head2
   call body2
   call larm2
   call rarm2
   call leg2
   jmp ch_a
change8:
   call clear
   call head
   call body
   call larm
   call rarm
   call leg
   jmp ch_a
exit:
   mov ah,01h
   int 21h
   cmp al,0dh
   jnz start
rexit: 
   mov ah,4ch
   int 21h
clear proc near
    mov ah,0h
    mov al,03h
    int 10h
    ret
clear endp

head proc near
;---the head
   mov ah,02h
   mov bh,0
   mov dh,2
   mov dl,7
   int 10h
   mov ah,09h
   mov al,01h;the character of smile face
   mov bh,00h
   mov bl,1eh;the chatacter's color,yellow
   mov cx,1
   int 10h
   ret
head endp

head2 proc near
;---the head2
   mov ah,02h
   mov bh,0
   mov dh,2
   mov dl,7
   int 10h
   mov ah,09h
   mov al,02h;
   mov bh,00h
   mov bl,1ch;red
   mov cx,1
   int 10h
   ret
head2 endp

body proc near
     ;---the body--
   mov ah,02h
   mov bh,0
   mov dh,3
   mov dl,7
   int 10h
   mov ah,09h
   mov al,0b2h
   mov bh,00h
   mov bl,1eh;yellow
   mov cx,1
   int 10h
     ret
body endp

body2 proc near
     ;---the body--
   mov ah,02h
   mov bh,0
   mov dh,3
   mov dl,7
   int 10h
   mov ah,09h
   mov al,0eh
   mov bh,00h
   mov bl,1fh;white
   mov cx,1
   int 10h
     ret
body2 endp

larm proc near
;----left arm
    mov ah,02h
   mov bh,0
   mov dh,3
   mov dl,6 ;left
   int 10h
   mov ah,09h
   mov al,0a9h
   mov bh,00h
   mov bl,1eh
   mov cx,1
   int 10h
     ret
larm endp

larm2 proc near
;----left arm
    mov ah,02h
   mov bh,0
   mov dh,3
   mov dl,6 ;left
   int 10h
   mov ah,09h
   mov al,2fh
   mov bh,00h
   mov bl,1dh;light magenta
   mov cx,1
   int 10h
     ret
larm2 endp

rarm proc near
     ;---right arm
    mov ah,02h
   mov bh,0
   mov dh,3
   mov dl,8;right
   int 10h
   mov ah,09h
   mov al,0aah
   mov bh,00h
   mov bl,1eh
   mov cx,1
   int 10h
     ret
rarm endp

rarm2 proc near
     ;---right arm
    mov ah,02h
   mov bh,0
   mov dh,3
   mov dl,8;right
   int 10h
   mov ah,09h
   mov al,5ch
   mov bh,00h
   mov bl,1ah;green
   mov cx,1
   int 10h
     ret
rarm2 endp

leg proc near
    ;------the legs
   mov ah,02h
   mov bh,0
   mov dh,4
   mov dl,7
   int 10h
   mov ah,09h
   mov al,0eah
   mov bh,00h
   mov bl,1eh
   mov cx,1
   int 10h
    ret
leg endp

leg2 proc near
    ;------the legs
   mov ah,02h
   mov bh,0
   mov dh,4
   mov dl,7
   int 10h
   mov ah,09h
   mov al,0e3h
   mov bh,00h
   mov bl,1bh ;cyan
   mov cx,1
   int 10h
    ret
leg2 endp
 code ends
     end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -