Created
August 9, 2018 12:56
-
-
Save taotao54321/65190bcd58bad955c584e6551b9a47b7 to your computer and use it in GitHub Desktop.
ドクターマリオ スコア加算ルーチンの処理量 (概算値)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#n LOW MED HI | |
1 121 121 121 | |
2 211 211 211 | |
3 391 404 404 | |
4 764 764 777 | |
5 1484 1510 1536 | |
6 2950 2989 3028 | |
7 2950 2989 3028 | |
8 2950 2989 3028 | |
9 2950 2989 3028 | |
10 2950 2989 3028 | |
11 2950 2989 3028 | |
12 944 957 970 | |
13 301 301 314 | |
14 23422 23799 24163 | |
15 121 121 121 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function measure(speed, n) | |
local cycle_start = nil | |
local cycle_end = nil | |
local done = false | |
memory.registerexec(0x8FF4, function() | |
cycle_start = debugger.getcyclescount() | |
memory.writebyte(0x8B, speed) | |
memory.writebyte(0xAD, n) | |
memory.writebyte(0x2000, bit.band(0x7F,memory.readbyte(0xFF))) | |
--memory.registerexec(0x8005, function() print("NMI") end) | |
end) | |
memory.registerexec(0x901B, function() | |
--memory.registerexec(0x8005, nil) | |
cycle_end = debugger.getcyclescount() | |
done = true | |
end) | |
while not done do | |
emu.frameadvance() | |
end | |
memory.registerexec(0x901B, nil) | |
memory.registerexec(0x8FF4, nil) | |
--print(cycle_start) | |
--print(cycle_end) | |
return cycle_end - cycle_start | |
end | |
local function main() | |
local state = savestate.object() | |
savestate.save(state) | |
local out = io.open("score_add_cycle.log", "w") | |
out:write("#n\tLOW\tMED\tHI\n") | |
for n = 0, 14 do | |
out:write(string.format("%d", n+1)) | |
for speed = 0, 2 do | |
duration = measure(speed, n) | |
out:write(string.format("\t%d", duration)) | |
savestate.load(state) | |
end | |
out:write("\n") | |
end | |
out:close() | |
end | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment