badline 0.16.1 → 0.18.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 (256) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +213 -0
  3. data/CLAUDE.md +11 -7
  4. data/CONTRIBUTING.md +7 -1
  5. data/README.md +265 -26
  6. data/doc/media.md +5 -2
  7. data/doc/pinned-behaviour.md +189 -0
  8. data/doc/snapshot-format.md +616 -74
  9. data/doc/snapshots.md +192 -24
  10. data/exe/badline-ruby +5 -0
  11. data/lib/badline/audio/terminal.rb +34 -2
  12. data/lib/badline/c128/keyed_state.rb +2 -0
  13. data/lib/badline/c128.rb +1 -0
  14. data/lib/badline/c64/keyed_state.rb +2 -0
  15. data/lib/badline/c64.rb +1 -0
  16. data/lib/badline/cbm2/acia.rb +10 -0
  17. data/lib/badline/cbm2/bus.rb +263 -0
  18. data/lib/badline/cbm2/cpu.rb +58 -0
  19. data/lib/badline/cbm2/crtc_video.rb +133 -0
  20. data/lib/badline/cbm2/ieee_drive.rb +18 -0
  21. data/lib/badline/cbm2/ieee_layout.rb +69 -0
  22. data/lib/badline/cbm2/ieee_ports.rb +104 -0
  23. data/lib/badline/cbm2/ieee_traps.rb +81 -0
  24. data/lib/badline/cbm2/keyboard_ports.rb +60 -0
  25. data/lib/badline/cbm2/keyed_modules.rb +67 -0
  26. data/lib/badline/cbm2/keyed_state.rb +95 -0
  27. data/lib/badline/cbm2/model.rb +44 -0
  28. data/lib/badline/cbm2/p500/control_ports.rb +80 -0
  29. data/lib/badline/cbm2/p500/ieee_layout.rb +41 -0
  30. data/lib/badline/cbm2/p500/keyed_state.rb +85 -0
  31. data/lib/badline/cbm2/p500/model.rb +39 -0
  32. data/lib/badline/cbm2/p500/pages.rb +57 -0
  33. data/lib/badline/cbm2/p500.rb +264 -0
  34. data/lib/badline/cbm2/sid_page.rb +19 -0
  35. data/lib/badline/cbm2.rb +270 -0
  36. data/lib/badline/{plus4 → chips}/acia/frames.rb +1 -1
  37. data/lib/badline/chips/acia/keyed_state.rb +47 -0
  38. data/lib/badline/chips/acia.rb +307 -0
  39. data/lib/badline/chips/cia/timer.rb +2 -2
  40. data/lib/badline/chips/cpu/instruction_set.rb +1 -1
  41. data/lib/badline/chips/crtc.rb +3 -2
  42. data/lib/badline/chips/m6809/arithmetic.rb +140 -0
  43. data/lib/badline/chips/m6809/bus_steps.rb +223 -0
  44. data/lib/badline/chips/m6809/core.rb +149 -0
  45. data/lib/badline/chips/m6809/indexed.rb +82 -0
  46. data/lib/badline/chips/m6809/interrupts.rb +159 -0
  47. data/lib/badline/chips/m6809/keyed_state.rb +147 -0
  48. data/lib/badline/chips/m6809/opcodes.rb +159 -0
  49. data/lib/badline/chips/m6809/operations.rb +258 -0
  50. data/lib/badline/chips/m6809/plans.rb +143 -0
  51. data/lib/badline/chips/m6809/registers.rb +82 -0
  52. data/lib/badline/chips/m6809/stack.rb +140 -0
  53. data/lib/badline/chips/m6809.rb +13 -0
  54. data/lib/badline/chips/riot/fast_forward.rb +72 -0
  55. data/lib/badline/chips/riot/keyed_parts.rb +69 -0
  56. data/lib/badline/chips/riot/timer.rb +91 -0
  57. data/lib/badline/chips/riot.rb +162 -0
  58. data/lib/badline/chips/rriot/keyed_state.rb +30 -0
  59. data/lib/badline/chips/rriot.rb +134 -0
  60. data/lib/badline/chips/sid/filter.rb +4 -4
  61. data/lib/badline/chips/sid/waveform.rb +6 -6
  62. data/lib/badline/chips/tpi/keyed_state.rb +38 -0
  63. data/lib/badline/chips/tpi.rb +233 -0
  64. data/lib/badline/chips/vic/bank.rb +60 -5
  65. data/lib/badline/chips/vic/sprite.rb +4 -3
  66. data/lib/badline/chips/vic_i/keyed_parts.rb +7 -2
  67. data/lib/badline/chips/vic_i.rb +84 -21
  68. data/lib/badline/data_path.rb +3 -3
  69. data/lib/badline/drives/datasette/keyed_state.rb +9 -1
  70. data/lib/badline/drives/datasette.rb +27 -3
  71. data/lib/badline/drives/ieee_models.rb +54 -0
  72. data/lib/badline/drives/model1001.rb +37 -0
  73. data/lib/badline/drives/model2031.rb +6 -0
  74. data/lib/badline/drives/model4040/disk.rb +62 -0
  75. data/lib/badline/drives/model4040/ip_bus.rb +46 -0
  76. data/lib/badline/drives/model4040/keyed_state.rb +57 -0
  77. data/lib/badline/drives/model4040/mechanism.rb +192 -0
  78. data/lib/badline/drives/model4040/parts.rb +20 -0
  79. data/lib/badline/drives/model4040.rb +179 -0
  80. data/lib/badline/drives/model8050/board.rb +77 -0
  81. data/lib/badline/drives/model8050/disk.rb +163 -0
  82. data/lib/badline/drives/model8050/dos_board.rb +91 -0
  83. data/lib/badline/drives/model8050/fdc_bus.rb +102 -0
  84. data/lib/badline/drives/model8050/idle.rb +181 -0
  85. data/lib/badline/drives/model8050/ieee_port.rb +147 -0
  86. data/lib/badline/drives/model8050/ip_bus.rb +93 -0
  87. data/lib/badline/drives/model8050/keyed_state.rb +163 -0
  88. data/lib/badline/drives/model8050/mechanism.rb +230 -0
  89. data/lib/badline/drives/model8050/parts.rb +37 -0
  90. data/lib/badline/drives/model8050.rb +131 -0
  91. data/lib/badline/drives/model9060/idle.rb +149 -0
  92. data/lib/badline/drives/model9060/keyed_state.rb +123 -0
  93. data/lib/badline/drives/model9060/parts.rb +98 -0
  94. data/lib/badline/drives/model9060/sasi_bus.rb +88 -0
  95. data/lib/badline/drives/model9060/sasi_commands.rb +168 -0
  96. data/lib/badline/drives/model9060/sasi_target.rb +161 -0
  97. data/lib/badline/drives/model9060.rb +195 -0
  98. data/lib/badline/frontend/app.rb +18 -3
  99. data/lib/badline/frontend/boot.rb +4 -3
  100. data/lib/badline/frontend/controls.rb +107 -15
  101. data/lib/badline/frontend/gamepads.rb +3 -3
  102. data/lib/badline/frontend/keys.rb +97 -2
  103. data/lib/badline/frontend/kim1_panel.rb +208 -0
  104. data/lib/badline/frontend/media_slots.rb +8 -1
  105. data/lib/badline/frontend/menu/drive_types.rb +56 -0
  106. data/lib/badline/frontend/menu/menu_dialogs.rb +61 -14
  107. data/lib/badline/frontend/menu/menu_media.rb +47 -14
  108. data/lib/badline/frontend/menu/menu_pages.rb +113 -4
  109. data/lib/badline/frontend/menu/menu_ports.rb +77 -4
  110. data/lib/badline/frontend/menu/pause_menu.rb +6 -2
  111. data/lib/badline/frontend/pet_keyboard.rb +45 -7
  112. data/lib/badline/frontend/screen.rb +1 -1
  113. data/lib/badline/frontend/screens.rb +40 -2
  114. data/lib/badline/frontend/teletype_pane.rb +152 -0
  115. data/lib/badline/frontend/timeline.rb +49 -11
  116. data/lib/badline/frontend.rb +3 -0
  117. data/lib/badline/kernal_trap/dos/disk_commands.rb +80 -0
  118. data/lib/badline/kernal_trap/dos/status.rb +3 -0
  119. data/lib/badline/kernal_trap/dos.rb +18 -5
  120. data/lib/badline/kernal_trap/ieee.rb +4 -2
  121. data/lib/badline/kernal_trap/ieee_layout.rb +95 -43
  122. data/lib/badline/kim1/bus.rb +117 -0
  123. data/lib/badline/kim1/cpu.rb +25 -0
  124. data/lib/badline/kim1/host_terminal.rb +74 -0
  125. data/lib/badline/kim1/key_entry.rb +74 -0
  126. data/lib/badline/kim1/keyed_modules.rb +53 -0
  127. data/lib/badline/kim1/keyed_state.rb +133 -0
  128. data/lib/badline/kim1/panel.rb +176 -0
  129. data/lib/badline/kim1/rriots.rb +28 -0
  130. data/lib/badline/kim1/sound.rb +29 -0
  131. data/lib/badline/kim1/tape.rb +116 -0
  132. data/lib/badline/kim1/teletype.rb +193 -0
  133. data/lib/badline/kim1.rb +190 -0
  134. data/lib/badline/machine/ieee_drives.rb +171 -0
  135. data/lib/badline/machine/keyboard_buffer.rb +20 -3
  136. data/lib/badline/machine/line_sound.rb +122 -0
  137. data/lib/badline/machine/settling.rb +4 -0
  138. data/lib/badline/machine.rb +62 -14
  139. data/lib/badline/media/cbm2_media.rb +29 -0
  140. data/lib/badline/media/extensions.rb +8 -4
  141. data/lib/badline/media/kim1_media.rb +150 -0
  142. data/lib/badline/media/pet_media.rb +3 -1
  143. data/lib/badline/media/program.rb +6 -3
  144. data/lib/badline/media/true_drive.rb +51 -25
  145. data/lib/badline/media.rb +23 -8
  146. data/lib/badline/options/family.rb +108 -6
  147. data/lib/badline/options/help.rb +58 -12
  148. data/lib/badline/options/table.rb +60 -14
  149. data/lib/badline/options/validation.rb +71 -11
  150. data/lib/badline/options.rb +46 -13
  151. data/lib/badline/pet/bus.rb +16 -2
  152. data/lib/badline/pet/cassettes.rb +22 -1
  153. data/lib/badline/pet/ieee_drive.rb +5 -64
  154. data/lib/badline/pet/ieee_ports.rb +7 -0
  155. data/lib/badline/pet/keyboard_ports.rb +9 -2
  156. data/lib/badline/pet/keyed_state.rb +4 -0
  157. data/lib/badline/pet/model.rb +11 -2
  158. data/lib/badline/pet/rom_sets.rb +1 -0
  159. data/lib/badline/pet/sound.rb +5 -105
  160. data/lib/badline/pet/superpet/acia.rb +12 -0
  161. data/lib/badline/pet/superpet/board.rb +221 -0
  162. data/lib/badline/pet/superpet/dongle.rb +81 -0
  163. data/lib/badline/pet/superpet/keyed_modules.rb +63 -0
  164. data/lib/badline/pet/superpet/keyed_parts.rb +76 -0
  165. data/lib/badline/pet/superpet/m6809.rb +32 -0
  166. data/lib/badline/pet/superpet/waterloo_traps.rb +199 -0
  167. data/lib/badline/pet/superpet.rb +216 -0
  168. data/lib/badline/pet.rb +33 -6
  169. data/lib/badline/plus4/acia.rb +4 -298
  170. data/lib/badline/plus4/keyed_parts.rb +0 -44
  171. data/lib/badline/plus4/keyed_state.rb +2 -0
  172. data/lib/badline/plus4.rb +2 -0
  173. data/lib/badline/roms/1001/fdc-251257-02a.rom +0 -0
  174. data/lib/badline/roms/4040/dos-1.2.rom +0 -0
  175. data/lib/badline/roms/4040/dos-2.1-rev.rom +0 -0
  176. data/lib/badline/roms/4040/dos-2.1.rom +0 -0
  177. data/lib/badline/roms/4040/fdc-901466-02.rom +0 -0
  178. data/lib/badline/roms/4040/fdc-901466-04.rom +0 -0
  179. data/lib/badline/roms/8050/dos-2.7.rom +0 -0
  180. data/lib/badline/roms/8050/fdc-901869-01.rom +0 -0
  181. data/lib/badline/roms/8050/fdc-901885-04.rom +0 -0
  182. data/lib/badline/roms/9060/dos-3.0.rom +0 -0
  183. data/lib/badline/roms/9060/sasi-300515-revb.rom +0 -0
  184. data/lib/badline/roms/README +277 -0
  185. data/lib/badline/roms/cbm2/basic128-02b.rom +0 -0
  186. data/lib/badline/roms/cbm2/basic128.rom +0 -0
  187. data/lib/badline/roms/cbm2/basic256.rom +0 -0
  188. data/lib/badline/roms/cbm2/characters-600.rom +0 -0
  189. data/lib/badline/roms/cbm2/characters-700.rom +0 -0
  190. data/lib/badline/roms/cbm2/kernal-03b.rom +0 -0
  191. data/lib/badline/roms/cbm2/kernal-04a.rom +0 -0
  192. data/lib/badline/roms/cbm2/p500-basic.rom +0 -0
  193. data/lib/badline/roms/cbm2/p500-kernal.rom +0 -0
  194. data/lib/badline/roms/kim1/6530-002.rom +0 -0
  195. data/lib/badline/roms/kim1/6530-003.rom +0 -0
  196. data/lib/badline/roms/pet/characters-superpet.rom +0 -0
  197. data/lib/badline/roms/pet/superpet-a000.rom +0 -0
  198. data/lib/badline/roms/pet/superpet-c000.rom +0 -0
  199. data/lib/badline/roms/pet/superpet-e000-50hz.rom +0 -0
  200. data/lib/badline/roms/pet/superpet-e000.rom +0 -0
  201. data/lib/badline/snapshot/cbm2_setup.rb +53 -0
  202. data/lib/badline/snapshot/container.rb +9 -2
  203. data/lib/badline/snapshot/field_doc/markdown.rb +4 -2
  204. data/lib/badline/snapshot/field_doc.rb +59 -3
  205. data/lib/badline/snapshot/image.rb +65 -9
  206. data/lib/badline/snapshot/kim1_setup.rb +28 -0
  207. data/lib/badline/snapshot/pet_setup.rb +27 -11
  208. data/lib/badline/snapshot/storage_setup.rb +4 -1
  209. data/lib/badline/snapshot/vic20_setup.rb +11 -7
  210. data/lib/badline/snapshot/vice/cbm2.rb +93 -0
  211. data/lib/badline/snapshot/vice/cbm2_acia.rb +75 -0
  212. data/lib/badline/snapshot/vice/cbm2_crtc.rb +127 -0
  213. data/lib/badline/snapshot/vice/cbm2_mains.rb +49 -0
  214. data/lib/badline/snapshot/vice/cbm2_mem.rb +75 -0
  215. data/lib/badline/snapshot/vice/cbm2_restore.rb +204 -0
  216. data/lib/badline/snapshot/vice/cbm2_tpi.rb +58 -0
  217. data/lib/badline/snapshot/vice/cias.rb +13 -9
  218. data/lib/badline/snapshot/vice/p500.rb +96 -0
  219. data/lib/badline/snapshot/vice/p500_restore.rb +130 -0
  220. data/lib/badline/snapshot/vice/p500_vicii.rb +166 -0
  221. data/lib/badline/snapshot/vice/pet.rb +20 -10
  222. data/lib/badline/snapshot/vice/pet_cpu.rb +42 -5
  223. data/lib/badline/snapshot/vice/pet_crtc.rb +25 -17
  224. data/lib/badline/snapshot/vice/pet_drive.rb +180 -0
  225. data/lib/badline/snapshot/vice/pet_drive8050.rb +336 -0
  226. data/lib/badline/snapshot/vice/pet_mem.rb +49 -5
  227. data/lib/badline/snapshot/vice/pet_restore.rb +100 -7
  228. data/lib/badline/snapshot/vice/pet_via.rb +6 -5
  229. data/lib/badline/snapshot/vice/sid_registers.rb +2 -1
  230. data/lib/badline/snapshot/vice/vicii_import.rb +10 -6
  231. data/lib/badline/snapshot/vice.rb +3 -0
  232. data/lib/badline/snapshot.rb +15 -3
  233. data/lib/badline/status.rb +30 -30
  234. data/lib/badline/storage/crt_file.rb +7 -1
  235. data/lib/badline/storage/d64_image.rb +7 -0
  236. data/lib/badline/storage/d67_image.rb +55 -0
  237. data/lib/badline/storage/d80_image.rb +17 -1
  238. data/lib/badline/storage/d81_image.rb +14 -0
  239. data/lib/badline/storage/d90_image.rb +180 -0
  240. data/lib/badline/storage/disk_image/bam.rb +18 -3
  241. data/lib/badline/storage/disk_image/formatting.rb +69 -0
  242. data/lib/badline/storage/disk_image/writing.rb +37 -2
  243. data/lib/badline/storage/disk_image.rb +2 -0
  244. data/lib/badline/storage/kim_tape.rb +254 -0
  245. data/lib/badline/storage/papertape.rb +90 -0
  246. data/lib/badline/storage.rb +5 -0
  247. data/lib/badline/support/cbm2_checkpoint.rb +48 -0
  248. data/lib/badline/support/kim1_checkpoint.rb +41 -0
  249. data/lib/badline/support/p500_checkpoint.rb +35 -0
  250. data/lib/badline/support/superpet_checkpoint.rb +35 -0
  251. data/lib/badline/version.rb +1 -1
  252. data/lib/badline/vic20/keyed_modules.rb +6 -3
  253. data/lib/badline/vic20/keyed_state.rb +6 -4
  254. data/lib/badline/vic20.rb +26 -12
  255. data/lib/badline.rb +2 -0
  256. metadata +148 -2
@@ -100,6 +100,109 @@ https://www.zimmers.net/anonftp/pub/cbm/firmware/drives/old/2031/
100
100
  and concatenated.
101
101
  SHA-1 c53e180a96649ceb3f421739e8dc66faba7cba44.
102
102
 
103
+ 8050/fdc-901869-01.rom
104
+ ----------------------
105
+ The 6530 of the 8050 and 8250's floppy controller with the DOS 2.7
106
+ mask for MPI mechanisms, 901869-01 (6530-48): the 1 KB ROM the
107
+ controller runs from $FC00-$FFFF. Chips::RRIOT holds it.
108
+ SHA-1 3a9a80f72ce76e5f5c72513f8ef7553212912ae3.
109
+
110
+ 8050/fdc-901885-04.rom
111
+ ----------------------
112
+ The same 6530 with the DOS 2.7 mask for Micropolis mechanisms,
113
+ 901885-04 (6530-47). It differs from 901869-01 in 104 bytes.
114
+ SHA-1 0dc9a3b60f1b866c63eebd882403532fc59fe57f.
115
+
116
+ 8050/dos-2.7.rom
117
+ ----------------
118
+ The 8050 and 8250's DOS 2.7, 16 KB for the interface processor's
119
+ $C000-$FFFF: 901887-01 ($C000-$DFFF, SHA-1
120
+ b10603195f240118fe5fb6c6dfe5c5097463d890) followed by 901888-01
121
+ ($E000-$FFFF, SHA-1 2e6c2d7ca934e5c550ad14bd5e9e7749686b7af4). xcbm2
122
+ and xpet with -drive8type 8050 or 8250 run the same 16 KB.
123
+ Drives::Model8050 loads it.
124
+ SHA-1 d50b093828888146596f17ae0df9ef3dfde71b05.
125
+
126
+ Both downloaded from
127
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/drives/old/8050/
128
+ and named by the 8050's parts list
129
+ (https://www.zimmers.net/anonftp/pub/cbm/schematics/drives/old/8050/parts.txt).
130
+
131
+ 1001/fdc-251257-02a.rom
132
+ -----------------------
133
+ The SFD-1001's floppy controller program, 251257-02A: the first 1 KB
134
+ of the 2716 on its 6530 adaptor (251252-01), whose A10 is grounded, so
135
+ the controller runs it from $FC00-$FFFF in place of the 6530's mask.
136
+ Its interface processor runs 8050/dos-2.7.rom, the same 16 KB as
137
+ 901887-01 and 901888-01. Drives::Model1001 loads it.
138
+ SHA-1 473664d405942865d46a6e723eb7d3f243584f7a (the whole 2 KB EPROM,
139
+ SHA-1 3b954eb34f7ea088eed1d33ebc6d6e83a3e9be15).
140
+
141
+ Downloaded from
142
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/drives/old/1001/251257-02A.bin
143
+
144
+ 4040/dos-1.2.rom
145
+ ----------------
146
+ The 2040's DOS 1.2, the 3040's with DOS 1, 8 KB for the interface
147
+ processor's $E000-$FFFF: 901468-06 ($E000-$EFFF, SHA-1
148
+ 4d9658f2e6ff3276e5c6e224611a66ce44b16fc7) followed by 901468-07
149
+ ($F000-$FFFF, SHA-1 6a51c7954938439ca8342fc295bda050c06e1791). No DOS
150
+ 1.0 image is public, so both DOS 1 units run it, as xpet's 2040 does.
151
+ Drives::Model2040 loads it.
152
+ SHA-1 e37b3bfd801eb19dea50cf8b4a6af8613c3520d3.
153
+
154
+ 4040/fdc-901466-02.rom
155
+ ----------------------
156
+ The 6530 of the DOS 1 floppy controller, 901466-02, the same 1 KB as
157
+ 901466-01, run from $FC00-$FFFF.
158
+ SHA-1 d539858f839f96393f218307df7394362a84a26a.
159
+
160
+ 4040/dos-2.1.rom
161
+ ----------------
162
+ DOS 2.1, 12 KB for the interface processor's $D000-$FFFF: 901468-11
163
+ ($D000, SHA-1 8415f3159dea73161e0cef7960afa6c76953b6f8), 901468-12
164
+ ($E000, SHA-1 e8a94f239082d45f64f01b2d8e488d18fe659cbb) and 901468-13
165
+ ($F000, SHA-1 6ada7904ac9d13c3f1c0a8715f9c4be1aa6eb0bb). xpet's 3040
166
+ runs it, and so does Drives::Model3040.
167
+ SHA-1 02bd4b0c8508b3874b95799a9a63caf369c837de.
168
+
169
+ 4040/dos-2.1-rev.rom
170
+ --------------------
171
+ The revised DOS 2.1, 12 KB for $D000-$FFFF: 901468-14 ($D000, SHA-1
172
+ ffb992b82ec913ddff7be964d7527aca3e21580c), 901468-15 ($E000, SHA-1
173
+ f702d6917fe8a798740ba4d467b500944ae7b70a) and 901468-16 ($F000, SHA-1
174
+ 04b918cf4adeee8015b43383d3cea7288a7d0aa8). xpet's 4040 runs it, and
175
+ so does Drives::Model4040.
176
+ SHA-1 245abbe76581558d270cdbb6fe55f56748403d8e.
177
+
178
+ 4040/fdc-901466-04.rom
179
+ ----------------------
180
+ The 6530 of the DOS 2.1 floppy controller, 901466-04, run from
181
+ $FC00-$FFFF under both DOS 2.1 sets.
182
+ SHA-1 6645fa40b81be1ff7d1384e9b52df06a26ab0bfb.
183
+
184
+ All downloaded from
185
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/drives/old/4040/
186
+ and concatenated in address order.
187
+
188
+ 9060/dos-3.0.rom
189
+ ----------------
190
+ The D9060's and D9090's DOS 3.0, 16 KB for the interface processor's
191
+ $C000-$FFFF: 300516 rev C ($C000-$DFFF, SHA-1
192
+ bb1ddb5da94a86266012eca54818aa21dc4cef6a) followed by 300517 rev C
193
+ ($E000-$FFFF, SHA-1 4c17d014de48c906871b9b6c7d037d8736b1fd52), the set
194
+ xpet's 9000 runs.
195
+ SHA-1 c48df2cbb0eea656c3243df7ea8bfefcd171b8e8.
196
+
197
+ 9060/sasi-300515-revb.rom
198
+ -------------------------
199
+ The program of the D9060's and D9090's SASI host processor, 300515
200
+ rev B, 2 KB for $F800-$FFFF.
201
+ SHA-1 59dafbd4855083074ba8dc96a04d4daa5b76e0d6.
202
+
203
+ Both downloaded from
204
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/drives/old/9090/
205
+
103
206
  Commodore VIC-20 ROMs
104
207
  =====================
105
208
 
@@ -348,3 +451,177 @@ second half is 901447-10 byte for byte, and its first a DIN set, with
348
451
  the German letters and the section sign in place of @ [ \ ] and in
349
452
  some of the graphics. The CRTC's MA13, bit 5 of R12, picks the half.
350
453
  SHA-1 9616f7f18757cccefb702a945f954b644d5b17d1.
454
+
455
+ Commodore SuperPET ROMs
456
+ =======================
457
+
458
+ Downloaded from
459
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/SuperPET/
460
+ The Waterloo 6809 firmware, as the two-board SuperPET's three 2764s hold
461
+ it. The three-board SuperPET's 2532s and 2516 hold the same bytes, and
462
+ each file below names them. In 6502 mode the SuperPET runs the 8032's
463
+ ROMs above. Nothing maps these yet.
464
+
465
+ pet/superpet-a000.rom
466
+ ---------------------
467
+ The Waterloo ROM for $A000-$BFFF, 970018-12
468
+ (waterloo-a000-bfff.970018-12.bin): 901898-01
469
+ (waterloo-a000.901898-01.bin, SHA-1
470
+ 0414b3ab847c8977eb05c2fcc72efcf2f9d92871) followed by 901898-02
471
+ (waterloo-b000.901898-02.bin, SHA-1
472
+ df154939b934d0aeeb376813ec1ba0d43c2a3378).
473
+ SHA-1 dcd18397dd2a691118aaacf2b087d08e3782f81a.
474
+
475
+ pet/superpet-c000.rom
476
+ ---------------------
477
+ The Waterloo ROM for $C000-$DFFF, 970019-12
478
+ (waterloo-c000-dfff.970019-12.bin): 901898-03
479
+ (waterloo-c000.901898-03.bin, SHA-1
480
+ 6c5b0cce97068f8841112ba6d5cd8e568b562fa3) followed by 901898-04
481
+ (waterloo-d000.901898-04.bin, SHA-1
482
+ b42a2050a319a1ffca7868a8d8d635fadd37ec37).
483
+ SHA-1 3ac4b9ae895c45630d10cfc9079f5dcbce5eb48e.
484
+
485
+ pet/superpet-e000.rom
486
+ ---------------------
487
+ The Waterloo ROM for $E000-$FFFF, 970020-12
488
+ (waterloo-e000-ffff.970020-12.bin), with the 60 Hz CRTC table: 901897-01
489
+ (waterloo-e000.901897-01.bin, SHA-1
490
+ e8ce8347451a001214a5e71a13081b38b4be23bc) for $E000-$E7FF, 2K of $FF
491
+ where the I/O page sits, and 901898-05 (waterloo-f000.901898-05.bin,
492
+ SHA-1 9b4a5134d20345171e7303445f87c4e0b9addc96) for $F000-$FFFF, which
493
+ ends in the 6809's vectors.
494
+ SHA-1 618992fe0046b670695f5b1d1c168ace9e6b8470.
495
+
496
+ pet/superpet-e000-50hz.rom
497
+ --------------------------
498
+ The 50 Hz Waterloo ROM for $E000-$FFFF, 970034-12
499
+ (waterloo-e000-ffff-970034-12.bin, from Christian Forstreuter's MMF
500
+ 9000, U49). Its $E000-$E7FF is the 50 Hz 901897-01
501
+ (waterloo-e000.901897-x.50Hz.bin, SHA-1
502
+ 57f8c3ef305768d9cba9a96d3f7b90d4a3c2daa4), which differs from the 60 Hz
503
+ one in three bytes of the CRTC table, $E0C2, $E0C3 and $E0C5, and the
504
+ rest is superpet-e000.rom's.
505
+ SHA-1 ef6c5e5e9be17b87faed43cf0007f98731d78384.
506
+
507
+ pet/characters-superpet.rom
508
+ ---------------------------
509
+ The SuperPET's 4K character generator, 901640-01
510
+ (characters.901640-01.bin). Its first half is 901447-10 byte for byte,
511
+ and its second holds an ASCII and an APL set. The CRTC's MA13, bit 5 of
512
+ R12, picks the half.
513
+ SHA-1 bf346f11595a3e65e55d6aeeaa2c0cec807b66c7.
514
+
515
+ Commodore CBM-II ROMs
516
+ =====================
517
+
518
+ Downloaded from
519
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/computers/b/
520
+ for the B series (610, 620, 710 and 720) and the P500 (510). Each BASIC
521
+ is its two 8K chips concatenated, $8000-$9FFF followed by $A000-$BFFF,
522
+ as the PET's are. Nothing maps them yet.
523
+
524
+ cbm2/kernal-04a.rom
525
+ -------------------
526
+ The B series KERNAL, 901244-04a (kernal.901244-04a.bin), for
527
+ $E000-$FFFF in segment 15. The default, the one VICE runs on every B
528
+ model.
529
+ SHA-1 abb26418b9e1614a8f52bdeee0822d4a96071439.
530
+
531
+ cbm2/kernal-03b.rom
532
+ -------------------
533
+ The B series KERNAL of the 1983 release, 901244-03b
534
+ (kernal.901244-03b.bin), for $E000-$FFFF in segment 15. Its entry
535
+ points and page 3 vectors are 901244-04a's.
536
+ SHA-1 a624899c236bc4458570144d25aaf0b3be08b2cd.
537
+
538
+ cbm2/basic128.rom
539
+ -----------------
540
+ BASIC 128 for the 610 and 710, 901243-04a and 901242-04a
541
+ (b128-8000.901243-04a.bin, SHA-1
542
+ 08d333208060ee2ce84d4532028d94f71c016b96, and b128-a000.901242-04a.bin,
543
+ SHA-1 7c6de17d46a3343dc597d9b9519cf63037b31908) concatenated, for
544
+ $8000-$BFFF in segment 15. The default, paired with kernal-04a.rom.
545
+ SHA-1 9409f92e167984096fe4d5913714bff6214c3b2d.
546
+
547
+ cbm2/basic128-02b.rom
548
+ ---------------------
549
+ BASIC 128 of the 1983 release, 901243-02b and 901242-02b
550
+ (b128-8000.901243-02b.bin, SHA-1
551
+ 625f7337ea972a8bce2bdf2daababc0ed0b3b69b, and b128-a000.901242-02b.bin,
552
+ SHA-1 56e8d2f86bf73ba36b3d3cb84dd75806b66c530a) concatenated, for
553
+ $8000-$BFFF in segment 15. Paired with kernal-03b.rom.
554
+ SHA-1 0da8311666521a1d5d7c80561550f9037f652989.
555
+
556
+ cbm2/basic256.rom
557
+ -----------------
558
+ BASIC 256 for the 620 and 720, 901241-03 and 901240-03
559
+ (b256-8000.901241-03.bin, SHA-1
560
+ 2d46be2cd89594b718cdd0a86d51b6f628343f42, and b256-a000.901240-03.bin,
561
+ SHA-1 0d7f77746290afba8d0abeb87c9caab9a3ad89ce) concatenated, for
562
+ $8000-$BFFF in segment 15. Both KERNALs run it.
563
+ SHA-1 53314b4d565cc405a67a0936b935e6e08955580d.
564
+
565
+ cbm2/characters-600.rom
566
+ -----------------------
567
+ The 600's character generator, 901237-01 (characters.901237-01.bin),
568
+ 4K: two sets of 128 glyphs, 16 bytes each, an 8x8 matrix in the first
569
+ eight rows.
570
+ SHA-1 e63bf18da48e5a53c99ef127c1ae721333d1d102.
571
+
572
+ cbm2/characters-700.rom
573
+ -----------------------
574
+ The 700's character generator, 901232-01 (characters.901232-01.bin),
575
+ 4K: two sets of 128 glyphs, 16 bytes each, an 8x16 matrix. zimmers.net
576
+ also has 901232-02, from a 710, which differs in 139 bytes. xcbm2 runs
577
+ -01 on its 710, and a 710's boot screen painted with it matches xcbm2's
578
+ dot for dot.
579
+ SHA-1 e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287.
580
+
581
+ cbm2/p500-kernal.rom
582
+ --------------------
583
+ The P500's KERNAL, 901234-02 (kernal.901234-02.bin), for $E000-$FFFF in
584
+ segment 15. The P500's character generator is the C64's,
585
+ character.rom above.
586
+ SHA-1 097197d4d08e0b82e0466a5f1fbd49a24f3d2523.
587
+
588
+ cbm2/p500-basic.rom
589
+ -------------------
590
+ The P500's BASIC 128, 901236-02 and 901235-02
591
+ (p500-basic-lo.901236-02.bin, SHA-1
592
+ f50240407bade901144f7e9f489fa9c607834eca, and
593
+ p500-basic-hi.901235-02.bin, SHA-1
594
+ 1b9a55f12f8cf025754d8029cc5324b474c35841) concatenated, for
595
+ $8000-$BFFF in segment 15.
596
+ SHA-1 e69531d45f5993f8e53c6bd9ab2a7bc10fe2d02f.
597
+
598
+ MOS KIM-1 ROMs
599
+ ==============
600
+
601
+ Downloaded from
602
+ https://www.zimmers.net/anonftp/pub/cbm/firmware/computers/kim1/
603
+ The files there are the monitor listing assembled with $FF in the
604
+ unused bytes. Real 6530-002 and 6530-003 chips have $00 there, as Hans
605
+ Otten found dumping his own
606
+ (http://retro.hansotten.nl/6502-sbc/kim-1-manuals-and-software/kim_1-roms/),
607
+ so badline zeroes those bytes and keeps the code as it is. Only a
608
+ program that reads unused ROM sees the difference.
609
+
610
+ kim1/6530-002.rom
611
+ -----------------
612
+ The mask ROM of the 6530-002, U2: the monitor, for $1C00-$1FFF, its
613
+ keypad and display routines, the teletype's and the 6502's vectors.
614
+ 6530-002.bin from zimmers.net, SHA-1
615
+ 054f7f6989af3a59462ffb0372b6f56f307b5362, with the three bytes at
616
+ $1FF7-$1FF9 zeroed. The result is Otten's dump of a real chip,
617
+ 6530-002 fillerbyte00.bin.
618
+ SHA-1 d0b5ceb279303cad219d6609d7db03a120f59ab8.
619
+
620
+ kim1/6530-003.rom
621
+ -----------------
622
+ The mask ROM of the 6530-003, U3: the cassette routines, for
623
+ $1800-$1BFF. 6530-003.bin from zimmers.net, SHA-1
624
+ 60b6e48f35fe4899e29166641bac3e81e3b9d220, with the 356 bytes at
625
+ $1A96-$1BF9 zeroed. The result is Otten's dump of a real chip,
626
+ 6530-003 fillerbyte00.bin.
627
+ SHA-1 16caaf9d4c8327e0d3198887499fe30056df3084.
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Badline
4
+ module Snapshot
5
+ # How a CBM-II was built: its model's name, one of CBM2::Model::ALL or
6
+ # CBM2::P500::Model::ALL, its KERNAL, one of the model's KERNALS, its
7
+ # mains, 50 or 60 Hz, and whether the DRAM refresh takes its cycles,
8
+ # the arguments CBM2.new or CBM2::P500.new takes.
9
+ CBM2Setup = Data.define(:model, :kernal, :mains_hz, :refresh)
10
+
11
+ class CBM2Setup
12
+ MODELS = (CBM2::Model::ALL + CBM2::P500::Model::ALL).map(&:name).freeze
13
+
14
+ KERNALS = (CBM2::Model::KERNALS.keys + CBM2::P500::Model::KERNALS.keys).freeze
15
+
16
+ MAINS = [50, 60].freeze
17
+
18
+ # The setup of `machine`.
19
+ def self.of(machine)
20
+ new(model: machine.model.name, kernal: machine.kernal, mains_hz: machine.mains_hz, refresh: machine.refresh?)
21
+ end
22
+
23
+ # The model by name, the KERNAL, the mains and the refresh, in a keyed
24
+ # snapshot module.
25
+ def write_fields(out)
26
+ out.text("model", model).text("kernal", kernal).int("mains_hz", mains_hz).bool("dram_refresh", refresh)
27
+ end
28
+
29
+ def self.read_fields(input)
30
+ model = input.choice("model", MODELS, CBM2::Model::DEFAULT)
31
+ kernal = input.choice("kernal", KERNALS, "04a")
32
+ mains_hz = input.int("mains_hz", 50)
33
+ unless MAINS.include?(mains_hz)
34
+ raise FormatError, "the snapshot is of a CBM-II at #{mains_hz} Hz, which badline doesn't build"
35
+ end
36
+
37
+ new(model:, kernal:, mains_hz:, refresh: input.bool("dram_refresh", true))
38
+ end
39
+
40
+ # A machine built this way, at power-on.
41
+ def build
42
+ return CBM2::P500.new(model:, mains_hz:) if CBM2::P500::Model.include?(model)
43
+
44
+ CBM2.new(model:, kernal:, mains_hz:, refresh:)
45
+ end
46
+
47
+ def to_s
48
+ machine = "#{model} with KERNAL #{kernal} at #{mains_hz} Hz"
49
+ refresh || CBM2::P500::Model.include?(model) ? machine : "#{machine} without the DRAM refresh"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -38,9 +38,16 @@ module Badline
38
38
  PLUS4 = "PLUS4"
39
39
  # xpet names its machine PET, for every model.
40
40
  PET = "PET"
41
+ # xcbm2 names its machine CBM-II, for every B series model.
42
+ CBM2 = "CBM-II"
43
+ # xcbm5x0 names its machine CBM-II-5x0, the P500.
44
+ CBM2_5X0 = "CBM-II-5x0"
45
+ # VICE has no KIM-1, so badline names it.
46
+ KIM1 = "KIM1"
41
47
  # The file format version each machine's VICE emulator reads, where
42
- # it isn't FORMAT_MAJOR.0: xpet refuses any other than 1.0.
43
- FORMAT_MAJORS = { PET => 1 }.freeze
48
+ # it isn't FORMAT_MAJOR.0: xpet and xcbm2 refuse any other than 1.0, and
49
+ # xcbm5x0 writes 0.0.
50
+ FORMAT_MAJORS = { PET => 1, CBM2 => 1, CBM2_5X0 => 0 }.freeze
44
51
  GZIP_MAGIC = "\x1f\x8b".b
45
52
 
46
53
  # The VICE version block, when VICE wrote the file: four version
@@ -7,7 +7,8 @@ module Badline
7
7
  # its default, with keys that differ only in a unit's number, such as
8
8
  # voice1 to voice3, on one row.
9
9
  class Markdown
10
- NAMES = { "c64" => "C64", "vic20" => "VIC-20", "c128" => "C128", "plus4" => "Plus/4", "pet" => "PET" }.freeze
10
+ NAMES = { "c64" => "C64", "vic20" => "VIC-20", "c128" => "C128", "plus4" => "Plus/4", "pet" => "PET",
11
+ "cbm2" => "CBM-II", "kim1" => "KIM-1" }.freeze
11
12
  TAG_TYPES = { Keyed::INT => "int", Keyed::BOOL => "bool", Keyed::BYTES => "bytes", Keyed::INTS => "ints",
12
13
  Keyed::TEXT => "text" }.freeze
13
14
 
@@ -31,7 +32,8 @@ module Badline
31
32
  `int & 0x..` are ints cut to the latch's width. A text that lists
32
33
  its values takes one of them. An optional int is absent when the
33
34
  latch holds nothing. A true drive's modules are named from its
34
- device number, `BL-D8` to `BL-D11`, and the SIDs past the first
35
+ device number, `BL-D8` to `BL-D11`, or to `BL-D15` for an 8050 or
36
+ an 8250. The SIDs past the first
35
37
  are `BL-SID2` onwards, in the order they were fitted. Keys with
36
38
  `<N>` stand for each numbered unit. A default of "written only" is
37
39
  a key the load doesn't read, or reads only when the snapshot has
@@ -37,8 +37,13 @@ module Badline
37
37
  # The machines the doc is made from: each family at power-on, the C64
38
38
  # with each kind of expansion, cartridge and media, and a second SID,
39
39
  # the 264 series' models, its TCBM interface, cartridge, tape and
40
- # true drives, the 1541 and the 1551, and a CRTC PET, a 2001, an 8096,
41
- # an 8296 with its user port jumpered and a PET with a disk and tapes.
40
+ # true drives, the 1541 and the 1551, a CRTC PET, a 2001, an 8096,
41
+ # an 8296 with its user port jumpered, a PET with a disk and tapes and
42
+ # one with a true 2031, one with an 8050, one with an 8250, one with
43
+ # a 4040 and one with a D9060, a SuperPET in 6809 mode with a disk in
44
+ # device 8, and a 610, a 720, a 610 with a cartridge and one with a
45
+ # disk, a PAL and an NTSC 510, and a KIM-1 on its keypad and one
46
+ # expanded, on a teletype.
42
47
  def self.machines
43
48
  {
44
49
  "c64" => [C64.new, C64.new(ram_expansion: :plus256k), C64.new(reu: 512),
@@ -51,7 +56,12 @@ module Badline
51
56
  Plus4.new(ram_expansion: :csory256),
52
57
  plus4_with_cartridge, plus4_with_tape, plus4_with_drive, plus4_with_drive("1551")],
53
58
  "pet" => [PET.new, PET.new(model: "2001"), PET.new(model: "8096"),
54
- PET.new(model: "8296", characters: "din", jumpers: %w[userport]), pet_with_media]
59
+ PET.new(model: "8296", characters: "din", jumpers: %w[userport]), pet_with_media,
60
+ pet_with_drive, pet_with_unit("8050"), pet_with_unit("8250"), pet_with_dos2_unit,
61
+ pet_with_hard_disk, superpet_with_disk],
62
+ "cbm2" => [CBM2.new, CBM2.new(model: "720", kernal: "03b", mains_hz: 60), cbm2_with_cartridge,
63
+ cbm2_with_disk, CBM2::P500.new, CBM2::P500.new(model: "510ntsc")],
64
+ "kim1" => [KIM1.new, KIM1.new(tty: true, ram: :expanded)]
55
65
  }
56
66
  end
57
67
 
@@ -66,8 +76,54 @@ module Badline
66
76
  end
67
77
  end
68
78
 
79
+ # A SuperPET with its CPU switch at 6809 and a disk in device 8
80
+ # through the traps.
81
+ def self.superpet_with_disk
82
+ PET::SuperPET.new(cpu: "6809").tap do |machine|
83
+ machine.mount(Storage::D64Image.new("", read_only: true, bytes: blank(174_848)))
84
+ end
85
+ end
86
+
87
+ # A PET with a 2031 holding a blank disk.
88
+ def self.pet_with_drive
89
+ PET.new.tap do |machine|
90
+ image = Storage::D64Image.new("", bytes: blank(174_848))
91
+ machine.plug_true_drive.insert(Drives::Model1541::Disk.decode(image))
92
+ end
93
+ end
94
+
95
+ # A PET with an 8050 or an 8250 holding a blank disk in drive 0.
96
+ def self.pet_with_unit(model)
97
+ image = if model == "8250"
98
+ Storage::D82Image.new("", bytes: blank(1_066_496))
99
+ else
100
+ Storage::D80Image.new("", bytes: blank(533_248))
101
+ end
102
+ PET.new.tap { |machine| machine.plug_ieee_drive(model).insert(Drives::Model8050::Disk.new(image)) }
103
+ end
104
+
105
+ # A PET with a 4040 holding a blank disk in drive 0.
106
+ def self.pet_with_dos2_unit
107
+ image = Storage::D64Image.new("", bytes: blank(174_848))
108
+ PET.new.tap { |machine| machine.plug_ieee_drive("4040").insert(Drives::Model4040::Disk.new(image)) }
109
+ end
110
+
111
+ # A PET with a D9060 and no hard disk in it.
112
+ def self.pet_with_hard_disk = PET.new.tap { |machine| machine.plug_ieee_drive("9060") }
113
+
69
114
  def self.blank(length) = Array.new(length, 0)
70
115
 
116
+ # A 610 with a disk in device 8 through the traps.
117
+ def self.cbm2_with_disk
118
+ CBM2.new.tap { |machine| machine.mount(Storage::D64Image.new("", read_only: true, bytes: blank(174_848))) }
119
+ end
120
+
121
+ # A 610 with an 8K cartridge ROM at $2000.
122
+ def self.cbm2_with_cartridge
123
+ chip = Storage::CRTFile::Chip.new(chip_type: 0, bank: 0, address: 0x2000, data: blank(0x2000))
124
+ CBM2.new.tap { |machine| machine.attach_cartridge([chip]) }
125
+ end
126
+
71
127
  def self.with_cartridge(type)
72
128
  chips = [0x8000, 0xa000].map do |address|
73
129
  Storage::CRTFile::Chip.new(chip_type: 2, bank: 0, address:, data: blank(0x2000))
@@ -34,7 +34,15 @@ module Badline
34
34
  # of a machine in memory (.of).
35
35
  class Image
36
36
  MACHINE = "BL-MACHINE"
37
- FAMILIES = { "c64" => "C64", "vic20" => "VIC-20", "c128" => "C128", "plus4" => "Plus/4", "pet" => "PET" }.freeze
37
+ FAMILIES = { "c64" => "C64", "vic20" => "VIC-20", "c128" => "C128", "plus4" => "Plus/4", "pet" => "PET",
38
+ "cbm2" => "CBM-II", "kim1" => "KIM-1" }.freeze
39
+
40
+ # The snapshots VICE's emulators write that badline doesn't read, by
41
+ # the machine their container names.
42
+ UNREAD = {
43
+ Container::VIC20 => "VIC-20 snapshots, not xvic's", Container::C128 => "C128 snapshots, not x128's",
44
+ Container::PLUS4 => "Plus/4 snapshots, not xplus4's"
45
+ }.freeze
38
46
 
39
47
  attr_reader :container
40
48
 
@@ -53,21 +61,39 @@ module Badline
53
61
  new(Container.new(computer.save_modules, machine: machine_name(computer)))
54
62
  end
55
63
 
56
- # The snapshot with VICE's modules ahead of the BL-* ones for a C64
57
- # or a PET, so x64sc or xpet opens it too. Raises FormatError for a
58
- # Plus/4, whose snapshots badline doesn't write for xplus4.
64
+ # The snapshot with VICE's modules ahead of the BL-* ones for a C64,
65
+ # a PET, a CBM-II's B series or a P500, so x64sc, xpet, xcbm2 or
66
+ # xcbm5x0 opens it too. Raises FormatError for a Plus/4, whose
67
+ # snapshots badline doesn't write for xplus4.
59
68
  def self.exported(computer)
60
69
  raise FormatError, "badline doesn't export a Plus/4's snapshot for VICE" if computer.family == :plus4
70
+ raise FormatError, "VICE has no KIM-1 to open a snapshot of one" if computer.family == :kim1
61
71
 
62
- computer.settle_for_snapshot!
72
+ computer.settle_for_vice!
63
73
  sections = computer.save_modules
64
74
  case computer.family
65
75
  when :c64 then sections = Vice.export(computer) + sections
66
76
  when :pet then sections = Vice::PET.export(computer, sections) + sections
77
+ when :cbm2 then sections = cbm2_export(computer, sections) + sections
67
78
  end
68
79
  new(Container.new(sections, machine: machine_name(computer)))
69
80
  end
70
81
 
82
+ # xcbm2's or xcbm5x0's modules for a CBM-II.
83
+ def self.cbm2_export(computer, sections)
84
+ computer.is_a?(CBM2::P500) ? Vice::P500.export(computer, sections) : Vice::CBM2.export(computer, sections)
85
+ end
86
+
87
+ # The VICE emulator a machine's VICE modules are for.
88
+ def self.vice_emulator(computer)
89
+ case machine_name(computer)
90
+ when Container::PET then "xpet"
91
+ when Container::CBM2 then "xcbm2"
92
+ when Container::CBM2_5X0 then "xcbm5x0"
93
+ else "x64sc"
94
+ end
95
+ end
96
+
71
97
  # The machine as VICE's emulators name it.
72
98
  def self.machine_name(computer)
73
99
  case computer.family
@@ -75,6 +101,8 @@ module Badline
75
101
  when :c128 then Container::C128
76
102
  when :plus4 then Container::PLUS4
77
103
  when :pet then Container::PET
104
+ when :cbm2 then computer.is_a?(CBM2::P500) ? Container::CBM2_5X0 : Container::CBM2
105
+ when :kim1 then Container::KIM1
78
106
  else Container::MACHINE
79
107
  end
80
108
  end
@@ -87,6 +115,8 @@ module Badline
87
115
  when "c128" then C128Setup.read_fields(machine)
88
116
  when "plus4" then Plus4Setup.read_fields(machine)
89
117
  when "pet" then PETSetup.read_fields(machine)
118
+ when "cbm2" then CBM2Setup.read_fields(machine)
119
+ when "kim1" then KIM1Setup.read_fields(machine)
90
120
  else C64Setup.read_fields(machine)
91
121
  end
92
122
  end
@@ -102,16 +132,16 @@ module Badline
102
132
 
103
133
  # A new machine, built as the snapshot's was and restored from it. A
104
134
  # badline snapshot restores from its BL-* modules alone, and a VICE
105
- # one through the modules badline reads, x64sc's or xpet's. xvic's,
135
+ # one through the modules badline reads, x64sc's, xpet's, xcbm2's or xcbm5x0's. xvic's,
106
136
  # x128's and xplus4's own modules aren't read. Yields a line for
107
137
  # each thing left out, or warns it without a block. `detached`
108
138
  # restores it without the host's files (Keyed::Modules).
109
139
  def load(detached: false, &)
110
140
  refuse_old_layout
111
- raise FormatError, "badline reads only its own VIC-20 snapshots, not xvic's" if vic20? && !badline?
112
- raise FormatError, "badline reads only its own C128 snapshots, not x128's" if c128? && !badline?
113
- raise FormatError, "badline reads only its own Plus/4 snapshots, not xplus4's" if plus4? && !badline?
141
+ refuse_unread
114
142
  return load_xpet(&) if pet? && !badline?
143
+ return load_xcbm2(&) if cbm2? && !badline?
144
+ return load_xcbm5x0(&) if p500? && !badline?
115
145
  return load_vice(&) unless badline?
116
146
 
117
147
  modules = Keyed::Modules.new(sections, detached:)
@@ -132,6 +162,13 @@ module Badline
132
162
  # Whether the machine is a PET, as the container names it.
133
163
  def pet? = @container.machine == Container::PET
134
164
 
165
+ # Whether the machine is a CBM-II's B series, as the container names
166
+ # it.
167
+ def cbm2? = @container.machine == Container::CBM2
168
+
169
+ # Whether the machine is a P500, as the container names it.
170
+ def p500? = @container.machine == Container::CBM2_5X0
171
+
135
172
  # Restores `computer` from the snapshot, and returns the Report. The
136
173
  # snapshot goes into a new machine first, so one that fails, or is of
137
174
  # a machine built another way, leaves `computer` as it was.
@@ -139,6 +176,8 @@ module Badline
139
176
  refuse_old_layout
140
177
  report = if badline? then restore_modules(computer)
141
178
  elsif pet? then Vice::PET::Restore.import(@container, computer)
179
+ elsif cbm2? then Vice::CBM2::Restore.import(@container, computer)
180
+ elsif p500? then Vice::P500::Restore.import(@container, computer)
142
181
  else Vice::Restore.import(@container, computer)
143
182
  end
144
183
  tell(report, &)
@@ -159,6 +198,18 @@ module Badline
159
198
  computer
160
199
  end
161
200
 
201
+ def load_xcbm2(&)
202
+ computer = Vice::CBM2.setup(@container).build
203
+ tell(Vice::CBM2::Restore.apply(@container, computer), &)
204
+ computer
205
+ end
206
+
207
+ def load_xcbm5x0(&)
208
+ computer = Vice::P500.setup(@container).build
209
+ tell(Vice::P500::Restore.apply(@container, computer), &)
210
+ computer
211
+ end
212
+
162
213
  # The snapshot goes into a new machine first, so one that fails
163
214
  # leaves `computer` as it was.
164
215
  def restore_modules(computer)
@@ -175,6 +226,11 @@ module Badline
175
226
  report(modules, computer)
176
227
  end
177
228
 
229
+ def refuse_unread
230
+ unread = UNREAD[@container.machine]
231
+ raise FormatError, "badline reads only its own #{unread}" if unread && !badline?
232
+ end
233
+
178
234
  # A snapshot from a badline before the keyed modules, which only the
179
235
  # version that saved it reads.
180
236
  def refuse_old_layout