badline 0.12.0 → 0.13.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/CLAUDE.md +59 -31
- data/README.md +1 -1
- data/doc/library.md +9 -9
- data/doc/pinned-behaviour.md +105 -105
- data/doc/snapshots.md +1 -4
- data/lib/badline/audio/bare_player.rb +4 -4
- data/lib/badline/audio/cli.rb +6 -6
- data/lib/badline/audio/jukebox.rb +2 -2
- data/lib/badline/audio/machine_player.rb +2 -2
- data/lib/badline/{media → audio}/queue.rb +1 -1
- data/lib/badline/audio/queued_tune.rb +6 -6
- data/lib/badline/audio/renderer.rb +5 -5
- data/lib/badline/audio/stereo.rb +1 -1
- data/lib/badline/c128/{bus_state.rb → bus/saved_state.rb} +6 -6
- data/lib/badline/c128/bus.rb +30 -51
- data/lib/badline/c128/color_lines.rb +2 -2
- data/lib/badline/c128/cpu.rb +1 -1
- data/lib/badline/c128/drives.rb +10 -11
- data/lib/badline/c128/fast_serial.rb +5 -5
- data/lib/badline/c128/mmu_pages.rb +1 -1
- data/lib/badline/c128/modes.rb +2 -2
- data/lib/badline/c128/saved_state.rb +21 -47
- data/lib/badline/c128/z80.rb +2 -2
- data/lib/badline/c128.rb +18 -72
- data/lib/badline/{computer → c64}/attachments.rb +16 -47
- data/lib/badline/c64/banked_ram/banking.rb +32 -0
- data/lib/badline/c64/banked_ram/plus256k.rb +56 -0
- data/lib/badline/c64/banked_ram/plus60k.rb +45 -0
- data/lib/badline/c64/banked_ram/unexpanded.rb +30 -0
- data/lib/badline/c64/banked_ram.rb +23 -0
- data/lib/badline/c64/bus/extra_sids.rb +32 -0
- data/lib/badline/c64/bus/fittings.rb +40 -0
- data/lib/badline/c64/bus/pla.rb +149 -0
- data/lib/badline/c64/bus/roms.rb +41 -0
- data/lib/badline/c64/bus/saved_state.rb +68 -0
- data/lib/badline/c64/bus/sid_slots.rb +44 -0
- data/lib/badline/c64/bus.rb +218 -0
- data/lib/badline/c64/cartridge/action_replay.rb +128 -0
- data/lib/badline/c64/cartridge/atomic_power.rb +26 -0
- data/lib/badline/c64/cartridge/bank.rb +83 -0
- data/lib/badline/c64/cartridge/comal80.rb +52 -0
- data/lib/badline/c64/cartridge/dinamic.rb +36 -0
- data/lib/badline/c64/cartridge/easy_flash.rb +147 -0
- data/lib/badline/c64/cartridge/epyx_fastload.rb +81 -0
- data/lib/badline/c64/cartridge/final_cartridge3.rb +91 -0
- data/lib/badline/c64/cartridge/flash/saved_state.rb +40 -0
- data/lib/badline/c64/cartridge/flash.rb +279 -0
- data/lib/badline/c64/cartridge/freezer.rb +35 -0
- data/lib/badline/c64/cartridge/fun_play.rb +40 -0
- data/lib/badline/c64/cartridge/g_mod2.rb +76 -0
- data/lib/badline/c64/cartridge/game_system.rb +42 -0
- data/lib/badline/c64/cartridge/geo_ram.rb +81 -0
- data/lib/badline/c64/cartridge/kcs_power.rb +77 -0
- data/lib/badline/c64/cartridge/mach5.rb +34 -0
- data/lib/badline/c64/cartridge/magic_desk.rb +32 -0
- data/lib/badline/c64/cartridge/ocean.rb +37 -0
- data/lib/badline/c64/cartridge/pagefox.rb +70 -0
- data/lib/badline/c64/cartridge/retro_replay/saved_state.rb +47 -0
- data/lib/badline/c64/cartridge/retro_replay.rb +286 -0
- data/lib/badline/c64/cartridge/rex_utility.rb +31 -0
- data/lib/badline/c64/cartridge/rgcd.rb +60 -0
- data/lib/badline/c64/cartridge/saved_state.rb +63 -0
- data/lib/badline/c64/cartridge/simons_basic.rb +37 -0
- data/lib/badline/c64/cartridge/standard.rb +17 -0
- data/lib/badline/c64/cartridge/super_games.rb +50 -0
- data/lib/badline/c64/cartridge/westermann.rb +32 -0
- data/lib/badline/c64/cartridge/zaxxon.rb +68 -0
- data/lib/badline/c64/cartridge.rb +258 -0
- data/lib/badline/c64/color_memory.rb +27 -0
- data/lib/badline/c64/common.rb +34 -0
- data/lib/badline/c64/kernal_traps.rb +89 -0
- data/lib/badline/c64/reu/dma/saved_state.rb +52 -0
- data/lib/badline/c64/reu/dma.rb +275 -0
- data/lib/badline/c64/reu/ram.rb +109 -0
- data/lib/badline/c64/reu/saved_state.rb +55 -0
- data/lib/badline/c64/reu/trigger.rb +34 -0
- data/lib/badline/c64/reu.rb +291 -0
- data/lib/badline/{computer → c64}/saved_state.rb +13 -18
- data/lib/badline/{computer → c64}/true_drives.rb +20 -31
- data/lib/badline/{computer.rb → c64.rb} +22 -80
- data/lib/badline/chips/cia/fast_forward.rb +62 -0
- data/lib/badline/chips/cia/interrupt_register.rb +145 -0
- data/lib/badline/chips/cia/saved_state.rb +49 -0
- data/lib/badline/chips/cia/serial/saved_state.rb +45 -0
- data/lib/badline/chips/cia/serial.rb +250 -0
- data/lib/badline/chips/cia/time_of_day.rb +232 -0
- data/lib/badline/chips/cia/timer.rb +208 -0
- data/lib/badline/chips/cia.rb +281 -0
- data/lib/badline/chips/cpu/addressing.rb +133 -0
- data/lib/badline/chips/cpu/boundary.rb +56 -0
- data/lib/badline/chips/cpu/core.rb +167 -0
- data/lib/badline/chips/cpu/instruction.rb +338 -0
- data/lib/badline/chips/cpu/instruction_set/arithmetic.rb +118 -0
- data/lib/badline/chips/cpu/instruction_set/bitwise.rb +130 -0
- data/lib/badline/chips/cpu/instruction_set/branch.rb +83 -0
- data/lib/badline/chips/cpu/instruction_set/flag.rb +67 -0
- data/lib/badline/chips/cpu/instruction_set/illegal.rb +274 -0
- data/lib/badline/chips/cpu/instruction_set/inc_dec.rb +73 -0
- data/lib/badline/chips/cpu/instruction_set/stack.rb +56 -0
- data/lib/badline/chips/cpu/instruction_set/transfer.rb +141 -0
- data/lib/badline/chips/cpu/instruction_set.rb +59 -0
- data/lib/badline/chips/cpu/interrupts.rb +108 -0
- data/lib/badline/chips/cpu/microcode.rb +179 -0
- data/lib/badline/chips/cpu/operations.rb +90 -0
- data/lib/badline/chips/cpu/port.rb +116 -0
- data/lib/badline/chips/cpu/saved_state.rb +117 -0
- data/lib/badline/chips/cpu/stack_operations.rb +84 -0
- data/lib/badline/chips/cpu/traps.rb +23 -0
- data/lib/badline/chips/cpu.rb +12 -0
- data/lib/badline/chips/sid/catch_up.rb +122 -0
- data/lib/badline/chips/sid/decimator.rb +66 -0
- data/lib/badline/chips/sid/envelope/saved_state.rb +70 -0
- data/lib/badline/chips/sid/envelope.rb +241 -0
- data/lib/badline/chips/sid/filter/saved_state.rb +42 -0
- data/lib/badline/chips/sid/filter.rb +241 -0
- data/lib/badline/chips/sid/saved_state.rb +52 -0
- data/lib/badline/chips/sid/voice.rb +79 -0
- data/lib/badline/chips/sid/waveform/combined.rb +128 -0
- data/lib/badline/chips/sid/waveform/fast_forward.rb +107 -0
- data/lib/badline/chips/sid/waveform/noise_writeback.rb +124 -0
- data/lib/badline/chips/sid/waveform/saved_state.rb +68 -0
- data/lib/badline/chips/sid/waveform.rb +307 -0
- data/lib/badline/chips/sid.rb +265 -0
- data/lib/badline/{c128 → chips}/vdc/memory.rb +1 -1
- data/lib/badline/{c128 → chips}/vdc/painter.rb +1 -1
- data/lib/badline/{c128 → chips}/vdc/raster.rb +1 -1
- data/lib/badline/chips/vdc/saved_state.rb +36 -0
- data/lib/badline/{c128 → chips}/vdc/window.rb +1 -1
- data/lib/badline/{c128 → chips}/vdc.rb +7 -31
- data/lib/badline/chips/via/control_lines.rb +124 -0
- data/lib/badline/chips/via/fast_forward.rb +55 -0
- data/lib/badline/chips/via/interrupt_register.rb +69 -0
- data/lib/badline/chips/via/saved_state.rb +44 -0
- data/lib/badline/chips/via/shift_register.rb +182 -0
- data/lib/badline/chips/via/timer1.rb +133 -0
- data/lib/badline/chips/via/timer2.rb +135 -0
- data/lib/badline/chips/via.rb +268 -0
- data/lib/badline/chips/vic/bank.rb +135 -0
- data/lib/badline/chips/vic/border_mask.rb +88 -0
- data/lib/badline/chips/vic/collisions.rb +117 -0
- data/lib/badline/chips/vic/color_patches.rb +49 -0
- data/lib/badline/chips/vic/display_state.rb +187 -0
- data/lib/badline/chips/vic/graphics_mode.rb +166 -0
- data/lib/badline/chips/vic/graphics_shifter/saved_state.rb +40 -0
- data/lib/badline/chips/vic/graphics_shifter.rb +187 -0
- data/lib/badline/chips/vic/register_log.rb +83 -0
- data/lib/badline/chips/vic/registers.rb +197 -0
- data/lib/badline/chips/vic/saved_state.rb +82 -0
- data/lib/badline/chips/vic/sequencer/saved_state.rb +91 -0
- data/lib/badline/chips/vic/sequencer.rb +277 -0
- data/lib/badline/chips/vic/sequencer_output.rb +118 -0
- data/lib/badline/chips/vic/sprite/internal_bus.rb +70 -0
- data/lib/badline/chips/vic/sprite/saved_state.rb +66 -0
- data/lib/badline/chips/vic/sprite/shifter.rb +148 -0
- data/lib/badline/chips/vic/sprite/timing.rb +58 -0
- data/lib/badline/chips/vic/sprite.rb +339 -0
- data/lib/badline/chips/vic/sprites/saved_state.rb +59 -0
- data/lib/badline/chips/vic/sprites.rb +284 -0
- data/lib/badline/chips/vic.rb +783 -0
- data/lib/badline/chips/vic_i/painter/saved_state.rb +40 -0
- data/lib/badline/{vic20/vic → chips/vic_i}/painter.rb +6 -30
- data/lib/badline/{vic20/vic → chips/vic_i}/saved_state.rb +2 -2
- data/lib/badline/chips/vic_i/sound/output.rb +85 -0
- data/lib/badline/chips/vic_i/sound.rb +235 -0
- data/lib/badline/{vic20/vic → chips/vic_i}/text_window.rb +2 -2
- data/lib/badline/{vic20/vic.rb → chips/vic_i.rb} +5 -5
- data/lib/badline/chips/z80/arithmetic.rb +119 -0
- data/lib/badline/chips/z80/bit_page.rb +57 -0
- data/lib/badline/chips/z80/block_io.rb +60 -0
- data/lib/badline/chips/z80/block_transfers.rb +61 -0
- data/lib/badline/chips/z80/bus_cycles.rb +113 -0
- data/lib/badline/chips/z80/core.rb +115 -0
- data/lib/badline/chips/z80/exchanges.rb +52 -0
- data/lib/badline/chips/z80/extended_page.rb +91 -0
- data/lib/badline/chips/z80/flags.rb +39 -0
- data/lib/badline/chips/z80/interrupt_acceptance.rb +48 -0
- data/lib/badline/chips/z80/jumps.rb +84 -0
- data/lib/badline/chips/z80/loads.rb +100 -0
- data/lib/badline/chips/z80/main_page.rb +136 -0
- data/lib/badline/chips/z80/registers.rb +122 -0
- data/lib/badline/chips/z80/saved_state.rb +71 -0
- data/lib/badline/chips/z80/shifts.rb +66 -0
- data/lib/badline/chips/z80.rb +13 -0
- data/lib/badline/core.rb +27 -29
- data/lib/badline/drives/datasette/saved_state.rb +37 -0
- data/lib/badline/drives/datasette.rb +140 -0
- data/lib/badline/drives/engine/core.rb +149 -0
- data/lib/badline/drives/engine/fast_serial.rb +75 -0
- data/lib/badline/drives/engine/idle.rb +127 -0
- data/lib/badline/drives/engine/idle_cpu.rb +30 -0
- data/lib/badline/drives/engine/orbit.rb +81 -0
- data/lib/badline/drives/engine/serial_lines.rb +75 -0
- data/lib/badline/drives/engine/sleep.rb +114 -0
- data/lib/badline/drives/engine/vias.rb +86 -0
- data/lib/badline/drives/engine/watch.rb +152 -0
- data/lib/badline/drives/engine.rb +11 -0
- data/lib/badline/drives/model1541/bus.rb +88 -0
- data/lib/badline/drives/model1541/byte_ready.rb +50 -0
- data/lib/badline/drives/model1541/cpu.rb +13 -0
- data/lib/badline/drives/model1541/disk/saved_state.rb +88 -0
- data/lib/badline/drives/model1541/disk.rb +317 -0
- data/lib/badline/drives/model1541/disk_via.rb +38 -0
- data/lib/badline/drives/model1541/gcr.rb +59 -0
- data/lib/badline/drives/model1541/mechanism/saved_state.rb +72 -0
- data/lib/badline/drives/model1541/mechanism.rb +315 -0
- data/lib/badline/drives/model1541/rotation.rb +123 -0
- data/lib/badline/drives/model1541/saved_state.rb +44 -0
- data/lib/badline/drives/model1541/sector_reader.rb +78 -0
- data/lib/badline/drives/model1541/serial_port.rb +20 -0
- data/lib/badline/drives/model1541/track.rb +100 -0
- data/lib/badline/drives/model1541.rb +81 -0
- data/lib/badline/drives/model1571/bus.rb +113 -0
- data/lib/badline/drives/model1571/cpu.rb +13 -0
- data/lib/badline/drives/model1571/saved_state.rb +47 -0
- data/lib/badline/drives/model1571/serial_port.rb +39 -0
- data/lib/badline/drives/model1571/serial_via.rb +27 -0
- data/lib/badline/drives/model1571/wd1770.rb +122 -0
- data/lib/badline/drives/model1571.rb +142 -0
- data/lib/badline/drives/model1581/bus.rb +139 -0
- data/lib/badline/drives/model1581/cpu.rb +13 -0
- data/lib/badline/drives/model1581/disk/saved_state.rb +89 -0
- data/lib/badline/drives/model1581/disk.rb +137 -0
- data/lib/badline/drives/model1581/mechanism.rb +119 -0
- data/lib/badline/drives/model1581/saved_state.rb +42 -0
- data/lib/badline/drives/model1581/serial_port.rb +54 -0
- data/lib/badline/drives/model1581/slot.rb +79 -0
- data/lib/badline/drives/model1581/track.rb +102 -0
- data/lib/badline/drives/model1581/track_bytes.rb +77 -0
- data/lib/badline/drives/model1581/wd1772/registers.rb +91 -0
- data/lib/badline/drives/model1581/wd1772/saved_state.rb +68 -0
- data/lib/badline/drives/model1581/wd1772/sector_writes.rb +75 -0
- data/lib/badline/drives/model1581/wd1772/sectors.rb +152 -0
- data/lib/badline/drives/model1581/wd1772/stepping.rb +111 -0
- data/lib/badline/drives/model1581/wd1772/tracks.rb +127 -0
- data/lib/badline/drives/model1581/wd1772/turn.rb +75 -0
- data/lib/badline/drives/model1581/wd1772.rb +218 -0
- data/lib/badline/drives/model1581.rb +206 -0
- data/lib/badline/drives/serial_bus.rb +161 -0
- data/lib/badline/frontend/boot.rb +10 -61
- data/lib/badline/frontend/machine_window.rb +3 -1
- data/lib/badline/frontend/player/filter_view.rb +1 -1
- data/lib/badline/frontend/player/player_controller.rb +2 -2
- data/lib/badline/frontend/player/player_screen.rb +1 -0
- data/lib/badline/frontend/player/theme.rb +7 -7
- data/lib/badline/frontend/timeline.rb +3 -3
- data/lib/badline/input/control_ports.rb +78 -0
- data/lib/badline/input/joystick.rb +27 -0
- data/lib/badline/input/keyboard.rb +114 -0
- data/lib/badline/input.rb +3 -0
- data/lib/badline/kernal_trap/{drive → dos}/block_commands.rb +1 -1
- data/lib/badline/kernal_trap/dos/channel.rb +183 -0
- data/lib/badline/kernal_trap/{drive → dos}/channels.rb +1 -1
- data/lib/badline/kernal_trap/{drive → dos}/memory.rb +1 -1
- data/lib/badline/kernal_trap/{drive → dos}/parameters.rb +1 -1
- data/lib/badline/kernal_trap/{drive → dos}/status.rb +1 -1
- data/lib/badline/kernal_trap/{drive → dos}/write_file.rb +1 -1
- data/lib/badline/kernal_trap/{drive → dos}/writes.rb +1 -1
- data/lib/badline/kernal_trap/{drive.rb → dos.rb} +11 -10
- data/lib/badline/kernal_trap/{file.rb → file_routine.rb} +1 -1
- data/lib/badline/kernal_trap/load.rb +6 -6
- data/lib/badline/kernal_trap/save.rb +5 -5
- data/lib/badline/kernal_trap/serial.rb +7 -7
- data/lib/badline/kernal_trap.rb +2 -3
- data/lib/badline/machine/clocking.rb +50 -0
- data/lib/badline/machine.rb +63 -7
- data/lib/badline/media/boot_disk.rb +2 -2
- data/lib/badline/media/disk_list.rb +3 -3
- data/lib/badline/media/disk_set.rb +1 -1
- data/lib/badline/media/extensions.rb +33 -0
- data/lib/badline/media/program.rb +28 -0
- data/lib/badline/media/true_drive.rb +4 -3
- data/lib/badline/media/tune.rb +35 -0
- data/lib/badline/media/vic20_cartridge.rb +1 -7
- data/lib/badline/media/vic20_media.rb +38 -80
- data/lib/badline/media.rb +84 -81
- data/lib/badline/model.rb +1 -1
- data/lib/badline/options/event.rb +3 -1
- data/lib/badline/roms/README +6 -6
- data/lib/badline/sdl.rb +1 -0
- data/lib/badline/{storage/sid_file.rb → sid_tune/file.rb} +3 -3
- data/lib/badline/{storage → sid_tune}/hvsc.rb +7 -7
- data/lib/badline/{storage → sid_tune}/song_lengths.rb +2 -2
- data/lib/badline/{storage → sid_tune}/stil/credit.rb +1 -1
- data/lib/badline/{storage → sid_tune}/stil.rb +3 -3
- data/lib/badline/sid_tune.rb +6 -0
- data/lib/badline/snapshot/c128_setup.rb +43 -0
- data/lib/badline/snapshot/c64_setup.rb +79 -0
- data/lib/badline/snapshot/image.rb +5 -25
- data/lib/badline/snapshot/machine_state.rb +10 -2
- data/lib/badline/snapshot/setup.rb +22 -66
- data/lib/badline/snapshot/state.rb +8 -17
- data/lib/badline/snapshot/storage_setup.rb +68 -0
- data/lib/badline/snapshot/vic20_setup.rb +37 -0
- data/lib/badline/snapshot/vice/c64_mem.rb +1 -1
- data/lib/badline/snapshot/vice/restore.rb +1 -1
- data/lib/badline/snapshot/vice/reu1764.rb +1 -1
- data/lib/badline/snapshot/vice/reu_fields.rb +40 -0
- data/lib/badline/snapshot/vice.rb +7 -5
- data/lib/badline/snapshot.rb +13 -12
- data/lib/badline/storage/d64_image.rb +15 -9
- data/lib/badline/storage/d71_image.rb +0 -2
- data/lib/badline/storage/d81_image.rb +0 -2
- data/lib/badline/storage/disk_image/writing.rb +2 -2
- data/lib/badline/storage/disk_image.rb +3 -6
- data/lib/badline/storage/g64_image.rb +2 -2
- data/lib/badline/storage/host_directory.rb +0 -5
- data/lib/badline/storage/t64.rb +2 -8
- data/lib/badline/storage/unavailable.rb +1 -1
- data/lib/badline/storage.rb +0 -37
- data/lib/badline/support/c128_checkpoint.rb +39 -0
- data/lib/badline/support/checkpoint.rb +108 -0
- data/lib/badline/support/vic20_checkpoint.rb +38 -0
- data/lib/badline/support.rb +5 -0
- data/lib/badline/version.rb +1 -1
- data/lib/badline/vic20/attachments.rb +11 -81
- data/lib/badline/vic20/bus/saved_state.rb +35 -0
- data/lib/badline/vic20/bus.rb +3 -25
- data/lib/badline/vic20/cpu.rb +1 -1
- data/lib/badline/vic20/port_wiring.rb +4 -4
- data/lib/badline/vic20/saved_state.rb +16 -60
- data/lib/badline/vic20/user_via_ports.rb +2 -2
- data/lib/badline/vic20.rb +20 -51
- metadata +250 -221
- data/lib/badline/address_bus/extra_sids.rb +0 -30
- data/lib/badline/address_bus/fittings.rb +0 -38
- data/lib/badline/address_bus/pla.rb +0 -147
- data/lib/badline/address_bus/roms.rb +0 -39
- data/lib/badline/address_bus/saved_state.rb +0 -72
- data/lib/badline/address_bus/sid_slots.rb +0 -42
- data/lib/badline/address_bus.rb +0 -235
- data/lib/badline/cartridge/action_replay.rb +0 -126
- data/lib/badline/cartridge/atomic_power.rb +0 -24
- data/lib/badline/cartridge/bank.rb +0 -81
- data/lib/badline/cartridge/comal80.rb +0 -50
- data/lib/badline/cartridge/dinamic.rb +0 -34
- data/lib/badline/cartridge/easy_flash.rb +0 -145
- data/lib/badline/cartridge/epyx_fastload.rb +0 -79
- data/lib/badline/cartridge/final_cartridge3.rb +0 -89
- data/lib/badline/cartridge/flash.rb +0 -306
- data/lib/badline/cartridge/freezer.rb +0 -33
- data/lib/badline/cartridge/fun_play.rb +0 -38
- data/lib/badline/cartridge/g_mod2.rb +0 -74
- data/lib/badline/cartridge/game_system.rb +0 -40
- data/lib/badline/cartridge/geo_ram.rb +0 -79
- data/lib/badline/cartridge/kcs_power.rb +0 -75
- data/lib/badline/cartridge/mach5.rb +0 -32
- data/lib/badline/cartridge/magic_desk.rb +0 -30
- data/lib/badline/cartridge/ocean.rb +0 -35
- data/lib/badline/cartridge/pagefox.rb +0 -68
- data/lib/badline/cartridge/retro_replay.rb +0 -320
- data/lib/badline/cartridge/rex_utility.rb +0 -29
- data/lib/badline/cartridge/rgcd.rb +0 -58
- data/lib/badline/cartridge/simons_basic.rb +0 -35
- data/lib/badline/cartridge/standard.rb +0 -15
- data/lib/badline/cartridge/super_games.rb +0 -48
- data/lib/badline/cartridge/westermann.rb +0 -30
- data/lib/badline/cartridge/zaxxon.rb +0 -66
- data/lib/badline/cartridge.rb +0 -303
- data/lib/badline/checkpoint.rb +0 -98
- data/lib/badline/cia/fast_forward.rb +0 -60
- data/lib/badline/cia/interrupt_register.rb +0 -143
- data/lib/badline/cia/serial.rb +0 -275
- data/lib/badline/cia/state.rb +0 -47
- data/lib/badline/cia/timer.rb +0 -206
- data/lib/badline/cia.rb +0 -279
- data/lib/badline/color_memory.rb +0 -25
- data/lib/badline/computer/kernal_traps.rb +0 -29
- data/lib/badline/control_ports.rb +0 -76
- data/lib/badline/cpu/addressing.rb +0 -131
- data/lib/badline/cpu/boundary.rb +0 -54
- data/lib/badline/cpu/core.rb +0 -165
- data/lib/badline/cpu/microcode.rb +0 -177
- data/lib/badline/cpu/operations.rb +0 -88
- data/lib/badline/cpu/saved_state.rb +0 -115
- data/lib/badline/cpu/stack_operations.rb +0 -82
- data/lib/badline/cpu.rb +0 -10
- data/lib/badline/cycleable.rb +0 -38
- data/lib/badline/datasette.rb +0 -161
- data/lib/badline/drive/core.rb +0 -147
- data/lib/badline/drive/fast_serial.rb +0 -73
- data/lib/badline/drive/idle.rb +0 -125
- data/lib/badline/drive/idle_cpu.rb +0 -28
- data/lib/badline/drive/orbit.rb +0 -79
- data/lib/badline/drive/serial_lines.rb +0 -73
- data/lib/badline/drive/sleep.rb +0 -112
- data/lib/badline/drive/vias.rb +0 -84
- data/lib/badline/drive/watch.rb +0 -150
- data/lib/badline/drive.rb +0 -11
- data/lib/badline/drive1541/bus.rb +0 -86
- data/lib/badline/drive1541/byte_ready.rb +0 -48
- data/lib/badline/drive1541/cpu.rb +0 -11
- data/lib/badline/drive1541/disk.rb +0 -318
- data/lib/badline/drive1541/disk_state.rb +0 -94
- data/lib/badline/drive1541/disk_via.rb +0 -36
- data/lib/badline/drive1541/gcr.rb +0 -57
- data/lib/badline/drive1541/mechanism.rb +0 -313
- data/lib/badline/drive1541/mechanism_state.rb +0 -68
- data/lib/badline/drive1541/rotation.rb +0 -121
- data/lib/badline/drive1541/sector_reader.rb +0 -76
- data/lib/badline/drive1541/serial_port.rb +0 -18
- data/lib/badline/drive1541/track.rb +0 -98
- data/lib/badline/drive1541.rb +0 -111
- data/lib/badline/drive1571/bus.rb +0 -111
- data/lib/badline/drive1571/cpu.rb +0 -11
- data/lib/badline/drive1571/serial_port.rb +0 -37
- data/lib/badline/drive1571/serial_via.rb +0 -25
- data/lib/badline/drive1571/wd1770.rb +0 -120
- data/lib/badline/drive1571.rb +0 -175
- data/lib/badline/drive1581/bus.rb +0 -137
- data/lib/badline/drive1581/cpu.rb +0 -11
- data/lib/badline/drive1581/disk.rb +0 -135
- data/lib/badline/drive1581/disk_state.rb +0 -87
- data/lib/badline/drive1581/mechanism.rb +0 -117
- data/lib/badline/drive1581/serial_port.rb +0 -52
- data/lib/badline/drive1581/slot.rb +0 -78
- data/lib/badline/drive1581/track.rb +0 -100
- data/lib/badline/drive1581/track_bytes.rb +0 -75
- data/lib/badline/drive1581/wd1772/registers.rb +0 -89
- data/lib/badline/drive1581/wd1772/sector_writes.rb +0 -73
- data/lib/badline/drive1581/wd1772/sectors.rb +0 -150
- data/lib/badline/drive1581/wd1772/state.rb +0 -66
- data/lib/badline/drive1581/wd1772/stepping.rb +0 -109
- data/lib/badline/drive1581/wd1772/tracks.rb +0 -125
- data/lib/badline/drive1581/wd1772/turn.rb +0 -73
- data/lib/badline/drive1581/wd1772.rb +0 -216
- data/lib/badline/drive1581.rb +0 -233
- data/lib/badline/iec_bus.rb +0 -159
- data/lib/badline/instruction.rb +0 -334
- data/lib/badline/instruction_set/arithmetic.rb +0 -114
- data/lib/badline/instruction_set/bitwise.rb +0 -126
- data/lib/badline/instruction_set/branch.rb +0 -79
- data/lib/badline/instruction_set/flag.rb +0 -63
- data/lib/badline/instruction_set/illegal.rb +0 -270
- data/lib/badline/instruction_set/inc_dec.rb +0 -69
- data/lib/badline/instruction_set/stack.rb +0 -52
- data/lib/badline/instruction_set/transfer.rb +0 -137
- data/lib/badline/instruction_set.rb +0 -55
- data/lib/badline/interrupts.rb +0 -104
- data/lib/badline/joystick.rb +0 -25
- data/lib/badline/kernal_trap/channel.rb +0 -181
- data/lib/badline/keyboard.rb +0 -112
- data/lib/badline/ram_expansion/banking.rb +0 -30
- data/lib/badline/ram_expansion/plus256k.rb +0 -54
- data/lib/badline/ram_expansion/plus60k.rb +0 -43
- data/lib/badline/ram_expansion/unexpanded.rb +0 -28
- data/lib/badline/ram_expansion.rb +0 -21
- data/lib/badline/reu/dma/saved_state.rb +0 -50
- data/lib/badline/reu/dma.rb +0 -273
- data/lib/badline/reu/ram.rb +0 -107
- data/lib/badline/reu/saved_state.rb +0 -80
- data/lib/badline/reu/trigger.rb +0 -32
- data/lib/badline/reu.rb +0 -289
- data/lib/badline/sid/catch_up.rb +0 -120
- data/lib/badline/sid/decimator.rb +0 -64
- data/lib/badline/sid/envelope/state.rb +0 -68
- data/lib/badline/sid/envelope.rb +0 -239
- data/lib/badline/sid/filter.rb +0 -263
- data/lib/badline/sid/voice.rb +0 -77
- data/lib/badline/sid/waveform/combined.rb +0 -126
- data/lib/badline/sid/waveform/fast_forward.rb +0 -105
- data/lib/badline/sid/waveform/noise_writeback.rb +0 -122
- data/lib/badline/sid/waveform/state.rb +0 -66
- data/lib/badline/sid/waveform.rb +0 -305
- data/lib/badline/sid.rb +0 -303
- data/lib/badline/time_of_day.rb +0 -228
- data/lib/badline/traps.rb +0 -19
- data/lib/badline/via/control_lines.rb +0 -122
- data/lib/badline/via/fast_forward.rb +0 -53
- data/lib/badline/via/interrupt_register.rb +0 -67
- data/lib/badline/via/shift_register.rb +0 -180
- data/lib/badline/via/state.rb +0 -42
- data/lib/badline/via/timer1.rb +0 -131
- data/lib/badline/via/timer2.rb +0 -133
- data/lib/badline/via.rb +0 -266
- data/lib/badline/vic/bank.rb +0 -133
- data/lib/badline/vic/border_mask.rb +0 -86
- data/lib/badline/vic/collisions.rb +0 -115
- data/lib/badline/vic/color_patches.rb +0 -47
- data/lib/badline/vic/display_state.rb +0 -185
- data/lib/badline/vic/graphics_mode.rb +0 -164
- data/lib/badline/vic/graphics_shifter.rb +0 -207
- data/lib/badline/vic/register_log.rb +0 -81
- data/lib/badline/vic/registers.rb +0 -195
- data/lib/badline/vic/sequencer.rb +0 -275
- data/lib/badline/vic/sequencer_output.rb +0 -116
- data/lib/badline/vic/sequencer_state.rb +0 -89
- data/lib/badline/vic/sprite/internal_bus.rb +0 -68
- data/lib/badline/vic/sprite/saved_state.rb +0 -64
- data/lib/badline/vic/sprite/shifter.rb +0 -146
- data/lib/badline/vic/sprite/timing.rb +0 -56
- data/lib/badline/vic/sprite.rb +0 -337
- data/lib/badline/vic/sprites.rb +0 -282
- data/lib/badline/vic/sprites_state.rb +0 -57
- data/lib/badline/vic.rb +0 -852
- data/lib/badline/vic20/sound/output.rb +0 -83
- data/lib/badline/vic20/sound.rb +0 -233
- data/lib/badline/z80/arithmetic.rb +0 -117
- data/lib/badline/z80/bit_page.rb +0 -55
- data/lib/badline/z80/block_io.rb +0 -58
- data/lib/badline/z80/block_transfers.rb +0 -59
- data/lib/badline/z80/bus_cycles.rb +0 -111
- data/lib/badline/z80/core.rb +0 -113
- data/lib/badline/z80/exchanges.rb +0 -50
- data/lib/badline/z80/extended_page.rb +0 -89
- data/lib/badline/z80/flags.rb +0 -37
- data/lib/badline/z80/interrupt_acceptance.rb +0 -46
- data/lib/badline/z80/jumps.rb +0 -82
- data/lib/badline/z80/loads.rb +0 -98
- data/lib/badline/z80/main_page.rb +0 -134
- data/lib/badline/z80/registers.rb +0 -120
- data/lib/badline/z80/saved_state.rb +0 -69
- data/lib/badline/z80/shifts.rb +0 -64
- data/lib/badline/z80.rb +0 -11
- /data/lib/badline/snapshot/{fields.rb → vice/fields.rb} +0 -0
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Badline
|
|
4
|
-
module RAMExpansion
|
|
5
|
-
# The +60K: a second bank of RAM behind $1000-$FFFF, selected by bit 7
|
|
6
|
-
# of $D100. $0000-$0FFF stays the machine's own RAM, and so does all of
|
|
7
|
-
# what the VIC sees.
|
|
8
|
-
class Plus60k
|
|
9
|
-
include Banking
|
|
10
|
-
|
|
11
|
-
def initialize(ram)
|
|
12
|
-
@low_ram = @video_ram = @high_ram = ram
|
|
13
|
-
@banks = [ram, Memory.new]
|
|
14
|
-
@on_change = nil
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def poke(_addr, value)
|
|
18
|
-
@high_ram = @banks[value >> 7]
|
|
19
|
-
@on_change&.call
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def reset!
|
|
23
|
-
@high_ram = @banks[0]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def type = :plus60k
|
|
27
|
-
|
|
28
|
-
def save_state(out)
|
|
29
|
-
out.int(@banks.index(@high_ram))
|
|
30
|
-
@banks[1].save_state(out)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def load_state(input)
|
|
34
|
-
@high_ram = @banks.fetch(input.int)
|
|
35
|
-
@banks[1].load_state(input)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def power_on!
|
|
39
|
-
@banks[1].clear!
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Badline
|
|
4
|
-
module RAMExpansion
|
|
5
|
-
# The machine with no expansion fitted: its own RAM everywhere, and
|
|
6
|
-
# $D100 left to the VIC.
|
|
7
|
-
class Unexpanded
|
|
8
|
-
include Banking
|
|
9
|
-
|
|
10
|
-
def initialize(ram)
|
|
11
|
-
@low_ram = @video_ram = @high_ram = ram
|
|
12
|
-
@on_change = nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def type = nil
|
|
16
|
-
|
|
17
|
-
def map_io(_read_pages, _write_pages); end
|
|
18
|
-
|
|
19
|
-
def save_state(_out); end
|
|
20
|
-
|
|
21
|
-
def load_state(_input); end
|
|
22
|
-
|
|
23
|
-
def reset!; end
|
|
24
|
-
|
|
25
|
-
def power_on!; end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "badline/ram_expansion/banking"
|
|
4
|
-
require "badline/ram_expansion/unexpanded"
|
|
5
|
-
require "badline/ram_expansion/plus60k"
|
|
6
|
-
require "badline/ram_expansion/plus256k"
|
|
7
|
-
|
|
8
|
-
module Badline
|
|
9
|
-
# RAM expansions that bank extra memory in under the CPU through a
|
|
10
|
-
# register at $D100, in the VIC's I/O page. Any write to $D100-$D1FF
|
|
11
|
-
# sets the register, which reads back as $FF.
|
|
12
|
-
module RAMExpansion
|
|
13
|
-
TYPES = { plus60k: Plus60k, plus256k: Plus256k }.freeze
|
|
14
|
-
|
|
15
|
-
def self.build(type, ram, &)
|
|
16
|
-
expansion = type ? TYPES.fetch(type).new(ram) : Unexpanded.new(ram)
|
|
17
|
-
expansion.on_change(&)
|
|
18
|
-
expansion
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Badline
|
|
4
|
-
class REU
|
|
5
|
-
class DMA
|
|
6
|
-
# A transfer's state for a snapshot (REU::SavedState).
|
|
7
|
-
module SavedState
|
|
8
|
-
# Everything a transfer holds between cycles. Before the first
|
|
9
|
-
# transfer, the fields it sets on starting are empty.
|
|
10
|
-
def save_state(out)
|
|
11
|
-
out.int(@c64).int(@expansion).int(@length).int(@events)
|
|
12
|
-
[@type, @c64_step, @expansion_step, @last, @ba_low_after_writes, @swap_byte, @held_read].each do |value|
|
|
13
|
-
out.optional_int(value)
|
|
14
|
-
end
|
|
15
|
-
[@holding, @waiting, @stopped_after_write, @swap_write_due, @swap_read_again, @moved_all,
|
|
16
|
-
@extra_cycle].each do |flag|
|
|
17
|
-
out.boolean(flag)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def load_state(input)
|
|
22
|
-
@c64 = input.int
|
|
23
|
-
@expansion = input.int
|
|
24
|
-
@length = input.int
|
|
25
|
-
@events = input.int
|
|
26
|
-
load_steps(input)
|
|
27
|
-
@holding = input.boolean?
|
|
28
|
-
@waiting = input.boolean?
|
|
29
|
-
@stopped_after_write = input.boolean?
|
|
30
|
-
@swap_write_due = input.boolean?
|
|
31
|
-
@swap_read_again = input.boolean?
|
|
32
|
-
@moved_all = input.boolean?
|
|
33
|
-
@extra_cycle = input.boolean?
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def load_steps(input)
|
|
39
|
-
@type = input.optional_int
|
|
40
|
-
@c64_step = input.optional_int
|
|
41
|
-
@expansion_step = input.optional_int
|
|
42
|
-
@last = input.optional_int
|
|
43
|
-
@ba_low_after_writes = input.optional_int
|
|
44
|
-
@swap_byte = input.optional_int
|
|
45
|
-
@held_read = input.optional_int
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
data/lib/badline/reu/dma.rb
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "badline/reu/dma/saved_state"
|
|
4
|
-
|
|
5
|
-
module Badline
|
|
6
|
-
class REU
|
|
7
|
-
# One transfer between the C64 and the REU's RAM, clocked a cycle at a
|
|
8
|
-
# time while the REC holds the bus. The REC only reads the C64's bus
|
|
9
|
-
# while BA is high, so a read followed by BA low waits for BA to rise.
|
|
10
|
-
# After a write it goes on through the first BA-low cycle and stops at
|
|
11
|
-
# the second. See doc/pinned-behaviour.md, REU DMA.
|
|
12
|
-
class DMA
|
|
13
|
-
include SavedState
|
|
14
|
-
|
|
15
|
-
# Transfer types, as the command register's bottom two bits give
|
|
16
|
-
# them.
|
|
17
|
-
STASH = 0
|
|
18
|
-
FETCH = 1
|
|
19
|
-
SWAP = 2
|
|
20
|
-
VERIFY = 3
|
|
21
|
-
|
|
22
|
-
# What the REC did on the cycle before.
|
|
23
|
-
IDLE = 0
|
|
24
|
-
READ = 1
|
|
25
|
-
WRITE = 2
|
|
26
|
-
|
|
27
|
-
# Where the transfer stopped, what it left for the length register,
|
|
28
|
-
# and the status bits it ended with.
|
|
29
|
-
attr_reader :c64, :expansion, :length, :events
|
|
30
|
-
|
|
31
|
-
def initialize(ram, span, bus)
|
|
32
|
-
@ram = ram
|
|
33
|
-
@span = span
|
|
34
|
-
@bus = bus
|
|
35
|
-
@c64 = @expansion = @length = @events = 0
|
|
36
|
-
@holding = false
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Whether the REC held the bus on the last cycle clocked, which it
|
|
40
|
-
# does while it waits for BA too, since the CPU stays halted.
|
|
41
|
-
def holds_bus? = @holding
|
|
42
|
-
|
|
43
|
-
# A length of 0 moves 64K. control is the address control register,
|
|
44
|
-
# which can hold either address where it is.
|
|
45
|
-
def start(type, c64, expansion, length, control)
|
|
46
|
-
@type = type
|
|
47
|
-
@c64 = c64
|
|
48
|
-
@expansion = expansion
|
|
49
|
-
@length = length.zero? ? 0x10000 : length
|
|
50
|
-
@c64_step = control.anybits?(FIX_C64) ? 0 : 1
|
|
51
|
-
@expansion_step = control.anybits?(FIX_EXPANSION) ? 0 : 1
|
|
52
|
-
@events = 0
|
|
53
|
-
@holding = true
|
|
54
|
-
@last = IDLE
|
|
55
|
-
@waiting = false
|
|
56
|
-
@ba_low_after_writes = 0
|
|
57
|
-
@stopped_after_write = false
|
|
58
|
-
@swap_write_due = false
|
|
59
|
-
@swap_read_again = false
|
|
60
|
-
@swap_byte = 0
|
|
61
|
-
@held_read = 0
|
|
62
|
-
@moved_all = false
|
|
63
|
-
@extra_cycle = false
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# Writes the byte a fetch from these addresses starts with, without
|
|
67
|
-
# counting it. Other transfers start with a read.
|
|
68
|
-
def write_ahead(type, c64, expansion)
|
|
69
|
-
return unless type == FETCH
|
|
70
|
-
|
|
71
|
-
@c64 = c64
|
|
72
|
-
byte = @ram.peek(expansion)
|
|
73
|
-
@ram.latch = byte
|
|
74
|
-
write_c64(byte)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# One cycle of the transfer. The cycle the REC lets go of the bus on
|
|
78
|
-
# is the CPU's. late says BA fell on this cycle but a REC that moved a
|
|
79
|
-
# byte on the last one doesn't see it yet (VIC#reu_ba_late?), and
|
|
80
|
-
# handed_on that BA runs on from a bad line's DMA into a sprite's
|
|
81
|
-
# here (VIC#reu_ba_handed_on?).
|
|
82
|
-
def cycle!(ba_low, late, handed_on)
|
|
83
|
-
note_ba(ba_low, late)
|
|
84
|
-
@swap_read_again ||= handed_on && @swap_write_due
|
|
85
|
-
settle_held_read(ba_low) if @held_read.positive?
|
|
86
|
-
return if @waiting && ba_low
|
|
87
|
-
|
|
88
|
-
@waiting = false
|
|
89
|
-
@moved_all ? wind_down : move(ba_low)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
private
|
|
93
|
-
|
|
94
|
-
# The second BA-low cycle in a row after writes stops the REC, and so
|
|
95
|
-
# does any BA-low cycle after a read. It then waits for BA to rise.
|
|
96
|
-
def note_ba(ba_low, late)
|
|
97
|
-
seen = ba_low && !late
|
|
98
|
-
if @last == READ
|
|
99
|
-
note_ba_after_read(seen)
|
|
100
|
-
elsif @last == WRITE
|
|
101
|
-
note_ba_after_write(seen)
|
|
102
|
-
end
|
|
103
|
-
@last = IDLE
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
# A swap's read that BA stops before its write is made again.
|
|
107
|
-
def note_ba_after_read(ba_low)
|
|
108
|
-
@waiting = ba_low
|
|
109
|
-
@ba_low_after_writes = 0
|
|
110
|
-
@swap_read_again = ba_low && @swap_write_due && @held_read.zero?
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
# A fetch's last write doesn't go through the first BA-low cycle.
|
|
114
|
-
# Pinned by REU/reutiming2/d and d2.
|
|
115
|
-
def note_ba_after_write(ba_low)
|
|
116
|
-
@ba_low_after_writes = ba_low ? @ba_low_after_writes + 1 : 0
|
|
117
|
-
@stopped_after_write = @ba_low_after_writes == 2 || (ba_low && @type == FETCH && @length == 1)
|
|
118
|
-
return unless @stopped_after_write
|
|
119
|
-
|
|
120
|
-
@waiting = true
|
|
121
|
-
@ba_low_after_writes = 0
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# A fetch or a swap whose last write ran into BA, or a verify that
|
|
125
|
-
# found a difference before its last byte, takes one more cycle before
|
|
126
|
-
# the REC lets go of the bus.
|
|
127
|
-
def wind_down
|
|
128
|
-
if @extra_cycle || (@stopped_after_write && (@type == FETCH || @type == SWAP))
|
|
129
|
-
@extra_cycle = @stopped_after_write = false
|
|
130
|
-
@last = READ
|
|
131
|
-
return
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
@holding = false
|
|
135
|
-
settle
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def move(ba_low)
|
|
139
|
-
case @type
|
|
140
|
-
when STASH then stash
|
|
141
|
-
when FETCH then fetch
|
|
142
|
-
when SWAP then swap(ba_low)
|
|
143
|
-
else verify
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
# The REU's data bus latch keeps the last byte the REC stored.
|
|
148
|
-
def stash
|
|
149
|
-
byte = read_c64
|
|
150
|
-
@ram.poke(@expansion, byte)
|
|
151
|
-
@ram.latch = byte
|
|
152
|
-
step
|
|
153
|
-
@last = READ
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def fetch
|
|
157
|
-
byte = @ram.peek(@expansion)
|
|
158
|
-
@ram.latch = byte
|
|
159
|
-
write_c64(byte)
|
|
160
|
-
step
|
|
161
|
-
@last = WRITE
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
# Two cycles a byte: the C64's byte is read and stored while the
|
|
165
|
-
# REU's is fetched, and the REU's is written to the C64 on the next.
|
|
166
|
-
def swap(ba_low)
|
|
167
|
-
return read_swap_again if @swap_read_again
|
|
168
|
-
|
|
169
|
-
if @swap_write_due
|
|
170
|
-
@swap_write_due = false
|
|
171
|
-
write_c64(@swap_byte)
|
|
172
|
-
step
|
|
173
|
-
@last = WRITE
|
|
174
|
-
return
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
@swap_byte = @ram.peek(@expansion)
|
|
178
|
-
@swap_write_due = true
|
|
179
|
-
@last = READ
|
|
180
|
-
return swap_read_on_ba if ba_low
|
|
181
|
-
|
|
182
|
-
@ram.poke(@expansion, read_c64)
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
# A swap's read on the first BA-low cycle after a write, while AEC is
|
|
186
|
-
# still high. On the last byte the read is made there, the write
|
|
187
|
-
# follows on the next cycle whatever BA does, and the REC lets go.
|
|
188
|
-
# Otherwise the read stays open and takes what is on the bus two
|
|
189
|
-
# cycles later, or on the cycle BA rises if that comes first. Pinned
|
|
190
|
-
# by REU/reutiming2/e5-m2, f3-m2 and f4-m2.
|
|
191
|
-
def swap_read_on_ba
|
|
192
|
-
return @held_read = 2 unless @length == 1
|
|
193
|
-
|
|
194
|
-
@ram.poke(@expansion, read_c64)
|
|
195
|
-
@last = IDLE
|
|
196
|
-
@ba_low_after_writes = 0
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
# A swap's read that BA cut off from its write is made again when BA
|
|
200
|
-
# rises, and the write follows it. Pinned by REU/reutiming2/e4-m2,
|
|
201
|
-
# e6-m2 and g3-m2.
|
|
202
|
-
def read_swap_again
|
|
203
|
-
@swap_read_again = false
|
|
204
|
-
@ram.poke(@expansion, read_c64)
|
|
205
|
-
@last = READ
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
def settle_held_read(ba_low)
|
|
209
|
-
@held_read -= 1
|
|
210
|
-
return if @held_read.positive? && ba_low
|
|
211
|
-
|
|
212
|
-
@held_read = 0
|
|
213
|
-
@ram.poke(@expansion, read_c64)
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
# A difference ends the transfer, with one cycle more if bytes were
|
|
217
|
-
# left to compare.
|
|
218
|
-
def verify
|
|
219
|
-
same = @ram.peek(@expansion) == read_c64
|
|
220
|
-
step
|
|
221
|
-
@last = READ
|
|
222
|
-
return if same
|
|
223
|
-
|
|
224
|
-
@events |= FAULT
|
|
225
|
-
@extra_cycle = @length.positive?
|
|
226
|
-
@moved_all = true
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
# The REC reaches C64 memory as the CPU sees it, but at $00 and $01
|
|
230
|
-
# it reaches the RAM under the CPU's port.
|
|
231
|
-
def read_c64
|
|
232
|
-
@c64 < 0x02 ? @bus.ram.peek(@c64) : @bus.peek(@c64)
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
def write_c64(byte)
|
|
236
|
-
@c64 < 0x02 ? @bus.ram.poke(@c64, byte) : @bus.poke(@c64, byte)
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
# The REC counts the expansion address in its 19 low bits, from the
|
|
240
|
-
# top of its span back to 0, and leaves the bank bits above them as
|
|
241
|
-
# they were.
|
|
242
|
-
def step
|
|
243
|
-
@c64 = (@c64 + @c64_step) & 0xffff
|
|
244
|
-
low = (@expansion & 0x7ffff) + @expansion_step
|
|
245
|
-
@expansion = (@expansion & 0xf80000) | (low == @span ? 0 : low)
|
|
246
|
-
@length -= 1
|
|
247
|
-
@moved_all = true if @length.zero?
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
# The length register is left at 1 after a whole block. A fetch has
|
|
251
|
-
# already fetched the byte after its last into the latch.
|
|
252
|
-
def settle
|
|
253
|
-
return settle_verify if @type == VERIFY
|
|
254
|
-
|
|
255
|
-
@length += 1
|
|
256
|
-
@events |= END_OF_BLOCK
|
|
257
|
-
@ram.latch = @ram.peek(@expansion) if @type == FETCH
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
# A verify that compared every byte ends the block. One that found a
|
|
261
|
-
# difference on the byte before the last compares the last too, and
|
|
262
|
-
# ends the block if that one is the same.
|
|
263
|
-
def settle_verify
|
|
264
|
-
if @length.zero?
|
|
265
|
-
@length = 1
|
|
266
|
-
@events |= END_OF_BLOCK
|
|
267
|
-
elsif @length == 1 && @ram.peek(@expansion) == read_c64
|
|
268
|
-
@events |= END_OF_BLOCK
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
end
|
data/lib/badline/reu/ram.rb
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Badline
|
|
4
|
-
class REU
|
|
5
|
-
# The REU's DRAM, as the REC addresses it. The REC counts 19 address
|
|
6
|
-
# bits, 17 on the 1700, and the 1764 fills only the first 256K of
|
|
7
|
-
# them: past that a read finds the latch on the REU's data bus, which
|
|
8
|
-
# holds the last byte the REC moved. A unit past 512K takes its upper
|
|
9
|
-
# address lines from the bank register.
|
|
10
|
-
class RAM
|
|
11
|
-
BANK_SIZE = 0x10000
|
|
12
|
-
|
|
13
|
-
# Where a bank of a 1764 that has just been switched on reads
|
|
14
|
-
# inverted, over the first 128K of each 256K. Over the second 128K
|
|
15
|
-
# it is the rest of the bank that reads inverted. Measured from
|
|
16
|
-
# REU/raminitpattern/dumpfile-256k-x1541.bin, a real 1764's dump.
|
|
17
|
-
INVERTED = [0x2a00...0x5400, 0x8000...0xac00, 0xd600...0x10000].freeze
|
|
18
|
-
|
|
19
|
-
attr_reader :size
|
|
20
|
-
attr_accessor :latch
|
|
21
|
-
|
|
22
|
-
def initialize(size, span)
|
|
23
|
-
@size = size
|
|
24
|
-
@mask = (size > 0x80000 ? size : span) - 1
|
|
25
|
-
@banks = Array.new(size / BANK_SIZE) { [] }
|
|
26
|
-
@power_on = [[], []]
|
|
27
|
-
@latch = 0xff
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def peek(addr)
|
|
31
|
-
addr &= @mask
|
|
32
|
-
addr < @size ? bank(addr >> 16)[addr & 0xffff] : @latch
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def poke(addr, value)
|
|
36
|
-
addr &= @mask
|
|
37
|
-
bank(addr >> 16)[addr & 0xffff] = value if addr < @size
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# The latch, and each 64K bank the REC has touched. A bank it hasn't
|
|
41
|
-
# keeps its power-on contents until it does.
|
|
42
|
-
def save_state(out)
|
|
43
|
-
out.int(@latch)
|
|
44
|
-
@banks.each do |bank|
|
|
45
|
-
out.boolean(!bank.empty?)
|
|
46
|
-
out.blob(bank) unless bank.empty?
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def load_state(input)
|
|
51
|
-
@latch = input.int
|
|
52
|
-
@banks.each_index { |number| @banks[number] = input.boolean? ? input.blob : [] }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Every byte, as one string, with a bank the REC hasn't touched at
|
|
56
|
-
# its power-on contents.
|
|
57
|
-
def contents
|
|
58
|
-
power_on = power_on_strings
|
|
59
|
-
Array.new(@banks.length) do |number|
|
|
60
|
-
bank = @banks[number]
|
|
61
|
-
bank.empty? ? power_on[(number >> 1) & 1] : bank.pack("C*")
|
|
62
|
-
end.join
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# Takes every byte from a string as long as the RAM. A bank that
|
|
66
|
-
# holds its power-on contents stays untouched.
|
|
67
|
-
def restore(bytes)
|
|
68
|
-
power_on = power_on_strings
|
|
69
|
-
@banks.each_index do |number|
|
|
70
|
-
slice = bytes.byteslice(number * BANK_SIZE, BANK_SIZE).to_s
|
|
71
|
-
@banks[number] = slice == power_on[(number >> 1) & 1] ? [] : slice.bytes
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
private
|
|
76
|
-
|
|
77
|
-
def power_on_strings
|
|
78
|
-
[0, 1].map do |half|
|
|
79
|
-
@power_on[half] = power_on_bank(half == 1) if @power_on[half].empty?
|
|
80
|
-
@power_on[half].pack("C*")
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# A bank takes its power-on contents the first time it is touched,
|
|
85
|
-
# so an REU costs only the memory a program uses.
|
|
86
|
-
def bank(number)
|
|
87
|
-
bank = @banks[number]
|
|
88
|
-
return bank unless bank.empty?
|
|
89
|
-
|
|
90
|
-
half = (number >> 1) & 1
|
|
91
|
-
@power_on[half] = power_on_bank(half == 1) if @power_on[half].empty?
|
|
92
|
-
@banks[number] = @power_on[half].dup
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# Pairs of $FF and $00 bytes, starting with a single $FF, and each
|
|
96
|
-
# odd page the inverse of the even one before it.
|
|
97
|
-
def power_on_bank(upper)
|
|
98
|
-
Array.new(BANK_SIZE) do |offset|
|
|
99
|
-
byte = (offset + 1).anybits?(2) ? 0x00 : 0xff
|
|
100
|
-
byte ^= 0xff if offset.anybits?(0x100)
|
|
101
|
-
inverted = INVERTED.any? { |range| range.cover?(offset) }
|
|
102
|
-
inverted == upper ? byte : byte ^ 0xff
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Badline
|
|
4
|
-
class REU
|
|
5
|
-
# The REU's state for a snapshot: the REC's registers and the values
|
|
6
|
-
# its counters start from, an armed or running transfer, the IRQ line,
|
|
7
|
-
# the transfer's own state and the RAM. The size is the machine's
|
|
8
|
-
# setup (Snapshot::Setup), so a restore finds an REU of the same size.
|
|
9
|
-
module SavedState
|
|
10
|
-
def size_kb = @size_kb
|
|
11
|
-
|
|
12
|
-
def save_state(out)
|
|
13
|
-
out.marker("REU")
|
|
14
|
-
[@status, @command, @c64, @c64_start, @expansion, @expansion_start, @bank, @bank_start, @length,
|
|
15
|
-
@length_start, @interrupt_mask, @address_control].each { |value| out.int(value) }
|
|
16
|
-
out.boolean(@armed).boolean(@requested).boolean(@running).boolean(@irq).boolean(@ba_was_low)
|
|
17
|
-
@dma.save_state(out)
|
|
18
|
-
@ram.save_state(out)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# The IRQ line comes back as it was without calling back into the
|
|
22
|
-
# machine, which reads it again afterwards.
|
|
23
|
-
def load_state(input)
|
|
24
|
-
input.marker("REU")
|
|
25
|
-
load_registers(input)
|
|
26
|
-
@armed = input.boolean?
|
|
27
|
-
@requested = input.boolean?
|
|
28
|
-
@running = input.boolean?
|
|
29
|
-
@irq = input.boolean?
|
|
30
|
-
@ba_was_low = input.boolean?
|
|
31
|
-
@dma.load_state(input)
|
|
32
|
-
@ram.load_state(input)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# The sixteen bytes the REC's registers read from $DF00, without
|
|
36
|
-
# what reading the status does, as VICE's REU1764 module holds them.
|
|
37
|
-
def register_file = Array.new(16) { |register| register_value(register) }
|
|
38
|
-
|
|
39
|
-
# Sets the registers from a register file, as writing them would but
|
|
40
|
-
# without starting a transfer: each address and the length set both
|
|
41
|
-
# the counter and the value it starts from. A command with the
|
|
42
|
-
# execute bit set and the $FF00 trigger on arms the REC.
|
|
43
|
-
def restore_registers(values)
|
|
44
|
-
@status = (values[STATUS] & (INTERRUPT_PENDING | END_OF_BLOCK | FAULT)) | @chips
|
|
45
|
-
@command = values[COMMAND]
|
|
46
|
-
@c64 = @c64_start = values[C64_LOW] | (values[C64_HIGH] << 8)
|
|
47
|
-
@expansion = @expansion_start = values[EXPANSION_LOW] | (values[EXPANSION_HIGH] << 8)
|
|
48
|
-
@bank = @bank_start = values[EXPANSION_BANK] & @bank_bits
|
|
49
|
-
@length = @length_start = values[LENGTH_LOW] | (values[LENGTH_HIGH] << 8)
|
|
50
|
-
@interrupt_mask = values[INTERRUPT_MASK] | 0x1f
|
|
51
|
-
@address_control = values[ADDRESS_CONTROL] | 0x3f
|
|
52
|
-
@armed = @command.anybits?(EXECUTE) && @command.nobits?(NO_FF00_TRIGGER)
|
|
53
|
-
@requested = @running = @ba_was_low = false
|
|
54
|
-
interrupt(@status.anybits?(INTERRUPT_PENDING))
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# The RAM, every byte of it, as one string.
|
|
58
|
-
def ram_contents = @ram.contents
|
|
59
|
-
|
|
60
|
-
def restore_ram(bytes) = @ram.restore(bytes)
|
|
61
|
-
|
|
62
|
-
private
|
|
63
|
-
|
|
64
|
-
def load_registers(input)
|
|
65
|
-
@status = input.int
|
|
66
|
-
@command = input.int
|
|
67
|
-
@c64 = input.int
|
|
68
|
-
@c64_start = input.int
|
|
69
|
-
@expansion = input.int
|
|
70
|
-
@expansion_start = input.int
|
|
71
|
-
@bank = input.int
|
|
72
|
-
@bank_start = input.int
|
|
73
|
-
@length = input.int
|
|
74
|
-
@length_start = input.int
|
|
75
|
-
@interrupt_mask = input.int
|
|
76
|
-
@address_control = input.int
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
data/lib/badline/reu/trigger.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Badline
|
|
4
|
-
class REU
|
|
5
|
-
# Stands in for the page at $FF00 in the write table, passing each
|
|
6
|
-
# write on to what is mapped there and telling the REC when $FF00 is
|
|
7
|
-
# written, which starts an armed transfer.
|
|
8
|
-
class Trigger
|
|
9
|
-
ADDRESS = 0xff00
|
|
10
|
-
|
|
11
|
-
def initialize(reu)
|
|
12
|
-
@reu = reu
|
|
13
|
-
@target = nil
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Puts the trigger in front of target and returns it.
|
|
17
|
-
def wrap(target)
|
|
18
|
-
@target = target
|
|
19
|
-
self
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def peek(addr)
|
|
23
|
-
@target.peek(addr)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def poke(addr, value)
|
|
27
|
-
@target.poke(addr, value)
|
|
28
|
-
@reu.ff00_written if addr == ADDRESS
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|