Repository navigation
Expand file tree
/
Copy pathAddTwo.asm
More file actions
822 lines (686 loc) · 13.9 KB
/
Copy pathAddTwo.asm
File metadata and controls
822 lines (686 loc) · 13.9 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
INCLUDE Irvine32.inc
INCLUDE Macros.inc
INCLUDELIB user32.lib
INCLUDELIB Winmm.lib
GetKeyState PROTO, nVirtkey:DWORD; 判斷按鍵狀況
PlaySound PROTO, pszSound:PTR BYTE, hmod : DWORD, fdwSound : DWORD
mGoTo MACRO indexX : REQ, indexY : REQ; 移動游標
PUSH edx
MOV dl, indexX
MOV dh, indexY
call Gotoxy
POP edx
ENDM
mWrite MACRO drawText : REQ; 劃出圖像
LOCAL string
.data
string BYTE drawText, 0
.code
PUSH edx
MOV edx, OFFSET string
call WriteString
POP edx
ENDM
VK_LEFT EQU 000000025h; 左方向鍵
VK_RIGHT EQU 000000027h; 右方向鍵
.data; this is the data area
arr byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 地圖陣列
arr_y byte 0, 3, 6, 9, 12, 15, 18, 21, 24, 27; 地圖陣列之y座標紀錄
arr_x byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 地圖陣列之x座標紀錄
arr_type byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 0:一般地板 1 : Sham 2 : 尖刺 3 : 滾動
lg_type byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
top DWORD 0
bottom DWORD 9
FloorCount byte 2
CurrentFloor byte 2
DropSpeed EQU 200; 掉落速度
DropStartTime DWORD ? ; 掉落起始時間
DropTimer DWORD ? ;Drop Timer
KeySpeed EQU 50; 鍵盤輸入速度
KeyStartTime DWORD ? ; 鍵盤輸入起始時間
KeyTimer DWORD ? ; Key Timer
FloorSpeed EQU 500; 上升速度
FloorStartTime DWORD ? ; 上升起始時間
FloorTimer DWORD ? ; Floor Timer
StateSpeed EQU 10; player狀態刷新速度
StateStartTime DWORD ? ; 狀態刷新起始時間
StateTimer DWORD ? ; State Timer
InitialPos_X1 EQU 50; 角色1起始位置X
InitialPos_Y1 EQU 1; 角色1起始位置Y
CurrentPos_X1 BYTE InitialPos_X1; 角色1當前位置X
CurrentPos_Y1 BYTE InitialPos_Y1; 角色1當前位置Y
Player1 EQU 'A'
Score1 DWORD 0; 角色1分數
InitialPos_X2 EQU 60; 角色2起始位置X
InitialPos_Y2 EQU 1; 角色2起始位置Y
CurrentPos_X2 BYTE InitialPos_X2; 角色2當前位置X
CurrentPos_Y2 BYTE InitialPos_Y2; 角色2當前位置Y
Player2 EQU 'B'
Score2 DWORD 0; 角色2分數
Wall EQU '|'; 牆壁
Floor EQU 'TTTTTTTTTT'
Sham EQU 'HHHHHHHHHH'; 踩到一秒後掉落
Spike EQU 'AAAAAAAAAA'; 踩到後死亡
RollRight_1 EQU '->->->->->'
RollRight_2 EQU '>->->->->-'
RollLeft_1 EQU '-<-<-<-<-<'
RollLeft_2 EQU '<-<-<-<-<-'
RollState Byte 0
decision Byte 0
Empty EQU ' '
Min_X EQU 30
Max_X EQU 91; 地圖寬
Min_Y EQU 0
Max_Y EQU 30; 地圖高
flag DWORD 0
State1 BYTE 0; 0:不在樓梯上,1:在樓梯上,2:死掉,3:跌在其他人身上
State2 BYTE 0
Floor_type1 byte ? ; 0:一般地板 1 : sham 2 : spikes 3 : roll
Floor_type2 byte ?
;--------------------------------------------------------------
SND_ALIAS DWORD 00010000h
SND_RESOURCE DWORD 00040005h
SND_FILENAME DWORD 00020001h
file BYTE "C:\\Users\\wabby\\Desktop\\assembly code\\test\\c.wav", 0
.code; this is the code area
main proc
;INVOKE PlaySound, OFFSET deviceConnect, NULL, SND_ALIAS
INVOKE PlaySound, OFFSET file, NULL, SND_FILENAME
mov esi, 0
mov ecx, 10
call Randomize
FloorInitial :
mov eax, 6
call RandomRange
mov arr[esi], al
mov eax, 4
call RandomRange
mov arr_type[esi], al
inc esi
loop FloorInitial
call ShowWall
call ShowRole
Invoke ExitProcess, 0
main endp
; ----------------------------------------
; 畫出人物
; ----------------------------------------
ShowRole PROC
INVOKE GetTickCount
mov DropstartTime, eax
mov KeyStartTime, eax
mov FloorStartTime, eax
mov StateStartTime, eax
Drop :
.IF State1 == 2 && State2 == 2
jnl EndDrop; 跳出迴圈
.ENDIF
call ShowScore
; 計算掉落的timer
INVOKE GetTickCount; get new tick count
sub eax, DropstartTime; get elapsed milliseconds
mov DropTimer, eax
; 計算鍵盤輸入的timer
INVOKE GetTickCount; get new tick count
sub eax, KeyStartTime
mov KeyTimer, eax
; 計算地板輸入的timer
INVOKE GetTickCount; get new tick count
sub eax, FloorStartTime
mov FloorTimer, eax
INVOKE GetTickCount
sub eax, StateStartTime
mov StateTimer, eax
.IF DropTimer > DropSpeed
call ShowDrop
call ChangeState
INVOKE GetTickCount; get starting tick count
mov DropStartTime, eax; save it
.ENDIF
.IF StateTimer > StateSpeed
call ChangeState
INVOKE GetTickCount; get starting tick count
mov StateStartTime, eax
.ENDIF
.IF KeyTimer > KeySpeed
call key
INVOKE GetTickCount; get starting tick count
mov KeyStartTime, eax
.ENDIF
.IF FloorTimer > FloorSpeed
.IF State1 != 2
inc Score1
.ENDIF
.IF State2 != 2
inc Score2
.ENDIF
call Left_Right
call ShowFloor
call ChangeState
INVOKE GetTickCount; get starting tick count
mov FloorStartTime, eax
.ENDIF
.IF CurrentPos_Y1 <= 0 || CurrentPos_Y1 >= 31; player1超出範圍
mov State1, 2
.ENDIF
.IF CurrentPos_Y2 <= 0 || CurrentPos_Y2 >= 31; player2超出範圍
mov State2, 2
.ENDIF
.IF State1 != 2; player1死亡
mGoTo CurrentPos_X1, CurrentPos_Y1
mWrite Player1
.ENDIF
.IF State2 != 2; player2死亡
mGoTo CurrentPos_X2, CurrentPos_Y2
mWrite Player2
.ENDIF
jmp Drop
EndDrop :
call ShowEnd
Invoke sleep, 5000
ret
ShowRole ENDP
; ----------------------------------------
; Floor
; ----------------------------------------
ShowFloor PROC USES eax
mov esi, 0
mov eax, 0
mov al, FloorCount
mov CurrentFloor, al
EmptyLoop : ; 擦去上一次樓梯的迴圈
mov al, arr[esi]
mov bl, 10
mul bl
add al, 31
.IF FloorCount != 0 || esi != 0
mGoto al, CurrentFloor
mWrite Empty
.ENDIF
add CurrentFloor, 3
inc esi
.IF esi < 10
JMP EmptyLoop
.ENDIF
.IF FloorCount == 0; 最上層的地板要超過天花板,陣列需要更新
mov FloorCount, 2
mov esi, 0
mov ecx, 9
L1:
mov al, arr[esi + 1]
mov arr[esi], al
mov al, arr_type[esi + 1]
mov arr_type[esi], al
mov al, lg_type[esi + 1]
mov lg_type[esi], al
inc esi
Loop L1
mov eax, 6
call RandomRange
mov arr[9], al
mov eax, 4
call RandomRange
mov arr_type[9], al
mov eax, 2
call RandomRange
mov lg_type[9], al
.ELSEIF
dec FloorCount
.ENDIF
mov esi, 0
mov eax, 0
mov al, FloorCount
mov CurrentFloor, al
.IF State1 == 1 || State1 == 3; on the stair
mGoto CurrentPos_X1, CurrentPos_Y1
mWrite ' '
dec CurrentPos_Y1
.ENDIF
.IF State2 == 1 || State2 == 3
mGoto CurrentPos_X2, CurrentPos_Y2
mWrite ' '
dec CurrentPos_Y2
.ENDIF
FloorLoop:; 畫樓梯的迴圈
mov al, arr[esi]
mov bl, 10
mul bl
add al, 31
mov arr_x[esi], al
mov ah, CurrentFloor
mov arr_y[esi], ah
.IF FloorCount != 0 || esi != 0
mGoto al, CurrentFloor
.IF arr_type[esi] == 0
mWrite Floor
.ELSEIF arr_type[esi] == 1
mWrite Sham
dec CurrentFloor
mov al, CurrentFloor
.IF CurrentPos_Y1 == al && State1 == 1
mov arr_type[esi], 4; 下次不印東西
.ENDIF
.IF CurrentPos_Y2 == al && State2 == 1
mov arr_type[esi], 4; 下次不印東西
.ENDIF
inc CurrentFloor
.ELSEIF arr_type[esi] == 2
mWrite Spike
.ELSEIF arr_type[esi] == 3
.IF lg_type[esi] == 1
.IF RollState == 0
mWrite RollRight_1
.ELSE
mWrite RollRight_2
.ENDIF
.ELSEIF lg_type[esi] == 0
.IF RollState == 0
mWrite RollLeft_1
.ELSE
mWrite RollLeft_2
.ENDIF
.ENDIF
.ENDIF
.ENDIF
add CurrentFloor, 3
inc esi
.IF esi < 10
JMP FloorLoop
.ENDIF
.IF RollState == 0
mov RollState, 1
.ELSE
mov RollState, 0
.ENDIF
ret
ShowFloor EndP
; ----------------------------------------
; Drop
; ----------------------------------------
ShowDrop PROC USES eax
; 擦除上一個位置
.IF State1 != 2
mGoTo CurrentPos_X1, CurrentPos_Y1
mWrite ' '
.ENDIF
.IF State2 != 2
mGoTo CurrentPos_X2, CurrentPos_Y2
mWrite ' '
.ENDIF
.IF State1 == 0
inc CurrentPos_Y1
.ENDIF
.IF State2 == 0
inc CurrentPos_Y2
.ENDIF
ret
ShowDrop EndP
; ----------------------------------------
; 畫出記分板
; ----------------------------------------
ShowScore PROC USES eax
mGoTo 20, 1
mov eax, score1
call WriteDec
mGoTo 111, 1
mov eax, score2
call WriteDec
ret
ShowScore EndP
; ----------------------------------------
; 畫出牆壁
; ----------------------------------------
ShowWall PROC USES eax
mov al, Min_Y
WallLoop :
cmp al, Max_Y; eax < Max_Y ?
jnl EndWall; 跳出迴圈
mGoTo Min_X, al
mWrite Wall
mGoTo Max_X, al
mWrite Wall
inc eax
jmp WallLoop
EndWall :
mov esi, 0
mov al, FloorCount
mov CurrentFloor, al
FloorLoop :
mov al, arr[esi]
mov bl, 10
mul bl
add al, 31
mov arr_x[esi], al
mov ah, CurrentFloor
mov arr_y[esi], ah
mGoto al, CurrentFloor
.IF arr_type[esi] == 0
mWrite Floor
.ELSEIF arr_type[esi] == 1
mWrite Sham
.ELSEIF arr_type[esi] == 2
mWrite Spike
.ELSEIF arr_type[esi] == 3
.IF lg_type[esi] == 1
.IF RollState == 0
mWrite RollRight_1
.ELSE
mWrite RollRight_2
.ENDIF
.ELSEIF lg_type[esi] == 0
.IF RollState == 0
mWrite RollLeft_1
.ELSE
mWrite RollLeft_2
.ENDIF
.ENDIF
.ENDIF
add CurrentFloor, 3
inc esi
.IF esi < 10
JMP FloorLoop
.ENDIF
mov ecx, 60
mov al, 31
SpikeLoop:
mGoTo al, 0
mWrite'V'
inc al
Loop SpikeLoop
mov RollState, 1
mGoTo 1, 1
mWrite 'player1 score:'
mGoTo 93, 1
mWrite 'player2 score:'
ret
ShowWall ENDP
; ----------------------------------------
; 結束畫面
; ----------------------------------------
ShowEnd PROC USES eax
call Clrscr
mov eax, score2
mGoTo 55, 15
.IF score1 > eax
mWrite 'player1 WIN'
.ELSEIF score1 < eax
mWrite 'player2 WIN'
.ELSEIF
mWrite 'TIE'
.ENDIF
ret
ShowEnd ENDP
; ----------------------------------------
; 輸入
; ----------------------------------------
key proc
mov ah, 0
INVOKE GetKeyState, 'A'; 角色1左鍵
mov bh, CurrentPos_Y2
mov bl, CurrentPos_X2
inc bl
.IF ah&& CurrentPos_X1 > 31 && State1 != 2
.IF CurrentPos_X1 == bl && CurrentPos_Y1 == bh && CurrentPos_X1 > 32
mGoto CurrentPos_X1, CurrentPos_Y1; 消去player1本來的位置
mWrite ' '
dec CurrentPos_X1
mGoto CurrentPos_X2, CurrentPos_Y2; 消去player2本來的位置
mWrite ' '
dec CurrentPos_X2
.ELSEIF CurrentPos_X1 != bl || CurrentPos_Y1 != bh
; ---------------- - 判斷player1左邊有沒有樓梯----------------------;
mov ecx, 10
mov ah, CurrentPos_Y1
mov al, CurrentPos_X1
dec al
LeftLoop1 :
.IF ah == arr_y[ecx - 1]
mov ah, arr_x[ecx - 1]
add ah, 9
.IF al == ah
jmp Left1
.ENDIF
.ENDIF
loop LeftLoop1
mGoto CurrentPos_X1, CurrentPos_Y1; 消去player1本來的位置
mWrite ' '
dec CurrentPos_X1
Left1 :
.ENDIF
.ENDIF
INVOKE GetKeyState, 'D'; 角色1右鍵
mov bh, CurrentPos_Y2
mov bl, CurrentPos_X2
dec bl
.IF ah&& CurrentPos_X1 < 90 && State1 != 2
.IF CurrentPos_X1 == bl && CurrentPos_Y1 == bh && CurrentPos_X1 < 89
mGoto CurrentPos_X1, CurrentPos_Y1
mWrite ' '
inc CurrentPos_X1
mGoto CurrentPos_X2, CurrentPos_Y2
mWrite ' '
inc CurrentPos_X2
.ELSEIF CurrentPos_X1 != bl || CurrentPos_Y1 != bh
; ---------------- - 判斷player1右邊有沒有樓梯----------------------;
mov ecx, 10
mov ah, CurrentPos_Y1
mov al, CurrentPos_X1
inc al
RightLoop1 :
.IF ah == arr_y[ecx - 1]
mov ah, arr_x[ecx - 1]
.IF al == ah
jmp Right1
.ENDIF
.ENDIF
loop RightLoop1
mGoto CurrentPos_X1, CurrentPos_Y1; 消去player1本來的位置
mWrite ' '
inc CurrentPos_X1
Right1 :
.ENDIF
.ENDIF
INVOKE GetKeyState, VK_LEFT; 角色2左鍵
mov bh, CurrentPos_Y1
mov bl, CurrentPos_X1
inc bl
.IF ah&& CurrentPos_X2 > 31 && State2 != 2
.IF CurrentPos_X2 == bl && CurrentPos_Y2 == bh && CurrentPos_X2 > 32
mGoto CurrentPos_X2, CurrentPos_Y2; 消去player2本來的位置
mWrite ' '
dec CurrentPos_X2
mGoto CurrentPos_X1, CurrentPos_Y1; 消去player1本來的位置
mWrite ' '
dec CurrentPos_X1
.ELSEIF CurrentPos_X2 != bl || CurrentPos_Y2 != bh
; ---------------- - 判斷player2左邊有沒有樓梯----------------------;
mov ecx, 10
mov ah, CurrentPos_Y2
mov al, CurrentPos_X2
dec al
LeftLoop2 :
.IF ah == arr_y[ecx - 1]
mov ah, arr_x[ecx - 1]
add ah, 9
.IF al == ah
jmp Left2
.ENDIF
.ENDIF
loop LeftLoop2
mGoto CurrentPos_X2, CurrentPos_Y2; 消去player1本來的位置
mWrite ' '
dec CurrentPos_X2
Left2 :
.ENDIF
.ENDIF
INVOKE GetKeyState, VK_RIGHT; 角色2右鍵
mov bl, CurrentPos_X1
dec bl
.IF ah&& CurrentPos_X2 < 90 && State2 != 2
.IF CurrentPos_X2 == bl && CurrentPos_Y2 == bh && CurrentPos_X2 < 89
mGoto CurrentPos_X2, CurrentPos_Y2
mWrite ' '
inc CurrentPos_X2
mGoto CurrentPos_X1, CurrentPos_Y1
mWrite ' '
inc CurrentPos_X1
.ELSEIF CurrentPos_X2 != bl || CurrentPos_Y2 != bh
; ---------------- - 判斷player2右邊有沒有樓梯----------------------;
mov ecx, 10
mov ah, CurrentPos_Y2
mov al, CurrentPos_X2
inc al
RightLoop2 :
.IF ah == arr_y[ecx - 1]
mov ah, arr_x[ecx - 1]
.IF al == ah
jmp Right2
.ENDIF
.ENDIF
loop RightLoop2
mGoto CurrentPos_X2, CurrentPos_Y2; 消去player1本來的位置
mWrite ' '
inc CurrentPos_X2
Right2 :
.ENDIF
.ENDIF
ret
key endp
; -------------------------------------------- -
; ChangeState
; -------------------------------------------- -
ChangeState proc USES eax ecx edx ebx
.IF State1 != 2
mov State1, 0
mov dl, State2
mov bl, CurrentPos_Y1
mov bh, CurrentPos_X1
inc bl
mov ecx, 10
CheckState1:
.IF bl == arr_y[ecx - 1]
mov ah, arr_x[ecx - 1]
mov al, ah
add al, 9
.IF CurrentPos_X1 >= ah && CurrentPos_X1 <= al && arr_type[ecx - 1] != 4
mov State1, 1
sub bl, 2
.IF arr_type[ecx - 1] == 2
mov State1, 2
.ELSEIF CurrentPos_X2 == bh && CurrentPos_Y2 == bl
mov State2, 3
jmp E1
.ENDIF
.ELSE
mov State1, 0
.ENDIF
jmp S2
.ELSE
mov State1, 0
.ENDIF
loop CheckState1
.ENDIF
S2 :
.IF State2 != 2
mov bl, CurrentPos_Y2
mov bh, CurrentPos_X2
inc bl
mov ecx, 10
CheckState2:
.IF bl == arr_y[ecx - 1]
mov ah, arr_x[ecx - 1]
mov al, ah
add al, 9
.IF CurrentPos_X2 >= ah && CurrentPos_X2 <= al && arr_type[ecx - 1] != 4
mov State2, 1
sub bl, 2
.IF arr_type[ecx - 1] == 2
mov State2, 2
.ELSEIF CurrentPos_X1 == bh && CurrentPos_Y1 == bl
mov State1, 3
jmp E1
.ENDIF
.ELSE
mov State2, 0
.ENDIF
jmp E1
.ELSE
mov State2, 0
.ENDIF
loop CheckState2
.ENDIF
E1 :
; ------------ - 更新腳下地板狀態
mov Floor_type1, 0
mov bl, CurrentPos_Y1
mov bh, CurrentPos_X1
inc bl
mov esi, 0
L1:
.IF bl == arr_y[esi] || esi > 9
.IF arr_type[esi] == 3
.IF lg_type[esi] == 1
mov Floor_type1, 3
jmp EndL1
.ELSEIF lg_type[esi] == 0
mov Floor_type1, 4
jmp EndL1
.ENDIF
.ENDIF
.ELSE
inc esi
jmp L1
.ENDIF
EndL1 :
mov Floor_type2, 0
mov bl, CurrentPos_Y2
mov bh, CurrentPos_X2
inc bl
mov esi, 0
L2:
.IF bl == arr_y[esi] || esi > 9
.IF arr_type[esi] == 3
.IF lg_type[esi] == 1
mov Floor_type2, 3
jmp EndL2
.ELSEIF lg_type[esi] == 0
mov Floor_type2, 4
jmp EndL2
.ENDIF
.ENDIF
.ELSE
inc esi
jmp L2
.ENDIF
EndL2 :
ret
ChangeState endp
; -------------------------------------------- -
; left or right
; -------------------------------------------- -
Left_Right proc
.IF State1 == 1
.IF Floor_type1 == 3
.IF CurrentPos_X1 < 90
inc CurrentPos_X1
.ENDIF
.ELSEIF Floor_type1 == 4
.IF CurrentPos_X1 > 31
dec CurrentPos_X1
.ENDIF
.ENDIF
.ENDIF
.IF State2 == 1
.IF Floor_type2 == 3
.IF CurrentPos_X2 < 90
inc CurrentPos_X2
.ENDIF
.ELSEIF Floor_type2 == 4
.IF CurrentPos_X2>31
dec CurrentPos_X2
.ENDIF
.ENDIF
.ENDIF
ret
Left_Right endp
end main