Flags added

This commit is contained in:
José Carlos Cuevas 2020-06-08 22:21:36 +02:00
parent 06931bb440
commit bbb3e4d7e4

View file

@ -95,6 +95,7 @@ iscovered:
ret
isflagged:
mov bx, flagbmp ; Point to the flag bitmap
ret
mine:
mov bx, minebmp ; Point to the mine cell
ret
@ -416,20 +417,20 @@ lalt:
cmp ax, [lastkeypressed]
je mainloop
mov [lastkeypressed], ax
mov ah,02
mov dl,38h
int 21h
jmp mainloop
mov ax, [cursorx]
mov cx, [cursory]
call setflag
jmp redraw
uncover:
getoffset:
cmp ax, COLUMNS ;If we are out of bounds, return
jl checky
ret
checky:
cmp cx, LINES
jl uncoverinbounds
jl inbounds
ret
uncoverinbounds:
inbounds:
push ax ;Calculate offset
mov ax, cx
mov cx, COLUMNS
@ -441,11 +442,21 @@ uncoverinbounds:
mul cx
mov bx, map
add bx, ax
ret
uncover:
call getoffset
mov dx, word [ds:bx] ;Read
mov dh, 00h ;Set upperbit as 0
mov word [ds:bx], dx
ret
setflag:
call getoffset
mov dx, word [ds:bx] ;Read
mov dh, 02h ;Set upperbit as 0
mov word [ds:bx], dx
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Data segment