我刚刚开始制作用于翻转纸牌游戏的大学项目, 使用emu8086.com的模拟器
可悲的是,我被困在这么早的统计数据上。不知何故无法弄清楚什么是错的。
使用JZ或JE的跳转,如果我在2个相等的值上使用cmp,它应该有效,但它不起作用。
什么都没发生!mov ah,1
int 21h
cmp al,1 or cmp al,'1'
JE or JZ Card1
但无论我写什么都不跳,
我的完整代码:
include "emu8086.inc"
; multi-segment executable file template.
data segment
; add your data here!
pkey db "press any key...$"
data_error dw "input error.... $"
datar db 0 ;row
datac db 0 ;cloumn
datacard db '1','2','3','4','5','6','7','8','9'
data1 dw ?
data2 dw ?
dataf dw "False $"
endapp dw "END GAME.... $"
datat dw "True $"
datas db '0'
score dw "Score : $"
x db ?
y db ?
a db '0','0','0','0','0','0','0','0'
data3 db 'D','B','A','O','C','C','A','B','D'
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
GOTOXY 25,0
;PRINT 'Wellcom to My Flipping Game !?!'
GOTOXY 10, 5
mov si,offset data3
PUTC [si]
GOTOXY 15, 5
inc si
PUTC [si]
GOTOXY 20, 5
inc si
PUTC [si]
GOTOXY 10, 8
inc si
PUTC [si]
GOTOXY 15, 8
inc si
PUTC [si]
GOTOXY 20, 8
inc si
PUTC [si]
GOTOXY 10, 11
inc si
PUTC [si]
GOTOXY 15, 11
inc si
PUTC [si]
GOTOXY 20, 11
inc si
PUTC [si]
GOTOXY 10, 5
mov si,offset datacard
PUTC [si]
GOTOXY 15, 5
inc si
PUTC [si]
GOTOXY 20, 5
inc si
PUTC [si]
GOTOXY 10, 8
inc si
PUTC [si]
GOTOXY 15, 8
inc si
PUTC [si]
GOTOXY 20, 8
inc si
PUTC [si]
GOTOXY 10, 11
inc si
PUTC [si]
GOTOXY 15, 11
inc si
PUTC [si]
GOTOXY 20, 11
inc si
PUTC [si]
GOTOXY 25, 15
Print 'Enter your Selection : '
mov ah,1
int 21h
mov ah,al
cmp ah,1
JZ card1
cmp ah,2
JE card2
cmp ah,3
JE card3
cmp ah,4
JE card4
cmp ah,5
JE card5
cmp ah,6
JE card6
cmp ah,7
JE card7
cmp ah,8
JE card8
cmp ah,9
JE card9
JMP deadend
card1 :
GOTOXY 10, 5
mov si,offset data3
PUTC [si]
JMP deadend
card2 :
GOTOXY 15, 5
mov si,offset data3
inc si
PUTC [si]
JMP deadend
card3 :
GOTOXY 20, 5
mov si,offset data3
inc si
inc si
PUTC [si]
JMP deadend
card4 :
mov si,offset data3
inc si
inc si
inc si
PUTC [si]
JMP deadend
card5 :
mov si,offset data3
inc si
inc si
inc si
inc si
PUTC [si]
JMP deadend
card6 :
mov si,offset data3
inc si
inc si
inc si
inc si
inc si
PUTC [si]
JMP deadend
card7 :
mov si,offset data3
inc si
inc si
inc si
inc si
inc si
inc si
PUTC [si]
JMP deadend
card8 :
mov si,offset data3
inc si
inc si
inc si
inc si
inc si
inc si
inc si
PUTC [si]
JMP deadend
card9 :
mov si,offset data3
inc si
inc si
inc si
inc si
inc si
inc si
inc si
inc si
PUTC [si]
JMP deadend
deadend:
lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
我将示例代码留在我的代码中的模拟器中创建一个新文件,稍后将删除它们。
你知道我把AL放入AH并使用它,因为我无法想象什么是错的, 但是当我在cmp中使用AL本身时它无法正常工作 没有JE / JZ的跳跃工作,只有JMP工作。TNX。
答案 0 :(得分:0)
修正了它,相当愚蠢,
问题只是我之前放了一个空间:我的标签!洛尔
像
card1 :
.....应该是
card1:
我还改回了我的代码,将AL用于所有内容,并将''放在数字上。