zemu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +7 -0
  2. data/lib/zemu/config.rb +312 -0
  3. data/lib/zemu/instance.rb +179 -0
  4. data/lib/zemu.rb +172 -0
  5. data/src/debug.c +118 -0
  6. data/src/debug.h +30 -0
  7. data/src/external/Z/API/Z/ABIs/generic/allocator.h +36 -0
  8. data/src/external/Z/API/Z/ABIs/generic/cipher.h +47 -0
  9. data/src/external/Z/API/Z/ABIs/generic/data codec.h +33 -0
  10. data/src/external/Z/API/Z/ABIs/generic/emulation.h +103 -0
  11. data/src/external/Z/API/Z/ABIs/generic/hash function.h +33 -0
  12. data/src/external/Z/API/Z/ABIs/generic/module.h +33 -0
  13. data/src/external/Z/API/Z/ABIs/generic/wave codec.h +40 -0
  14. data/src/external/Z/API/Z/classes/base/InitializerList.hpp +34 -0
  15. data/src/external/Z/API/Z/classes/base/OpaqueFunctionPointer.hpp +26 -0
  16. data/src/external/Z/API/Z/classes/base/OpaqueMemberFunctionPointer.hpp +26 -0
  17. data/src/external/Z/API/Z/classes/base/Pair.hpp +46 -0
  18. data/src/external/Z/API/Z/classes/base/Range.hpp +111 -0
  19. data/src/external/Z/API/Z/classes/base/SizedString.hpp +66 -0
  20. data/src/external/Z/API/Z/classes/base/Status.hpp +89 -0
  21. data/src/external/Z/API/Z/classes/base/Symbol.hpp +39 -0
  22. data/src/external/Z/API/Z/classes/base/Tuple.hpp +111 -0
  23. data/src/external/Z/API/Z/classes/base/Value2D.hpp +389 -0
  24. data/src/external/Z/API/Z/classes/base/Value3D.hpp +368 -0
  25. data/src/external/Z/API/Z/classes/buffering/RingBuffer.hpp +93 -0
  26. data/src/external/Z/API/Z/classes/buffering/TripleBuffer.hpp +68 -0
  27. data/src/external/Z/API/Z/classes/functional/Functor.hpp +265 -0
  28. data/src/external/Z/API/Z/classes/functional/MemberFunction.hpp +98 -0
  29. data/src/external/Z/API/Z/classes/functional/ObjectMemberFunction.hpp +172 -0
  30. data/src/external/Z/API/Z/classes/functional/ObjectSelector.hpp +219 -0
  31. data/src/external/Z/API/Z/classes/functional/Selector.hpp +146 -0
  32. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABB.hpp +81 -0
  33. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABR.hpp +685 -0
  34. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Box.hpp +219 -0
  35. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Circle.hpp +80 -0
  36. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line2D.hpp +93 -0
  37. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line3D.hpp +80 -0
  38. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Rectangle.hpp +675 -0
  39. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Sphere.hpp +0 -0
  40. data/src/external/Z/API/Z/classes/memory/Shared.hpp +90 -0
  41. data/src/external/Z/API/Z/constants/base.h +35 -0
  42. data/src/external/Z/API/Z/constants/chemical elements.h +6385 -0
  43. data/src/external/Z/API/Z/constants/numbers.h +963 -0
  44. data/src/external/Z/API/Z/constants/version.h +15 -0
  45. data/src/external/Z/API/Z/formats/character set/ASCII.h +158 -0
  46. data/src/external/Z/API/Z/formats/character set/DOS CP437.h +159 -0
  47. data/src/external/Z/API/Z/formats/character set/DOS CP737.h +159 -0
  48. data/src/external/Z/API/Z/formats/character set/DOS CP775.h +159 -0
  49. data/src/external/Z/API/Z/formats/character set/DOS CP850.h +159 -0
  50. data/src/external/Z/API/Z/formats/character set/DOS CP852.h +159 -0
  51. data/src/external/Z/API/Z/formats/character set/DOS CP855.h +159 -0
  52. data/src/external/Z/API/Z/formats/character set/DOS CP857.h +159 -0
  53. data/src/external/Z/API/Z/formats/character set/DOS CP858.h +159 -0
  54. data/src/external/Z/API/Z/formats/character set/DOS CP860.h +159 -0
  55. data/src/external/Z/API/Z/formats/character set/DOS CP861.h +159 -0
  56. data/src/external/Z/API/Z/formats/character set/DOS CP862.h +159 -0
  57. data/src/external/Z/API/Z/formats/character set/DOS CP863.h +159 -0
  58. data/src/external/Z/API/Z/formats/character set/DOS CP864.h +159 -0
  59. data/src/external/Z/API/Z/formats/character set/DOS CP865.h +159 -0
  60. data/src/external/Z/API/Z/formats/character set/DOS CP866.h +159 -0
  61. data/src/external/Z/API/Z/formats/character set/DOS CP869.h +159 -0
  62. data/src/external/Z/API/Z/formats/character set/DOS CP872.h +159 -0
  63. data/src/external/Z/API/Z/formats/character set/DOS CP874.h +159 -0
  64. data/src/external/Z/API/Z/formats/character set/Unicode.h +30119 -0
  65. data/src/external/Z/API/Z/formats/data model/I16LP32.h +19 -0
  66. data/src/external/Z/API/Z/formats/data model/ILP32.h +19 -0
  67. data/src/external/Z/API/Z/formats/data model/ILP64.h +19 -0
  68. data/src/external/Z/API/Z/formats/data model/IP16L32.h +19 -0
  69. data/src/external/Z/API/Z/formats/data model/LLP64.h +19 -0
  70. data/src/external/Z/API/Z/formats/data model/LP32.h +19 -0
  71. data/src/external/Z/API/Z/formats/data model/LP64.h +19 -0
  72. data/src/external/Z/API/Z/formats/data model/SILP64.h +19 -0
  73. data/src/external/Z/API/Z/formats/file system/FAT12.h +61 -0
  74. data/src/external/Z/API/Z/formats/floating-point/IEEE 754.h +141 -0
  75. data/src/external/Z/API/Z/formats/floating-point/x87.h +74 -0
  76. data/src/external/Z/API/Z/formats/image/ICNS.h +39 -0
  77. data/src/external/Z/API/Z/formats/keymap/Mac OS.h +284 -0
  78. data/src/external/Z/API/Z/formats/keymap/Z.h +141 -0
  79. data/src/external/Z/API/Z/formats/multimedia/Creative Voice.h +106 -0
  80. data/src/external/Z/API/Z/formats/multimedia/Microsoft Wave.h +49 -0
  81. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ACH.h +44 -0
  82. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/FRZ.h +54 -0
  83. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/PRG.h +33 -0
  84. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SEM.h +46 -0
  85. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SIT.h +34 -0
  86. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNA.h +117 -0
  87. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNP.h +37 -0
  88. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SP.h +62 -0
  89. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/Z80.h +117 -0
  90. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX.h +56 -0
  91. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX82.h +70 -0
  92. data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/UNIF.h +26 -0
  93. data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/iNES.h +76 -0
  94. data/src/external/Z/API/Z/formats/storage medium image/audio/TAP.h +25 -0
  95. data/src/external/Z/API/Z/formats/storage medium image/audio/TZX.h +1185 -0
  96. data/src/external/Z/API/Z/formats/storage medium image/audio/Warajevo TAP.h +32 -0
  97. data/src/external/Z/API/Z/formats/storage medium image/floppy disk/FDI.h +45 -0
  98. data/src/external/Z/API/Z/functions/base/Z2D.h +583 -0
  99. data/src/external/Z/API/Z/functions/base/Z3D.h +712 -0
  100. data/src/external/Z/API/Z/functions/base/ZRange.h +137 -0
  101. data/src/external/Z/API/Z/functions/base/all.h +16 -0
  102. data/src/external/Z/API/Z/functions/base/casting.hpp +37 -0
  103. data/src/external/Z/API/Z/functions/base/character.h +38 -0
  104. data/src/external/Z/API/Z/functions/base/constructors.h +326 -0
  105. data/src/external/Z/API/Z/functions/base/structure.hpp +26 -0
  106. data/src/external/Z/API/Z/functions/base/type.hpp +60 -0
  107. data/src/external/Z/API/Z/functions/base/value.h +1901 -0
  108. data/src/external/Z/API/Z/functions/base/value.hpp +112 -0
  109. data/src/external/Z/API/Z/functions/buffering/ZRingBuffer.h +85 -0
  110. data/src/external/Z/API/Z/functions/buffering/ZTripleBuffer.h +65 -0
  111. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z2DLine.h +179 -0
  112. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z3DLine.h +168 -0
  113. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABB.h +361 -0
  114. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABR.h +1081 -0
  115. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZBox.h +340 -0
  116. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZCircle.h +142 -0
  117. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZRectangle.h +1267 -0
  118. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZSphere.h +156 -0
  119. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/all.h +18 -0
  120. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/constructors.h +620 -0
  121. data/src/external/Z/API/Z/functions/time/date.h +29 -0
  122. data/src/external/Z/API/Z/hardware/CPU/architecture/6502.h +90 -0
  123. data/src/external/Z/API/Z/hardware/CPU/architecture/Z80.h +245 -0
  124. data/src/external/Z/API/Z/hardware/CPU/architecture/i4004.h +37 -0
  125. data/src/external/Z/API/Z/hardware/PSG/General Instrument/AY-3-891x.h +180 -0
  126. data/src/external/Z/API/Z/hardware/VDC/Ricoh/RP2C0x.h +625 -0
  127. data/src/external/Z/API/Z/hardware/bus/AGP.h +24 -0
  128. data/src/external/Z/API/Z/hardware/bus/USB.h +510 -0
  129. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Inves Spectrum +.h +47 -0
  130. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Pentagon.h +13 -0
  131. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Scorpion.h +13 -0
  132. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum + 128K.h +158 -0
  133. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +.h +82 -0
  134. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2.h +13 -0
  135. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2A.h +13 -0
  136. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +3.h +13 -0
  137. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum.h +109 -0
  138. data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (NTSC).h +29 -0
  139. data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (PAL).h +29 -0
  140. data/src/external/Z/API/Z/hardware/machine/platform/computer/ZX Spectrum.h +405 -0
  141. data/src/external/Z/API/Z/hardware/machine/platform/console/Game Boy.h +49 -0
  142. data/src/external/Z/API/Z/hardware/machine/platform/console/Nintendo Entertainment System.h +350 -0
  143. data/src/external/Z/API/Z/hardware/storage medium/ROM cartridge/SNES Game Pak.h +238 -0
  144. data/src/external/Z/API/Z/inspection/C/completion.h +178 -0
  145. data/src/external/Z/API/Z/inspection/C/modules/C11.h +41 -0
  146. data/src/external/Z/API/Z/inspection/C/modules/C18.h +13 -0
  147. data/src/external/Z/API/Z/inspection/C/modules/C89.h +19 -0
  148. data/src/external/Z/API/Z/inspection/C/modules/C90.h +13 -0
  149. data/src/external/Z/API/Z/inspection/C/modules/C94.h +15 -0
  150. data/src/external/Z/API/Z/inspection/C/modules/C99.h +29 -0
  151. data/src/external/Z/API/Z/inspection/C/modules/KR C.h +19 -0
  152. data/src/external/Z/API/Z/inspection/C++/completion.h +512 -0
  153. data/src/external/Z/API/Z/inspection/C++/modules/C++03.h +15 -0
  154. data/src/external/Z/API/Z/inspection/C++/modules/C++11.h +80 -0
  155. data/src/external/Z/API/Z/inspection/C++/modules/C++14.h +26 -0
  156. data/src/external/Z/API/Z/inspection/C++/modules/C++17.h +55 -0
  157. data/src/external/Z/API/Z/inspection/C++/modules/C++85.h +11 -0
  158. data/src/external/Z/API/Z/inspection/C++/modules/C++89.h +13 -0
  159. data/src/external/Z/API/Z/inspection/C++/modules/C++98.h +17 -0
  160. data/src/external/Z/API/Z/inspection/C++.h +78 -0
  161. data/src/external/Z/API/Z/inspection/C.h +79 -0
  162. data/src/external/Z/API/Z/inspection/CPU/completion.h +56 -0
  163. data/src/external/Z/API/Z/inspection/CPU/detection.h +714 -0
  164. data/src/external/Z/API/Z/inspection/CPU/modules/6502.h +25 -0
  165. data/src/external/Z/API/Z/inspection/CPU/modules/AArch32.h +32 -0
  166. data/src/external/Z/API/Z/inspection/CPU/modules/AArch64.h +32 -0
  167. data/src/external/Z/API/Z/inspection/CPU/modules/Z80.h +26 -0
  168. data/src/external/Z/API/Z/inspection/CPU/modules/x86-32.h +31 -0
  169. data/src/external/Z/API/Z/inspection/CPU/modules/x86-64.h +312 -0
  170. data/src/external/Z/API/Z/inspection/CPU.h +209 -0
  171. data/src/external/Z/API/Z/inspection/OS/completion.h +36 -0
  172. data/src/external/Z/API/Z/inspection/OS/detection.h +768 -0
  173. data/src/external/Z/API/Z/inspection/OS/modules/Linux.h +22 -0
  174. data/src/external/Z/API/Z/inspection/OS/modules/MS-DOS.h +16 -0
  175. data/src/external/Z/API/Z/inspection/OS/modules/Mac OS X.h +23 -0
  176. data/src/external/Z/API/Z/inspection/OS/modules/Windows.h +19 -0
  177. data/src/external/Z/API/Z/inspection/OS/modules/iPhone OS.h +23 -0
  178. data/src/external/Z/API/Z/inspection/OS.h +236 -0
  179. data/src/external/Z/API/Z/inspection/Objective-C/completion.h +8 -0
  180. data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v1.0.h +11 -0
  181. data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v2.0.h +15 -0
  182. data/src/external/Z/API/Z/inspection/Objective-C.h +51 -0
  183. data/src/external/Z/API/Z/inspection/Z.h +19 -0
  184. data/src/external/Z/API/Z/inspection/build.h +22 -0
  185. data/src/external/Z/API/Z/inspection/character set.h +66 -0
  186. data/src/external/Z/API/Z/inspection/compiler/completion.h +2885 -0
  187. data/src/external/Z/API/Z/inspection/compiler/modules/Apple LLVM.h +26 -0
  188. data/src/external/Z/API/Z/inspection/compiler/modules/Clang.h +1664 -0
  189. data/src/external/Z/API/Z/inspection/compiler/modules/GCC.h +1366 -0
  190. data/src/external/Z/API/Z/inspection/compiler/modules/SCCZ80.h +473 -0
  191. data/src/external/Z/API/Z/inspection/compiler/modules/Visual C++.h +606 -0
  192. data/src/external/Z/API/Z/inspection/compiler/modules/cc65.h +529 -0
  193. data/src/external/Z/API/Z/inspection/compiler/modules/generic.h +13 -0
  194. data/src/external/Z/API/Z/inspection/compiler/modules/template.h +650 -0
  195. data/src/external/Z/API/Z/inspection/compiler.h +299 -0
  196. data/src/external/Z/API/Z/inspection/data model/completion.h +128 -0
  197. data/src/external/Z/API/Z/inspection/data model/deduction.h +9 -0
  198. data/src/external/Z/API/Z/inspection/data model/detection.h +45 -0
  199. data/src/external/Z/API/Z/inspection/data model.h +362 -0
  200. data/src/external/Z/API/Z/inspection/floating-point/completion.h +50 -0
  201. data/src/external/Z/API/Z/inspection/floating-point.h +324 -0
  202. data/src/external/Z/API/Z/inspection/language.h +163 -0
  203. data/src/external/Z/API/Z/inspection/platform/detection.h +9 -0
  204. data/src/external/Z/API/Z/inspection/platform.h +29 -0
  205. data/src/external/Z/API/Z/keys/C++.h +27 -0
  206. data/src/external/Z/API/Z/keys/C.h +29 -0
  207. data/src/external/Z/API/Z/keys/CPU.h +80 -0
  208. data/src/external/Z/API/Z/keys/OS.h +182 -0
  209. data/src/external/Z/API/Z/keys/Objective-C.h +17 -0
  210. data/src/external/Z/API/Z/keys/chemistry.h +26 -0
  211. data/src/external/Z/API/Z/keys/compiler.h +178 -0
  212. data/src/external/Z/API/Z/keys/data model.h +32 -0
  213. data/src/external/Z/API/Z/keys/endianness.h +24 -0
  214. data/src/external/Z/API/Z/keys/language.h +21 -0
  215. data/src/external/Z/API/Z/keys/layout.h +20 -0
  216. data/src/external/Z/API/Z/keys/mathematics/geometry.h +29 -0
  217. data/src/external/Z/API/Z/keys/mathematics/number.h +21 -0
  218. data/src/external/Z/API/Z/keys/order.h +18 -0
  219. data/src/external/Z/API/Z/keys/platform.h +87 -0
  220. data/src/external/Z/API/Z/keys/program.h +39 -0
  221. data/src/external/Z/API/Z/keys/science/chemical elements.h +200 -0
  222. data/src/external/Z/API/Z/keys/science/electricity.h +18 -0
  223. data/src/external/Z/API/Z/keys/science/magnetism.h +19 -0
  224. data/src/external/Z/API/Z/keys/status.h +69 -0
  225. data/src/external/Z/API/Z/keys/text.h +27 -0
  226. data/src/external/Z/API/Z/keys/value.h +88 -0
  227. data/src/external/Z/API/Z/macros/arguments.h +25 -0
  228. data/src/external/Z/API/Z/macros/casting.h +22 -0
  229. data/src/external/Z/API/Z/macros/character.h +159 -0
  230. data/src/external/Z/API/Z/macros/date.h +14 -0
  231. data/src/external/Z/API/Z/macros/key.h +20 -0
  232. data/src/external/Z/API/Z/macros/language.h +126 -0
  233. data/src/external/Z/API/Z/macros/language.hpp +81 -0
  234. data/src/external/Z/API/Z/macros/members.h +86 -0
  235. data/src/external/Z/API/Z/macros/pasting.h +308 -0
  236. data/src/external/Z/API/Z/macros/pointer.h +33 -0
  237. data/src/external/Z/API/Z/macros/repetition.h +283 -0
  238. data/src/external/Z/API/Z/macros/structure.h +104 -0
  239. data/src/external/Z/API/Z/macros/templating.h +407 -0
  240. data/src/external/Z/API/Z/macros/tokens.h +14 -0
  241. data/src/external/Z/API/Z/macros/type enumeration.h +43 -0
  242. data/src/external/Z/API/Z/macros/type selection.hpp +76 -0
  243. data/src/external/Z/API/Z/macros/value.h +489 -0
  244. data/src/external/Z/API/Z/macros/variadic pasting.h +21 -0
  245. data/src/external/Z/API/Z/macros/variadic selection.h +56 -0
  246. data/src/external/Z/API/Z/macros/variadic.h +46 -0
  247. data/src/external/Z/API/Z/macros/version.h +17 -0
  248. data/src/external/Z/API/Z/network/3/IP.h +36 -0
  249. data/src/external/Z/API/Z/network/4/TCP.h +24 -0
  250. data/src/external/Z/API/Z/network/4/UDP.h +26 -0
  251. data/src/external/Z/API/Z/network/7/ED2K.h +104 -0
  252. data/src/external/Z/API/Z/network/7/HTTP.h +100 -0
  253. data/src/external/Z/API/Z/traits/SelectType.hpp +71 -0
  254. data/src/external/Z/API/Z/traits/TernaryType.hpp +20 -0
  255. data/src/external/Z/API/Z/traits/Type.hpp +4516 -0
  256. data/src/external/Z/API/Z/traits/TypeCount.hpp +52 -0
  257. data/src/external/Z/API/Z/traits/TypeList.hpp +376 -0
  258. data/src/external/Z/API/Z/traits/base.hpp +19 -0
  259. data/src/external/Z/API/Z/traits/filtering.hpp +30 -0
  260. data/src/external/Z/API/Z/traits/mathematics.hpp +48 -0
  261. data/src/external/Z/API/Z/types/arguments.h +19 -0
  262. data/src/external/Z/API/Z/types/base.h +1655 -0
  263. data/src/external/Z/API/Z/types/base.hpp +169 -0
  264. data/src/external/Z/API/Z/types/buffering.h +27 -0
  265. data/src/external/Z/API/Z/types/mathematics.h +135 -0
  266. data/src/external/Z/API/Z/types/time.h +23 -0
  267. data/src/external/Z/COPYING.LESSER +165 -0
  268. data/src/external/Z/development/Qt Creator/Z.pro +253 -0
  269. data/src/external/Z/distribution/CocoaPods/Zeta.podspec +18 -0
  270. data/src/external/Z/distribution/Gentoo Linux/Zeta-0.1.ebuild +22 -0
  271. data/src/external/Z/distribution/Gentoo Linux/metadata.xml +8 -0
  272. data/src/external/Z/distribution/Homebrew/Zeta.rb +11 -0
  273. data/src/external/z80/API/emulation/CPU/Z80.h +201 -0
  274. data/src/external/z80/README.md +229 -0
  275. data/src/external/z80/building/premake4.lua +33 -0
  276. data/src/external/z80/development/Xcode/Z80.xcodeproj/project.pbxproj +520 -0
  277. data/src/external/z80/sources/Z80.c +1660 -0
  278. data/src/interrupt.c +6 -0
  279. data/src/interrupt.h +3 -0
  280. data/src/io.c.erb +115 -0
  281. data/src/io.h.erb +18 -0
  282. data/src/main.c +69 -0
  283. data/src/memory.c.erb +43 -0
  284. data/src/memory.h.erb +9 -0
  285. metadata +329 -0
@@ -0,0 +1,1185 @@
1
+ /* Z Kit - formats/storage medium image/audio/TZX.h
2
+ _____ _______________
3
+ /_ /_/ -_/_ _/ _ |
4
+ /____/\___/ /__//___/_| Kit
5
+ Copyright (C) Tomaz Kac.
6
+ Copyright (C) Martijn van der Heide.
7
+ Copyright (C) Ramsoft.
8
+ Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
9
+ Released under the terms of the GNU Lesser General Public License v3.
10
+
11
+ .------------------------------------------------------------------------------.
12
+ | Extensions: tzx, cdt |
13
+ | Endianness: Little |
14
+ | Created by: Tomaz Kac |
15
+ | Used by: Many programs |
16
+ | Reference: http://www.worldofspectrum.org/TZXformat.html |
17
+ | |
18
+ | 1) Introduction |
19
+ | --------------- |
20
+ | |
21
+ | TZX is a file format designed to preserve all (hopefully) of the tapes with |
22
+ | turbo or custom loading routines. Even though some of the newer and smarter |
23
+ | emulators can find most of the information about the loader from the code |
24
+ | itself, this isn't possible if you want to save the file to tape, or to a |
25
+ | real ZX Spectrum. With all this information in the file, the emulators don't |
26
+ | have to bother with finding out the timings and other things. |
27
+ | |
28
+ | This file format is explicitly targeted to the ZX Spectrum compatible |
29
+ | computers only. Specialized versions of the TZX format have been defined for |
30
+ | other machines too, e.g. the Amstrad CPC and Commodore 64, but they are now |
31
+ | available as distinct file formats with other filename extensions. |
32
+ | |
33
+ | If you're looking for TZX files, you can find an extensive collection at |
34
+ | Martijn van der Heide's 'World of Spectrum': http://www.worldofspectrum.org |
35
+ | |
36
+ | The format was first started off by Tomaz Kac who was maintainer until |
37
+ | revision 1.13, and then passed to Martijn v.d. Heide. After that, Ramsoft |
38
+ | were the maintainers for a brief period during which the v1.20 revision was |
39
+ | put together. If you have any questions about the format, visit the forums |
40
+ | at World of Spectrum and ask. |
41
+ | |
42
+ | The default format file extension is "TZX" and hopefully this won't have to |
43
+ | change in the future. Amstrad CPC files should use the extension "CDT" to |
44
+ | distinguish them from the ZX Spectrum files. |
45
+ | |
46
+ | 2) Rules and definitions |
47
+ | ------------------------ |
48
+ | |
49
+ | - Any value requiring more than one byte is stored in little endian-format. |
50
+ | |
51
+ | - All unused bits should be set to zero. |
52
+ | |
53
+ | - The timings are given in Z80 clock cycles unless otherwise stated. |
54
+ | 1 cycle = (1 / 3500000) s |
55
+ | |
56
+ | - All ASCII texts use the ISO 8859-1 (Latin 1) encoding; some of them can |
57
+ | have several lines, which should be separated by ASCII code 0Dh. |
58
+ | |
59
+ | - You might interpret 'wave' as --__ or __--, and 'pulse' as -- or __. |
60
+ | |
61
+ | - The values in brackets are the default values that are used in the ROM |
62
+ | routines of the machine. Curly {} for the ZX Spectrum and square [] for |
63
+ | the Commodore 64. |
64
+ | |
65
+ | - If there is no pause between two data blocks then the second one should |
66
+ | follow immediately; not even so much as one CPU cycle between them. |
67
+ | |
68
+ | - This document refers to 'HIGH' and 'LOW' pulse levels. Whether this is |
69
+ | implemented as EAR=1 and EAR=0 respectively or the other way around is not |
70
+ | important, as long as it is done consistently. |
71
+ | |
72
+ | - The 'current pulse level' after playing the blocks ID 10,11,12,13,14 or 19 |
73
+ | is the opposite of the last pulse level played, so that a subsequent pulse |
74
+ | will produce an edge. |
75
+ | |
76
+ | - A 'Pause' block consists of a LOW pulse level of some duration. |
77
+ | To ensure that the last edge produced is properly finished there should be |
78
+ | at least 1ms pause of the opposite level and only after that the pulse |
79
+ | should go to LOW. At the end of a 'Pause' block the 'current pulse level' |
80
+ | is low (note that the first pulse will therefore not immediately produce |
81
+ | an edge). A 'Pause' block of zero duration is completely ignored, so the |
82
+ | 'current pulse level' will NOT change in this case. This also applies to |
83
+ | 'Data' blocks that have some pause duration included in them. |
84
+ | |
85
+ | - An emulator should put the 'current pulse level' to LOW when starting to |
86
+ | play a TZX file, either from the start or from a certain position. The |
87
+ | writer of a TZX file should ensure that the 'current pulse level' is |
88
+ | well-defined in every sequence of blocks where this is important, i.e. in |
89
+ | any sequence that includes a 'Direct recording' block, or that depends on |
90
+ | edges generated by 'Pause' blocks. The recommended way of doing this is to |
91
+ | include a Pause after each sequence of blocks. |
92
+ | |
93
+ | - General extension rule: ALL custom blocks that will be added after v1.10 |
94
+ | will contain the size of the block in the first 4 bytes (this size does |
95
+ | not include these 4 bytes). This should enable programs that can only |
96
+ | handle older versions to skip that block. |
97
+ | |
98
+ | 3) Fields common to more than 1 type of block |
99
+ | --------------------------------------------- |
100
+ | |
101
+ | block_size |
102
+ | The size (in bytes) of the whole block (without this field). |
103
+ | |
104
+ | data |
105
+ | Data as in .TAP files. |
106
+ | |
107
+ | data_size |
108
+ | The size in bytes of the data following this field. |
109
+ | |
110
+ | general_purpose.data_bit_order |
111
+ | The order in which the bits of the data bytes must be played. |
112
+ | |
113
+ | last_byte_bit_count |
114
+ | Bits used in the last byte of the data (the remaining ones should be 0). |
115
+ | e.g. if this is 6, then the bits used "X" in the last byte are: XXXXXX00, |
116
+ | where MSb is the leftmost bit and LSb is the rightmost bit. |
117
+ | |
118
+ | pause_duration_ms |
119
+ | The duration of the period of silence after block playback in milliseconds |
120
+ | (usually 1000). |
121
+ | |
122
+ | xor_checksum_bit |
123
+ | The XOR checksum (if applicable, i.e. if different than FFh) is a XOR of |
124
+ | all bits in the data byte XORed with the value in this field as the start |
125
+ | value. |
126
+ | |
127
+ | 4) Version history |
128
+ | ------------------ |
129
+ | |
130
+ | v1.20 (2006-12-19) |
131
+ | |
132
+ | - The following blocks have been deprecated and should not appear in TZX |
133
+ | files v1.20 and above: 16h, 17h, 34h, 40h. Their IDs are now reserved. |
134
+ | All Custom information (block ID 35h) types standardized up to v1.13 are |
135
+ | now deprecated. |
136
+ | - The following new blocks have been introduced: 18h, 19h, 2Bh. |
137
+ | Newly added blocks follow the general extension rule. |
138
+ | - Added new entries to the hardware ID list: 00h/1Eh-2Dh, 01h/12h-17h, |
139
+ | 02h/06h-0Ah, 03h/06h-0Ch, 06h/03h, 0Bh/03h, 10h/00h-03h. |
140
+ | |
141
+ | v1.13 (1998-11-02) |
142
+ | |
143
+ | - The following new blocks have been introduced: 16h, 17h. |
144
+ | - Added new entries to the hardware ID list: 00h/1Ch,1Dh. |
145
+ | |
146
+ | v1.12 |
147
+ | |
148
+ | - Added the following fields to the block ID 32h: 05h-08h. |
149
+ | - Added two new types of 'Custom Information' (ID 35h) block: |
150
+ | 'ZX-Edit document' - for .ZED files generated by the great ZX-Editor! |
151
+ | 'Picture' - for .GIF and .JPEG (.JPG) pictures. |
152
+ | - Added new entries to the hardware ID list: 00h/1Ah,1Bh. |
153
+ | |
154
+ | v1.10 |
155
+ | |
156
+ | - The following new blocks have been introduced: 24h, 25h, 26h, 27h, 28h, |
157
+ | 40h. |
158
+ | - Allowed multiple lines in the block ID 32h. Also added field 04h. |
159
+ | - First three types of 'Custom information' (ID 35h) block standardized: |
160
+ | 'POKEs', 'Instructions' and 'Screen'. |
161
+ | |
162
+ | v1.02 |
163
+ | |
164
+ | - Added new entries to the hardware ID list: 00h/15h-19h. |
165
+ | |
166
+ | v1.01 |
167
+ | |
168
+ | - The Length of ASCII content ID in 'Custom Information' (ID 35h) block |
169
+ | should be 16 and not 15 bytes - even Tomaz Kac doesn't remember if it |
170
+ | concerns only documentation or also the implementation; to be sure |
171
+ | consider the block ID 35h as newly added in v1.01. |
172
+ | |
173
+ | v1.00 |
174
+ | |
175
+ | - Initial version. |
176
+ '-----------------------------------------------------------------------------*/
177
+
178
+ #ifndef _Z_formats_storage_medium_image_audio_TZX_H_
179
+ #define _Z_formats_storage_medium_image_audio_TZX_H_
180
+
181
+ #include <Z/types/base.h>
182
+
183
+ /* MARK: - File Header
184
+ .------------------------------------------------------------------------------.
185
+ | The file is identified with the first 8 bytes being 'ZXTape!' plus the EOF |
186
+ | byte 26 (1Ah). This is followed by two bytes containing the major and minor |
187
+ | version numbers. |
188
+ | |
189
+ | To be able to use a TZX file, your program must be able to handle files of |
190
+ | at least its major version number. If your program can handle (say) version |
191
+ | 1.05 and you encounter a file with version number 1.06, your program must be |
192
+ | able to handle it, even if it cannot handle all the data in the file. |
193
+ | |
194
+ | Then the main body of the file follows. It consists of a mixture of blocks, |
195
+ | each preceded and identified by an ID byte. |
196
+ '-----------------------------------------------------------------------------*/
197
+
198
+ Z_DEFINE_STRICT_STRUCTURE (
199
+ zuint8 signature[7]; /* 'ZXTape!' */
200
+ zuint8 eof_marker; /* 1Ah */
201
+ zuint8 major_version;
202
+ zuint8 minor_version;
203
+ ) ZTZXHeader;
204
+
205
+ /* MARK: - Block ID */
206
+
207
+ typedef zuint8 ZTZXBlockID;
208
+
209
+ #define Z_TZX_BLOCK_ID_STANDARD_SPEED_DATA 0x10
210
+ #define Z_TZX_BLOCK_ID_TURBO_SPEED_DATA 0x11
211
+ #define Z_TZX_BLOCK_ID_PURE_TONE 0x12
212
+ #define Z_TZX_BLOCK_ID_PULSE_SEQUENCE 0x13
213
+ #define Z_TZX_BLOCK_ID_PURE_DATA 0x14
214
+ #define Z_TZX_BLOCK_ID_DIRECT_RECORDING 0x15
215
+ #define Z_TZX_BLOCK_ID_C64_ROM_TYPE_DATA 0x16 /* Added in v1.13, deprecated in v1.20 */
216
+ #define Z_TZX_BLOCK_ID_C64_TURBO_TAPE_DATA 0x17 /* Added in v1.13, deprecated in v1.20 */
217
+ #define Z_TZX_BLOCK_ID_CSW_RECORDING 0x18 /* Added in v1.20 */
218
+ #define Z_TZX_BLOCK_ID_GENERALIZED_DATA 0x19 /* Added in v1.20 */
219
+ #define Z_TZX_BLOCK_ID_PAUSE 0x20
220
+ #define Z_TZX_BLOCK_ID_GROUP_START 0x21
221
+ #define Z_TZX_BLOCK_ID_GROUP_END 0x22
222
+ #define Z_TZX_BLOCK_ID_JUMP 0x23
223
+ #define Z_TZX_BLOCK_ID_LOOP_START 0x24 /* Added in v1.10 */
224
+ #define Z_TZX_BLOCK_ID_LOOP_END 0x25 /* Added in v1.10 */
225
+ #define Z_TZX_BLOCK_ID_CALL_SEQUENCE 0x26 /* Added in v1.10 */
226
+ #define Z_TZX_BLOCK_ID_RETURN 0x27 /* Added in v1.10 */
227
+ #define Z_TZX_BLOCK_ID_SELECT 0x28 /* Added in v1.10 */
228
+ #define Z_TZX_BLOCK_ID_STOP_IF_48K 0x2A
229
+ #define Z_TZX_BLOCK_ID_SET_SIGNAL_LEVEL 0x2B /* Added in v1.20 */
230
+ #define Z_TZX_BLOCK_ID_SECTION_DESCRIPTION 0x30
231
+ #define Z_TZX_BLOCK_ID_MESSAGE 0x31
232
+ #define Z_TZX_BLOCK_ID_INFORMATION 0x32
233
+ #define Z_TZX_BLOCK_ID_HARDWARE_INFORMATION 0x33
234
+ #define Z_TZX_BLOCK_ID_EMULATION_INFORMATION 0x34 /* Deprecated in v1.20 */
235
+ #define Z_TZX_BLOCK_ID_CUSTOM_INFORMATION 0x35 /* "Added" in v1.01, deprecated in v1.20 */
236
+ #define Z_TZX_BLOCK_ID_SNAPSHOT 0x40 /* Added in v1.10, deprecated in v1.20 */
237
+ #define Z_TZX_BLOCK_ID_GLUE 0x5A
238
+
239
+ /* MARK: - ID 10h - Standard Speed Data
240
+ .------------------------------------------------------------------------------.
241
+ | This block must be played using the standard Spectrum ROM timings (see the |
242
+ | values in curly brackets in block ID 11). The initial pilot tone consists in |
243
+ | 8063 pulses if the first data byte (flag byte) is < 128, 3223 otherwise. |
244
+ | This block can be used for the ROM loading routines and for custom loading |
245
+ | routines that use the same timings as ROM ones do. |
246
+ '-----------------------------------------------------------------------------*/
247
+
248
+ Z_DEFINE_STRICT_STRUCTURE (
249
+ zuint16 pause_duration_ms;
250
+ zuint16 data_size;
251
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
252
+ ) ZTZXStandardSpeedData;
253
+
254
+ /* MARK: - ID 11h - Turbo Speed Data
255
+ .------------------------------------------------------------------------------.
256
+ | This block is very similar to the normal TAP block but with some additional |
257
+ | information on the timings and other important differences. The same tape |
258
+ | encoding is used as for the standard speed data block. If a block should use |
259
+ | some non-standard sync or pilot tones (i.e. all sorts of protection schemes) |
260
+ | then use the next three blocks to describe it. |
261
+ '-----------------------------------------------------------------------------*/
262
+
263
+ Z_DEFINE_STRICT_STRUCTURE (
264
+ zuint16 cycles_per_pilot_pulse; /* {2168} */
265
+ zuint16 cycles_per_sync_high_pulse; /* {667} */
266
+ zuint16 cycles_per_sync_low_pulse; /* {735} */
267
+ zuint16 cycles_per_bit_0_pulse; /* {855} */
268
+ zuint16 cycles_per_bit_1_pulse; /* {1710} */
269
+ zuint16 pilot_tone_pulse_count; /* {8063 header (flag < 128), 3223 data (flag >= 128)} */
270
+ zuint8 last_byte_bit_count;
271
+ zuint16 pause_duration_ms;
272
+ zuint8 data_size[3];
273
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
274
+ ) ZTZXTurboSpeedData;
275
+
276
+ /* MARK: - ID 12h - Pure Tone
277
+ .----------------------------------------------------------------------------.
278
+ | This will produce a tone which is basically the same as the pilot tone in |
279
+ | the ID 10, ID 11 blocks. You can define how long the pulse is and how many |
280
+ | pulses are in the tone. |
281
+ '---------------------------------------------------------------------------*/
282
+
283
+ Z_DEFINE_STRICT_STRUCTURE (
284
+ zuint16 cycles_per_pulse;
285
+ zuint16 pulse_count;
286
+ ) ZTZXPureTone;
287
+
288
+ /* MARK: - ID 13h - Pulse Sequence
289
+ .------------------------------------------------------------------------------.
290
+ | This will produce N pulses, each having its own timing. Up to 255 pulses can |
291
+ | be stored in this block; this is useful for non-standard sync tones used by |
292
+ | some protection schemes. |
293
+ '-----------------------------------------------------------------------------*/
294
+
295
+ Z_DEFINE_STRICT_STRUCTURE (
296
+ zuint8 pulse_count;
297
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint16 pulse_cycles[];)
298
+ ) ZTZXPulseSequence;
299
+
300
+ /* MARK: - ID 14h - Pure Data
301
+ .------------------------------------------------------------------------------.
302
+ | This is the same as in the turbo loading data block (ID 11h), except that it |
303
+ | has no pilot or sync pulses. |
304
+ '-----------------------------------------------------------------------------*/
305
+
306
+ Z_DEFINE_STRICT_STRUCTURE (
307
+ zuint16 cycles_per_bit_0_pulse;
308
+ zuint16 cycles_per_bit_1_pulse;
309
+ zuint8 last_byte_bit_count;
310
+ zuint16 pause_duration_ms;
311
+ zuint8 data_size[3];
312
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
313
+ ) ZTZXPureData;
314
+
315
+ /* MARK: - ID 15h - Direct Recording
316
+ .------------------------------------------------------------------------------.
317
+ | This block is used for tapes which have some parts in a format such that the |
318
+ | turbo loader block cannot be used. This is not like a VOC file, since the |
319
+ | information is much more compact. Each sample value is represented by one |
320
+ | bit only (0 for LOW, 1 for HIGH) which means that the block will be at most |
321
+ | 1/8 the size of the equivalent VOC. |
322
+ | |
323
+ | The 'current pulse level' after playing this type of block is the last level |
324
+ | played. |
325
+ | |
326
+ | When creating a block of this type please stick to the standard sampling |
327
+ | frequencies of 22050 or 44100 Hz (158 or 79 cycles per pulse). This will |
328
+ | ensure correct playback when using modern soundcards. |
329
+ | |
330
+ | If you can, don't use other sampling frequencies and only use this block if |
331
+ | you can not use any other one. |
332
+ '-----------------------------------------------------------------------------*/
333
+
334
+ Z_DEFINE_STRICT_STRUCTURE (
335
+ zuint16 cycles_per_pulse;
336
+ zuint16 pause_duration_ms;
337
+ zuint8 last_byte_bit_count;
338
+ zuint8 data_size[3];
339
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
340
+ ) ZTZXDirectRecording;
341
+
342
+ /* MARK: - ID 16h - C64 ROM Type Data (Added in v1.13, deprecated in v1.20)
343
+ .------------------------------------------------------------------------------.
344
+ | This block was created to support the Commodore 64 standard ROM and similar |
345
+ | tape blocks. It is made so basically anything that uses two or four pulses |
346
+ | (which are the same in pairs) per bit can be written with it. |
347
+ | |
348
+ | The replay procedure looks like this: |
349
+ | |
350
+ | 1) Pilot Tone |
351
+ | 2) x1 sync wave |
352
+ | 3) For each byte in data: |
353
+ | 1) x8 bit waves (1 wave for each bit of the byte) |
354
+ | 2) x1 XOR wave (optional) |
355
+ | 3) x1 finish byte wave (except in the last byte) |
356
+ | 4) x1 finish data wave |
357
+ | 5) Trailing tone (optional) |
358
+ | 6) Pause |
359
+ | |
360
+ | Some explanation: |
361
+ | |
362
+ | - A wave consists of 2 pulses: first LOW then HIGH. |
363
+ | |
364
+ | - If the cycles of any pulse are 0 then the wave must be skipped. |
365
+ | This applies to DATA too. |
366
+ | |
367
+ | - Finish byte wave should be played after each byte EXCEPT last one. |
368
+ | |
369
+ | - Finish data wave should be ONLY played after last byte of data. |
370
+ | |
371
+ | - When all the data has finished there is an optional trailing tone, which |
372
+ | is standard for the repeated blocks in the Commodore 64 ROM Loader. |
373
+ '-----------------------------------------------------------------------------*/
374
+
375
+ Z_DEFINE_STRICT_STRUCTURE (
376
+ zuint32 block_size;
377
+ zuint16 cycles_per_pilot_pulse; /* [616] */
378
+ zuint16 pilot_wave_count;
379
+ zuint16 cycles_per_sync_low_pulse; /* [1176] */
380
+ zuint16 cycles_per_sync_high_pulse; /* [896] */
381
+ zuint16 cycles_per_bit_0_low_pulse; /* [616] */
382
+ zuint16 cycles_per_bit_0_high_pulse; /* [896] */
383
+ zuint16 cycles_per_bit_1_low_pulse; /* [896] */
384
+ zuint16 cycles_per_bit_1_high_pulse; /* [616] */
385
+ zuint8 xor_checksum_bit;
386
+ zuint16 cycles_per_finish_byte_low_pulse; /* [1176] */
387
+ zuint16 cycles_per_finish_byte_high_pulse; /* [896] */
388
+ zuint16 cycles_per_finish_data_low_pulse; /* [1176] */
389
+ zuint16 cycles_per_finish_data_high_pulse; /* [616] */
390
+ zuint16 cycles_per_trailing_tone_pulse; /* [616] */
391
+ zuint16 trailing_tone_wave_count;
392
+ zuint8 last_byte_bit_count;
393
+
394
+ struct {Z_BIT_FIELD(8, 2) (
395
+ zuint8 unused :7,
396
+ zuint8 data_bit_order :1
397
+ )} general_purpose;
398
+
399
+ zuint16 pause_duration_ms;
400
+ zuint8 data_size[3];
401
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
402
+ ) ZTZXC64ROMTypeData;
403
+
404
+ #define Z_TZX_C64_XOR_CHECKSUM_BIT_START_WITH_0 0x00
405
+ #define Z_TZX_C64_XOR_CHECKSUM_BIT_START_WITH_1 0x01
406
+ #define Z_TZX_C64_XOR_CHECKSUM_BIT_NONE 0xFF
407
+
408
+ #define Z_TZX_C64_DATA_BIT_ORDER_LSB 0 /* LSB first */
409
+ #define Z_TZX_C64_DATA_BIT_ORDER_MSB 1 /* MSB first */
410
+
411
+ /* MARK: - ID 17h - C64 Turbo Tape Data (Added in v1.13, deprecated in v1.20)
412
+ .------------------------------------------------------------------------------.
413
+ | This block is made to support another type of encoding that is commonly used |
414
+ | by the Commodore 64. Most of the commercial software uses this encoding, |
415
+ | i.e. the pilot tone is not made from one type of wave only, but it is made |
416
+ | from actual data byte which is repeated many times. As the sync value |
417
+ | another, different, data byte is sent to signal the start of the data. The |
418
+ | data bits are made from ONE wave only and there is NO XOR checksum either. |
419
+ | The trailing byte is played one or more times AFTER the DATA has ended. |
420
+ | |
421
+ | The replay procedure looks like this: |
422
+ | |
423
+ | 1) Pilot bytes |
424
+ | 2) For each byte in data: |
425
+ | 1) Padding bits (only if padding position is BEFORE) |
426
+ | 2) x8 bit waves (1 wave for each bit of the byte) |
427
+ | 3) Padding bits (only if padding position is AFTER) |
428
+ | 3) Trailing bytes |
429
+ | 4) Pause |
430
+ '-----------------------------------------------------------------------------*/
431
+
432
+ Z_DEFINE_STRICT_STRUCTURE (
433
+ zuint32 block_size;
434
+ zuint16 cycles_per_bit_0_pulse;
435
+ zuint16 cycles_per_bit_1_pulse;
436
+
437
+ struct {Z_BIT_FIELD(8, 4) (
438
+ zuint8 unused :3,
439
+ zuint8 position :1,
440
+ zuint8 value :1,
441
+ zuint8 count :3
442
+ )} padding_bits;
443
+
444
+ zuint16 pilot_byte_count;
445
+ zuint8 pilot_byte;
446
+ zuint8 last_byte_bit_count;
447
+
448
+ struct {Z_BIT_FIELD(8, 2) (
449
+ zuint8 unused :7,
450
+ zuint8 data_bit_order :1
451
+ )} general_purpose;
452
+
453
+ zuint16 trailing_byte_count;
454
+ zuint8 trailing_byte;
455
+ zuint16 pause_duration_ms;
456
+ zuint8 data_size[3];
457
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
458
+ ) ZTZXC64TurboTapeData;
459
+
460
+ #define Z_TZX_C64_PADDING_BITS_POSITION_BEFORE 0
461
+ #define Z_TZX_C64_PADDING_BITS_POSITION_AFTER 1
462
+
463
+ /* MARK: - ID 18h - CSW Recording (Added in v1.20)
464
+ .------------------------------------------------------------------------------.
465
+ | This block contains a sequence of raw pulses encoded in CSW format v2. See |
466
+ | details of this format in <Z/formats/audio/CSW.h> |
467
+ | |
468
+ | The 'current pulse level' after playing this type of block is the last level |
469
+ | played. |
470
+ '-----------------------------------------------------------------------------*/
471
+
472
+ Z_DEFINE_STRICT_STRUCTURE (
473
+ zuint32 block_size;
474
+ zuint16 pause_duration_ms;
475
+ zuint8 sampling_rate[3];
476
+ zuint8 compression_type;
477
+ zuint32 pulse_count; /* After decompression, for validation purposes */
478
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 csw_data[];)
479
+ ) ZTZXCSWRecording;
480
+
481
+ #define Z_TZX_CSW_COMPRESSION_TYPE_RLE 1
482
+ #define Z_TZX_CSW_COMPRESSION_TYPE_Z_RLE 2
483
+
484
+ /* MARK: - ID 19h - Generalized Data (Added in v1.20)
485
+ .------------------------------------------------------------------------------.
486
+ | This block has been specifically developed to represent an extremely wide |
487
+ | range of data encoding techniques. The basic idea is that each loading |
488
+ | component (pilot tone, sync, data) is associated to a specific sequence of |
489
+ | pulses, where each sequence (wave) can contain a different number of pulses |
490
+ | from the others. e.g. we can represent bit 0 with 4 pulses and bit 1 with 8 |
491
+ | pulses. |
492
+ | |
493
+ | The symbols definitions are stored using a table where each symbol is a row |
494
+ | of pulses. The number of columns (i.e. pulses) of the table is the maximum |
495
+ | number of pulses per symbol (amongst pilot/sync and data symbols); shorter |
496
+ | waves are terminated by a zero-length pulse in the sequence. |
497
+ | |
498
+ | Any number of data symbols is allowed, so we can have more than two distinct |
499
+ | waves; for example, imagine a loader which writes two bits at a time by |
500
+ | encoding them with four distinct pulse lengths: this loader would have a |
501
+ | symbols definition table of four symbols, each associated to a specific |
502
+ | sequence of pulses (wave). |
503
+ '-----------------------------------------------------------------------------*/
504
+
505
+ Z_DEFINE_STRICT_STRUCTURE (
506
+ zuint32 block_size;
507
+ zuint16 pause_duration_ms;
508
+ zuint32 pilot_sync_symbol_count;
509
+ zuint8 pulses_per_pilot_sync_symbol_maximum;
510
+ zuint8 pilot_sync_symbol_definition_count;
511
+ zuint32 data_symbol_count;
512
+ zuint8 pulses_per_data_symbol_maximum;
513
+ zuint8 data_symbol_definition_count;
514
+ /* Pilot/sync symbols definition table */
515
+ /* Pilot/sync stream */
516
+ /* Data symbols definition table */
517
+ /* Data stream */
518
+ ) ZTZXGeneralizedData;
519
+
520
+ Z_DEFINE_STRICT_STRUCTURE (
521
+ zuint8 polarity;
522
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint16 pulse_durations[];)
523
+ ) ZTZXSymbolDefinition;
524
+
525
+ #define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_OPPOSITE 0
526
+ #define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_CURRENT 1
527
+ #define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_LOW 2
528
+ #define Z_TZX_SYMBOL_DEFINITION_FLAG_POLARITY_HIGH 3
529
+
530
+ /*----------------------------------------------------------------------------.
531
+ | Most commonly, pilot and sync are repetitions of the same pulse, thus they |
532
+ | are represented using a very simple RLE encoding structure which stores the |
533
+ | symbol and the number of times it must be repeated. |
534
+ | |
535
+ | Each symbol in the data stream is represented by a string of NB bits of the |
536
+ | block data, where NB = ceil(log2(ASD)). Thus the length of the whole data |
537
+ | stream in bits is NB * TOTD, or in bytes DS = ceil(NB * TOTD / 8). |
538
+ '----------------------------------------------------------------------------*/
539
+
540
+ Z_DEFINE_STRICT_STRUCTURE (
541
+ zuint8 symbol;
542
+ zuint16 repetitions;
543
+ ) ZTZXPulseRLE;
544
+
545
+ /* MARK: EXAMPLE
546
+ A typical Spectrum's standard loading header can be represented like this:
547
+
548
+ Offset Value Description
549
+ .----+-----------------+----------------------------------------------.
550
+ | 00 | 59 (3Bh) | Total block length |
551
+ |----+-----------------+----------------------------------------------|
552
+ | 04 | 1000 (03E8h) | Pause after this block (ms.) |
553
+ |----+-----------------+----------------------------------------------|
554
+ | 06 | 2 | Total number of symbols in pilot/sync block |
555
+ |----+-----------------+----------------------------------------------|
556
+ | 0A | 2 | Maximum pulses per symbol |
557
+ |----+-----------------+----------------------------------------------|
558
+ | 0B | 2 | Number of symbols in pilot/sync alphabet |
559
+ |----+-----------------+----------------------------------------------|
560
+ | 0C | 152 (98h) | Total number of symbols (bits, in this case) |
561
+ | | | in data stream |
562
+ |----+-----------------+----------------------------------------------|
563
+ | 10 | 2 | Max pulses per data symbol |
564
+ |----+-----------------+----------------------------------------------|
565
+ | 11 | 2 | Number of symbols in data alphabet |
566
+ |----+-----------------+----------------------------------------------|
567
+ | 12 | (0, 2168, 0) | Pilot/sync symbol definitions |
568
+ | | (0, 667, 735) | |
569
+ |----+-----------------+----------------------------------------------|
570
+ | 1C | (0, 8063) | Pilot/sync data block |
571
+ | | (1, 1) | |
572
+ |----+-----------------+----------------------------------------------|
573
+ | 22 | (0, 855, 855) | Data symbol definitions |
574
+ | | (0, 1710, 1710) | |
575
+ |----+-----------------+----------------------------------------------|
576
+ | 2C | 00000000b (00h) |- Loading flag (00h = header) |
577
+ | | 00000011b (03h) |- Data type (03h = "Bytes:") |
578
+ | | 01001010b (4Ah) |\ |
579
+ | | 01010000b (50h) | | |
580
+ | | 01010011b (53h) | | |
581
+ | | 01010000b (50h) | | |
582
+ | | 00100000b (20h) | | File name ("JPSP") |
583
+ | | 00100000b (20h) | | |
584
+ | | 00100000b (20h) | | |
585
+ | | 00100000b (20h) | | |
586
+ | | 00100000b (20h) | | |
587
+ | | 00100000b (20h) |/ |
588
+ | | 00000000b (00h) |\ Data length |
589
+ | | 00011011b (1Bh) |/ |
590
+ | | 00000000b (00h) |\ Start address |
591
+ | | 01000000b (40h) |/ |
592
+ | | 00000000b (00h) |\ Autostart (no meaning here) |
593
+ | | 10000000b (80h) |/ |
594
+ | | 11000001b (C1h) |- Checksum |
595
+ '--------------------------------------------------------------------*/
596
+
597
+ /* MARK: - ID 20h - Pause (Silence) or 'Stop the Tape' Command
598
+ .------------------------------------------------------------------------------.
599
+ | This will make a silence (LOW pulses) for a given time. If the duration is 0 |
600
+ | then the emulator or utility should (in effect) STOP THE TAPE, i.e. should |
601
+ | not continue loading until the user or emulator requests it. |
602
+ '-----------------------------------------------------------------------------*/
603
+
604
+ Z_DEFINE_STRICT_STRUCTURE (
605
+ zuint16 duration_ms;
606
+ ) ZTZXPause;
607
+
608
+ /* MARK: - ID 21h - Group Start
609
+ .-----------------------------------------------------------------------------.
610
+ | This block marks the start of a group of blocks which are to be treated as |
611
+ | one single (composite) block. This is very handy for tapes that use lots of |
612
+ | blocks like Bleepload (which may well have over 160 custom loading blocks). |
613
+ | You can also give the group a name (example 'Bleepload Block 1'). |
614
+ | |
615
+ | For each group start block, there must be a group end block. Nesting of |
616
+ | groups is not allowed. |
617
+ | |
618
+ | Please keep the group name under 30 characters long. |
619
+ '----------------------------------------------------------------------------*/
620
+
621
+ Z_DEFINE_STRICT_STRUCTURE (
622
+ zuint8 name_size;
623
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 name[];)
624
+ ) ZTZXGroupStart;
625
+
626
+ /* MARK: - ID 22h - Group End
627
+ .------------------------------------------------------------.
628
+ | This indicates the end of a group. This block has no body. |
629
+ '-----------------------------------------------------------*/
630
+
631
+ /* MARK: - ID 23h - Jump
632
+ .---------------------------------------------------------------------.
633
+ | This block will enable you to jump from one block to another within |
634
+ | the file. Some examples: |
635
+ | |
636
+ | Jump 0 = 'Loop Forever' - this should never happen |
637
+ | Jump 1 = 'Go to the next block' - it is like NOP in assembler ;) |
638
+ | Jump 2 = 'Skip one block' |
639
+ | Jump -1 = 'Go to the previous block' |
640
+ | |
641
+ | All blocks are included in the block count! |
642
+ '--------------------------------------------------------------------*/
643
+
644
+ Z_DEFINE_STRICT_STRUCTURE (
645
+ zsint16 relative_offset;
646
+ ) ZTZXJump;
647
+
648
+ /* MARK: - ID 24h - Loop Start (Added in v1.10)
649
+ .------------------------------------------------------------------------------.
650
+ | If you have a sequence of identical blocks or groups of blocks, you can use |
651
+ | this block to tell how many times they should be repeated. This block is the |
652
+ | same as the FOR statement in BASIC. |
653
+ | |
654
+ | For simplicity reasons don't nest loop blocks! |
655
+ '-----------------------------------------------------------------------------*/
656
+
657
+ Z_DEFINE_STRICT_STRUCTURE (
658
+ zuint16 count; /* Greater than 1 */
659
+ ) ZTZXLoopStart;
660
+
661
+ /* MARK: - ID 25h - Loop End (Added in v1.10)
662
+ .------------------------------------------------------------------------------.
663
+ | This is the same as BASIC's NEXT statement. It means that the utility should |
664
+ | jump back to the start of the loop if it hasn't been run for the specified |
665
+ | number of times. |
666
+ | |
667
+ | This block has no body. |
668
+ '-----------------------------------------------------------------------------*/
669
+
670
+ /* MARK: - ID 26h - Call Sequence (Added in v1.10)
671
+ .------------------------------------------------------------------------------.
672
+ | This block is an analogue of the CALL Subroutine statement. It basically |
673
+ | executes a sequence of blocks that are somewhere else and then goes back to |
674
+ | the next block. Because more than one call can be normally used you can |
675
+ | include a list of sequences to be called. The 'nesting' of call blocks is |
676
+ | also not allowed for the simplicity reasons. You can, of course, use the |
677
+ | CALL blocks in the LOOP sequences and vice versa. The value is relative for |
678
+ | the obvious reasons: so that you can add some blocks in the beginning of the |
679
+ | file without disturbing the call values. Please take a look at block ID 23h |
680
+ | for reference on the values. |
681
+ '-----------------------------------------------------------------------------*/
682
+
683
+ Z_DEFINE_STRICT_STRUCTURE (
684
+ zuint16 count;
685
+ Z_FLEXIBLE_ARRAY_MEMBER(zsint16 relative_offsets[];)
686
+ ) ZTZXCallSequence;
687
+
688
+ /* MARK: - ID 27h - Return (Added in v1.10)
689
+ .----------------------------------------------------------------------------.
690
+ | This block indicates the end of the Called Sequence. The next block played |
691
+ | will be the block after the last CALL block (or the next Call, if the Call |
692
+ | block had multiple calls). |
693
+ | |
694
+ | This block has no body. |
695
+ '---------------------------------------------------------------------------*/
696
+
697
+ /* MARK: - ID 28h - Select (Added in v1.10)
698
+ .------------------------------------------------------------------------------.
699
+ | This block is useful when the tape consists of two or more separately |
700
+ | loadable parts. With this block, you are able to select one of the parts and |
701
+ | the emulator/utility will start loading from that block. For example you can |
702
+ | use it when the game has a separate Trainer or when it is a multiload. |
703
+ | Of course, to make some use of it the emulator/utility has to show a menu |
704
+ | with the selections when it encounters such a block. |
705
+ | |
706
+ | Please use single line and maximum of 30 characters for description texts. |
707
+ '-----------------------------------------------------------------------------*/
708
+
709
+ Z_DEFINE_STRICT_STRUCTURE (
710
+ zuint32 block_size;
711
+ zuint8 item_count;
712
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 items[];) /* ZTZXSelectItem */
713
+ ) ZTZXSelect;
714
+
715
+ Z_DEFINE_STRICT_STRUCTURE (
716
+ zsint16 relative_offset;
717
+ zuint8 description_size;
718
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 description[];)
719
+ ) ZTZXSelectItem;
720
+
721
+ /* MARK: - ID 2Ah - Stop if 48K
722
+ .------------------------------------------------------------------------------.
723
+ | When this block is encountered, the tape will stop ONLY if the machine is a |
724
+ | 48K ZX Spectrum. This block is to be used for multiloading games that load |
725
+ | one level at a time in 48K mode, but load the entire tape at once if in 128K |
726
+ | mode. |
727
+ | |
728
+ | This block has no body of its own, but follows the extension rule. |
729
+ '-----------------------------------------------------------------------------*/
730
+
731
+ Z_DEFINE_STRICT_STRUCTURE (
732
+ zuint32 block_size; /* 0 */
733
+ ) ZTZXStopIf48K;
734
+
735
+ /* MARK: - ID 2Bh - Set Signal Level (Added in v1.20)
736
+ .----------------------------------------------------------------------.
737
+ | This block sets the 'current pulse level' to the specified value |
738
+ | (HIGH or LOW). It should be used whenever it is necessary to avoid |
739
+ | any ambiguities, e.g. with custom loaders which are level-sensitive. |
740
+ '---------------------------------------------------------------------*/
741
+
742
+ Z_DEFINE_STRICT_STRUCTURE (
743
+ zuint32 block_size;
744
+ zuint8 level;
745
+ ) ZTZXSetSignalLevel;
746
+
747
+ #define Z_TZX_SIGNAL_LEVEL_LOW 0
748
+ #define Z_TZX_SIGNAL_LEVEL_HIGH 1
749
+
750
+ /* MARK: - ID 30h - Section Description
751
+ .------------------------------------------------------------------------------.
752
+ | This is meant to identify parts of the tape, so you know where level 1 |
753
+ | starts, where to rewind to when the game ends, etc. This description is not |
754
+ | guaranteed to be shown while the tape is playing, but can be read while |
755
+ | browsing the tape or changing the tape pointer. |
756
+ | |
757
+ | The description can be up to 255 characters long but please keep it down to |
758
+ | about 30 so the program can show it in one line (where this is appropriate). |
759
+ | |
760
+ | Please use block ID 32h for title, authors, publisher, etc. |
761
+ '-----------------------------------------------------------------------------*/
762
+
763
+ Z_DEFINE_STRICT_STRUCTURE (
764
+ zuint8 text_size;
765
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 text[];)
766
+ ) ZTZXSectionDescription;
767
+
768
+ /* MARK: - ID 31h - Message
769
+ .----------------------------------------------------------------------------.
770
+ | This will enable the emulators to display a message for a given time. This |
771
+ | should not stop the tape and it should not make silence. If the time is 0 |
772
+ | then the emulator should wait for the user to press a key. |
773
+ | |
774
+ | The text message should: |
775
+ | - Stick to a maximum of 30 characters per line. |
776
+ | - Stick to a maximum of 8 lines. |
777
+ | - Use single 0Dh (13 decimal) to separate lines. |
778
+ | |
779
+ | If you do not obey these rules, emulators may display your message in any |
780
+ | way they like. |
781
+ '---------------------------------------------------------------------------*/
782
+
783
+ Z_DEFINE_STRICT_STRUCTURE (
784
+ zuint8 duration_s; /* Seconds */
785
+ zuint8 text_size;
786
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 text[];)
787
+ ) ZTZXMessage;
788
+
789
+ /* MARK: - ID 32h - Information
790
+ .------------------------------------------------------------------------------.
791
+ | Use this block at the beginning of the tape to identify the title of the |
792
+ | game, author, publisher, year of publication, price (including the |
793
+ | currency), type of software (arcade adventure, puzzle, word processor, ...), |
794
+ | loader/protection scheme it uses (Speedlock 1, Alkatraz, ...) and its origin |
795
+ | (Original, Budget re-release, ...), etc. This block is built in a way that |
796
+ | allows easy future expansion. The block consists of a series of fields. Each |
797
+ | one has its identification number (which tells us what the field means) and |
798
+ | then the ASCII text. To make it possible to skip this block, if needed, the |
799
+ | length of the whole block is at the beginning of it. |
800
+ | |
801
+ | If all texts on the tape are in English language then you don't have to |
802
+ | supply the language field. |
803
+ | |
804
+ | The information about what hardware the tape uses is in the block ID 33h, so |
805
+ | no need for it here. |
806
+ '-----------------------------------------------------------------------------*/
807
+
808
+ Z_DEFINE_STRICT_STRUCTURE (
809
+ zuint32 block_size;
810
+ zuint8 field_count;
811
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 fields[];) /* ZTZXInformationField */
812
+ ) ZTZXInformation;
813
+
814
+ Z_DEFINE_STRICT_STRUCTURE (
815
+ zuint8 id;
816
+ zuint8 text_size;
817
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 text[];)
818
+ ) ZTZXInformationField;
819
+
820
+ #define Z_TZX_INFORMATION_FIELD_FULL_TITLE 0x00
821
+ #define Z_TZX_INFORMATION_FIELD_PUBLISHER 0x01
822
+ #define Z_TZX_INFORMATION_FIELD_AUTHORS 0x02
823
+ #define Z_TZX_INFORMATION_FIELD_YEAR 0x03
824
+ #define Z_TZX_INFORMATION_FIELD_LANGUAGE 0x04 /* Added in v1.10 */
825
+ #define Z_TZX_INFORMATION_FIELD_TYPE 0x05 /* Added in v1.12 */
826
+ #define Z_TZX_INFORMATION_FIELD_PRICE 0x06 /* Added in v1.12 */
827
+ #define Z_TZX_INFORMATION_FIELD_LOADER 0x07 /* Added in v1.12 */
828
+ #define Z_TZX_INFORMATION_FIELD_ORIGIN 0x08 /* Added in v1.12 */
829
+ #define Z_TZX_INFORMATION_FIELD_COMMENT 0xFF
830
+
831
+ /* MARK: - ID 33h - Hardware Information
832
+ .----------------------------------------------------------------------------.
833
+ | This blocks contains information about the hardware that the programs on |
834
+ | this tape use. Please include only machines and hardware for which you are |
835
+ | 100% sure that it either runs (or doesn't run) on or with, or you know it |
836
+ | uses (or doesn't use) the hardware or special features of that machine. |
837
+ | |
838
+ | If the tape runs only on the ZX81 (and TS1000, etc.) then it clearly won't |
839
+ | work on any Spectrum or Spectrum variant, so there's no need to list this |
840
+ | information. |
841
+ | |
842
+ | If you are not sure or you haven't tested a tape on some particular |
843
+ | machine/hardware combination then do not include it in the list. |
844
+ '---------------------------------------------------------------------------*/
845
+
846
+ Z_DEFINE_STRICT_STRUCTURE (
847
+ zuint8 type;
848
+ zuint8 id;
849
+ zuint8 compatibility;
850
+ ) ZTZXHardware;
851
+
852
+ Z_DEFINE_STRICT_STRUCTURE (
853
+ zuint8 hardware_count;
854
+ Z_FLEXIBLE_ARRAY_MEMBER(ZTZXHardware hardware[];) /* ZTZXHardware */
855
+ ) ZTZXHardwareInformation;
856
+
857
+ #define Z_TZX_HARDWARE_TYPE_MACHINE 0x00
858
+ #define Z_TZX_HARDWARE_TYPE_STORAGE 0x01
859
+ #define Z_TZX_HARDWARE_TYPE_MEMORY 0x02
860
+ #define Z_TZX_HARDWARE_TYPE_SOUND 0x03
861
+ #define Z_TZX_HARDWARE_TYPE_JOYSTICK 0x04
862
+ #define Z_TZX_HARDWARE_TYPE_MICE 0x05
863
+ #define Z_TZX_HARDWARE_TYPE_OTHER 0x06
864
+ #define Z_TZX_HARDWARE_TYPE_SERIAL_PORT 0x07
865
+ #define Z_TZX_HARDWARE_TYPE_PARALLEL_PORT 0x08
866
+ #define Z_TZX_HARDWARE_TYPE_PRINTER 0x09
867
+ #define Z_TZX_HARDWARE_TYPE_MODEM 0x0A
868
+ #define Z_TZX_HARDWARE_TYPE_DIGITIZER 0x0B
869
+ #define Z_TZX_HARDWARE_TYPE_NETWORK_ADAPTER 0x0C
870
+ #define Z_TZX_HARDWARE_TYPE_KEYBOARD 0x0D
871
+ #define Z_TZX_HARDWARE_TYPE_ADC_DAC 0x0E
872
+ #define Z_TZX_HARDWARE_TYPE_EPROM_PROGRAMMER 0x0F
873
+ #define Z_TZX_HARDWARE_TYPE_GRAPHICS 0x10
874
+
875
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_16K 0x00
876
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_48K_PLUS 0x01
877
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_48K_ISSUE_1 0x02
878
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_128K_SINCLAIR 0x03
879
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_2 0x04
880
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_2A_PLUS_3 0x05
881
+ #define Z_TZX_MACHINE_ID_TIMEX_SINCLAIR_2048 0x06
882
+ #define Z_TZX_MACHINE_ID_TIMEX_SINCLAIR_2068 0x07
883
+ #define Z_TZX_MACHINE_ID_PENTAGON_128 0x08
884
+ #define Z_TZX_MACHINE_ID_SAM_COUPE 0x09
885
+ #define Z_TZX_MACHINE_ID_DIDAKTIK_M 0x0A
886
+ #define Z_TZX_MACHINE_ID_DIDAKTIK_GAMA 0x0B
887
+ #define Z_TZX_MACHINE_ID_ZX80 0x0C
888
+ #define Z_TZX_MACHINE_ID_ZX81 0x0D
889
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_128K_ES 0x0E
890
+ #define Z_TZX_MACHINE_ID_ZX_SPECTRUM_PLUS_2_AR 0x0F
891
+ #define Z_TZX_MACHINE_ID_MICRODIGITAL_TK_90X 0x10
892
+ #define Z_TZX_MACHINE_ID_MICRODIGITAL_TK_95 0x11
893
+ #define Z_TZX_MACHINE_ID_BAJT 0x12
894
+ #define Z_TZX_MACHINE_ID_ELWRO_800_3_JUNIOR 0x13
895
+ #define Z_TZX_MACHINE_ID_SCORPION_ZS_256 0x14
896
+ #define Z_TZX_MACHINE_ID_CPC_464 0x15 /* Added in v1.02 */
897
+ #define Z_TZX_MACHINE_ID_CPC_664 0x16 /* Added in v1.02 */
898
+ #define Z_TZX_MACHINE_ID_CPC_6128 0x17 /* Added in v1.02 */
899
+ #define Z_TZX_MACHINE_ID_CPC_464_PLUS 0x18 /* Added in v1.02 */
900
+ #define Z_TZX_MACHINE_ID_CPC_6128_PLUS 0x19 /* Added in v1.02 */
901
+ #define Z_TZX_MACHINE_ID_JUPITER_ACE 0x1A /* Added in v1.12 */
902
+ #define Z_TZX_MACHINE_ID_ENTERPRISE 0x1B /* Added in v1.12 */
903
+ #define Z_TZX_MACHINE_ID_COMMODORE_64 0x1C /* Added in v1.13 */
904
+ #define Z_TZX_MACHINE_ID_COMMODORE_128 0x1D /* Added in v1.13 */
905
+ #define Z_TZX_MACHINE_ID_INVES_SPECTRUM_PLUS 0x1E /* Added in v1.20 */
906
+ #define Z_TZX_MACHINE_ID_PROFI 0x1F /* Added in v1.20 */
907
+ #define Z_TZX_MACHINE_ID_GRANDROMMAX 0x20 /* Added in v1.20 */
908
+ #define Z_TZX_MACHINE_ID_KAY_1024 0x21 /* Added in v1.20 */
909
+ #define Z_TZX_MACHINE_ID_HC_91 0x22 /* Added in v1.20 */
910
+ #define Z_TZX_MACHINE_ID_HC_2000 0x23 /* Added in v1.20 */
911
+ #define Z_TZX_MACHINE_ID_MISTRUM 0x24 /* Added in v1.20 */
912
+ #define Z_TZX_MACHINE_ID_QUORUM_128 0x25 /* Added in v1.20 */
913
+ #define Z_TZX_MACHINE_ID_ATM 0x26 /* Added in v1.20 */
914
+ #define Z_TZX_MACHINE_ID_ATM_TURBO_2 0x27 /* Added in v1.20 */
915
+ #define Z_TZX_MACHINE_ID_CHROME 0x28 /* Added in v1.20 */
916
+ #define Z_TZX_MACHINE_ID_ZX_BADA_LOC 0x29 /* Added in v1.20 */
917
+ #define Z_TZX_MACHINE_ID_TIMEX_SINCLAIR_1500 0x2A /* Added in v1.20 */
918
+ #define Z_TZX_MACHINE_ID_PC_8300 0x2B /* Added in v1.20 */
919
+ #define Z_TZX_MACHINE_ID_TK95 0x2C /* Added in v1.20 */
920
+ #define Z_TZX_MACHINE_ID_ZX97_LITE 0x2D /* Added in v1.20 */
921
+
922
+ #define Z_TZX_STORAGE_ID_ZX_MICRODRIVE 0x00
923
+ #define Z_TZX_STORAGE_ID_OPUS_DISCOVERY_1 0x01
924
+ #define Z_TZX_STORAGE_ID_DISCIPLE 0x02
925
+ #define Z_TZX_STORAGE_ID_PLUS_D 0x03
926
+ #define Z_TZX_STORAGE_ID_WAFADRIVE 0x04
927
+ #define Z_TZX_STORAGE_ID_BETA_DISK_INTERFACE 0x05
928
+ #define Z_TZX_STORAGE_ID_BYTE_DRIVE_500 0x06
929
+ #define Z_TZX_STORAGE_ID_WATFORD /* What model? */ 0x07
930
+ #define Z_TZX_STORAGE_ID_FIZ 0x08
931
+ #define Z_TZX_STORAGE_ID_TRITON_QUICK_DISK 0x09
932
+ #define Z_TZX_STORAGE_ID_DIDAKTIK_40_80 0x0A
933
+ #define Z_TZX_STORAGE_ID_MB_02_PLUS 0x0B
934
+ #define Z_TZX_STORAGE_ID_ZX_SPECTRUM_PLUS_3_DISK_DRIVE 0x0C
935
+ #define Z_TZX_STORAGE_ID_OLIGER_DISK_INTERFACE 0x0D
936
+ #define Z_TZX_STORAGE_ID_TIMEX_FDD_3000 0x0E
937
+ #define Z_TZX_STORAGE_ID_ZEBRA_FLOPPY_DISK_DRIVE 0x0F
938
+ #define Z_TZX_STORAGE_ID_MILLENA_K 0x10
939
+ #define Z_TZX_STORAGE_ID_LARKEN 0x11
940
+ #define Z_TZX_STORAGE_ID_KEMPSTON_DISC_INTERFACE 0x12 /* Added in v1.20 */
941
+ #define Z_TZX_STORAGE_ID_SANDY 0x13 /* Added in v1.20 */
942
+ #define Z_TZX_STORAGE_ID_ZX_SPECTRUM_PLUS_3E_HDD 0x14 /* Added in v1.20 */
943
+ #define Z_TZX_STORAGE_ID_ZXATASP 0x15 /* Added in v1.20 */
944
+ #define Z_TZX_STORAGE_ID_DIVIDE 0x16 /* Added in v1.20 */
945
+ #define Z_TZX_STORAGE_ID_ZXCF 0x17 /* Added in v1.20 */
946
+
947
+ #define Z_TZX_MEMORY_ID_SAM_RAM 0x00
948
+ #define Z_TZX_MEMORY_ID_MULTIFACE_ONE 0x01
949
+ #define Z_TZX_MEMORY_ID_MULTIFACE_128 0x02
950
+ #define Z_TZX_MEMORY_ID_MULTIFACE_3 0x03
951
+ #define Z_TZX_MEMORY_ID_MULTIPRINT 0x04
952
+ #define Z_TZX_MEMORY_ID_MB_02_PLUS 0x05
953
+ #define Z_TZX_MEMORY_ID_SOFT_ROM 0x06 /* Added in v1.20 */
954
+ #define Z_TZX_MEMORY_ID_1K 0x07 /* Added in v1.20 */
955
+ #define Z_TZX_MEMORY_ID_16K 0x08 /* Added in v1.20 */
956
+ #define Z_TZX_MEMORY_ID_48K 0x09 /* Added in v1.20 */
957
+ #define Z_TZX_MEMORY_ID_8K_16K_USED 0x0A /* Added in v1.20 */
958
+
959
+ #define Z_TZX_SOUND_ID_CLASSIC_AY 0x00 /* (compatible with 128K ZXs) */
960
+ #define Z_TZX_SOUND_ID_FULLER_BOX_AY 0x01
961
+ #define Z_TZX_SOUND_ID_CURRAH_MICROSPEECH 0x02
962
+ #define Z_TZX_SOUND_ID_SPECDRUM 0x03
963
+ #define Z_TZX_SOUND_ID_AY_ACB_STEREO_MELODIK 0x04
964
+ #define Z_TZX_SOUND_ID_AY_ABC_STEREO 0x05
965
+ #define Z_TZX_SOUND_ID_MUSIC_MACHINE 0x06 /* Added in v1.20 */
966
+ #define Z_TZX_SOUND_ID_COVOX 0x07 /* Added in v1.20 */
967
+ #define Z_TZX_SOUND_ID_GENERAL_SOUND 0x08 /* Added in v1.20 */
968
+ #define Z_TZX_SOUND_ID_DIGITAL_INTERFACE_B8001 0x09 /* Added in v1.20 */
969
+ #define Z_TZX_SOUND_ID_ZON_X_AY 0x0A /* Added in v1.20 */
970
+ #define Z_TZX_SOUND_ID_QUICKSILVA_AY 0x0B /* Added in v1.20 */
971
+ #define Z_TZX_SOUND_ID_JUPITER_ACE 0x0C /* Added in v1.20 */
972
+
973
+ #define Z_TZX_JOYSTICK_ID_KEMPSTON 0x00
974
+ #define Z_TZX_JOYSTICK_ID_STAR_CURSOR_PROTEK_AGF 0x01
975
+ #define Z_TZX_JOYSTICK_ID_SINCLAIR_2_LEFT 0x02
976
+ #define Z_TZX_JOYSTICK_ID_SINCLAIR_1_RIGHT 0x03
977
+ #define Z_TZX_JOYSTICK_ID_FULLER 0x04
978
+
979
+ #define Z_TZX_MICE_ID_AMX_MOUSE 0x00
980
+ #define Z_TZX_MICE_ID_KEMPSTON_MOUSE 0x01
981
+
982
+ #define Z_TZX_HARDWARE_ID_TRICKSTICK 0x00
983
+ #define Z_TZX_HARDWARE_ID_SINCLAIR_LIGHT_GUN 0x01
984
+ #define Z_TZX_HARDWARE_ID_ZEBRA_GRAPHICS_TABLET /* correct name? */ 0x02
985
+ #define Z_TZX_HARDWARE_ID_DEFENDER_LIGHT_GUN 0x03 /* Added in v1.20 */
986
+
987
+ #define Z_TZX_SERIAL_PORT_ID_ZX_INTERFACE_1 0x00
988
+ #define Z_TZX_SERIAL_PORT_ID_ZX_SPECTRUM_PLUS_128K 0x01
989
+
990
+ #define Z_TZX_PARALLEL_PORT_ID_KEMPSTON_CENTRONICS_INTERFACE_S 0x00
991
+ #define Z_TZX_PARALLEL_PORT_ID_KEMPSTON_CENTRONICS_INTERFACE_E 0x01
992
+ #define Z_TZX_PARALLEL_PORT_ID_ZX_SPECTRUM_PLUS_3 0x02
993
+ #define Z_TZX_PARALLEL_PORT_ID_TASMAN_PARALLEL_PRINTER_INTERFACE 0x03
994
+ #define Z_TZX_PARALLEL_PORT_ID_DKTRONICS_PARALLEL_CENTRONICS_INTERFACE 0x04
995
+ #define Z_TZX_PARALLEL_PORT_ID_HILDERBAY_INTERFACE 0x05
996
+ #define Z_TZX_PARALLEL_PORT_ID_INES_PRINTERFACE /* ? */ 0x06
997
+ #define Z_TZX_PARALLEL_PORT_ID_ZX_LPRINT_III 0x07
998
+ #define Z_TZX_PARALLEL_PORT_ID_MULTIPRINT 0x08
999
+ #define Z_TZX_PARALLEL_PORT_ID_OPUS_DISCOVERY_1 0x09
1000
+ #define Z_TZX_PARALLEL_PORT_ID_STANDARD_8255_IC_WITH_PORTS_31_63_95 0x0A
1001
+
1002
+ #define Z_TZX_PRINTER_ID_ZX_PRINTER_COMPATIBLE 0x00
1003
+ #define Z_TZX_PRINTER_ID_GENERIC_PRINTER 0x01
1004
+ #define Z_TZX_PRINTER_ID_EPSON_COMPATIBLE 0x02
1005
+
1006
+ #define Z_TZX_MODEM_ID_PRISM_VTX5000 0x00
1007
+ #define Z_TZX_MODEM_ID_TS_2050 0x01
1008
+
1009
+ #define Z_TZX_DIGITIZER_ID_RD_DIGITAL_TRACER 0x00
1010
+ #define Z_TZX_DIGITIZER_ID_DKTRONICS_LIGHT_PEN 0x01
1011
+ #define Z_TZX_DIGITIZER_ID_GRAFPAD 0x02
1012
+ #define Z_TZX_DIGITIZER_ID_VIDEOFACE 0x03 /* Added in v1.20 */
1013
+
1014
+ #define Z_TZX_NETWORK_ADAPTER_ID_ZX_INTERFACE_1 0x00
1015
+
1016
+ #define Z_TZX_KEYBOARD_ID_ZX_SPECTRUM_PLUS_128K_KEYPAD 0x00
1017
+
1018
+ #define Z_TZX_ADC_DAC_ID_ADC8 0x00
1019
+ #define Z_TZX_ADC_DAC_ID_BLACKBOARD_ELECTRONICS /* ? */ 0x01
1020
+
1021
+ #define Z_TZX_EPROM_PROGRAMMER_ID_ORME_EPROM_CARD 0x00
1022
+
1023
+ #define Z_TZX_GRAPHICS_ID_WRX_HI_RES /* correct name? */ 0x00 /* Added in v1.20 */
1024
+ #define Z_TZX_GRAPHICS_ID_G007 0x01 /* Added in v1.20 */
1025
+ #define Z_TZX_GRAPHICS_ID_MEMOTECH /* Memopak HRG? */ 0x02 /* Added in v1.20 */
1026
+ #define Z_TZX_GRAPHICS_ID_LAMBDA_8300 0x03 /* Added in v1.20 */
1027
+
1028
+ #define Z_TZX_HARDWARE_COMPATIBILITY_COMPATIBLE 0
1029
+ #define Z_TZX_HARDWARE_COMPATIBILITY_NEEDED 1
1030
+ #define Z_TZX_HARDWARE_COMPATIBILITY_UNNEEDED 2
1031
+ #define Z_TZX_HARDWARE_COMPATIBILITY_INCOMPATIBLE 3
1032
+
1033
+ /* MARK: - ID 34h - Emulation Information (Deprecated in v1.20)
1034
+ .------------------------------------------------------------------------------.
1035
+ | This is a special block that would normally be generated only by emulators. |
1036
+ | For now it contains information on everything the authors could find that |
1037
+ | other formats support. Please inform them of any additions/corrections since |
1038
+ | this is a very important part for emulators. |
1039
+ | Those bits that are not used by the emulator that stored the info, should be |
1040
+ | left at their DEFAULT values. |
1041
+ '------------------------------------------------------------------------------'
1042
+
1043
+ Flags (16-bit little-endian):
1044
+
1045
+ loading featatures
1046
+ ___|____ ______|______
1047
+ .-/ \-/ \-.
1048
+ | 15..10 9 8 7 6 5 4 3 2 1 0 |
1049
+ '-\____/-|-|-|-|-|-\_/-|-|-|-'
1050
+ unused | | | | | | | | '-> R register emulation
1051
+ | | | | | | | '---> LDIR instruction emulation
1052
+ | | | | | | '-----> high resolution colour emulation with
1053
+ | | | | | | true interrupt frequency
1054
+ | | | | | '--------> video synchronisation
1055
+ | | | | | (1 = high, 3 = low, 0 or 2 = normal)
1056
+ | | | | '-----------> fast loading when ROM load routine is used
1057
+ | | | '-------------> border emulation
1058
+ | | '---------------> screen refresh mode (1 = ON, 0 = OFF)
1059
+ | '-----------------> start playing the tape immediately
1060
+ '-------------------> auto type LOAD"" or press ENTER when in 128K mode */
1061
+
1062
+ Z_DEFINE_STRICT_STRUCTURE (
1063
+ struct {Z_BIT_FIELD(8, 7) (
1064
+ zuint8 screen_refresh_mode :1,
1065
+ zuint8 screen_border :1,
1066
+ zuint8 fast_loading :1,
1067
+ zuint8 vsync :2,
1068
+ zuint8 hrc_with_true_frequency :1,
1069
+ zuint8 ldir_instruction :1,
1070
+ zuint8 r_register :1
1071
+ )} features;
1072
+
1073
+ struct {Z_BIT_FIELD(8, 3) (
1074
+ zuint8 unused :6,
1075
+ zuint8 type_load_or_press_enter_if_128k :1,
1076
+ zuint8 autoplay :1
1077
+ )} loading;
1078
+
1079
+ zuint8 screen_refresh_delay; /* 1 - 255 */
1080
+ zuint16 interrupt_hz; /* 0 - 999 */
1081
+ zuint8 reserved[3];
1082
+ ) ZTZXEmulationInformation;
1083
+
1084
+ #define Z_TZX_EMULATION_INFORMATION_VSYNC_HIGH 0
1085
+ #define Z_TZX_EMULATION_INFORMATION_VSYNC_LOW 1
1086
+ #define Z_TZX_EMULATION_INFORMATION_VSYNC_NORMAL 2
1087
+
1088
+ /* MARK: - ID 35h - Custom Information ("Added" in v1.01, deprecated in v1.20)
1089
+ .------------------------------------------------------------------------------.
1090
+ | This block can be used to save any information you want. For example, it |
1091
+ | might contain some information written by a utility, extra settings required |
1092
+ | by a particular emulator, or even poke data. |
1093
+ '-----------------------------------------------------------------------------*/
1094
+
1095
+ Z_DEFINE_STRICT_STRUCTURE (
1096
+ zuint8 content_id[16];
1097
+ zuint32 data_size;
1098
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
1099
+ ) ZTZXCustomInformation;
1100
+
1101
+ #define Z_TZX_CUSTOM_INFORMATION_CONTENT_ID_POKES \
1102
+ 'P','O','K','E','s',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '
1103
+
1104
+ #define Z_TZX_CUSTOM_INFORMATION_CONTENT_ID_INSTRUCTIONS \
1105
+ 'I','n','s','t','r','u','c','t','i','o','n','s',' ',' ',' ',' '
1106
+
1107
+ #define Z_TZX_CUSTOM_INFORMATION_CONTENT_ID_SCREEN \
1108
+ 'S','p','e','c','t','r','u','m',' ','S','c','r','e','e','n',' '
1109
+
1110
+ #define Z_TZX_CUSTOM_INFORMATION_CONTENT_ID_ZX_EDIT_DOCUMENT \
1111
+ 'Z','X','-','E','d','i','t',' ','d','o','c','u','m','e','n','t'
1112
+
1113
+ #define Z_TZX_CUSTOM_INFORMATION_CONTENT_ID_PICTURE \
1114
+ 'P','i','c','t','u','r','e',' ',' ',' ',' ',' ',' ',' ',' ',' '
1115
+
1116
+ Z_DEFINE_STRICT_STRUCTURE (
1117
+ zuint8 description_size;
1118
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 description[];)
1119
+ ) ZTZXPOKEs;
1120
+
1121
+ Z_DEFINE_STRICT_STRUCTURE (
1122
+ ) ZTZXTrainer;
1123
+
1124
+ Z_DEFINE_STRICT_STRUCTURE (
1125
+ ) ZTZXInstructions;
1126
+
1127
+ Z_DEFINE_STRICT_STRUCTURE (
1128
+ ) ZTZXScreen;
1129
+
1130
+ Z_DEFINE_STRICT_STRUCTURE (
1131
+ zuint8 description_size; /* if 0 then handle description as 'Instructions' */
1132
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 description[];)
1133
+ /* ZX-Editor document (.ZED file) data */
1134
+ ) ZTZXZXEditDocument;
1135
+
1136
+ Z_DEFINE_STRICT_STRUCTURE (
1137
+ zuint8 format;
1138
+ zuint8 description_size; /* if 0 then handle description as 'Inlay Card' */
1139
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 description[];)
1140
+ /* Picture data */
1141
+ ) ZTZXPicture;
1142
+
1143
+ #define Z_TZX_PICTURE_FORMAT_GIF 0x00
1144
+ #define Z_TZX_PICTURE_FORMAT_JPG 0x01
1145
+
1146
+ /* MARK: - ID 40h - Snapshot (Added in v1.10, deprecated in v1.20)
1147
+ .------------------------------------------------------------------------------.
1148
+ | This would enable one to snapshot the prgram at the start and still have all |
1149
+ | the tape blocks in the same file. Only .Z80 and .SNA snapshots are supported |
1150
+ | for compatibility reasons! |
1151
+ | The emulator should take care of that the snapshot is not taken while the |
1152
+ | actual tape loading is taking place (which doesn't do much sense). When an |
1153
+ | emulator encounters the snapshot block it should load it and then continue |
1154
+ | with the next block. |
1155
+ '-----------------------------------------------------------------------------*/
1156
+
1157
+ Z_DEFINE_STRICT_STRUCTURE (
1158
+ zuint8 format;
1159
+ zuint8 size[3];
1160
+ Z_FLEXIBLE_ARRAY_MEMBER(zuint8 data[];)
1161
+ ) ZTZXSnapshot;
1162
+
1163
+ #define Z_TZX_SNAPSHOT_FORMAT_Z80 0
1164
+ #define Z_TZX_SNAPSHOT_FORMAT_SNA 1
1165
+
1166
+ /* MARK: - ID 5Ah - "Glue"
1167
+ .------------------------------------------------------------------------------.
1168
+ | This block is generated when you merge two ZX Tape files together. It is |
1169
+ | here so that you can easily copy the files together and use them. Of course, |
1170
+ | this means that resulting file would be 10 bytes longer than if this block |
1171
+ | was not used. All you have to do if you encounter this block ID is to skip |
1172
+ | next 9 bytes. |
1173
+ | If you can avoid using this block for this purpose, then do so; it is |
1174
+ | preferable to use a utility to join the two files and ensure that they are |
1175
+ | both of the higher version number. |
1176
+ '-----------------------------------------------------------------------------*/
1177
+
1178
+ Z_DEFINE_STRICT_STRUCTURE (
1179
+ zuint8 signature[6]; /* 'XTape!' */
1180
+ zuint8 eof_marker; /* 1Ah */
1181
+ zuint8 major_version;
1182
+ zuint8 minor_version;
1183
+ ) ZTZXGlue;
1184
+
1185
+ #endif /* _Z_formats_storage_medium_image_audio_TZX_H_ */