Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
; SQ_game for MenuetOS
; Author: Alexei Ershov aka ealex
; E-mail: e-al[at]yandex[dot]ru
; Fidonet: 2:469/335.38
2018-09-16 11:42:32 +02:00
; slightly updated by leency and renamed to Lights
; https://en.wikipedia.org/wiki/Lights_Out_(game)
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
; slightly optimized by diamond
; english translation by diamond (two strings in end of source)
2018-09-16 11:42:32 +02:00
BtnSize equ 36 ; ࠧ<> <E0A0A7> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
BtnSpace equ 0 ; <20> <EFBFBD> <E0AEAC> <EFBFBD> ⮪ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
NofBtn equ 4 ; ࠧ<> <E0A0A7> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> (3-15)
Color1 equ 0xcc0000
Color2 equ 0x00cc00
FieldSize = ( BtnSize + BtnSpace ) * NofBtn + BtnSpace * 3
center = FieldSize / 2
2018-09-16 11:42:32 +02:00
margin = 20
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
use32 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 32-<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ० <> <E0A5A6> <20> <> ᥬ<EFBFBD> <E1A5AC> <EFBFBD> <EFBFBD> <EFBFBD>
org 0x0 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD>
db 'MENUET01' ; 8-<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 䨪<EFBFBD> <E4A8AA> <EFBFBD> <EFBFBD> MenuetOS
dd 0x01 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (<28> ᥣ<EFBFBD> <E1A5A3> 1)
dd START ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> ࢮ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
dd I_END ; ࠧ<> <E0A0A7> <EFBFBD> <20> ணࠬ<E0AEA3> <E0A0AC>
dd 0x1000 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ⢮ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
dd 0x1000 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> 設<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
dd 0x0 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> ࠬ<EFBFBD> <E0A0AC> (<28> <> <20> ᯮ<EFBFBD> <E1AFAE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )
dd 0x0 ; <20> <> १<EFBFBD> ࢨ<E0A2A8> <E0AEA2> <EFBFBD>
2018-09-16 11:42:32 +02:00
include '../../../macros.inc' ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> ᥬ<EFBFBD> <E1A5AC> <EFBFBD> <EFBFBD> 騪<EFBFBD> <E9A8AA> !
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
START:
call Game_Init
red:
call Draw_Window
still:
mcall 10 ; <20> 㭪<EFBFBD> <E3ADAA> <EFBFBD> 10 - <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ᮡ<> <E1AEA1> <EFBFBD> <EFBFBD>
dec eax
jz red
dec eax
jnz button
key: ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
mov al , 2
int 0x40
jmp still
;---------------------------------------------------------------------
button:
mov al , 17 ; 17 - <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 䨪<EFBFBD> <E4A8AA> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> ⮩ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
int 0x40
cmp ah , 1 ; <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> 1, <20> <> 室<EFBFBD> <E5AEA4>
je .exit
cmp ah , 2 ; <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 2, <20> <> 稭<EFBFBD> <E7A8AD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
je START
; <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD>
inc dword [ moves ] ; 㢥<> <E3A2A5> 稢<EFBFBD> <E7A8A2> <EFBFBD> <20> <> 室<> <E5AEA4>
shr eax , 8 ; <20> eax <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 䨪<EFBFBD> <E4A8AA> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> ⮩ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
mov dh , NofBtn
div dh ; al = ax(<28> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ) / NofBtn
; ah = <20> <> <EFBFBD> <EFBFBD> ⮪ (<28> <> . <20> <> <EFBFBD> 㭮<EFBFBD> )
mov ebx , eax ; <20> <> <EFBFBD> ࠭<EFBFBD> <E0A0AD> <20> <> <EFBFBD> ⭮<EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> ⮪ <20> ebx
; al\ah 0 1 2 3
; +-+ +-+ +-+ +-+
; 1 |4| |5| |6| |7|
; +-+ +-+ +-+ +-+
; +-+ +-+ +-+ +-+
; 2 |8| |9| |10 |11
; +-+ +-+ +-+ +-+
; +-+ +-+ +-+ +-+
; 3 |12 |13 |14 |15
; +-+ +-+ +-+ +-+
; +-+ +-+ +-+ +-+
; 4 |16 |17 |18 |19
; +-+ +-+ +-+ +-+
; <20> <> <EFBFBD> 塞 梥<> <20> ⮫<EFBFBD> <E2AEAB> <EFBFBD> <EFBFBD>
shr eax , 8 ; eax = ah
mov edi , field
add edi , eax ; edi 㪠<> <E3AAA0> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <EFBFBD> <E1AAAE> <EFBFBD> <20> ⫡<EFBFBD> <E2ABA1>
mov ecx , NofBtn
@ @ :
not byte [ edi ] ; <20> <> <EFBFBD> 塞 梥<> <20> <> <20> ᥬ <20> ⮫<EFBFBD> <E2AEAB> <EFBFBD> <EFBFBD>
dec ecx
add edi , NofBtn
test ecx , ecx
jnz @ r
; <20> <> <EFBFBD> 塞 梥<> <20> <> ப<EFBFBD>
mov eax , ebx ; <20> <> <EFBFBD> <EFBFBD> ⠭<EFBFBD> <E2A0AD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> eax
dec eax
mov dl , NofBtn
mul dl ; ax = al * NofBtn
mov edi , field
add edi , eax ; edi 㪠<> <E3AAA0> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <EFBFBD> <E1AAAE> <EFBFBD> <20> <> ப<EFBFBD>
mov ecx , NofBtn
@ @ :
not byte [ edi ] ; <20> <> <EFBFBD> 塞 梥<> <20> <> <20> ᥩ <20> <> ப<EFBFBD>
dec ecx
inc edi
test ecx , ecx
jnz @ r
; <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> ⮩ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 2 ࠧ<> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> ࠡ<EFBFBD> <E0A0A1> 뢠<EFBFBD> <EBA2A0> <20> <> ப<EFBFBD> <20> <20> ⮫<EFBFBD> <E2AEAB> <EFBFBD> ),
; <20> .<2E> . <20> <> ⠫<EFBFBD> <E2A0AB> <20> <> ࢮ<EFBFBD> <E0A2AE> 砫<EFBFBD> <E7A0AB> <EFBFBD>
; <20> <> <EFBFBD> 塞 梥<> <20> <> <EFBFBD> <EFBFBD> ⮩ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
shr ebx , 8 ; ebx = <20> <> <EFBFBD> <EFBFBD> ⮪ (ah <20> <> <20> <> <EFBFBD> 㭪<EFBFBD> )
not byte [ field + eax + ebx ]
jmp red
.exit:
mcall - 1 ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> ணࠬ<E0AEA3> <E0A0AC>
;----------------------------------------------------------------------------
; Draw_Window
;----------------------------------------------------------------------------
Draw_Window:
mcall 12 , 1
2018-09-16 11:42:32 +02:00
mcall 0 , 200 * 65536 + FieldSize + margin * 2 , \
2 0 0 * 6 5 5 3 6 + FieldSize + 28 + margin * 3 , \
0 x14DDD7CF , 0x805080D0 , header
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
2018-09-16 11:42:32 +02:00
mcall 8 , ( BtnSpace * 2 + margin ) * 65536 + 83 , \
( FieldSize + BtnSpace + margin * 2 + 10 ) * 65536 + 22 , 2
mcall 4 , ( BtnSpace * 2 + 3 + margin ) * 65536 + ( FieldSize + BtnSpace + margin * 2 ) + 14 , \
0 x90DDEEFF , strNew
mcall 4 , ( center - 25 + margin ) * 65536 + 30 , 0x80000000 , strMovs
mcall 47 , 4 * 65536 + 1 , moves , ( center + 2 + margin ) * 65536 + 30 , 0
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
mov ecx , ( 20 + 20 + BtnSpace - BtnSize ) * 65536 + BtnSize
mov edx , NofBtn ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 䨪<EFBFBD> <E4A8AA> <EFBFBD> <EFBFBD> <20> <> ࢮ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD>
; <20> <> <20> <> <EFBFBD> 㭮<EFBFBD>
buttons: ; <20> <> <EFBFBD> 㥬 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 窨
mov eax , edx
mov dh , NofBtn
div dh ; al = ax / dh, ah - <20> <> <EFBFBD> <EFBFBD> ⮪
mov dh , 0
test ah , ah ; <20> ah = 0, <20> <> 稭<EFBFBD> <E7A8AD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD>
jnz @ f
add ecx , ( BtnSize + BtnSpace ) * 65536
2018-09-16 11:42:32 +02:00
mov ebx , ( BtnSpace * 2 + margin ) * 65536 + BtnSize + 1
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
@ @ :
mov esi , Color1 ; <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
cmp byte [ field - NofBtn + edx ], 0 ; field-NofBtn+<2B> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <5F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
jz @ f ; <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> 梥<> <E6A2A5>
mov esi , Color2
@ @ :
mcall 8 ,
add ebx , ( BtnSize + BtnSpace ) * 65536
inc edx ; <20> <> <EFBFBD> <EFBFBD> 室<EFBFBD> <E5AEA4> <20> <> <E1ABA5> <EFBFBD> 饩 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
cmp edx , NofBtn * ( NofBtn + 1 )
jb buttons
mcall 12 , 2 ; <20> 㭪<EFBFBD> <E3ADAA> <EFBFBD> 12: ᮮ<> <E1AEAE> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <20> <> <EFBFBD> <EFBFBD> ᮢ<EFBFBD> <E1AEA2> <20> <> <EFBFBD> <EFBFBD>
ret
;----------------------------------------------------------------------------
; Game_Init
;----------------------------------------------------------------------------
Game_Init:
and [ moves ], 0 ; <20> <> <EFBFBD> 㫨<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ⢮ 室<> <E5AEA4>
call random ; <20> eax <20> <> <EFBFBD> 砩<EFBFBD> <E7A0A9> <EFBFBD> <20> <>
mov ecx , NofBtn * NofBtn ; <20> ecx <20> <> <EFBFBD> -<2D> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD>
mov bh , 0 ; <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> 㤥<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
; 1 <20> <> <EFBFBD> <20> <> eax, bh - <> 쪮
button_init: ; <20> <> <EFBFBD> 㦥 <20> ᯮ<EFBFBD> 짮<EFBFBD> <ECA7AE> <EFBFBD> <EFBFBD>
shr eax , 1 ; <20> <> <EFBFBD> <EFBFBD> 訩 <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> 䫠<> CF
; <20> <20> <> <EFBFBD> <EFBFBD> ᨬ<EFBFBD> <E1A8AC> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <20> <> <EFBFBD> 祭<EFBFBD> <E7A5AD>
; <20> bl <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 뢠<EFBFBD> <EBA2A0> <EFBFBD> <EFBFBD> -1 <20> <> <EFBFBD> 0
sbb bl , bl
mov [ field + ecx - 1 ], bl
inc bh
cmp bh , 32 ; <20> <20> ᯮ<EFBFBD> 짮<EFBFBD> <ECA7AE> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> 32 <20> <> <EFBFBD> <EFBFBD> <20> <> eax
jb @ f ; <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> 砩<EFBFBD> <E7A0A9> <EFBFBD> <20> <>
call random
mov bh , 0
@ @ :
loop button_init
ret
;----------------------------------------------------------------------------
; random - <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
;----------------------------------------------------------------------------
random: mov eax ,[ generator ]
add eax , - 43ab45b5h
ror eax , 1
xor eax , 32c4324fh
ror eax , 1
mov [ generator ], eax
; --- IVAN ---
mov eax , 26
mov ebx , 9
int 0x40
xor eax , 0xdeadbeef
add eax ,[ generator ]
; --- IVAN ---
ret
;============================================================================
field db NofBtn * NofBtn dup ( 0 )
moves dd 0
generator dd 0
2018-09-16 11:42:32 +02:00
header db 'Lights' , 0
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
if lang eq ru
2018-09-16 11:42:32 +02:00
strMovs db '<27> <> <EFBFBD> ' , 0
strNew db '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> ' , 0
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
else
2018-09-16 11:42:32 +02:00
strMovs db 'MOVE' , 0
strNew db ' New game' , 0
Added sources of the following games: bnc, checkers, fara, FindNumbers, gomoku, reversi, rforces, sq_game, sudoku, whowtbam, xonix.
git-svn-id: svn://kolibrios.org@1805 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 11:48:08 +01:00
end if
I_END: ; <20> <> ⪠ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> ணࠬ<E0AEA3> <E0A0AC>