试图在8086组装中制作乒乓,并且角色不合格

时间:2015-02-25 15:23:00

标签: assembly x86-16

尝试制作乒乓球并且角色不合适。

http://prntscr.com/69nyg8

; multi-segment executable file template.

data segment
    ; add your data here!
    game db        "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±";0
         db 10,13, "                                           ";1
         db 10,13, "                                           ";2
         db 10,13, "                                           ";3
         db 10,13, "                                           ";4
         db 10,13, "                                           ";5
         db 10,13, "                                           ";6
         db 10,13, "                                           ";7
         db 10,13, "                                           ";8
         db 10,13, "                                           ";9
         db 10,13, "                                           ";A
         db 10,13, "                                           ";B
         db 10,13, "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±";C
         db 10,13, "Player1:                         Player2: $";D 
                   ;0123456789ABCDEF        18   

     player1 db        ""       
             db 10,    ""
             db 10,    "$"

     player2 db        "" 
             db 10,    "" 
             db 10,    "$"

     ball db "*$"

      Menu db        "  _____                     " 
           db 10,13, " |  __ \                    " 
           db 10,13, " | |__) |___   _ __    __ _ " 
           db 10,13, " |  ___// _ \ | '_ \  / _` |" 
           db 10,13, " | |   | (_) || | | || (_| |" 
           db 10,13, " |_|    \___/ |_| |_| \__, |" 
           db 10,13, "                       __/ |" 
           db 10,13, "                      |___/ " 
           db 10,13, "Click HERE to start         "                             
           db 10,13, "Player1:W -UP               "
           db 10,13, "        S -DOWN             "
           db 10,13, "Player2: ON NUMPAD          "
           db 10,13, "        8 -UP               "
           db 10,13, "        2 -DOWB            $"







     player1Score db 0

     player2Score db 0

     ballx db 0Ch

     bally db 06h

     player1Y db 6

     player2Y db 6          

     xstart dw 2Fh          
     xFinal dw 4Dh
     ystart dw 40h
     yfinal dw 46h          



ends              


stack segment
    dw   128  dup(0)
ends

code segment
start:
; set segment registers:
    mov ax, data
    mov ds, ax
    mov es, ax
    mov ch,32;removes cursor
    mov ah,1h
    int 10h

    enu:
         mov ah,9
         lea dx,Menu
         int 21h
    mouse:
         mov ax,3
         int 33h
         cmp bx,1
         je checkPos
         jmp mouse     


    fresh:;prints new game


       mov al,3h
       mov ah,0
       int 10h

          mov ah,9
          lea dx,game
          int 21h 

          mov bh,0
          mov dh,player1Y
          mov dl,03h
          mov ah,2
          int 10h

          mov ah,9
          lea dx,player1
          int 21h

          mov bh,0
          mov dh,player2Y
          mov dl,25h
          mov ah,02h
          int 10h

          mov ah,9
          lea dx,player2
          int 21h







    mov ax, 4c00h ; exit to operating system.
    int 21h    


       mov al,12h
       mov ah,0
       int 10h


    ;  Input:
    ;  mov ah,7
    ;  int 21h
    ;  cmp al,'w'
    ;  je inc             
    ;  cmp al,'s'
    ;  je down
    ;  cmp al,'8'
    ;  je right
    ;  cmp al,'2'
    ;  je left
    ;  jmp firstInput 
    ;  
    ;  checkWall:
    ;
    ;  downRight:
    ;  inc ballY
    ;  inc ballX


    checkPos:
    mov ax,xstart
    cmp cx,ax
    jl mouse
    mov ax,xfinal
    cmp cx,ax
    jg mouse
    mov ax,yfinal
    cmp dx,ax
    jg Mouse
    mov ax,ystart
    cmp dx,ax
    jl mouse
    jmp fresh


ends

end start ; set entry point and stop the assembler.

代码尚未完成,因此基本上没有。

1 个答案:

答案 0 :(得分:0)

player1 db        ""       
         db 10,    ""
         db 10,    "$"

导致梯形图。 在每个换行符后放置退格键可能有效:

player1 db        ""       
         db 10,8,    ""
         db 10,8,    "$"