-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathVBL.cpp
More file actions
127 lines (120 loc) · 2.49 KB
/
VBL.cpp
File metadata and controls
127 lines (120 loc) · 2.49 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
#include "stdafx.h"
#include "UI.h"
#include <stdio.h>
//#include "Objects.h"
#include "Dispatch.h"
#include "CSB.h"
#include "Data.h"
//#ifdef _DEBUG
void traceFlash (const char * /*msg*/,i32 /*x*/,i32 /*y*/)
{
/*
if (x==-1)
{
if (TraceFileActive)
{
fprintf(TraceFile,"%08x %s\n",d.Time,msg);
};
return;
};
if (TraceFileActive)
{
char *name = "??????";
fprintf(TraceFile,"%08x vblFlashButn x=%d,y=%d",d.Time, x,y);
switch (x)
{
case 291:
switch (y)
{
case 125: name = "Turn Right"; break;
case 147: name = "Slide Right"; break;
};
break;
case 263:
switch (y)
{
case 125: name = "Forward"; break;
case 147: name = "Backward"; break;
};
break;
case 234:
switch (y)
{
case 125: name = "Turn Left"; break;
case 147: name = "Slide Left"; break;
};
break;
};
fprintf(TraceFile," %s\n",name);
};
*/
}
// TAG00091c
void vblFlashButn(i16 x1,i16 x2,i16 y1,i16 y2) // called by VBL handler
{ // x1, x2, y1, y2 come directly from d.MoveButn
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dReg D0, D1, D2, D3, D4, D5, D6, D7;
aReg A0, A1;
traceFlash("vblFlashButn", x1, y1);
A0 = (aReg)d.LogicalScreenBase;
D5W = y1;
D0W = sw(y2-y1); // line counter
A0 += 160*y1;
D5W = x1;
D6W = x1;
D5W = (I16)((D5W >> 1) & 0x00f8);
D7W = D5W;
A0 += D5W+4;
D6W &= 15;
D3L = D4L = 0xffff;
D3H1 = 0; D3L >>= D6W;
D5W = x2;
D6W = (I16)((D5W>>1) & 0x00f8);
D5W &= 15;
D5W = sw(15 - D5W);
D4W <<= D5W;
if (D7W != D6W)
{
D1W = (I16)((((D6W - D7W) - 8) >> 3) & 0x1fff);
tag00097a:
A1 = A0 + 160;
D6W = LE16(wordGear(A0));
D5W = (UI16)(D6W ^ 0xffff);
D5W &= D3W;
D7W = (UI16)(D3W ^ 0xffff);
D6W = (UI16)((D6W & D7W) | D5W);
wordGear(A0) = LE16(D6W);
A0 += 8;
D2W = D1W;
goto tag0099a;
tag000996:
wordGear(A0) ^= 0xffff;
A0 += 8;
tag0099a:
if (--D2W >= 0) goto tag000996;
D5W = LE16(wordGear(A0));
D6W = D5W;
D5W ^= 0xffff;
D5W &= D4W;
D7W = (UI16)(D4W ^ 0xffff);
D6W = (UI16)((D6W & D7W) | D5W);
wordGear(A0) = LE16(D6W);
A0 = A1;
if (--D0W >= 0) goto tag00097a;
}
else
{
D3W &= D4W;
tag0009ba:
D5W = LE16(wordGear(A0));
D6W = D5W;
D5W ^= 0xffff;
D5W &= D3W;
D7W = (UI16)(D3W ^ 0xffff);
D6W &= D7W;
D6W |= D5W;
wordGear(A0) = LE16(D6W);
A0 += 160;
if (--D0W >= 0) goto tag0009ba;
};
}