-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollision.asm
executable file
·86 lines (69 loc) · 971 Bytes
/
collision.asm
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
; push 1 - адрес
; push 2 - адрес
collision:
push bp
mov bp,sp
push bx
mov bx,[bp+4]
mov ax,[bx+12]
mov bx,[bp+6]
cmp ax,[bx+12]
pushf
xor ax,ax
popf
je collision_end
mov ax,[bx]
mov [_xp],ax
mov [_xm],ax
mov ax,[bx+2]
mov [_yp],ax
mov [_ym],ax
mov bx,[bx+10]
mov ax,[bx]
shl ax,2
add ax,[bx]
shl ax,1
add ax,2
add bx,ax
mov ax,[bx]
add [_xp],ax
sub [_xm],ax
mov ax,[bx+2]
add [_yp],ax
sub [_ym],ax
mov bx,[bp+4]
mov bx,[bx+10]
mov ax,[bx]
shl ax,2
add ax,[bx]
shl ax,1
add ax,2
add bx,ax
mov ax,[bx]
add [_xp],ax
sub [_xm],ax
mov ax,[bx+2]
add [_yp],ax
sub [_ym],ax
xor ax,ax
mov bx,[bp+4]
mov cx,[bx]
cmp cx,[_xm]
jl collision_end
cmp cx,[_xp]
jg collision_end
mov cx,[bx+2]
cmp cx,[_ym]
jl collision_end
cmp cx,[_yp]
jg collision_end
inc ax
collision_end:
pop bx
mov sp,bp
pop bp
retn 4
_xp dw 12
_xm dw 14
_yp dw 3
_ym dw 8