badline 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -1
  3. data/CLAUDE.md +42 -12
  4. data/CONTRIBUTING.md +4 -3
  5. data/README.md +76 -13
  6. data/doc/media.md +2 -1
  7. data/doc/pinned-behaviour.md +174 -0
  8. data/doc/snapshot-format.md +1197 -0
  9. data/doc/snapshots.md +90 -40
  10. data/lib/badline/audio/bare_player.rb +46 -17
  11. data/lib/badline/audio/machine_player.rb +6 -10
  12. data/lib/badline/audio/renderer.rb +32 -21
  13. data/lib/badline/c128/banks.rb +7 -6
  14. data/lib/badline/c128/bus/keyed_state.rb +45 -0
  15. data/lib/badline/c128/bus.rb +36 -4
  16. data/lib/badline/c128/drives.rb +6 -25
  17. data/lib/badline/c128/keyed_modules.rb +117 -0
  18. data/lib/badline/c128/keyed_state.rb +91 -0
  19. data/lib/badline/c128/keys.rb +9 -0
  20. data/lib/badline/c128/mmu.rb +9 -8
  21. data/lib/badline/c128/mmu_pages.rb +27 -0
  22. data/lib/badline/c128/modes.rb +19 -9
  23. data/lib/badline/c128/z80_turns.rb +1 -1
  24. data/lib/badline/c128.rb +8 -8
  25. data/lib/badline/c64/attachments.rb +0 -44
  26. data/lib/badline/c64/banked_ram/plus256k.rb +18 -10
  27. data/lib/badline/c64/banked_ram/plus60k.rb +8 -6
  28. data/lib/badline/c64/banked_ram/unexpanded.rb +2 -2
  29. data/lib/badline/c64/bus/debug_register.rb +32 -0
  30. data/lib/badline/c64/bus/extra_sids.rb +80 -0
  31. data/lib/badline/c64/bus/keyed_state.rb +41 -0
  32. data/lib/badline/c64/bus.rb +3 -1
  33. data/lib/badline/c64/cartridge/action_replay.rb +6 -15
  34. data/lib/badline/c64/cartridge/comal80.rb +1 -0
  35. data/lib/badline/c64/cartridge/dinamic.rb +3 -1
  36. data/lib/badline/c64/cartridge/easy_flash.rb +0 -15
  37. data/lib/badline/c64/cartridge/epyx_fastload.rb +0 -8
  38. data/lib/badline/c64/cartridge/final_cartridge3.rb +1 -12
  39. data/lib/badline/c64/cartridge/flash.rb +3 -3
  40. data/lib/badline/c64/cartridge/fun_play.rb +2 -1
  41. data/lib/badline/c64/cartridge/g_mod2.rb +0 -12
  42. data/lib/badline/c64/cartridge/game_system.rb +2 -1
  43. data/lib/badline/c64/cartridge/geo_ram.rb +0 -16
  44. data/lib/badline/c64/cartridge/kcs_power.rb +0 -8
  45. data/lib/badline/c64/cartridge/keyed_state.rb +514 -0
  46. data/lib/badline/c64/cartridge/magic_desk.rb +2 -1
  47. data/lib/badline/c64/cartridge/ocean.rb +1 -0
  48. data/lib/badline/c64/cartridge/pagefox.rb +1 -10
  49. data/lib/badline/c64/cartridge/retro_replay.rb +0 -8
  50. data/lib/badline/c64/cartridge/rgcd.rb +2 -11
  51. data/lib/badline/c64/cartridge/super_games.rb +3 -12
  52. data/lib/badline/c64/cartridge/zaxxon.rb +1 -16
  53. data/lib/badline/c64/cartridge.rb +4 -30
  54. data/lib/badline/c64/kernal_traps.rb +28 -25
  55. data/lib/badline/c64/keyed_modules.rb +115 -0
  56. data/lib/badline/c64/keyed_state.rb +68 -0
  57. data/lib/badline/c64/reu/dma.rb +0 -4
  58. data/lib/badline/c64/reu/keyed_state.rb +140 -0
  59. data/lib/badline/c64/reu/ram.rb +0 -15
  60. data/lib/badline/c64/reu.rb +1 -3
  61. data/lib/badline/c64/true_drives.rb +56 -5
  62. data/lib/badline/c64.rb +7 -3
  63. data/lib/badline/chips/cia/interrupt_register.rb +0 -17
  64. data/lib/badline/chips/cia/keyed_parts.rb +213 -0
  65. data/lib/badline/chips/cia/serial.rb +0 -4
  66. data/lib/badline/chips/cia/time_of_day.rb +0 -22
  67. data/lib/badline/chips/cia/timer.rb +0 -20
  68. data/lib/badline/chips/cia.rb +2 -2
  69. data/lib/badline/chips/cpu/core.rb +18 -2
  70. data/lib/badline/chips/cpu/keyed_state.rb +177 -0
  71. data/lib/badline/chips/cpu/microcode.rb +16 -0
  72. data/lib/badline/chips/cpu/port.rb +20 -3
  73. data/lib/badline/chips/cpu.rb +5 -0
  74. data/lib/badline/chips/sid/decimator.rb +10 -8
  75. data/lib/badline/chips/sid/envelope.rb +1 -6
  76. data/lib/badline/chips/sid/filter.rb +0 -14
  77. data/lib/badline/chips/sid/keyed_parts.rb +286 -0
  78. data/lib/badline/chips/sid/voice.rb +0 -10
  79. data/lib/badline/chips/sid/waveform.rb +0 -2
  80. data/lib/badline/chips/sid.rb +1 -2
  81. data/lib/badline/chips/ted/beam.rb +118 -0
  82. data/lib/badline/chips/ted/fetches.rb +199 -0
  83. data/lib/badline/chips/ted/keyed_state.rb +156 -0
  84. data/lib/badline/chips/ted/modes.rb +134 -0
  85. data/lib/badline/chips/ted/palette.rb +43 -0
  86. data/lib/badline/chips/ted/picture.rb +182 -0
  87. data/lib/badline/chips/ted/sound/output.rb +86 -0
  88. data/lib/badline/chips/ted/sound.rb +284 -0
  89. data/lib/badline/chips/ted/timers.rb +66 -0
  90. data/lib/badline/chips/ted.rb +190 -0
  91. data/lib/badline/chips/tia.rb +61 -0
  92. data/lib/badline/chips/vdc/keyed_parts.rb +105 -0
  93. data/lib/badline/chips/vdc/painter.rb +0 -12
  94. data/lib/badline/chips/vdc/raster.rb +0 -16
  95. data/lib/badline/chips/vdc/window.rb +0 -9
  96. data/lib/badline/chips/vdc.rb +1 -2
  97. data/lib/badline/chips/via/control_lines.rb +0 -15
  98. data/lib/badline/chips/via/interrupt_register.rb +0 -9
  99. data/lib/badline/chips/via/keyed_parts.rb +163 -0
  100. data/lib/badline/chips/via/shift_register.rb +0 -14
  101. data/lib/badline/chips/via/timer1.rb +0 -13
  102. data/lib/badline/chips/via/timer2.rb +0 -18
  103. data/lib/badline/chips/via.rb +1 -2
  104. data/lib/badline/chips/vic/border_mask.rb +0 -10
  105. data/lib/badline/chips/vic/collisions.rb +0 -11
  106. data/lib/badline/chips/vic/color_patches.rb +0 -11
  107. data/lib/badline/chips/vic/display_state.rb +0 -19
  108. data/lib/badline/chips/vic/graphics_shifter.rb +0 -4
  109. data/lib/badline/chips/vic/keyed_parts.rb +228 -0
  110. data/lib/badline/chips/vic/keyed_sprites.rb +225 -0
  111. data/lib/badline/chips/vic/keyed_state.rb +102 -0
  112. data/lib/badline/chips/vic/register_log.rb +0 -18
  113. data/lib/badline/chips/vic/registers.rb +0 -9
  114. data/lib/badline/chips/vic/sequencer.rb +0 -2
  115. data/lib/badline/chips/vic/sprite/internal_bus.rb +0 -11
  116. data/lib/badline/chips/vic/sprite.rb +0 -2
  117. data/lib/badline/chips/vic/sprites.rb +0 -3
  118. data/lib/badline/chips/vic.rb +6 -2
  119. data/lib/badline/chips/vic_i/keyed_parts.rb +142 -0
  120. data/lib/badline/chips/vic_i/painter.rb +0 -4
  121. data/lib/badline/chips/vic_i/sound.rb +38 -46
  122. data/lib/badline/chips/vic_i.rb +2 -2
  123. data/lib/badline/chips/z80/core.rb +2 -2
  124. data/lib/badline/chips/z80/keyed_state.rb +73 -0
  125. data/lib/badline/chips.rb +10 -0
  126. data/lib/badline/core.rb +4 -21
  127. data/lib/badline/drives/datasette/keyed_state.rb +43 -0
  128. data/lib/badline/drives/datasette.rb +62 -12
  129. data/lib/badline/drives/engine/core.rb +3 -0
  130. data/lib/badline/drives/engine/serial_lines.rb +4 -7
  131. data/lib/badline/drives/model1541/bus.rb +0 -13
  132. data/lib/badline/drives/model1541/disk.rb +9 -8
  133. data/lib/badline/drives/model1541/keyed_state.rb +251 -0
  134. data/lib/badline/drives/model1541/mechanism.rb +0 -2
  135. data/lib/badline/drives/model1541.rb +1 -2
  136. data/lib/badline/drives/model1571/bus.rb +0 -13
  137. data/lib/badline/drives/model1571/keyed_state.rb +108 -0
  138. data/lib/badline/drives/model1571/wd1770.rb +0 -14
  139. data/lib/badline/drives/model1571.rb +1 -2
  140. data/lib/badline/drives/model1581/bus.rb +0 -13
  141. data/lib/badline/drives/model1581/disk.rb +0 -4
  142. data/lib/badline/drives/model1581/keyed_state.rb +280 -0
  143. data/lib/badline/drives/model1581/mechanism.rb +0 -21
  144. data/lib/badline/drives/model1581/slot.rb +0 -18
  145. data/lib/badline/drives/model1581/wd1772.rb +0 -2
  146. data/lib/badline/drives/model1581.rb +2 -2
  147. data/lib/badline/drives.rb +8 -0
  148. data/lib/badline/frontend/app.rb +3 -3
  149. data/lib/badline/frontend/boot.rb +4 -2
  150. data/lib/badline/frontend/controls.rb +25 -5
  151. data/lib/badline/frontend/drive_led.rb +44 -21
  152. data/lib/badline/frontend/keys.rb +14 -2
  153. data/lib/badline/frontend/media_slots.rb +11 -1
  154. data/lib/badline/frontend/menu/menu_dialogs.rb +4 -3
  155. data/lib/badline/frontend/menu/menu_media.rb +13 -3
  156. data/lib/badline/frontend/menu/menu_pages.rb +8 -8
  157. data/lib/badline/frontend/menu/menu_ports.rb +13 -1
  158. data/lib/badline/frontend/screen.rb +33 -12
  159. data/lib/badline/frontend/screens.rb +2 -1
  160. data/lib/badline/frontend/snapshots.rb +12 -1
  161. data/lib/badline/frontend/sound.rb +4 -4
  162. data/lib/badline/frontend/timeline.rb +43 -12
  163. data/lib/badline/input/matrix_typist.rb +98 -0
  164. data/lib/badline/input.rb +1 -0
  165. data/lib/badline/kernal_trap/chrout.rb +45 -0
  166. data/lib/badline/kernal_trap/dos/channel.rb +0 -27
  167. data/lib/badline/kernal_trap/dos/channels.rb +0 -25
  168. data/lib/badline/kernal_trap/dos/memory.rb +0 -9
  169. data/lib/badline/kernal_trap/dos/status.rb +0 -8
  170. data/lib/badline/kernal_trap/dos/write_file.rb +0 -18
  171. data/lib/badline/kernal_trap/dos.rb +0 -19
  172. data/lib/badline/kernal_trap/file_routine.rb +4 -4
  173. data/lib/badline/kernal_trap/keyed_state.rb +150 -0
  174. data/lib/badline/kernal_trap/layout.rb +75 -11
  175. data/lib/badline/kernal_trap/load.rb +14 -16
  176. data/lib/badline/kernal_trap/routine.rb +12 -0
  177. data/lib/badline/kernal_trap/save.rb +8 -18
  178. data/lib/badline/kernal_trap/serial.rb +1 -17
  179. data/lib/badline/kernal_trap.rb +2 -0
  180. data/lib/badline/machine/keyboard_buffer.rb +49 -0
  181. data/lib/badline/machine/settling.rb +29 -0
  182. data/lib/badline/machine.rb +29 -6
  183. data/lib/badline/media/boot_disk.rb +14 -2
  184. data/lib/badline/media/extensions.rb +10 -0
  185. data/lib/badline/media/plus4_media.rb +68 -0
  186. data/lib/badline/media/program.rb +20 -6
  187. data/lib/badline/media.rb +33 -12
  188. data/lib/badline/memory.rb +3 -6
  189. data/lib/badline/options/family.rb +6 -2
  190. data/lib/badline/options/help.rb +66 -16
  191. data/lib/badline/options/table.rb +17 -2
  192. data/lib/badline/options/validation.rb +26 -2
  193. data/lib/badline/options.rb +42 -9
  194. data/lib/badline/plus4/acia.rb +45 -0
  195. data/lib/badline/plus4/bus.rb +375 -0
  196. data/lib/badline/plus4/cassette_sense.rb +21 -0
  197. data/lib/badline/plus4/cpu.rb +10 -0
  198. data/lib/badline/plus4/cpu_port.rb +93 -0
  199. data/lib/badline/plus4/keyboard_port.rb +76 -0
  200. data/lib/badline/plus4/keyed_modules.rb +99 -0
  201. data/lib/badline/plus4/keyed_parts.rb +143 -0
  202. data/lib/badline/plus4/keyed_state.rb +41 -0
  203. data/lib/badline/plus4/model.rb +38 -0
  204. data/lib/badline/plus4/user_port.rb +31 -0
  205. data/lib/badline/plus4.rb +240 -0
  206. data/lib/badline/roms/README +38 -0
  207. data/lib/badline/roms/plus4/basic.rom +0 -0
  208. data/lib/badline/roms/plus4/function-high.rom +0 -0
  209. data/lib/badline/roms/plus4/function-low.rom +0 -0
  210. data/lib/badline/roms/plus4/kernal-ntsc.rom +0 -0
  211. data/lib/badline/roms/plus4/kernal-pal.rom +0 -0
  212. data/lib/badline/snapshot/c128_setup.rb +9 -20
  213. data/lib/badline/snapshot/c64_setup.rb +28 -24
  214. data/lib/badline/snapshot/container.rb +6 -0
  215. data/lib/badline/snapshot/field_doc/markdown.rb +113 -0
  216. data/lib/badline/snapshot/field_doc.rb +148 -0
  217. data/lib/badline/snapshot/image.rb +143 -28
  218. data/lib/badline/snapshot/keyed/cursor.rb +40 -0
  219. data/lib/badline/snapshot/keyed/modules.rb +66 -0
  220. data/lib/badline/snapshot/keyed/reader.rb +188 -0
  221. data/lib/badline/snapshot/keyed/recorder.rb +88 -0
  222. data/lib/badline/snapshot/keyed/report.rb +26 -0
  223. data/lib/badline/snapshot/keyed/writer.rb +55 -0
  224. data/lib/badline/snapshot/keyed.rb +64 -0
  225. data/lib/badline/snapshot/machine_state.rb +17 -64
  226. data/lib/badline/snapshot/plus4_setup.rb +39 -0
  227. data/lib/badline/snapshot/storage_setup.rb +29 -34
  228. data/lib/badline/snapshot/vic20_setup.rb +6 -15
  229. data/lib/badline/snapshot/vice/reu1764.rb +2 -2
  230. data/lib/badline/snapshot/vice.rb +7 -31
  231. data/lib/badline/snapshot.rb +48 -20
  232. data/lib/badline/storage/crt_file.rb +3 -1
  233. data/lib/badline/storage/g64_image.rb +9 -4
  234. data/lib/badline/storage/tap.rb +57 -20
  235. data/lib/badline/support/checkpoint.rb +3 -2
  236. data/lib/badline/support/plus4_checkpoint.rb +42 -0
  237. data/lib/badline/version.rb +1 -1
  238. data/lib/badline/vic20/attachments.rb +3 -0
  239. data/lib/badline/vic20/bus/keyed_state.rb +52 -0
  240. data/lib/badline/vic20/bus.rb +1 -2
  241. data/lib/badline/vic20/keyed_modules.rb +73 -0
  242. data/lib/badline/vic20/keyed_state.rb +45 -0
  243. data/lib/badline/vic20.rb +5 -5
  244. data/lib/badline.rb +1 -0
  245. metadata +75 -42
  246. data/lib/badline/c128/bus/saved_state.rb +0 -53
  247. data/lib/badline/c128/saved_state.rb +0 -117
  248. data/lib/badline/c64/bus/saved_state.rb +0 -68
  249. data/lib/badline/c64/cartridge/flash/saved_state.rb +0 -40
  250. data/lib/badline/c64/cartridge/retro_replay/saved_state.rb +0 -47
  251. data/lib/badline/c64/cartridge/saved_state.rb +0 -63
  252. data/lib/badline/c64/reu/dma/saved_state.rb +0 -52
  253. data/lib/badline/c64/reu/saved_state.rb +0 -55
  254. data/lib/badline/c64/saved_state.rb +0 -112
  255. data/lib/badline/chips/cia/saved_state.rb +0 -49
  256. data/lib/badline/chips/cia/serial/saved_state.rb +0 -45
  257. data/lib/badline/chips/cpu/saved_state.rb +0 -117
  258. data/lib/badline/chips/sid/envelope/saved_state.rb +0 -70
  259. data/lib/badline/chips/sid/filter/saved_state.rb +0 -42
  260. data/lib/badline/chips/sid/saved_state.rb +0 -52
  261. data/lib/badline/chips/sid/waveform/saved_state.rb +0 -68
  262. data/lib/badline/chips/vdc/saved_state.rb +0 -36
  263. data/lib/badline/chips/via/saved_state.rb +0 -44
  264. data/lib/badline/chips/vic/graphics_shifter/saved_state.rb +0 -40
  265. data/lib/badline/chips/vic/saved_state.rb +0 -82
  266. data/lib/badline/chips/vic/sequencer/saved_state.rb +0 -91
  267. data/lib/badline/chips/vic/sprite/saved_state.rb +0 -66
  268. data/lib/badline/chips/vic/sprites/saved_state.rb +0 -59
  269. data/lib/badline/chips/vic_i/painter/saved_state.rb +0 -40
  270. data/lib/badline/chips/vic_i/saved_state.rb +0 -55
  271. data/lib/badline/chips/z80/saved_state.rb +0 -71
  272. data/lib/badline/chrout_trap.rb +0 -43
  273. data/lib/badline/debug_register.rb +0 -28
  274. data/lib/badline/drives/datasette/saved_state.rb +0 -37
  275. data/lib/badline/drives/model1541/disk/saved_state.rb +0 -88
  276. data/lib/badline/drives/model1541/mechanism/saved_state.rb +0 -72
  277. data/lib/badline/drives/model1541/saved_state.rb +0 -44
  278. data/lib/badline/drives/model1571/saved_state.rb +0 -47
  279. data/lib/badline/drives/model1581/disk/saved_state.rb +0 -89
  280. data/lib/badline/drives/model1581/saved_state.rb +0 -42
  281. data/lib/badline/drives/model1581/wd1772/saved_state.rb +0 -68
  282. data/lib/badline/keyboard_buffer.rb +0 -33
  283. data/lib/badline/snapshot/setup.rb +0 -31
  284. data/lib/badline/snapshot/state.rb +0 -179
  285. data/lib/badline/vic20/bus/saved_state.rb +0 -35
  286. data/lib/badline/vic20/saved_state.rb +0 -110
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a074ca0626351bec4132e06bc5e4ab951f7a4b18cf9e78ddc3c16adfd4194b8
4
- data.tar.gz: 878629423f450e6c6440649b00d87646c1ff59d5ccb99801d5909fedc14f9108
3
+ metadata.gz: dcc4aea1603a5dac88787b701529e7019573fa5bd3b66cdd31a6d4f071fb3ecf
4
+ data.tar.gz: bc8de62e989822edd15ff2d59002a034c361c176e50a0e064a3482ff820b150a
5
5
  SHA512:
6
- metadata.gz: 8eb5553980d187ccafd1ac4906b8a3d7fb6a80a8219375ef872f208411c362bf3724e721946ed166b91595177ce3adf38632e2b69008d9a4082032239cfcb697
7
- data.tar.gz: dcb3a6ab34cceff4e85b56d09c2e38eaeab8350f57928c07e23ba7c6f5de38b32a88a0735802a2d196bb2ccf89a6a058579a47daf85ca8ac275f5b6bce90a975
6
+ metadata.gz: 88c53ecfb3d2322c4f2ed6cc99c58e3e5cdb9b135b9afaae85a183f95d23d1546c0c7d245547dfe968574849689508e0669dda8648c3a0cb123251672895d442
7
+ data.tar.gz: 2d2d289ef46a002ff548fb7a219805a8c6fcbd555f469f4f8bb8eb87bc6895df48e83d8694ec262251d87997a2f2d325120f608f491df76ef9c47f83be1cc0e2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.15.0](https://github.com/elektronaut/badline/compare/v0.14.0...v0.15.0) (2026-10-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * run the Plus/4 and the C16 in the window with badline plus4 ([935bcf1](https://github.com/elektronaut/badline/commit/935bcf11b986c65f01024515d7c98ac1efa46530))
9
+ * paint the TED's picture ([ede7805](https://github.com/elektronaut/badline/commit/ede7805b8113cb6321fbfdffedcb6b7a79e95983))
10
+ * play the TED's sound ([a34efd6](https://github.com/elektronaut/badline/commit/a34efd67dbec995f246781452bce7c9c070ed10b))
11
+ * read the Plus/4's joysticks through the keyboard latch and map its keys ([6a1f7cb](https://github.com/elektronaut/badline/commit/6a1f7cb5a9a9426562fe5b3c9106a245bc23d287))
12
+ * attach programs, disks and cartridges to a Plus/4 ([84a86f4](https://github.com/elektronaut/badline/commit/84a86f43e97e08fdb4ea21ef909adf54bc09540c))
13
+ * put a true 1541 or 1581 on the Plus/4's serial bus ([bd068ff](https://github.com/elektronaut/badline/commit/bd068ffd1b337915ad70ed9e96f10df6ca770c05))
14
+ * put Plus/4 cartridges in both slots, from .crt or raw .bin ([42ae7c0](https://github.com/elektronaut/badline/commit/42ae7c0f66dd200bc1787ad3a9bd62c4f57719eb))
15
+ * play and record Plus/4 and C16 tapes ([cd19fa9](https://github.com/elektronaut/badline/commit/cd19fa920a4e2b8a488011872ca98f6bd95cb43a))
16
+ * show the Plus/4's picture, play its sound and drive its joysticks in the front end ([4213c26](https://github.com/elektronaut/badline/commit/4213c26ffeaafe46bc6ec42433e2dc763b70aa6a))
17
+ * keyed snapshots for the Plus/4 and the C16 ([c7a1ace](https://github.com/elektronaut/badline/commit/c7a1ace2c3c94064bb14841773e109c56e49f1d6))
18
+ * save the Plus/4 from F11 and the Snapshots page ([853085f](https://github.com/elektronaut/badline/commit/853085f0c177fcbf305c1fd60cd1a800dfcbc266))
19
+ * save cartridge mappers' registers in snapshots ([9ea6e0b](https://github.com/elektronaut/badline/commit/9ea6e0b2669c4ae9ed8270cf3de345787c76dcb3))
20
+ * save the extra SIDs in snapshots ([bf7f142](https://github.com/elektronaut/badline/commit/bf7f1426472620b6168352ba3bf74e4780d29e89))
21
+
22
+ ### Bug Fixes
23
+
24
+ * store a C128 bank LOAD into the I/O that bank maps ([58672c2](https://github.com/elektronaut/badline/commit/58672c2bb7b9a5fed8d75d72007d00444eebb696))
25
+
26
+ ## [0.14.0](https://github.com/elektronaut/badline/compare/v0.13.0...v0.14.0) (2026-10-11)
27
+
28
+
29
+ ### Features
30
+
31
+ * add the keyed snapshot record encoding ([1b87aed](https://github.com/elektronaut/badline/commit/1b87aeddea27f81cb1ccedbbef2bba58c2db0bb3))
32
+ * boot the Plus/4 and the C16 to READY headless ([278020e](https://github.com/elektronaut/badline/commit/278020ee0256fa1d085391fd0e7a6679ac80dbcb))
33
+ * bundle the 264 series ROMs and refuse badline plus4 until it runs ([7072ae7](https://github.com/elektronaut/badline/commit/7072ae7cb6e1ccd96a4e02eb1146b7b1bfaf7125))
34
+ * give each machine its keyboard buffer layout ([0b64648](https://github.com/elektronaut/badline/commit/0b64648fec3cd56bbbee1ac4dc8fe446c84dd4b9))
35
+ * keep the KERNAL's file variables in KernalTrap::Layout ([0ca7488](https://github.com/elektronaut/badline/commit/0ca7488505b2b7af9f358bdf6d3e86a1e1c768e3))
36
+ * keyed snapshot fields for device 8 through the KERNAL traps ([cce36f2](https://github.com/elektronaut/badline/commit/cce36f2f740c5337cd2b0a66fe99394114409c32))
37
+ * keyed snapshot fields for each machine's own state and setup ([ff251a6](https://github.com/elektronaut/badline/commit/ff251a62cbad4502f576628a4f4c5d3d6a22eaf8))
38
+ * keyed snapshot fields for the 1541 ([f3f57b7](https://github.com/elektronaut/badline/commit/f3f57b7e24471e198304bfd90ba16c4abb7c4c16))
39
+ * keyed snapshot fields for the 1571 ([5ceb741](https://github.com/elektronaut/badline/commit/5ceb7416a1902252d97c80aff22658a68e4abfb6))
40
+ * keyed snapshot fields for the 1581 ([1c67e29](https://github.com/elektronaut/badline/commit/1c67e298c24e82e92cc5feddcc0153143d4eda8d))
41
+ * keyed snapshot fields for the 6502 cores and the Z80 ([8ee592e](https://github.com/elektronaut/badline/commit/8ee592e5ee5b658c8f452cf4bdf9df044f8c19ab))
42
+ * keyed snapshot fields for the C128's MMU ([aa861ca](https://github.com/elektronaut/badline/commit/aa861cac0a33d79f777b60310f0cb573024f2d60))
43
+ * keyed snapshot fields for the cartridges ([349ae81](https://github.com/elektronaut/badline/commit/349ae81c7c002f5c1b94fa50cc994a6b7ec16915))
44
+ * keyed snapshot fields for the CIA ([b5a6ff8](https://github.com/elektronaut/badline/commit/b5a6ff8b02026daa3ec6247ab4024d35efedb18e))
45
+ * keyed snapshot fields for the datasette and its tape ([37a52f1](https://github.com/elektronaut/badline/commit/37a52f1018ab226a60395e1c98c6a362c0159f01))
46
+ * keyed snapshot fields for the memories, RAM expansions and buses ([14b1a95](https://github.com/elektronaut/badline/commit/14b1a951a44c2bc23871208b9843489d4ca6963c))
47
+ * keyed snapshot fields for the REU ([8088ac5](https://github.com/elektronaut/badline/commit/8088ac52c68667db7d6acdc6e0f0b629e165b0b3))
48
+ * keyed snapshot fields for the SID ([b58f88d](https://github.com/elektronaut/badline/commit/b58f88d1a98346aba4dbec0dead306b3d36b32f7))
49
+ * keyed snapshot fields for the VDC ([b894c3e](https://github.com/elektronaut/badline/commit/b894c3ef0b83988d17f03027b1831e7be3739be3))
50
+ * keyed snapshot fields for the VIA ([52ab12c](https://github.com/elektronaut/badline/commit/52ab12cb129adedc8a3f0b7df469a1440eb72309))
51
+ * keyed snapshot fields for the VIC-I and its sound ([a47d3e8](https://github.com/elektronaut/badline/commit/a47d3e823891e5d597141423f1675962ac266df7))
52
+ * keyed snapshot fields for the VIC-II ([8fc8b4c](https://github.com/elektronaut/badline/commit/8fc8b4c39f8ae5cac781f51f0bbeab5134c3bc9f))
53
+ * latch the VIC's sprite collisions when a snapshot settles ([a1c9429](https://github.com/elektronaut/badline/commit/a1c9429fefdbbc57407fb68baf057209d7163db1))
54
+ * let a unit report its own adjustments when its snapshot loads ([3b3af19](https://github.com/elektronaut/badline/commit/3b3af19ef0d74b0a45fbea96feef107f26db12a6))
55
+ * read Plus/4 CRT images ([450148d](https://github.com/elektronaut/badline/commit/450148db02c8057cc071f6d867707aa45a87c996))
56
+ * read version 2 C16 tapes and time the datasette's read level ([7e78070](https://github.com/elektronaut/badline/commit/7e78070877394a4657e23699a3098f297469be05))
57
+ * report a VIC-II line restarted from another renderer's snapshot ([6cb0607](https://github.com/elektronaut/badline/commit/6cb06075d410e59a8cd6f7d82d29757819e23e67))
58
+ * run the 264 testbench's exitcode rows as testbench-plus4 and testbench-c16 ([862f14b](https://github.com/elektronaut/badline/commit/862f14bd474bdac92017f25a57a057cf1f42a63f))
59
+ * run the Lorenz suite's plus4 build as lorenz-plus4 ([006efdd](https://github.com/elektronaut/badline/commit/006efddeb3a052714b99ff9b11ec18dd85cb6778))
60
+ * save and load snapshots as BL-* modules ([25db1be](https://github.com/elektronaut/badline/commit/25db1be28817d292c314672c5401251d36d11902))
61
+ * save snapshots at the next instruction boundary ([3f9ae3c](https://github.com/elektronaut/badline/commit/3f9ae3cf5392c194a1915801c9da4739832649e3))
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * boot C128 boot sectors on .g64 and .g71 images ([81ad184](https://github.com/elektronaut/badline/commit/81ad1842fdc66b5ddb5d2988eb699409741f376a))
67
+ * draw the true drive's power LED, and the LEDs of a drive plugged in after start ([982c522](https://github.com/elektronaut/badline/commit/982c522c56c46d193ca5d15f49c59f221f04ad8e))
68
+ * drive the datasette's write line from the CPU port's bit 3 ([b90c29d](https://github.com/elektronaut/badline/commit/b90c29dd758eb7867930c5f26dbd0ae510f430af))
69
+ * let a held key go as the key it pressed across a C128 mode switch ([3a8d731](https://github.com/elektronaut/badline/commit/3a8d7313034f0b69057528b58ff247250b7e7168))
70
+ * read the ROMs and I/O a C128 KERNAL bank maps when saving ([3e4db21](https://github.com/elektronaut/badline/commit/3e4db218959237fada950e4b65238203af10e3c6))
71
+ * run the VIC-20's sound voices whether or not the host plays them ([13052c7](https://github.com/elektronaut/badline/commit/13052c7bbb9ca2b4ed678935ec6b88cc84bb2806))
72
+ * take the C128's own keys in --at key= ([428047c](https://github.com/elektronaut/badline/commit/428047cc4eca55b70967048d49579840b90ea946))
73
+ * type --at type= text on the C128's key matrix while the Z80 runs ([39d77ff](https://github.com/elektronaut/badline/commit/39d77ff29989a46c82184cd2dde03e8d470c553b))
74
+
3
75
  ## [0.13.0](https://github.com/elektronaut/badline/compare/v0.12.1...v0.13.0) (2026-10-11)
4
76
 
5
77
 
@@ -81,7 +153,6 @@
81
153
  * bundle the PET 64's KERNAL, 901246-01 ([9a029ec](https://github.com/elektronaut/badline/commit/9a029ecfe25c0d9a806d8858253c4c172e175b7f))
82
154
 
83
155
 
84
- ### Miscellaneous Chores
85
156
 
86
157
  * release 0.10.1 ([9d6f6ba](https://github.com/elektronaut/badline/commit/9d6f6ba71a647f24f00a830fbc772531fbcb4d92))
87
158
 
data/CLAUDE.md CHANGED
@@ -69,10 +69,10 @@ file: `core.rb` requires their members one by one.
69
69
  | rspec (`spec/`) | `bundle exec rspec` | Unit behaviour, all of `lib/` |
70
70
  | SingleStepTests 65x02 | `rake test` (100 sampled cases per opcode) | CPU, per-cycle bus traces |
71
71
  | SingleStepTests z80 | `rake test` (the first 100 cases per opcode, `Z80_SAMPLE=all` for all 1,604,000) | `Z80`: registers, flags, ports and the bus pins on every T-state |
72
- | Wolfgang Lorenz suite | `bin/lorenz` | CPU, CIA, interrupts |
73
- | VICE testbench | `bin/testbench <subtree>` | `VICII/`, `CIA/`, `interrupts/`, `CPU/`, cartridges with `--carts`, the true 1541 drive with `--drive`, the VIC-20 with `--vic20`, the C128 in C64 mode with `--c128c64`, in C128 mode with `--c128`, and its Z80 with `--c128-z80` |
72
+ | Wolfgang Lorenz suite | `bin/lorenz` | CPU, CIA, interrupts; its plus4 build with `--plus4`: the CPU on the 264's bus, the TED's clock, DMA, timers and interrupt |
73
+ | VICE testbench | `bin/testbench <subtree>` | `VICII/`, `CIA/`, `interrupts/`, `CPU/`, cartridges with `--carts`, the true 1541 drive with `--drive`, the VIC-20 with `--vic20`, the C128 in C64 mode with `--c128c64`, in C128 mode with `--c128`, and its Z80 with `--c128-z80`, the Plus/4 with `--plus4` and the C16 with `--c16` |
74
74
  | VICE SID testprogs | `bin/sidtests` | SID |
75
- | Drive scenarios | `bin/drive_scenarios` | The true 1541 running the DOS ROM: save, format, the error channel, idle, write protect and autostart |
75
+ | Drive scenarios | `bin/drive_scenarios` | The true 1541 running the DOS ROM: save, format, the error channel, idle, write protect and autostart; the `plus4-*` rows on the Plus/4 and C16, with the 1541 and 1581 on their serial bus and a tape saved and loaded back on the datasette |
76
76
  | CIA offline grids | `bundle exec rspec --tag slow spec/badline/chips/cia` | CIA timers and shift register, against a bare CIA in about 2 min |
77
77
 
78
78
  The CIA offline grids replay Lorenz's `cia1ta` and `cia1tb` sweeps (about
@@ -92,6 +92,13 @@ Z80), and names the first component that differs. It builds a C64 unless
92
92
  `--family vic20` or `--family c128` (with `--mode c64|c128`) says
93
93
  otherwise. Use it for refactors and speed work.
94
94
 
95
+ `bin/snapshot_check` checks snapshots. For each scenario (`--list`) it saves
96
+ twice, then saves, loads and saves again, and expects the same bytes each
97
+ time. It then runs the saved and the loaded machine side by side and names
98
+ the first difference. `--carts` does the same for every cartridge mapper,
99
+ and `--diff A B` compares two snapshot files module by module. Run it on any
100
+ change to a unit's saved state.
101
+
95
102
  ## Driving the emulator headlessly
96
103
 
97
104
  `exe/badline-ruby <media>` opens the SDL window, which is no use for checking
@@ -153,7 +160,7 @@ worktree and owns a different set of files.
153
160
 
154
161
  - `rake vendor:checkout` fetches SingleStepTests 65x02, the Z80 sample
155
162
  and VICE-testprogs into `vendor/`
156
- - `bundle exec rspec`: line coverage is about 97%. `spec/spec_helper.rb`
163
+ - `bundle exec rspec`: line coverage is about 95%. `spec/spec_helper.rb`
157
164
  fails a whole-suite run (every spec file, no filters) below 90%, while
158
165
  single-file and filtered runs skip the floor. `:slow` specs are excluded
159
166
  by default: run them with `bundle exec rspec --tag slow`
@@ -183,7 +190,7 @@ overrides that, capped by the core count, but keep the default, because
183
190
  other worktrees share the machine. Whole runs at 4 shards on an M-series
184
191
  laptop take 15 min for `testbench` (`VICII/`), 11 for `testbench-cia`, 1 for
185
192
  `testbench-interrupts`, 37 for `testbench-irqdma`, 11 for
186
- `testbench-cpu`, 2 for `testbench-carts`, about 25 for `testbench-expansions`, under 1 for `testbench-vic20` and about 30 for `testbench-c128c64`. `sid` takes about 12 min. `lorenz` chains itself and takes
193
+ `testbench-cpu`, 2 for `testbench-carts`, about 25 for `testbench-expansions`, under 1 for `testbench-vic20`, `testbench-plus4`, `testbench-c16` and `testbench-plus4-ntsc`, and about 30 for `testbench-c128c64`. `lorenz-plus4` takes about 21 min whole on the Spinel build. `rake regression:lorenz-plus4-1` to `lorenz-plus4-4` run it as four stretches, cut where `lorenz` is, and the last, through the trap tests the chain resumes past, is about half of it. `sid` takes about 12 min. `lorenz` chains itself and takes
187
194
  about 2.5 h on CI whole. `rake regression:lorenz-1` to `lorenz-4` run it as
188
195
  four stretches of about 40 min each, and they can run side by side.
189
196
  `test/baselines/README.md` has the full table. A killed `bin/testbench` run
@@ -200,12 +207,25 @@ the rows your change can't reach tell you nothing about it.
200
207
  `ruby --yjit bin/lorenz [image] [start_test] [max_cycles]` (resumes the
201
208
  chain at a named test, and `--stop-after NAME` ends it once that test is
202
209
  done). These take seconds to minutes
203
- - A pull request's CI is the verdict. It runs every suite on the Spinel
204
- build, compared row by row against
205
- `test/baselines/`, and every job is a required check. A row that moved
206
- fails it. A pull request that changes only docs, or only a release's
207
- version bump, skips the specs and suites; pushes to main always run
208
- them. Re-record only those rows, in the same change:
210
+ - A pull request's CI is the verdict, and a pull request merges on it
211
+ alone. It runs the specs, Rubocop, Minitest, the harness builds, the
212
+ Spinel checks, the native round trip, and the suites its changed files
213
+ can reach, on the Spinel build, compared row by row against
214
+ `test/baselines/`. `test/support/ci_reach.rb` maps paths to suites, and
215
+ a path it doesn't name runs every suite. A row that moved fails it. A
216
+ pull request that changes only docs, or only a release's version bump,
217
+ skips the specs and suites. A row that moves in a pull request's CI is
218
+ re-recorded in that pull request with its reason; nobody waits for
219
+ `suites.yml` to confirm it. A change that reaches a suite the map
220
+ doesn't name adds the path to `test/support/ci_reach.rb` in the same
221
+ pull request, and a change that adds a directory under `lib/badline/`
222
+ gives it a rule
223
+ - The full suites run on main every two hours (`.github/workflows/suites.yml`).
224
+ Nobody waits for it, polls it or dispatches it to check a pull request.
225
+ Its result is a `suites` commit status and, when red, one `suites-red`
226
+ issue the planner owns. A red main never blocks a merge. A release
227
+ publishes only once its tagged commit is green
228
+ - Re-record only the rows that moved, in the same change:
209
229
  `rake "regression:record:<suite>[filter,...]"` (quote it, because zsh
210
230
  globs the brackets). It runs only the matching tests on CRuby and
211
231
  splices their rows into the baseline, and every other row keeps its
@@ -235,7 +255,17 @@ the 6526A) for anything the interrupt register or the CIA model reaches; cartrid
235
255
  `testbench-carts`, plus `testbench-expansions` for banking; GEO-RAM, +60K,
236
256
  +256K, the REU or the VIC's BA line the REU follows → `testbench-expansions`; the 1541 drive, VIA or IEC bus →
237
257
  `testbench-drive` (`bin/testbench --drive`) and `drive-scenarios` (`bin/drive_scenarios <filter>`), plus `testbench-vic20` for the VIA; the VIC-20 (`vic20/`) →
238
- `testbench-vic20` (`bin/testbench --vic20`); the C128 (`c128.rb`, `c128/`), or
258
+ `testbench-vic20` (`bin/testbench --vic20`); the 264 series (`plus4.rb`,
259
+ `plus4/`), the TED (`chips/ted.rb`, `chips/ted/`) or the TIA (`chips/tia.rb`)
260
+ → `testbench-plus4` (`bin/testbench --plus4`) and `testbench-c16`
261
+ (`bin/testbench --c16`), plus `testbench-plus4-ntsc`
262
+ (`bin/testbench --plus4 --ntsc`) for anything NTSC timing or the picture
263
+ reaches, `lorenz-plus4` (`bin/lorenz --plus4`) for
264
+ anything the CPU's clock, the TED's DMA, its timers or its interrupt reach,
265
+ and the `plus4-*` drive scenarios (`bin/drive_scenarios plus4`) for its
266
+ serial bus, its media, the CPU port or the datasette.
267
+ Its tests run one at a time as the C64's do, with
268
+ `ruby --yjit bin/lorenz --plus4 --resume <test> --stop-after <test>`; the C128 (`c128.rb`, `c128/`), or
239
269
  the VIC-IIe, CPU or PLA code it shares with the C64 → `testbench-c128c64`
240
270
  (`bin/testbench --c128c64`); the C128's Z80, MMU or hand-over → `testbench-c128-z80` (`bin/testbench --c128-z80`) and `testbench-c128`; SID → `sid`, plus `sid-8580` for anything the 8580
241
271
  model reaches (`bin/sidtests --sid 8580`). Leave the Lorenz chain to CI,
data/CONTRIBUTING.md CHANGED
@@ -91,9 +91,10 @@ bundle exec rubocop
91
91
  ## Tests and commits
92
92
 
93
93
  - Add tests for any behavior you change.
94
- - CI runs rubocop, the specs and every regression suite on each pull
95
- request, and fails on any suite row that differs from its baseline in
96
- `test/baselines/`. When a change moves rows on purpose, re-record just
94
+ - CI runs rubocop, the specs and the regression suites a pull request's
95
+ changes can reach on each pull request, and fails on any suite row that
96
+ differs from its baseline in `test/baselines/`. Every suite runs on
97
+ `main` every two hours. When a change moves rows on purpose, re-record just
97
98
  those rows as [test/baselines/README.md](test/baselines/README.md)
98
99
  describes, and say why in the pull request.
99
100
  - Write commit messages using
data/README.md CHANGED
@@ -13,7 +13,7 @@ are modelled at the cycle level.
13
13
  It runs programs, disk and tape images, cartridges and SID tunes, and
14
14
  the SDL2 front end supports the keyboard, joysticks, game controllers,
15
15
  paddles and a 1351 mouse. It also runs a PAL VIC-20, as
16
- `badline vic20`, and the C128, in C128 mode on 40 or 80 columns and in C64 mode, as `badline c128`. See [What's emulated](#whats-emulated) for the details.
16
+ `badline vic20`, the C128, in C128 mode on 40 or 80 columns and in C64 mode, as `badline c128`, and the Plus/4, the C16 and the C116, as `badline plus4`. See [What's emulated](#whats-emulated) for the details.
17
17
 
18
18
  It comes in two builds of the same emulator:
19
19
 
@@ -69,8 +69,8 @@ from it.
69
69
 
70
70
  The first argument can name the machine, as in `badline c64 game.prg`.
71
71
  The C64 is the default, and `--model` picks which C64. See
72
- [The VIC-20](#the-vic-20) for `badline vic20` and [The C128](#the-c128)
73
- for `badline c128`.
72
+ [The VIC-20](#the-vic-20) for `badline vic20`, [The C128](#the-c128)
73
+ for `badline c128` and [The Plus/4](#the-plus4) for `badline plus4`.
74
74
 
75
75
  `badline-ruby` takes the same media and the same options, with the
76
76
  differences noted in the table. `--help` lists the options for either.
@@ -84,9 +84,10 @@ differences noted in the table. `--help` lists the options for either.
84
84
  | `--true-drive` | Put an emulated 1541 on device 8 instead of the KERNAL traps. See [Media](#media) |
85
85
  | `-s`, `--subtune N` | Pick a subtune of a `.sid` file, counting from 1 |
86
86
  | `--sid 6581`, `--sid 8580` | Fit the older or newer SID. `--sid auto`, the default, takes a `.sid` tune's own |
87
- | `--ram SIZE` | Give a VIC-20 the RAM expansion `SIZE`: `unexpanded`, `3k`, `8k`, `16k`, `24k`, `32k` or `all`. Without it, the VIC-20 gets the expansion its media needs. See [The VIC-20](#the-vic-20) |
87
+ | `--ram SIZE` | Give a VIC-20 the RAM expansion `SIZE`: `unexpanded`, `3k`, `8k`, `16k`, `24k`, `32k` or `all`. Without it, the VIC-20 gets the expansion its media needs. See [The VIC-20](#the-vic-20). On the Plus/4, `16k`, `32k` or `64k` of RAM in place of the model's own |
88
+ | `--c1lo FILE`, `--c1hi FILE`, `--c2lo FILE`, `--c2hi FILE` | Put a raw `.bin` ROM image in one of the Plus/4's cartridge slots: cartridge 1 or 2, low (`$8000`) or high (`$C000`). See [The Plus/4](#the-plus4) |
88
89
  | `--reu SIZE` | Plug in a RAM Expansion Unit of `SIZE` K: 128, 256, 512 (a 1750) or up to 16384 |
89
- | `--model NAME` | Run another model of the machine, named as in VICE. For the C64: `c64` (the default, a PAL C64 with the 6569 VIC-II, 6526 CIAs and the 6581 SID), `c64c` (the PAL C64C, with the 8565, 6526As and the 8580), `ntsc` (the 6567R8), `newntsc` (the NTSC C64C, with the 8562, 6526As and the 8580), `oldntsc` (the first NTSC C64s' 6567R56A), `drean` (the Drean C64 of Argentina, PAL-N with the 6572), `sx64` (the portable SX-64, with its own KERNAL and no datasette), `pet64` (the PET 64 or Educator 64, a PAL C64 in a PET's case with its own KERNAL and a green monochrome monitor) `c64gs` (the C64GS games console, a PAL C64C with its own BASIC and KERNAL, and no keyboard or datasette) or `ultimax` (the MAX Machine of Japan, NTSC with 2K of RAM, one CIA and no ROMs, which runs only a cartridge). `--sid` or a `.sid` tune's own SID takes the model's place |
90
+ | `--model NAME` | Run another model of the machine, named as in VICE. For the C64: `c64` (the default, a PAL C64 with the 6569 VIC-II, 6526 CIAs and the 6581 SID), `c64c` (the PAL C64C, with the 8565, 6526As and the 8580), `ntsc` (the 6567R8), `newntsc` (the NTSC C64C, with the 8562, 6526As and the 8580), `oldntsc` (the first NTSC C64s' 6567R56A), `drean` (the Drean C64 of Argentina, PAL-N with the 6572), `sx64` (the portable SX-64, with its own KERNAL and no datasette), `pet64` (the PET 64 or Educator 64, a PAL C64 in a PET's case with its own KERNAL and a green monochrome monitor) `c64gs` (the C64GS games console, a PAL C64C with its own BASIC and KERNAL, and no keyboard or datasette) or `ultimax` (the MAX Machine of Japan, NTSC with 2K of RAM, one CIA and no ROMs, which runs only a cartridge). `--sid` or a `.sid` tune's own SID takes the model's place. The VIC-20, the C128 and the Plus/4 have models of their own: see their sections |
90
91
  | `--ntsc` | Run an NTSC C64, as `--model ntsc` does |
91
92
  | `--c64` | Start a C128 in C64 mode, holding `C=` at power-on. See [The C128](#the-c128) |
92
93
  | `--no-sound` | Don't play the SID (`badline` only, where sound is on by default) |
@@ -107,6 +108,7 @@ differences noted in the table. `--help` lists the options for either.
107
108
  | `--script FILE` | Run the events in `FILE`, one `FRAME:EVENT` a line |
108
109
  | `--screenshot FILE` | Save the last frame as a `.bmp` |
109
110
  | `--save-snapshot FILE` | Save the machine as a `.vsf` snapshot after the last frame |
111
+ | `--vice` | Add VICE's modules to `--save-snapshot`'s C64 snapshot, so x64sc opens it too |
110
112
 
111
113
  ```sh
112
114
  badline --unpaced --frames 12000 --true-drive disk1.d64 \
@@ -139,7 +141,8 @@ Without `--true-drive`, device 8 is no drive at all but traps on the
139
141
  KERNAL's disk routines. Loading is instant, but fast loaders and copy
140
142
  protection that run code on the drive need `--true-drive`, which puts
141
143
  an emulated 1541 there, running its own DOS at a real 1541's speed. Its
142
- red LED lights in the bottom right corner of the border. With
144
+ red activity LED and green power LED light in the bottom right corner
145
+ of the border. With
143
146
  `--true-drive`, a `.d81` goes in an emulated 1581 in place of the 1541.
144
147
  [doc/media.md](doc/media.md) has the details, and how to attach media
145
148
  from Ruby.
@@ -219,16 +222,55 @@ no host key yet: `Tab` and the arrows keep their C64 uses.
219
222
  `F11`, `F12` and the pause menu save and load the C128 in badline's own
220
223
  snapshots, and x128's `.vsf` files don't load.
221
224
 
225
+ ## The Plus/4
226
+
227
+ `badline plus4` runs a PAL Plus/4, with BASIC 3.5 and the 3-plus-1
228
+ function ROMs, and takes the same media as the C64 apart from SID tunes:
229
+
230
+ ```sh
231
+ badline plus4 # READY., in BASIC 3.5
232
+ badline plus4 game.prg # Load and run a program
233
+ badline plus4 game.d64 # Mount a disk image as device 8 and load it
234
+ badline plus4 game.tap # Insert a tape and load it
235
+ badline plus4 game.crt # Attach a cartridge
236
+ badline plus4 --model c16 game.bin # A C16 with a cartridge's ROM image
237
+ ```
238
+
239
+ `--model` picks the machine: `plus4` (the default, PAL with 64K of RAM),
240
+ `c16` (PAL with 16K, without the function ROMs, the ACIA and the user
241
+ port), `c116`, which is the C16 in another case, and `plus4ntsc` and
242
+ `c16ntsc` for their NTSC versions. `--ram 16k`, `32k` or `64k` fits other
243
+ RAM in place of the model's own.
244
+
245
+ A program loads at the start of BASIC 3.5, `$1001`, and runs. A tape's
246
+ `LOAD` reads the datasette, as the 264 KERNAL's does by default. A
247
+ cartridge is a `.crt` or a raw `.bin` ROM image. A `.bin` goes in
248
+ cartridge 1, its low slot for up to 16K and both slots for 32K, and
249
+ `--c1lo`, `--c1hi`, `--c2lo` and `--c2hi` put one in the slot they name,
250
+ as xplus4's options do:
251
+
252
+ ```sh
253
+ badline plus4 --c1lo game-low.bin --c1hi game-high.bin
254
+ ```
255
+
256
+ Disks go through the KERNAL traps or, with `--true-drive`, a 1541 or a
257
+ 1581 on the serial bus. There is no 1551 yet. The pause menu's Power
258
+ page names the model and its RAM, and its Expansion port page shows the
259
+ slots that hold a cartridge and takes them all out. `F11` and the
260
+ Snapshots page save it as they do the others, but not for VICE.
261
+ [Input](#input) lists its keys.
262
+
222
263
  ## Snapshots
223
264
 
224
265
  `F11` quicksaves the whole machine to the next of five slots in
225
266
  badline's data folder, replacing the oldest, and `F12` restores the
226
267
  newest, even after badline has quit and started again. badline also
227
268
  autosaves every two minutes of play, and the pause menu's Snapshots page
228
- saves under a name and loads any of them. Snapshots use
229
- VICE's `.vsf` format: badline opens those x64sc saves, and x64sc opens
230
- badline's. See [doc/snapshots.md](doc/snapshots.md) for where they're
231
- kept, what they hold and how far the two agree.
269
+ saves under a name and loads any of them. Snapshots from badline 0.14.0
270
+ on load in every later version. They use VICE's `.vsf` format: badline
271
+ opens those x64sc saves, and x64sc opens badline's saved with `--vice`.
272
+ See [doc/snapshots.md](doc/snapshots.md) for where they're kept, what
273
+ they hold and how far the two agree.
232
274
 
233
275
  ## Playing and rendering SID tunes
234
276
 
@@ -269,6 +311,21 @@ types `"`. These keys have no same-named host key:
269
311
  | `+` / `*` | Keypad `+` / Keypad `*` |
270
312
  | `RESTORE` | `Page Up` |
271
313
 
314
+ The Plus/4 and the C16 keep the C64's host keys for the keys they share,
315
+ and put their own here:
316
+
317
+ | Plus/4 | Host |
318
+ |--------|------|
319
+ | `ESC` | `Escape` |
320
+ | `RUN/STOP` | `Page Down` |
321
+ | `F1` / `F2` / `F3` | `F1` / `F2` / `F3` |
322
+ | `HELP` | `F4`, `Insert` or `Help` |
323
+ | `CRSR ←` / `→` / `↑` / `↓` | `Left` / `Right` / `Up` / `Down` |
324
+ | `SHIFT` | `Left Shift` or `Right Shift` |
325
+
326
+ They have no `RESTORE`, `←` or `↑` key, so `Page Up`, `` ` `` and `]`
327
+ press nothing.
328
+
272
329
  `Tab` switches the keys between the C64 keyboard and the joysticks. The
273
330
  window title shows where they go, and any device plugged into a control
274
331
  port:
@@ -311,10 +368,10 @@ too.
311
368
  | Snapshots | Quicksave, save under a name, load a named save, and the latest quicksaves and autosaves |
312
369
  | Drive 8 | The disk: insert, eject, the previous or next disk of its set, and whether it's writable |
313
370
  | Datasette | The tape: insert, eject, PLAY and REWIND |
314
- | Expansion port | The cartridge: insert, remove, and its freeze button if it has one |
371
+ | Expansion port | The cartridge: insert, remove, and its freeze button if it has one. On the Plus/4, the slots that hold one |
315
372
  | Ports | The device in each control port, and where the keys go |
316
373
  | Sound | Mute, and the SID's model |
317
- | Power | Reset, power cycle and quit, and on a C128 its model and mode |
374
+ | Power | Reset, power cycle and quit, on a C128 its model and mode, and on a Plus/4 its model and RAM |
318
375
 
319
376
  INSERT opens a file browser. A disk's set is the `.m3u` or `.vfl` list it
320
377
  was opened from, or one in its folder that lists it. Without one, it comes
@@ -354,12 +411,18 @@ program or `.sid` dropped on it opens the menu to ask first.
354
411
  port, FAST mode, the VIC-IIe with its extra keyboard lines, the 8722
355
412
  MMU, the 8563 or 8568 VDC with its 80 column display, and 128K of RAM
356
413
  (`badline c128`), and the Z80, which boots the machine.
414
+ - **Plus/4, C16 and C116**: the 7501, the TED with its picture, sound,
415
+ timers and the CPU's single and double clock, 16K to 64K of RAM, ROM
416
+ banking with the 3-plus-1 function ROMs, the keyboard and both
417
+ joysticks, cartridges in both slots, the datasette and the serial bus
418
+ to device 8, PAL and NTSC (`badline plus4`). The ACIA's registers are
419
+ there but send and receive nothing.
357
420
  - **1541**: an emulated drive running its own DOS (`--true-drive`).
358
421
  - **1571**: the C128D's drive running DOS 3.0, in 1541 mode and in 1571
359
422
  mode at 2 MHz with both sides of a `.d71` or `.g71`, and fast serial
360
423
  (burst) to a C128 in C128 mode (`badline c128 --true-drive`).
361
424
  - **1581**: the 3.5" drive running its own DOS on its WD1772 and 8520,
362
- reading and writing `.d81` images, on the C64, the VIC-20 and the C128
425
+ reading and writing `.d81` images, on the C64, the VIC-20, the C128 and the Plus/4
363
426
  (`--true-drive` with a `.d81`).
364
427
  - **Cartridges**: standard 8K, 16K and Ultimax, Simons' BASIC, Ocean,
365
428
  Fun Play / Power Play, Super Games, Epyx FastLoad, Westermann
data/doc/media.md CHANGED
@@ -31,7 +31,8 @@ own DOS ROM on its own 6502 and talking to the machine over the serial
31
31
  bus. It reads `.d64` and `.g64` images, which it autostarts with the
32
32
  same `LOAD"*",8,1` and `RUN`, but not `.d71`, `.d81` or `.t64` images
33
33
  or directories. Loading runs at the speed of a real 1541, and the
34
- drive's red LED lights in the bottom right corner of the border.
34
+ drive's red activity LED and green power LED light in the bottom right
35
+ corner of the border. A 1581 flashes its power LED after an error.
35
36
 
36
37
  A `.g64` holds the disk's raw GCR, half tracks and all, so copy
37
38
  protection and fast loaders that read it work.
@@ -38,6 +38,8 @@ only catches the rows that happen to move.
38
38
  - [VIC-20 RAM power-on pattern](#vic-20-ram-power-on-pattern)
39
39
  - [VIC-I fetches and the V-bus](#vic-i-fetches-and-the-v-bus)
40
40
  - [VIC-I sound](#vic-i-sound)
41
+ - [TED beam and the 7501 port](#ted-beam-and-the-7501-port)
42
+ - [TED sound](#ted-sound)
41
43
  - [1541 serial port](#1541-serial-port)
42
44
  - [1541 disk mechanism](#1541-disk-mechanism)
43
45
  - [REU DMA](#reu-dma)
@@ -1490,6 +1492,178 @@ wasn't read.
1490
1492
  - Spec guard: *a step* in
1491
1493
  [`vic_i/sound/output_spec.rb`](../spec/badline/chips/vic_i/sound/output_spec.rb).
1492
1494
 
1495
+ ## TED beam and the 7501 port
1496
+
1497
+ Two places where badline knowingly differs from xplus4 r45942, which was
1498
+ run as a black box. No hardware capture settles either of them. Whoever
1499
+ finds one should start here.
1500
+
1501
+ - The line count steps, and the raster interrupt fires, at horizontal
1502
+ count 376, column 47 of `Chips::TED::Beam`: the datasheet's "Increment
1503
+ Vertical Line" decode, which fits its "8 cycles before the character
1504
+ window" for the raster interrupt. xplus4 steps the line about 3 single
1505
+ clock cycles later, and its raster interrupt reaches the handler 2-3
1506
+ cycles later, on display and border lines alike.
1507
+ - Pinned by the TED datasheet in the *Plus/4 Hardware Manual*, the
1508
+ scanned decode table on sheet 11 (page 62 of `hw.pdf`), not by a test.
1509
+ The comparison with xplus4 used trace probes that sample `$FF1E` and
1510
+ `$FF1D` through the lines, described with #644. The Lorenz plus4 rows
1511
+ don't move either way.
1512
+ - Spec guard: *the beam* in
1513
+ [`chips/ted_spec.rb`](../spec/badline/chips/ted_spec.rb).
1514
+ - `trap10`, `trap12` and `trap14` of the Lorenz suite's plus4 build, and
1515
+ their `ane` and `lxa` variants, pass on badline and fail (`$ff`) on
1516
+ xplus4. They are the trap tests that put their data on the 7501's port
1517
+ at `$00`-`$01` (`Plus4::CPUPort`: a full 8-bit direction register, P5
1518
+ reading 1 as an input). `readme-plus4.txt` says the trap tests don't
1519
+ work on a real 264, so its results don't decide this either.
1520
+ - Pinned by `lorenz-plus4`'s rows for those tests. The xplus4 verdicts
1521
+ are its exit codes with `-debugcart`, one program at a time.
1522
+
1523
+ The TED's fetch counters (`Chips::TED::Fetches`) follow xplus4 where the
1524
+ datasheet is silent, and the datasheet where the two disagree. Each was
1525
+ checked with probes that sample `$FF1A`, `$FF1B`, `$FF1D`, `$FF1E` and
1526
+ `$FF1F` through a frame, run on badline and xplus4 r45942 alike.
1527
+
1528
+ - The row's line (`$FF1F` bits 0-2) steps with the line count only on the
1529
+ display window's lines, so it holds 7 from line 204 to the end of the
1530
+ frame, and the character position reload holds 1000 there. The frame's
1531
+ end clears both.
1532
+ - The blink counter (`$FF1F` bits 3-6) counts at horizontal count 336, the
1533
+ datasheet's "Increment Blink", on line 256 of a PAL frame and line 228
1534
+ of an NTSC one, the lines xplus4 counts on. The datasheet gives no line.
1535
+ - A row's last line keeps its own attributes, although the line fetches
1536
+ the next row's, as xplus4 shows it: the attributes take hold as each
1537
+ character's pointer is fetched.
1538
+ - The attribute line reads the row the reload will point to after its own
1539
+ latch: 40 on from it on a row's eighth line, and the reload itself on any
1540
+ other line, as on the first row of a frame or after a scroll change
1541
+ stretched a row past eight lines.
1542
+ - The pointer line is the line after an attribute line, whatever the
1543
+ scroll says by then (the datasheet's DMA timing, step 8). A line whose
1544
+ scroll alone asks for pointers fetches none, so a scroll of 7 starts the
1545
+ first row on line 8, not line 0.
1546
+ - The row's line runs on from the frame's first row, wrapping from 7 to
1547
+ 0, and a pointer line doesn't reset it. After a scroll change moves the
1548
+ DMA lines, a row starts on whatever line the counter has reached.
1549
+ - Both pinned by xplus4 screenshots of scroll changes inside a text row,
1550
+ on lines 20, 100 and 101.
1551
+ - `$FF1A` reads back both bits written to it, the datasheet's two MSBs of
1552
+ the reload. xplus4 reads bit 1 as 0.
1553
+ - xplus4 reads the reload 40 higher for a few cycles around the line step
1554
+ on some lines. badline reads the register as it stands.
1555
+
1556
+ The TED's picture (`Chips::TED::Picture` and `Modes`) matches xplus4's
1557
+ screenshots pixel for pixel, by palette index, on probes for every mode,
1558
+ both column widths, both row counts, each horizontal and vertical scroll,
1559
+ the idle lines before the first row, cursor and flash, and scroll changes
1560
+ mid-frame. Where it follows xplus4 over the datasheet:
1561
+
1562
+ - The 38-column window is pixels 39-342 of the 384, 7 in on the left and
1563
+ 9 on the right. The datasheet's counts (3 and 307 against 451 and 315)
1564
+ would make it 8 and 8.
1565
+ - A multicolour bitmap's 01 takes the luminance of the attribute's bits
1566
+ 0-2, as the hires bitmap's 1 does. The datasheet gives it bits 4-6.
1567
+ - A register write takes hold 19 dots after its cycle starts
1568
+ (`Picture::WRITE_DELAY`), on a character cell's boundary with no scroll.
1569
+ That puts a raster interrupt's colour change within a cycle or two of
1570
+ where xplus4 puts it. Code timed from `$FF1E` or a DMA stall lands 3
1571
+ cycles later than in xplus4, the other side of the line-step difference
1572
+ above. Pinned by probes that change `$FF15` and `$FF19` every 6 cycles,
1573
+ timed both ways, and the spec guard *shows a register written mid-line
1574
+ from the pixel the write lands on* in
1575
+ [`chips/ted_spec.rb`](../spec/badline/chips/ted_spec.rb).
1576
+ - The picture's lines are scanlines as they go out. They follow the line
1577
+ count until a write to `$FF1C`-`$FF1D` moves it, start over where the
1578
+ count wraps to 0 at the end of the frame, and step with each line
1579
+ otherwise. The vertical border is a flip-flop: the window opens when
1580
+ the count reaches line 4 (8 with 24 rows) and shuts when it reaches 204
1581
+ (200), so a count moved past line 4 leaves the frame bordered. Pinned by
1582
+ `TED/write-scanline-coarse.prg`, which matches xplus4's screenshot pixel
1583
+ for pixel, and the spec guards *keeps the window shut through a frame
1584
+ whose line count jumps past line 4* and *paints the scanline after a
1585
+ line count write on the picture's next line*.
1586
+ - A write to `$FF1E` changes nothing: xplus4 reads the same positions
1587
+ after writes of `$00` to `$FF` on line 100, and its screenshots don't
1588
+ move. Härsfalvi says writing back a value read at the right time
1589
+ affects the screen, which no probe here reproduces.
1590
+ - Freezing the TED (`$FF07` bit 5) for about 100 cycles on line 100
1591
+ leaves the picture as xplus4 shows it.
1592
+ - The blink counter's carry turns cursor and flash over together: in one
1593
+ turn flashing characters show the background and the cursor is off, in
1594
+ the other both show, the cursor as reverse.
1595
+
1596
+ ## TED sound
1597
+
1598
+ No testprog checks the TED's sound, so these rules are pinned by xplus4
1599
+ (VICE 3.10) recordings, run as a black box: `-sounddev wav` at 96 kHz of
1600
+ probe programs that set the registers, the same programs run on badline
1601
+ with the sound's level sampled at the same rate, and the two compared by
1602
+ period, level and noise bits. xplus4 records the raw level, with no
1603
+ filter, so its samples read off as levels. xplus4's own source wasn't
1604
+ read.
1605
+
1606
+ - A voice counts once every 4 cycles and toggles its output every
1607
+ 1023 - x counts, so its frequency is the clock over 8 * (1023 - x).
1608
+ `$3FF` counts 1,024. The datasheet's formula has 1024 - x, and its PAL
1609
+ constant, 111,840.45, is 1,000 above the clock over 8.
1610
+ - Pinned by xplus4: voice 1 at `$000`, `$200`, `$300`, `$3F0` and `$3FF`
1611
+ measures 108.344, 216.900, 434.653, 7389.08 and 108.239 Hz. Their
1612
+ ratios are 1023 : 511 : 255 : 15 : 1024 to 5 digits, which 1024 - x
1613
+ can't give, and badline's recordings measure the same within 0.005%.
1614
+ - Spec guard: *a voice's counter* in
1615
+ [`chips/ted/sound_spec.rb`](../spec/badline/chips/ted/sound_spec.rb).
1616
+ - `$3FE` stops a voice after its next toggle, its output high whatever
1617
+ the phase, square wave or noise, and stops the noise's shifts.
1618
+ - Pinned by xplus4: `$3FE` written while voice 1 plays at `$200`, after
1619
+ 21, 22, 23 and 24 frames, holds the level high each time, and noise
1620
+ at `$3FE` holds high too. Noise held at `$3FE` for 20, 21 or 23
1621
+ frames plays on with the same bits once it leaves, one shift on from
1622
+ where it would be if the pending toggle were dropped.
1623
+ - Spec guard: *$3FE* in
1624
+ [`chips/ted/sound_spec.rb`](../spec/badline/chips/ted/sound_spec.rb).
1625
+ - The noise is an 8-bit shift register that shifts at each of voice 2's
1626
+ toggles, taking in the XOR of bits 1, 4, 5 and 7 at bit 0. Bit 1 is the
1627
+ output. Voice 2's counter and the noise run whether voice 2 plays the
1628
+ square wave, the noise or nothing, and the square wins when bits 5 and
1629
+ 6 of `$FF11` are both set.
1630
+ - Pinned by xplus4: 21,306 bits of noise at `$3D7` after a reload,
1631
+ decoded from a recording, satisfy s(n) = s(n-2) ^ s(n-5) ^ s(n-6) ^
1632
+ s(n-8) (Berlekamp-Massey gives linear complexity 8), with period 255,
1633
+ starting 1100110111101110. Run back from there, the register held all
1634
+ ones with the first two output bits already in it, so the output is
1635
+ bit 1. Released from the reload into the square wave, into nothing or
1636
+ into noise, voice 2 plays the same bits once switched to noise.
1637
+ badline's recordings decode to the same first 64 bits in each of
1638
+ these runs and in the `$3FE` ones above.
1639
+ - Spec guard: *the noise* in
1640
+ [`chips/ted/sound_spec.rb`](../spec/badline/chips/ted/sound_spec.rb).
1641
+ - While `$FF11` bit 7 is set, the voices that are on hold high, the noise
1642
+ is silent and its register holds all ones. Written clear, each voice
1643
+ starts on a whole high half-wave. With the voices held high, the volume
1644
+ plays 9-level samples.
1645
+ - Pinned by xplus4: voice 1, voice 2's square wave and both hold the
1646
+ level high under bit 7, noise holds it at 0, and the half-wave after
1647
+ the release is 221 samples at `$200`, a whole one.
1648
+ - Spec guard: *the reload bit* in
1649
+ [`chips/ted/sound_spec.rb`](../spec/badline/chips/ted/sound_spec.rb).
1650
+ - The level comes from the volume and how many voices are on and high.
1651
+ One voice measures 586, 1610, 2634, 3658, 4682, 5706, 6730 and 7754 at
1652
+ volumes 1-8, and both 1172, 3284, 5526, 7984, 10658, 13548, 16654 and
1653
+ 19976. Volumes 9-15 are 8, and volume 0 or no voice on is silent.
1654
+ - Pinned by xplus4: those are its sample values, read off recordings
1655
+ that step the volume with one voice and with both held high.
1656
+ - Not pinned: that the hardware's levels are these. Nothing here says
1657
+ why two voices come out above twice one.
1658
+ - Spec guard: *the levels* in
1659
+ [`chips/ted/sound_spec.rb`](../spec/badline/chips/ted/sound_spec.rb).
1660
+ - The output stage is the level averaged over each sample, then a one-pole
1661
+ high-pass at 2.7 Hz. The Plus/4 schematic (310164, sheet 2) couples SND
1662
+ through R10 (1K) and C18 (10 uF) into R11 (12K) and R12 (10K), with C19
1663
+ (2,700 pF) as a low-pass at about 70 kHz, above any audio rate.
1664
+ - Not pinned: xplus4 records no output stage, and there is no hardware
1665
+ recording.
1666
+
1493
1667
  ## 1541 serial port
1494
1668
 
1495
1669
  - The drive sees the C64's side of the serial bus a host cycle late. The