簡體   English   中英

試圖在8086組裝中制作乒乓,並且角色不合格

[英]Trying to make pong in assembly 8086 and the characters are out of line

試圖制作乒乓球和角色都不合適。

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.

代碼還沒有完成,所以什么都沒有。

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

導致梯形圖。 在每個換行符后放置backspace char可能有效:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM