badline 0.15.0 → 0.15.1

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +63 -0
  3. data/CLAUDE.md +7 -0
  4. data/README.md +40 -10
  5. data/doc/media.md +19 -0
  6. data/doc/snapshot-format.md +61 -13
  7. data/exe/badline-ruby +1 -1
  8. data/lib/badline/audio/machine_player.rb +2 -14
  9. data/lib/badline/c64/true_drives.rb +13 -1
  10. data/lib/badline/c64.rb +6 -0
  11. data/lib/badline/chips/tia.rb +16 -0
  12. data/lib/badline/chips/vic/register_log.rb +4 -1
  13. data/lib/badline/drives/datasette/keyed_state.rb +8 -3
  14. data/lib/badline/drives/engine/core.rb +6 -14
  15. data/lib/badline/drives/engine/idle.rb +42 -4
  16. data/lib/badline/drives/engine/idle_cpu.rb +18 -0
  17. data/lib/badline/drives/engine/serial_connection.rb +25 -0
  18. data/lib/badline/drives/engine/sleep.rb +1 -0
  19. data/lib/badline/drives/engine.rb +1 -0
  20. data/lib/badline/drives/model1541/byte_ready.rb +19 -3
  21. data/lib/badline/drives/model1541/mechanism.rb +10 -1
  22. data/lib/badline/drives/model1541.rb +1 -0
  23. data/lib/badline/drives/model1551/bus.rb +138 -0
  24. data/lib/badline/drives/model1551/cable.rb +104 -0
  25. data/lib/badline/drives/model1551/cpu.rb +14 -0
  26. data/lib/badline/drives/model1551/keyed_state.rb +65 -0
  27. data/lib/badline/drives/model1551/port.rb +74 -0
  28. data/lib/badline/drives/model1551/tia.rb +92 -0
  29. data/lib/badline/drives/model1551.rb +170 -0
  30. data/lib/badline/drives/model1571.rb +1 -0
  31. data/lib/badline/drives/model1581.rb +1 -0
  32. data/lib/badline/frontend/boot.rb +20 -1
  33. data/lib/badline/frontend/menu/menu_dialogs.rb +13 -5
  34. data/lib/badline/frontend/menu/menu_media.rb +92 -14
  35. data/lib/badline/frontend/menu/menu_pages.rb +11 -6
  36. data/lib/badline/frontend/player/player_controller.rb +11 -4
  37. data/lib/badline/machine.rb +9 -5
  38. data/lib/badline/media/true_drive.rb +7 -5
  39. data/lib/badline/options/help.rb +4 -2
  40. data/lib/badline/options/option.rb +2 -1
  41. data/lib/badline/options/table.rb +14 -2
  42. data/lib/badline/options/validation.rb +49 -9
  43. data/lib/badline/options.rb +34 -2
  44. data/lib/badline/plus4/acia/frames.rb +55 -0
  45. data/lib/badline/plus4/acia.rb +276 -16
  46. data/lib/badline/plus4/bus.rb +181 -45
  47. data/lib/badline/plus4/keyed_modules.rb +22 -5
  48. data/lib/badline/plus4/keyed_parts.rb +33 -4
  49. data/lib/badline/plus4/keyed_state.rb +5 -2
  50. data/lib/badline/plus4/ram_expansion.rb +145 -0
  51. data/lib/badline/plus4/sid_card.rb +95 -0
  52. data/lib/badline/plus4/sound_mix.rb +51 -0
  53. data/lib/badline/plus4/tcbm_drive.rb +120 -0
  54. data/lib/badline/plus4/user_port.rb +11 -2
  55. data/lib/badline/plus4.rb +103 -21
  56. data/lib/badline/roms/README +9 -0
  57. data/lib/badline/roms/dos1551.rom +0 -0
  58. data/lib/badline/snapshot/field_doc.rb +7 -5
  59. data/lib/badline/snapshot/plus4_setup.rb +52 -10
  60. data/lib/badline/storage/g64_image.rb +1 -1
  61. data/lib/badline/version.rb +1 -1
  62. metadata +15 -1
@@ -4,20 +4,33 @@ module Badline
4
4
  module Snapshot
5
5
  # How a 264 series machine was built: its model's name, one of
6
6
  # Plus4::Model::ALL, which also says whether the Plus/4's function ROMs
7
- # are fitted, its RAM in K, and whether a 1551's TCBM interface is
8
- # plugged in, the arguments Plus4.new takes.
9
- Plus4Setup = Data.define(:model, :ram_kb, :tcbm)
7
+ # are fitted, its RAM in K, whether a 1551's TCBM interface is plugged
8
+ # in, the SID card's SID model, or nil without one, and its address,
9
+ # and the RAM expansion's kind, or nil without one, the arguments
10
+ # Plus4.new takes.
11
+ Plus4Setup = Data.define(:model, :ram_kb, :tcbm, :sid_card, :sid_card_address, :ram_expansion)
10
12
 
11
13
  class Plus4Setup
12
14
  MODELS = Plus4::Model::ALL.map(&:name).freeze
13
15
 
16
+ SID_CARDS = %w[none mos6581 mos8580].freeze
17
+
18
+ RAM_EXPANSIONS = ["none", *Plus4::RAMExpansion::KINDS.keys.map(&:to_s)].freeze
19
+
14
20
  # The setup of `machine`.
15
- def self.of(machine) = new(model: machine.model.name, ram_kb: machine.ram_kb, tcbm: !machine.tias.empty?)
21
+ def self.of(machine)
22
+ card = machine.sid_card
23
+ new(model: machine.model.name, ram_kb: machine.ram_kb, tcbm: !machine.tias.empty?, sid_card: card&.model,
24
+ sid_card_address: card ? card.address : Plus4::SIDCard::ADDRESSES.first,
25
+ ram_expansion: machine.ram_expansion&.kind)
26
+ end
16
27
 
17
- # The model by name, the RAM and the TCBM interface, in a keyed
18
- # snapshot module.
28
+ # The model by name, the RAM, the TCBM interface, the SID card's
29
+ # model and address and the RAM expansion's kind, "none" without
30
+ # them, in a keyed snapshot module.
19
31
  def write_fields(out)
20
- out.text("model", model).int("ram_kb", ram_kb).bool("tcbm", tcbm)
32
+ out.text("model", model).int("ram_kb", ram_kb).bool("tcbm", tcbm).text("sid_card", (sid_card || :none).to_s)
33
+ out.int("sid_card_address", sid_card_address).text("ram_expansion", (ram_expansion || :none).to_s)
21
34
  end
22
35
 
23
36
  def self.read_fields(input)
@@ -27,13 +40,42 @@ module Badline
27
40
  raise FormatError, "the snapshot is of a Plus/4 with #{ram_kb}K of RAM, which badline doesn't build"
28
41
  end
29
42
 
30
- new(model:, ram_kb:, tcbm: input.bool("tcbm", false))
43
+ sid_card = named(input.choice("sid_card", SID_CARDS, "none"))
44
+ ram_expansion = named(input.choice("ram_expansion", RAM_EXPANSIONS, "none"))
45
+ new(model:, ram_kb:, tcbm: input.bool("tcbm", false), sid_card:, sid_card_address: sid_card_address(input),
46
+ ram_expansion:)
31
47
  end
32
48
 
49
+ # A choice's name as a Symbol, or nil for "none".
50
+ def self.named(name) = name == "none" ? nil : name.to_sym
51
+
52
+ def self.sid_card_address(input)
53
+ address = input.int("sid_card_address", Plus4::SIDCard::ADDRESSES.first)
54
+ return address if Plus4::SIDCard::ADDRESSES.include?(address)
55
+
56
+ raise FormatError, format("the snapshot is of a Plus/4 with a SID card at $%<address>04X, " \
57
+ "which badline doesn't build", address:)
58
+ end
59
+ private_class_method :named, :sid_card_address
60
+
33
61
  # A machine built this way, at power-on.
34
- def build = Plus4.new(model:, ram: ram_kb, tcbm:)
62
+ def build = Plus4.new(model:, ram: ram_kb, tcbm:, sid_card:, sid_card_address:, ram_expansion:)
63
+
64
+ def to_s
65
+ parts = ["#{ram_kb}K"]
66
+ parts << "a TCBM interface" if tcbm
67
+ parts << sid_card_part if sid_card
68
+ parts << "a #{ram_expansion} RAM expansion" if ram_expansion
69
+ "#{model} with #{parts.join(' and ')}"
70
+ end
35
71
 
36
- def to_s = "#{model} with #{ram_kb}K#{' and a TCBM interface' if tcbm}"
72
+ private
73
+
74
+ def sid_card_part
75
+ format("%<article>s %<model>s SID card at $%<address>04X", article: sid_card == :mos8580 ? "an" : "a",
76
+ model: sid_card.to_s.delete_prefix("mos"),
77
+ address: sid_card_address)
78
+ end
37
79
  end
38
80
  end
39
81
  end
@@ -47,7 +47,7 @@ module Badline
47
47
  # track 1 and 1 for track 1.5, laid out as VICE lays one out: every
48
48
  # block as long as the longest track.
49
49
  def self.create(path, tracks, half_tracks: HALF_TRACKS)
50
- max = tracks.values.map { |bytes, _| bytes.length }.push(MAX_TRACK_SIZE).max
50
+ max = [MAX_TRACK_SIZE, *tracks.values.map { |bytes, _| bytes.length }].max
51
51
  offsets = Array.new(half_tracks, 0)
52
52
  zones = Array.new(half_tracks, 0)
53
53
  blocks = +"".b
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Badline
4
- VERSION = "0.15.0"
4
+ VERSION = "0.15.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: badline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
@@ -259,6 +259,7 @@ files:
259
259
  - lib/badline/drives/engine/idle.rb
260
260
  - lib/badline/drives/engine/idle_cpu.rb
261
261
  - lib/badline/drives/engine/orbit.rb
262
+ - lib/badline/drives/engine/serial_connection.rb
262
263
  - lib/badline/drives/engine/serial_lines.rb
263
264
  - lib/badline/drives/engine/sleep.rb
264
265
  - lib/badline/drives/engine/vias.rb
@@ -276,6 +277,13 @@ files:
276
277
  - lib/badline/drives/model1541/sector_reader.rb
277
278
  - lib/badline/drives/model1541/serial_port.rb
278
279
  - lib/badline/drives/model1541/track.rb
280
+ - lib/badline/drives/model1551.rb
281
+ - lib/badline/drives/model1551/bus.rb
282
+ - lib/badline/drives/model1551/cable.rb
283
+ - lib/badline/drives/model1551/cpu.rb
284
+ - lib/badline/drives/model1551/keyed_state.rb
285
+ - lib/badline/drives/model1551/port.rb
286
+ - lib/badline/drives/model1551/tia.rb
279
287
  - lib/badline/drives/model1571.rb
280
288
  - lib/badline/drives/model1571/bus.rb
281
289
  - lib/badline/drives/model1571/cpu.rb
@@ -401,6 +409,7 @@ files:
401
409
  - lib/badline/options/validation.rb
402
410
  - lib/badline/plus4.rb
403
411
  - lib/badline/plus4/acia.rb
412
+ - lib/badline/plus4/acia/frames.rb
404
413
  - lib/badline/plus4/bus.rb
405
414
  - lib/badline/plus4/cassette_sense.rb
406
415
  - lib/badline/plus4/cpu.rb
@@ -410,6 +419,10 @@ files:
410
419
  - lib/badline/plus4/keyed_parts.rb
411
420
  - lib/badline/plus4/keyed_state.rb
412
421
  - lib/badline/plus4/model.rb
422
+ - lib/badline/plus4/ram_expansion.rb
423
+ - lib/badline/plus4/sid_card.rb
424
+ - lib/badline/plus4/sound_mix.rb
425
+ - lib/badline/plus4/tcbm_drive.rb
413
426
  - lib/badline/plus4/user_port.rb
414
427
  - lib/badline/region.rb
415
428
  - lib/badline/rom.rb
@@ -421,6 +434,7 @@ files:
421
434
  - lib/badline/roms/c64gs.rom
422
435
  - lib/badline/roms/character.rom
423
436
  - lib/badline/roms/dos1541.rom
437
+ - lib/badline/roms/dos1551.rom
424
438
  - lib/badline/roms/dos1571.rom
425
439
  - lib/badline/roms/dos1581.rom
426
440
  - lib/badline/roms/eapi/LICENSE.md