1

I'm creating a maze game in emu8086, but I have a problem. The asterisk is the character and the "1" are the walls. How to validate if the asterisk is positioned on "1"?, the validation should do that when I move the arrow left , right, up or down, if there a 1, do nothing, if not there a 1 in that position, to move through the maze normally. Something, but not how.

dario
  • 5,149
  • 12
  • 28
  • 32
alex22596
  • 13
  • 4
  • 4
    Please provide some more information, code or the likes. It is difficult to help without more information. – tmr232 May 30 '15 at 13:53

1 Answers1

1

From your info I understand that you are working with the text video mode.
Logically the cursor will be where your asterisk * is shown.

When your program receives a movement command you first reposition the cursor to this new position. There you read from the screen, and depending on that information you either leave the cursor at its new position (if there's no wall) or you restore the position to where it was before (if there's a wall).

; Here you remove the "*" by putting a space character.
; Here you reposition the cursor depending movement command

 mov bh, 0
 mov ah, 03h
 int 10h
 mov [SavedCursor], dx
 mov bh, 0
 mov ah, 08h
 int 10h
 cmp al, "1"
 jne NoWall  
 mov dx, [SavedCursor]
 mov bh, 0
 mov ah, 02h
 int 10h
NoWall:

; Here you display the "*"
Sep Roland
  • 33,889
  • 7
  • 43
  • 76