i wrote a code and when i run it normally it doesnt work but when i run it with turbo debugger it works does anyone has any idea what i can do for it to work please?
i dont know if the code is needed but ill put it anyways
please i really need help
the main proc
proc aliensShot
pusha
cmp [AshotFired],1
je dontShoot ;a shot is already in the air
mov [AshotFired],1
call random ;roll random row and col in the array
call checkAlienAlive ;check if the alien rolled is alive
call alienShootFrom ;find the location on screen of the alien according to the row and col
dontShoot:
call AshotMovement ;shoot
popa
ret
endp aliensShot
proc random
pusha
roll:
mov ax, 40h
mov es, ax
mov ax, [es:6Ch]
and al, 00001111b
cmp al,4
ja roll
mov ah,0
mov [row],ax
roll1:
mov ax, 40h
mov es, ax
mov ax, [es:6Ch]
and al, 00001111b
cmp al,9
ja roll1
mov ah,0
mov [col],ax
popa
ret
endp random
proc checkAlienAlive
pusha
checkAgain:
mov ah,0
mov al,10
mul [row] ;ax = row *10
add ax,[col]
mov si,ax ;si = row *10 + col
cmp [aliensLifes+si],0
je rollAgain
jmp okShoot
rollAgain:
call random
jmp checkAgain
okShoot:
popa
ret
endp checkAlienAlive
proc alienShootFrom
pusha
mov ax,25
mul [col] ;ax=col*width
add ax,[xA0]
add ax,6
mov [xAS],ax ;x of shot= alienX0 + colInArr * alienWidth
mov ax,16
inc [row]
mul [row] ;ax=row*heigth
add ax,[yA0]
mov [yAS],ax ;y of shot= alienY0 + rowInArr * alienheigth
popa
ret
endp alienShootFrom
proc alienShootFrom
pusha
mov ax,25
mul [col] ;ax=col*width
add ax,[xA0]
add ax,6
mov [xAS],ax ;x of shot= alienX0 + colInArr * alienWidth
mov ax,16
inc [row]
mul [row] ;ax=row*heigth
add ax,[yA0]
mov [yAS],ax ;y of shot= alienY0 + rowInArr * alienheigth
popa
ret
endp alienShootFrom
proc AshotMovement
cmp [yAS],200
je resetAShot
; check if shot hit something
call checkHit2
cmp [hitObject],3
je resetAShot
cmp [hitObject],2
je resetAShot
mov si, offset Ashot
push cx
push [yAS]
call printAShot
pop [yAS]
add [yAS],4
pop cx
jmp exitAShotMovement
resetAShot:
mov [AshotFired],0
mov [AdeleteShot],1
call printAShot
mov [AdeleteShot],0
push [y0S]
pop [yS]
exitAShotMovement:
ret
endp AshotMovement
i tried to check it on debugger step by step and it work every time when i tried to run it without td it didnt work, i tried to isolate every proc and each one worked properly on its own
New contributor
Kim Strugo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.