1
0
kolibrios/programs/games/lines/basic_alg.inc
Kirill Lipatov (Leency) 36b358a358 Added games: donkey, invaders, piton, lines
git-svn-id: svn://kolibrios.org@950 a494cfbc-eb01-0410-851d-a64ba20cac60
2008-12-08 23:58:40 +00:00

128 lines
2.1 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;<EFBFBD><EFBFBD>Ž…„“<EFBFBD> <EFBFBD><EFBFBD>Ž<EFBFBD>Šˆ “™…Ž<EFBFBD>ˆŸ <EFBFBD>ˆ „Ž Š<EFBFBD>Ž<EFBFBD>Šˆ [dest] ¨§ EAX
test_path:
pushad
mov cx, [lineCoord + eax*2 - 4]
mov edx, eax
cmp eax, [current]
je .recurs_call
cmp eax, [dest]
je .end_yes
cmp byte [eax + lineBall - 2], 0
jne .end_no
or byte [eax + lineBall - 2], 0x8 ;4-© ¡¨â - 1 (cheked)
.recurs_call:
;â㯮© ¢ë§®¢ ¤«ï á®á¥¤­¨å ª«¥â®ª
test cl, cl
jz @F
sub eax, 9
call test_path
jc .end_yes
@@:
test cl, 8
jnz @F
mov eax, edx
add eax, 9
call test_path
jc .end_yes
@@:
test ch, ch
jz @F
mov eax, edx
dec eax
call test_path
jc .end_yes
@@:
test ch, 8
jnz .end_no
mov eax, edx
inc eax
call test_path
jc .end_yes
.end_no:
clc
popad
ret
.end_yes:
stc
popad
ret
;<EFBFBD><EFBFBD>Ž…„“<EFBFBD> <EFBFBD>ŽˆŠ€ <EFBFBD>ˆ ˆ<EFBFBD>ˆ ([dest] - ID ª­®¯ª¨ ¤«ï ¯®¨áª )
find_line:
mov dword [findRightLeft], 0 ;®¡­ã«ï¥¬ ­ ç «ì­ë¥ §­ ç¥­¨ï
mov eax, [dest]
add eax, lineBall - 2
mov dh, [eax]
mov [baseAddr], eax
or byte [eax], 0xF0
mov ecx, 8 ;¢ ecx - áç¥â稪
.cycle_find:
lea eax, [ecx*4 + ecx]
shl eax, 1 ;eax = ecx*10
mov edi, [eax + findTable - 4] ;edi - ªã¤ë § ¯¨á뢠âì १-âë
mov ebp, [eax + findTable - 8] ;ebp - ¯à¨¡ ¢«¥­¨¥  ¤à¥á 
mov bx, [eax + findTable - 10] ;bx - ¯à¨¡ ¢«¥­¨¥ ª®®à¤¨­ â
mov dl, cl
shl dl, 4
mov esi, [baseAddr]
mov eax, [dest]
mov ax, [eax*2 + lineCoord - 4]
.small_cycle_find:
add al, bh
cmp al, 8 ;¢ [0..8] ?
ja @F
add ah, bl
cmp ah, 8
ja @F
add esi, ebp
cmp byte [esi], dh
jne @F
or byte [esi], dl
inc byte [edi]
jmp .small_cycle_find
@@:
loop .cycle_find
ret
findRightLeft db ?
findUpRight_DownLeft db ?
findUpDown db ?
findUpLeft_DownRight db ?
findTable:
Up:
db -1, 0
dd -1, findUpDown
Down:
db +1, 0
dd +1, findUpDown
Left:
db 0, -1
dd -9, findRightLeft
Right:
db 0, +1
dd +9, findRightLeft
UpLeft:
db -1, -1
dd -10, findUpLeft_DownRight
DownRight:
db +1, +1
dd +10, findUpLeft_DownRight
UpRight:
db -1, +1
dd +8, findUpRight_DownLeft
DownLeft:
db +1, -1
dd -8, findUpRight_DownLeft