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
data/README.md CHANGED
@@ -12,8 +12,8 @@ are modelled at the cycle level.
12
12
 
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
- paddles and a 1351 mouse. It also runs a PAL VIC-20, as
16
- `badline vic20`, the C128, in C128 mode on 40 or 80 columns and in C64 mode, as `badline c128`, the Plus/4, the C16 and the C116, as `badline plus4`, and the PET and CBM, as `badline pet`. See [What's emulated](#whats-emulated) for the details.
15
+ paddles and a 1351 mouse. It also runs the VIC-20, PAL or NTSC, as
16
+ `badline vic20`, the C128, in C128 mode on 40 or 80 columns and in C64 mode, as `badline c128`, the Plus/4, the C16 and the C116, as `badline plus4`, the PET and CBM, as `badline pet`, the CBM-II, the B series and the P500, as `badline cbm2`, and the MOS KIM-1, as `badline kim1`. See [What's emulated](#whats-emulated) for the details.
17
17
 
18
18
  It comes in two builds of the same emulator:
19
19
 
@@ -70,8 +70,9 @@ from it.
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
72
  [The VIC-20](#the-vic-20) for `badline vic20`, [The C128](#the-c128)
73
- for `badline c128`, [The Plus/4](#the-plus4) for `badline plus4` and
74
- [The PET](#the-pet) for `badline pet`.
73
+ for `badline c128`, [The Plus/4](#the-plus4) for `badline plus4`,
74
+ [The PET](#the-pet) for `badline pet`, [The CBM-II](#the-cbm-ii) for
75
+ `badline cbm2` and [The KIM-1](#the-kim-1) for `badline kim1`.
75
76
 
76
77
  `badline-ruby` takes the same media and the same options, with the
77
78
  differences noted in the table. `--help` lists the options for either.
@@ -82,20 +83,26 @@ differences noted in the table. `--help` lists the options for either.
82
83
  | --- | --- |
83
84
  | `--no-autostart` | Attach the media and stop at `READY.`, so you can type the `LOAD` yourself |
84
85
  | `--writable` | Let the machine write to disk images. Without it, a disk goes in write-protected: the drive reports `26,WRITE PROTECT ON` for any write and the image file stays as it was |
85
- | `--true-drive` | Put an emulated 1541 on device 8 instead of the KERNAL traps, a 1551 on the Plus/4, or a 2031 on the PET. See [Media](#media) |
86
- | `--drive-type 1541` | On the Plus/4, make the true drive on device 8 an emulated 1541 on the serial bus in place of the 1551. It implies `--true-drive`. See [The Plus/4](#the-plus4) |
86
+ | `--true-drive` | Put an emulated 1541 on device 8 instead of the KERNAL traps, a 1551 on the Plus/4, or a 2031 on the PET or the CBM-II, or for a `.d80` or `.d82` an 8050 or 8250. A `.d90` always goes in a D9060 or D9090. See [Media](#media) |
87
+ | `--drive-type MODEL` | On the Plus/4, `1541` makes the true drive on device 8 an emulated 1541 on the serial bus in place of the 1551. On the PET and the CBM-II, `2031` (the default), `8050`, `8250`, `1001` (an SFD-1001, which reads `.d82` images), `4040` or `3040` (two drives reading `.d64` images, with DOS 2.1), `2040` (DOS 1.2's `.d67` images), `9060` or `9090` names the drive `--true-drive` puts on the IEEE-488 bus. It implies `--true-drive`. See [The Plus/4](#the-plus4) and [The PET](#the-pet) |
87
88
  | `-s`, `--subtune N` | Pick a subtune of a `.sid` file, counting from 1 |
88
89
  | `--sid 6581`, `--sid 8580` | Fit the older or newer SID. `--sid auto`, the default, takes a `.sid` tune's own |
89
- | `--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, and on the PET `4k`, `8k`, `16k` or `32k` |
90
- | `--60hz` | Run a CRTC PET's 60 Hz editor in place of its 50 Hz one. See [The PET](#the-pet) |
90
+ | `--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, on the PET `4k`, `8k`, `16k` or `32k`, and on the KIM-1 `1k` (the default), `5k` or `expanded`. See [The KIM-1](#the-kim-1) |
91
+ | `--60hz` | Run a CRTC PET's 60 Hz editor in place of its 50 Hz one, or a CBM-II on 60 Hz mains. See [The PET](#the-pet) and [The CBM-II](#the-cbm-ii) |
92
+ | `--kernal 04a`, `--kernal 03b` | Fit a B series CBM-II with KERNAL 901244-04a (the default) or 901244-03b. The P500 takes its own, `02`. See [The CBM-II](#the-cbm-ii) |
91
93
  | `--basic VERSION`, `--editor NAME` | Fit a PET with an upgrade ROM its board takes: BASIC `1`, `2` or `4`, or an editor. See [The PET](#the-pet) |
92
94
  | `--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) |
93
95
  | `--sid-card 6581`, `--sid-card 8580` | Fit a Plus/4 or C16 with a SID card at `$FD40`. See [The Plus/4](#the-plus4) |
94
96
  | `--sid-card-address fd40`, `--sid-card-address fe80` | Put the SID card at `$FD40` (the default) or at `$FE80` |
95
97
  | `--ram-expansion NAME` | Fit a Plus/4 or C16 with a RAM expansion: `hannes256`, `hannes1m` or `csory256`. See [The Plus/4](#the-plus4) |
96
98
  | `--reu SIZE` | Plug in a RAM Expansion Unit of `SIZE` K: 128, 256, 512 (a 1750) or up to 16384 |
97
- | `--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, the Plus/4 and the PET have models of their own: see their sections |
98
- | `--ntsc` | Run an NTSC C64, as `--model ntsc` does |
99
+ | `--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, the Plus/4, the PET and the CBM-II have models of their own: see their sections |
100
+ | `--ntsc` | Run an NTSC C64 or VIC-20, as `--model ntsc` does |
101
+ | `--tty` | Fit the KIM-1's TTY/KB jumper, so its monitor talks to a teletype: a page in the window, or the terminal with `--headless`. See [The KIM-1](#the-kim-1) |
102
+ | `--baud N` | Run the KIM-1's teletype at `110`, `300`, `1200`, `2400`, `4800` or `9600` baud (the default) |
103
+ | `--tty-load` | Load the KIM-1's `.ptp` or `.pap` through its monitor's `L` command on the teletype, in real time, instead of straight into RAM. It implies `--tty` |
104
+ | `--load-address ADDR` | Where the KIM-1 loads a `.bin`, in hex: `0200` (the default), `$0200` or `0x0200` |
105
+ | `--start-address ADDR` | Where the KIM-1 starts its program, in hex, when that isn't where it loads |
99
106
  | `--c64` | Start a C128 in C64 mode, holding `C=` at power-on. See [The C128](#the-c128) |
100
107
  | `--no-sound` | Don't play the SID (`badline` only, where sound is on by default) |
101
108
  | `--sound` | Play the SID (`badline-ruby`, where sound is off by default) |
@@ -115,7 +122,7 @@ differences noted in the table. `--help` lists the options for either.
115
122
  | `--script FILE` | Run the events in `FILE`, one `FRAME:EVENT` a line |
116
123
  | `--screenshot FILE` | Save the last frame as a `.bmp` |
117
124
  | `--save-snapshot FILE` | Save the machine as a `.vsf` snapshot after the last frame |
118
- | `--vice` | Add VICE's modules to `--save-snapshot`'s C64 or PET snapshot, so x64sc or xpet opens it too |
125
+ | `--vice` | Add VICE's modules to `--save-snapshot`'s C64, PET or CBM-II snapshot, so x64sc, xpet, xcbm2 or xcbm5x0 opens it too |
119
126
 
120
127
  ```sh
121
128
  badline --unpaced --frames 12000 --true-drive disk1.d64 \
@@ -136,12 +143,14 @@ library, are covered in [doc/library.md](doc/library.md).
136
143
  | `.prg`, `.p00` | Loaded into memory after boot. A program at the BASIC start (`$0801`) is `RUN`, anything else is left for you to `SYS` |
137
144
  | `.d64`, `.d71`, `.d81` | Mounted as device 8, then `LOAD"*",8,1` and `RUN`. On a C128 in C128 mode a boot disk goes in a true drive instead and boots at power-on. See [Media](doc/media.md#c128-boot-disks). Write-protected unless `--writable` |
138
145
  | `.g64` | Put in a true 1541, then `LOAD"*",8,1` and `RUN`. It holds the disk's raw GCR, so copy protection that reads it works. Write-protected unless `--writable` |
146
+ | `.d80`, `.d82`, `.d67` | A PET's or a CBM-II's disk: an 8050's, an 8250's or SFD-1001's, or a 2040's with DOS 1. It starts a PET, and is mounted as device 8 or put in the true drive that reads it. See [The PET](#the-pet) |
147
+ | `.d90` | A D9060's or D9090's hard disk. It starts a PET, and always goes in the true drive, the D9060 or the D9090 by its size. See [The PET](#the-pet) |
139
148
  | `.m3u`, `.vfl` | A list of disk images, one path a line, relative to the list: an `.m3u` playlist, or a VICE flip list, which only unit 8's entries are taken from. Its first disk goes in as above, and the list is its set for the pause menu |
140
149
  | `.t64` | Mounted read-only as device 8 and loaded like a disk image. The files load by name, and no tape is involved |
141
150
  | `.tap` | Inserted in the datasette with PLAY pressed, then `LOAD` and `RUN`. It loads at the speed of a real tape |
142
151
  | `.crt` | The hardware types listed under [Cartridges](#whats-emulated). Other types are rejected |
143
152
  | `.sid` | PSID and RSID tunes, started through a small driver after boot |
144
- | `.vsf` | A snapshot of a running machine, badline's own or one VICE's x64sc saved. See [Snapshots](#snapshots) |
153
+ | `.vsf` | A snapshot of a running machine, badline's own or one VICE's x64sc, xpet, xcbm2 or xcbm5x0 saved. See [Snapshots](#snapshots) |
145
154
  | A directory | Mounted as device 8. It serves the `.prg` and `.p00` files in it and the contents of any `.t64`, and `SAVE` writes a new `.prg` |
146
155
 
147
156
  Without `--true-drive`, device 8 is no drive at all but traps on the
@@ -156,11 +165,14 @@ from Ruby.
156
165
 
157
166
  ## The VIC-20
158
167
 
159
- `badline vic20` runs a PAL VIC-20, and takes the same media as the C64
160
- apart from SID tunes:
168
+ `badline vic20` runs a PAL VIC-20, with the 6561 VIC-I, and
169
+ `badline vic20 --ntsc` (or `--model ntsc`) an NTSC one, with the 6560 and
170
+ the NTSC KERNAL, at 1,022,727 Hz and 60 frames a second. Either takes the
171
+ same media as the C64 apart from SID tunes:
161
172
 
162
173
  ```sh
163
174
  badline vic20 # READY.
175
+ badline vic20 --ntsc # READY., on an NTSC VIC-20
164
176
  badline vic20 game.prg # Load and run a program
165
177
  badline vic20 game.d64 # Mount a disk image as device 8 and load it
166
178
  badline vic20 game.tap # Insert a tape and load it
@@ -305,7 +317,8 @@ the business keyboard), `8096` (an 8032 with the 64K board at `$FFF0`),
305
317
  `8296` (128K on one board, below), `4032` (40 columns on a CRTC and the
306
318
  graphics keyboard), `3032` (the
307
319
  discrete 40-column board with BASIC 2), `3032b` (the same with the
308
- business keyboard) and `2001` (8K, BASIC 1 and the chiclet keyboard).
320
+ business keyboard), `2001` (8K, BASIC 1 and the chiclet keyboard) and
321
+ `superpet` (an 8032 with the Waterloo board, below).
309
322
  `--ram 4k`, `8k` or `16k` fits less RAM in place of the model's own, as
310
323
  the 3008, 3016 and 4016 had.
311
324
 
@@ -339,6 +352,44 @@ runs its own 50 Hz editor, `4-80-b-50hz-8296`, with lines of 59 cycles,
339
352
  fits the German boards' 4K character ROM, whose two halves R12's bit 5
340
353
  picks between.
341
354
 
355
+ The SuperPET, the SP9000 or MMF 9000, is an 8032 with the University of
356
+ Waterloo's board: 64K of RAM in 16 banks of 4K, one at a time at `$9000`
357
+ through the bank latch at `$EFFC`, the system latch at `$EFF8`, a 6551
358
+ ACIA at `$EFF0` with nothing on its RS-232 port, the 6702 protection
359
+ chip at `$EFE0`, and the 901640-01 character ROM, whose first half is the
360
+ 8032's and whose second half holds an ASCII and an APL set. It starts in
361
+ 6502 mode, as an 8032 with the board, and `--cpu 6809` sets its CPU switch
362
+ to the 6809, which runs the Waterloo ROMs to their microSystems menu. The
363
+ menu loads its languages from disk: a language disk given with `--cpu
364
+ 6809` goes in device 8, which answers the Waterloo ROM's IEEE-488
365
+ routines through traps as it answers the KERNAL's, so typing `basic` at
366
+ the menu loads microBASIC in about 20 seconds of the machine's time. The
367
+ menu loads from drive 1 of a dual drive, and the traps' one disk answers
368
+ as drive 1 too. With `--true-drive` the disk goes in a true drive
369
+ instead: a `.d80` or `.d82` in drive 1 of an 8050 or 8250, where typing
370
+ `basic` loads microBASIC in about twice the time, and a `.d64` in a
371
+ 2031's only drive, where `disk/0.BASIC` does. In 6502 mode a disk goes in
372
+ drive 0, as on the 8032. The original language
373
+ disks' copy protection finds its 6702, so they run unpatched. `--cpu
374
+ prog` leaves the CPU to bit 0 of the system latch, and `--bank-ram read`
375
+ write-protects the 64K bank RAM, or `prog` leaves it to bit 1, R/W by
376
+ default. The pause menu's power page has both switches: moving the CPU
377
+ switch resets the machine onto the CPU it picks, and the RAM switch
378
+ takes effect at once. While a Waterloo language shows its APL
379
+ characters, as microAPL does, the keys go by position: each presses the
380
+ SuperPET key that types its unshifted character, with the host's SHIFT,
381
+ so it types the APL symbol on that keycap. The menu's KEYBOARD page
382
+ says which set is up. It takes the 8032's editors and `--60hz`,
383
+ which picks the Waterloo ROM with the 60 Hz CRTC table, and no `--ram`.
384
+ Its snapshots save and load in both modes, and xpet's `-model SuperPET`
385
+ opens those saved with `--vice`.
386
+
387
+ ```sh
388
+ badline pet --model superpet --cpu 6809 # The SuperPET's Waterloo menu
389
+ badline pet --model superpet --cpu 6809 sp9000lang.d80 # The same with the language disk
390
+ badline pet --model superpet --bank-ram read # The bank RAM write-protected
391
+ ```
392
+
342
393
  ```sh
343
394
  badline pet --model 8296 --jumpers ram9,rama # An 8296 with RAM at $9000 and $A000
344
395
  badline pet --model 2001 --basic 2 # A 2001 with BASIC 2
@@ -354,11 +405,26 @@ goes into memory as a program file does. `--basic 2`, the upgrade
354
405
  Commodore sold, loads from disk.
355
406
 
356
407
  A program loads at the start of BASIC, `$0401`, and runs. A `.d80`, a
357
- `.d82` or a tape made for the PET starts a PET without `pet`, but a
408
+ `.d82`, a `.d67`, a `.d90` or a tape made for the PET starts a PET
409
+ without `pet`, but a
358
410
  program that loads at `$0401` starts a C64, since a VIC-20 with 3K loads
359
411
  there too. Disks go through the KERNAL traps on the IEEE-488 bus as
360
412
  device 8, or with `--true-drive` an emulated 2031 on the bus, which
361
- reads `.d64` and `.g64` images, and tapes play on cassette port 1. The keys type what the host's
413
+ reads `.d64` and `.g64` images, and an 8050 for a `.d80` or an 8250 for
414
+ a `.d82`. `--drive-type 8050` or `8250` plugs either in from the start,
415
+ and `--drive-type 1001` an SFD-1001, the single drive that takes the
416
+ 8250's disks, for a `.d82`. `--drive-type 4040` or `3040` puts a `.d64`
417
+ in a 4040 or a 3040 with DOS 2.1 in place of the 2031. A `.d67`, a DOS 1
418
+ disk, goes in a 2040 running DOS 1.2, the only DOS 1 there is an image
419
+ of, which takes `I0` before it reads a disk and `0:` before a file name,
420
+ and works from BASIC 2. The traps mount a `.d67` as they do the others.
421
+ A `.d90` hard disk image always goes in an emulated D9060 or D9090, by
422
+ its size, since the traps don't read one; `--drive-type 9060` or `9090`
423
+ picks the drive whatever the image's size. Its `N` skips the test
424
+ patterns the DOS writes over the whole disk, an hour on the hardware.
425
+ The pause menu's Drive 8 page lists the drive types under DRIVE TYPE,
426
+ and the one picked goes on the bus as device 8, with the disk device 8
427
+ had if it reads it. Tapes play on cassette port 1. The keys type what the host's
362
428
  keys type, on either keyboard, and `Alt` adds the PET's `SHIFT`:
363
429
  [Input](#input) lists the rest. The pause
364
430
  menu's Power page names the model, its RAM and its frame rate, and its
@@ -367,6 +433,133 @@ jumpers. The PET has no
367
433
  joysticks. `F11` and the Snapshots page save it as they do the others,
368
434
  but not for VICE.
369
435
 
436
+ ## The CBM-II
437
+
438
+ `badline cbm2` runs a CBM 610 of the B series, with BASIC 128 and 80
439
+ columns on a green screen, and takes programs, disks and cartridges:
440
+
441
+ ```sh
442
+ badline cbm2 # READY., in BASIC 128
443
+ badline cbm2 game.prg # Load and run a program
444
+ badline cbm2 game.d82 # Mount an 8250's disk as device 8 and load it
445
+ badline cbm2 game.crt # Put a cartridge in and start the machine
446
+ badline cbm2 --model 720 # A 720, with 256K and the 700's monitor
447
+ badline cbm2 --model 510 game.d82 # A P500, the CBM 510, on the VIC-II
448
+ ```
449
+
450
+ `--model` picks the machine: `610` (the default, 128K), `620` (256K,
451
+ with BASIC 256), `710` and `720` (the same with the 700's monitor and
452
+ character ROM, 25 rows of 14 lines). `--kernal 03b` fits the 1983
453
+ KERNAL, 901244-03b, in place of 901244-04a, the default, which VICE
454
+ runs too, and on a 610 or a 710 BASIC 128's 1983 release, 02b, with it. The machine runs on 50 Hz mains, and
455
+ `--60hz` on 60 Hz, which also sets a 600's jumper for its editor's
456
+ 60 Hz table. The mains is the system tick and the clock of the CIA's
457
+ time of day.
458
+
459
+ A program loads at the start of BASIC, `$0003` in segment 1, and runs.
460
+ Disks of every kind, `.d80` and `.d82` among them, go through the
461
+ KERNAL traps on the IEEE-488 bus as device 8, or with `--true-drive` an
462
+ emulated 2031 on the bus, which reads `.d64` and `.g64` images, and an
463
+ 8050 for a `.d80` or an 8250 for a `.d82`, and `--drive-type` names the
464
+ drive to start with, as on the PET. A 610's first `LOAD` from a
465
+ 2031 after power-on finds no file, as on xcbm2, and the second loads.
466
+ A `.d80` or `.d82` on its own starts a PET, so `cbm2` names the machine
467
+ for one, but a cartridge made for the CBM-II starts it without `cbm2`.
468
+ The cartridge goes in from the command line or Quick open. There is no
469
+ datasette. The SID plays through the host's audio device at
470
+ the machine's 2 MHz, as the C64's does. The keys type what the host's
471
+ keys type, as on the PET, and `Alt` with a key presses the keys the
472
+ host has none for: [Input](#input) lists them. The pause menu's Power
473
+ page names the model, its RAM, the mains and the KERNAL, and its
474
+ Expansion port page its RAM. The B series has no joysticks. `F11` and
475
+ the Snapshots page save it as they do the others, and `--vice` adds
476
+ xcbm2's modules, so xcbm2 opens the file too.
477
+
478
+ `--model 510` runs the P500, the CBM 510: the B series' CPU, SID, CIA,
479
+ ACIA and keyboard at about 1 MHz, with a VIC-II for 40 columns in
480
+ colour, 128K of RAM and its own KERNAL, 901234-02. `510` is PAL on
481
+ 50 Hz mains, and `510ntsc` NTSC on 60 Hz. A program loads at `$0003` in
482
+ segment 0. Its keys are the B series', and it has two joysticks on its
483
+ control ports: `Tab` switches the keys to them, as on the C64, and game
484
+ controllers drive them. The pause menu's Ports page plugs a 1351 mouse
485
+ or a pair of paddles into either port, as on the C64, and while the
486
+ keys type, says where its keys are.
487
+
488
+ ## The KIM-1
489
+
490
+ `badline kim1` runs a MOS KIM-1, the single-board computer of 1976,
491
+ with its 1K of RAM and the monitor in its 6530-002. The window shows its
492
+ six LED digits and its keypad, and the monitor starts on address 0000:
493
+
494
+ ```sh
495
+ badline kim1 # The monitor, on the keypad and display
496
+ badline kim1 --tty # The monitor on a teletype, in the window
497
+ badline kim1 --headless # The monitor on a teletype, in the terminal
498
+ badline game.ptp # Load a papertape and run it
499
+ badline kim1 --ram 5k game.bin # Load a .bin at $0200 on a board with 5K
500
+ ```
501
+
502
+ | Host key | KIM-1 key |
503
+ |----------|-----------|
504
+ | `0`-`9`, `A`-`F`, the keypad's digits | The hex keys |
505
+ | `,` | AD, address mode |
506
+ | `.` | DA, data mode |
507
+ | `Space`, `+`, the keypad's `+` | +, the next address |
508
+ | `G`, `Return`, `Enter` | GO |
509
+ | `P` | PC |
510
+ | `S`, `Esc` | ST, which stops a program |
511
+ | `R` | RS, reset |
512
+ | `T` | The SST switch, which steps a program an instruction at a time |
513
+
514
+ A click on a key the window draws presses it too. Each digit is lit
515
+ only while a program scans it, as on the board, so the monitor's
516
+ display is steady, a program that scans more slowly shows dimmer, and
517
+ one that doesn't scan leaves it dark. ST and SST work once the NMI
518
+ vector at `$17FA` holds `$1C00`, as the User Manual's section 4.1 sets
519
+ it up. The sound is U2's PB7, the tape output music programs toggle.
520
+ The pause menu's Panel page sets SST and the TTY/KB jumper, wires U3's
521
+ PB7, its timer's interrupt, to IRQ, and plays a speaker on U3's PA0 in
522
+ place of PB7.
523
+
524
+ With `--tty`, or the jumper on the Panel page, the monitor talks to a
525
+ teletype on its 20 mA loop instead, as the User Manual's section 2.6
526
+ describes, at `--baud`'s rate, 9600 by default. The window shows the
527
+ teletype's page, the host keys type on it, `Backspace` sends RUBOUT and
528
+ `Down` LINE FEED, and the board echoes what's typed, as its hardware
529
+ does. `--headless` puts the teletype on the terminal, until `Ctrl-C`.
530
+ After a reset the teletype sends RUBOUT for the monitor to time, and
531
+ then each character once the monitor has had time to take the last.
532
+
533
+ The KIM-1 loads MOS papertapes, `.ptp` and `.pap` files as the
534
+ monitor's `Q` command punches them, which start a KIM-1 without
535
+ `kim1`, and `.bin` files of bare bytes, at `--load-address`. The
536
+ program goes straight into RAM once the monitor runs, the NMI and IRQ
537
+ vectors at `$17FA` and `$17FE` are set to `$1C00`, so ST and `BRK`
538
+ stop it in the monitor, and the monitor starts it as you would: `AD`,
539
+ the address and `GO` on the keypad, or the address, a space and `G` on
540
+ the teletype. It starts where it loads unless `--start-address` says
541
+ otherwise, and with `--no-autostart` the monitor stops at that address.
542
+ `--tty-load` feeds a papertape through the monitor's `L` command
543
+ instead, as a teletype's tape reader would. A program that loads over
544
+ the monitor's own bytes at `$00EF`-`$00FF`, `$01F8`-`$01FF` or
545
+ `$17E7`-`$17FF` can't load that way on the board either.
546
+
547
+ The stock board has 1K of RAM at `$0000`-`$03FF`. `--ram 5k` fills
548
+ `$0400`-`$13FF` with RAM, as a board on the expansion connector does,
549
+ and `--ram expanded` adds `$2000`-`$DFFF` too, with the first 8K
550
+ repeated at `$E000`-`$FFFF` for the vectors, as most software beyond
551
+ the First Book of KIM needs. The KIM-1 saves snapshots as the others
552
+ do, without VICE's modules.
553
+
554
+ The pause menu's Datasette page is the KIM-1's cassette deck. INSERT,
555
+ Quick open, a drop or `badline kim1 tape.wav` puts a `.wav` recording of a
556
+ KIM tape in it, 8-bit or 16-bit, without starting anything, and DECK presses
557
+ PLAY, RECORD or STOP. The monitor's LOADT, at `$1873`, reads the tape
558
+ while it plays, and DUMPT, at `$1800`, writes it while it records, as the
559
+ User Manual's appendix E describes. A recording goes over the tape from
560
+ where the deck is, and STOP writes it to its `.wav`. With no tape in,
561
+ RECORD puts a new one in the `tapes` folder in badline's data folder.
562
+
370
563
  ## Snapshots
371
564
 
372
565
  `F11` quicksaves the whole machine to the next of five slots in
@@ -375,8 +568,8 @@ newest, even after badline has quit and started again. badline also
375
568
  autosaves every two minutes of play, and the pause menu's Snapshots page
376
569
  saves under a name and loads any of them. Snapshots from badline 0.14.0
377
570
  on load in every later version. They use VICE's `.vsf` format: badline
378
- opens those x64sc and xpet save, and x64sc and xpet open badline's saved
379
- with `--vice`.
571
+ opens those x64sc, xpet, xcbm2 and xcbm5x0 save, and they open
572
+ badline's saved with `--vice`.
380
573
  See [doc/snapshots.md](doc/snapshots.md) for where they're kept, what
381
574
  they hold and how far the two agree.
382
575
 
@@ -458,6 +651,31 @@ listing them too:
458
651
 
459
652
  On the PET `Tab` is a key, since there are no joysticks to switch to.
460
653
 
654
+ The CBM-II types the characters on the host's keys as the PET does, so
655
+ Shift and `'` type `"` with the CBM-II's `SHIFT` and `'`. `F9` and
656
+ `F10` keep opening the pause menu and muting, and `F12` is `RUN/STOP`
657
+ in place of loading a snapshot. Its keys without a character are here,
658
+ with the pause menu's Keyboard page listing them too:
659
+
660
+ | CBM-II | Host |
661
+ |--------|------|
662
+ | `ESC` | `Escape` |
663
+ | `RUN/STOP` | `F12` |
664
+ | `CLR/HOME` | `Home` |
665
+ | `INST/DEL` | `Backspace` |
666
+ | `TAB` | `Tab` |
667
+ | `CTRL` | `Ctrl` |
668
+ | `F1`-`F8` | `F1`-`F8` |
669
+ | `F9` / `F10` | `Alt` and `F9` / `F10` |
670
+ | `CRSR ←` / `→` / `↑` / `↓` | `Left` / `Right` / `Up` / `Down` |
671
+ | `←` | `_` or `` ` ``, and with `SHIFT` it's `\` |
672
+ | Keypad | The keypad, and `Alt` and `0` for `00` |
673
+ | `C=` | `Alt` and `C` |
674
+ | `CE` | `Alt` and `E` |
675
+ | `NORM/GRAPH` | `Alt` and `G` |
676
+ | `OFF/RVS` | `Alt` and `R` |
677
+ | `π` | `Alt` and `P` |
678
+
461
679
  `Tab` switches the keys between the C64 keyboard and the joysticks. The
462
680
  window title shows where they go, and any device plugged into a control
463
681
  port:
@@ -499,11 +717,11 @@ too.
499
717
  |------|---------------|
500
718
  | Snapshots | Quicksave, save under a name, load a named save, and the latest quicksaves and autosaves |
501
719
  | Drive 8 | The disk: insert, eject, the previous or next disk of its set, and whether it's writable |
502
- | Datasette | The tape: insert, eject, PLAY and REWIND |
720
+ | Datasette | The tape: insert, eject, PLAY and REWIND. On the KIM-1, its deck's PLAY, RECORD and STOP too |
503
721
  | Expansion port | The cartridge's name: a `.crt`'s own, or a raw image's file name. Insert, remove, and its freeze button if it has one. On the VIC-20, the cartridge and the RAM expansion |
504
- | Ports | The device in each control port, and where the keys go. On the PET, Keyboard: where its keys are |
722
+ | Ports | The device in each control port, and where the keys go. On the PET and the CBM-II's B series, Keyboard: where its keys are, and on the P500 also where its keys are while they type. On the KIM-1, Panel: SST, the TTY/KB jumper and U3's wiring |
505
723
  | Sound | Mute, and the SID's model |
506
- | Power | Reset, power cycle and quit, on a C128 its model and mode, and on a Plus/4 or a PET its model and RAM |
724
+ | Power | Reset, power cycle and quit, on a C128 its model and mode, on a Plus/4 or a PET its model and RAM, and on a CBM-II its model, RAM, mains and KERNAL |
507
725
 
508
726
  INSERT opens a file browser. A disk's set is the `.m3u` or `.vfl` list it
509
727
  was opened from, or one in its folder that lists it. Without one, it comes
@@ -537,8 +755,9 @@ in cartridge 1 as it does from the command line.
537
755
  - **REU**: the 1700, 1764 and 1750 and bigger units up to 16M
538
756
  (`--reu`), with DMA timed against the VIC's bad lines and sprites.
539
757
  - **Datasette**: `.tap` playback.
540
- - **VIC-20**: the 6502, the PAL 6561 VIC-I with its picture and sound,
541
- both 6522 VIAs, the keyboard, the joystick and RESTORE, RAM
758
+ - **VIC-20**: the 6502, the PAL 6561 and NTSC 6560 VIC-I with its
759
+ picture and sound and the 6560's interlaced fields' timing, both 6522
760
+ VIAs, the keyboard, the joystick and RESTORE, RAM
542
761
  expansions up to 35K (`--ram`), cartridges, the datasette and the
543
762
  serial bus to device 8 (`badline vic20`).
544
763
  - **C128**: C128 mode with BASIC 7.0 and C64 mode, on the 8502 with its
@@ -557,9 +776,29 @@ in cartridge 1 as it does from the command line.
557
776
  with BASIC 1, 2 or 4, the discrete video and the 6545 CRTC on 40 and 80
558
777
  columns, both 6520 PIAs and the 6522 VIA, the graphics and business
559
778
  keyboards, the sound on the VIA's CB2, the 8096's 64K board, the
560
- 8296's 128K with its jumpers, RA4 and 4K character ROM, both
779
+ 8296's 128K with its jumpers, RA4 and 4K character ROM, the
780
+ SuperPET's bank RAM, latches, ACIA, 6702 and 6809 with the Waterloo
781
+ languages loading from disk, both
561
782
  cassette ports and device 8 on the IEEE-488 bus through the KERNAL
562
- traps, `.d80` and `.d82` among its disks (`badline pet`).
783
+ traps, `.d80` and `.d82` among its disks, and the D9060 and D9090
784
+ hard disks on `.d90` images (`badline pet`).
785
+ - **CBM-II**: the B series' 610, 620, 710 and 720, with the 6509 at
786
+ 2 MHz and its sixteen segments, 128K or 256K of RAM, BASIC 128 or 256
787
+ with KERNAL 04a or 03b, the 6845 CRTC on 80 columns, the SID, the
788
+ 6526 CIA, the 6551 ACIA, both 6525 TPIs, the keyboard, the 50 or 60 Hz
789
+ mains, cartridges, and device 8 on the IEEE-488 bus through the
790
+ KERNAL traps (`badline cbm2`).
791
+ - **P500**: the CBM 510, PAL and NTSC, with the B series' 6509, SID,
792
+ CIA, ACIA and TPIs at the VIC-II's clock, the VIC-II on the P500's
793
+ video bus, 128K of RAM, the keyboard, both joysticks, a 1351 mouse or
794
+ paddles on either port, and device 8
795
+ on the IEEE-488 bus through the KERNAL traps
796
+ (`badline cbm2 --model 510`).
797
+ - **KIM-1**: the 6502 at 1 MHz, 1K, 5K or 53K of RAM, the two 6530 RRIOTs with
798
+ the monitor's and the tape routines' ROMs, the keypad and the six
799
+ multiplexed LED digits, the SST switch, ST and RS, PB7's sound, the
800
+ teletype on its 20 mA loop, papertape and `.bin` programs, and the
801
+ cassette as `.wav` (`badline kim1`).
563
802
  - **2031**: the PET's single drive, the 1541's board and DOS 2.6 on the
564
803
  IEEE-488 bus, with the bus's handshake on every line
565
804
  (`badline pet --true-drive`).
data/doc/media.md CHANGED
@@ -15,8 +15,11 @@ the directory of any medium mounted there, as a 1541 does.
15
15
  The command channel answers `I`, `B-P` and `U1` block reads, which
16
16
  covers loaders that read blocks directly. On a writable disk image it
17
17
  also takes `SAVE` (with `@0:` to replace a file), files opened for
18
- writing or appending, `S` to scratch, `U2` and `B-W` block writes, and
19
- `B-A` and `B-F`. It doesn't rename, copy, format or validate disks.
18
+ writing or appending, `S` to scratch, `U2` and `B-W` block writes,
19
+ `B-A` and `B-F`, `N` to format the disk (or, without an ID, clear it),
20
+ `R` to rename a file and `C` to copy or join files, with the reports a
21
+ 2031 or 8050 gives. It acts as a single drive, so it doesn't duplicate
22
+ or copy whole disks (`D`, `C1=0`), and it doesn't validate disks.
20
23
  Loaders that upload their own code to the drive with `M-W` and `M-E`,
21
24
  and copy protection that reads raw GCR, won't work there, but do on a
22
25
  true drive.
@@ -50,6 +50,12 @@ only catches the rows that happen to move.
50
50
  - [`.sid` tune banking](#sid-tune-banking)
51
51
  - [PET discrete video](#pet-discrete-video)
52
52
  - [PET CRTC](#pet-crtc)
53
+ - [CBM-II DRAM refresh](#cbm-ii-dram-refresh)
54
+ - [6509 indirection segment](#6509-indirection-segment)
55
+ - [KIM-1 single step](#kim-1-single-step)
56
+ - [6809 dead cycles](#6809-dead-cycles)
57
+ - [6809 interrupts, SYNC, CWAI, HALT and reset](#6809-interrupts-sync-cwai-halt-and-reset)
58
+ - [6809 undocumented opcodes](#6809-undocumented-opcodes)
53
59
 
54
60
  ## CPU interrupt recognition
55
61
 
@@ -2214,6 +2220,21 @@ testprogs named.
2214
2220
  - Spec guard: *past an R1 it missed*, *repeats a row*, *past an R9 it
2215
2221
  missed* and *past an R6 it missed* in
2216
2222
  [`chips/crtc_spec.rb`](../spec/badline/chips/crtc_spec.rb).
2223
+ - The R5 lines of vertical adjust end no row: the line counter counts
2224
+ them from 0 to R5, and passing R9 neither restarts it nor moves the
2225
+ next row's start, so every adjust line starts where the last row left
2226
+ off. The datasheets (MOS 6545-1, sheets 7-11) give R5 as extra scan
2227
+ lines to complete the frame, apart from the R4 rows, and the address
2228
+ sequence of their figure 4 moves on only per row. The 8032's 901474-04
2229
+ editor dated 0283 sets R5 above R9 (16 lines against 9-line rows, 17
2230
+ against 8 in graphics mode) and its 313-line frame runs on real 8032s,
2231
+ so passing R9 can't end a row there, and the same compare moving the
2232
+ start would be a row end that doesn't happen. xpet's black box agrees.
2233
+ Only a frame whose display runs on through the adjust (R6 past R4)
2234
+ shows it; no editor's does, and the PET has no light pen wired.
2235
+ - Not pinned by a test row: no testbench row runs the 0283 editor.
2236
+ - Spec guard: *with a vertical adjust longer than a row* in
2237
+ [`chips/crtc_spec.rb`](../spec/badline/chips/crtc_spec.rb).
2217
2238
  - The picture is framed as xpet frames its screenshots: R1's characters
2218
2239
  in the middle of 704 dots (80 columns) or 384 (40); each character as
2219
2240
  far right as it comes after its line's horizontal sync, so lines whose
@@ -2229,3 +2250,171 @@ testprogs named.
2229
2250
  cycle dot for dot.
2230
2251
  - Spec guard:
2231
2252
  [`pet/crtc_video_spec.rb`](../spec/badline/pet/crtc_video_spec.rb).
2253
+
2254
+ ## CBM-II DRAM refresh
2255
+
2256
+ - The B series' DRAM refresh takes the 6509's clock away for one cycle:
2257
+ a counter of the CPU's cycles asks for a refresh once it reaches 20
2258
+ and stops there, the refresh comes on the next opcode fetch, which it
2259
+ holds off a cycle, and it clears the counter. A JMP loop, fetching
2260
+ every third cycle, loses one cycle in 22. Read off sheet 3 of
2261
+ schematic 8256043 (U89, U88 and U55: the request at count 20, gated
2262
+ with SYNC, clocked by SPhi1, driving RDY and REFEN) and sheet 2 (REFEN
2263
+ clearing the CPU's phi2 flip-flop U57).
2264
+ - Pinned by `CBM2/cbm2-burnin.d80`'s 6526 timer test, which starts
2265
+ timer A at $8888 and counts a 12-cycle loop until its interrupt
2266
+ flag rises, and passes only at exactly 10 pages and $DB: 2,779
2267
+ loops. Without the refresh badline counts 2,895, and stealing a
2268
+ cycle in every 24 or 25, or five a line, misses by one or more.
2269
+ xcbm2, which steals nothing, shows the cell BAD.
2270
+ - Spec guard: *takes a cycle for the DRAM's refresh* in
2271
+ [`cbm2_spec.rb`](../spec/badline/cbm2_spec.rb).
2272
+
2273
+ ## 6509 indirection segment
2274
+
2275
+ - LDA (zp),Y and STA (zp),Y take the indirection segment for every
2276
+ access at the address they index: the dummy read before the data, as
2277
+ well as the data. The opcode and the zero-page pointer stay in the
2278
+ execution segment.
2279
+ - Pinned by `CBM2/cbm2-burnin.d80`'s 6526 TOD test. It sets the time
2280
+ with STA (zp),Y into segment 15, hours first, polls the tenths until
2281
+ they leave the value written, then checks the tenths, seconds,
2282
+ minutes and hours against the time one tenth on, which leaves the
2283
+ clock latched. In the run that steps the seconds from 01:00:01.9,
2284
+ each step starts latched at the previous step's result, tenths 0,
2285
+ and with that latch held the first poll reads the stale 0, matches
2286
+ the expected tenths and fails on the live seconds, one short. The
2287
+ store's dummy read of the tenths releases the latch before they are
2288
+ written. With the dummy read in the execution segment it reads RAM,
2289
+ and the burn-in's grid grades $FF.
2290
+ - The CIA keeps its latch through writes: `CIA/ciavarious/cia15.prg`'s
2291
+ test B sets X:59:59.8 with absolute stores, hours first, after
2292
+ reading the hours, and its reference has the hour unchanged for odd
2293
+ X, where the first wait reads the stale latched tenths 0 and falls
2294
+ through. A write to the tenths that released the latch fails it.
2295
+ - Spec guard: *makes STA (zp),Y's dummy read in the indirection
2296
+ segment* in [`cbm2/cpu_spec.rb`](../spec/badline/cbm2/cpu_spec.rb).
2297
+
2298
+ ## KIM-1 single step
2299
+
2300
+ - With the SST switch on, the board pulls NMI through each opcode fetch
2301
+ outside K7 ($1C00-$1FFF and its mirrors), and the CPU takes it at the
2302
+ end of the instruction that fetch starts, a 2-cycle one included: the
2303
+ board raises the NMI latch ahead of the fetch cycle's poll, so the
2304
+ sample the boundary commits, the one from the second-to-last cycle,
2305
+ holds it. The pull on the cycle that starts the interrupt sequence is
2306
+ taken up by the same NMI.
2307
+ - Pinned by the KIM-1 User Manual's figure 5.6, which single-steps the
2308
+ sample program of figure 5.4 from $0200: the display shows 0202 after
2309
+ the first GO, the 2-cycle LDA #$01, and 020F after TAX. With the
2310
+ latch raised a cycle later, after the fetch cycle has polled, NMI
2311
+ waits an instruction more and the first GO shows 0205.
2312
+ - The monitor's display scan, SCANDS ($1F1F) and the key scan AK
2313
+ ($1EFE) in its idle loop, repeats every 4,258 cycles, and lights the
2314
+ six digits 676, 687, 676, 687, 676 and 657 cycles each. That follows
2315
+ from the ROM and the 6502 core's cycle counts, which SingleStepTests
2316
+ checks, not from a test of the board.
2317
+ - Spec guards: *takes the NMI single-step pulls right after a 2-cycle
2318
+ instruction* in [`kim1/cpu_spec.rb`](../spec/badline/kim1/cpu_spec.rb),
2319
+ and *figure 5.6* and *scans the six digits every 4,258 cycles* in
2320
+ [`kim1_spec.rb`](../spec/badline/kim1_spec.rb).
2321
+
2322
+ ## 6809 dead cycles
2323
+
2324
+ 6809 dead cycles follow the MC6809E flowcharts, not MAME. The
2325
+ neetandev/m6809 vectors (`rake test`) are MAME's, and on these dead
2326
+ ("Don't Care") cycles they read another address than Figure 17 of the
2327
+ MC6809E datasheet gives. The core reads the datasheet's address, and the
2328
+ runner checks each of these cycles against it, through the rules in
2329
+ [`m6809_divergences.rb`](../test/support/m6809_divergences.rb). Every
2330
+ other cycle, and every cycle count but X18's, is the vectors'.
2331
+
2332
+ - A read-modify-write (NEG, COM, LSR, ROR, ASR, ASL, ROL, DEC, INC, CLR
2333
+ and the undocumented aliases, in memory) reads `$FFFF` between its read
2334
+ and its write, where the vectors read PC. Pinned by MC6809E Fig. 17
2335
+ sheet 5 and the datasheet's DEC extended example.
2336
+ - ADDD, SUBD, CMPD, CMPX, CMPY, CMPU, CMPS and the undocumented XADDD and
2337
+ XADDU end on a dead read of `$FFFF`, where the vectors read PC. Pinned
2338
+ by MC6809E Fig. 17 sheet 5.
2339
+ - JSR's first dead cycle after its address reads the subroutine's
2340
+ address, where the vectors read PC. BSR and LBSR read it on the dead
2341
+ cycle before their last `$FFFF`, where the vectors read `$FFFF`. Pinned
2342
+ by MC6809E Fig. 17 sheets 1 and 5 and the datasheet's LBSR example.
2343
+ - RTS ends on a dead read of `$FFFF`, where the vectors read the stack.
2344
+ Pinned by MC6809E Fig. 17 sheet 2.
2345
+ - TSTA and TSTB read NNNN+1 after the opcode, as every one-byte inherent
2346
+ opcode does, where the vectors read `$FFFF`. Pinned by MC6809E Fig. 17
2347
+ sheet 2.
2348
+ - Indexed: an 8-bit offset from R is followed by a dead read of `$FFFF`,
2349
+ where the vectors read PC. A 16-bit offset from R or PC, a D offset and
2350
+ extended indirect read NNNN+4 (NNNN+5 after a prefix) on the cycle
2351
+ after the offset, where the vectors read `$FFFF`. Pinned by MC6809E
2352
+ Fig. 17 sheet 4.
2353
+ - Spec guard: *dead cycles* in
2354
+ [`m6809_spec.rb`](../spec/badline/chips/m6809_spec.rb).
2355
+
2356
+ ## 6809 interrupts, SYNC, CWAI, HALT and reset
2357
+
2358
+ The vectors leave these out. The core follows the MC6809E datasheet, and
2359
+ reyco2000's `6809_interrupt_test` and `6809_cycle_test`
2360
+ (`rake test`) pass on it.
2361
+
2362
+ - The lines are sampled once a cycle, and an instruction boundary sees the
2363
+ sample of two cycles before: IRQ or FIRQ asserted on an instruction's
2364
+ next-to-last cycle is taken once it ends, and on its last cycle only
2365
+ after the next instruction. NMI is an edge, latched until taken, and
2366
+ ignored until a program loads S after reset (LDS, LEAS, TFR or EXG
2367
+ into S, PULU S). Pinned by MC6809E Figs. 8 and 9.
2368
+ - IRQ and NMI take 19 cycles from the cycle that would have fetched the
2369
+ opcode: PC twice, `$FFFF`, the 12 bytes from PC low to CC with E set,
2370
+ `$FFFF`, the vector, `$FFFF`. FIRQ takes 10, stacking PC and CC with E
2371
+ clear. The masks take effect as the vector's first byte is read. Pinned
2372
+ by MC6809E Figs. 8 and 9.
2373
+ - SYNC reads NNNN+1 and then leaves the bus alone until any interrupt line
2374
+ is asserted, masked or not, and for one cycle more. A masked interrupt
2375
+ goes on to the next instruction; an unmasked one runs its usual
2376
+ sequence. Pinned by MC6809E Fig. 16 and Fig. 17 sheet 2.
2377
+ - CWAI reads its operand, NNNN+2 and `$FFFF`, ANDs CC with the operand,
2378
+ sets E, stacks all 12 bytes, then reads `$FFFF` until an interrupt it
2379
+ may take comes, and reads that interrupt's vector and `$FFFF`: 20
2380
+ cycles when the interrupt is already there. Pinned by MC6809E Fig. 17
2381
+ sheet 2.
2382
+ - HALT stops the CPU at the next instruction boundary, sampled as IRQ is,
2383
+ and leaves the bus alone until it is released.
2384
+ - After RESET the CPU reads `$FFFE` twice, the vector at `$FFFE` and
2385
+ `$FFFF`, and `$FFFF`, and fetches its first opcode on the sixth cycle.
2386
+ It masks FIRQ and IRQ and clears DP. Pinned by MC6809E Fig. 6.
2387
+ - Spec guard: [`m6809_spec.rb`](../spec/badline/chips/m6809_spec.rb).
2388
+
2389
+ ## 6809 undocumented opcodes
2390
+
2391
+ The undocumented opcodes follow David Banks' "Undocumented 6809
2392
+ Behaviours" (github.com/hoglet67/6809Decoder/wiki), which was checked on
2393
+ real chips, where it and the vectors (MAME's) disagree. The runner checks
2394
+ these cases against the rules in
2395
+ [`m6809_divergences.rb`](../test/support/m6809_divergences.rb).
2396
+
2397
+ - X18 (`$18`) takes 3 cycles, where the vectors take 2, and sets V to
2398
+ (C AND bit 0) OR (Z AND bit 2) of the byte after the opcode, where the
2399
+ vectors take Z alone. Banks doesn't give the third cycle's address; the
2400
+ core reads `$FFFF`. Pinned by Banks, X18.
2401
+ - XADDU adds the operand to U OR `$FF00`, where the vectors add U. Pinned
2402
+ by Banks, XADDU.
2403
+ - DAA sets V to C XOR bit 7 of the result, where the vectors (and the
2404
+ datasheet) clear it. Pinned by Banks, Undefined values of the Overflow
2405
+ Flag.
2406
+ - The stores immediate set N and clear Z and V when prefixed. Unprefixed,
2407
+ N, Z and V hang on the group of the instruction before (CMPA and BITA;
2408
+ LDA and LDD; the A arithmetic and logic; the A shifts, DEC, INC, NEG,
2409
+ COM, TSTA, DAA and SUBD; SEX; the 16-bit compares and XADDD/XADDU; LEA;
2410
+ anything else). The 16-bit ones also clear Z unless the register's low
2411
+ byte is 0. The vectors set N and Z from the register and clear V. The
2412
+ vectors start every case after no instruction, the "anything else"
2413
+ group: N set, Z and V clear. Pinned by Banks, Store Immediate and Flags
2414
+ for unprefixed Store Immediate.
2415
+ - What the vectors leave out also comes from Banks: `$14`, `$15` and `$CD`
2416
+ read on from PC, a byte a cycle, until reset; a chain of `$10` and `$11`
2417
+ prefixes takes the first, a cycle for each; an opcode page 2 or 3
2418
+ doesn't define runs as on page 1, a cycle later.
2419
+ - Spec guard: *the flags of the unprefixed stores immediate* in
2420
+ [`m6809_spec.rb`](../spec/badline/chips/m6809_spec.rb).