-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordPuzzle.asm
More file actions
1716 lines (1463 loc) · 27.6 KB
/
Copy pathwordPuzzle.asm
File metadata and controls
1716 lines (1463 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.386
.model flat, stdcall
.stack 4096
ExitProcess proto, dwExitCode:dword
GetStdHandle PROTO, ; get standard handle
nStdHandle:DWORD ; type of console handle
GetTickCount PROTO ; get elapsed milliseconds
; since computer turned on
ReadConsoleA PROTO,
handle:DWORD, ; input handle
lpBuffer:PTR BYTE, ; pointer to buffer
nNumberOfCharsToRead:DWORD, ; number of chars to read
lpNumberOfCharsRead:PTR DWORD, ; number of chars read
lpReserved:PTR DWORD ; 0 (not used - reserved)
WriteConsoleA PROTO, ; write a buffer to the console
handle:DWORD, ; output handle
lpBuffer:PTR BYTE, ; pointer to buffer
nNumberOfCharsToWrite:DWORD, ; size of buffer
lpNumberOfCharsWritten:PTR DWORD, ; number of chars written
lpReserved:PTR DWORD ; 0 (not used)
CreateFileA PROTO, ; create new file
pFilename:PTR BYTE, ; ptr to filename
accessMode:DWORD, ; access mode
shareMode:DWORD, ; share mode
lpSecurity:DWORD, ; can be NULL
howToCreate:DWORD, ; how to create the file
attributes:DWORD, ; file attributes
htemplate:DWORD ; handle to template file
ReadFile PROTO, ; read buffer from input file
fileHandle:DWORD, ; handle to file
pBuffer:PTR BYTE, ; ptr to buffer
nBufsize:DWORD, ; number bytes to read
pBytesRead:PTR DWORD, ; bytes actually read
pOverlapped:PTR DWORD ; ptr to asynchronous info
WriteFile PROTO, ; write buffer to output file
fileHandle:DWORD, ; output handle
pBuffer:PTR BYTE, ; pointer to buffer
nBufsize:DWORD, ; size of buffer
pBytesWritten:PTR DWORD, ; number of bytes written
pOverlapped:PTR DWORD ; ptr to asynchronous info
GetTimeFormatA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
SetConsoleTextAttribute PROTO,
nStdHandle:DWORD, ; console output handle
nColor:DWORD ; color attribute
SetConsoleCursorPosition PROTO,
handle:DWORD,
pos:DWORD
.data
char byte ?
empSpace byte " "
string1 byte " |----------Welcome to the Puzzle World----------|",0
string2 byte 0dh,0ah, "You have 10 minutes to complete the game. Your time started at: ",0
timeformat byte "hh:mm:ss tt", 0
direction0 byte "Possible Directions:"
direction1 byte " 0 "
direction2 byte " | "
direction3 byte " | "
direction4 byte " 5 ------o------ 1"
direction5 byte " / | \ "
direction6 byte " / | \ "
direction7 byte " 4 3 2 "
systime byte 15 dup (?)
string4 byte 0dh,0ah,"Words to be found: Score:",0
score sword 0
bytescore byte 5 dup(?)
string5 byte 0dh,0ah,"Please enter the word, row no, column no and direction no (e.g. dummyword 1 2 0):",0
chosefile byte 90 dup (?)
filepath byte "C:\Users\Kalicifer\Downloads\wordsa.txt",0
tickPath byte "C:\Users\Kalicifer\Downloads\tick.txt",0
abc byte "ABCDEFGHIJKLMNOPQRSTUVWXYZ",0
tempGrid dword 300 dup(?)
buffer byte 5000 dup(?)
Grid byte 705 dup(?) ;================> check getBlocks proc to calculate blocks
ngrid dword 15 ;================> adjustable NxN grid size
x dword ?
checkcount dword ?
seed dword ?
boolword dword 8 dup(?)
count dword 0
rand dword 0
theWord byte 10 dup (?)
Direction byte ?
colNo byte ?
rowNo byte ?
startTime dword ?
endTime dword ?
checkWord byte 90 dup (?)
wordOff dword 400 dup(?)
.code
;==========================ToChangeGridblocks==============================
;==========================to change blocks first adjust Grid==============
getBlocks proc uses esi
mov eax, ngrid
mul ngrid
mov esi, eax
add esi, esi
add esi, eax
mov eax, esi
mov esi, ngrid
shl esi, 1
add eax, esi
ret
getBlocks endp
;========================== Main Proc==============================
main proc
call loadStart
call WriteToGrid
call hideWords
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset Grid, lengthof Grid, offset x, 0
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset string5, lengthof string5, offset x, 0
call startGame
invoke ExitProcess, 0
main endp
;========================== DisplayDirection==============================
movecursor proc uses eax ebx
mov ebx, 3
rol ebx, 16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset direction0, lengthof direction0, offset x, 0
mov ebx, 4
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11 ;keyboard input handle
invoke WriteConsoleA, EAX, offset direction1, lengthof direction1, offset x, 0
mov ebx, 5
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11 ;keyboard input handle
invoke WriteConsoleA, EAX, offset direction2, lengthof direction2, offset x, 0
mov ebx, 6
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset direction3, lengthof direction3, offset x, 0
mov ebx, 7
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset direction4, lengthof direction4, offset x, 0
mov ebx, 8
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset direction5, lengthof direction5, offset x, 0
mov ebx, 9
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset direction6, lengthof direction6, offset x, 0
mov ebx, 10
rol ebx,16
mov bx, 36
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset direction7, lengthof direction7, offset x, 0
mov ebx, 12
rol ebx,16
mov bx, 0
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
ret
movecursor endp
;==========================LoadStartProcedures==============================
loadStart proc
invoke GetTickCount
mov seed, eax
mov startTime, eax
invoke GetTimeFormatA, 0800h, 0, 0, offset timeformat, offset systime , lengthof systime
invoke CreateFileA, offset filepath, 1, 0, 0, 3, 128, 0
;eax will be the handle
invoke ReadFile, eax, offset buffer, lengthof buffer, offset x, 0
invoke GetStdHandle, -11
call chooseFile
call shuffleSort
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset string1, lengthof string1, offset x, 0
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset string2, lengthof string2, offset x, 0
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset systime, lengthof systime, offset x, 0
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset string4, lengthof string4, offset x, 0
mov ebx, 0
mov bl, 7
shl bl, 4
or bl, 0
;mov ebx, 0
;mov bl, 0
;shl bl, 4
;or bl, 7
invoke GetStdHandle, -11
invoke SetConsoleTextAttribute, eax, ebx
mov ebx, 2
rol ebx, 16
mov bx, 69
invoke GetStdHandle, -11
invoke SetConsoleCursorPosition, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset bytescore, lengthof bytescore, offset x, 0
mov ebx, 0
mov bl, 0
shl bl, 4
or bl, 7
invoke GetStdHandle, -11
invoke SetConsoleTextAttribute, eax, ebx
invoke GetStdHandle, -11
invoke WriteConsoleA, EAX, offset chosefile, lengthof chosefile, offset x, 0
call movecursor
ret
loadStart endp
;========================== Take Random 8 words==============================
chooseFile proc uses eax ebx ecx esi
mov eax, 486
call generaterandom
mov ecx, eax
mov esi, offset buffer
l1:
cmp ecx, 0
je exit
mov al, [esi]
inc esi
cmp al, 0dh
jne l1
dec ecx
jmp l1
exit:
mov ecx, 8
mov ebx, offset chosefile
l2:
cmp ecx, 0
je exit2
mov al, [esi]
cmp al, 0dh
je inhere
checkme:
cmp al, 0ah
je inhere
and al, 11011111b
inhere:
mov [ebx], al
inc esi
inc ebx
cmp al, 0dh
jne l2
dec ecx
jmp l2
exit2:
mov cx, 0ah
mov [ebx], cx
inc ebx
mov al, 0
mov [ebx], al
ret
chooseFile endp
;========================== Write Random letters to Grid==============================
WriteToGrid proc uses ebx ecx edx esi ebp
mov eax, lengthof Grid
mov edx, ngrid
shl edx, 1
sub eax, edx
cdq
mov ecx, 3
div ecx
mov ecx, 1
mov edi, eax
inc edi
mov esi, offset Grid
mov eax, 0
mov ah, 32
mov bl, 20h
mov bp, 0d0ah
writeTo:
cmp edi, ecx
je endloop
mov edx, offset abc
mov eax, 26
call generaterandom
add edx, eax
mov al, [edx]
mov [esi], al
inc esi
mov [esi], bl
inc esi
mov [esi], bl
inc esi
push ecx
call CheckGrid
cmp eax, 0
jne endhere
mov [esi], bp
inc esi
endhere:
inc ecx
jmp writeTo
endloop:
ret
WriteToGrid endp
;========================== Generate Random==============================
generaterandom proc uses ebx edx
mov ebx, eax ; maximum value
mov eax, 343FDh
imul seed
add eax, 269EC3h
mov seed, eax ; save the seed for the next call
ror eax,8 ; rotate out the lowest digit
mov edx,0
div ebx ; divide by max value
mov eax, edx ; return the remainder
ret
generaterandom endp
;==========================CheckForNewLine==============================
CheckGrid proc uses edx esi
mov eax, [esp+12]
cdq
div ngrid
mov eax, edx
ret 4
CheckGrid endp
;==========================hideWords=====================================
hideWords proc uses esi
mov ebx, offset boolword
mov esi, [ebx]
push esi
call horizontalR
mov esi, [ebx+4]
push esi
call horizontalS
mov esi, [ebx+8]
push esi
call hideColU
mov esi, [ebx+12]
push esi
call hideCold
mov esi, [ebx+16]
push esi
call diagnoalS
mov esi, [ebx+20]
push esi
call diagnoalR
mov eax, 3
call generaterandom
cmp eax, 0
je word1
cmp eax, 1
je word2
cmp eax, 2
je word3
word1:
mov esi, [ebx+24]
push esi
call horizontalR
mov esi, [ebx+28]
push esi
call hideColU
jmp exit
word2:
mov esi, [ebx+24]
push esi
call hideCold
mov esi, [ebx+28]
push esi
call diagnoalS
jmp exit
word3:
mov esi, [ebx+24]
push esi
call diagnoalR
mov esi, [ebx+28]
push esi
call horizontalS
exit:
;incomplete
ret
hideWords endp
;==========================MatchOffset=====================================
matchOffset proc uses esi ebx ebp ecx
mov ecx, lengthof wordOff
mov esi, offset wordOff
loopout:
mov eax, [esi]
mov ebp, offset tempGrid
loopin:
mov ebx, [ebp]
add ebp, 4
cmp ebx, 0
je endloop
cmp eax, ebx
je break
jmp loopin
endloop:
add esi, 4
loop loopout
mov eax, 0
break:
exit:
ret
matchOffset endp
;==========================DonotRepeatRand=====================================
repeatRand proc uses edx ecx esi
again:
mov eax, 706
call generaterandom
mov edx, offset tempGrid
mov esi, edx
mov ecx, lengthof tempGrid
looped1:
mov ebp, [esi]
cmp eax, esi
je again
add esi, 4
loop looped1
add edx, rand
mov [edx], eax
add rand, 4
ret
repeatRand endp
;==========================GetOffsetDimension=====================================
getOffsetDim proc uses ecx eax
mov ebx, 0
mov edx, offset tempGrid
again:
mov esi, offset Grid
call repeatRand
add esi, eax
mov al, [esi]
cmp al, 20h
je again
cmp al, 0dh
je again
cmp al, 0ah
je again
ret
getOffsetDim endp
;==========================Hidein-Str-Horizontal=====================================
horizontalS proc uses esi ebx ecx ebp
mov rand, 0
mov edi, count
again:
call getOffsetDim
mov ecx, 0
mov ebx, [esp+20]
wirtetemp:
mov al, [ebx]
cmp al, 0dh
je notexit
inc ecx
inc ebx
jmp wirtetemp
notexit:
mov eax, offset Grid
add eax, lengthof Grid
dec eax
mov edx, 0
mov ebp, offset tempGrid
push esi
loop1:
mov bl, [esi]
cmp bl, 0dh
je exit
cmp bl, 0ah
je exit
cmp bl, 20h
je exit
cmp edx, ecx
je exit
mov [ebp], esi
add ebp, 4
add esi, 3
inc edx
cmp esi, eax
ja exit
jmp loop1
Exit:
pop esi
call matchOffset
cmp eax, 0
jne again
cmp edx, ecx
jl again
mov eax,offset wordOff
mov ebx, [esp+20]
mov count, edi
mov edx, count
add eax, edx
mov edx, 0
writeword:
mov cl, [ebx]
cmp cl, 0dh
je exit2
mov [eax], esi
mov [esi],cl
add edx, 4
add eax, 4
add esi, 3
inc ebx
jmp writeword
exit2:
add count, edx
ret 4
horizontalS endp
;==========================Hidein-Rev-Horizontal=====================================
horizontalR proc uses esi ebx ecx ebp
mov rand, 0
mov edi, count
again:
call getOffsetDim
mov ecx, 0
mov ebx, [esp+20]
wirtetemp:
mov al, [ebx]
cmp al, 0dh
je notexit
inc ecx
inc ebx
jmp wirtetemp
notexit:
mov eax, offset Grid
mov edx, 0
mov ebp, offset tempGrid
push esi
loop1:
mov bl, [esi]
cmp bl, 20h
je exit
cmp bl, 0dh
je exit
cmp bl, 0ah
je exit
cmp edx, ecx
je exit
mov [ebp], esi
add ebp, 4
sub esi, 3
inc edx
cmp esi, eax
jb exit
jmp loop1
Exit:
pop esi
call matchOffset
cmp eax, 0
jne again
cmp edx, ecx
jl again
mov eax,offset wordOff
mov ebx, [esp+20]
mov count, edi
mov edx, count
add eax, edx
mov edx, 0
writeword:
mov cl, [ebx]
cmp cl, 0dh
je exit2
mov [eax], esi
mov [esi],cl
add eax, 4
add edx, 4
sub esi, 3
inc ebx
jmp writeword
exit2:
add count, edx
ret 4
horizontalR endp
;==========================Hidein-Str-diagnoal=====================================
diagnoalS proc uses esi ebx ecx ebp
mov edi, count
startover:
mov rand, 0
again:
call getOffsetDim
mov ebx, [esp+20]
mov ecx, 0
wirtetemp:
mov al, [ebx]
cmp al, 0dh
je notexit
inc ecx
inc ebx
jmp wirtetemp
notexit:
mov eax, offset Grid
add eax, lengthof Grid
dec eax
mov edx, 0
mov ebp, offset tempGrid
push esi
loop1:
mov bl, [esi]
cmp bl, 0dh
je exit
cmp bl, 20h
je exit
cmp bl, 0ah
je exit
cmp edx, ecx
je exit
mov [ebp], esi
add ebp, 4
add esi, 49
inc edx
cmp esi, eax
ja exit
jmp loop1
Exit:
pop esi
call matchOffset
cmp eax, 0
jne again
cmp edx, ecx
jl again
mov ebx, [esp+20]
mov edx,offset wordOff
mov ecx, 0
mov count, edi
mov eax, count
add edx, eax
mov eax, 0
writeword:
cmp ch, 11
je startover
mov cl, [ebx]
cmp cl, 0dh
je exit2
mov [edx], esi
mov [esi],cl
add eax, 4
add edx, 4
add esi, 49
inc ebx
inc ch
jmp writeword
exit2:
add count, eax
ret 4
diagnoalS endp
;==========================Hidein-Rev-diagnoal=====================================
diagnoalR proc uses esi ebx ecx ebp
mov edi, count
startover:
mov rand, 0
again:
call getOffsetDim
mov ebx, [esp+20]
mov ecx, 0
wirtetemp:
mov al, [ebx]
cmp al, 0dh
je notexit
inc ecx
inc ebx
jmp wirtetemp
notexit:
mov eax, offset Grid
add eax, lengthof Grid
sub eax, 20
dec eax
mov edx, 0
mov ebp, offset tempGrid
push esi
loop1:
mov bl, [esi]
cmp bl, 0dh
je exit
cmp bl, 20h
je exit
cmp bl, 0ah
je exit
cmp edx, ecx
je exit
mov [ebp], esi
add ebp, 4
add esi, 43
inc edx
cmp esi, eax
ja exit
jmp loop1
Exit:
pop esi
call matchOffset
cmp eax, 0
jne again
cmp edx, ecx
jl again
mov ebx, [esp+20]
mov edx,offset wordOff
mov count, edi
mov eax, count
add edx, eax
mov ecx, 0
mov eax, 0
writeword:
cmp ch, 11
je startover
mov cl, [ebx]
cmp cl, 0dh
je exit2
mov [edx], esi
mov [esi],cl
add eax, 4
add edx, 4
add esi, 43
inc ebx
inc ch
jmp writeword
exit2:
add count, eax
ret 4
diagnoalR endp
;==========================HideinUpwardColumn=====================================
hideColU proc uses esi ebx ecx ebp
mov edi, count
mov rand, 0
again:
call getOffsetDim
mov ebx, [esp+20]
mov ecx, 0
wirtetemp:
mov al, [ebx]
cmp al, 0dh
je notexit
inc ecx
inc ebx
jmp wirtetemp
notexit:
mov eax, offset Grid
add eax, lengthof Grid
dec eax
sub eax, 55
mov edx, 0
mov ebp, offset tempGrid
push esi
loop1:
mov bl, [esi]
cmp bl, 0dh
je exit
cmp bl, 20h
je exit
cmp bl, 0ah
je exit
cmp edx, ecx
je exit
mov [ebp], esi
add ebp, 4
add esi, 46
inc edx
cmp esi, eax
ja exit
jmp loop1
Exit:
pop esi
call matchOffset
cmp eax, 0
jne again
cmp edx, ecx
jl again
mov eax,offset wordOff
mov ebx, [esp+20]
mov count, edi
mov edx, count
add eax, edx
mov edx, 0
writeword:
mov cl, [ebx]
cmp cl, 0dh
je exit2
mov [eax], esi
mov [esi],cl
add edx, 4
add eax, 4
add esi, 46
inc ebx
jmp writeword
exit2:
add count, edx
ret 4
hideColU endp
;==========================HideinDownwardColumn=====================================
hideCold proc uses esi ebx ecx ebp
mov rand, 0
mov edi, count
again:
call getOffsetDim
mov ebx, [esp+20]
mov ecx, 0
wirtetemp:
mov al, [ebx]
cmp al, 0dh
je notexit
inc ecx
inc ebx
jmp wirtetemp
notexit:
mov eax, offset Grid
add eax, 50
mov edx, 0
mov ebp, offset tempGrid
push esi
loop1:
mov bl, [esi]
cmp bl, 0dh
je exit
cmp bl, 20h
je exit
cmp bl, 0ah
je exit
cmp edx, ecx
je exit
mov [ebp], esi
add ebp, 4
sub esi, 46
inc edx
cmp esi, eax
jb exit
jmp loop1
Exit:
pop esi
call matchOffset
cmp eax, 0
jne again
cmp edx, ecx
jl again
mov eax,offset wordOff
mov ebx, [esp+20]
mov count, edi
mov edx, count
add eax, edx
mov edx, 0
writeword:
mov cl, [ebx]
cmp cl, 0dh
je exit2