2006-11-02 15:18:23 +01:00
|
|
|
|
; <--- description --->
|
|
|
|
|
; compiler: FASM 1.50
|
|
|
|
|
; name: FreeCell for MeOS
|
|
|
|
|
; version: 1.00
|
|
|
|
|
; last update: 21/07/2004
|
|
|
|
|
; written by: Alexandr Gorbovets
|
|
|
|
|
; e-mail: gorsash@mail.ru
|
|
|
|
|
|
|
|
|
|
|
2011-08-18 22:06:30 +02:00
|
|
|
|
include "../../macros.inc"
|
2007-12-02 17:32:03 +01:00
|
|
|
|
include "lang.inc"
|
2006-11-02 15:18:23 +01:00
|
|
|
|
meos_app_start
|
|
|
|
|
|
|
|
|
|
code
|
|
|
|
|
call randomize
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
wait_event:
|
|
|
|
|
mov eax, 10
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
cmp eax, 1 ; if event == 1
|
|
|
|
|
je redraw ; jump to redraw handler
|
|
|
|
|
cmp eax, 2 ; else if event == 2
|
|
|
|
|
je key ; jump to key handler
|
|
|
|
|
cmp eax, 3 ; else if event == 3
|
|
|
|
|
je button ; jump to button handler
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jmp wait_event ;else return to the start of main cycle
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
redraw: ; redraw event handler
|
2006-11-02 15:18:23 +01:00
|
|
|
|
call draw_window
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
key: ; key event handler
|
|
|
|
|
mov eax, 2 ; get key code
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
button: ; button event handler
|
|
|
|
|
mov eax, 17 ; get button identifier
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp ah, 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je exit_app ; return if button id != 1
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp ah, 1 + 8
|
|
|
|
|
jbe common_card ; if 1 < ah <= 9
|
|
|
|
|
|
|
|
|
|
cmp ah, 1 + 8 + 4 ; if 9 < ah <= 13
|
|
|
|
|
jbe temp_cell
|
|
|
|
|
|
|
|
|
|
cmp ah, 1 + 8 + 8
|
|
|
|
|
jbe home_cell
|
|
|
|
|
|
|
|
|
|
cmp ah, 1 + 8 + 4 + 4 + 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je new_game_button
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp ah, 1 + 8 + 4 + 4 + 2
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je exit_app
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit_app:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, -1 ; exit application
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
common_card:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
sub ah, 2 ;going from number of card to number of column
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov [columnclicked], 0
|
|
|
|
|
mov byte [columnclicked], ah
|
|
|
|
|
call common_card_click
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
|
|
|
|
temp_cell:
|
|
|
|
|
sub ah, 2 + 8
|
|
|
|
|
mov [columnclicked], 0
|
|
|
|
|
mov byte [columnclicked], ah
|
|
|
|
|
call temp_cell_click
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
home_cell:
|
|
|
|
|
sub ah, 2 + 8 + 4
|
|
|
|
|
mov [columnclicked], 0
|
|
|
|
|
mov byte [columnclicked], ah
|
|
|
|
|
call home_cell_click
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
|
|
|
|
new_game_button:
|
|
|
|
|
call new_game_click
|
|
|
|
|
jmp wait_event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; common_card_click(columnclicked)
|
|
|
|
|
common_card_click:
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; counting code of card, that has been clicked
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
mov [ncolumn], eax
|
|
|
|
|
call get_row_of_top_card_in_column
|
|
|
|
|
mov eax, [topcardrow] ; eax = topcardrow * 8 + columnofselcard
|
|
|
|
|
mov bl, 8
|
|
|
|
|
mul bl
|
|
|
|
|
add eax, [columnclicked]
|
|
|
|
|
add eax, cards
|
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [cardclicked], ebx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call get_sel_card_code_and_addr
|
|
|
|
|
|
|
|
|
|
cmp [selcardcode], 52
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb .something_selected
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [cardclicked], 52
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .end
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scCommonCells
|
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
mov [columnofselcard], eax
|
|
|
|
|
call draw_window
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.something_selected:
|
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; checking if selected and clicked cards are equivalent
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [selcardcode]
|
|
|
|
|
cmp [cardclicked], eax
|
|
|
|
|
jne .not_same_card
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
call draw_window
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.not_same_card:
|
|
|
|
|
|
|
|
|
|
cmp [cardclicked], 52
|
|
|
|
|
jae .put_in_blank_cell
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardcode]
|
|
|
|
|
mov bl, 4
|
|
|
|
|
div bl
|
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, ah
|
|
|
|
|
mov [cardfamily], ebx
|
|
|
|
|
|
|
|
|
|
mov ecx, 0
|
|
|
|
|
mov cl, al
|
|
|
|
|
mov [cardrange], ecx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [cardclicked]
|
|
|
|
|
mov bl, 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div bl ; reminder in ah, quotient in al
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, ah
|
|
|
|
|
mov [clickedcardfamily], ebx
|
|
|
|
|
|
|
|
|
|
mov ecx, 0
|
|
|
|
|
mov cl, al
|
|
|
|
|
mov [clickedcardrange], ecx
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; clickedcardrange must be = cardrange + 1
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [cardrange]
|
|
|
|
|
inc eax
|
|
|
|
|
|
|
|
|
|
cmp [clickedcardrange], eax ; eax is such as needed
|
|
|
|
|
jne .end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [cardfamily], 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
ja .black_card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; if selected red card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
cmp [clickedcardfamily], 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jbe .end ; if clicked red card (range <= 1) then exit
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .valid_cards
|
|
|
|
|
|
|
|
|
|
.black_card:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; if selected black card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
cmp [clickedcardfamily], 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
ja .end ; if clicked black card then exit
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .valid_cards
|
|
|
|
|
|
|
|
|
|
.valid_cards:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; moving card from its place on clicked card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
mov [ncolumn], eax
|
|
|
|
|
call get_row_of_top_card_in_column
|
|
|
|
|
mov eax, [topcardrow]
|
|
|
|
|
inc eax
|
|
|
|
|
|
|
|
|
|
mov bl, 8
|
|
|
|
|
mul bl
|
|
|
|
|
|
|
|
|
|
and eax, $0000FFFF
|
|
|
|
|
add eax, [columnclicked]
|
|
|
|
|
add eax, cards
|
|
|
|
|
|
|
|
|
|
mov bl, byte [selcardcode]
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardaddr]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.put_in_blank_cell:
|
|
|
|
|
|
|
|
|
|
mov eax, cards
|
|
|
|
|
add eax, [columnclicked]
|
|
|
|
|
mov bl, byte [selcardcode]
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardaddr]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
.end:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; temp_cell_click(columnclicked)
|
|
|
|
|
temp_cell_click:
|
|
|
|
|
call get_sel_card_code_and_addr
|
|
|
|
|
cmp [selcardcode], 52
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb .something_selected
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scTempCells
|
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
mov [columnofselcard], eax
|
|
|
|
|
call draw_window
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.something_selected:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; checking if selected and clicked cards equivalent
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
add eax, tempcells
|
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [cardclicked], ebx
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardcode]
|
|
|
|
|
cmp [cardclicked], eax
|
|
|
|
|
jne .not_same_card
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
.not_same_card:
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;putting cards in temp cells
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
add eax, tempcells
|
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [cardclicked], ebx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [cardclicked], 52
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb .end
|
|
|
|
|
; if nothing lay in this cell
|
|
|
|
|
; move selected card to temp cell
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
add eax, tempcells
|
|
|
|
|
mov bl, byte [selcardcode]
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardaddr]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.end:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; home_cell_click(column_clicked)
|
|
|
|
|
home_cell_click:
|
|
|
|
|
call get_sel_card_code_and_addr
|
|
|
|
|
|
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
add eax, homecells
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [cardclicked], ebx
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardcode]
|
|
|
|
|
mov bl, 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div bl ; reminder in ah, quotient in al
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, ah
|
|
|
|
|
mov [cardfamily], ebx
|
|
|
|
|
|
|
|
|
|
mov ecx, 0
|
|
|
|
|
mov cl, al
|
|
|
|
|
mov [cardrange], ecx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [cardclicked], 52
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb .not_blank
|
|
|
|
|
; if nothing lay in this cell
|
2006-11-02 15:18:23 +01:00
|
|
|
|
cmp [cardrange], 0
|
|
|
|
|
jne .end
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; move ace to home
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
add eax, homecells
|
|
|
|
|
mov bl, byte [selcardcode]
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardaddr]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.not_blank:
|
|
|
|
|
|
|
|
|
|
mov eax, [cardclicked]
|
|
|
|
|
mov bl, 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div bl ; reminder in ah, quotient in al
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, ah
|
|
|
|
|
mov [clickedcardfamily], ebx
|
|
|
|
|
|
|
|
|
|
mov ecx, 0
|
|
|
|
|
mov cl, al
|
|
|
|
|
mov [clickedcardrange], ecx
|
|
|
|
|
|
|
|
|
|
cmp [cardfamily], ebx
|
|
|
|
|
jne .end
|
|
|
|
|
|
|
|
|
|
inc ecx
|
|
|
|
|
cmp [cardrange], ecx
|
|
|
|
|
jne .end
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; moving card from its place to home with replacing
|
|
|
|
|
; of old card in home
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [columnclicked]
|
|
|
|
|
add eax, homecells
|
|
|
|
|
mov bl, byte [selcardcode]
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
mov eax, [selcardaddr]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.end:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
new_game_click:
|
|
|
|
|
|
|
|
|
|
mov [i], 0
|
|
|
|
|
.deleting_cards_from_common_cells:
|
|
|
|
|
mov eax, cards
|
|
|
|
|
add eax, [i]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
cmp [i], 19*8
|
|
|
|
|
jb .deleting_cards_from_common_cells
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [i], 0
|
|
|
|
|
.filling_pack:
|
|
|
|
|
mov eax, pack
|
|
|
|
|
add eax, [i]
|
|
|
|
|
mov bl, byte [i]
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
cmp [i], 52
|
|
|
|
|
jb .filling_pack
|
|
|
|
|
|
|
|
|
|
mov [i], 0
|
|
|
|
|
|
|
|
|
|
.putting_cards:
|
|
|
|
|
|
|
|
|
|
mov [range], 52
|
|
|
|
|
call random
|
|
|
|
|
mov eax, [random_value]
|
|
|
|
|
add eax, pack
|
|
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [randomcard], ebx
|
|
|
|
|
|
|
|
|
|
mov eax, [random_value]
|
|
|
|
|
mov [j], eax
|
|
|
|
|
|
|
|
|
|
cmp [randomcard], 52
|
|
|
|
|
jb .found_card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [range], 52
|
|
|
|
|
call random
|
|
|
|
|
cmp [random_value], 26
|
|
|
|
|
jae .decreasing_j
|
|
|
|
|
|
|
|
|
|
.increasing_j:
|
|
|
|
|
inc [j]
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; j mod 52
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [j]
|
|
|
|
|
mov edx, 0
|
|
|
|
|
mov ebx, 52
|
|
|
|
|
div ebx
|
|
|
|
|
mov [j], edx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [j]
|
|
|
|
|
add eax, pack
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [randomcard], ebx
|
|
|
|
|
cmp [randomcard], 52
|
|
|
|
|
jb .found_card
|
|
|
|
|
|
|
|
|
|
jmp .increasing_j
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.decreasing_j:
|
|
|
|
|
dec [j]
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; i mod 32
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [j]
|
|
|
|
|
mov edx, 0
|
|
|
|
|
mov ebx, 52
|
|
|
|
|
div ebx
|
|
|
|
|
mov [j], edx
|
|
|
|
|
|
|
|
|
|
mov eax, [j]
|
|
|
|
|
add eax, pack
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [randomcard], ebx
|
|
|
|
|
cmp [randomcard], 52
|
|
|
|
|
jb .found_card
|
|
|
|
|
|
|
|
|
|
jmp .decreasing_j
|
|
|
|
|
|
|
|
|
|
.found_card:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; putting card from pack
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, cards
|
|
|
|
|
add eax, [i]
|
|
|
|
|
mov bl, byte [randomcard]
|
|
|
|
|
mov byte [eax], bl
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; deleting card from pack
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, pack
|
|
|
|
|
add eax, [j]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
cmp [i], 52
|
|
|
|
|
jb .putting_cards
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [i], 0
|
|
|
|
|
.deleting_cards_from_temp_cells:
|
|
|
|
|
mov eax, tempcells
|
|
|
|
|
add eax, [i]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
cmp [i], 4
|
|
|
|
|
jb .deleting_cards_from_temp_cells
|
|
|
|
|
|
|
|
|
|
mov [i], 0
|
|
|
|
|
.deleting_cards_from_home_cells:
|
|
|
|
|
mov eax, homecells
|
|
|
|
|
add eax, [i]
|
|
|
|
|
mov byte [eax], 52
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
cmp [i], 4
|
|
|
|
|
jb .deleting_cards_from_home_cells
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [whereisselcard], scNotSelected
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; get_sel_card_code_and_addr(): selcardcode, selcardaddr
|
|
|
|
|
; if nothing selected, then selcardcode is 52
|
|
|
|
|
get_sel_card_code_and_addr:
|
|
|
|
|
cmp [whereisselcard], scNotSelected
|
|
|
|
|
jne .something_selected
|
|
|
|
|
|
|
|
|
|
mov [selcardcode], 52
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.something_selected:
|
|
|
|
|
cmp [whereisselcard], scTempCells
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .temp_cells_selected
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; common cells selected
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [columnofselcard]
|
|
|
|
|
mov [ncolumn], eax
|
|
|
|
|
call get_row_of_top_card_in_column
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [topcardrow]; eax = topcardrow * 8 + columnofselcard
|
|
|
|
|
mov bl, 8
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mul bl ; result of multiplication in ax
|
2006-11-02 15:18:23 +01:00
|
|
|
|
add eax, [columnofselcard]
|
|
|
|
|
add eax, cards
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [selcardaddr], eax
|
|
|
|
|
xor ebx, ebx
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [selcardcode], ebx
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.temp_cells_selected:
|
|
|
|
|
|
|
|
|
|
mov eax, tempcells
|
|
|
|
|
add eax, [columnofselcard]
|
|
|
|
|
mov [selcardaddr], eax
|
|
|
|
|
mov ebx, 0
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
mov [selcardcode], ebx
|
|
|
|
|
|
|
|
|
|
.end:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; draw_window()
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
mov eax,48 ; get system colors
|
|
|
|
|
mov ebx,3
|
|
|
|
|
mov ecx,syscolors
|
|
|
|
|
mov edx,sizeof.system_colors
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, 12 ; start drawing
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, 0 ; create and draw the window
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, 100 * 65536 + 8 * cardwidth + 10 + 7 * columnspace
|
|
|
|
|
mov ecx, 100 * 65536 + 500
|
|
|
|
|
mov edx, 0x13008000
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mov edi, title
|
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, 9 ; getting window info
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, process_info
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov ecx, -1 ; we want to know info of our window
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2011-08-18 22:06:30 +02:00
|
|
|
|
test [process_info.wnd_state], 0x04
|
|
|
|
|
jnz draw_window.end_draw
|
|
|
|
|
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mov eax, [process_info.box.height]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov [WindowHeight], ax
|
|
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mov eax, [process_info.box.width]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov [WindowWidth], ax
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; draw top panel
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, 13
|
|
|
|
|
mov ebx, 5
|
|
|
|
|
shl ebx, 16
|
2007-05-10 15:48:35 +02:00
|
|
|
|
add bx, word [process_info.box.width]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
sub bx, 9
|
|
|
|
|
mov ecx, 22 shl 16 + topbuttonsbarheight - 1
|
|
|
|
|
mov edx, [syscolors.work_graph]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; draw button "new game"
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, 8
|
|
|
|
|
mov ebx, 5 shl 16 + 80
|
|
|
|
|
mov ecx, 22 shl 16 + topbuttonsbarheight - 2
|
|
|
|
|
mov edx, 1 + 8 + 4 + 4 + 1 ;button id
|
|
|
|
|
mov esi, [syscolors.work_button]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, 4
|
2024-06-03 01:34:02 +02:00
|
|
|
|
if lang eq it_IT
|
2013-06-01 10:03:43 +02:00
|
|
|
|
mov ebx, 7 shl 16 + 22 + topbuttonsbarheight/2 - 4
|
|
|
|
|
else
|
|
|
|
|
mov ebx, 20 shl 16 + 22 + topbuttonsbarheight/2 - 4
|
|
|
|
|
end if
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ecx, [syscolors.work_button_text]
|
|
|
|
|
mov edx, new_game
|
|
|
|
|
mov esi, new_game_len
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; draw button "exit"
|
|
|
|
|
mov eax, 8
|
|
|
|
|
mov ebx, (5 + 85) shl 16 + 80 + 5
|
|
|
|
|
mov ecx, 22 shl 16 + topbuttonsbarheight - 2
|
|
|
|
|
mov edx, 1 + 8 + 4 + 4 + 2 ;button id
|
|
|
|
|
mov esi, [syscolors.work_button]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov ebx, (40 + 80) shl 16 + 22 + topbuttonsbarheight/2 - 4
|
|
|
|
|
mov ecx, [syscolors.work_button_text]
|
|
|
|
|
mov edx, exit
|
|
|
|
|
mov esi, exit_len
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; draw separators between home, temp and common cells
|
|
|
|
|
mov eax, 13
|
|
|
|
|
; horizontal line
|
|
|
|
|
mov ebx, 5
|
|
|
|
|
shl ebx, 16
|
2007-05-10 15:48:35 +02:00
|
|
|
|
add bx, word [process_info.box.width]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
sub bx, 9
|
|
|
|
|
mov ecx, (21 + topbuttonsbarheight + cardheight + columnspace) shl 16+1
|
|
|
|
|
|
|
|
|
|
mov edx, [syscolors.work_graph]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
; verical line
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mov eax, [process_info.box.width]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov edx, 0
|
|
|
|
|
mov ecx, 2
|
|
|
|
|
div ecx
|
|
|
|
|
|
|
|
|
|
mov ebx, eax
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
add bx, 1
|
|
|
|
|
mov ecx, (21 + topbuttonsbarheight) shl 16 + cardheight + columnspace
|
|
|
|
|
mov edx, [syscolors.work_graph]
|
|
|
|
|
mov eax, 13
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; draw temp buttons
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov [j], 0 ;counter that loops from 0 to 51
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
draw_a_temp_card:
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; code of card must be in ecx
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, tempcells
|
|
|
|
|
add eax, [j]
|
|
|
|
|
xor ecx, ecx
|
|
|
|
|
mov cl, byte [eax] ; placing in cl value from memory
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; with address [tempcells + j] or
|
|
|
|
|
; j-th element of array "tempcells"
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [cardcode], ecx
|
|
|
|
|
|
|
|
|
|
mov eax, [j]
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ebx, 8
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div ebx ; divsion by 8 (8 columns),
|
|
|
|
|
; so in eax quotient - number of row
|
|
|
|
|
; and in edx remainder -
|
|
|
|
|
; number of column where lay card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [row], eax
|
|
|
|
|
mov [column], edx
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, [process_info.box.width] ; width of window
|
2006-11-02 15:18:23 +01:00
|
|
|
|
sub eax, 10
|
|
|
|
|
sub eax, cardwidth
|
|
|
|
|
mov ebx, 7
|
|
|
|
|
mov edx, 0
|
|
|
|
|
div ebx
|
|
|
|
|
mov ebx, [column]
|
|
|
|
|
mul ebx
|
|
|
|
|
add eax, 5
|
|
|
|
|
|
|
|
|
|
mov [xpos], eax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [row]
|
|
|
|
|
mov bl, rowsize
|
|
|
|
|
mul bl
|
|
|
|
|
add eax, 24 + topbuttonsbarheight
|
|
|
|
|
mov [ypos], eax
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; checking, if this card selected
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [negativedraw], 0
|
|
|
|
|
|
|
|
|
|
cmp [whereisselcard], scTempCells
|
|
|
|
|
jne .this_temp_cell_isnt_selected
|
|
|
|
|
|
|
|
|
|
mov eax, [column]
|
|
|
|
|
cmp [columnofselcard], eax
|
|
|
|
|
jne .this_temp_cell_isnt_selected
|
|
|
|
|
|
|
|
|
|
mov [negativedraw], 1
|
|
|
|
|
|
|
|
|
|
.this_temp_cell_isnt_selected:
|
|
|
|
|
|
|
|
|
|
call draw_card
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; define button on place of card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, 8
|
|
|
|
|
mov ebx, [xpos]
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
add bx, cardwidth - 1
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
add cx, cardheight - 1
|
|
|
|
|
mov edx, [column]
|
|
|
|
|
add edx, 01000000000000000000000000000000b + 2 + 8; button id = column
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; id = 1 reserved as close button
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [j]
|
|
|
|
|
cmp [j], 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb draw_a_temp_card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; draw home buttons
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov [j], 0 ;counter that loops from 0 to 51
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
draw_a_home_card:
|
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; code of card must be in ecx
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, homecells
|
|
|
|
|
add eax, [j]
|
|
|
|
|
xor ecx, ecx
|
|
|
|
|
mov cl, byte [eax] ; placing in cl value from memory
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; with address [tempcells + j] or
|
|
|
|
|
; j-th element of array "tempcells"
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [cardcode], ecx
|
|
|
|
|
|
|
|
|
|
mov eax, [j]
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ebx, 8
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div ebx ; divsion by 8 (8 columns),
|
|
|
|
|
; so in eax quotient - number of row
|
|
|
|
|
; and in edx remainder -
|
|
|
|
|
; number of column where lay card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [row], eax
|
|
|
|
|
mov [column], edx
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, [process_info.box.width] ; width of window
|
2006-11-02 15:18:23 +01:00
|
|
|
|
sub eax, 10
|
|
|
|
|
sub eax, cardwidth
|
|
|
|
|
mov ebx, 7
|
|
|
|
|
mov edx, 0
|
|
|
|
|
div ebx
|
|
|
|
|
mov ebx, [column]
|
|
|
|
|
add ebx, 4
|
|
|
|
|
mul ebx
|
|
|
|
|
add eax, 5
|
|
|
|
|
|
|
|
|
|
mov [xpos], eax
|
|
|
|
|
|
|
|
|
|
mov eax, [row]
|
|
|
|
|
mov bl, rowsize
|
|
|
|
|
mul bl
|
|
|
|
|
add eax, 24 + topbuttonsbarheight
|
|
|
|
|
mov [ypos], eax
|
|
|
|
|
|
|
|
|
|
mov [negativedraw], 0
|
|
|
|
|
|
|
|
|
|
call draw_card
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; define button on place of card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, 8
|
|
|
|
|
mov ebx, [xpos]
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
add bx, cardwidth - 1
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
add cx, cardheight - 1
|
|
|
|
|
mov edx, [column]
|
|
|
|
|
add edx, 01000000000000000000000000000000b + 2 + 8 + 4 ; button id
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; id = 1 reserved as close button
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [j]
|
|
|
|
|
cmp [j], 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb draw_a_home_card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; draw common cards
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov [j], 0 ;counter that loops from 0 to 8 * 19
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
draw_a_card:
|
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; code of card must be in ecx
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, cards
|
|
|
|
|
add eax, [j]
|
|
|
|
|
xor ecx, ecx
|
|
|
|
|
mov cl, byte [eax] ; placing in cl value from memory
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; with address [cards + j] or
|
|
|
|
|
; j-th element of array "cards"
|
2006-11-02 15:18:23 +01:00
|
|
|
|
; cmp ecx, 52 ; if code of card >= 52 then there is no card
|
|
|
|
|
; jae no_draw
|
|
|
|
|
;
|
|
|
|
|
; cmp ecx, 0 ; if code of card < 0 then there is no card
|
|
|
|
|
; jb no_draw
|
|
|
|
|
|
|
|
|
|
mov [cardcode], ecx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [j]
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ebx, 8
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div ebx ; divsion by 8 (8 columns),
|
|
|
|
|
; so in eax quotient - number of row
|
|
|
|
|
; and in edx remainder -
|
|
|
|
|
; number of column where lay card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov [row], eax
|
|
|
|
|
mov [column], edx
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, [process_info.box.width] ; width of window
|
2006-11-02 15:18:23 +01:00
|
|
|
|
sub eax, 10
|
|
|
|
|
sub eax, cardwidth
|
|
|
|
|
mov ebx, 7
|
|
|
|
|
mov edx, 0
|
|
|
|
|
div ebx
|
|
|
|
|
mov ebx, [column]
|
|
|
|
|
mul ebx
|
|
|
|
|
add eax, 5
|
|
|
|
|
|
|
|
|
|
mov [xpos], eax
|
|
|
|
|
|
|
|
|
|
mov eax, [row]
|
|
|
|
|
mov bl, rowsize
|
|
|
|
|
mul bl
|
|
|
|
|
add eax, cardheight + 24 + topbuttonsbarheight + columnspace
|
|
|
|
|
mov [ypos], eax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [negativedraw], 0 ;checking, if this is selected card
|
|
|
|
|
|
|
|
|
|
cmp [whereisselcard], scCommonCells
|
|
|
|
|
jne .this_card_isnt_selected
|
|
|
|
|
|
|
|
|
|
mov eax, [column]
|
|
|
|
|
cmp [columnofselcard], eax
|
|
|
|
|
jne .this_card_isnt_selected
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [column]
|
|
|
|
|
mov [ncolumn], eax
|
|
|
|
|
call get_row_of_top_card_in_column
|
|
|
|
|
mov eax, [row]
|
|
|
|
|
cmp [topcardrow], eax
|
|
|
|
|
jne .this_card_isnt_selected
|
|
|
|
|
|
|
|
|
|
mov [negativedraw], 1
|
|
|
|
|
|
|
|
|
|
.this_card_isnt_selected:
|
|
|
|
|
|
|
|
|
|
call draw_card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; now checking if it is top card in its column
|
|
|
|
|
; if it does, we'll define button on its place
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, [column]
|
|
|
|
|
mov [ncolumn], eax
|
|
|
|
|
call get_row_of_top_card_in_column
|
|
|
|
|
mov eax, [row]
|
|
|
|
|
cmp [topcardrow], eax
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .define_button
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [topcardrow], 0
|
|
|
|
|
jne .no_define_button
|
|
|
|
|
|
|
|
|
|
cmp [row], 0
|
|
|
|
|
jne .no_define_button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.define_button:
|
|
|
|
|
mov eax, 8
|
|
|
|
|
mov ebx, [xpos]
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
add bx, cardwidth - 1
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
add cx, cardheight - 1
|
|
|
|
|
mov edx, [column]
|
|
|
|
|
add edx, 01000000000000000000000000000000b + 2; button id = column + 2,
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; id = 1 reserved as close button
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.no_define_button:
|
|
|
|
|
|
|
|
|
|
inc [j]
|
|
|
|
|
cmp [j], 8 * 19
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb draw_a_card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2011-08-18 22:06:30 +02:00
|
|
|
|
draw_window.end_draw:
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, 12 ; finish drawing
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, 2
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; get_row_of_top_card_in_column(ncolumn): topcardrow
|
|
|
|
|
|
|
|
|
|
get_row_of_top_card_in_column:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; number of column in ncolumn
|
|
|
|
|
; returns in topcardrow
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov [i], 0 ; i loops from 0 to 1, ... while card i * 8 + ncolumn
|
|
|
|
|
; is valid card (0 <= its code < 52)
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
.cycle:
|
|
|
|
|
xor eax, eax
|
|
|
|
|
mov al, 8
|
|
|
|
|
mov ebx, [i]
|
|
|
|
|
mul bl
|
|
|
|
|
add eax, [ncolumn]
|
|
|
|
|
add eax, cards
|
|
|
|
|
xor ecx, ecx
|
|
|
|
|
mov cl, byte [eax]
|
|
|
|
|
|
|
|
|
|
cmp ecx, 52
|
|
|
|
|
jae .endcycle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [i], 18
|
|
|
|
|
ja .endcycle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
|
|
|
|
|
jmp .cycle
|
|
|
|
|
|
|
|
|
|
.endcycle:
|
|
|
|
|
|
|
|
|
|
cmp [i], 0
|
|
|
|
|
je .dont_dec
|
|
|
|
|
|
|
|
|
|
dec [i]
|
|
|
|
|
|
|
|
|
|
.dont_dec:
|
|
|
|
|
|
|
|
|
|
mov eax, [i]
|
|
|
|
|
mov [topcardrow], eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; invert_image_colors(imagetoinvert, sizeofimagetoinvert)
|
|
|
|
|
invert_image_colors:
|
|
|
|
|
mov [i], 0
|
|
|
|
|
|
|
|
|
|
.inverting:
|
|
|
|
|
mov eax, [imagetoinvert]
|
|
|
|
|
add eax, [i]
|
|
|
|
|
|
|
|
|
|
mov bl, byte [eax]
|
|
|
|
|
;xor ebx, ebx
|
|
|
|
|
;add ebx, 10
|
|
|
|
|
not ebx
|
|
|
|
|
|
|
|
|
|
mov byte [eax], bl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc [i]
|
|
|
|
|
|
|
|
|
|
mov ecx, [sizeofimagetoinvert]
|
|
|
|
|
cmp [i], ecx
|
2007-12-02 17:32:03 +01:00
|
|
|
|
jb .inverting
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .later
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.exit:
|
|
|
|
|
mov eax, -1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
.later:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; draw_card(xpos, ypos, cardcode, negativedraw)
|
|
|
|
|
; if negativedraw = 1 then card drawn in inverted colors
|
|
|
|
|
|
|
|
|
|
draw_card: ; draws card with left top corner
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; in point ([xpos],[ypos]),
|
|
|
|
|
; type of card in [cardcode]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardcode], 52 ; if code of card >= 52 then there is no card
|
|
|
|
|
jae .no_draw_card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [negativedraw], 1
|
|
|
|
|
jne .no_invert1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;doing if negativedraw
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov [bgcolor], $00000000
|
|
|
|
|
mov [blackcolor], $00FFFFFF
|
|
|
|
|
mov [redcolor], $0000FFFF
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;inverting all images
|
2006-11-02 15:18:23 +01:00
|
|
|
|
call invert_all_images
|
|
|
|
|
|
|
|
|
|
jmp .colors_selection_done
|
|
|
|
|
|
|
|
|
|
.no_invert1:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;doing if not negativedraw
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov [bgcolor], $00FFFFFF
|
|
|
|
|
mov [blackcolor], $00000000
|
|
|
|
|
mov [redcolor], $00FF0000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.colors_selection_done:
|
|
|
|
|
|
|
|
|
|
mov eax, 13
|
|
|
|
|
|
|
|
|
|
mov ebx, [xpos] ; filling card with bgcolor
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; (big background rectangle)
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov edx, [bgcolor]
|
|
|
|
|
add ebx, 2
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
mov bx, cardwidth - 4
|
|
|
|
|
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
add ecx, 2
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
mov cx, cardheight - 4
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
mov ebx, [xpos] ; left black line
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
mov bx, 1
|
|
|
|
|
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
add ecx, 5
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
xor cx, cx
|
|
|
|
|
mov cx, cardheight - 2 * radius - 2
|
|
|
|
|
mov edx, [blackcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, [xpos] ; left white line
|
|
|
|
|
inc ebx
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
mov bx, 1
|
|
|
|
|
mov edx, [bgcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, [xpos] ; right black line
|
|
|
|
|
add ebx, cardwidth - 1
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
mov bx, 1
|
|
|
|
|
mov edx, [blackcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, [xpos] ; right white line
|
|
|
|
|
add ebx, cardwidth - 2
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
mov bx, 1
|
|
|
|
|
mov edx, [bgcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
mov ecx, [ypos] ; top black line
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
mov cx, 1
|
|
|
|
|
|
|
|
|
|
mov ebx, [xpos]
|
|
|
|
|
add ebx, 5
|
|
|
|
|
shl ebx, 16
|
|
|
|
|
mov bx, cardwidth - 2 * radius - 2
|
|
|
|
|
mov edx, [blackcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ecx, [ypos] ; top white line
|
|
|
|
|
inc ecx
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
mov cx, 1
|
|
|
|
|
mov edx, [bgcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ecx, [ypos] ; bottom black line
|
|
|
|
|
add ecx, cardheight - 1
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
mov cx, 1
|
|
|
|
|
mov edx, [blackcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ecx, [ypos] ; bottom white line
|
|
|
|
|
add ecx, cardheight - 2
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
mov cx, 1
|
|
|
|
|
mov edx, [bgcolor]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov eax, 1 ; drawing points
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov edx, [blackcolor] ; black color for all pixels
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov ebx, [xpos] ; draw top left corner
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
inc ebx
|
|
|
|
|
add ecx, 4
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ecx
|
|
|
|
|
inc ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ecx
|
|
|
|
|
inc ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
inc ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov ebx, [xpos] ;drawing top right corner
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
add ebx, cardwidth - 2
|
|
|
|
|
add ecx, 4
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ebx
|
|
|
|
|
dec ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ebx
|
|
|
|
|
dec ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;drawing bottom left corner
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [xpos]
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
inc ebx
|
|
|
|
|
add ecx, cardheight - 5
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
inc ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
inc ebx
|
|
|
|
|
inc ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
inc ebx
|
|
|
|
|
inc ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
inc ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;drawing bottom right corner
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [xpos]
|
|
|
|
|
mov ecx, [ypos]
|
|
|
|
|
add ebx, cardwidth - 2
|
|
|
|
|
add ecx, cardheight - 5
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
inc ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ebx
|
|
|
|
|
inc ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ebx
|
|
|
|
|
inc ecx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
dec ebx
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; drawing text and images
|
|
|
|
|
|
|
|
|
|
mov eax, [cardcode]
|
|
|
|
|
mov edx, 0
|
|
|
|
|
mov ebx, 4
|
|
|
|
|
div ebx
|
|
|
|
|
|
|
|
|
|
mov [cardfamily], edx
|
|
|
|
|
mov [cardrange], eax
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; counting position of small card image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov eax, 7
|
|
|
|
|
mov ecx, 8*65536+8
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, radius
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, radius + 8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [cardfamily], 0
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .heart
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardfamily], 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .diamond
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardfamily], 2
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .club
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardfamily], 3
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .spade
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
.heart:
|
|
|
|
|
mov esi, [redcolor]
|
|
|
|
|
mov [color], esi
|
|
|
|
|
mov [imageaddr], heart
|
|
|
|
|
mov [imageflipaddr], heart_updown
|
|
|
|
|
|
|
|
|
|
mov ebx, heart_small
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .selnumber
|
|
|
|
|
|
|
|
|
|
.diamond:
|
|
|
|
|
mov esi, [redcolor]
|
|
|
|
|
mov [color], esi
|
|
|
|
|
mov [imageaddr], diamond
|
|
|
|
|
mov [imageflipaddr], diamond_updown
|
|
|
|
|
|
|
|
|
|
mov ebx, diamond_small
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .selnumber
|
|
|
|
|
|
|
|
|
|
.club:
|
|
|
|
|
mov esi, [blackcolor]
|
|
|
|
|
mov [color], esi
|
|
|
|
|
mov [imageaddr], club
|
|
|
|
|
mov [imageflipaddr], club_updown
|
|
|
|
|
|
|
|
|
|
mov ebx, club_small
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .selnumber
|
|
|
|
|
|
|
|
|
|
.spade:
|
|
|
|
|
mov esi, [blackcolor]
|
|
|
|
|
mov [color], esi
|
|
|
|
|
mov [imageaddr], spade
|
|
|
|
|
mov [imageflipaddr], spade_updown
|
|
|
|
|
|
|
|
|
|
mov ebx, spade_small
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.selnumber:
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov ebx, [xpos] ; counting position of text
|
|
|
|
|
; in ebx, same for all cards
|
2006-11-02 15:18:23 +01:00
|
|
|
|
add ebx, radius
|
|
|
|
|
shl ebx, 16
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov bx, word [ypos]
|
|
|
|
|
add bx, radius
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov ecx, [color]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [cardrange], 0
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .ace
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .two
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 2
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .three
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 3
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .four
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .five
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 5
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .six
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 6
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .seven
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 7
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .eight
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 8
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .nine
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 9
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .ten
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 10
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .jack
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 11
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .queen
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp [cardrange], 12
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je .king
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
; +-------+-------+-------+
|
|
|
|
|
; | 3 | 2 | 3 | ace = 1
|
|
|
|
|
; +-------+-------+-------+ two = 2
|
|
|
|
|
; | | | | three = 2 + 1
|
|
|
|
|
; +-------+-------+-------+ four = 3
|
|
|
|
|
; | | 6 | | five = 3 + 1
|
|
|
|
|
; +-------+-------+-------+ six = 3 + 4
|
|
|
|
|
; | 5 | | 5 | seven = 3 + 4 + 6
|
|
|
|
|
; +-------+-------+-------+ eight = 3 + 5
|
|
|
|
|
; | 4 | 1 | 4 | nine = 3 + 5
|
|
|
|
|
; +-------+-------+-------+ ten = 3 + 5 + 6 + 7
|
|
|
|
|
; | 5 | | 5 |
|
|
|
|
|
; +-------+-------+-------+
|
|
|
|
|
; | | 7 | | 1 means draw_1
|
|
|
|
|
; +-------+-------+-------+
|
|
|
|
|
; | | | |
|
|
|
|
|
; +-------+-------+-------+
|
|
|
|
|
; | 3 | 2 | 3 |
|
|
|
|
|
; +-------+-------+-------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ace:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte 'A'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_1
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.two:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '2'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_2
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.three:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '3'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_1
|
|
|
|
|
call draw_2
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.four:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '4'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_3
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.five:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '5'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_1
|
|
|
|
|
call draw_3
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.six:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '6'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_3
|
|
|
|
|
call draw_4
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.seven:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '7'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_3
|
|
|
|
|
call draw_4
|
|
|
|
|
call draw_6
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.eight:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '8'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_3
|
|
|
|
|
call draw_5
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.nine:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte '9'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_3
|
|
|
|
|
call draw_5
|
|
|
|
|
call draw_1
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.ten:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], word '10'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 2
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
call draw_3
|
|
|
|
|
call draw_5
|
|
|
|
|
call draw_6
|
|
|
|
|
call draw_7
|
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.jack:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte 'J'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.queen:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte 'Q'
|
|
|
|
|
mov edx, s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp .end
|
|
|
|
|
|
|
|
|
|
.king:
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov [s], byte 'K'
|
|
|
|
|
mov edx,s
|
|
|
|
|
mov esi, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
.end:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [negativedraw], 1
|
|
|
|
|
jne .no_invert2
|
|
|
|
|
|
|
|
|
|
call invert_all_images
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.no_invert2:
|
|
|
|
|
.no_draw_card:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; invert_all_images()
|
|
|
|
|
invert_all_images:
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], heart
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], diamond
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], spade
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], club
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], heart_updown
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], diamond_updown
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], spade_updown
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 16 * 16 * 3
|
|
|
|
|
mov [imagetoinvert], club_updown
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 8 * 8 * 3
|
|
|
|
|
mov [imagetoinvert], heart_small
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 8 * 8 * 3
|
|
|
|
|
mov [imagetoinvert], diamond_small
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 8 * 8 * 3
|
|
|
|
|
mov [imagetoinvert], spade_small
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
mov [sizeofimagetoinvert], 8 * 8 * 3
|
|
|
|
|
mov [imagetoinvert], club_small
|
|
|
|
|
call invert_image_colors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
draw_1:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw center image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth/2 - 8
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight/2 - 8
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_2:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw top image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, 40 - 8
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, margin
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw bottom image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageflipaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth/2 - 8
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight - 16 - margin
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
draw_3:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw top left image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, margin
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, margin
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw bottom left image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageflipaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, margin
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight - margin - 16
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw top right image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth - margin - 16
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, margin
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw bottom right image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageflipaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth - margin - 16
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight - margin - 16
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
draw_4:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw center left image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, margin
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight/2 - 8
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw center right image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth - margin - 16
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight/2 - 8
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
draw_5:
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw top left image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, margin
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight * 3 / 9
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw bottom left image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageflipaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, 16
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight * 5 / 9
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw top right image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth - margin - 16
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight * 3 / 9
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-12-02 17:32:03 +01:00
|
|
|
|
;draw bottom right image
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, [imageflipaddr]
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth - margin - 16
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight * 5 / 9
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
draw_6:
|
|
|
|
|
mov ebx, [imageaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth/2 - 8
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight * 2 / 9
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
draw_7:
|
|
|
|
|
mov ebx, [imageflipaddr]
|
|
|
|
|
mov ecx, 16 * 65536 + 16
|
|
|
|
|
mov edx, [xpos]
|
|
|
|
|
add edx, cardwidth/2 - 8
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov dx, word [ypos]
|
|
|
|
|
add dx, cardheight * 6 / 9
|
|
|
|
|
mov eax, 7
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
randomize:
|
|
|
|
|
push eax
|
|
|
|
|
|
|
|
|
|
mov eax, 3
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, $A59E3F1C
|
|
|
|
|
mul ebx
|
|
|
|
|
mov dword [randseed], eax
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
; function Random(Range): RandomValue
|
|
|
|
|
random:
|
|
|
|
|
push ebx
|
|
|
|
|
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
mov edx, 0
|
|
|
|
|
mov ebx, 7
|
|
|
|
|
div ebx
|
|
|
|
|
|
|
|
|
|
cmp edx, 0
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _0
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp edx, 1
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _1
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp edx, 2
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _2
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp edx, 3
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _3
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp edx, 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _4
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp edx, 5
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _5
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
cmp edx, 6
|
2007-12-02 17:32:03 +01:00
|
|
|
|
je _6
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
jmp _end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_0:
|
|
|
|
|
;base := base + 58 + a[8];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 58
|
|
|
|
|
add eax, dword [a + 8 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
jmp _end;
|
|
|
|
|
|
|
|
|
|
_1:
|
|
|
|
|
;base := base + 1 + a[9];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 1
|
|
|
|
|
add eax, dword [a + 9 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
jmp _end;
|
|
|
|
|
|
|
|
|
|
_2:
|
|
|
|
|
;base := base + 4 + a[88];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 4
|
|
|
|
|
add eax, dword [a + 88 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
jmp _end;
|
|
|
|
|
|
|
|
|
|
_3:
|
|
|
|
|
;randseed := randseed + 79 + a[43];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 79
|
|
|
|
|
add eax, dword [a + 43 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
jmp _end;
|
|
|
|
|
|
|
|
|
|
_4:
|
|
|
|
|
;randseed := randseed + 3 + a[12];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 3
|
|
|
|
|
add eax, dword [a + 12 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
jmp _end;
|
|
|
|
|
|
|
|
|
|
_5:
|
|
|
|
|
;randseed := randseed + 2 + a[63];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 2
|
|
|
|
|
add eax, dword [a + 63 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
jmp _end;
|
|
|
|
|
|
|
|
|
|
_6:
|
|
|
|
|
;randseed := randseed + 151 + a[24];
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
add eax, 151
|
|
|
|
|
add eax, dword [a + 24 * 4]
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
|
|
|
|
|
_end:
|
|
|
|
|
|
|
|
|
|
mov eax, [randseed]
|
|
|
|
|
mov edx, eax
|
|
|
|
|
shl edx, 16
|
|
|
|
|
mov bx, 100
|
2007-12-02 17:32:03 +01:00
|
|
|
|
div bx ; dx = randseed mod 100
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mov ax, dx ; ax = randseed mod 100
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov bx, 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mul bx ; dx:ax = (randseed mod 100) * 4
|
2006-11-02 15:18:23 +01:00
|
|
|
|
and eax, $0000FFFF
|
|
|
|
|
shr edx, 16
|
|
|
|
|
and edx, $FFFF0000
|
2007-12-02 17:32:03 +01:00
|
|
|
|
or eax, edx
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
mov eax, dword [a + eax] ; eax = dword[a + (randseed mod 100) * 4]
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; ~ a[randseed mod 100]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
mov ebx, dword [a + 47 * 4]
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mul ebx ; eax = low(a[randseed mod 100] * a[47])
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
add eax, [randseed]
|
|
|
|
|
add eax, $4AE783A
|
|
|
|
|
mov [randseed], eax
|
|
|
|
|
|
|
|
|
|
mov eax, dword [a + 6 * 4]
|
|
|
|
|
mov edx, 0
|
|
|
|
|
mov ebx, 100
|
|
|
|
|
div ebx
|
|
|
|
|
mov eax, edx
|
|
|
|
|
mov ebx, 4
|
2007-12-02 17:32:03 +01:00
|
|
|
|
mul ebx ; eax = (dword [a + 6 * 4] mod 100) * 4 ~ a[6] mod 100
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, dword [a + eax] ; eax = dword [a + (dword [a + 6 * 4] mod 100) * 4
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
; ~ a[a[6] mod 100]
|
2006-11-02 15:18:23 +01:00
|
|
|
|
add eax, [randseed]
|
|
|
|
|
mov [random_value], eax
|
|
|
|
|
|
|
|
|
|
mov edx, 0
|
|
|
|
|
|
|
|
|
|
mov ebx, [range]
|
|
|
|
|
div ebx
|
|
|
|
|
mov [random_value], edx
|
|
|
|
|
|
|
|
|
|
mov al, [TimesCalled]
|
|
|
|
|
xor ah, ah
|
|
|
|
|
inc al
|
|
|
|
|
mov bl, 100
|
|
|
|
|
div bl
|
|
|
|
|
mov [TimesCalled], ah ; TimesCalled = (TimesCalled + 1 ) mod 100
|
|
|
|
|
|
|
|
|
|
mov al, ah
|
|
|
|
|
mov bl, 4
|
|
|
|
|
mul bl
|
|
|
|
|
and eax, $0000FFFF
|
|
|
|
|
|
|
|
|
|
mov ebx, [randseed]
|
|
|
|
|
mov dword [a + eax], ebx ; a[TimesCalled] = randseed
|
|
|
|
|
|
|
|
|
|
pop ebx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
|
|
|
|
|
; <--- initialised data --->
|
2024-06-03 01:34:02 +02:00
|
|
|
|
if lang eq ru_RU
|
2007-12-02 17:32:03 +01:00
|
|
|
|
title db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0
|
|
|
|
|
|
|
|
|
|
new_game: db "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
new_game_len = $ - new_game
|
|
|
|
|
|
|
|
|
|
exit: db "<22><>室"
|
|
|
|
|
exit_len = $ - exit
|
|
|
|
|
|
|
|
|
|
s: db "10"
|
|
|
|
|
|
2024-06-03 01:34:02 +02:00
|
|
|
|
else if lang eq it_IT
|
2013-06-01 10:03:43 +02:00
|
|
|
|
title db 'Freecell',0
|
|
|
|
|
|
|
|
|
|
new_game: db "Nuova partita"
|
|
|
|
|
new_game_len = $ - new_game
|
|
|
|
|
|
|
|
|
|
exit: db "Esci"
|
|
|
|
|
exit_len = $ - exit
|
|
|
|
|
|
|
|
|
|
s: db "10"
|
2007-12-02 17:32:03 +01:00
|
|
|
|
else
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db 'Freecell',0
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
new_game: db "New game"
|
|
|
|
|
new_game_len = $ - new_game
|
|
|
|
|
|
|
|
|
|
exit: db "Exit"
|
|
|
|
|
exit_len = $ - exit
|
|
|
|
|
|
|
|
|
|
s: db "10"
|
2007-12-02 17:32:03 +01:00
|
|
|
|
end if
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
negativedraw db 0 ; for procedure draw_card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
2010-12-27 13:29:39 +01:00
|
|
|
|
spade file 'Spade.bmp': 54
|
|
|
|
|
spade_updown file 'SpadeUD.bmp': 54
|
|
|
|
|
spade_small file 'SpadeSml.bmp': 54
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2010-12-27 13:29:39 +01:00
|
|
|
|
club file 'Club.bmp': 54
|
|
|
|
|
club_updown file 'ClubUD.bmp': 54
|
|
|
|
|
club_small file 'ClubSml.bmp': 54
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2010-12-27 13:29:39 +01:00
|
|
|
|
diamond file 'Diam.bmp': 54
|
|
|
|
|
diamond_updown file 'DiamUD.bmp': 54
|
|
|
|
|
diamond_small file 'DiamSml.bmp': 54
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2010-12-27 13:29:39 +01:00
|
|
|
|
heart file 'Heart.bmp': 54
|
|
|
|
|
heart_updown file 'HeartUD.bmp': 54
|
|
|
|
|
heart_small file 'HeartSml.bmp': 54
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scNotSelected = 0
|
|
|
|
|
scCommonCells = 1
|
|
|
|
|
scTempCells = 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
whereisselcard dd scNotSelected
|
2007-12-02 17:32:03 +01:00
|
|
|
|
columnofselcard dd 0 ; if WhereIsSelCard = scGeneralCells
|
|
|
|
|
; then this can be 0 .. 7,
|
|
|
|
|
; if scTempCells then - 0 .. 3
|
|
|
|
|
; if scNotSelected - no matter
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
tempcells: times 4 db 52;
|
|
|
|
|
homecells: times 4 db 52 ; maximal card code is 51
|
|
|
|
|
cards: times 8 * 19 db 52; - %
|
|
|
|
|
pack: times 52 db ?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
udata
|
|
|
|
|
process_info process_information
|
|
|
|
|
syscolors system_colors
|
|
|
|
|
|
|
|
|
|
WindowHeight rw 1
|
|
|
|
|
WindowWidth rw 1
|
|
|
|
|
|
|
|
|
|
xpos rd 1
|
|
|
|
|
ypos rd 1
|
|
|
|
|
bgcolor rd 1
|
|
|
|
|
blackcolor rd 1
|
|
|
|
|
redcolor rd 1
|
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
lastparam rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
randomcard rd 1 ; for new_game_click
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
columnclicked rd 1 ; used in common_card_click, temp_cell_click,
|
|
|
|
|
cardclicked rd 1 ; home_cell_click
|
|
|
|
|
clickedcardrange rd 1 ;
|
|
|
|
|
clickedcardfamily rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
selcardcode rd 1 ; for procedure get_sel_card_code_and_addr
|
|
|
|
|
selcardaddr rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
column rd 1 ; for procedure draw_window
|
|
|
|
|
row rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
imagetoinvert rd 1 ; for procedure invert_image_colors
|
|
|
|
|
sizeofimagetoinvert rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
ncolumn rd 1 ; for procedure get_row_of_top_card_in_column
|
|
|
|
|
topcardrow rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
color rd 1 ; for procedue draw_card
|
|
|
|
|
imageaddr rd 1 ;
|
|
|
|
|
imageflipaddr rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
cardcode rd 1 ; used in differrent procedures
|
|
|
|
|
cardrange rd 1 ; cardcode = cardrange * 4 + cardfamily
|
|
|
|
|
cardfamily rd 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
a: times 100 rd 1 ; for function Random
|
|
|
|
|
range rd 1 ;
|
|
|
|
|
random_value rd 1 ;
|
|
|
|
|
randseed rd 1 ;
|
|
|
|
|
TimesCalled rb 1 ;
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
2007-12-02 17:32:03 +01:00
|
|
|
|
j rd 1 ; number of card (in array cards) drawn now
|
|
|
|
|
i rd 1 ; used in many procedures of 1-st level
|
2006-11-02 15:18:23 +01:00
|
|
|
|
k rd 1
|
|
|
|
|
|
|
|
|
|
cardwidth = 80
|
|
|
|
|
cardheight = 120
|
2007-12-02 17:32:03 +01:00
|
|
|
|
radius = 4 ; not recommended to change
|
|
|
|
|
rowsize = 30 ; distance between top poins
|
|
|
|
|
;of cards in neighboring rows
|
|
|
|
|
columnspace = 5 ; minimal space between cards
|
|
|
|
|
margin = 14 ; margin of every card
|
2006-11-02 15:18:23 +01:00
|
|
|
|
|
|
|
|
|
topbuttonsbarheight = 20
|
|
|
|
|
|
|
|
|
|
|
2011-08-18 22:06:30 +02:00
|
|
|
|
meos_app_end
|