badline 0.16.1 → 0.17.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 (143) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -0
  3. data/CLAUDE.md +1 -1
  4. data/README.md +102 -12
  5. data/doc/media.md +5 -2
  6. data/doc/pinned-behaviour.md +61 -0
  7. data/doc/snapshot-format.md +376 -69
  8. data/doc/snapshots.md +148 -14
  9. data/lib/badline/cbm2/acia.rb +10 -0
  10. data/lib/badline/cbm2/bus.rb +263 -0
  11. data/lib/badline/cbm2/cpu.rb +58 -0
  12. data/lib/badline/cbm2/crtc_video.rb +133 -0
  13. data/lib/badline/cbm2/ieee_drive.rb +18 -0
  14. data/lib/badline/cbm2/ieee_layout.rb +69 -0
  15. data/lib/badline/cbm2/ieee_ports.rb +104 -0
  16. data/lib/badline/cbm2/ieee_traps.rb +81 -0
  17. data/lib/badline/cbm2/keyboard_ports.rb +60 -0
  18. data/lib/badline/cbm2/keyed_modules.rb +67 -0
  19. data/lib/badline/cbm2/keyed_state.rb +91 -0
  20. data/lib/badline/cbm2/model.rb +44 -0
  21. data/lib/badline/cbm2/p500/control_ports.rb +80 -0
  22. data/lib/badline/cbm2/p500/ieee_layout.rb +41 -0
  23. data/lib/badline/cbm2/p500/keyed_state.rb +85 -0
  24. data/lib/badline/cbm2/p500/model.rb +39 -0
  25. data/lib/badline/cbm2/p500/pages.rb +57 -0
  26. data/lib/badline/cbm2/p500.rb +262 -0
  27. data/lib/badline/cbm2/sid_page.rb +19 -0
  28. data/lib/badline/cbm2.rb +267 -0
  29. data/lib/badline/{plus4 → chips}/acia/frames.rb +1 -1
  30. data/lib/badline/chips/acia/keyed_state.rb +47 -0
  31. data/lib/badline/chips/acia.rb +307 -0
  32. data/lib/badline/chips/crtc.rb +3 -2
  33. data/lib/badline/chips/riot/fast_forward.rb +72 -0
  34. data/lib/badline/chips/riot/keyed_parts.rb +69 -0
  35. data/lib/badline/chips/riot/timer.rb +80 -0
  36. data/lib/badline/chips/riot.rb +162 -0
  37. data/lib/badline/chips/rriot/keyed_state.rb +30 -0
  38. data/lib/badline/chips/rriot.rb +132 -0
  39. data/lib/badline/chips/tpi/keyed_state.rb +38 -0
  40. data/lib/badline/chips/tpi.rb +233 -0
  41. data/lib/badline/chips/vic/bank.rb +60 -5
  42. data/lib/badline/chips/vic/sprite.rb +4 -3
  43. data/lib/badline/drives/datasette/keyed_state.rb +9 -1
  44. data/lib/badline/drives/datasette.rb +27 -3
  45. data/lib/badline/drives/model8050/disk.rb +163 -0
  46. data/lib/badline/drives/model8050/fdc_bus.rb +102 -0
  47. data/lib/badline/drives/model8050/idle.rb +177 -0
  48. data/lib/badline/drives/model8050/ieee_port.rb +147 -0
  49. data/lib/badline/drives/model8050/ip_bus.rb +93 -0
  50. data/lib/badline/drives/model8050/keyed_state.rb +160 -0
  51. data/lib/badline/drives/model8050/mechanism.rb +230 -0
  52. data/lib/badline/drives/model8050/parts.rb +37 -0
  53. data/lib/badline/drives/model8050.rb +243 -0
  54. data/lib/badline/frontend/app.rb +10 -3
  55. data/lib/badline/frontend/boot.rb +1 -1
  56. data/lib/badline/frontend/controls.rb +51 -15
  57. data/lib/badline/frontend/gamepads.rb +3 -3
  58. data/lib/badline/frontend/keys.rb +61 -2
  59. data/lib/badline/frontend/media_slots.rb +1 -1
  60. data/lib/badline/frontend/menu/menu_media.rb +14 -11
  61. data/lib/badline/frontend/menu/menu_pages.rb +18 -4
  62. data/lib/badline/frontend/menu/menu_ports.rb +40 -4
  63. data/lib/badline/frontend/menu/pause_menu.rb +1 -1
  64. data/lib/badline/frontend/pet_keyboard.rb +23 -7
  65. data/lib/badline/frontend/timeline.rb +19 -10
  66. data/lib/badline/kernal_trap/dos/disk_commands.rb +80 -0
  67. data/lib/badline/kernal_trap/dos/status.rb +3 -0
  68. data/lib/badline/kernal_trap/dos.rb +18 -5
  69. data/lib/badline/kernal_trap/ieee.rb +4 -2
  70. data/lib/badline/kernal_trap/ieee_layout.rb +95 -43
  71. data/lib/badline/machine/ieee_drives.rb +194 -0
  72. data/lib/badline/machine/settling.rb +4 -0
  73. data/lib/badline/machine.rb +23 -6
  74. data/lib/badline/media/cbm2_media.rb +29 -0
  75. data/lib/badline/media/program.rb +6 -3
  76. data/lib/badline/media/true_drive.rb +38 -9
  77. data/lib/badline/media.rb +15 -6
  78. data/lib/badline/options/family.rb +15 -3
  79. data/lib/badline/options/help.rb +16 -2
  80. data/lib/badline/options/table.rb +18 -4
  81. data/lib/badline/options/validation.rb +27 -3
  82. data/lib/badline/options.rb +21 -7
  83. data/lib/badline/pet/cassettes.rb +22 -1
  84. data/lib/badline/pet/ieee_drive.rb +5 -64
  85. data/lib/badline/pet/ieee_ports.rb +7 -0
  86. data/lib/badline/pet.rb +15 -4
  87. data/lib/badline/plus4/acia.rb +4 -298
  88. data/lib/badline/plus4/keyed_parts.rb +0 -44
  89. data/lib/badline/plus4.rb +1 -0
  90. data/lib/badline/roms/8050/dos-2.7.rom +0 -0
  91. data/lib/badline/roms/8050/fdc-901869-01.rom +0 -0
  92. data/lib/badline/roms/8050/fdc-901885-04.rom +0 -0
  93. data/lib/badline/roms/README +111 -0
  94. data/lib/badline/roms/cbm2/basic128-02b.rom +0 -0
  95. data/lib/badline/roms/cbm2/basic128.rom +0 -0
  96. data/lib/badline/roms/cbm2/basic256.rom +0 -0
  97. data/lib/badline/roms/cbm2/characters-600.rom +0 -0
  98. data/lib/badline/roms/cbm2/characters-700.rom +0 -0
  99. data/lib/badline/roms/cbm2/kernal-03b.rom +0 -0
  100. data/lib/badline/roms/cbm2/kernal-04a.rom +0 -0
  101. data/lib/badline/roms/cbm2/p500-basic.rom +0 -0
  102. data/lib/badline/roms/cbm2/p500-kernal.rom +0 -0
  103. data/lib/badline/snapshot/cbm2_setup.rb +53 -0
  104. data/lib/badline/snapshot/container.rb +7 -2
  105. data/lib/badline/snapshot/field_doc/markdown.rb +4 -2
  106. data/lib/badline/snapshot/field_doc.rb +38 -3
  107. data/lib/badline/snapshot/image.rb +62 -9
  108. data/lib/badline/snapshot/vice/cbm2.rb +93 -0
  109. data/lib/badline/snapshot/vice/cbm2_acia.rb +75 -0
  110. data/lib/badline/snapshot/vice/cbm2_crtc.rb +127 -0
  111. data/lib/badline/snapshot/vice/cbm2_mains.rb +49 -0
  112. data/lib/badline/snapshot/vice/cbm2_mem.rb +75 -0
  113. data/lib/badline/snapshot/vice/cbm2_restore.rb +204 -0
  114. data/lib/badline/snapshot/vice/cbm2_tpi.rb +58 -0
  115. data/lib/badline/snapshot/vice/cias.rb +13 -9
  116. data/lib/badline/snapshot/vice/p500.rb +96 -0
  117. data/lib/badline/snapshot/vice/p500_restore.rb +130 -0
  118. data/lib/badline/snapshot/vice/p500_vicii.rb +166 -0
  119. data/lib/badline/snapshot/vice/pet.rb +7 -3
  120. data/lib/badline/snapshot/vice/pet_cpu.rb +5 -2
  121. data/lib/badline/snapshot/vice/pet_crtc.rb +10 -15
  122. data/lib/badline/snapshot/vice/pet_drive.rb +180 -0
  123. data/lib/badline/snapshot/vice/pet_drive8050.rb +216 -0
  124. data/lib/badline/snapshot/vice/pet_restore.rb +70 -6
  125. data/lib/badline/snapshot/vice/pet_via.rb +6 -5
  126. data/lib/badline/snapshot/vice/sid_registers.rb +2 -1
  127. data/lib/badline/snapshot/vice/vicii_import.rb +10 -6
  128. data/lib/badline/snapshot/vice.rb +3 -0
  129. data/lib/badline/snapshot.rb +11 -3
  130. data/lib/badline/storage/crt_file.rb +7 -1
  131. data/lib/badline/storage/d64_image.rb +7 -0
  132. data/lib/badline/storage/d80_image.rb +17 -1
  133. data/lib/badline/storage/d81_image.rb +14 -0
  134. data/lib/badline/storage/disk_image/bam.rb +18 -3
  135. data/lib/badline/storage/disk_image/formatting.rb +69 -0
  136. data/lib/badline/storage/disk_image/writing.rb +35 -0
  137. data/lib/badline/storage/disk_image.rb +2 -0
  138. data/lib/badline/storage.rb +1 -0
  139. data/lib/badline/support/cbm2_checkpoint.rb +48 -0
  140. data/lib/badline/support/p500_checkpoint.rb +35 -0
  141. data/lib/badline/version.rb +1 -1
  142. data/lib/badline.rb +1 -0
  143. metadata +72 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e6b53df8a82bbf9f9524441b6d948fb245c0e81c589757dcd23b7e69fbd4c69
4
- data.tar.gz: 83e5a043f2a09ed982663e1df4a0f4e2c5483791417fd1220785dab8d0e39d42
3
+ metadata.gz: 0da2c8736f994b6f50c665b7bd8fdd6a1e311df953b16b0d7a09eb833771f96a
4
+ data.tar.gz: a9922d7605a40eb98862e08c724ff7552a8e56d26662b95eb49b0fa954a9a9f5
5
5
  SHA512:
6
- metadata.gz: f739ad0afd029d46648ceff8307e010ca6290e4c8951175e30c70e08ec11385dba966c79ebd2d3d5a93e52db922b0362b45239825e3f42e750ee4f0fe56589a5
7
- data.tar.gz: d5e22aa87453b2446e2d5c2168f99076e4a950a753022fd5dc5946fb56ababc156bcda2b0d57ed1e90a923dee9d693c7040187f4475d8c1a6e50afa5346ca7e3
6
+ metadata.gz: 7cb8eb2574f2816cd5eba6ac3077819583869dd5c60badec24cd3ef2e0d145ae0729c51268cbe47fd3b7781be1a0700415b26309c9eb3eb175e51bd8c799b858
7
+ data.tar.gz: fd843b8b309c535c679c074801be2240e6e13c3ff65b671635c3a4d138808d048e73ce7802eabec3746d4e7154391757537e17e6ae30d91113c5df585a9c603a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.17.0](https://github.com/elektronaut/badline/compare/v0.16.1...v0.17.0) (2026-10-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * add the 6525 TPI ([5ff88b4](https://github.com/elektronaut/badline/commit/5ff88b420bdffaf0179e1a254416755bb0cc6d64))
9
+ * add the 6530 RRIOT as a bare chip, with the 8050's masks ([9d91534](https://github.com/elektronaut/badline/commit/9d915346a031d186db706f80ca644b5d63dcea7c))
10
+ * add the 6532 RIOT as a bare chip ([76634e5](https://github.com/elektronaut/badline/commit/76634e56584c452e7bba2849d7c7d4f0468515e4))
11
+ * add the 8050 and 8250's board, booting both processors ([841ade8](https://github.com/elektronaut/badline/commit/841ade887cb047ccc45f13fba74fe9a24ab4c74e))
12
+ * add the 8050 and 8250's drives, reading and writing .d80 and .d82 images ([6e05a3e](https://github.com/elektronaut/badline/commit/6e05a3e6da8e9fd4addfad972bfe4f9d5593aac8))
13
+ * add the CBM-II's 6509 and its segment bus ([59e114b](https://github.com/elektronaut/badline/commit/59e114b3a9913d2c1f5f50e46410657a1c8b5292))
14
+ * boot the CBM-II's B series to READY, headless ([586c699](https://github.com/elektronaut/badline/commit/586c6997b6e0384641c98cc07a48e252ed92cce7))
15
+ * boot the P500 and run its testbench rows ([0f02bd0](https://github.com/elektronaut/badline/commit/0f02bd07f75ff0a4e9832370a8b98b2985cad84b))
16
+ * boot the P500 to READY, headless ([cbd9b29](https://github.com/elektronaut/badline/commit/cbd9b296d41ebc2b302a2b5bff02cf30a68c83f5))
17
+ * bundle the 8050 and 8250's DOS 2.7 ([0889ccc](https://github.com/elektronaut/badline/commit/0889ccc6297246ffc7ccb0acf025d8aa44c560f4))
18
+ * bundle the 8050 controller's 6530 mask ROMs ([3ac2932](https://github.com/elektronaut/badline/commit/3ac293218676d33cc09656cb9ae2e52357896171))
19
+ * bundle the CBM-II ROMs ([beca63a](https://github.com/elektronaut/badline/commit/beca63aca091a4dd86f9e262b5d3105977839c32))
20
+ * fetch a sprite's phi2 bytes over the P500's video bus ([0079ef4](https://github.com/elektronaut/badline/commit/0079ef4b8572c14adcf5e27dc6e90e426e124030))
21
+ * format, rename and copy on the virtual DOS ([46d49a5](https://github.com/elektronaut/badline/commit/46d49a553d5ff9ea564dc8c6d421b8dd0fac945f))
22
+ * let the CBM-II's bus take a P500's screen and video pages ([d57648c](https://github.com/elektronaut/badline/commit/d57648cc53f40afbf6a80f96b7c11aaae5f75881))
23
+ * map a true 2031 to and from xpet's .vsf ([06e8725](https://github.com/elektronaut/badline/commit/06e87257aeac59a5b8471cfaf9be3c0fbd6903b6))
24
+ * paint the CBM-II's B series picture from its 6845 ([1033f06](https://github.com/elektronaut/badline/commit/1033f06071566166b59d9508ba8b1bf33ee4d3df))
25
+ * plug a mouse or paddles into the P500's ports in the window ([d25dc30](https://github.com/elektronaut/badline/commit/d25dc302bce0d2d654c64de48add9971c96061c1))
26
+ * put an 8050 or 8250 on the PET's IEEE-488 bus for a .d80 or .d82 ([9a7ff9a](https://github.com/elektronaut/badline/commit/9a7ff9a78439fd4fae4b4765da85e26b14c66cdb))
27
+ * put the CBM-II's IEEE-488 ports on the bus for a true 2031, 8050 or 8250 ([f1906bb](https://github.com/elektronaut/badline/commit/f1906bbd0b89fe5b27783fda1ac5beee31ce4c60))
28
+ * put the P500's IEEE-488 ports on the bus, and let --true-drive reach the CBM-II ([1228a6b](https://github.com/elektronaut/badline/commit/1228a6b3ad8800a7b14a76ce2ae878ff7869f16e))
29
+ * read and write a PET's 8050 or 8250 in xpet's .vsf ([618397c](https://github.com/elektronaut/badline/commit/618397c8d11023ea7a6c7b339cc3fa80ff2352d3))
30
+ * read and write the CBM-II's B series in xcbm2's .vsf ([b56cc71](https://github.com/elektronaut/badline/commit/b56cc71064442c5e354e9415f1a5bec6110e1950))
31
+ * read and write the CBM-II's true drives in xcbm2's and xcbm5x0's .vsf ([7975d43](https://github.com/elektronaut/badline/commit/7975d4312a77ddb16565b95002c3928623d3b906))
32
+ * read and write the P500 in xcbm5x0's .vsf ([ebe273f](https://github.com/elektronaut/badline/commit/ebe273f7ed7a571cbe42fda822875c24afe0efde))
33
+ * read the P500's paddles through the SID and its light pen on PA6 ([40361cd](https://github.com/elektronaut/badline/commit/40361cdb3f5a2229ce523e45912522fff07d0580))
34
+ * read the P500's video bus in the VIC's bank ([4cddf8c](https://github.com/elektronaut/badline/commit/4cddf8c55e39373c00bb26218dc70966797a05a8))
35
+ * recognise CBM-II cartridge images ([125419c](https://github.com/elektronaut/badline/commit/125419ce1d40a2c1943f6629397a125031bbf2d2))
36
+ * register the CBM-II family, refused until it boots ([c90d9a4](https://github.com/elektronaut/badline/commit/c90d9a4f06496e1f9b08781989bcb5bbe7350b3d))
37
+ * run the CBM-II's B series in the window, with its keys, KEYBOARD page and Power page ([41045ef](https://github.com/elektronaut/badline/commit/41045efb6cff8452ef32b0939b90fa293a87b2ab))
38
+ * run the CBM-II's testbench rows, and diff and check it on Spinel ([36f7b87](https://github.com/elektronaut/badline/commit/36f7b8789c6dbe191d5ad96d8b79bd6f9446894c))
39
+ * run the P500 in the window, with its joysticks, keys and Power page ([497bbe6](https://github.com/elektronaut/badline/commit/497bbe602d48896738281b34a5e33e51da910a7e))
40
+ * run the P500's testbench rows, and diff and check it on Spinel ([fa0188b](https://github.com/elektronaut/badline/commit/fa0188bccf2ae24ca00c57d4fae082e96505c323))
41
+ * save and restore the CBM-II in keyed snapshots ([a477ffd](https://github.com/elektronaut/badline/commit/a477ffdb9f169d3518867a85e94a7cd8b9653584))
42
+ * save and restore the PET's 8050 or 8250 in keyed snapshots ([4f6cdd2](https://github.com/elektronaut/badline/commit/4f6cdd2b2b2e5599104bc6ae6522f3b8d0435252))
43
+ * serve the CBM-II's device 8 through its IEEE-488 traps, and attach its media ([521947f](https://github.com/elektronaut/badline/commit/521947f594810dbff84e4c06a1752de54ce728d3))
44
+ * serve the P500's device 8 through its KERNAL's IEEE-488 traps ([4f01bc5](https://github.com/elektronaut/badline/commit/4f01bc5371ae53982982cde1fed4175ff6e442dc))
45
+ * settle a PET's 8050 into its controller's idle loop for xpet's .vsf ([f3c7a84](https://github.com/elektronaut/badline/commit/f3c7a84ddb3ef8bd37c0085a36c429b924ece83c))
46
+ * settle the CBM-II's sound, RS-232 and user port, and the 6525's mask readback ([e256879](https://github.com/elektronaut/badline/commit/e2568796740938472ca01ead18e138fdaccdae5c))
47
+ * sleep the 8050 and 8250 through their idle loops ([5ba4654](https://github.com/elektronaut/badline/commit/5ba4654ec57f4f1c194c37a3dc2bfd34eb137c10))
48
+ * take badline cbm2 with --model, --kernal and --60hz, and pick the CBM-II for its cartridges ([87dadcc](https://github.com/elektronaut/badline/commit/87dadcc67b3be5dda237d6b85802b2b41f03b73c))
49
+ * take the CBM-II's DRAM refresh cycles from its CPU ([62df423](https://github.com/elektronaut/badline/commit/62df42301369f3c94b01df84013538c7d5ca087c))
50
+ * take the P500 as badline cbm2 --model 510 or 510ntsc, with KERNAL 02 ([219fb0a](https://github.com/elektronaut/badline/commit/219fb0aef0eef3c54aadeabd9402af7b6d999982))
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * end no CRTC row in the vertical adjust ([f3ac171](https://github.com/elektronaut/badline/commit/f3ac1713954f093e85a40c981b0a012c0e251069))
56
+ * lay files out on disk images as the DOS does ([8494ee1](https://github.com/elektronaut/badline/commit/8494ee10a5ac589fe74e54b96fe06887fc95baff))
57
+
58
+
59
+ ### Performance Improvements
60
+
61
+ * clock the PET's cassette decks only while a tape runs ([196f73b](https://github.com/elektronaut/badline/commit/196f73b142c8457d760cb6220063395e4dff6c03))
62
+
3
63
  ## [0.16.1](https://github.com/elektronaut/badline/compare/v0.16.0...v0.16.1) (2026-10-18)
4
64
 
5
65
 
data/CLAUDE.md CHANGED
@@ -275,7 +275,7 @@ serial bus, its media, the CPU port or the datasette.
275
275
  Its tests run one at a time as the C64's do, with
276
276
  `ruby --yjit bin/lorenz --plus4 --resume <test> --stop-after <test>`; the C128 (`c128.rb`, `c128/`), or
277
277
  the VIC-IIe, CPU or PLA code it shares with the C64 → `testbench-c128c64`
278
- (`bin/testbench --c128c64`); the PET (`pet.rb`, `pet/`), its 6520 PIA (`chips/pia.rb`) or its CRTC (`chips/crtc.rb`) → `testbench-pet` (`bin/testbench --pet`) and `testbench-pet-discrete` (`bin/testbench --pet-discrete`); the C128's Z80, MMU or hand-over → `testbench-c128-z80` (`bin/testbench --c128-z80`) and `testbench-c128`; SID → `sid`, plus `sid-8580` for anything the 8580
278
+ (`bin/testbench --c128c64`); the PET (`pet.rb`, `pet/`), its 6520 PIA (`chips/pia.rb`) or its CRTC (`chips/crtc.rb`) → `testbench-pet` (`bin/testbench --pet`) and `testbench-pet-discrete` (`bin/testbench --pet-discrete`), plus `testbench-cbm2` for the CRTC; the CBM-II (`cbm2.rb`, `cbm2/`), its 6525 TPI (`chips/tpi.rb`) or the CIA, SID and ACIA it shares → `testbench-cbm2` (`bin/testbench --cbm2`), plus `testbench-cbm5x0` (`bin/testbench --cbm5x0`); the P500 (`cbm2/p500.rb`, `cbm2/p500/`) → `testbench-cbm5x0`, which the VIC (`chips/vic*`) reaches too; the C128's Z80, MMU or hand-over → `testbench-c128-z80` (`bin/testbench --c128-z80`) and `testbench-c128`; SID → `sid`, plus `sid-8580` for anything the 8580
279
279
  model reaches (`bin/sidtests --sid 8580`). Leave the Lorenz chain to CI,
280
280
  unless your code has a rule in `doc/pinned-behaviour.md` that names Lorenz
281
281
  tests: the interrupt polling, CPU port and CIA timer rules. Run just the
data/README.md CHANGED
@@ -13,7 +13,7 @@ are modelled at the cycle level.
13
13
  It runs programs, disk and tape images, cartridges and SID tunes, and
14
14
  the SDL2 front end supports the keyboard, joysticks, game controllers,
15
15
  paddles and a 1351 mouse. It also runs a PAL VIC-20, as
16
- `badline vic20`, 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.
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`, and the CBM-II, the B series and the P500, as `badline cbm2`. 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` and [The CBM-II](#the-cbm-ii) for
75
+ `badline cbm2`.
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,19 +83,20 @@ 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
+ | `--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. See [Media](#media) |
86
87
  | `--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) |
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
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, 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) |
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 |
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 |
98
100
  | `--ntsc` | Run an NTSC C64, as `--model ntsc` does |
99
101
  | `--c64` | Start a C128 in C64 mode, holding `C=` at power-on. See [The C128](#the-c128) |
100
102
  | `--no-sound` | Don't play the SID (`badline` only, where sound is on by default) |
@@ -115,7 +117,7 @@ differences noted in the table. `--help` lists the options for either.
115
117
  | `--script FILE` | Run the events in `FILE`, one `FRAME:EVENT` a line |
116
118
  | `--screenshot FILE` | Save the last frame as a `.bmp` |
117
119
  | `--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 |
120
+ | `--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
121
 
120
122
  ```sh
121
123
  badline --unpaced --frames 12000 --true-drive disk1.d64 \
@@ -141,7 +143,7 @@ library, are covered in [doc/library.md](doc/library.md).
141
143
  | `.tap` | Inserted in the datasette with PLAY pressed, then `LOAD` and `RUN`. It loads at the speed of a real tape |
142
144
  | `.crt` | The hardware types listed under [Cartridges](#whats-emulated). Other types are rejected |
143
145
  | `.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) |
146
+ | `.vsf` | A snapshot of a running machine, badline's own or one VICE's x64sc, xpet, xcbm2 or xcbm5x0 saved. See [Snapshots](#snapshots) |
145
147
  | 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
148
 
147
149
  Without `--true-drive`, device 8 is no drive at all but traps on the
@@ -367,6 +369,57 @@ jumpers. The PET has no
367
369
  joysticks. `F11` and the Snapshots page save it as they do the others,
368
370
  but not for VICE.
369
371
 
372
+ ## The CBM-II
373
+
374
+ `badline cbm2` runs a CBM 610 of the B series, with BASIC 128 and 80
375
+ columns on a green screen, and takes programs, disks and cartridges:
376
+
377
+ ```sh
378
+ badline cbm2 # READY., in BASIC 128
379
+ badline cbm2 game.prg # Load and run a program
380
+ badline cbm2 game.d82 # Mount an 8250's disk as device 8 and load it
381
+ badline cbm2 game.crt # Put a cartridge in and start the machine
382
+ badline cbm2 --model 720 # A 720, with 256K and the 700's monitor
383
+ badline cbm2 --model 510 game.d82 # A P500, the CBM 510, on the VIC-II
384
+ ```
385
+
386
+ `--model` picks the machine: `610` (the default, 128K), `620` (256K,
387
+ with BASIC 256), `710` and `720` (the same with the 700's monitor and
388
+ character ROM, 25 rows of 14 lines). `--kernal 03b` fits the 1983
389
+ KERNAL, 901244-03b, in place of 901244-04a, the default, which VICE
390
+ 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
391
+ `--60hz` on 60 Hz, which also sets a 600's jumper for its editor's
392
+ 60 Hz table. The mains is the system tick and the clock of the CIA's
393
+ time of day.
394
+
395
+ A program loads at the start of BASIC, `$0003` in segment 1, and runs.
396
+ Disks of every kind, `.d80` and `.d82` among them, go through the
397
+ KERNAL traps on the IEEE-488 bus as device 8, or with `--true-drive` an
398
+ emulated 2031 on the bus, which reads `.d64` and `.g64` images, and an
399
+ 8050 for a `.d80` or an 8250 for a `.d82`. A 610's first `LOAD` from a
400
+ 2031 after power-on finds no file, as on xcbm2, and the second loads.
401
+ A `.d80` or `.d82` on its own starts a PET, so `cbm2` names the machine
402
+ for one, but a cartridge made for the CBM-II starts it without `cbm2`.
403
+ The cartridge goes in from the command line or Quick open. There is no
404
+ datasette. The SID plays through the host's audio device at
405
+ the machine's 2 MHz, as the C64's does. The keys type what the host's
406
+ keys type, as on the PET, and `Alt` with a key presses the keys the
407
+ host has none for: [Input](#input) lists them. The pause menu's Power
408
+ page names the model, its RAM, the mains and the KERNAL, and its
409
+ Expansion port page its RAM. The B series has no joysticks. `F11` and
410
+ the Snapshots page save it as they do the others, and `--vice` adds
411
+ xcbm2's modules, so xcbm2 opens the file too.
412
+
413
+ `--model 510` runs the P500, the CBM 510: the B series' CPU, SID, CIA,
414
+ ACIA and keyboard at about 1 MHz, with a VIC-II for 40 columns in
415
+ colour, 128K of RAM and its own KERNAL, 901234-02. `510` is PAL on
416
+ 50 Hz mains, and `510ntsc` NTSC on 60 Hz. A program loads at `$0003` in
417
+ segment 0. Its keys are the B series', and it has two joysticks on its
418
+ control ports: `Tab` switches the keys to them, as on the C64, and game
419
+ controllers drive them. The pause menu's Ports page plugs a 1351 mouse
420
+ or a pair of paddles into either port, as on the C64, and while the
421
+ keys type, says where its keys are.
422
+
370
423
  ## Snapshots
371
424
 
372
425
  `F11` quicksaves the whole machine to the next of five slots in
@@ -375,8 +428,8 @@ newest, even after badline has quit and started again. badline also
375
428
  autosaves every two minutes of play, and the pause menu's Snapshots page
376
429
  saves under a name and loads any of them. Snapshots from badline 0.14.0
377
430
  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`.
431
+ opens those x64sc, xpet, xcbm2 and xcbm5x0 save, and they open
432
+ badline's saved with `--vice`.
380
433
  See [doc/snapshots.md](doc/snapshots.md) for where they're kept, what
381
434
  they hold and how far the two agree.
382
435
 
@@ -458,6 +511,31 @@ listing them too:
458
511
 
459
512
  On the PET `Tab` is a key, since there are no joysticks to switch to.
460
513
 
514
+ The CBM-II types the characters on the host's keys as the PET does, so
515
+ Shift and `'` type `"` with the CBM-II's `SHIFT` and `'`. `F9` and
516
+ `F10` keep opening the pause menu and muting, and `F12` is `RUN/STOP`
517
+ in place of loading a snapshot. Its keys without a character are here,
518
+ with the pause menu's Keyboard page listing them too:
519
+
520
+ | CBM-II | Host |
521
+ |--------|------|
522
+ | `ESC` | `Escape` |
523
+ | `RUN/STOP` | `F12` |
524
+ | `CLR/HOME` | `Home` |
525
+ | `INST/DEL` | `Backspace` |
526
+ | `TAB` | `Tab` |
527
+ | `CTRL` | `Ctrl` |
528
+ | `F1`-`F8` | `F1`-`F8` |
529
+ | `F9` / `F10` | `Alt` and `F9` / `F10` |
530
+ | `CRSR ←` / `→` / `↑` / `↓` | `Left` / `Right` / `Up` / `Down` |
531
+ | `←` | `_` or `` ` ``, and with `SHIFT` it's `\` |
532
+ | Keypad | The keypad, and `Alt` and `0` for `00` |
533
+ | `C=` | `Alt` and `C` |
534
+ | `CE` | `Alt` and `E` |
535
+ | `NORM/GRAPH` | `Alt` and `G` |
536
+ | `OFF/RVS` | `Alt` and `R` |
537
+ | `π` | `Alt` and `P` |
538
+
461
539
  `Tab` switches the keys between the C64 keyboard and the joysticks. The
462
540
  window title shows where they go, and any device plugged into a control
463
541
  port:
@@ -501,9 +579,9 @@ too.
501
579
  | Drive 8 | The disk: insert, eject, the previous or next disk of its set, and whether it's writable |
502
580
  | Datasette | The tape: insert, eject, PLAY and REWIND |
503
581
  | 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 |
582
+ | 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 |
505
583
  | 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 |
584
+ | 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
585
 
508
586
  INSERT opens a file browser. A disk's set is the `.m3u` or `.vfl` list it
509
587
  was opened from, or one in its folder that lists it. Without one, it comes
@@ -560,6 +638,18 @@ in cartridge 1 as it does from the command line.
560
638
  8296's 128K with its jumpers, RA4 and 4K character ROM, both
561
639
  cassette ports and device 8 on the IEEE-488 bus through the KERNAL
562
640
  traps, `.d80` and `.d82` among its disks (`badline pet`).
641
+ - **CBM-II**: the B series' 610, 620, 710 and 720, with the 6509 at
642
+ 2 MHz and its sixteen segments, 128K or 256K of RAM, BASIC 128 or 256
643
+ with KERNAL 04a or 03b, the 6845 CRTC on 80 columns, the SID, the
644
+ 6526 CIA, the 6551 ACIA, both 6525 TPIs, the keyboard, the 50 or 60 Hz
645
+ mains, cartridges, and device 8 on the IEEE-488 bus through the
646
+ KERNAL traps (`badline cbm2`).
647
+ - **P500**: the CBM 510, PAL and NTSC, with the B series' 6509, SID,
648
+ CIA, ACIA and TPIs at the VIC-II's clock, the VIC-II on the P500's
649
+ video bus, 128K of RAM, the keyboard, both joysticks, a 1351 mouse or
650
+ paddles on either port, and device 8
651
+ on the IEEE-488 bus through the KERNAL traps
652
+ (`badline cbm2 --model 510`).
563
653
  - **2031**: the PET's single drive, the 1541's board and DOS 2.6 on the
564
654
  IEEE-488 bus, with the bus's handshake on every line
565
655
  (`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,8 @@ 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)
53
55
 
54
56
  ## CPU interrupt recognition
55
57
 
@@ -2214,6 +2216,21 @@ testprogs named.
2214
2216
  - Spec guard: *past an R1 it missed*, *repeats a row*, *past an R9 it
2215
2217
  missed* and *past an R6 it missed* in
2216
2218
  [`chips/crtc_spec.rb`](../spec/badline/chips/crtc_spec.rb).
2219
+ - The R5 lines of vertical adjust end no row: the line counter counts
2220
+ them from 0 to R5, and passing R9 neither restarts it nor moves the
2221
+ next row's start, so every adjust line starts where the last row left
2222
+ off. The datasheets (MOS 6545-1, sheets 7-11) give R5 as extra scan
2223
+ lines to complete the frame, apart from the R4 rows, and the address
2224
+ sequence of their figure 4 moves on only per row. The 8032's 901474-04
2225
+ editor dated 0283 sets R5 above R9 (16 lines against 9-line rows, 17
2226
+ against 8 in graphics mode) and its 313-line frame runs on real 8032s,
2227
+ so passing R9 can't end a row there, and the same compare moving the
2228
+ start would be a row end that doesn't happen. xpet's black box agrees.
2229
+ Only a frame whose display runs on through the adjust (R6 past R4)
2230
+ shows it; no editor's does, and the PET has no light pen wired.
2231
+ - Not pinned by a test row: no testbench row runs the 0283 editor.
2232
+ - Spec guard: *with a vertical adjust longer than a row* in
2233
+ [`chips/crtc_spec.rb`](../spec/badline/chips/crtc_spec.rb).
2217
2234
  - The picture is framed as xpet frames its screenshots: R1's characters
2218
2235
  in the middle of 704 dots (80 columns) or 384 (40); each character as
2219
2236
  far right as it comes after its line's horizontal sync, so lines whose
@@ -2229,3 +2246,47 @@ testprogs named.
2229
2246
  cycle dot for dot.
2230
2247
  - Spec guard:
2231
2248
  [`pet/crtc_video_spec.rb`](../spec/badline/pet/crtc_video_spec.rb).
2249
+
2250
+ ## CBM-II DRAM refresh
2251
+
2252
+ - The B series' DRAM refresh takes the 6509's clock away for one cycle:
2253
+ a counter of the CPU's cycles asks for a refresh once it reaches 20
2254
+ and stops there, the refresh comes on the next opcode fetch, which it
2255
+ holds off a cycle, and it clears the counter. A JMP loop, fetching
2256
+ every third cycle, loses one cycle in 22. Read off sheet 3 of
2257
+ schematic 8256043 (U89, U88 and U55: the request at count 20, gated
2258
+ with SYNC, clocked by SPhi1, driving RDY and REFEN) and sheet 2 (REFEN
2259
+ clearing the CPU's phi2 flip-flop U57).
2260
+ - Pinned by `CBM2/cbm2-burnin.d80`'s 6526 timer test, which starts
2261
+ timer A at $8888 and counts a 12-cycle loop until its interrupt
2262
+ flag rises, and passes only at exactly 10 pages and $DB: 2,779
2263
+ loops. Without the refresh badline counts 2,895, and stealing a
2264
+ cycle in every 24 or 25, or five a line, misses by one or more.
2265
+ xcbm2, which steals nothing, shows the cell BAD.
2266
+ - Spec guard: *takes a cycle for the DRAM's refresh* in
2267
+ [`cbm2_spec.rb`](../spec/badline/cbm2_spec.rb).
2268
+
2269
+ ## 6509 indirection segment
2270
+
2271
+ - LDA (zp),Y and STA (zp),Y take the indirection segment for every
2272
+ access at the address they index: the dummy read before the data, as
2273
+ well as the data. The opcode and the zero-page pointer stay in the
2274
+ execution segment.
2275
+ - Pinned by `CBM2/cbm2-burnin.d80`'s 6526 TOD test. It sets the time
2276
+ with STA (zp),Y into segment 15, hours first, polls the tenths until
2277
+ they leave the value written, then checks the tenths, seconds,
2278
+ minutes and hours against the time one tenth on, which leaves the
2279
+ clock latched. In the run that steps the seconds from 01:00:01.9,
2280
+ each step starts latched at the previous step's result, tenths 0,
2281
+ and with that latch held the first poll reads the stale 0, matches
2282
+ the expected tenths and fails on the live seconds, one short. The
2283
+ store's dummy read of the tenths releases the latch before they are
2284
+ written. With the dummy read in the execution segment it reads RAM,
2285
+ and the burn-in's grid grades $FF.
2286
+ - The CIA keeps its latch through writes: `CIA/ciavarious/cia15.prg`'s
2287
+ test B sets X:59:59.8 with absolute stores, hours first, after
2288
+ reading the hours, and its reference has the hour unchanged for odd
2289
+ X, where the first wait reads the stale latched tenths 0 and falls
2290
+ through. A write to the tenths that released the latch fails it.
2291
+ - Spec guard: *makes STA (zp),Y's dummy read in the indirection
2292
+ segment* in [`cbm2/cpu_spec.rb`](../spec/badline/cbm2/cpu_spec.rb).