2015-04-22 16:51:27 -07:00
|
|
|
require "boilerplate"
|
2015-04-26 00:18:33 -07:00
|
|
|
require "addrs.init"
|
2015-05-01 08:40:32 -07:00
|
|
|
require "classes"
|
2015-04-22 16:51:27 -07:00
|
|
|
|
|
|
|
local ignore = {
|
2015-04-25 23:23:41 -07:00
|
|
|
-- every time a scene (un)loads
|
|
|
|
['92,7=0 (weg)'] = true,
|
2015-04-22 16:51:27 -07:00
|
|
|
['92,7=1 (weg)'] = true,
|
2015-04-25 23:23:41 -07:00
|
|
|
-- night transition available
|
|
|
|
['05,2=0 (inf)'] = true,
|
|
|
|
['05,2=1 (inf)'] = true,
|
2015-04-22 16:51:27 -07:00
|
|
|
-- daily postman crap
|
|
|
|
['27,6=0 (weg)'] = true,
|
|
|
|
['27,7=0 (weg)'] = true,
|
|
|
|
['28,0=0 (weg)'] = true,
|
|
|
|
['28,1=0 (weg)'] = true,
|
|
|
|
['28,2=0 (weg)'] = true,
|
|
|
|
['27,6=1 (weg)'] = true,
|
|
|
|
['27,7=1 (weg)'] = true,
|
|
|
|
['28,0=1 (weg)'] = true,
|
|
|
|
['28,1=1 (weg)'] = true,
|
|
|
|
['28,2=1 (weg)'] = true,
|
|
|
|
}
|
|
|
|
|
2015-05-01 08:40:32 -07:00
|
|
|
FlagMonitor = Class(Monitor)
|
2015-04-25 23:54:04 -07:00
|
|
|
|
2015-05-01 08:40:32 -07:00
|
|
|
function FlagMonitor:mark(i, x, x1)
|
|
|
|
local now = emu.framecount()
|
|
|
|
local diff = bit.bxor(x, x1)
|
|
|
|
for which = 0, 7 do
|
|
|
|
if bit.band(diff, 2^which) ~= 0 then
|
|
|
|
local state = bit.band(x, 2^which) ~= 0 and 1 or 0
|
|
|
|
local str = ('%02i,%i=%i (%s)'):format(i, which, state, self.name)
|
|
|
|
if not ignore[str] then
|
|
|
|
printf('%s @%i', str, now)
|
|
|
|
gui.addmessage(str)
|
2015-04-22 16:51:27 -07:00
|
|
|
end
|
2015-05-03 10:00:49 -07:00
|
|
|
local ib = i*8 + which
|
2015-05-03 10:37:45 -07:00
|
|
|
if not self.modified[ib] then
|
|
|
|
self.modified[ib] = true
|
2015-05-03 10:00:49 -07:00
|
|
|
self.dirty = true
|
|
|
|
end
|
2015-04-22 16:51:27 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 00:18:33 -07:00
|
|
|
local weg = FlagMonitor('weg', addrs.week_event_reg)
|
|
|
|
local inf = FlagMonitor('inf', addrs.event_inf)
|
2015-05-01 09:37:56 -07:00
|
|
|
local mmb = FlagMonitor('mmb', addrs.mask_mask_bit)
|
2015-05-03 10:00:49 -07:00
|
|
|
weg:load('data/_weg.lua')
|
|
|
|
inf:load('data/_inf.lua')
|
2015-05-01 09:37:56 -07:00
|
|
|
while mm do
|
2015-04-25 23:54:04 -07:00
|
|
|
weg:diff()
|
|
|
|
inf:diff()
|
2015-05-01 06:16:38 -07:00
|
|
|
mmb:diff()
|
2015-05-03 10:00:49 -07:00
|
|
|
weg:save()
|
|
|
|
inf:save()
|
2015-04-22 16:51:27 -07:00
|
|
|
emu.frameadvance()
|
|
|
|
end
|