badline 0.8.0 → 0.10.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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -0
  3. data/CLAUDE.md +6 -4
  4. data/README.md +60 -19
  5. data/doc/library.md +10 -3
  6. data/doc/media.md +11 -2
  7. data/doc/pinned-behaviour.md +199 -9
  8. data/doc/sid-player.md +8 -4
  9. data/doc/snapshots.md +79 -33
  10. data/lib/badline/address_bus/pla.rb +130 -0
  11. data/lib/badline/address_bus/roms.rb +32 -0
  12. data/lib/badline/address_bus.rb +13 -92
  13. data/lib/badline/audio/bare_player.rb +24 -0
  14. data/lib/badline/audio/checkpoints.rb +42 -0
  15. data/lib/badline/audio/jukebox.rb +11 -4
  16. data/lib/badline/audio/machine_player.rb +16 -0
  17. data/lib/badline/audio/renderer.rb +80 -9
  18. data/lib/badline/audio/stereo.rb +3 -5
  19. data/lib/badline/audio.rb +1 -0
  20. data/lib/badline/chrout_trap.rb +4 -3
  21. data/lib/badline/computer/attachments.rb +52 -12
  22. data/lib/badline/computer/saved_state.rb +1 -0
  23. data/lib/badline/computer.rb +50 -33
  24. data/lib/badline/control_ports.rb +10 -3
  25. data/lib/badline/core.rb +51 -0
  26. data/lib/badline/data_path.rb +37 -0
  27. data/lib/badline/datasette.rb +63 -10
  28. data/lib/badline/drive1541/disk.rb +3 -3
  29. data/lib/badline/drive1541/disk_state.rb +14 -5
  30. data/lib/badline/drive1541/serial_port.rb +5 -8
  31. data/lib/badline/drive1541/sleep.rb +5 -6
  32. data/lib/badline/drive1541.rb +3 -3
  33. data/lib/badline/frontend/app.rb +63 -64
  34. data/lib/badline/frontend/boot.rb +34 -4
  35. data/lib/badline/frontend/confirmation.rb +17 -11
  36. data/lib/badline/frontend/controls.rb +12 -6
  37. data/lib/badline/frontend/drive_led.rb +9 -10
  38. data/lib/badline/frontend/frame_rate.rb +4 -4
  39. data/lib/badline/frontend/machine_window.rb +87 -0
  40. data/lib/badline/frontend/menu_dialogs.rb +52 -14
  41. data/lib/badline/frontend/menu_media.rb +70 -16
  42. data/lib/badline/frontend/menu_pages.rb +47 -42
  43. data/lib/badline/frontend/menu_ports.rb +69 -0
  44. data/lib/badline/frontend/name_field.rb +88 -0
  45. data/lib/badline/frontend/pacer.rb +6 -5
  46. data/lib/badline/frontend/pause_menu.rb +52 -37
  47. data/lib/badline/frontend/player_screen.rb +1 -1
  48. data/lib/badline/frontend/player_window.rb +4 -4
  49. data/lib/badline/frontend/screen.rb +39 -37
  50. data/lib/badline/frontend/sid_view.rb +1 -1
  51. data/lib/badline/frontend/snapshots.rb +145 -17
  52. data/lib/badline/frontend/sound.rb +17 -9
  53. data/lib/badline/frontend/timeline.rb +36 -5
  54. data/lib/badline/frontend.rb +3 -0
  55. data/lib/badline/iec_bus.rb +16 -28
  56. data/lib/badline/kernal_trap/drive.rb +3 -0
  57. data/lib/badline/kernal_trap/file.rb +1 -1
  58. data/lib/badline/kernal_trap/layout.rb +112 -0
  59. data/lib/badline/kernal_trap/load.rb +24 -25
  60. data/lib/badline/kernal_trap/routine.rb +17 -5
  61. data/lib/badline/kernal_trap/save.rb +13 -23
  62. data/lib/badline/kernal_trap/serial.rb +38 -24
  63. data/lib/badline/kernal_trap.rb +1 -0
  64. data/lib/badline/keyboard.rb +17 -14
  65. data/lib/badline/machine.rb +60 -0
  66. data/lib/badline/media/disk_list.rb +75 -0
  67. data/lib/badline/media/disk_set.rb +13 -3
  68. data/lib/badline/media/vic20_basic.rb +54 -0
  69. data/lib/badline/media/vic20_cartridge.rb +74 -0
  70. data/lib/badline/media/vic20_media.rb +132 -0
  71. data/lib/badline/media.rb +39 -20
  72. data/lib/badline/model.rb +62 -0
  73. data/lib/badline/options/event.rb +10 -6
  74. data/lib/badline/options/help.rb +25 -13
  75. data/lib/badline/options/table.rb +15 -1
  76. data/lib/badline/options/validation.rb +63 -3
  77. data/lib/badline/options.rb +37 -34
  78. data/lib/badline/region.rb +16 -4
  79. data/lib/badline/reu/ram.rb +27 -0
  80. data/lib/badline/reu/saved_state.rb +27 -0
  81. data/lib/badline/roms/README +37 -0
  82. data/lib/badline/roms/kernal-sx64.rom +0 -0
  83. data/lib/badline/roms/vic20/basic.rom +0 -0
  84. data/lib/badline/roms/vic20/character.rom +0 -0
  85. data/lib/badline/roms/vic20/kernal-ntsc.rom +0 -0
  86. data/lib/badline/roms/vic20/kernal-pal.rom +0 -0
  87. data/lib/badline/sid/decimator.rb +13 -0
  88. data/lib/badline/sid/filter.rb +6 -3
  89. data/lib/badline/sid.rb +19 -0
  90. data/lib/badline/snapshot/container.rb +2 -0
  91. data/lib/badline/snapshot/fields.rb +1 -0
  92. data/lib/badline/snapshot/image.rb +15 -0
  93. data/lib/badline/snapshot/setup.rb +20 -8
  94. data/lib/badline/snapshot/state.rb +15 -7
  95. data/lib/badline/snapshot/vice/main_cpu.rb +1 -1
  96. data/lib/badline/snapshot/vice/peripherals.rb +12 -2
  97. data/lib/badline/snapshot/vice/restore.rb +3 -1
  98. data/lib/badline/snapshot/vice/reu1764.rb +55 -0
  99. data/lib/badline/snapshot/vice/vicii.rb +59 -13
  100. data/lib/badline/snapshot/vice/vicii_import.rb +14 -3
  101. data/lib/badline/snapshot/vice.rb +25 -23
  102. data/lib/badline/snapshot.rb +10 -0
  103. data/lib/badline/storage/crt_file.rb +16 -5
  104. data/lib/badline/storage/disk_image.rb +3 -0
  105. data/lib/badline/storage/host_directory.rb +3 -0
  106. data/lib/badline/storage/t64.rb +10 -4
  107. data/lib/badline/storage/tap.rb +44 -8
  108. data/lib/badline/storage/unavailable.rb +3 -1
  109. data/lib/badline/storage.rb +5 -5
  110. data/lib/badline/timing.rb +12 -0
  111. data/lib/badline/version.rb +1 -1
  112. data/lib/badline/via/shift_register.rb +43 -16
  113. data/lib/badline/vic/bank.rb +53 -16
  114. data/lib/badline/vic/registers.rb +20 -4
  115. data/lib/badline/vic/sprite/timing.rb +5 -9
  116. data/lib/badline/vic/sprite.rb +4 -3
  117. data/lib/badline/vic.rb +34 -15
  118. data/lib/badline/vic20/attachments.rb +103 -0
  119. data/lib/badline/vic20/bus.rb +308 -0
  120. data/lib/badline/vic20/cpu.rb +10 -0
  121. data/lib/badline/vic20/keyboard_via_ports.rb +53 -0
  122. data/lib/badline/vic20/port_wiring.rb +50 -0
  123. data/lib/badline/vic20/saved_state.rb +152 -0
  124. data/lib/badline/vic20/sound/output.rb +83 -0
  125. data/lib/badline/vic20/sound.rb +233 -0
  126. data/lib/badline/vic20/user_via_ports.rb +47 -0
  127. data/lib/badline/vic20/vic/painter.rb +239 -0
  128. data/lib/badline/vic20/vic/saved_state.rb +55 -0
  129. data/lib/badline/vic20/vic/text_window.rb +71 -0
  130. data/lib/badline/vic20/vic.rb +267 -0
  131. data/lib/badline/vic20.rb +220 -0
  132. data/lib/badline.rb +2 -38
  133. metadata +37 -2
  134. data/lib/badline/address_bus/ultimax_pages.rb +0 -38
@@ -0,0 +1,220 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "badline/vic20/attachments"
4
+ require "badline/vic20/bus"
5
+ require "badline/vic20/cpu"
6
+ require "badline/vic20/keyboard_via_ports"
7
+ require "badline/vic20/port_wiring"
8
+ require "badline/vic20/user_via_ports"
9
+ require "badline/vic20/vic"
10
+ require "badline/vic20/sound"
11
+ require "badline/vic20/saved_state"
12
+
13
+ module Badline
14
+ # The Commodore VIC-20 with the PAL 6561: a 6502 at the VIC's clock, the
15
+ # VIC-I and two 6522 VIAs. VIA 1, at $9110, pulls NMI, and VIA 2, at
16
+ # $9120, pulls IRQ. Nothing else interrupts the CPU, and nothing halts
17
+ # it: the VIC fetches in the half of the cycle the CPU leaves alone.
18
+ #
19
+ # It runs in the window, as `badline vic20`, with the VIC's picture and
20
+ # sound. The keyboard, the joystick and RESTORE reach the VIAs, the
21
+ # datasette and the serial bus hang off them (PortWiring), and device 8
22
+ # serves disks through the KERNAL traps or a true 1541.
23
+ class Vic20
24
+ include IntegerHelper
25
+ include KeyboardBuffer
26
+ include Attachments
27
+ include PortWiring
28
+ include SavedState
29
+
30
+ attr_reader :bus, :cpu, :vic, :via1, :via2, :keyboard, :joystick1, :cycles, :init_threshold, :sound,
31
+ :drive1541, :iec_bus, :datasette
32
+
33
+ # The RAM expansion it was built with, a key of Bus::RAM_CONFIGURATIONS.
34
+ attr_reader :ram_configuration
35
+
36
+ # The path of the disk or directory device 8 serves through the traps
37
+ # (Attachments), or an empty one.
38
+ def mounted_path = @drive.nil? ? "" : @drive.path
39
+
40
+ def ram = @bus.ram
41
+
42
+ def family = :vic20
43
+
44
+ # The one control port's joystick, which the front end's second
45
+ # joystick drives too.
46
+ def joystick2 = @joystick1
47
+
48
+ # No pot device plugs in yet.
49
+ def control_ports = nil
50
+
51
+ # +ram+ names the RAM expansion, one of Bus::RAM_CONFIGURATIONS.
52
+ def initialize(ram: :unexpanded, debug: false)
53
+ @ram_configuration = ram
54
+ @vic = VIC.new
55
+ @keyboard = Keyboard.new(matrix: KeyboardVIAPorts::MATRIX)
56
+ @joystick1 = Joystick.new
57
+ @iec_bus = IECBus.new
58
+ @datasette = Datasette.new
59
+ @via1 = VIA.new(start: 0x9000, peripheral: UserVIAPorts.new(joystick: @joystick1, serial_bus: @iec_bus,
60
+ datasette: @datasette))
61
+ keyboard_ports = KeyboardVIAPorts.new(keyboard: @keyboard, joystick: @joystick1)
62
+ @via2 = VIA.new(start: 0x9000, peripheral: keyboard_ports)
63
+ keyboard_ports.connect(@via2)
64
+ @bus = Bus.new(vic: @vic, via1: @via1, via2: @via2, blocks: Bus::RAM_CONFIGURATIONS.fetch(ram))
65
+ @vic.connect(@bus)
66
+ @cpu = CPU.new(@bus, debug:)
67
+ @cycles = 0
68
+ @sound = Sound.new(self, @vic.profile.clock_hz)
69
+ @vic.sound = @sound
70
+ @nmi_asserted = false
71
+ @init_handlers = []
72
+ @pending_keys = nil
73
+ @drive = nil
74
+ @serial_trap = nil
75
+ @save_trap = nil
76
+ @capture_output = nil
77
+ @drive1541 = nil
78
+ @init_threshold = boot_cycles
79
+ wire_ports
80
+ end
81
+
82
+ # The VIC and the VIAs clock ahead of the CPU, as the C64's chips do,
83
+ # so a register write lands on the cycle after the one it was issued
84
+ # on.
85
+ def cycle!
86
+ handle_init if @cycles == @init_threshold
87
+ feed_keyboard if @pending_keys
88
+
89
+ @vic.cycle!
90
+ @via1.cycle!
91
+ @via2.cycle!
92
+ @datasette.cycle!
93
+ @cpu.irq = @via2.irq?
94
+ drive_nmi
95
+ @cpu.cycle!
96
+ @drive1541&.host_cycle!
97
+
98
+ @cycles += 1
99
+ end
100
+
101
+ # Runs `count` cycles, one #cycle! after another.
102
+ def run_cycles(count)
103
+ i = 0
104
+ while i < count
105
+ cycle!
106
+ i += 1
107
+ end
108
+ end
109
+
110
+ # Runs cycles until the block returns true or the cycle count passes
111
+ # `limit`, checking before each cycle.
112
+ def run_until(limit)
113
+ cycle! until yield || @cycles > limit
114
+ end
115
+
116
+ # Runs the block once the KERNAL has booted (see init_threshold), or
117
+ # now if it has.
118
+ def on_init(&block)
119
+ if @cycles < @init_threshold
120
+ @init_handlers << block
121
+ else
122
+ block.call
123
+ end
124
+ end
125
+
126
+ # The chip whose #display a front end shows.
127
+ def video = @vic
128
+
129
+ # What a front end plays: the VIC's sound, which answers #record and
130
+ # #drain_samples.
131
+ def sound_source = @sound
132
+
133
+ # The PAL clock and raster, and the part of the display xvic shows: all
134
+ # 284 pixels of a line, from line 28, below the VIC's vertical blank.
135
+ # The VIC draws 4 pixels a cycle, half as many as the C64's VIC-II on
136
+ # about the same clock, so each pixel shows two window pixels wide, as
137
+ # xvic draws them.
138
+ def timing
139
+ profile = @vic.profile
140
+ width = profile.cycles_per_line * VIC::PIXELS_PER_CYCLE
141
+ blanked = profile.blanked_lines
142
+ Timing.new(clock_hz: profile.clock_hz, cycles_per_line: profile.cycles_per_line,
143
+ lines_per_frame: profile.lines_per_frame,
144
+ crop: [0, blanked, width, profile.lines_per_frame - blanked], pixel_width: 2)
145
+ end
146
+
147
+ # The RESTORE key pulls VIA 1's CA1 low while it is held. The KERNAL
148
+ # sets CA1 to interrupt on that falling edge, and its NMI handler
149
+ # ($FEAD) warm-starts BASIC if RUN/STOP is down too.
150
+ def press_restore
151
+ @via1.ca1 = false
152
+ end
153
+
154
+ def release_restore
155
+ @via1.ca1 = true
156
+ end
157
+
158
+ # Calls the block with the exit code a VICE testprog writes to $910F.
159
+ def install_debug_register(&) = @bus.install_debug_register(&)
160
+
161
+ # Stores a PRG's bytes from its load address on, as the CPU would, so
162
+ # bytes for an empty block go nowhere, and returns that address.
163
+ def load_prg(data)
164
+ load_addr = uint16(data[0], data[1])
165
+ bytes = data[2..] || []
166
+ bytes = bytes[0, 0x10000 - load_addr] if load_addr + bytes.length > 0x10000
167
+ bytes.each_with_index { |byte, i| @bus.poke(load_addr + i, byte) }
168
+ load_addr
169
+ end
170
+
171
+ # The RES line reaches the CPU and both VIAs, and through the serial
172
+ # bus's RESET line, the drive. The VIC has no reset pin.
173
+ def reset!
174
+ @via1.reset!
175
+ @via2.reset!
176
+ via_written
177
+ @drive&.reset!
178
+ @drive1541&.reset!
179
+ @nmi_asserted = false
180
+ @cpu.reset!
181
+ end
182
+
183
+ # Switches the machine off and on: RAM and the VIC start from their
184
+ # power-on state, and the RES line resets everything else.
185
+ def power_cycle!
186
+ @bus.power_on!
187
+ @vic.power_on!
188
+ @sound.power_on!
189
+ reset!
190
+ end
191
+
192
+ def inspect
193
+ "#<#{self.class.name} cycles=#{@cycles} cpu=(#{@cpu.inspect})>"
194
+ end
195
+
196
+ private
197
+
198
+ # The cycle by which the KERNAL has booted and BASIC printed READY,
199
+ # with a margin. The KERNAL's RAM test takes most of it, and runs up
200
+ # from $1000 until it finds no RAM, so each 8K block on from BLK1
201
+ # adds about 615,000 cycles. Unexpanded, READY is up by about 557,000.
202
+ def boot_cycles
203
+ tested = 0
204
+ tested += 1 while tested < 3 && @bus.ram?(%i[blk1 blk2 blk3][tested])
205
+ 700_000 + (650_000 * tested)
206
+ end
207
+
208
+ # VIA 1's IRQ output drives NMI, and the CPU takes an interrupt on its
209
+ # falling edge.
210
+ def drive_nmi
211
+ nmi = @via1.irq?
212
+ @cpu.nmi = true if nmi && !@nmi_asserted
213
+ @nmi_asserted = nmi
214
+ end
215
+
216
+ def handle_init
217
+ @init_handlers.each(&:call)
218
+ end
219
+ end
220
+ end
data/lib/badline.rb CHANGED
@@ -1,43 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "badline/version"
3
+ require "badline/core"
4
4
  require "badline/options"
5
- require "badline/integer_helper"
6
- require "badline/region"
7
- require "badline/addressable"
8
- require "badline/memory"
9
- require "badline/color_memory"
10
- require "badline/rom"
11
- require "badline/ram_expansion"
12
- require "badline/address_bus"
13
- require "badline/instruction"
14
- require "badline/instruction_set"
15
- require "badline/status"
16
- require "badline/keyboard"
17
- require "badline/joystick"
18
- require "badline/control_ports"
19
- require "badline/input"
20
- require "badline/cycleable"
21
- require "badline/datasette"
22
- require "badline/time_of_day"
23
- require "badline/cia"
24
- require "badline/via"
25
- require "badline/sid"
26
- require "badline/debug_register"
27
- require "badline/reu"
28
- require "badline/interrupts"
29
- require "badline/traps"
30
- require "badline/cpu"
31
- require "badline/vic"
32
- require "badline/keyboard_buffer"
33
- require "badline/iec_bus"
34
- require "badline/drive1541"
35
- require "badline/computer"
36
- require "badline/checkpoint"
37
- require "badline/storage"
38
- require "badline/cartridge"
39
- require "badline/kernal_trap"
40
- require "badline/chrout_trap"
41
- require "badline/media"
5
+ require "badline/data_path"
42
6
  require "badline/snapshot"
43
7
  require "badline/audio"
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.8.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
@@ -50,13 +50,15 @@ files:
50
50
  - lib/badline.rb
51
51
  - lib/badline/address_bus.rb
52
52
  - lib/badline/address_bus/extra_sids.rb
53
+ - lib/badline/address_bus/pla.rb
54
+ - lib/badline/address_bus/roms.rb
53
55
  - lib/badline/address_bus/saved_state.rb
54
56
  - lib/badline/address_bus/sid_slots.rb
55
- - lib/badline/address_bus/ultimax_pages.rb
56
57
  - lib/badline/addressable.rb
57
58
  - lib/badline/audio.rb
58
59
  - lib/badline/audio/aiff.rb
59
60
  - lib/badline/audio/bare_player.rb
61
+ - lib/badline/audio/checkpoints.rb
60
62
  - lib/badline/audio/cli.rb
61
63
  - lib/badline/audio/console.rb
62
64
  - lib/badline/audio/jukebox.rb
@@ -108,6 +110,7 @@ files:
108
110
  - lib/badline/computer/attachments.rb
109
111
  - lib/badline/computer/saved_state.rb
110
112
  - lib/badline/control_ports.rb
113
+ - lib/badline/core.rb
111
114
  - lib/badline/cpu.rb
112
115
  - lib/badline/cpu/addressing.rb
113
116
  - lib/badline/cpu/boundary.rb
@@ -117,6 +120,7 @@ files:
117
120
  - lib/badline/cpu/saved_state.rb
118
121
  - lib/badline/cpu/stack_operations.rb
119
122
  - lib/badline/cycleable.rb
123
+ - lib/badline/data_path.rb
120
124
  - lib/badline/datasette.rb
121
125
  - lib/badline/debug_register.rb
122
126
  - lib/badline/drive1541.rb
@@ -151,9 +155,12 @@ files:
151
155
  - lib/badline/frontend/gamepads.rb
152
156
  - lib/badline/frontend/info_view.rb
153
157
  - lib/badline/frontend/keys.rb
158
+ - lib/badline/frontend/machine_window.rb
154
159
  - lib/badline/frontend/menu_dialogs.rb
155
160
  - lib/badline/frontend/menu_media.rb
156
161
  - lib/badline/frontend/menu_pages.rb
162
+ - lib/badline/frontend/menu_ports.rb
163
+ - lib/badline/frontend/name_field.rb
157
164
  - lib/badline/frontend/pacer.rb
158
165
  - lib/badline/frontend/pad_port.rb
159
166
  - lib/badline/frontend/painter.rb
@@ -201,17 +208,24 @@ files:
201
208
  - lib/badline/kernal_trap/drive/write_file.rb
202
209
  - lib/badline/kernal_trap/drive/writes.rb
203
210
  - lib/badline/kernal_trap/file.rb
211
+ - lib/badline/kernal_trap/layout.rb
204
212
  - lib/badline/kernal_trap/load.rb
205
213
  - lib/badline/kernal_trap/routine.rb
206
214
  - lib/badline/kernal_trap/save.rb
207
215
  - lib/badline/kernal_trap/serial.rb
208
216
  - lib/badline/keyboard.rb
209
217
  - lib/badline/keyboard_buffer.rb
218
+ - lib/badline/machine.rb
210
219
  - lib/badline/media.rb
220
+ - lib/badline/media/disk_list.rb
211
221
  - lib/badline/media/disk_set.rb
212
222
  - lib/badline/media/queue.rb
213
223
  - lib/badline/media/true_drive.rb
224
+ - lib/badline/media/vic20_basic.rb
225
+ - lib/badline/media/vic20_cartridge.rb
226
+ - lib/badline/media/vic20_media.rb
214
227
  - lib/badline/memory.rb
228
+ - lib/badline/model.rb
215
229
  - lib/badline/options.rb
216
230
  - lib/badline/options/event.rb
217
231
  - lib/badline/options/help.rb
@@ -238,7 +252,12 @@ files:
238
252
  - lib/badline/roms/eapi/LICENSE.md
239
253
  - lib/badline/roms/eapi/README
240
254
  - lib/badline/roms/eapi/eapi-am29f040-14
255
+ - lib/badline/roms/kernal-sx64.rom
241
256
  - lib/badline/roms/kernal.rom
257
+ - lib/badline/roms/vic20/basic.rom
258
+ - lib/badline/roms/vic20/character.rom
259
+ - lib/badline/roms/vic20/kernal-ntsc.rom
260
+ - lib/badline/roms/vic20/kernal-pal.rom
242
261
  - lib/badline/sdl.rb
243
262
  - lib/badline/sid.rb
244
263
  - lib/badline/sid/catch_up.rb
@@ -266,6 +285,7 @@ files:
266
285
  - lib/badline/snapshot/vice/main_cpu.rb
267
286
  - lib/badline/snapshot/vice/peripherals.rb
268
287
  - lib/badline/snapshot/vice/restore.rb
288
+ - lib/badline/snapshot/vice/reu1764.rb
269
289
  - lib/badline/snapshot/vice/sid_extended.rb
270
290
  - lib/badline/snapshot/vice/sid_registers.rb
271
291
  - lib/badline/snapshot/vice/vicii.rb
@@ -294,6 +314,7 @@ files:
294
314
  - lib/badline/storage/tap.rb
295
315
  - lib/badline/storage/unavailable.rb
296
316
  - lib/badline/time_of_day.rb
317
+ - lib/badline/timing.rb
297
318
  - lib/badline/traps.rb
298
319
  - lib/badline/version.rb
299
320
  - lib/badline/via.rb
@@ -324,6 +345,20 @@ files:
324
345
  - lib/badline/vic/sprite/timing.rb
325
346
  - lib/badline/vic/sprites.rb
326
347
  - lib/badline/vic/sprites_state.rb
348
+ - lib/badline/vic20.rb
349
+ - lib/badline/vic20/attachments.rb
350
+ - lib/badline/vic20/bus.rb
351
+ - lib/badline/vic20/cpu.rb
352
+ - lib/badline/vic20/keyboard_via_ports.rb
353
+ - lib/badline/vic20/port_wiring.rb
354
+ - lib/badline/vic20/saved_state.rb
355
+ - lib/badline/vic20/sound.rb
356
+ - lib/badline/vic20/sound/output.rb
357
+ - lib/badline/vic20/user_via_ports.rb
358
+ - lib/badline/vic20/vic.rb
359
+ - lib/badline/vic20/vic/painter.rb
360
+ - lib/badline/vic20/vic/saved_state.rb
361
+ - lib/badline/vic20/vic/text_window.rb
327
362
  - packaging/homebrew/badline.rb
328
363
  homepage: https://github.com/elektronaut/badline
329
364
  licenses:
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Badline
4
- class AddressBus
5
- # The page tables of an Ultimax cartridge, which AddressBus lays out
6
- # in place of the $01 banking while the cartridge holds GAME low and
7
- # EXROM high.
8
- module UltimaxPages
9
- private
10
-
11
- # Ultimax cartridges ignore the $01 lines: 4K of RAM, ROML/ROMH windows,
12
- # I/O always visible and open address space everywhere else. The ROML
13
- # and ROMH selects fire on writes as well, so cartridge RAM or flash in
14
- # either window takes the writes there.
15
- def map_ultimax_pages
16
- @read_pages.fill(@open_bus, 0x10, 0xf0)
17
- @write_pages.fill(@open_bus, 0x10, 0xf0)
18
- @read_pages.fill(@cartridge.roml, 0x80, 0x20) if @cartridge.roml
19
- map_ultimax_writes(@cartridge.roml, 0x80)
20
- @read_pages.fill(@cartridge.romh, 0xe0, 0x20) if @cartridge.romh
21
- map_ultimax_writes(@cartridge.romh, 0xe0)
22
- map_ultimax_a000
23
- map_io_pages
24
- end
25
-
26
- def map_ultimax_writes(bank, first_page)
27
- @write_pages.fill(bank, first_page, 0x20) if bank.respond_to?(:poke)
28
- end
29
-
30
- def map_ultimax_a000
31
- return unless (window = @cartridge.ultimax_a000)
32
-
33
- @read_pages.fill(window, 0xa0, 0x20)
34
- @write_pages.fill(window, 0xa0, 0x20)
35
- end
36
- end
37
- end
38
- end