Advertisement
Zeronoin

A Nightmare on Elm Street NES Door Manipulation

Aug 13th, 2016
880
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.10 KB | None | 0 0
  1. A Nightmare on Elm Street NES Door Manipulation
  2. by ZeroNoin
  3.  
  4.  
  5. The RNG of the doors when a game starts in A Nightmare on Elm Street NES has a big effect on a speedrun.
  6. What really helps here is an RNG buffer/manipulation to get the ideal RNG every or about every time.
  7.  
  8. I observed how the RNG and lag works in the RAM and came up with placing certain inputs in certain spots when the system Powers On.
  9.  
  10. The door RNG is determined by the value in RAM address $06FD end of the player number select screen.
  11. The RNG is decided for door RNG on the last frame of the fade to black on the player number select screen.
  12. The value in the RNG address is affected by the Frame Counter value in $0021 and by the Inputs values in $0030, $0031, and $0032.
  13. This means that Controller Inputs can affect the RNG.
  14. Values in these addresses persist through Resets, so the manipulation must be done from Power On.
  15. Since this game does not initialize these addresses, the manipulation will work differently on different consoles and emulators.
  16.  
  17. The resulting door RNG value is stored in $06F7.
  18. Since there are 6 possible door combinations, the value ranges from 00 to 06.
  19. A value of 00 is necessary because it puts the door in order from left (where the game begins) to right.
  20. A value of 01 is bad because the runner will need to complete the first stage before finding that the run is dead.
  21. A value of 02, 03, 04, or 05 will result in a quick reset.
  22.  
  23. There is a special black screen following the first screen of text after the game is Powered On.
  24. During this screen, the game lags 10 frames while it loads the title screen.
  25. The RNG does not change and is unaffected during this black screen.
  26. What is also special about this black screen is Start can be pressed and held during it all the way to a game start.
  27. This provides an 11-frame window for changing and buffering inputs through to a new game.
  28. Power On also works as a place to buffer inputs, as holding inputs before the system turns-on will buffer perfectly each time.
  29.  
  30. The black screen following the title screen also lags, but only 4 frames, so it is much less useful.
  31.  
  32. So there are two points to press and hold different inputs - before Power On and during the black screen.
  33. Start cannot be held before the black screen because that prevents it from automatically starting a game.
  34. Start must be first pressed and held during the black screen.
  35. Holding Up from either Power On or the black screen all the way to a game start is useful because it automatically enters the first door.
  36.  
  37. The template for the instructions for the NoES door RNG manipulation are as follows:
  38. Press and hold 0 or more inputs not including Start.
  39. Power On.
  40. Wait for the black loading screen following the text screen.
  41. Press and hold Start and 0 or more inputs all the start of the game.
  42.  
  43. I made an FCEUX Lua script for finding these input combinations using different initialized RAM settings.
  44. Before this script the best buffer I found is holding Up, Powering On, then at the black screen also holding Select, Start, and A.
  45.  
  46. FCEUX Lua Script for finding input combinations:
  47. http://pastebin.com/ufmkSAE9
  48.  
  49. Memory Initialization
  50. Most games initialize various values in the memory (RAM) to make the instructions execute more reliably.
  51. There are many games that do not initialize memory values including Nightmare on Elm Street NES.
  52. Another example is Final Fantasy 1 which does not initialize some of the randomness values (Nasir likely did this deliberately).
  53. Uninitialized memory has a consequence for manipulation because various consoles and emulators have different uninitialized memory values.
  54. This means that different manipulation inputs will be required for different consoles and emulators.
  55. It also means that many individual NES consoles may be difficult to work with this manipulation.
  56.  
  57. FCEUX
  58. By default FCEUX alternates setting addresses at 0x00 and 0xFF every four addresses.
  59. So all the lines look like this:
  60. 00000000FFFFFFFF00000000FFFFFFFF
  61. The two best manipulations I have noticed for FCEUX (and my Toploader):
  62. Hold Up, Power On, at the black screen keep holding Up and also press and hold Select, Start, and A through to a game start.
  63. Hold nothing, Power On, at the black screen press and hold Left, Select, Start, and B to a game start.
  64. The bottom of this document includes the results of the FCEUX script for the default FCEUX and Toploader memory values.
  65.  
  66. Toploader NES (NES 2)
  67. The Toploader NES seems to tend to initialize memory very similarly and perhaps identically to FCEUX.
  68. I have already managed to get some manipulations for FCEUX to work on my Toploader.
  69. I have about a 100% success rate using these manipulations on my Toploader:
  70. Hold Up, Power On, at the black screen keep holding Up and also press and hold Select, Start, and A through to a game start.
  71. Hold nothing, Power On, at the black screen press and hold Left, Select, Start, and B to a game start.
  72. I cannot be sure that most or all Toploaders work with this manipulation, but it seems much more likely with these consoles.
  73.  
  74. AV Famicom (Famicom 2)
  75. I would imagine the AV Famicom would be similar to the Toploader, but do not know for sure.
  76.  
  77. BizHawk
  78. By default Bizhawk sets all memory values to 0xFF for a Power On.
  79. So all the lines look like this:
  80. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  81. As a result of this the door RNG manipulation is incredibly easy in BizHawk.
  82. There are three easy options:
  83. Hold nothing, Power On, at the black screen press and hold Start through to a game start.
  84. Hold nothing, Power On, at the black screen press and hold Up and Start through to a game start.
  85. Hold Up, Power On, at the black screen keep holding Up and also press and hold Select and Start through to a game start.
  86. The BizHawk default memory can be simulated in the FCEUX Lua script by entering 0xFF for all the SET variables.
  87.  
  88. Frontloader NES (NES 1)
  89. Memory initialization in individual NES Frontloaders is very unreliable.
  90. Different individual Frontloader consoles seem to initialize in different ways.
  91. They tend to initialize differently based on what values were in the memory prior to the Power On.
  92. And they tend to initialize differently based on the amount of time the console was off prior to the Power On.
  93. Having the console off for 1 second, 5 seconds, 10 seconds, 30 seconds, 1 minute, or 5 minutes can all each produce different results.
  94. Perhaps some individual Frontloaders have more reliable memory, and these were likely produced later in the NES era.
  95. I own a Frontloader that immediately clears memory for reliable FF1 manipulation, but I cannot get reliable NoES manipulation from it.
  96. First try some inputs that work for FCEUX, then some for BizHawk, and see if either will work for Frontloader.
  97. What may help in examining individual Frontloader memory is a Homebrew NES ROM for testing it.
  98.  
  99. Famicom (Famicom 1)
  100. I would imagine the original Famicom would be similar to the Frontloader, but do not know for sure.
  101.  
  102. Flash Cart
  103. PowerPak and EverDrive may or may not use NES console memory when loading games.
  104. And this loading may or may not produce the same behavior for NoES in every console using a certain model of flash cart.
  105. So far Skavenger216 found that using EverDrive on his Frontloader he could reliably get the manipulation.
  106. His inputs are holding Up while the game is loading on the EverDrive, then add and hold Select, Start, B, and A at the black screen.
  107.  
  108. Homebrew NES Memory Initialization ROM
  109. Something that could potentially help in doing manipulation on many Frontloaders is a ROM that can display and set RAM addresses.
  110. It would be run on flash cart reading unitialized addresses and using a simple two-color text pattern table.
  111. A ROM could be made specific for NoES for the manipulation addresses of $0021, $0030, $0031, $0032, and $06FD.
  112. The ROM could also set the addresses after looking at them to values like 0x00 or 0xFF or to random values using random instructions.
  113. After setting the addresses, further Power cycles would see what happens to the addresses.
  114. This could be used to look for tendencies and/or reliable values that show in the addresses through Power cycles.
  115. These values can then be plugged into the Lua Script and inputs can be found that work with those values.
  116. A similar ROM could be used for clearing or setting the memory between FF1 or NoES attempts.
  117. Could a similar ROM be used for something that would be considered cheating in speedrunning is another question.
  118. Another option would be finding a game that initializes memory in a good way and using it to clear memory.
  119. I am not sure if flash carts use some of the console RAM when loading after a Power On, but this may need to be addressed.
  120. If flash carts have these problems, either different firmware or some re-written ROM chips may be necessary.
  121.  
  122. Credits
  123. Skavenger216 for finding a reliable setup on his EverDrive with Frontloader, which might apply to all EverDrives on any console.
  124. I kind of overlooked the idea of potentially using the loading of flash carts to your advantage until Skavenger pointed things out.
  125.  
  126. Manipulation Inputs for Address Values Common in Toploaders and by Default in FCEUX
  127. 325/5184 Possible Sets of Inputs Work (6.3%)
  128. Counter Set: 0 || Inputs Set: 0 0 0 || RNG Set: 255
  129. | || BST L |
  130. | ||ABST R|
  131. | R|| T D R|
  132. | R||A ST DL |
  133. | R||AB T DL |
  134. | L || STU R|
  135. | L || B TU L |
  136. | L ||A ST D |
  137. | L ||A ST D R|
  138. | L ||A ST DL |
  139. | L ||AB TU L |
  140. | D || STU R|
  141. | D || BST L |
  142. | D R|| TU |
  143. | D R|| ST R|
  144. | D R||A TU |
  145. | D R||AB T D |
  146. | D R||ABSTU L |
  147. | DL || T R|
  148. | DL || B T L |
  149. | DL ||A T |
  150. | DL ||AB T DL |
  151. | DL ||ABSTU |
  152. | U || T D R|
  153. | U || B T D |
  154. | U || BSTU L |
  155. | U ||A T D R|
  156. | U ||A STU |
  157. | U ||A STU L |
  158. | U ||ABSTU |
  159. | U R|| ST D |
  160. | U R||A T |
  161. | U R||AB TU |
  162. | U L || ST DL |
  163. | U L || B T L |
  164. | U L ||A T R|
  165. | U L ||A T L |
  166. | U L ||AB TU R|
  167. | U L ||ABST L |
  168. | S || T R|
  169. | S || BST DL |
  170. | S ||AB TU L |
  171. | S R||A ST |
  172. | S R||A STU L |
  173. | S L ||A ST R|
  174. | S L ||ABST D |
  175. | S L ||ABST DL |
  176. | S D || STU R|
  177. | S D || B T D R|
  178. | S D || BST D R|
  179. | S D ||A T |
  180. | S D ||A ST D |
  181. | S D ||AB TU L |
  182. | S D R|| T R|
  183. | S D R|| B T D R|
  184. | S D R|| B T DL |
  185. | S D R||A T D R|
  186. | S D R||ABSTU L |
  187. | S DL || ST R|
  188. | S DL || B T DL |
  189. | S DL || BST L |
  190. | S DL ||A TU |
  191. | S DL ||A ST |
  192. | S U || BST D |
  193. | S U ||ABST |
  194. | S U R||AB T D |
  195. | S U R||ABSTU |
  196. | S U R||ABSTU L |
  197. | S U L || STU L |
  198. | S U L || B TU |
  199. | S U L || BSTU L |
  200. | S U L ||A STU |
  201. | S U L ||ABST DL |
  202. | S U L ||ABSTU |
  203. | B || B TU R|
  204. | B || BST D R|
  205. | B ||A T L |
  206. | B ||A TU |
  207. | B ||A TU R|
  208. | B ||A TU L |
  209. | B ||ABST |
  210. | B R|| B TU L |
  211. | B R||A ST DL |
  212. | B R||ABST D |
  213. | B L ||A T L |
  214. | B L ||A ST |
  215. | B L ||A ST DL |
  216. | B L ||AB TU L |
  217. | B L ||ABSTU |
  218. | B L ||ABSTU L |
  219. | B D ||A T |
  220. | B D ||ABST L |
  221. | B D ||ABST D |
  222. | B D R|| B T |
  223. | B D R|| B TU L |
  224. | B D R|| BST D |
  225. | B D R||A TU R|
  226. | B D R||A ST |
  227. | B DL || ST |
  228. | B DL || BSTU |
  229. | B DL ||A T D R|
  230. | B DL ||A TU L |
  231. | B DL ||ABST L |
  232. | B U ||ABSTU |
  233. | B U ||ABSTU L |
  234. | B U R|| TU L |
  235. | B U R|| BSTU L |
  236. | B U R||A ST D |
  237. | B U R||AB T |
  238. | B U R||ABST D |
  239. | B U R||ABST DL |
  240. | B U L ||A T D |
  241. | B U L ||ABST D |
  242. | B U L ||ABSTU |
  243. | BS || ST R|
  244. | BS || BSTU |
  245. | BS ||AB T L |
  246. | BS R|| ST R|
  247. | BS R|| ST L |
  248. | BS R|| ST D R|
  249. | BS R|| BST R|
  250. | BS R|| BSTU |
  251. | BS R|| BSTU R|
  252. | BS R||A ST |
  253. | BS R||ABST L |
  254. | BS L || TU L |
  255. | BS L || BSTU R|
  256. | BS L ||A ST DL |
  257. | BS L ||AB TU L |
  258. | BS L ||ABST |
  259. | BS D || ST R|
  260. | BS D || BST D R|
  261. | BS D ||A T D R|
  262. | BS D ||A ST |
  263. | BS D ||A ST L |
  264. | BS D ||A STU R|
  265. | BS D ||AB T L |
  266. | BS D ||ABST L |
  267. | BS D ||ABSTU L |
  268. | BS D R|| ST R|
  269. | BS D R|| BSTU R|
  270. | BS D R||A TU |
  271. | BS D R||AB T L |
  272. | BS D R||AB TU |
  273. | BS D R||AB TU L |
  274. | BS D R||ABST L |
  275. | BS D R||ABSTU |
  276. | BS D R||ABSTU L |
  277. | BS DL || T L |
  278. | BS DL ||A T L |
  279. | BS DL ||A ST D R|
  280. | BS DL ||AB T |
  281. | BS DL ||AB TU |
  282. | BS U ||A T D R|
  283. | BS U ||A ST |
  284. | BS U ||A ST DL |
  285. | BS U ||A STU R|
  286. | BS U ||AB TU L |
  287. | BS U R||A ST |
  288. | BS U R||AB T D |
  289. | BS U R||ABST |
  290. | BS U R||ABSTU L |
  291. | BS U L || T R|
  292. | BS U L ||ABSTU L |
  293. |A || BST D R|
  294. |A || BSTU |
  295. |A ||A T D R|
  296. |A ||ABST L |
  297. |A R|| BSTU |
  298. |A R|| BSTU L |
  299. |A R||A ST D R|
  300. |A R||AB T DL |
  301. |A R||AB TU R|
  302. |A R||ABSTU |
  303. |A L || T R|
  304. |A L || T D R|
  305. |A L || ST L |
  306. |A L || STU R|
  307. |A L || B TU R|
  308. |A L || BSTU L |
  309. |A L ||A ST DL |
  310. |A D || T D R|
  311. |A D || TU R|
  312. |A D || B TU L |
  313. |A D ||A ST |
  314. |A D ||A ST R|
  315. |A D R|| ST |
  316. |A D R|| STU L |
  317. |A D R||A T L |
  318. |A D R||A ST D R|
  319. |A D R||AB TU |
  320. |A D R||AB TU R|
  321. |A D R||ABST D |
  322. |A DL || TU R|
  323. |A DL || BST L |
  324. |A DL ||A TU R|
  325. |A DL ||AB TU L |
  326. |A U || ST R|
  327. |A U || STU R|
  328. |A U ||A STU R|
  329. |A U R|| STU R|
  330. |A U R||A ST L |
  331. |A U L || BST L |
  332. |A U L ||A T D |
  333. |A U L ||AB T L |
  334. |A U L ||AB TU |
  335. |A U L ||AB TU L |
  336. |A U L ||ABST D |
  337. |A S || T R|
  338. |A S || TU R|
  339. |A S || ST L |
  340. |A S || BST L |
  341. |A S ||A TU L |
  342. |A S ||ABST D |
  343. |A S R|| T D R|
  344. |A S R|| ST DL |
  345. |A S R|| B TU R|
  346. |A S R|| BST DL |
  347. |A S R||A TU |
  348. |A S R||AB T D |
  349. |A S R||AB T DL |
  350. |A S L ||AB T DL |
  351. |A S D ||AB T |
  352. |A S D ||ABST DL |
  353. |A S D R|| ST D R|
  354. |A S D R|| B T R|
  355. |A S D R|| BST D |
  356. |A S D R||ABSTU L |
  357. |A S DL || B T R|
  358. |A S DL || BST D R|
  359. |A S DL ||ABSTU L |
  360. |A S U || T R|
  361. |A S U ||A ST D R|
  362. |A S U R|| T D R|
  363. |A S U R|| ST D |
  364. |A S U R|| ST D R|
  365. |A S U R||A ST |
  366. |A S U R||A ST L |
  367. |A S U R||A STU L |
  368. |A S U R||AB T L |
  369. |A S U R||ABST |
  370. |A S U L || BST DL |
  371. |A S U L ||A TU |
  372. |A S U L ||AB T D |
  373. |A S U L ||AB TU |
  374. |A S U L ||AB TU L |
  375. |AB || T D R|
  376. |AB || BSTU R|
  377. |AB ||AB T D |
  378. |AB ||ABST |
  379. |AB R|| T D R|
  380. |AB R|| B T DL |
  381. |AB R||ABST D |
  382. |AB R||ABST D R|
  383. |AB R||ABST DL |
  384. |AB L || T R|
  385. |AB L || TU R|
  386. |AB L || B T |
  387. |AB L ||A ST |
  388. |AB L ||AB T |
  389. |AB L ||ABST D |
  390. |AB D || T D R|
  391. |AB D ||A TU R|
  392. |AB D ||A ST D |
  393. |AB D ||AB T D |
  394. |AB D R|| BST R|
  395. |AB D R||A T L |
  396. |AB D R||AB T R|
  397. |AB DL || T D R|
  398. |AB DL || TU R|
  399. |AB DL || TU L |
  400. |AB DL || B TU R|
  401. |AB DL || BST D R|
  402. |AB DL ||A STU |
  403. |AB U || T D R|
  404. |AB U || STU |
  405. |AB U || BSTU |
  406. |AB U ||A T R|
  407. |AB U ||A ST DL |
  408. |AB U ||AB T D |
  409. |AB U R|| ST R|
  410. |AB U R|| B T DL |
  411. |AB U R|| BSTU L |
  412. |AB U R||A T D |
  413. |AB U R||AB T L |
  414. |AB U L || ST D R|
  415. |AB U L || B T D R|
  416. |AB U L || BST R|
  417. |AB U L ||A STU R|
  418. |AB U L ||ABSTU L |
  419. |ABS || BST D |
  420. |ABS R|| B T R|
  421. |ABS R|| B T D |
  422. |ABS R|| BST D R|
  423. |ABS R||A T L |
  424. |ABS R||A TU |
  425. |ABS L || TU R|
  426. |ABS L || ST L |
  427. |ABS L || STU L |
  428. |ABS L || B T D R|
  429. |ABS L || BSTU R|
  430. |ABS L ||A T R|
  431. |ABS L ||A ST D R|
  432. |ABS L ||AB TU R|
  433. |ABS L ||ABST D |
  434. |ABS D || B T R|
  435. |ABS D || BST R|
  436. |ABS D || BSTU L |
  437. |ABS D ||ABST D |
  438. |ABS D ||ABST DL |
  439. |ABS D R|| T R|
  440. |ABS D R|| STU R|
  441. |ABS DL || BSTU R|
  442. |ABS DL ||A T L |
  443. |ABS U || B T |
  444. |ABS U || B TU |
  445. |ABS U ||A TU |
  446. |ABS U ||A ST |
  447. |ABS U R||A TU R|
  448. |ABS U L || T D R|
  449. |ABS U L || ST |
  450. |ABS U L || BSTU |
  451. |ABS U L ||A T D |
  452. |ABS U L ||A TU L |
  453. |ABS U L ||AB TU |
  454.  
  455. ZeroNoin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement