Advertisement
Zoinkity

Doubutsu no Mori Famicom Emulator Controls & Scripting

Sep 28th, 2022
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. [Doubutsu no Mori Famicom Emulator Controls & Scripting]
  2.  
  3. .: Known Emulator Controls :.
  4. Note: presumes Features[] below are enabled!
  5. quit emulator
  6. L + R + Z
  7. reset emulator
  8. hold Z: L + R
  9. pause emulator
  10. L + R
  11. toggle 8-sprite limit
  12. hold C-right: C-left
  13. Rapid Fire
  14. hold L: press any NES button
  15. Default mask is buttons only (F0), two levels.
  16. Reset All Rapid Fire
  17. L + R + Start (Recenter)
  18. speed control
  19. faster hold L: C-up
  20. slower hold L: C-down
  21. reset hold L: C-left
  22. save state
  23. hold R: any C button (C-up: #1, C-left: #2, C-right: #3, C-down: #4)
  24. load state
  25. hold C button: R
  26. load auto-savestate (~5 seconds back)
  27. hold all C buttons: R
  28.  
  29.  
  30. .: Controller Pak Notes, Scripting, Features :.
  31. Controller Pak notes must not set an extension or use Doubutsu no Mori's normal save names.
  32. Only the first "game" is used. The remaining are ignored.
  33.  
  34. NESINFO Controller Pak header
  35. +0 8 NESINFO\x1A
  36. +8 1 [0; unknown]
  37. +9 1 [0; unknown]
  38. +A 2 size of scripts, if present
  39. +C 4 size of info section, must be non-zero
  40. +10 var scripts, if present
  41. +var var info section; iNES ROM, optionally Yay compressed
  42.  
  43. script format:
  44. +0 3 cmd
  45. +3 1 length
  46. First command is eaten (skipped). Runs until END found.
  47.  
  48. Menu cmds:
  49. VEQ, VNE, GID, GNM, IFM, ISZ, ICS, TCS, FIL, ROM, ESZ, CPN, REM, END
  50. Game cmds:
  51. VEQ, VNE, DIF, NHD, HSC, MOV, PAT, END
  52.  
  53. VEQ execute if =0
  54. +4 1 if 0, processes next command else skips it
  55. VNE execute if !0
  56. +4 1 if !0, processes next command else skips it
  57. GID game ID
  58. str; value ignored
  59. GNM game name
  60. str; value ignored
  61. CPN Controller Pak name
  62. +4 0x10 name used for Controller Pak save data, mempak-encoded
  63. HSC High Scores
  64. Watches for changes in range of data at offset, exporting modifications to Controller Pak.
  65. The intention is to replace default high scores with saved ones, then update the saved copies when changed. That said, you could use it for any number of things.
  66. Data is saved to f"{CPN}.S" and automatically reloaded at boot if HSC commands are used.
  67. If savestates are in use, writeback only occurs if feature[8] is set to prevent corruption (or cheating).
  68. Watching starts when WRAM is equal to the given data, triggers writeback on mismatch.
  69. +4 2 address
  70. 07FF address in CPU WRAM
  71. 8000 if True, will not reset to "waiting" step once watch activated
  72. +6 var array copied to location; total length of all cmds cannot exceeed 0x80! (ignored beyond that)
  73. REM remark (comment)
  74. END terminates script
  75. ISZ info section size
  76. value ignored
  77. IFM info section format
  78. value ignored
  79. ICS info section checkum; HW sum of data
  80. +4 2 checksum; should match
  81. TCS test checksum of script region; HW sum of whole thing, should be 0
  82. likely contains inverse sum as data
  83. FIL set buffer fill value; used when feature[E] set
  84. +4 1 overrides default value FF stored to 803B7B58[0]
  85. ROM loads built-in ROM in hardcoded list from cartridge
  86. +4 1 index of ROM; 0 is external (Controller Pak)
  87. ESZ expanded size; if set, this value is used as decompressed size for ROM cmds instead of difference in codeword start & end
  88. +4 2 size of decompressed data allocation
  89. MOV copy A2 QWs f/ ROM QW A0 to A1
  90. +4 2 ROM src (<<4 for actual)
  91. +6 2 ROM target (<<4 for actual)
  92. +8 2 length (<<4 for actual)
  93. NHD new header: copy cmd[3] bytes f/ cmd data to iNES header
  94. +4 var data
  95. DIF a sort of IFF file? directory info? deinterlace file? Disk to iNES format? Purposefully corrupt ROM w/ compressed data as source pattern?
  96. Reads original file, writing "strings" over uncompressed ROM
  97. Pairs of "advance ** bytes" and copy "str" until NULL. Continues until size of uncompressed ROM.
  98. PAT patch; writes data to one of various address ranges
  99. patch entries:
  100. +0 1 target type; note the codeword types aren't rectified, will trigger TLB miss
  101. 1:features [803D67C8]; actual size 0x10, mostly booleans; debug pattern is 01 01 01 01 01 F0 01 01 01 01 01 01 01 01 01
  102. 00 if True, enables Reset (hold Z, press R + L)
  103. 01 if True, enables pausing emulation (R + L)
  104. 02 if True, enables speed up/slow down (set levels w/ C&D below)
  105. 03 if True, allows removing the 8 sprites-per-scanline limit {forces a conditional in the microcode}
  106. 04 if True, offers savestates
  107. 05 rapid fire button mask; by default set via word at osAppNMIBuffer+34
  108. 06 if True, enables writing RAM (f"{CPN}.R") to Controller Pak when preset (iNES RAM flag set; byte 6, |2)
  109. 07 maximum rapid fire level (or something)
  110. 08 if True, enables writing f"{CPN}.S" to Controller Pak even when savestates are in use. (see HSC cmd)
  111. 09 if True, allows {toggling 803B7B54[0]; some effect on speed-up behavior, possible clock hack}
  112. 0A if True, enables writing savestate 1 (C-Up) as f"{CPN}.W" to Controller Pak
  113. 0B frame threshold out of 100; not terribly sure but affects auto-savestates, may simply be a frameskip
  114. 0C maximum speedup levels
  115. 0D maximum slowdown levels
  116. 0E fill RSP buffer with 0x800 bytes of fill value {set on built-in games 1 (Clu Clu Land), 2 (Balloon Fight)}
  117. 0F unused?
  118. 2:ROM (including iNES header)
  119. 3:osAppNMIBuffer; actual size 0x40
  120. 4:word f/ 8082A070 in famicom_emu overlay code [007492E0]
  121. 5:word f/ 80835DA0 in famicom_emu overlay data
  122. 6:word f/ 80852690 in famicom_emu overlay stack
  123. +1 1 length
  124. +2 2 offset at target
  125. +4 var data
  126. *Note that these addresses are exploitable!
  127.  
  128. These Controller Pak Notes are optionally used with Controller Pak imported games (not built-ins).
  129. Will attempt to write to port 1, then port 2.
  130. {CPN}.R 32 pages (0x2000) RAM. Only one bank supported and must have RAM flag set in iNES header.
  131. If matching filename found at boot, will load it automatically.
  132. Set feature[6] to write back to Controller Pak.
  133. {CPN}.W 83 pages (0x5300) WORKRAM, aka savestate 1 (C-up)
  134. If matching filename found at boot, will load it automatically.
  135. Set feature[A] to write back to Controller Pak, set feature[4] to enable loading/saving savestates during play.
  136. {CPN}.S 1 page (0x100) High Scores
  137. Only output if HSC cmds in use and data was modified during runtime. Two 0x80 banks; updated if savestates not in use or if features[8] set.
  138. Effectively a list of modifications to watched addresses vs. expected data, so could be used creatively for other purposes.
  139.  
  140. -Zoinkity
  141.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement