badline 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +153 -0
  3. data/CLAUDE.md +11 -7
  4. data/CONTRIBUTING.md +7 -1
  5. data/README.md +169 -20
  6. data/doc/pinned-behaviour.md +128 -0
  7. data/doc/snapshot-format.md +253 -18
  8. data/doc/snapshots.md +57 -23
  9. data/exe/badline-ruby +5 -0
  10. data/lib/badline/audio/terminal.rb +34 -2
  11. data/lib/badline/c128/keyed_state.rb +2 -0
  12. data/lib/badline/c128.rb +1 -0
  13. data/lib/badline/c64/keyed_state.rb +2 -0
  14. data/lib/badline/c64.rb +1 -0
  15. data/lib/badline/cbm2/keyed_state.rb +4 -0
  16. data/lib/badline/cbm2/p500.rb +5 -3
  17. data/lib/badline/cbm2.rb +6 -3
  18. data/lib/badline/chips/cia/timer.rb +2 -2
  19. data/lib/badline/chips/cpu/instruction_set.rb +1 -1
  20. data/lib/badline/chips/m6809/arithmetic.rb +140 -0
  21. data/lib/badline/chips/m6809/bus_steps.rb +223 -0
  22. data/lib/badline/chips/m6809/core.rb +149 -0
  23. data/lib/badline/chips/m6809/indexed.rb +82 -0
  24. data/lib/badline/chips/m6809/interrupts.rb +159 -0
  25. data/lib/badline/chips/m6809/keyed_state.rb +147 -0
  26. data/lib/badline/chips/m6809/opcodes.rb +159 -0
  27. data/lib/badline/chips/m6809/operations.rb +258 -0
  28. data/lib/badline/chips/m6809/plans.rb +143 -0
  29. data/lib/badline/chips/m6809/registers.rb +82 -0
  30. data/lib/badline/chips/m6809/stack.rb +140 -0
  31. data/lib/badline/chips/m6809.rb +13 -0
  32. data/lib/badline/chips/riot/timer.rb +14 -3
  33. data/lib/badline/chips/rriot.rb +4 -2
  34. data/lib/badline/chips/sid/filter.rb +4 -4
  35. data/lib/badline/chips/sid/waveform.rb +6 -6
  36. data/lib/badline/chips/vic_i/keyed_parts.rb +7 -2
  37. data/lib/badline/chips/vic_i.rb +84 -21
  38. data/lib/badline/data_path.rb +3 -3
  39. data/lib/badline/drives/ieee_models.rb +54 -0
  40. data/lib/badline/drives/model1001.rb +37 -0
  41. data/lib/badline/drives/model2031.rb +6 -0
  42. data/lib/badline/drives/model4040/disk.rb +62 -0
  43. data/lib/badline/drives/model4040/ip_bus.rb +46 -0
  44. data/lib/badline/drives/model4040/keyed_state.rb +57 -0
  45. data/lib/badline/drives/model4040/mechanism.rb +192 -0
  46. data/lib/badline/drives/model4040/parts.rb +20 -0
  47. data/lib/badline/drives/model4040.rb +179 -0
  48. data/lib/badline/drives/model8050/board.rb +77 -0
  49. data/lib/badline/drives/model8050/dos_board.rb +91 -0
  50. data/lib/badline/drives/model8050/idle.rb +11 -7
  51. data/lib/badline/drives/model8050/keyed_state.rb +5 -2
  52. data/lib/badline/drives/model8050.rb +18 -130
  53. data/lib/badline/drives/model9060/idle.rb +149 -0
  54. data/lib/badline/drives/model9060/keyed_state.rb +123 -0
  55. data/lib/badline/drives/model9060/parts.rb +98 -0
  56. data/lib/badline/drives/model9060/sasi_bus.rb +88 -0
  57. data/lib/badline/drives/model9060/sasi_commands.rb +168 -0
  58. data/lib/badline/drives/model9060/sasi_target.rb +161 -0
  59. data/lib/badline/drives/model9060.rb +195 -0
  60. data/lib/badline/frontend/app.rb +8 -0
  61. data/lib/badline/frontend/boot.rb +3 -2
  62. data/lib/badline/frontend/controls.rb +62 -6
  63. data/lib/badline/frontend/keys.rb +36 -0
  64. data/lib/badline/frontend/kim1_panel.rb +208 -0
  65. data/lib/badline/frontend/media_slots.rb +8 -1
  66. data/lib/badline/frontend/menu/drive_types.rb +56 -0
  67. data/lib/badline/frontend/menu/menu_dialogs.rb +61 -14
  68. data/lib/badline/frontend/menu/menu_media.rb +42 -12
  69. data/lib/badline/frontend/menu/menu_pages.rb +97 -2
  70. data/lib/badline/frontend/menu/menu_ports.rb +38 -1
  71. data/lib/badline/frontend/menu/pause_menu.rb +5 -1
  72. data/lib/badline/frontend/pet_keyboard.rb +23 -1
  73. data/lib/badline/frontend/screen.rb +1 -1
  74. data/lib/badline/frontend/screens.rb +40 -2
  75. data/lib/badline/frontend/teletype_pane.rb +152 -0
  76. data/lib/badline/frontend/timeline.rb +31 -2
  77. data/lib/badline/frontend.rb +3 -0
  78. data/lib/badline/kim1/bus.rb +117 -0
  79. data/lib/badline/kim1/cpu.rb +25 -0
  80. data/lib/badline/kim1/host_terminal.rb +74 -0
  81. data/lib/badline/kim1/key_entry.rb +74 -0
  82. data/lib/badline/kim1/keyed_modules.rb +53 -0
  83. data/lib/badline/kim1/keyed_state.rb +133 -0
  84. data/lib/badline/kim1/panel.rb +176 -0
  85. data/lib/badline/kim1/rriots.rb +28 -0
  86. data/lib/badline/kim1/sound.rb +29 -0
  87. data/lib/badline/kim1/tape.rb +116 -0
  88. data/lib/badline/kim1/teletype.rb +193 -0
  89. data/lib/badline/kim1.rb +190 -0
  90. data/lib/badline/machine/ieee_drives.rb +94 -117
  91. data/lib/badline/machine/keyboard_buffer.rb +20 -3
  92. data/lib/badline/machine/line_sound.rb +122 -0
  93. data/lib/badline/machine.rb +46 -15
  94. data/lib/badline/media/extensions.rb +8 -4
  95. data/lib/badline/media/kim1_media.rb +150 -0
  96. data/lib/badline/media/pet_media.rb +3 -1
  97. data/lib/badline/media/true_drive.rb +42 -45
  98. data/lib/badline/media.rb +12 -6
  99. data/lib/badline/options/family.rb +98 -8
  100. data/lib/badline/options/help.rb +44 -12
  101. data/lib/badline/options/table.rb +43 -11
  102. data/lib/badline/options/validation.rb +44 -8
  103. data/lib/badline/options.rb +27 -8
  104. data/lib/badline/pet/bus.rb +16 -2
  105. data/lib/badline/pet/keyboard_ports.rb +9 -2
  106. data/lib/badline/pet/keyed_state.rb +4 -0
  107. data/lib/badline/pet/model.rb +11 -2
  108. data/lib/badline/pet/rom_sets.rb +1 -0
  109. data/lib/badline/pet/sound.rb +5 -105
  110. data/lib/badline/pet/superpet/acia.rb +12 -0
  111. data/lib/badline/pet/superpet/board.rb +221 -0
  112. data/lib/badline/pet/superpet/dongle.rb +81 -0
  113. data/lib/badline/pet/superpet/keyed_modules.rb +63 -0
  114. data/lib/badline/pet/superpet/keyed_parts.rb +76 -0
  115. data/lib/badline/pet/superpet/m6809.rb +32 -0
  116. data/lib/badline/pet/superpet/waterloo_traps.rb +199 -0
  117. data/lib/badline/pet/superpet.rb +216 -0
  118. data/lib/badline/pet.rb +19 -3
  119. data/lib/badline/plus4/keyed_state.rb +2 -0
  120. data/lib/badline/plus4.rb +1 -0
  121. data/lib/badline/roms/1001/fdc-251257-02a.rom +0 -0
  122. data/lib/badline/roms/4040/dos-1.2.rom +0 -0
  123. data/lib/badline/roms/4040/dos-2.1-rev.rom +0 -0
  124. data/lib/badline/roms/4040/dos-2.1.rom +0 -0
  125. data/lib/badline/roms/4040/fdc-901466-02.rom +0 -0
  126. data/lib/badline/roms/4040/fdc-901466-04.rom +0 -0
  127. data/lib/badline/roms/9060/dos-3.0.rom +0 -0
  128. data/lib/badline/roms/9060/sasi-300515-revb.rom +0 -0
  129. data/lib/badline/roms/README +166 -0
  130. data/lib/badline/roms/kim1/6530-002.rom +0 -0
  131. data/lib/badline/roms/kim1/6530-003.rom +0 -0
  132. data/lib/badline/roms/pet/characters-superpet.rom +0 -0
  133. data/lib/badline/roms/pet/superpet-a000.rom +0 -0
  134. data/lib/badline/roms/pet/superpet-c000.rom +0 -0
  135. data/lib/badline/roms/pet/superpet-e000-50hz.rom +0 -0
  136. data/lib/badline/roms/pet/superpet-e000.rom +0 -0
  137. data/lib/badline/snapshot/container.rb +2 -0
  138. data/lib/badline/snapshot/field_doc/markdown.rb +1 -1
  139. data/lib/badline/snapshot/field_doc.rb +27 -6
  140. data/lib/badline/snapshot/image.rb +4 -1
  141. data/lib/badline/snapshot/kim1_setup.rb +28 -0
  142. data/lib/badline/snapshot/pet_setup.rb +27 -11
  143. data/lib/badline/snapshot/storage_setup.rb +4 -1
  144. data/lib/badline/snapshot/vic20_setup.rb +11 -7
  145. data/lib/badline/snapshot/vice/pet.rb +13 -7
  146. data/lib/badline/snapshot/vice/pet_cpu.rb +39 -5
  147. data/lib/badline/snapshot/vice/pet_crtc.rb +15 -2
  148. data/lib/badline/snapshot/vice/pet_drive8050.rb +188 -68
  149. data/lib/badline/snapshot/vice/pet_mem.rb +49 -5
  150. data/lib/badline/snapshot/vice/pet_restore.rb +40 -11
  151. data/lib/badline/snapshot.rb +4 -0
  152. data/lib/badline/status.rb +30 -30
  153. data/lib/badline/storage/d67_image.rb +55 -0
  154. data/lib/badline/storage/d90_image.rb +180 -0
  155. data/lib/badline/storage/disk_image/writing.rb +2 -2
  156. data/lib/badline/storage/kim_tape.rb +254 -0
  157. data/lib/badline/storage/papertape.rb +90 -0
  158. data/lib/badline/storage.rb +4 -0
  159. data/lib/badline/support/kim1_checkpoint.rb +41 -0
  160. data/lib/badline/support/superpet_checkpoint.rb +35 -0
  161. data/lib/badline/version.rb +1 -1
  162. data/lib/badline/vic20/keyed_modules.rb +6 -3
  163. data/lib/badline/vic20/keyed_state.rb +6 -4
  164. data/lib/badline/vic20.rb +26 -12
  165. data/lib/badline.rb +1 -0
  166. metadata +77 -1
@@ -23,11 +23,11 @@ key only some of them have names them.
23
23
 
24
24
  ## BL-MACHINE
25
25
 
26
- Written by the C64, VIC-20, C128, Plus/4, PET, CBM-II.
26
+ Written by the C64, VIC-20, C128, Plus/4, PET, CBM-II, KIM-1.
27
27
 
28
28
  | Key | Type | Default |
29
29
  | --- | --- | --- |
30
- | `family` | text: c64 vic20 c128 plus4 pet cbm2 | "c64" |
30
+ | `family` | text: c64 vic20 c128 plus4 pet cbm2 kim1 | "c64" |
31
31
  | `region` | text: pal ntsc ntscold drean | C64: "pal" |
32
32
  | `vic_model` | text: mos6569 mos8565 mos8566 mos8564 | C64: "mos6569" |
33
33
  | `cia_model` | text: mos6526 mos6526a | C64: "mos6526" |
@@ -45,19 +45,20 @@ Written by the C64, VIC-20, C128, Plus/4, PET, CBM-II.
45
45
  | `freeze_writes` | int | C64: 0 |
46
46
  | `dma` | bool | C64: false |
47
47
  | `host.pending_keys` | ints | [] |
48
+ | `host.init_keys` | ints | C64: []; VIC-20: []; C128: []; Plus/4: []; PET: []; CBM-II: [] |
48
49
  | `host.init_pending` | int | 0 |
49
50
  | `written_by` | text | "" |
50
- | `ram` | text: unexpanded 3k 8k 16k 24k 32k all | VIC-20: "unexpanded" |
51
+ | `ram` | text: unexpanded 3k 8k 16k 24k 32k all | VIC-20: "unexpanded"; KIM-1: "1k" |
52
+ | `model` | text: pal ntsc | VIC-20: "pal"; C128: "c128"; Plus/4: "plus4"; PET: "8032"; CBM-II: "610" |
51
53
  | `bus.data` | byte | VIC-20: 253; C128: 255 |
52
54
  | `bus.video_data` | byte | VIC-20: 0 |
53
- | `model` | text: c128 c128ntsc c128dcr c128dcrntsc | C128: "c128"; Plus/4: "plus4"; PET: "8032"; CBM-II: "610" |
54
55
  | `mode` | text: c64 c128 | C128: "c64" |
55
56
  | `bus.address` | word | C128: 65533 |
56
57
  | `clock_bits` | int | C128: 0 |
57
58
  | `z80_ahead` | int | C128: 0 |
58
59
  | `chips_ahead` | int | C128: 0 |
59
60
  | `cpu_reset_pending` | bool | C128: true |
60
- | `host.typing` | bool | C128: false |
61
+ | `host.typing` | bool | C128: false; KIM-1: false |
61
62
  | `host.holding_commodore` | bool | C128: false |
62
63
  | `host.typist.code` | int, optional | C128: absent |
63
64
  | `host.typist.wait` | int | C128: 0 |
@@ -71,22 +72,29 @@ Written by the C64, VIC-20, C128, Plus/4, PET, CBM-II.
71
72
  | `rom.basic` | text | PET: "pet/basic4.rom" or "pet/basic1.rom" |
72
73
  | `rom.editor` | text | PET: "pet/editor4-80-b-50hz.rom" or "pet/editor1.rom" or "pet/editor4-80-b-50hz-8296.rom" |
73
74
  | `rom.kernal` | text | PET: "pet/kernal4.rom" or "pet/kernal1.rom" |
74
- | `rom.characters` | text | PET: "pet/characters2.rom" or "pet/characters1.rom" |
75
+ | `rom.characters` | text | PET: "pet/characters2.rom" or "pet/characters1.rom" or "pet/characters-superpet.rom" |
75
76
  | `jumpers` | text | PET: "" |
76
77
  | `vertical_drive` | bool | PET: true |
78
+ | `host.ieee_drive_model` | text: 2031 8050 8250 1001 4040 3040 2040 9060 9090 | PET: "2031"; CBM-II: "2031" |
79
+ | `cpu_switch` | text: 6502 6809 prog | PET: "6502" |
80
+ | `ram_switch` | text: rw read prog | PET: "rw" |
77
81
  | `mains_hz` | int | CBM-II: 50 |
78
82
  | `dram_refresh` | bool | CBM-II: true |
79
83
  | `mains_countdown` | int | CBM-II: varies |
80
84
  | `mains_high` | bool | CBM-II: true |
81
85
  | `refresh` | int | CBM-II: 0 |
86
+ | `sst` | bool | KIM-1: false |
87
+ | `irq_wired` | bool | KIM-1: false |
88
+ | `host.key_down` | bool | KIM-1: false |
89
+ | `host.next_key_at` | int | KIM-1: 0 |
82
90
 
83
91
  ## BL-RAM
84
92
 
85
- Written by the C64, VIC-20, C128, Plus/4, PET, CBM-II.
93
+ Written by the C64, VIC-20, C128, Plus/4, PET, KIM-1, CBM-II.
86
94
 
87
95
  | Key | Type | Default |
88
96
  | --- | --- | --- |
89
- | `ram` | bytes | C64: 65536 values; VIC-20: 49152 values; C128: 131072 values; Plus/4: 65536 × 0 or 16384 × 0; PET: 32768 × 0 or 8192 × 0 |
97
+ | `ram` | bytes | C64: 65536 values; VIC-20: 49152 values; C128: 131072 values; Plus/4: 65536 × 0 or 16384 × 0; PET: 32768 × 0 or 8192 × 0; KIM-1: 1024 × 0 or 57344 × 0 |
90
98
  | `bus.low_bank` | int & 0x3 | Plus/4: 0 |
91
99
  | `bus.high_bank` | int & 0x3 | Plus/4: 0 |
92
100
  | `bus.rom_selected` | bool | Plus/4: true |
@@ -99,7 +107,7 @@ Written by the C64, VIC-20, C128, Plus/4, PET, CBM-II.
99
107
  | `segment<N>` | bytes | CBM-II: 65536 × 0 |
100
108
  | `execution_segment` | int & 0xf | CBM-II: 15 |
101
109
  | `indirect_segment` | int & 0xf | CBM-II: 15 |
102
- | `data` | byte | CBM-II: 249 |
110
+ | `data` | byte | CBM-II: 249; KIM-1: 28 |
103
111
  | `cartridge.addresses` | ints | CBM-II: [] |
104
112
  | `cartridge.8192` | bytes | CBM-II: [] |
105
113
 
@@ -114,14 +122,14 @@ Written by the C64, VIC-20, CBM-II, C128.
114
122
 
115
123
  ## BL-CPU
116
124
 
117
- Written by the C64, C128, Plus/4, VIC-20, PET, CBM-II.
125
+ Written by the C64, C128, Plus/4, VIC-20, PET, CBM-II, KIM-1.
118
126
 
119
127
  | Key | Type | Default |
120
128
  | --- | --- | --- |
121
129
  | `port.ddr` | byte | C64: 0; C128: 0; Plus/4: 0 |
122
130
  | `port.data` | byte | C64: 0; C128: 0; Plus/4: 0 |
123
131
  | `port.floating` | byte | C64: 0; C128: 0 |
124
- | `pc` | word | C64: 64738; VIC-20: 64802; C128: 65341; Plus/4: 65526; PET: 64790 or 64824; CBM-II: 63895 or 63902 |
132
+ | `pc` | word | C64: 64738; VIC-20: 64802; C128: 65341; Plus/4: 65526; PET: 64790 or 64824; CBM-II: 63895 or 63902; KIM-1: 7202 |
125
133
  | `sp` | byte | 255 |
126
134
  | `a` | byte | 0 |
127
135
  | `x` | byte | 0 |
@@ -572,7 +580,7 @@ Written by the C64, PET, CBM-II.
572
580
 
573
581
  | Key | Type | Default |
574
582
  | --- | --- | --- |
575
- | `storage.kind` | text: directory d64 d71 d81 t64 d80 d82 | "directory" |
583
+ | `storage.kind` | text: directory d64 d71 d81 t64 d80 d82 d67 | "directory" |
576
584
  | `storage.path` | text | "" |
577
585
  | `storage.bytes` | bytes | [] |
578
586
  | `storage.read_only` | bool | false |
@@ -601,6 +609,11 @@ Written by the C64, PET, CBM-II.
601
609
  | `ieee.talk_channel` | int, optional | PET: absent; CBM-II: absent |
602
610
  | `ieee.frame` | int | PET: 240; CBM-II: 240 |
603
611
  | `ieee.buffer` | bytes | PET: []; CBM-II: [] |
612
+ | `waterloo.listening` | bool | PET: false |
613
+ | `waterloo.talking` | bool | PET: false |
614
+ | `waterloo.channel` | int | PET: 0 |
615
+ | `waterloo.frame` | byte | PET: 0 |
616
+ | `waterloo.buffer` | ints | PET: [] |
604
617
 
605
618
  ## BL-D8
606
619
 
@@ -608,7 +621,7 @@ Written by the C64, C128, Plus/4, PET.
608
621
 
609
622
  | Key | Type | Default |
610
623
  | --- | --- | --- |
611
- | `model` | text: 1541 1551 1571 1581 | C64: "1541" or "1581"; C128: "1541" or "1571"; Plus/4: "1541" or "1551"; PET: "2031" or "8050" or "8250" |
624
+ | `model` | text: 1541 1551 1571 1581 | C64: "1541" or "1581"; C128: "1541" or "1571"; Plus/4: "1541" or "1551"; PET: varies |
612
625
  | `phase` | int | 0 |
613
626
  | `cycles` | int | 0 |
614
627
  | `so_pending` | bool | false |
@@ -617,8 +630,11 @@ Written by the C64, C128, Plus/4, PET.
617
630
  | `irq_timer` | int | Plus/4: 16660 |
618
631
  | `latched_byte` | byte | Plus/4: 0 |
619
632
  | `ieee.host` | int | PET: 0 |
620
- | `ip_data` | byte | PET: 242 |
633
+ | `ip_data` | byte | PET: 242 or 211 |
621
634
  | `fdc_data` | byte | PET: 252 |
635
+ | `sasi_data` | byte | PET: 248 |
636
+ | `sasi.ack_high` | bool | PET: true |
637
+ | `sasi.reset_high` | bool | PET: false |
622
638
 
623
639
  ## BL-D8-RAM
624
640
 
@@ -765,7 +781,7 @@ Written by the C64, C128, Plus/4, PET.
765
781
  | `track<N>.zone` | int, optional | absent |
766
782
  | `written` | ints | [] |
767
783
  | `changed` | ints | C64: [] |
768
- | `image.format` | text: d80 d82 | PET: "d80" |
784
+ | `image.format` | text: d80 d82 | PET: "d80" or "d64" |
769
785
  | `track<N>` | ints | PET: [] |
770
786
 
771
787
  ## BL-D8-MECH
@@ -807,6 +823,7 @@ Written by the C64, C128, Plus/4, PET.
807
823
  | `so_pending` | bool | PET: false |
808
824
  | `ca1_low` | bool | PET: false |
809
825
  | `data_in` | byte | PET: 255 |
826
+ | `half_tracks` | ints | PET: [0, 0] |
810
827
 
811
828
  ## BL-D8-CIA
812
829
 
@@ -969,6 +986,8 @@ Written by the VIC-20.
969
986
  | `registers` | bytes | 16 × 0 |
970
987
  | `raster` | int | 0 |
971
988
  | `column` | int | 0 |
989
+ | `frame_lines` | int | 312 |
990
+ | `long_field` | bool | true |
972
991
  | `window_open` | bool | false |
973
992
  | `window_done` | bool | false |
974
993
  | `row_start` | int | 0 |
@@ -1226,7 +1245,7 @@ Written by the Plus/4.
1226
1245
 
1227
1246
  ## BL-ACIA
1228
1247
 
1229
- Written by the Plus/4, CBM-II.
1248
+ Written by the Plus/4, PET, CBM-II.
1230
1249
 
1231
1250
  | Key | Type | Default |
1232
1251
  | --- | --- | --- |
@@ -1533,7 +1552,7 @@ Written by the PET.
1533
1552
 
1534
1553
  | Key | Type | Default |
1535
1554
  | --- | --- | --- |
1536
- | `pc` | word | 62135 |
1555
+ | `pc` | word | 62135 or 54059 or 61972 |
1537
1556
  | `sp` | byte | 255 |
1538
1557
  | `a` | byte | 0 |
1539
1558
  | `x` | byte | 0 |
@@ -1559,7 +1578,7 @@ Written by the PET.
1559
1578
 
1560
1579
  | Key | Type | Default |
1561
1580
  | --- | --- | --- |
1562
- | `pc` | word | 64516 |
1581
+ | `pc` | word | 64516 or 64521 |
1563
1582
  | `sp` | byte | 255 |
1564
1583
  | `a` | byte | 0 |
1565
1584
  | `x` | byte | 0 |
@@ -1646,6 +1665,125 @@ Written by the PET.
1646
1665
  | `timer.irq_enabled` | bool | false |
1647
1666
  | `timer.fired` | bool | false |
1648
1667
 
1668
+ ## BL-D8-SASICPU
1669
+
1670
+ Written by the PET.
1671
+
1672
+ | Key | Type | Default |
1673
+ | --- | --- | --- |
1674
+ | `pc` | word | 63489 |
1675
+ | `sp` | byte | 255 |
1676
+ | `a` | byte | 0 |
1677
+ | `x` | byte | 0 |
1678
+ | `y` | byte | 0 |
1679
+ | `p` | byte | 32 |
1680
+ | `nmi` | bool | false |
1681
+ | `so_high` | bool | true |
1682
+ | `irq.sample` | bool | false |
1683
+ | `irq.pending` | bool | false |
1684
+ | `irq.boundary` | bool | false |
1685
+ | `nmi.sample` | bool | false |
1686
+ | `nmi.pending` | bool | false |
1687
+ | `nmi.boundary` | bool | false |
1688
+ | `skip_poll` | bool | false |
1689
+ | `cycles` | int | 0 |
1690
+ | `instructions` | int | 0 |
1691
+ | `stalled` | int, optional | absent |
1692
+ | `pos.seq` | text: boundary op interrupt jam | "boundary" |
1693
+
1694
+ ## BL-D8-SASIRAM
1695
+
1696
+ Written by the PET.
1697
+
1698
+ | Key | Type | Default |
1699
+ | --- | --- | --- |
1700
+ | `ram` | bytes | 128 × 0 |
1701
+
1702
+ ## BL-D8-SASI
1703
+
1704
+ Written by the PET.
1705
+
1706
+ | Key | Type | Default |
1707
+ | --- | --- | --- |
1708
+ | `phase` | int | 0 |
1709
+ | `request` | bool | false |
1710
+ | `delay` | int | 0 |
1711
+ | `command` | ints | [] |
1712
+ | `buffer` | ints | [] |
1713
+ | `index` | int | 0 |
1714
+ | `writing` | bool | false |
1715
+ | `sense` | ints | [0, 0, 0, 0] |
1716
+ | `last_sense` | ints | [0, 0, 0, 0] |
1717
+ | `fast` | bool | false |
1718
+ | `cycle` | int | 0 |
1719
+ | `cylinder` | int | 0 |
1720
+ | `heads` | int | 4 |
1721
+ | `sectors` | int | 32 |
1722
+ | `block_buffer` | ints | 256 × 0 |
1723
+ | `path` | text | "" |
1724
+ | `read_only` | bool | false |
1725
+ | `disk_heads` | int | 4 |
1726
+
1727
+ ## BL-SUPERPET
1728
+
1729
+ Written by the PET.
1730
+
1731
+ | Key | Type | Default |
1732
+ | --- | --- | --- |
1733
+ | `bank_latch` | byte | 0 |
1734
+ | `system_latch` | byte | 0 |
1735
+ | `socket` | int | 0 |
1736
+ | `ram` | bytes | 65536 × 0 |
1737
+ | `dongle.registers` | ints | [0, 0, 0, 0, 0, 0, 0, 0] |
1738
+ | `dongle.latch` | byte | 255 |
1739
+ | `dongle.shift_in` | int, optional | absent |
1740
+
1741
+ ## BL-M6809
1742
+
1743
+ Written by the PET.
1744
+
1745
+ | Key | Type | Default |
1746
+ | --- | --- | --- |
1747
+ | `a` | byte | 0 |
1748
+ | `b` | byte | 0 |
1749
+ | `x` | word | 0 |
1750
+ | `y` | word | 0 |
1751
+ | `u` | word | 0 |
1752
+ | `s` | word | 0 |
1753
+ | `pc` | word | 0 |
1754
+ | `dp` | byte | 0 |
1755
+ | `cc` | byte | 80 |
1756
+ | `cycles` | int | 0 |
1757
+ | `irq` | bool | false |
1758
+ | `firq` | bool | false |
1759
+ | `nmi` | bool | false |
1760
+ | `halt` | bool | false |
1761
+ | `irq.latched` | bool | false |
1762
+ | `irq.seen` | bool | false |
1763
+ | `firq.latched` | bool | false |
1764
+ | `firq.seen` | bool | false |
1765
+ | `nmi.edge` | bool | false |
1766
+ | `nmi.latched` | bool | false |
1767
+ | `nmi.seen` | bool | false |
1768
+ | `nmi.armed` | bool | false |
1769
+ | `halt.latched` | bool | false |
1770
+ | `halt.seen` | bool | false |
1771
+ | `ea` | word | 0 |
1772
+ | `value` | word | 0 |
1773
+ | `post` | byte | 0 |
1774
+ | `opcode` | byte | 0 |
1775
+ | `operation` | text: none enter_nmi enter_firq enter_irq neg xnc com lsr ror asr asl rol dec xdec inc tst jmp clr nop sync jsr x18 daa orcc andcc sex exg tfr leax leay leas leau abx mul xres swi nega xnca coma lsra rora asra asla rola deca xdeca inca tsta xclra clra negb xncb comb lsrb rorb asrb aslb rolb decb xdecb incb tstb xclrb clrb suba cmpa sbca subd anda bita lda xsta eora adca ora adda cmpx ldx xstx sta stx subb cmpb sbcb addd andb bitb ldb xstb eorb adcb orb addb ldd ldu xstu stb std stu xswi2 swi2 cmpd xsta2 cmpy ldy xsty sty xaddd xstb2 lds xsts sts xfirq swi3 cmpu cmps xstx2 xaddu xstu2 | "none" |
1776
+ | `page` | int | 1 |
1777
+ | `group` | int | 0 |
1778
+ | `previous_group` | int | 0 |
1779
+ | `alu_word` | int | 0 |
1780
+ | `vector` | word | 65534 |
1781
+ | `interrupt_mask` | byte | 0 |
1782
+ | `stack_u` | bool | false |
1783
+ | `pos.plan` | text | "fetch" |
1784
+ | `pos.tail` | text | "none" |
1785
+ | `pos.index` | int | 0 |
1786
+
1649
1787
  ## BL-CIA
1650
1788
 
1651
1789
  Written by the CBM-II.
@@ -1747,3 +1885,100 @@ Written by the CBM-II.
1747
1885
  | `ca` | bool | false |
1748
1886
  | `cb` | bool | false |
1749
1887
  | `lines` | int & 0x1f | 31 |
1888
+
1889
+ ## BL-U2
1890
+
1891
+ Written by the KIM-1.
1892
+
1893
+ | Key | Type | Default |
1894
+ | --- | --- | --- |
1895
+ | `ram` | bytes | 64 × 0 |
1896
+ | `ora` | byte | 0 |
1897
+ | `orb` | byte | 0 |
1898
+ | `ddra` | byte | 0 |
1899
+ | `ddrb` | byte | 0 |
1900
+ | `timer.counter` | byte | 0 |
1901
+ | `timer.interval` | int & 0x3 | 0 |
1902
+ | `timer.prescale` | int | 1 |
1903
+ | `timer.expired` | bool | true |
1904
+ | `timer.flag` | bool | false |
1905
+ | `timer.irq_enabled` | bool | false |
1906
+ | `timer.fired` | bool | false |
1907
+
1908
+ ## BL-U3
1909
+
1910
+ Written by the KIM-1.
1911
+
1912
+ | Key | Type | Default |
1913
+ | --- | --- | --- |
1914
+ | `ram` | bytes | 64 × 0 |
1915
+ | `ora` | byte | 0 |
1916
+ | `orb` | byte | 0 |
1917
+ | `ddra` | byte | 0 |
1918
+ | `ddrb` | byte | 0 |
1919
+ | `timer.counter` | byte | 0 |
1920
+ | `timer.interval` | int & 0x3 | 0 |
1921
+ | `timer.prescale` | int | 1 |
1922
+ | `timer.expired` | bool | true |
1923
+ | `timer.flag` | bool | false |
1924
+ | `timer.irq_enabled` | bool | false |
1925
+ | `timer.fired` | bool | false |
1926
+
1927
+ ## BL-PANEL
1928
+
1929
+ Written by the KIM-1.
1930
+
1931
+ | Key | Type | Default |
1932
+ | --- | --- | --- |
1933
+ | `tty` | bool | false |
1934
+ | `held` | int | -1 |
1935
+ | `digit` | int | -1 |
1936
+ | `segments` | int & 0x7f | 0 |
1937
+ | `since` | int | 0 |
1938
+ | `lit` | ints | 42 × 0 |
1939
+ | `shown` | ints | [0, 0, 0, 0, 0, 0] |
1940
+ | `shown_at` | ints | [-20001, -20001, -20001, -20001, -20001, -20001] |
1941
+
1942
+ ## BL-DECK
1943
+
1944
+ Written by the KIM-1.
1945
+
1946
+ | Key | Type | Default |
1947
+ | --- | --- | --- |
1948
+ | `tape.gaps` | ints | [] |
1949
+ | `tape.path` | text | "" |
1950
+ | `playing` | bool | false |
1951
+ | `recording` | bool | false |
1952
+ | `position` | int | 0 |
1953
+ | `next_edge` | int | 0 |
1954
+ | `high` | bool | true |
1955
+ | `output_high` | bool | true |
1956
+
1957
+ ## BL-TTY
1958
+
1959
+ Written by the KIM-1.
1960
+
1961
+ | Key | Type | Default |
1962
+ | --- | --- | --- |
1963
+ | `baud` | int | 9600 |
1964
+ | `queue` | ints | [] |
1965
+ | `output` | bytes | [] |
1966
+ | `line_high` | bool | true |
1967
+ | `send.byte` | int | 0 |
1968
+ | `send.bits` | int | 11 |
1969
+ | `send.start` | int | 0 |
1970
+ | `quiet_until` | int | 0 |
1971
+ | `receive.busy` | bool | false |
1972
+ | `receive.byte` | int | 0 |
1973
+ | `receive.bits` | int | 0 |
1974
+ | `receive.edge` | int | 0 |
1975
+ | `receive.sample_at` | int | 0 |
1976
+ | `printer_high` | bool | true |
1977
+
1978
+ ## BL-SOUND
1979
+
1980
+ Written by the KIM-1.
1981
+
1982
+ | Key | Type | Default |
1983
+ | --- | --- | --- |
1984
+ | `speaker` | bool | false |
data/doc/snapshots.md CHANGED
@@ -17,7 +17,7 @@ autosave that fails warns once and stops autosaving.
17
17
 
18
18
  The pause menu's Snapshots page quicksaves, saves under a name in the
19
19
  `saves` folder and loads a named save. The name starts as the game's,
20
- from its cartridge, disk or tape, or BASIC, with the next free number,
20
+ from its cartridge, disk or tape, or BASIC, or KIM-1 on a KIM-1, with the next free number,
21
21
  and saving over a name already taken asks first. Below those, the
22
22
  newest quicksaves and autosaves, with the time each was saved, load
23
23
  with a press.
@@ -149,9 +149,14 @@ port lines the 8296's RAM follows, both PIAs, the VIA, the CPU, the
149
149
  CRTC on the boards that have one, the picture with where the video is
150
150
  in its frame, the tapes in both datasettes with their places on them,
151
151
  and the disk or directory device 8 serves through the IEEE-488 traps.
152
- It restores into a machine of the same model with the same RAM, the
153
- same editor frame rate, the same ROMs, which come with the model, and
154
- an 8296's same jumpers. Its file names its machine `PET`, as xpet's do,
152
+ A SuperPET's also holds its board's latches and 64K of bank RAM, the
153
+ 6702, the ACIA, the 6809 and the traps on the Waterloo ROM's IEEE-488
154
+ routines, in 6502 mode and in 6809 mode alike, and saves once the CPU
155
+ that has the bus is between instructions. It restores into a machine of
156
+ the same model with the same RAM, the same editor frame rate, the same
157
+ ROMs, which come with the model, an 8296's same jumpers and a SuperPET's
158
+ CPU and RAM switches at the same positions. Its file names its machine
159
+ `PET`, as xpet's do,
155
160
  and holds only badline's modules, so xpet doesn't open it unless it is
156
161
  saved with `--vice` (see [xpet](#xpet)).
157
162
 
@@ -160,28 +165,35 @@ saved with `--vice` (see [xpet](#xpet)).
160
165
  A PET snapshot saved with `--vice`, or `computer.export_snapshot(path)`,
161
166
  also holds xpet's modules for the CPU, the RAM with the screen RAM, or
162
167
  an 8296's 32K from `$8000`, an 8096's or 8296's board and its control
163
- register, the CRTC, both PIAs and the VIA, a true 2031's CPU, RAM, VIAs
164
- and head, or a true 8050's or 8250's interface processor with its RAM
165
- and 6532s and the heads' tracks, and the ones xpet 3.10 needs to open
168
+ register, a SuperPET's board, its bank and its `$EFFE` bit, the CRTC
169
+ with the character set VIA CA2 picks, both PIAs and the VIA, a
170
+ SuperPET's 6809 and ACIA, a true 2031's CPU, RAM, VIAs and head, or the
171
+ interface processor of a true 8050, 8250, SFD-1001, 4040, 3040, 2040,
172
+ D9060 or D9090, with its RAM and 6532s and the heads' tracks, and the
173
+ ones xpet 3.10 needs to open
166
174
  the file, with nothing open on the file system drive and nothing on the
167
175
  user port. The CRTC module carries the discrete boards' video too, in
168
176
  xpet's terms. The file says it is in VICE's snapshot format 1.0, the
169
177
  only one xpet reads.
170
178
 
171
179
  xpet 3.10 opens those snapshots as long as its model and editor match:
172
- `-model 2001`, `3032`, `3032B`, `4032`, `8032`, `8096` or `8296`, and
173
- for a badline editor other than xpet's own, `-editor` naming badline's
174
- ROM. xpet's 8296 runs the 8032's editor, 901474-04 dated 0283, so an
180
+ `-model 2001`, `3032`, `3032B`, `4032`, `8032`, `8096`, `8296` or
181
+ `SuperPET`, and for a badline editor other than xpet's own, `-editor`
182
+ naming badline's ROM. xpet runs a SuperPET's 6809 when the snapshot
183
+ says it has the bus, whatever its own CPU switch, and has no system
184
+ latch, write protect or 6702 to take from it. xpet's 8296 runs the 8032's editor, 901474-04 dated 0283, so an
175
185
  8296 saved for it has to run that editor (`--editor 4-80-b-50hz-0283`),
176
186
  and xpet takes the 8296's jumpers from its own settings. It keeps its
177
187
  own datasettes and leaves out badline's tapes and disks. A true drive
178
- needs `-drive8type 2031`, `8050` or `8250` with `-drive8truedrive` and
179
- the disk attached as `-8`. Its snapshot is settled with the 2031's CPU
188
+ needs `-drive8type 2031`, `8050`, `8250`, `1001`, `4040`, `3040`,
189
+ `2040`, or `9000` for either hard disk, with `-drive8truedrive` and the
190
+ disk attached as `-8`. Its snapshot is settled with the 2031's CPU
180
191
  between instructions too, and one saved while the 2031 talks on the bus
181
192
  can stall there in xpet, as xpet's own snapshots saved while it searches
182
- for a file do. xpet runs an 8050's floppy controller at a high level, so
183
- a snapshot for it is settled until badline's controller sits in its idle
184
- loop with both processors between instructions, and xpet's controller
193
+ for a file do. xpet runs an 8050's floppy controller, and a hard disk's
194
+ SASI host, at a high level, so a snapshot for it is settled until
195
+ badline's controller, or host, sits in its idle loop with both
196
+ processors between instructions, and xpet's controller
185
197
  starts from idle there, taking up any job the interface processor has
186
198
  left it. A unit that doesn't reach its idle loop within about 262,000
187
199
  cycles, such as one still starting up, is left out of xpet's modules,
@@ -195,24 +207,33 @@ at its instruction boundary, the RAM, the screen RAM, an 8096's or
195
207
  8296's board, the CRTC's registers and beam, both PIAs' registers and
196
208
  flags, the VIA's registers, timers and shift register, a true 2031's
197
209
  CPU, RAM, VIAs and head, which go on the bus with the disk badline's
198
- 2031 had in it, and a true 8050's or 8250's interface processor, its RAM
199
- and both 6532s, which go on the bus with the disks badline's unit of the
200
- same model had in it. Its floppy controller comes back as a unit
210
+ 2031 had in it, and the interface processor of a true 8050, 8250,
211
+ SFD-1001, 4040, 3040, 2040, D9060 or D9090, its RAM and both 6532s,
212
+ which go on the bus with the disks badline's unit of the same model had
213
+ in it. xpet's type 9000 stands for both hard disks, and the hard disk
214
+ badline's had in it, of either, makes it a D9090 for an image of six
215
+ heads and otherwise a D9060. Its floppy controller comes back as a unit
201
216
  switched on has it, in its idle loop with the heads on track 1: its next
202
217
  job steps them out to the track, and a job xpet's controller had under
203
- way starts again from there. A program
218
+ way starts again from there. A hard disk's SASI host comes back in its
219
+ job loop the same way. A program
204
220
  badline runs on from xpet's snapshot finds the vertical sync on the
205
221
  cycle xpet does, so the two run on alike, cycle for cycle. The picture
206
222
  starts again with the next frame. xpet doesn't save its ROMs, which
207
223
  keyboard it has or an 8296's jumpers, so the board, the RAM and the
208
224
  CRTC's frame build the machine: a 2001, a 3032 for any other discrete
209
225
  board, a 4032, an 8032, an 8096 or an 8296 with none of its jumpers
210
- fitted, at 50 or 60 Hz, and an 8032, 8096 or 8296 whose CRTC lines are
211
- 64 cycles long runs xpet's own 50 Hz editor, 901474-04 dated 0283. A
212
- SuperPET's snapshot fails. It reports the modules it leaves out, such
226
+ fitted, or a SuperPET, at 50 or 60 Hz, and an 8032, 8096 or 8296 whose
227
+ CRTC lines are 64 cycles long runs xpet's own 50 Hz editor, 901474-04
228
+ dated 0283. A SuperPET comes with its bank RAM, its bank, its `$EFFE`
229
+ bit and its ACIA, its CPU switch at the CPU that had the bus, and while
230
+ that is the 6809, the 6809's registers. Its RAM switch is at R/W, the
231
+ only position xpet has, its system latch is clear and its 6702 is as the
232
+ RES line leaves it, since xpet saves none of them, and in 6809 mode its
233
+ frame rate is the one the Waterloo ROM's CRTC table sets. It reports the modules it leaves out, such
213
234
  as the drives past device 8, the datasettes and the keyboard, and
214
235
  carries on without them, and a snapshot without a true drive takes
215
- badline's, a 2031, an 8050 or an 8250, off the bus and says so.
236
+ badline's off the bus and says so.
216
237
  Restored into a running PET, an xpet snapshot fails for a PET built
217
238
  another way, such as a 3032B, and otherwise switches the machine off
218
239
  and on, keeping its tapes and the disk device 8 serves.
@@ -329,6 +350,19 @@ xcbm2's snapshots. Restored into a running P500, an
329
350
  xcbm5x0 snapshot fails for a P500 built another way, and otherwise
330
351
  switches the machine off and on, keeping the disk device 8 serves.
331
352
 
353
+ ## The KIM-1
354
+
355
+ A KIM-1 saves and restores as the others do. A snapshot of one holds
356
+ its RAM, the expansion's too, the CPU, both 6530s with their 64 bytes,
357
+ ports and timers, the timer's interrupt flag among them, the panel with
358
+ the TTY/KB jumper, the key held down and how long each LED segment has
359
+ been lit, the teletype with the character on its way in or out, what
360
+ it has queued and all it has printed, the SST switch, U3's wiring to
361
+ IRQ and the speaker, and the keys `type_keys` has still to press. It
362
+ restores into a KIM-1 with the same RAM. Its file names its machine
363
+ `KIM1`, since VICE has no KIM-1, so no VICE emulator opens it, and
364
+ `--vice` fails for it.
365
+
332
366
  ## VICE
333
367
 
334
368
  Snapshots use VICE's `.vsf` format, and badline's own modules are named
data/exe/badline-ruby CHANGED
@@ -34,6 +34,11 @@ def load_sdl
34
34
  require "badline/frontend"
35
35
  end
36
36
 
37
+ if options.kim1_terminal?
38
+ require "badline/audio/console"
39
+ exit Badline::KIM1::HostTerminal.start(options, Badline::Audio::Console.new(input: $stdin, output: $stdout))
40
+ end
41
+
37
42
  if options.headless?
38
43
  require "badline/audio/console"
39
44
  console = if options.player_window?
@@ -4,8 +4,9 @@ module Badline
4
4
  module Audio
5
5
  # The terminal face of `--headless`: the tune's header, a status line
6
6
  # redrawn in place, and single keypresses read without waiting for
7
- # Return. Ctrl-C still interrupts. A subclass puts the terminal in raw
8
- # mode with #raw! and #restore and waits for keys with #readable?:
7
+ # Return, or for the KIM-1, the text typed and printed (#typing).
8
+ # Ctrl-C still interrupts. A subclass puts the terminal in raw mode
9
+ # with #raw! and #restore and waits for keys with #readable?:
9
10
  # Console with io/console for badline-ruby, and Native::Console with
10
11
  # stty and poll(2) for the native badline.
11
12
  class Terminal
@@ -50,6 +51,37 @@ module Badline
50
51
  end
51
52
  end
52
53
 
54
+ # Raw input for the length of the block, the cursor showing, for a
55
+ # session that types and prints text, as the KIM-1's teletype does.
56
+ def typing
57
+ mode = raw! if @input.tty?
58
+ yield
59
+ ensure
60
+ restore(mode) if mode
61
+ @output.print "\r\n"
62
+ end
63
+
64
+ # Waits up to `seconds` for keys and returns what they typed, as raw
65
+ # mode reads it, or an empty string.
66
+ def read_text(seconds)
67
+ if @closed
68
+ sleep(seconds)
69
+ return ""
70
+ end
71
+ return "" unless readable?(seconds)
72
+
73
+ text = @input.read_nonblock(64, exception: false)
74
+ return "" if text == :wait_readable
75
+
76
+ @closed = true if text.nil?
77
+ text.nil? ? "" : text
78
+ end
79
+
80
+ def print_text(text)
81
+ @output.print(text)
82
+ @output.flush
83
+ end
84
+
53
85
  def header(lines)
54
86
  lines.each { |line| @output.print "#{line}\r\n" }
55
87
  @output.print "←/→ subtune n/p tune ,/. seek space pause s shuffle l loop a all subtunes q quit\r\n"
@@ -39,6 +39,7 @@ module Badline
39
39
  pending = @pending_keys
40
40
  out.ints("host.pending_keys", pending) if pending
41
41
  out.bool("host.typing", !pending.nil?)
42
+ save_init_keys(out)
42
43
  out.int("host.init_pending", @cycles <= init_threshold ? @init_handlers.length : 0)
43
44
  out.bool("host.holding_commodore", @holding_commodore)
44
45
  @typist.save_fields(out, "host.typist.")
@@ -55,6 +56,7 @@ module Badline
55
56
  @cpu_reset_pending = input.bool("cpu_reset_pending", @cpu_reset_pending)
56
57
  pending = input.ints("host.pending_keys", [])
57
58
  @pending_keys = input.bool("host.typing", !pending.empty?) ? pending.dup : nil
59
+ load_init_keys(input)
58
60
  @init_handlers_lost = [input.int("host.init_pending", 0) - @init_handlers.length, 0].max
59
61
  load_holding_fields(input)
60
62
  @typist.load_fields(input, "host.typist.")
data/lib/badline/c128.rb CHANGED
@@ -139,6 +139,7 @@ module Badline
139
139
  @restore_pulse = false
140
140
  @init_handlers = []
141
141
  @pending_keys = nil
142
+ @init_keys = nil
142
143
  @typist = Input::MatrixTypist.new(@bus.keyboard)
143
144
  @capture_output = nil
144
145
  init_drives
@@ -39,6 +39,7 @@ module Badline
39
39
  out.bool("dma", @dma)
40
40
  pending = @pending_keys
41
41
  out.ints("host.pending_keys", pending) if pending
42
+ save_init_keys(out)
42
43
  out.int("host.init_pending", booting? ? @init_handlers.length : 0)
43
44
  end
44
45
 
@@ -52,6 +53,7 @@ module Badline
52
53
  @dma = input.bool("dma", @dma)
53
54
  pending = input.ints("host.pending_keys", [])
54
55
  @pending_keys = pending.empty? ? nil : pending.dup
56
+ load_init_keys(input)
55
57
  @init_handlers_lost = [input.int("host.init_pending", 0) - @init_handlers.length, 0].max
56
58
  end
57
59
 
data/lib/badline/c64.rb CHANGED
@@ -80,6 +80,7 @@ module Badline
80
80
  @freeze_writes = 0
81
81
  @init_handlers = []
82
82
  @pending_keys = nil
83
+ @init_keys = nil
83
84
  @dos = nil
84
85
  @serial_trap = nil
85
86
  @save_trap = nil