Subversion Repositories Kolibri OS

Rev

Rev 2067 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
205 heavyiron 1
; <--- description --->
2
; compiler:     FASM 1.50
3
; name:         FreeCell for MeOS
4
; version:      1.00
5
; last update:  21/07/2004
6
; written by:   Alexandr Gorbovets
7
; e-mail:       gorsash@mail.ru
8
 
9
 
2067 dunkaist 10
include "../../macros.inc"
677 ataualpa 11
include "lang.inc"
205 heavyiron 12
meos_app_start
13
 
14
code
15
   call    randomize
16
   call    draw_window
17
 
18
  wait_event:
19
    mov     eax, 10
485 heavyiron 20
    mcall
205 heavyiron 21
 
677 ataualpa 22
    cmp     eax, 1           ;   if event == 1
23
    je      redraw           ;     jump to redraw handler
24
    cmp     eax, 2           ;   else if event == 2
25
    je      key              ;     jump to key handler
26
    cmp     eax, 3           ;   else if event == 3
27
    je      button           ;     jump to button handler
205 heavyiron 28
 
29
 
677 ataualpa 30
    jmp     wait_event  ;else return to the start of main cycle
205 heavyiron 31
 
32
 
677 ataualpa 33
  redraw:                    ; redraw event handler
205 heavyiron 34
    call    draw_window
35
    jmp     wait_event
36
 
37
 
677 ataualpa 38
  key:                       ; key event handler
39
    mov     eax, 2           ;   get key code
485 heavyiron 40
    mcall
205 heavyiron 41
 
42
    jmp     wait_event
43
 
677 ataualpa 44
  button:                    ; button event handler
45
    mov     eax, 17          ;   get button identifier
485 heavyiron 46
    mcall
205 heavyiron 47
 
48
    cmp     ah, 1
677 ataualpa 49
    je      exit_app         ;   return if button id != 1
205 heavyiron 50
 
51
    cmp     ah, 1 + 8
52
    jbe     common_card      ;   if 1 < ah <= 9
53
 
54
    cmp     ah, 1 + 8 + 4    ;   if 9 < ah <= 13
55
    jbe     temp_cell
56
 
57
    cmp     ah, 1 + 8 + 8
58
    jbe     home_cell
59
 
60
    cmp     ah, 1 + 8 + 4 + 4 + 1
677 ataualpa 61
    je      new_game_button
205 heavyiron 62
 
63
    cmp     ah, 1 + 8 + 4 + 4 + 2
677 ataualpa 64
    je      exit_app
205 heavyiron 65
 
66
 
67
    jmp     wait_event
68
 
69
 
70
  exit_app:
677 ataualpa 71
    mov     eax, -1          ;   exit application
485 heavyiron 72
    mcall
205 heavyiron 73
 
74
  common_card:
677 ataualpa 75
    sub     ah, 2            ;going from number of card to number of column
205 heavyiron 76
    mov     [columnclicked], 0
77
    mov     byte [columnclicked], ah
78
    call    common_card_click
79
    jmp     wait_event
80
 
81
  temp_cell:
82
    sub     ah, 2 + 8
83
    mov     [columnclicked], 0
84
    mov     byte [columnclicked], ah
85
    call    temp_cell_click
86
    jmp     wait_event
87
 
88
 
89
  home_cell:
90
    sub    ah, 2 + 8 + 4
91
    mov    [columnclicked], 0
92
    mov    byte [columnclicked], ah
93
    call   home_cell_click
94
    jmp    wait_event
95
 
96
  new_game_button:
97
    call   new_game_click
98
    jmp    wait_event
99
 
100
 
101
;******************************************************************************
102
;                            common_card_click(columnclicked)
103
  common_card_click:
104
 
677 ataualpa 105
                             ; counting code of card, that has been clicked
205 heavyiron 106
    mov    eax, [columnclicked]
107
    mov    [ncolumn], eax
108
    call   get_row_of_top_card_in_column
109
    mov    eax, [topcardrow]  ; eax = topcardrow * 8 + columnofselcard
110
    mov    bl, 8
111
    mul    bl
112
    add    eax, [columnclicked]
113
    add    eax, cards
114
 
115
    mov    ebx, 0
116
    mov    bl, byte [eax]
117
    mov    [cardclicked], ebx
118
 
119
 
120
    call   get_sel_card_code_and_addr
121
 
122
    cmp    [selcardcode], 52
677 ataualpa 123
    jb      .something_selected
205 heavyiron 124
 
125
 
126
    cmp    [cardclicked], 52
677 ataualpa 127
    je      .end
205 heavyiron 128
 
129
    mov    [whereisselcard], scCommonCells
130
    mov    eax, [columnclicked]
131
    mov    [columnofselcard], eax
132
    call   draw_window
133
    jmp    .end
134
 
135
 
136
    .something_selected:
137
 
138
 
677 ataualpa 139
             ; checking if selected and clicked cards are equivalent
205 heavyiron 140
      mov     eax, [selcardcode]
141
      cmp     [cardclicked], eax
142
      jne     .not_same_card
143
 
144
      mov     [whereisselcard], scNotSelected
145
      call    draw_window
146
      jmp     .end
147
 
148
    .not_same_card:
149
 
150
      cmp     [cardclicked], 52
151
      jae     .put_in_blank_cell
152
 
153
 
154
      mov     eax, [selcardcode]
155
      mov     bl, 4
156
      div     bl
157
 
158
      mov     ebx, 0
159
      mov     bl, ah
160
      mov     [cardfamily], ebx
161
 
162
      mov     ecx, 0
163
      mov     cl, al
164
      mov     [cardrange], ecx
165
 
166
 
167
      mov     eax, [cardclicked]
168
      mov     bl, 4
677 ataualpa 169
      div     bl                     ; reminder in ah, quotient in al
205 heavyiron 170
 
171
      mov     ebx, 0
172
      mov     bl, ah
173
      mov     [clickedcardfamily], ebx
174
 
175
      mov     ecx, 0
176
      mov     cl, al
177
      mov     [clickedcardrange], ecx
178
 
677 ataualpa 179
                             ; clickedcardrange must be = cardrange + 1
205 heavyiron 180
      mov     eax, [cardrange]
181
      inc     eax
182
 
183
      cmp     [clickedcardrange], eax ; eax is such as needed
184
      jne     .end
185
 
186
 
187
      cmp     [cardfamily], 1
677 ataualpa 188
      ja             .black_card
205 heavyiron 189
 
677 ataualpa 190
                             ; if selected red card
205 heavyiron 191
      cmp     [clickedcardfamily], 1
677 ataualpa 192
      jbe     .end             ; if clicked red card (range <= 1) then exit
205 heavyiron 193
 
194
      jmp     .valid_cards
195
 
196
    .black_card:
677 ataualpa 197
                             ; if selected black card
205 heavyiron 198
      cmp     [clickedcardfamily], 1
677 ataualpa 199
      ja      .end             ; if clicked black card then exit
205 heavyiron 200
 
201
      jmp     .valid_cards
202
 
203
    .valid_cards:
677 ataualpa 204
                      ; moving card from its place on clicked card
205 heavyiron 205
 
206
      mov     eax, [columnclicked]
207
      mov     [ncolumn], eax
208
      call    get_row_of_top_card_in_column
209
      mov     eax, [topcardrow]
210
      inc     eax
211
 
212
      mov     bl, 8
213
      mul     bl
214
 
215
      and     eax, $0000FFFF
216
      add     eax, [columnclicked]
217
      add     eax, cards
218
 
219
      mov     bl, byte [selcardcode]
220
      mov     byte [eax], bl
221
 
222
      mov     eax, [selcardaddr]
223
      mov     byte [eax], 52
224
 
225
      mov     [whereisselcard], scNotSelected
226
 
227
      call    draw_window
228
 
229
      jmp     .end
230
 
231
      .put_in_blank_cell:
232
 
233
      mov     eax, cards
234
      add     eax, [columnclicked]
235
      mov     bl,  byte [selcardcode]
236
      mov     byte [eax], bl
237
 
238
      mov     eax, [selcardaddr]
239
      mov     byte [eax], 52
240
 
241
      mov     [whereisselcard], scNotSelected
242
 
243
      call    draw_window
244
 
245
    .end:
246
 
247
  ret
248
 
249
 
250
;******************************************************************************
251
;                            temp_cell_click(columnclicked)
252
  temp_cell_click:
253
    call   get_sel_card_code_and_addr
254
    cmp    [selcardcode], 52
677 ataualpa 255
    jb     .something_selected
205 heavyiron 256
 
257
 
258
    mov    [whereisselcard], scTempCells
259
    mov    eax, [columnclicked]
260
    mov    [columnofselcard], eax
261
    call   draw_window
262
    jmp    .end
263
 
264
    .something_selected:
677 ataualpa 265
                             ; checking if selected and clicked cards equivalent
205 heavyiron 266
    mov     eax, [columnclicked]
267
    add     eax, tempcells
268
 
269
    mov     ebx, 0
270
    mov     bl, byte [eax]
271
    mov     [cardclicked], ebx
272
 
273
    mov     eax, [selcardcode]
274
    cmp     [cardclicked], eax
275
    jne     .not_same_card
276
 
277
    mov     [whereisselcard], scNotSelected
278
    call    draw_window
279
 
280
    .not_same_card:
281
 
677 ataualpa 282
                             ;putting cards in temp cells
205 heavyiron 283
 
284
    mov     eax, [columnclicked]
285
    add     eax, tempcells
286
 
287
    mov     ebx, 0
288
    mov     bl, byte [eax]
289
    mov     [cardclicked], ebx
290
 
291
 
292
    cmp     [cardclicked], 52
677 ataualpa 293
    jb     .end
294
                             ; if nothing lay in this cell
295
                             ; move selected card to temp cell
205 heavyiron 296
    mov     eax, [columnclicked]
297
    add     eax, tempcells
298
    mov     bl, byte [selcardcode]
299
    mov     byte [eax], bl
300
 
301
    mov     eax, [selcardaddr]
302
    mov     byte [eax], 52
303
 
304
    mov     [whereisselcard], scNotSelected
305
 
306
    call    draw_window
307
 
308
 
309
    jmp     .end
310
 
311
 
312
    .end:
313
 
314
  ret
315
 
316
;******************************************************************************
317
;                            home_cell_click(column_clicked)
318
  home_cell_click:
319
    call    get_sel_card_code_and_addr
320
 
321
    mov     eax, [columnclicked]
322
    add     eax, homecells
323
 
324
 
325
    mov     ebx, 0
326
    mov     bl, byte [eax]
327
    mov     [cardclicked], ebx
328
 
329
    mov     eax, [selcardcode]
330
    mov     bl, 4
677 ataualpa 331
    div     bl               ; reminder in ah, quotient in al
205 heavyiron 332
 
333
    mov     ebx, 0
334
    mov     bl, ah
335
    mov     [cardfamily], ebx
336
 
337
    mov     ecx, 0
338
    mov     cl, al
339
    mov     [cardrange], ecx
340
 
341
 
342
    cmp     [cardclicked], 52
677 ataualpa 343
    jb     .not_blank
344
                             ; if nothing lay in this cell
205 heavyiron 345
    cmp     [cardrange], 0
346
    jne     .end
677 ataualpa 347
                             ; move ace to home
205 heavyiron 348
    mov     eax, [columnclicked]
349
    add     eax, homecells
350
    mov     bl, byte [selcardcode]
351
    mov     byte [eax], bl
352
 
353
    mov     eax, [selcardaddr]
354
    mov     byte [eax], 52
355
 
356
    mov     [whereisselcard], scNotSelected
357
 
358
    call    draw_window
359
 
360
 
361
    jmp     .end
362
 
363
    .not_blank:
364
 
365
    mov     eax, [cardclicked]
366
    mov     bl, 4
677 ataualpa 367
    div     bl               ; reminder in ah, quotient in al
205 heavyiron 368
 
369
    mov     ebx, 0
370
    mov     bl, ah
371
    mov     [clickedcardfamily], ebx
372
 
373
    mov     ecx, 0
374
    mov     cl, al
375
    mov     [clickedcardrange], ecx
376
 
377
    cmp     [cardfamily], ebx
378
    jne     .end
379
 
380
    inc     ecx
381
    cmp     [cardrange], ecx
382
    jne     .end
383
 
677 ataualpa 384
                      ; moving card from its place to home with replacing
385
                      ; of old card in home
205 heavyiron 386
    mov     eax, [columnclicked]
387
    add     eax, homecells
388
    mov     bl, byte [selcardcode]
389
    mov     byte [eax], bl
390
 
391
    mov     eax, [selcardaddr]
392
    mov     byte [eax], 52
393
 
394
    mov     [whereisselcard], scNotSelected
395
 
396
    call    draw_window
397
 
398
 
399
 
400
    .end:
401
 
402
  ret
403
 
404
 
405
;******************************************************************************
406
  new_game_click:
407
 
408
      mov   [i], 0
409
    .deleting_cards_from_common_cells:
410
      mov   eax, cards
411
      add   eax, [i]
412
      mov   byte [eax], 52
413
 
414
 
415
      inc   [i]
416
      cmp   [i], 19*8
417
      jb    .deleting_cards_from_common_cells
418
 
419
 
420
    mov     [i], 0
421
    .filling_pack:
422
      mov   eax, pack
423
      add   eax, [i]
424
      mov   bl, byte [i]
425
      mov   byte [eax], bl
426
 
427
      inc   [i]
428
      cmp   [i], 52
429
      jb    .filling_pack
430
 
431
      mov     [i], 0
432
 
433
    .putting_cards:
434
 
435
      mov   [range], 52
436
      call  random
437
      mov   eax, [random_value]
438
      add   eax, pack
439
 
440
      mov   ebx, 0
441
      mov   bl, byte [eax]
442
      mov   [randomcard], ebx
443
 
444
      mov   eax, [random_value]
445
      mov   [j], eax
446
 
447
      cmp   [randomcard], 52
448
      jb    .found_card
449
 
450
 
451
      mov   [range], 52
452
      call  random
453
      cmp   [random_value], 26
454
      jae    .decreasing_j
455
 
456
    .increasing_j:
457
      inc   [j]
677 ataualpa 458
                             ; j mod 52
205 heavyiron 459
      mov   eax, [j]
460
      mov   edx, 0
461
      mov   ebx, 52
462
      div   ebx
463
      mov   [j], edx
464
 
465
 
466
      mov   eax, [j]
467
      add   eax, pack
468
      mov   ebx, 0
469
      mov   bl, byte [eax]
470
      mov   [randomcard], ebx
471
      cmp   [randomcard], 52
472
      jb    .found_card
473
 
474
      jmp  .increasing_j
475
 
476
 
477
    .decreasing_j:
478
      dec   [j]
677 ataualpa 479
                             ; i mod 32
205 heavyiron 480
      mov   eax, [j]
481
      mov   edx, 0
482
      mov   ebx, 52
483
      div   ebx
484
      mov   [j], edx
485
 
486
      mov   eax, [j]
487
      add   eax, pack
488
      mov   ebx, 0
489
      mov   bl, byte [eax]
490
      mov   [randomcard], ebx
491
      cmp   [randomcard], 52
492
      jb    .found_card
493
 
494
      jmp  .decreasing_j
495
 
496
    .found_card:
677 ataualpa 497
                             ; putting card from pack
205 heavyiron 498
      mov   eax, cards
499
      add   eax, [i]
500
      mov   bl, byte [randomcard]
501
      mov   byte [eax], bl
677 ataualpa 502
                             ; deleting card from pack
205 heavyiron 503
      mov   eax, pack
504
      add   eax, [j]
505
      mov   byte [eax], 52
506
 
507
 
508
      inc   [i]
509
      cmp   [i], 52
510
      jb    .putting_cards
511
 
512
 
513
 
514
 
515
      mov   [i], 0
516
    .deleting_cards_from_temp_cells:
517
      mov   eax, tempcells
518
      add   eax, [i]
519
      mov   byte [eax], 52
520
 
521
 
522
      inc   [i]
523
      cmp   [i], 4
524
      jb    .deleting_cards_from_temp_cells
525
 
526
      mov   [i], 0
527
    .deleting_cards_from_home_cells:
528
      mov   eax, homecells
529
      add   eax, [i]
530
      mov   byte [eax], 52
531
 
532
 
533
      inc   [i]
534
      cmp   [i], 4
535
      jb    .deleting_cards_from_home_cells
536
 
537
 
538
    mov     [whereisselcard], scNotSelected
539
    call    draw_window
540
 
541
 
542
  ret
543
 
544
 
545
;******************************************************************************
546
;                       get_sel_card_code_and_addr(): selcardcode, selcardaddr
547
;                       if nothing selected, then selcardcode is 52
548
  get_sel_card_code_and_addr:
549
    cmp     [whereisselcard], scNotSelected
550
    jne     .something_selected
551
 
552
    mov     [selcardcode], 52
553
    jmp     .end
554
 
555
    .something_selected:
556
    cmp     [whereisselcard], scTempCells
677 ataualpa 557
    je      .temp_cells_selected
205 heavyiron 558
 
677 ataualpa 559
                             ; common cells selected
205 heavyiron 560
    mov     eax, [columnofselcard]
561
    mov     [ncolumn], eax
562
    call    get_row_of_top_card_in_column
563
 
564
 
565
    mov     eax, [topcardrow]; eax = topcardrow * 8  + columnofselcard
566
    mov     bl, 8
677 ataualpa 567
    mul     bl                       ; result of multiplication in ax
205 heavyiron 568
    add     eax, [columnofselcard]
569
    add     eax, cards
570
 
571
 
572
    mov     [selcardaddr], eax
573
    xor     ebx, ebx
574
    mov     bl, byte [eax]
575
    mov     [selcardcode], ebx
576
 
577
    jmp     .end
578
 
579
    .temp_cells_selected:
580
 
581
    mov     eax, tempcells
582
    add     eax, [columnofselcard]
583
    mov     [selcardaddr], eax
584
    mov     ebx, 0
585
    mov     bl, byte [eax]
586
    mov     [selcardcode], ebx
587
 
588
    .end:
589
 
590
  ret
591
 
592
;******************************************************************************
593
;                            draw_window()
594
 
595
  draw_window:
596
    mov  eax,48  ; get system colors
597
    mov  ebx,3
598
    mov  ecx,syscolors
599
    mov  edx,sizeof.system_colors
485 heavyiron 600
    mcall
205 heavyiron 601
 
602
 
677 ataualpa 603
    mov     eax, 12          ; start drawing
205 heavyiron 604
    mov     ebx, 1
485 heavyiron 605
    mcall
205 heavyiron 606
 
677 ataualpa 607
    mov     eax, 0           ; create and draw the window
205 heavyiron 608
    mov     ebx, 100 * 65536 + 8 * cardwidth + 10 + 7 * columnspace
609
    mov     ecx, 100 * 65536 + 500
610
    mov     edx, 0x13008000
485 heavyiron 611
    mov     edi, title
612
    mcall
205 heavyiron 613
 
677 ataualpa 614
    mov     eax, 9           ; getting window info
205 heavyiron 615
    mov     ebx, process_info
677 ataualpa 616
    mov     ecx, -1          ; we want to know info of our window
485 heavyiron 617
    mcall
205 heavyiron 618
 
2067 dunkaist 619
    test    [process_info.wnd_state], 0x04
620
    jnz     draw_window.end_draw
205 heavyiron 621
 
2067 dunkaist 622
 
485 heavyiron 623
    mov     eax, [process_info.box.height]
205 heavyiron 624
    mov     [WindowHeight], ax
625
 
485 heavyiron 626
    mov     eax, [process_info.box.width]
205 heavyiron 627
    mov     [WindowWidth], ax
628
 
629
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
677 ataualpa 630
        ; draw top panel
205 heavyiron 631
 
632
    mov     eax, 13
633
    mov     ebx, 5
634
    shl     ebx, 16
485 heavyiron 635
    add     bx, word [process_info.box.width]
205 heavyiron 636
    sub     bx, 9
637
    mov     ecx, 22 shl 16 + topbuttonsbarheight - 1
638
    mov     edx, [syscolors.work_graph]
485 heavyiron 639
    mcall
205 heavyiron 640
 
677 ataualpa 641
                             ; draw button "new game"
205 heavyiron 642
 
643
    mov     eax, 8
644
    mov     ebx, 5 shl 16 + 80
645
    mov     ecx, 22 shl 16 + topbuttonsbarheight - 2
646
    mov     edx, 1 + 8 + 4 + 4 + 1 ;button id
647
    mov     esi, [syscolors.work_button]
485 heavyiron 648
    mcall
205 heavyiron 649
 
650
    mov     eax, 4
3580 fedesco 651
    if lang eq it
652
        mov     ebx, 7 shl 16 + 22 + topbuttonsbarheight/2 - 4
653
    else
654
        mov     ebx, 20 shl 16 + 22 + topbuttonsbarheight/2 - 4
655
    end if
205 heavyiron 656
    mov     ecx, [syscolors.work_button_text]
657
    mov     edx, new_game
658
    mov     esi, new_game_len
485 heavyiron 659
    mcall
205 heavyiron 660
 
661
 
662
       ; draw button "exit"
663
    mov     eax, 8
664
    mov     ebx, (5 + 85) shl 16 + 80 + 5
665
    mov     ecx, 22 shl 16 + topbuttonsbarheight - 2
666
    mov     edx, 1 + 8 + 4 + 4 + 2 ;button id
667
    mov     esi, [syscolors.work_button]
485 heavyiron 668
    mcall
205 heavyiron 669
 
670
    mov     eax, 4
671
    mov     ebx, (40 + 80) shl 16 + 22 + topbuttonsbarheight/2 - 4
672
    mov     ecx, [syscolors.work_button_text]
673
    mov     edx, exit
674
    mov     esi, exit_len
485 heavyiron 675
    mcall
205 heavyiron 676
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
677
;                        draw separators between home, temp and common cells
678
    mov     eax, 13
679
                   ; horizontal line
680
    mov     ebx, 5
681
    shl     ebx, 16
485 heavyiron 682
    add     bx,  word [process_info.box.width]
205 heavyiron 683
    sub     bx,  9
684
    mov     ecx, (21 + topbuttonsbarheight + cardheight + columnspace) shl 16+1
685
 
686
    mov     edx, [syscolors.work_graph]
485 heavyiron 687
    mcall
205 heavyiron 688
                  ; verical line
485 heavyiron 689
    mov     eax, [process_info.box.width]
205 heavyiron 690
    mov     edx, 0
691
    mov     ecx, 2
692
    div     ecx
693
 
694
    mov     ebx, eax
695
 
696
    ;
697
    shl     ebx, 16
698
    add     bx,  1
699
    mov     ecx, (21 + topbuttonsbarheight) shl 16 + cardheight + columnspace
700
    mov     edx, [syscolors.work_graph]
701
    mov     eax, 13
485 heavyiron 702
    mcall
205 heavyiron 703
 
704
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
705
;                            draw temp buttons
706
 
677 ataualpa 707
    mov     [j], 0           ;counter that loops from 0 to 51
205 heavyiron 708
 
709
    draw_a_temp_card:
710
 
677 ataualpa 711
                             ; code of card must be in ecx
205 heavyiron 712
    mov     eax, tempcells
713
    add     eax, [j]
714
    xor     ecx, ecx
715
    mov     cl, byte [eax]   ; placing in cl value from memory
677 ataualpa 716
                             ;  with address [tempcells + j] or
717
                             ;  j-th element of array "tempcells"
205 heavyiron 718
 
719
    mov     [cardcode], ecx
720
 
721
    mov     eax, [j]
722
    xor     edx, edx
723
    mov     ebx, 8
677 ataualpa 724
    div     ebx              ; divsion by 8 (8 columns),
725
                             ;   so in eax quotient - number of row
726
                             ;   and in edx remainder -
727
                             ;   number of column where lay card
205 heavyiron 728
 
729
    mov     [row], eax
730
    mov     [column], edx
731
 
677 ataualpa 732
    mov     eax, [process_info.box.width]       ; width of window
205 heavyiron 733
    sub     eax, 10
734
    sub     eax, cardwidth
735
    mov     ebx, 7
736
    mov     edx, 0
737
    div     ebx
738
    mov     ebx, [column]
739
    mul     ebx
740
    add     eax, 5
741
 
742
    mov     [xpos], eax
743
 
744
 
745
    mov     eax, [row]
746
    mov     bl, rowsize
747
    mul     bl
748
    add     eax, 24 + topbuttonsbarheight
749
    mov     [ypos], eax
750
 
677 ataualpa 751
                             ; checking, if this card selected
205 heavyiron 752
 
753
    mov     [negativedraw], 0
754
 
755
    cmp     [whereisselcard], scTempCells
756
    jne     .this_temp_cell_isnt_selected
757
 
758
    mov     eax, [column]
759
    cmp     [columnofselcard], eax
760
    jne     .this_temp_cell_isnt_selected
761
 
762
    mov     [negativedraw], 1
763
 
764
    .this_temp_cell_isnt_selected:
765
 
766
    call    draw_card
767
 
677 ataualpa 768
                             ; define button on place of card
205 heavyiron 769
    mov     eax, 8
770
    mov     ebx, [xpos]
771
    shl     ebx, 16
772
    add     bx, cardwidth - 1
773
    mov     ecx, [ypos]
774
    shl     ecx, 16
775
    add     cx, cardheight - 1
776
    mov     edx, [column]
777
    add     edx, 01000000000000000000000000000000b + 2 + 8;  button id = column
677 ataualpa 778
                                           ; id = 1 reserved as close button
485 heavyiron 779
    mcall
205 heavyiron 780
 
781
 
782
    inc     [j]
783
    cmp     [j], 4
677 ataualpa 784
    jb      draw_a_temp_card
205 heavyiron 785
 
786
 
787
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
788
;                            draw home buttons
677 ataualpa 789
 mov     [j], 0              ;counter that loops from 0 to 51
205 heavyiron 790
 
791
    draw_a_home_card:
792
 
793
 
677 ataualpa 794
                             ; code of card must be in ecx
205 heavyiron 795
    mov     eax, homecells
796
    add     eax, [j]
797
    xor     ecx, ecx
798
    mov     cl, byte [eax]   ; placing in cl value from memory
677 ataualpa 799
                             ;  with address [tempcells + j] or
800
                             ;  j-th element of array "tempcells"
205 heavyiron 801
 
802
    mov     [cardcode], ecx
803
 
804
    mov     eax, [j]
805
    xor     edx, edx
806
    mov     ebx, 8
677 ataualpa 807
    div     ebx              ; divsion by 8 (8 columns),
808
                             ;  so in eax quotient - number of row
809
                             ;  and in edx remainder -
810
                             ;  number of column where lay card
205 heavyiron 811
 
812
    mov     [row], eax
813
    mov     [column], edx
814
 
677 ataualpa 815
    mov     eax, [process_info.box.width]       ; width of window
205 heavyiron 816
    sub     eax, 10
817
    sub     eax, cardwidth
818
    mov     ebx, 7
819
    mov     edx, 0
820
    div     ebx
821
    mov     ebx, [column]
822
    add     ebx, 4
823
    mul     ebx
824
    add     eax, 5
825
 
826
    mov     [xpos], eax
827
 
828
    mov     eax, [row]
829
    mov     bl, rowsize
830
    mul     bl
831
    add     eax, 24 + topbuttonsbarheight
832
    mov     [ypos], eax
833
 
834
    mov     [negativedraw], 0
835
 
836
    call    draw_card
837
 
677 ataualpa 838
                             ; define button on place of card
205 heavyiron 839
 
840
    mov     eax, 8
841
    mov     ebx, [xpos]
842
    shl     ebx, 16
843
    add     bx, cardwidth - 1
844
    mov     ecx, [ypos]
845
    shl     ecx, 16
846
    add     cx, cardheight - 1
847
    mov     edx, [column]
848
    add     edx, 01000000000000000000000000000000b + 2 + 8 + 4 ; button id
849
 
677 ataualpa 850
                             ; id = 1 reserved as close button
485 heavyiron 851
    mcall
205 heavyiron 852
 
853
 
854
    inc     [j]
855
    cmp     [j], 4
677 ataualpa 856
    jb       draw_a_home_card
205 heavyiron 857
 
858
 
859
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
860
;                            draw common cards
861
 
677 ataualpa 862
    mov     [j], 0           ;counter that loops from 0 to 8 * 19
205 heavyiron 863
 
864
    draw_a_card:
865
 
866
 
677 ataualpa 867
                             ; code of card must be in ecx
205 heavyiron 868
    mov     eax, cards
869
    add     eax, [j]
870
    xor     ecx, ecx
871
    mov     cl, byte [eax]   ; placing in cl value from memory
677 ataualpa 872
                             ;  with address [cards + j] or
873
                             ;  j-th element of array "cards"
205 heavyiron 874
;    cmp     ecx, 52          ; if code of card >= 52 then there is no card
875
;    jae     no_draw
876
;
877
;    cmp     ecx, 0           ; if code of card  < 0 then there is no card
878
;    jb      no_draw
879
 
880
    mov     [cardcode], ecx
881
 
882
 
883
 
884
    mov     eax, [j]
885
    xor     edx, edx
886
    mov     ebx, 8
677 ataualpa 887
    div     ebx             ; divsion by 8 (8 columns),
888
                            ;  so in eax quotient - number of row
889
                            ;  and in edx remainder -
890
                            ;  number of column where lay card
205 heavyiron 891
 
892
    mov     [row], eax
893
    mov     [column], edx
894
 
677 ataualpa 895
    mov     eax, [process_info.box.width]       ; width of window
205 heavyiron 896
    sub     eax, 10
897
    sub     eax, cardwidth
898
    mov     ebx, 7
899
    mov     edx, 0
900
    div     ebx
901
    mov     ebx, [column]
902
    mul     ebx
903
    add     eax, 5
904
 
905
    mov     [xpos], eax
906
 
907
    mov     eax, [row]
908
    mov     bl, rowsize
909
    mul     bl
910
    add     eax, cardheight + 24 + topbuttonsbarheight + columnspace
911
    mov     [ypos], eax
912
 
913
 
914
    mov     [negativedraw], 0 ;checking, if this is selected card
915
 
916
    cmp     [whereisselcard], scCommonCells
917
    jne     .this_card_isnt_selected
918
 
919
    mov     eax, [column]
920
    cmp     [columnofselcard], eax
921
    jne     .this_card_isnt_selected
922
 
923
 
924
    mov     eax, [column]
925
    mov     [ncolumn], eax
926
    call    get_row_of_top_card_in_column
927
    mov     eax, [row]
928
    cmp     [topcardrow], eax
929
    jne     .this_card_isnt_selected
930
 
931
    mov     [negativedraw], 1
932
 
933
    .this_card_isnt_selected:
934
 
935
    call    draw_card
936
 
937
 
938
 
677 ataualpa 939
                             ; now checking if it is top card in its column
940
                             ; if it does, we'll define button on its place
205 heavyiron 941
    mov     eax, [column]
942
    mov     [ncolumn], eax
943
    call    get_row_of_top_card_in_column
944
    mov     eax, [row]
945
    cmp     [topcardrow], eax
677 ataualpa 946
    je       .define_button
205 heavyiron 947
 
948
    cmp     [topcardrow], 0
949
    jne     .no_define_button
950
 
951
    cmp     [row], 0
952
    jne     .no_define_button
953
 
954
 
955
    .define_button:
956
    mov     eax, 8
957
    mov     ebx, [xpos]
958
    shl     ebx, 16
959
    add     bx, cardwidth - 1
960
    mov     ecx, [ypos]
961
    shl     ecx, 16
962
    add     cx, cardheight - 1
963
    mov     edx, [column]
964
    add     edx, 01000000000000000000000000000000b + 2; button id = column + 2,
677 ataualpa 965
                             ; id = 1 reserved as close button
485 heavyiron 966
    mcall
205 heavyiron 967
 
968
 
969
    .no_define_button:
970
 
971
    inc     [j]
972
    cmp     [j], 8 * 19
677 ataualpa 973
    jb       draw_a_card
205 heavyiron 974
 
975
 
976
 
977
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2067 dunkaist 978
    draw_window.end_draw:
205 heavyiron 979
 
677 ataualpa 980
    mov     eax, 12          ; finish drawing
205 heavyiron 981
    mov     ebx, 2
485 heavyiron 982
    mcall
205 heavyiron 983
 
984
  ret
985
 
986
 
987
;******************************************************************************
988
;            get_row_of_top_card_in_column(ncolumn): topcardrow
989
 
990
  get_row_of_top_card_in_column:
677 ataualpa 991
                             ; number of column in ncolumn
992
                             ; returns in topcardrow
205 heavyiron 993
 
677 ataualpa 994
    mov [i], 0               ; i loops from 0 to 1, ... while card i * 8 + ncolumn
995
                             ; is valid card (0 <= its code < 52)
205 heavyiron 996
 
997
    .cycle:
998
       xor  eax, eax
999
       mov  al, 8
1000
       mov  ebx, [i]
1001
       mul  bl
1002
       add  eax, [ncolumn]
1003
       add  eax, cards
1004
       xor  ecx, ecx
1005
       mov  cl, byte [eax]
1006
 
1007
       cmp  ecx, 52
1008
       jae  .endcycle
1009
 
1010
 
1011
       cmp  [i], 18
1012
       ja   .endcycle
1013
 
1014
 
1015
       inc  [i]
1016
 
1017
       jmp  .cycle
1018
 
1019
    .endcycle:
1020
 
1021
      cmp   [i], 0
1022
      je    .dont_dec
1023
 
1024
      dec   [i]
1025
 
1026
    .dont_dec:
1027
 
1028
      mov   eax, [i]
1029
      mov   [topcardrow], eax
1030
  ret
1031
 
1032
 
1033
;******************************************************************************
1034
;                      invert_image_colors(imagetoinvert, sizeofimagetoinvert)
1035
  invert_image_colors:
1036
    mov     [i], 0
1037
 
1038
    .inverting:
1039
    mov     eax, [imagetoinvert]
1040
    add     eax, [i]
1041
 
1042
    mov     bl, byte [eax]
1043
    ;xor     ebx, ebx
1044
    ;add     ebx, 10
1045
    not     ebx
1046
 
1047
    mov     byte [eax], bl
1048
 
1049
 
1050
    inc     [i]
1051
 
1052
    mov     ecx, [sizeofimagetoinvert]
1053
    cmp     [i], ecx
677 ataualpa 1054
    jb      .inverting
205 heavyiron 1055
 
1056
    jmp   .later
1057
 
1058
 
1059
    .exit:
1060
      mov  eax, -1
485 heavyiron 1061
      mcall
205 heavyiron 1062
 
1063
    .later:
1064
 
1065
 
1066
  ret
1067
 
1068
 
1069
 
1070
;******************************************************************************
1071
;            draw_card(xpos, ypos, cardcode, negativedraw)
1072
; if negativedraw = 1 then card drawn in inverted colors
1073
 
1074
  draw_card: ; draws card with left top corner
677 ataualpa 1075
                    ; in point ([xpos],[ypos]),
1076
                    ; type of card in [cardcode]
205 heavyiron 1077
 
1078
    cmp     [cardcode], 52   ; if code of card >= 52 then there is no card
1079
    jae     .no_draw_card
1080
 
1081
 
1082
    cmp     [negativedraw], 1
1083
    jne     .no_invert1
677 ataualpa 1084
                             ;doing if negativedraw
205 heavyiron 1085
    mov     [bgcolor], $00000000
1086
    mov     [blackcolor], $00FFFFFF
1087
    mov     [redcolor], $0000FFFF
1088
 
677 ataualpa 1089
             ;inverting all images
205 heavyiron 1090
    call invert_all_images
1091
 
1092
    jmp     .colors_selection_done
1093
 
1094
    .no_invert1:
677 ataualpa 1095
                             ;doing if not negativedraw
205 heavyiron 1096
    mov     [bgcolor], $00FFFFFF
1097
    mov     [blackcolor], $00000000
1098
    mov     [redcolor], $00FF0000
1099
 
1100
 
1101
    .colors_selection_done:
1102
 
1103
    mov     eax, 13
1104
 
1105
    mov     ebx, [xpos]      ; filling card with bgcolor
677 ataualpa 1106
                             ; (big background rectangle)
205 heavyiron 1107
    mov     edx, [bgcolor]
1108
    add     ebx, 2
1109
    shl     ebx, 16
1110
    mov     bx, cardwidth - 4
1111
 
1112
    mov     ecx, [ypos]
1113
    add     ecx, 2
1114
    shl     ecx, 16
1115
    mov     cx, cardheight - 4
485 heavyiron 1116
    mcall
205 heavyiron 1117
 
1118
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1119
 
1120
    mov     ebx, [xpos]      ; left black line
1121
    shl     ebx, 16
1122
    mov     bx, 1
1123
 
1124
    mov     ecx, [ypos]
1125
    add     ecx, 5
1126
    shl     ecx, 16
1127
    xor     cx, cx
1128
    mov     cx, cardheight - 2 * radius - 2
1129
    mov     edx, [blackcolor]
485 heavyiron 1130
    mcall
205 heavyiron 1131
 
1132
    mov     ebx, [xpos]      ; left white line
1133
    inc     ebx
1134
    shl     ebx, 16
1135
    mov     bx, 1
1136
    mov     edx, [bgcolor]
485 heavyiron 1137
    mcall
205 heavyiron 1138
 
1139
    mov     ebx, [xpos]      ; right black line
1140
    add     ebx, cardwidth - 1
1141
    shl     ebx, 16
1142
    mov     bx,  1
1143
    mov     edx, [blackcolor]
485 heavyiron 1144
    mcall
205 heavyiron 1145
 
1146
    mov     ebx, [xpos]      ; right white line
1147
    add     ebx, cardwidth - 2
1148
    shl     ebx, 16
1149
    mov     bx, 1
1150
    mov     edx, [bgcolor]
485 heavyiron 1151
    mcall
205 heavyiron 1152
 
1153
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1154
 
1155
    mov     ecx, [ypos]      ; top black line
1156
    shl     ecx, 16
1157
    mov     cx, 1
1158
 
1159
    mov     ebx, [xpos]
1160
    add     ebx, 5
1161
    shl     ebx, 16
1162
    mov     bx, cardwidth - 2 * radius - 2
1163
    mov     edx, [blackcolor]
485 heavyiron 1164
    mcall
205 heavyiron 1165
 
1166
    mov     ecx, [ypos]      ; top white line
1167
    inc     ecx
1168
    shl     ecx, 16
1169
    mov     cx, 1
1170
    mov     edx, [bgcolor]
485 heavyiron 1171
    mcall
205 heavyiron 1172
 
1173
    mov     ecx, [ypos]      ; bottom black line
1174
    add     ecx, cardheight - 1
1175
    shl     ecx, 16
1176
    mov     cx,  1
1177
    mov     edx, [blackcolor]
485 heavyiron 1178
    mcall
205 heavyiron 1179
 
1180
    mov     ecx, [ypos]      ; bottom white line
1181
    add     ecx, cardheight - 2
1182
    shl     ecx, 16
1183
    mov     cx, 1
1184
    mov     edx, [bgcolor]
485 heavyiron 1185
    mcall
205 heavyiron 1186
 
1187
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1188
 
677 ataualpa 1189
    mov    eax, 1            ; drawing points
205 heavyiron 1190
    mov    edx, [blackcolor] ; black color for all pixels
1191
 
677 ataualpa 1192
    mov    ebx, [xpos]       ; draw top left corner
205 heavyiron 1193
    mov    ecx, [ypos]
1194
    inc    ebx
1195
    add    ecx, 4
485 heavyiron 1196
    mcall
205 heavyiron 1197
 
1198
    dec    ecx
485 heavyiron 1199
    mcall
205 heavyiron 1200
 
1201
    dec    ecx
1202
    inc    ebx
485 heavyiron 1203
    mcall
205 heavyiron 1204
 
1205
    dec    ecx
1206
    inc    ebx
485 heavyiron 1207
    mcall
205 heavyiron 1208
 
1209
    inc    ebx
485 heavyiron 1210
    mcall
205 heavyiron 1211
 
677 ataualpa 1212
    mov    ebx, [xpos]       ;drawing top right corner
205 heavyiron 1213
    mov    ecx, [ypos]
1214
    add    ebx, cardwidth - 2
1215
    add    ecx, 4
485 heavyiron 1216
    mcall
205 heavyiron 1217
 
1218
    dec    ecx
485 heavyiron 1219
    mcall
205 heavyiron 1220
 
1221
    dec    ebx
1222
    dec    ecx
485 heavyiron 1223
    mcall
205 heavyiron 1224
 
1225
    dec    ebx
1226
    dec    ecx
485 heavyiron 1227
    mcall
205 heavyiron 1228
 
1229
    dec    ebx
485 heavyiron 1230
    mcall
677 ataualpa 1231
                             ;drawing bottom left corner
205 heavyiron 1232
    mov    ebx, [xpos]
1233
    mov    ecx, [ypos]
1234
    inc    ebx
1235
    add    ecx, cardheight - 5
485 heavyiron 1236
    mcall
205 heavyiron 1237
 
1238
    inc    ecx
485 heavyiron 1239
    mcall
205 heavyiron 1240
 
1241
    inc    ebx
1242
    inc    ecx
485 heavyiron 1243
    mcall
205 heavyiron 1244
 
1245
    inc    ebx
1246
    inc    ecx
485 heavyiron 1247
    mcall
205 heavyiron 1248
 
1249
    inc    ebx
485 heavyiron 1250
    mcall
677 ataualpa 1251
                             ;drawing bottom right corner
205 heavyiron 1252
    mov    ebx, [xpos]
1253
    mov    ecx, [ypos]
1254
    add    ebx, cardwidth - 2
1255
    add    ecx, cardheight - 5
485 heavyiron 1256
    mcall
205 heavyiron 1257
 
1258
    inc    ecx
485 heavyiron 1259
    mcall
205 heavyiron 1260
 
1261
    dec    ebx
1262
    inc    ecx
485 heavyiron 1263
    mcall
205 heavyiron 1264
 
1265
    dec    ebx
1266
    inc    ecx
485 heavyiron 1267
    mcall
205 heavyiron 1268
 
1269
    dec    ebx
485 heavyiron 1270
    mcall
205 heavyiron 1271
 
1272
 
1273
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1274
;   drawing text and images
1275
 
1276
    mov    eax, [cardcode]
1277
    mov    edx, 0
1278
    mov    ebx, 4
1279
    div    ebx
1280
 
1281
    mov    [cardfamily], edx
1282
    mov    [cardrange], eax
1283
 
677 ataualpa 1284
                     ; counting position of small card image
205 heavyiron 1285
    mov eax, 7
1286
    mov ecx, 8*65536+8
1287
    mov edx, [xpos]
1288
    add edx, radius
1289
    shl edx, 16
1290
    mov dx, word [ypos]
1291
    add dx, radius + 8
1292
 
1293
 
1294
 
1295
    cmp    [cardfamily], 0
677 ataualpa 1296
    je     .heart
205 heavyiron 1297
 
1298
    cmp    [cardfamily], 1
677 ataualpa 1299
    je     .diamond
205 heavyiron 1300
 
1301
    cmp    [cardfamily], 2
677 ataualpa 1302
    je     .club
205 heavyiron 1303
 
1304
    cmp    [cardfamily], 3
677 ataualpa 1305
    je     .spade
205 heavyiron 1306
 
1307
    .heart:
1308
       mov esi, [redcolor]
1309
       mov [color], esi
1310
       mov [imageaddr], heart
1311
       mov [imageflipaddr], heart_updown
1312
 
1313
       mov ebx, heart_small
485 heavyiron 1314
       mcall
205 heavyiron 1315
 
1316
       jmp .selnumber
1317
 
1318
    .diamond:
1319
       mov esi, [redcolor]
1320
       mov [color], esi
1321
       mov [imageaddr], diamond
1322
       mov [imageflipaddr], diamond_updown
1323
 
1324
       mov ebx, diamond_small
485 heavyiron 1325
       mcall
205 heavyiron 1326
 
1327
       jmp .selnumber
1328
 
1329
    .club:
1330
      mov  esi, [blackcolor]
1331
      mov  [color], esi
1332
      mov  [imageaddr], club
1333
      mov  [imageflipaddr], club_updown
1334
 
1335
      mov ebx, club_small
485 heavyiron 1336
      mcall
205 heavyiron 1337
 
1338
      jmp  .selnumber
1339
 
1340
    .spade:
1341
      mov  esi, [blackcolor]
1342
      mov  [color], esi
1343
      mov  [imageaddr], spade
1344
      mov  [imageflipaddr], spade_updown
1345
 
1346
      mov ebx, spade_small
485 heavyiron 1347
      mcall
205 heavyiron 1348
 
1349
 
1350
 
1351
    .selnumber:
1352
 
677 ataualpa 1353
    mov    ebx, [xpos]       ; counting position of text
1354
                             ; in ebx, same for all cards
205 heavyiron 1355
    add    ebx, radius
1356
    shl    ebx, 16
677 ataualpa 1357
    mov    bx,  word [ypos]
1358
    add    bx,  radius
205 heavyiron 1359
 
1360
 
1361
    mov    ecx, [color]
1362
 
1363
 
1364
    cmp    [cardrange], 0
677 ataualpa 1365
    je     .ace
205 heavyiron 1366
 
1367
    cmp    [cardrange], 1
677 ataualpa 1368
    je     .two
205 heavyiron 1369
 
1370
    cmp    [cardrange], 2
677 ataualpa 1371
    je     .three
205 heavyiron 1372
 
1373
    cmp    [cardrange], 3
677 ataualpa 1374
    je     .four
205 heavyiron 1375
 
1376
    cmp    [cardrange], 4
677 ataualpa 1377
    je     .five
205 heavyiron 1378
 
1379
    cmp    [cardrange], 5
677 ataualpa 1380
    je     .six
205 heavyiron 1381
 
1382
    cmp    [cardrange], 6
677 ataualpa 1383
    je     .seven
205 heavyiron 1384
 
1385
    cmp    [cardrange], 7
677 ataualpa 1386
    je     .eight
205 heavyiron 1387
 
1388
    cmp    [cardrange], 8
677 ataualpa 1389
    je     .nine
205 heavyiron 1390
 
1391
    cmp    [cardrange], 9
677 ataualpa 1392
    je     .ten
205 heavyiron 1393
 
1394
    cmp    [cardrange], 10
677 ataualpa 1395
    je     .jack
205 heavyiron 1396
 
1397
    cmp    [cardrange], 11
677 ataualpa 1398
    je     .queen
205 heavyiron 1399
 
1400
    cmp    [cardrange], 12
677 ataualpa 1401
    je     .king
205 heavyiron 1402
 
1403
    ;      +-------+-------+-------+
1404
    ;      |   3   |   2   |   3   |   ace   = 1
1405
    ;      +-------+-------+-------+   two   = 2
1406
    ;      |       |       |       |   three = 2 + 1
1407
    ;      +-------+-------+-------+   four  = 3
1408
    ;      |       |   6   |       |   five  = 3 + 1
1409
    ;      +-------+-------+-------+   six   = 3 + 4
1410
    ;      |   5   |       |   5   |   seven = 3 + 4 + 6
1411
    ;      +-------+-------+-------+   eight = 3 + 5
1412
    ;      |   4   |   1   |   4   |   nine  = 3 + 5
1413
    ;      +-------+-------+-------+   ten   = 3 + 5 + 6 + 7
1414
    ;      |   5   |       |   5   |
1415
    ;      +-------+-------+-------+
1416
    ;      |       |   7   |       |   1 means draw_1
1417
    ;      +-------+-------+-------+
1418
    ;      |       |       |       |
1419
    ;      +-------+-------+-------+
1420
    ;      |   3   |   2   |   3   |
1421
    ;      +-------+-------+-------+
1422
 
1423
 
1424
 
1425
    .ace:
1426
      mov  eax, 4
1427
      mov  [s], byte 'A'
1428
      mov  edx, s
1429
      mov  esi, 1
485 heavyiron 1430
      mcall
205 heavyiron 1431
 
1432
      call draw_1
1433
      jmp .end
1434
 
1435
    .two:
1436
      mov  eax, 4
1437
      mov  [s], byte '2'
1438
      mov  edx, s
1439
      mov  esi, 1
485 heavyiron 1440
      mcall
205 heavyiron 1441
 
1442
      call draw_2
1443
      jmp .end
1444
 
1445
 
1446
    .three:
1447
      mov  eax, 4
1448
      mov  [s], byte '3'
1449
      mov  edx, s
1450
      mov  esi, 1
485 heavyiron 1451
      mcall
205 heavyiron 1452
 
1453
      call draw_1
1454
      call draw_2
1455
 
1456
      jmp  .end
1457
 
1458
    .four:
1459
      mov  eax, 4
1460
      mov  [s], byte '4'
1461
      mov  edx, s
1462
      mov  esi, 1
485 heavyiron 1463
      mcall
205 heavyiron 1464
 
1465
      call draw_3
1466
      jmp  .end
1467
 
1468
    .five:
1469
      mov  eax, 4
1470
      mov  [s], byte '5'
1471
      mov  edx, s
1472
      mov  esi, 1
485 heavyiron 1473
      mcall
205 heavyiron 1474
 
1475
      call draw_1
1476
      call draw_3
1477
 
1478
      jmp  .end
1479
 
1480
    .six:
1481
      mov  eax, 4
1482
      mov  [s], byte '6'
1483
      mov  edx, s
1484
      mov  esi, 1
485 heavyiron 1485
      mcall
205 heavyiron 1486
 
1487
      call draw_3
1488
      call draw_4
1489
 
1490
      jmp  .end
1491
 
1492
    .seven:
1493
      mov  eax, 4
1494
      mov  [s], byte '7'
1495
      mov  edx, s
1496
      mov  esi, 1
485 heavyiron 1497
      mcall
205 heavyiron 1498
 
1499
      call draw_3
1500
      call draw_4
1501
      call draw_6
1502
 
1503
      jmp  .end
1504
 
1505
    .eight:
1506
      mov  eax, 4
1507
      mov  [s], byte '8'
1508
      mov  edx, s
1509
      mov  esi, 1
485 heavyiron 1510
      mcall
205 heavyiron 1511
 
1512
      call draw_3
1513
      call draw_5
1514
 
1515
      jmp  .end
1516
 
1517
    .nine:
1518
      mov  eax, 4
1519
      mov  [s], byte '9'
1520
      mov  edx, s
1521
      mov  esi, 1
485 heavyiron 1522
      mcall
205 heavyiron 1523
 
1524
      call draw_3
1525
      call draw_5
1526
      call draw_1
1527
 
1528
      jmp  .end
1529
 
1530
    .ten:
1531
      mov  eax, 4
1532
      mov  [s], word '10'
1533
      mov  edx, s
1534
      mov  esi, 2
485 heavyiron 1535
      mcall
205 heavyiron 1536
 
1537
      call draw_3
1538
      call draw_5
1539
      call draw_6
1540
      call draw_7
1541
 
1542
      jmp  .end
1543
 
1544
    .jack:
1545
      mov  eax, 4
1546
      mov  [s], byte 'J'
1547
      mov  edx, s
1548
      mov  esi, 1
485 heavyiron 1549
      mcall
205 heavyiron 1550
 
1551
      jmp  .end
1552
 
1553
    .queen:
1554
      mov  eax, 4
1555
      mov  [s], byte 'Q'
1556
      mov  edx, s
1557
      mov  esi, 1
485 heavyiron 1558
      mcall
205 heavyiron 1559
 
1560
      jmp  .end
1561
 
1562
    .king:
1563
      mov  eax, 4
1564
      mov  [s], byte 'K'
1565
      mov  edx,s
1566
      mov  esi, 1
485 heavyiron 1567
      mcall
205 heavyiron 1568
 
1569
    .end:
1570
 
1571
 
1572
    cmp  [negativedraw], 1
1573
    jne  .no_invert2
1574
 
1575
    call invert_all_images
1576
 
1577
 
1578
    .no_invert2:
1579
    .no_draw_card:
1580
 
1581
  ret
1582
 
1583
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1584
;                            invert_all_images()
1585
  invert_all_images:
1586
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1587
    mov  [imagetoinvert], heart
1588
    call invert_image_colors
1589
 
1590
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1591
    mov  [imagetoinvert], diamond
1592
    call invert_image_colors
1593
 
1594
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1595
    mov  [imagetoinvert], spade
1596
    call invert_image_colors
1597
 
1598
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1599
    mov  [imagetoinvert], club
1600
    call invert_image_colors
1601
 
1602
 
1603
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1604
    mov  [imagetoinvert], heart_updown
1605
    call invert_image_colors
1606
 
1607
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1608
    mov  [imagetoinvert], diamond_updown
1609
    call invert_image_colors
1610
 
1611
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1612
    mov  [imagetoinvert], spade_updown
1613
    call invert_image_colors
1614
 
1615
    mov  [sizeofimagetoinvert], 16 * 16 * 3
1616
    mov  [imagetoinvert], club_updown
1617
    call invert_image_colors
1618
 
1619
 
1620
    mov  [sizeofimagetoinvert], 8 * 8 * 3
1621
    mov  [imagetoinvert], heart_small
1622
    call invert_image_colors
1623
 
1624
    mov  [sizeofimagetoinvert], 8 * 8 * 3
1625
    mov  [imagetoinvert], diamond_small
1626
    call invert_image_colors
1627
 
1628
    mov  [sizeofimagetoinvert], 8 * 8 * 3
1629
    mov  [imagetoinvert], spade_small
1630
    call invert_image_colors
1631
 
1632
    mov  [sizeofimagetoinvert], 8 * 8 * 3
1633
    mov  [imagetoinvert], club_small
1634
    call invert_image_colors
1635
 
1636
 
1637
 
1638
  ret
1639
 
1640
 
1641
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1642
 
1643
  draw_1:
677 ataualpa 1644
                             ;draw center image
205 heavyiron 1645
      mov     ebx, [imageaddr]
1646
      mov     ecx, 16 * 65536 + 16
1647
      mov     edx, [xpos]
1648
      add     edx, cardwidth/2 - 8
1649
      shl     edx, 16
1650
      mov     dx, word [ypos]
1651
      add     dx, cardheight/2 - 8
1652
      mov      eax, 7
485 heavyiron 1653
      mcall
205 heavyiron 1654
  ret
1655
 
1656
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1657
 
1658
 
1659
  draw_2:
677 ataualpa 1660
                             ;draw top image
205 heavyiron 1661
      mov     ebx, [imageaddr]
1662
      mov     ecx, 16 * 65536 + 16
1663
      mov     edx, [xpos]
1664
      add     edx, 40 - 8
1665
      shl     edx, 16
1666
      mov     dx, word [ypos]
1667
      add     dx, margin
1668
      mov     eax, 7
485 heavyiron 1669
      mcall
677 ataualpa 1670
                             ;draw bottom image
205 heavyiron 1671
      mov     ebx, [imageflipaddr]
1672
      mov     edx, [xpos]
1673
      add     edx, cardwidth/2 - 8
1674
      shl     edx, 16
1675
      mov     dx, word [ypos]
1676
      add     dx, cardheight - 16 - margin
1677
      mov     eax, 7
485 heavyiron 1678
      mcall
205 heavyiron 1679
  ret
1680
 
1681
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1682
 
1683
  draw_3:
677 ataualpa 1684
                             ;draw top left image
205 heavyiron 1685
      mov     ebx, [imageaddr]
1686
      mov     ecx, 16 * 65536 + 16
1687
      mov     edx, [xpos]
1688
      add     edx, margin
1689
      shl     edx, 16
1690
      mov     dx, word [ypos]
1691
      add     dx, margin
1692
      mov     eax, 7
485 heavyiron 1693
      mcall
677 ataualpa 1694
                             ;draw bottom left image
205 heavyiron 1695
      mov     ebx, [imageflipaddr]
1696
      mov     edx, [xpos]
1697
      add     edx, margin
1698
      shl     edx, 16
1699
      mov     dx, word [ypos]
1700
      add     dx, cardheight - margin - 16
1701
      mov     eax, 7
485 heavyiron 1702
      mcall
677 ataualpa 1703
                             ;draw top right image
205 heavyiron 1704
      mov     ebx, [imageaddr]
1705
      mov     edx, [xpos]
1706
      add     edx, cardwidth - margin - 16
1707
      shl     edx, 16
1708
      mov     dx, word [ypos]
1709
      add     dx, margin
1710
      mov     eax, 7
485 heavyiron 1711
      mcall
677 ataualpa 1712
                             ;draw bottom right image
205 heavyiron 1713
      mov     ebx, [imageflipaddr]
1714
      mov     edx, [xpos]
1715
      add     edx, cardwidth - margin - 16
1716
      shl     edx, 16
1717
      mov     dx, word [ypos]
1718
      add     dx, cardheight - margin - 16
1719
      mov     eax, 7
485 heavyiron 1720
      mcall
205 heavyiron 1721
  ret
1722
 
1723
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1724
 
1725
  draw_4:
677 ataualpa 1726
                             ;draw center left image
205 heavyiron 1727
      mov     ebx, [imageaddr]
1728
      mov     ecx, 16 * 65536 + 16
1729
      mov     edx, [xpos]
1730
      add     edx, margin
1731
      shl     edx, 16
1732
      mov     dx, word [ypos]
1733
      add     dx, cardheight/2 - 8
1734
      mov     eax, 7
485 heavyiron 1735
      mcall
677 ataualpa 1736
                             ;draw center right image
205 heavyiron 1737
      mov     edx, [xpos]
1738
      add     edx, cardwidth - margin - 16
1739
      shl     edx, 16
1740
      mov     dx, word [ypos]
1741
      add     dx, cardheight/2 - 8
1742
      mov     eax, 7
485 heavyiron 1743
      mcall
205 heavyiron 1744
  ret
1745
 
1746
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1747
 
1748
  draw_5:
677 ataualpa 1749
                             ;draw top left image
205 heavyiron 1750
      mov     ebx, [imageaddr]
1751
      mov     ecx, 16 * 65536 + 16
1752
      mov     edx, [xpos]
1753
      add     edx, margin
1754
      shl     edx, 16
1755
      mov     dx, word [ypos]
1756
      add     dx, cardheight * 3 / 9
1757
      mov     eax, 7
485 heavyiron 1758
      mcall
677 ataualpa 1759
                             ;draw bottom left image
205 heavyiron 1760
      mov     ebx, [imageflipaddr]
1761
      mov     edx, [xpos]
1762
      add     edx, 16
1763
      shl     edx, 16
1764
      mov     dx, word [ypos]
1765
      add     dx, cardheight * 5 / 9
1766
      mov     eax, 7
485 heavyiron 1767
      mcall
677 ataualpa 1768
                             ;draw top right image
205 heavyiron 1769
      mov     ebx, [imageaddr]
1770
      mov     edx, [xpos]
1771
      add     edx, cardwidth - margin - 16
1772
      shl     edx, 16
1773
      mov     dx, word [ypos]
1774
      add     dx, cardheight * 3 / 9
1775
      mov     eax, 7
485 heavyiron 1776
      mcall
677 ataualpa 1777
                             ;draw bottom right image
205 heavyiron 1778
      mov     ebx, [imageflipaddr]
1779
      mov     edx, [xpos]
1780
      add     edx, cardwidth - margin - 16
1781
      shl     edx, 16
1782
      mov     dx, word [ypos]
1783
      add     dx, cardheight * 5 / 9
1784
      mov     eax, 7
485 heavyiron 1785
      mcall
205 heavyiron 1786
  ret
1787
 
1788
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1789
 
1790
  draw_6:
1791
      mov     ebx, [imageaddr]
1792
      mov     ecx, 16 * 65536 + 16
1793
      mov     edx, [xpos]
1794
      add     edx, cardwidth/2 - 8
1795
      shl     edx, 16
1796
      mov     dx, word [ypos]
1797
      add     dx, cardheight * 2 / 9
1798
      mov     eax, 7
485 heavyiron 1799
      mcall
205 heavyiron 1800
  ret
1801
 
1802
 
1803
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1804
  draw_7:
1805
      mov     ebx, [imageflipaddr]
1806
      mov     ecx, 16 * 65536 + 16
1807
      mov     edx, [xpos]
1808
      add     edx, cardwidth/2 - 8
1809
      shl     edx, 16
1810
      mov     dx, word [ypos]
1811
      add     dx, cardheight * 6 / 9
1812
      mov     eax, 7
485 heavyiron 1813
      mcall
205 heavyiron 1814
  ret
1815
 
1816
 
1817
;******************************************************************************
1818
  randomize:
1819
    push eax
1820
 
1821
    mov  eax, 3
485 heavyiron 1822
    mcall
205 heavyiron 1823
 
1824
    mov  ebx, $A59E3F1C
1825
    mul  ebx
1826
    mov  dword [randseed], eax
1827
    pop  eax
1828
  ret
1829
 
1830
 
1831
 
1832
;******************************************************************************
1833
;          function Random(Range): RandomValue
1834
  random:
1835
    push ebx
1836
 
1837
    mov  eax, [randseed]
1838
    mov  edx, 0
1839
    mov  ebx, 7
1840
    div  ebx
1841
 
1842
    cmp  edx, 0
677 ataualpa 1843
    je   _0
205 heavyiron 1844
 
1845
    cmp  edx, 1
677 ataualpa 1846
    je   _1
205 heavyiron 1847
 
1848
    cmp  edx, 2
677 ataualpa 1849
    je   _2
205 heavyiron 1850
 
1851
    cmp  edx, 3
677 ataualpa 1852
    je   _3
205 heavyiron 1853
 
1854
    cmp  edx, 4
677 ataualpa 1855
    je   _4
205 heavyiron 1856
 
1857
    cmp  edx, 5
677 ataualpa 1858
    je   _5
205 heavyiron 1859
 
1860
    cmp  edx, 6
677 ataualpa 1861
    je   _6
205 heavyiron 1862
 
1863
    jmp  _end
1864
 
1865
 
1866
    _0:
1867
      ;base := base + 58 + a[8];
1868
      mov  eax, [randseed]
1869
      add  eax, 58
1870
      add  eax, dword [a + 8 * 4]
1871
      mov  [randseed], eax
1872
      jmp  _end;
1873
 
1874
    _1:
1875
      ;base := base + 1 + a[9];
1876
      mov  eax, [randseed]
1877
      add  eax, 1
1878
      add  eax, dword [a + 9 * 4]
1879
      mov  [randseed], eax
1880
      jmp _end;
1881
 
1882
    _2:
1883
      ;base := base + 4 + a[88];
1884
      mov  eax, [randseed]
1885
      add  eax, 4
1886
      add  eax, dword [a + 88 * 4]
1887
      mov  [randseed], eax
1888
      jmp _end;
1889
 
1890
    _3:
1891
      ;randseed := randseed + 79 + a[43];
1892
      mov  eax, [randseed]
1893
      add  eax, 79
1894
      add  eax, dword [a + 43 * 4]
1895
      mov  [randseed], eax
1896
      jmp _end;
1897
 
1898
    _4:
1899
      ;randseed := randseed + 3 + a[12];
1900
      mov  eax, [randseed]
1901
      add  eax, 3
1902
      add  eax, dword [a + 12 * 4]
1903
      mov  [randseed], eax
1904
      jmp _end;
1905
 
1906
    _5:
1907
      ;randseed := randseed + 2 + a[63];
1908
      mov  eax, [randseed]
1909
      add  eax, 2
1910
      add  eax, dword [a + 63 * 4]
1911
      mov  [randseed], eax
1912
      jmp _end;
1913
 
1914
    _6:
1915
      ;randseed := randseed + 151 + a[24];
1916
      mov  eax, [randseed]
1917
      add  eax, 151
1918
      add  eax, dword [a + 24 * 4]
1919
      mov  [randseed], eax
1920
 
1921
      _end:
1922
 
1923
    mov  eax, [randseed]
1924
    mov  edx, eax
1925
    shl  edx, 16
1926
    mov  bx, 100
677 ataualpa 1927
    div  bx                   ; dx = randseed mod 100
205 heavyiron 1928
 
677 ataualpa 1929
    mov  ax, dx               ; ax = randseed mod 100
205 heavyiron 1930
    mov  bx, 4
677 ataualpa 1931
    mul  bx                   ; dx:ax = (randseed mod 100) * 4
205 heavyiron 1932
    and  eax, $0000FFFF
1933
    shr  edx, 16
1934
    and  edx, $FFFF0000
677 ataualpa 1935
    or   eax, edx
205 heavyiron 1936
 
1937
    mov  eax, dword [a + eax] ; eax = dword[a + (randseed mod 100) * 4]
677 ataualpa 1938
                            ; ~ a[randseed mod 100]
205 heavyiron 1939
    mov  ebx, dword [a + 47 * 4]
677 ataualpa 1940
    mul  ebx                  ; eax = low(a[randseed mod 100] * a[47])
205 heavyiron 1941
 
1942
    add  eax, [randseed]
1943
    add  eax, $4AE783A
1944
    mov  [randseed], eax
1945
 
1946
    mov  eax, dword [a + 6 * 4]
1947
    mov  edx, 0
1948
    mov  ebx,  100
1949
    div  ebx
1950
    mov  eax, edx
1951
    mov  ebx, 4
677 ataualpa 1952
    mul  ebx                  ; eax = (dword [a + 6 * 4] mod 100) * 4 ~ a[6] mod 100
205 heavyiron 1953
 
1954
 
1955
    mov  eax, dword [a + eax] ; eax = dword [a + (dword [a + 6 * 4] mod 100) * 4
1956
 
677 ataualpa 1957
                            ; ~ a[a[6] mod 100]
205 heavyiron 1958
    add  eax, [randseed]
1959
    mov  [random_value], eax
1960
 
1961
    mov  edx, 0
1962
 
1963
    mov  ebx, [range]
1964
    div  ebx
1965
    mov  [random_value], edx
1966
 
1967
    mov  al, [TimesCalled]
1968
    xor  ah, ah
1969
    inc  al
1970
    mov  bl, 100
1971
    div  bl
1972
    mov  [TimesCalled], ah   ; TimesCalled = (TimesCalled + 1 ) mod 100
1973
 
1974
    mov  al, ah
1975
    mov  bl, 4
1976
    mul  bl
1977
    and  eax, $0000FFFF
1978
 
1979
    mov  ebx, [randseed]
1980
    mov  dword [a + eax], ebx ; a[TimesCalled] = randseed
1981
 
1982
    pop  ebx
1983
  ret
1984
 
1985
;******************************************************************************
1986
 
1987
; <--- initialised data --->
677 ataualpa 1988
if lang eq ru
1989
  title db 'Солитер',0
1990
 
1991
  new_game: db "Новая игра"
1992
  new_game_len = $ - new_game
1993
 
1994
  exit: db "Выход"
1995
  exit_len = $ - exit
1996
 
1997
  s: db "10"
1998
 
3580 fedesco 1999
else if lang eq it
2000
  title db 'Freecell',0
2001
 
2002
  new_game: db "Nuova partita"
2003
  new_game_len = $ - new_game
2004
 
2005
  exit: db "Esci"
2006
  exit_len = $ - exit
2007
 
2008
  s: db "10"
677 ataualpa 2009
else
485 heavyiron 2010
  title db 'Freecell',0
205 heavyiron 2011
 
2012
  new_game: db "New game"
2013
  new_game_len = $ - new_game
2014
 
2015
  exit: db "Exit"
2016
  exit_len = $ - exit
2017
 
2018
  s: db "10"
677 ataualpa 2019
end if
205 heavyiron 2020
 
677 ataualpa 2021
  negativedraw db 0          ; for procedure draw_card
205 heavyiron 2022
 
2023
 
1728 clevermous 2024
  spade          file 'Spade.bmp': 54
2025
  spade_updown   file 'SpadeUD.bmp': 54
2026
  spade_small    file 'SpadeSml.bmp': 54
205 heavyiron 2027
 
1728 clevermous 2028
  club           file 'Club.bmp': 54
2029
  club_updown    file 'ClubUD.bmp': 54
2030
  club_small     file 'ClubSml.bmp': 54
205 heavyiron 2031
 
1728 clevermous 2032
  diamond        file 'Diam.bmp': 54
2033
  diamond_updown file 'DiamUD.bmp': 54
2034
  diamond_small  file 'DiamSml.bmp': 54
205 heavyiron 2035
 
1728 clevermous 2036
  heart          file 'Heart.bmp': 54
2037
  heart_updown   file 'HeartUD.bmp': 54
2038
  heart_small    file 'HeartSml.bmp': 54
205 heavyiron 2039
 
2040
 
2041
  scNotSelected = 0
2042
  scCommonCells = 1
2043
  scTempCells = 2
2044
 
2045
 
2046
  whereisselcard  dd scNotSelected
677 ataualpa 2047
  columnofselcard dd 0       ; if WhereIsSelCard = scGeneralCells
2048
                             ;    then this can be 0 .. 7,
2049
                             ; if scTempCells then - 0 .. 3
2050
                             ; if scNotSelected - no matter
205 heavyiron 2051
 
2052
  tempcells: times 4 db 52;
2053
  homecells: times 4 db 52 ; maximal card code is 51
2054
  cards:     times 8 * 19 db 52; - %
2055
  pack:      times 52 db ?
2056
 
2057
 
2058
 
2059
udata
2060
  process_info process_information
2061
  syscolors system_colors
2062
 
2063
  WindowHeight rw 1
2064
  WindowWidth rw 1
2065
 
2066
  xpos rd 1
2067
  ypos rd 1
2068
  bgcolor rd 1
2069
  blackcolor rd 1
2070
  redcolor rd 1
2071
 
2072
 
677 ataualpa 2073
  lastparam rd 1                  ;
205 heavyiron 2074
 
677 ataualpa 2075
  randomcard rd 1                ; for new_game_click
205 heavyiron 2076
 
677 ataualpa 2077
  columnclicked rd 1             ; used in common_card_click, temp_cell_click,
2078
  cardclicked rd 1               ;    home_cell_click
2079
  clickedcardrange rd 1          ;
2080
  clickedcardfamily rd 1         ;
205 heavyiron 2081
 
2082
 
677 ataualpa 2083
  selcardcode rd 1               ; for procedure get_sel_card_code_and_addr
2084
  selcardaddr rd 1               ;
205 heavyiron 2085
 
677 ataualpa 2086
  column rd 1                    ; for procedure draw_window
2087
  row rd 1                          ;
205 heavyiron 2088
 
677 ataualpa 2089
  imagetoinvert rd 1             ; for procedure invert_image_colors
2090
  sizeofimagetoinvert rd 1       ;
205 heavyiron 2091
 
677 ataualpa 2092
  ncolumn rd 1                   ; for procedure get_row_of_top_card_in_column
2093
  topcardrow rd 1                ;
205 heavyiron 2094
 
2095
 
677 ataualpa 2096
  color rd 1                     ; for procedue draw_card
2097
  imageaddr rd 1                 ;
2098
  imageflipaddr rd 1             ;
205 heavyiron 2099
 
677 ataualpa 2100
  cardcode rd 1                  ; used in differrent procedures
2101
  cardrange rd 1                 ; cardcode = cardrange * 4 + cardfamily
2102
  cardfamily rd 1                ;
205 heavyiron 2103
 
677 ataualpa 2104
  a: times 100 rd 1              ; for function Random
2105
  range rd 1                     ;
2106
  random_value rd 1              ;
2107
  randseed rd 1                  ;
2108
  TimesCalled rb 1               ;
205 heavyiron 2109
 
677 ataualpa 2110
  j rd 1                         ; number of card (in array cards) drawn now
2111
  i rd 1                         ; used in many procedures of 1-st level
205 heavyiron 2112
  k rd 1
2113
 
2114
  cardwidth = 80
2115
  cardheight = 120
677 ataualpa 2116
  radius = 4                     ; not recommended to change
2117
  rowsize = 30                   ; distance between top poins
2118
                                 ;of cards in neighboring rows
2119
  columnspace = 5                ; minimal space between cards
2120
  margin = 14                       ; margin of every card
205 heavyiron 2121
 
2122
  topbuttonsbarheight = 20
2123
 
2124
 
2067 dunkaist 2125
meos_app_end