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

📄 jimmy.asm

📁 课程设计大炮打飞机!简易!
💻 ASM
字号:
.model medium
.386
.stack 200h
data	segment
string1 db 'welcome to this game!',13,10,'$'
string2 db 'do you want to have a try?',13,10,'$'
string3 db 'yes/no',13,10,'$'
string4 db 'please select a suitable level of game for yourself!',13,10,'$'
string5 db '1.easy',13,10,'$'
string6 db '2.normal',13,10,'$'
string7 db '3.hard',13,10,'$'
string8 db 'if you did not have made a decision,you may:return!',13,10,'$'
string9 db 'score:',13,10,'$'
string10 db 'time:',13,10,'$'
string11 db 'fires:',13,10,'$'
string12 db 'do not worry,come on!',13,10,'$'
length dw ?
flag dw 0
time dw 0
fires dw 0
score dw 0
data	ends
code	segment
 ;****************************************
assume cs:code,ds:data
;defining and using macros
;**************************
show_string macro s,l,a
        mov al,2
        mov ah,0
        int 10h
        mov bp,seg s
        mov es,bp
        mov bp,offset s
        mov cx,l
        mov dx,a
        mov bl,07h
        mov al,1
        mov ah,13h
        int 10h
        endm
;game!
;**************************
input1 proc near
         pusha
get_key: mov ah,07h
         int 21h
         cmp al,'y'
         je yes
         cmp al,'n'
         je no
         jmp get_key
no:      mov ax,1
         mov flag,ax
yes:     popa
         ret
input1 endp
;*************************************
input2 proc near
        pusha
get_key1:mov ah,07h 
        int 21h
        cmp al,'1'
        je easy
        cmp al,'2'
        je normal
        cmp al,'3'
        je hard
        cmp al,'r'
        je return
        jmp get_key1
easy:   mov time,200
        mov sum,20
        ;_____________________________________
        jmp exit
normal: mov time,100
        mov sum,15
        ;___________________________________
        jmp exit
hard:   mov time,50
        mov sum,10
        ;__________________________________
        jmp exit
return: mov ax,1
        mov flag,ax
exit:   popa
        ret
input2 endp
;**********************************
clear_screen proc near
        pusha
        mov ax,0600h
        mov bh,07h
        mov cx,0
        mov dx,184fh
        int 10h
        popa
        ret
clear_screen endp
;******************************
playing_game proc near
        pusha
        call clear_screen
        xor bi,bi
        mov si,39
again:  mov ah,2
        mov bh,0
        mov dh,1
        mov dl,bi
        int 10h
        mov ah,9
        mov al,'+'
        mov bh,0
        mov bl,7
        mov cx,1
        int 10h
        mov ah,2
        mov bh,0
        mov dh,24
        mov dl,si
        int 10h
        mov ah,9
        mov al,'A'
        mov bh,0
        mov bl,7
        mov cx,1
        int 10h
        mov dl,0ffh
        mov ah,6
        int 21h
        jz next
        cmp al,'<'
        je left
        cmp al,'>'
        je right
        cmp al,0dh
        je fire
        jmp next
  fire: ;************************
        push bx
        mov bx,fires
        dec bx
        mov fires,bx
        pop bx
        jmp next
       ;**************************
  left: cmp si,10
        je a1
        dec si
    a1: jmp next
 right: cmp si,70
        je a2
        inc si
    a2: jmp next
  next: push cx
        mov cx,time
        dec cx
        jz exit
        mov time,cx
        pop cx
        push cx
        mov cx,fires
        cmp cx,0
        jz exit1
        mov fires,cx
        pop cx
        inc bi
        cmp bi,80
        jbe again
        mov bi,0
        jmp again
 exit1: popa
        ret
playing_game endp
;****************************************
main proc near
again1: call clear_screen
       mov ax,string2-string1
       mov length,ax
       show_string string1,length,0818h
       mov ax,string3-string2
       mov length,ax
       show_string string2,length,1018h
       mov ax,string4-string3
       mov length,ax
       show_string string3,length,1120h
       call input1
       mov bx,flag
       cmp bx,1
       je exit2
       call clear_screen
       mov ax,string5-string4
       mov length,ax
       show_string string4,length,0818h
       mov ax,string6-string5
       mov length,ax
       show_string string5,length,0918h
       mov ax,string7-string6
       mov length,ax
       show_string string6,length,0a18h
       mov ax,string8-string7
       mov length,ax
       show_string string7,length,0b18h
       mov ax,string9-string8
       mov length,ax
       show_string string8,length,0c18h
       call input2
       mov bx,flag
       cmp bx,1
       je again1
       call playing_game
       mov cx,score
       cmp cx,5
       jbe s1
       ;_____________________________________
       ;____________________________________
       ;_____________________________________
s1:    mov ax,length-string12
       mov length,ax
       show_string string12,length,0c20h
wait:  mov ah,7
       int 21h
       cmp al,0dh
       jne wait
exit2:  mov ax,4c00h
       int 21h
main  endp
code	ends
       end

⌨️ 快捷键说明

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