试图在程序集 8086 中制作 pong,但字符不一致
Trying to make pong in assembly 8086 and the characters are out of line
正在尝试打乒乓球,字符不对。
; 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, "$"
导致梯形图。
在每个换行符之后放置退格字符可能会起作用:
player1 db ""
db 10,8, ""
db 10,8, "$"
正在尝试打乒乓球,字符不对。
; 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, "$"
导致梯形图。 在每个换行符之后放置退格字符可能会起作用:
player1 db ""
db 10,8, ""
db 10,8, "$"