i just start on making my project for university for flipping card game, using emulator from emu8086.com
sadly i got stuck on such a early stat .
somehow can't quite figure out whats wrong .
the jump using JZ or JE , should work if i use cmp on 2 equal value , but it is not working .
nothing happening ! i used
mov ah,1
int 21h
cmp al,1 or cmp al,'1'
JE or JZ Card1
but it is not jumping no matter what i write ,
my full code :
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.
i left the sample codes from making a new file in emulator in my code , will remove them later.
u see i put AL into AH and used it too , just coz i couldn't figure whats wrong , but it didn't work when i used AL itself in cmp either
non of the JE / JZ jumps work , only the JMP one work .
Tnx.
Fixed it , Quite Silly ,
The Problem was just that i was puting an space before : of my lable ! lol
like
card1 :
..... while it should have been
card1:
i also change back my code to use AL for everything , and put ' ' on the numbers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.