badline 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -0
- data/CLAUDE.md +22 -5
- data/README.md +101 -11
- data/doc/media.md +19 -0
- data/doc/pinned-behaviour.md +145 -0
- data/doc/snapshot-format.md +244 -46
- data/doc/snapshots.md +18 -1
- data/exe/badline-ruby +1 -1
- data/lib/badline/audio/bare_player.rb +4 -8
- data/lib/badline/audio/machine_player.rb +4 -26
- data/lib/badline/c128/banks.rb +1 -3
- data/lib/badline/c128/bus.rb +19 -1
- data/lib/badline/c128/mmu_pages.rb +7 -0
- data/lib/badline/c64/bus/extra_sids.rb +80 -0
- data/lib/badline/c64/bus.rb +1 -0
- data/lib/badline/c64/cartridge/action_replay.rb +6 -2
- data/lib/badline/c64/cartridge/comal80.rb +1 -0
- data/lib/badline/c64/cartridge/dinamic.rb +3 -1
- data/lib/badline/c64/cartridge/final_cartridge3.rb +1 -0
- data/lib/badline/c64/cartridge/fun_play.rb +2 -1
- data/lib/badline/c64/cartridge/game_system.rb +2 -1
- data/lib/badline/c64/cartridge/keyed_state.rb +155 -34
- data/lib/badline/c64/cartridge/magic_desk.rb +2 -1
- data/lib/badline/c64/cartridge/ocean.rb +1 -0
- data/lib/badline/c64/cartridge/pagefox.rb +1 -0
- data/lib/badline/c64/cartridge/rgcd.rb +2 -1
- data/lib/badline/c64/cartridge/super_games.rb +3 -2
- data/lib/badline/c64/cartridge/zaxxon.rb +1 -0
- data/lib/badline/c64/cartridge.rb +3 -3
- data/lib/badline/c64/keyed_modules.rb +6 -2
- data/lib/badline/c64/true_drives.rb +13 -1
- data/lib/badline/c64.rb +6 -0
- data/lib/badline/chips/ted/beam.rb +13 -14
- data/lib/badline/chips/ted/fetches.rb +199 -0
- data/lib/badline/chips/ted/keyed_state.rb +156 -0
- data/lib/badline/chips/ted/modes.rb +134 -0
- data/lib/badline/chips/ted/palette.rb +43 -0
- data/lib/badline/chips/ted/picture.rb +182 -0
- data/lib/badline/chips/ted/sound/output.rb +86 -0
- data/lib/badline/chips/ted/sound.rb +284 -0
- data/lib/badline/chips/ted.rb +53 -6
- data/lib/badline/chips/tia.rb +28 -0
- data/lib/badline/chips/vic/register_log.rb +4 -1
- data/lib/badline/drives/datasette/keyed_state.rb +14 -4
- data/lib/badline/drives/datasette.rb +22 -5
- data/lib/badline/drives/engine/core.rb +6 -14
- data/lib/badline/drives/engine/idle.rb +42 -4
- data/lib/badline/drives/engine/idle_cpu.rb +18 -0
- data/lib/badline/drives/engine/serial_connection.rb +25 -0
- data/lib/badline/drives/engine/sleep.rb +1 -0
- data/lib/badline/drives/engine.rb +1 -0
- data/lib/badline/drives/model1541/byte_ready.rb +19 -3
- data/lib/badline/drives/model1541/mechanism.rb +10 -1
- data/lib/badline/drives/model1541.rb +1 -0
- data/lib/badline/drives/model1551/bus.rb +138 -0
- data/lib/badline/drives/model1551/cable.rb +104 -0
- data/lib/badline/drives/model1551/cpu.rb +14 -0
- data/lib/badline/drives/model1551/keyed_state.rb +65 -0
- data/lib/badline/drives/model1551/port.rb +74 -0
- data/lib/badline/drives/model1551/tia.rb +92 -0
- data/lib/badline/drives/model1551.rb +170 -0
- data/lib/badline/drives/model1571.rb +1 -0
- data/lib/badline/drives/model1581.rb +1 -0
- data/lib/badline/frontend/boot.rb +23 -2
- data/lib/badline/frontend/controls.rb +7 -3
- data/lib/badline/frontend/keys.rb +14 -2
- data/lib/badline/frontend/media_slots.rb +11 -1
- data/lib/badline/frontend/menu/menu_dialogs.rb +14 -5
- data/lib/badline/frontend/menu/menu_media.rb +102 -14
- data/lib/badline/frontend/menu/menu_pages.rb +16 -11
- data/lib/badline/frontend/menu/menu_ports.rb +13 -1
- data/lib/badline/frontend/player/player_controller.rb +11 -4
- data/lib/badline/frontend/screen.rb +33 -12
- data/lib/badline/frontend/screens.rb +2 -1
- data/lib/badline/frontend/sound.rb +4 -4
- data/lib/badline/frontend/timeline.rb +19 -6
- data/lib/badline/machine/settling.rb +1 -1
- data/lib/badline/machine.rb +30 -6
- data/lib/badline/media/plus4_media.rb +68 -0
- data/lib/badline/media/program.rb +20 -6
- data/lib/badline/media/true_drive.rb +7 -5
- data/lib/badline/media.rb +33 -12
- data/lib/badline/options/family.rb +1 -0
- data/lib/badline/options/help.rb +32 -6
- data/lib/badline/options/option.rb +2 -1
- data/lib/badline/options/table.rb +29 -4
- data/lib/badline/options/validation.rb +66 -4
- data/lib/badline/options.rb +71 -11
- data/lib/badline/plus4/acia/frames.rb +55 -0
- data/lib/badline/plus4/acia.rb +276 -16
- data/lib/badline/plus4/bus.rb +245 -46
- data/lib/badline/plus4/cassette_sense.rb +21 -0
- data/lib/badline/plus4/keyboard_port.rb +35 -10
- data/lib/badline/plus4/keyed_modules.rb +116 -0
- data/lib/badline/plus4/keyed_parts.rb +172 -0
- data/lib/badline/plus4/keyed_state.rb +44 -0
- data/lib/badline/plus4/ram_expansion.rb +145 -0
- data/lib/badline/plus4/sid_card.rb +95 -0
- data/lib/badline/plus4/sound_mix.rb +51 -0
- data/lib/badline/plus4/tcbm_drive.rb +120 -0
- data/lib/badline/plus4/user_port.rb +11 -2
- data/lib/badline/plus4.rb +184 -26
- data/lib/badline/roms/README +9 -0
- data/lib/badline/roms/dos1551.rom +0 -0
- data/lib/badline/snapshot/container.rb +2 -0
- data/lib/badline/snapshot/field_doc/markdown.rb +7 -6
- data/lib/badline/snapshot/field_doc.rb +48 -7
- data/lib/badline/snapshot/image.rb +12 -3
- data/lib/badline/snapshot/plus4_setup.rb +81 -0
- data/lib/badline/snapshot.rb +9 -4
- data/lib/badline/storage/tap.rb +21 -12
- data/lib/badline/support/checkpoint.rb +3 -2
- data/lib/badline/support/plus4_checkpoint.rb +42 -0
- data/lib/badline/version.rb +1 -1
- metadata +29 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Badline
|
|
4
|
+
class Plus4
|
|
5
|
+
class ACIA
|
|
6
|
+
# A character's frame and how long it takes. A start bit, 5 to 8
|
|
7
|
+
# data bits, a parity bit where the command enables one, and the stop
|
|
8
|
+
# bits: one, or with control bit 7 two, but one and a half for 5 bits
|
|
9
|
+
# without parity and one for 8 bits with it (6551 datasheet). Each bit
|
|
10
|
+
# takes 16 periods of the baud rate generator's 16x clock, the 1.8432
|
|
11
|
+
# MHz crystal divided by the rate's divisor, which the machine's
|
|
12
|
+
# cycles are counted against, carrying what is left of a cycle from
|
|
13
|
+
# one character to the next.
|
|
14
|
+
module Frames
|
|
15
|
+
CRYSTAL_HZ = 1_843_200
|
|
16
|
+
|
|
17
|
+
# The crystal's divisor for each baud rate the control register
|
|
18
|
+
# selects: the external clock, then 50, 75, 109.92, 134.58, 150,
|
|
19
|
+
# 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600 and 19,200.
|
|
20
|
+
DIVISORS = [1, 2304, 1536, 1048, 856, 768, 384, 192, 96, 64, 48, 32, 24, 16, 12, 6].freeze
|
|
21
|
+
|
|
22
|
+
def word_length = 8 - ((@control >> 5) & 0x03)
|
|
23
|
+
|
|
24
|
+
def word_mask = (1 << word_length) - 1
|
|
25
|
+
|
|
26
|
+
# The frame's length in half bits.
|
|
27
|
+
def frame_halves
|
|
28
|
+
length = word_length
|
|
29
|
+
parity = @command.anybits?(0x20)
|
|
30
|
+
stops = if @control < 0x80 || (length == 8 && parity) then 2
|
|
31
|
+
elsif length == 5 && !parity then 3
|
|
32
|
+
else 4
|
|
33
|
+
end
|
|
34
|
+
((1 + length + (parity ? 1 : 0)) * 2) + stops
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
# The cycle a character the transmitter, or else the receiver,
|
|
40
|
+
# starts at `time` ends at.
|
|
41
|
+
def after(time, transmitter)
|
|
42
|
+
units = frame_halves * 8 * DIVISORS[@control & 0x0f] * @clock_hz
|
|
43
|
+
if transmitter
|
|
44
|
+
units += @transmit_remainder
|
|
45
|
+
@transmit_remainder = units % CRYSTAL_HZ
|
|
46
|
+
else
|
|
47
|
+
units += @receive_remainder
|
|
48
|
+
@receive_remainder = units % CRYSTAL_HZ
|
|
49
|
+
end
|
|
50
|
+
time + (units / CRYSTAL_HZ)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
data/lib/badline/plus4/acia.rb
CHANGED
|
@@ -1,44 +1,304 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "badline/plus4/acia/frames"
|
|
4
|
+
|
|
3
5
|
module Badline
|
|
4
6
|
class Plus4
|
|
5
|
-
# The Plus/4's 6551 ACIA at $FD00-$FD0F, its four registers repeated
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
7
|
+
# The Plus/4's 6551 ACIA at $FD00-$FD0F, its four registers repeated:
|
|
8
|
+
#
|
|
9
|
+
# $FD00 - read the receiver's data, write the transmitter's
|
|
10
|
+
# $FD01 - read the status, write a programmed reset
|
|
11
|
+
# $FD02 - the command register
|
|
12
|
+
# $FD03 - the control register
|
|
13
|
+
#
|
|
14
|
+
# Status: bit 0 a parity error, 1 a framing error, 2 an overrun, 3 the
|
|
15
|
+
# receiver full, 4 the transmitter empty, 5 DCD and 6 DSR as their pins
|
|
16
|
+
# read (1 high, not asserted), 7 an interrupt. Reading it clears bit 7.
|
|
17
|
+
#
|
|
18
|
+
# Command: bit 0 DTR, which also enables the receiver and every
|
|
19
|
+
# interrupt, bit 1 set disables the receiver's interrupt, bits 2-3 the
|
|
20
|
+
# transmitter (00 off with RTS high, 01 on with its interrupt, 10 on
|
|
21
|
+
# without, 11 sending a break), bit 4 echoes what is received, bits 5-7
|
|
22
|
+
# the parity.
|
|
23
|
+
#
|
|
24
|
+
# Control: bits 0-3 the baud rate from the 1.8432 MHz crystal (0, the
|
|
25
|
+
# 16x external clock, runs straight from the crystal, 115,200 baud),
|
|
26
|
+
# bit 4 the receiver's clock (0 the RxC pin, which nothing drives on the
|
|
27
|
+
# Plus/4, so the receiver hears nothing), bits 5-6 the word length (8
|
|
28
|
+
# down to 5 bits) and bit 7 the stop bits (Frames).
|
|
29
|
+
#
|
|
30
|
+
# The transmitter runs in whole characters while it is on: at the end
|
|
31
|
+
# of each it hands the character it shifted out to the line, moves a
|
|
32
|
+
# waiting byte from the data register into the shift register and sets
|
|
33
|
+
# the transmitter empty, and with its interrupt on interrupts while the
|
|
34
|
+
# register is empty, every character until a byte comes. The first
|
|
35
|
+
# character ends a character's time after the transmitter comes on.
|
|
36
|
+
# The receiver takes a character's time for each byte the line sends,
|
|
37
|
+
# and a byte that arrives while the last is unread is lost to an
|
|
38
|
+
# overrun. The receiver full, and DCD or DSR changing, interrupt unless
|
|
39
|
+
# bit 1 disables it.
|
|
40
|
+
#
|
|
41
|
+
# The user port carries no CTS, so the transmitter is always clear to
|
|
42
|
+
# send; the KERNAL takes the user port's 6529 P1 as its handshake.
|
|
43
|
+
#
|
|
44
|
+
# What is on the other end of the user port (#plug): nothing, where
|
|
45
|
+
# DCD and DSR read high and what is sent goes nowhere; a terminal,
|
|
46
|
+
# which asserts DCD and DSR, sends what the host feeds it (#feed) while
|
|
47
|
+
# DTR is asserted and keeps what it receives for the host to drain
|
|
48
|
+
# (#drain); or a loopback plug, which returns TxD to RxD and DTR to DSR
|
|
49
|
+
# and DCD.
|
|
50
|
+
#
|
|
51
|
+
# The machine runs the ACIA at the cycle it next has something to do
|
|
52
|
+
# (#due) through #run!, and learns its IRQ line and that cycle from
|
|
53
|
+
# `clock`'s #acia_changed, whose #cycles is the time.
|
|
11
54
|
class ACIA
|
|
12
|
-
|
|
55
|
+
include Frames
|
|
56
|
+
|
|
57
|
+
PARITY_ERROR = 0x01
|
|
58
|
+
FRAMING_ERROR = 0x02
|
|
59
|
+
OVERRUN = 0x04
|
|
60
|
+
RECEIVER_FULL = 0x08
|
|
61
|
+
TRANSMITTER_EMPTY = 0x10
|
|
62
|
+
DCD = 0x20
|
|
63
|
+
DSR = 0x40
|
|
64
|
+
IRQ = 0x80
|
|
65
|
+
|
|
66
|
+
NOTHING = 0
|
|
67
|
+
TERMINAL = 1
|
|
68
|
+
LOOPBACK = 2
|
|
69
|
+
|
|
70
|
+
# No shift in progress.
|
|
71
|
+
IDLE = -1
|
|
13
72
|
|
|
14
|
-
|
|
73
|
+
# Far enough ahead that it never comes.
|
|
74
|
+
NEVER = 1 << 60
|
|
15
75
|
|
|
16
|
-
|
|
76
|
+
attr_reader :command, :control, :device, :due
|
|
77
|
+
|
|
78
|
+
def initialize(clock, clock_hz)
|
|
79
|
+
@clock = clock
|
|
80
|
+
@clock_hz = clock_hz
|
|
81
|
+
@device = NOTHING
|
|
82
|
+
@incoming = []
|
|
83
|
+
@received = []
|
|
17
84
|
reset!
|
|
18
85
|
end
|
|
19
86
|
|
|
87
|
+
# The RES line: every register cleared, the transmitter empty and
|
|
88
|
+
# both shift registers stopped.
|
|
20
89
|
def reset!
|
|
21
90
|
@command = 0
|
|
22
91
|
@control = 0
|
|
92
|
+
@errors = 0
|
|
93
|
+
@receiver_full = false
|
|
94
|
+
@transmitter_empty = true
|
|
95
|
+
@irq = false
|
|
96
|
+
@receive_data = 0
|
|
97
|
+
@transmit_data = 0
|
|
98
|
+
@shifting = IDLE
|
|
99
|
+
@transmit_at = NEVER
|
|
100
|
+
@transmit_remainder = 0
|
|
101
|
+
@receive_at = NEVER
|
|
102
|
+
@receive_remainder = 0
|
|
103
|
+
@clock_lost = false
|
|
104
|
+
@lines = modem_lines
|
|
105
|
+
changed
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def irq? = @irq
|
|
109
|
+
|
|
110
|
+
# DTR and RTS as asserted, low on the pins.
|
|
111
|
+
def dtr? = @command.anybits?(0x01)
|
|
112
|
+
|
|
113
|
+
def rts? = @command.anybits?(0x0c)
|
|
114
|
+
|
|
115
|
+
# Whether the transmitter sends a break, holding TxD low.
|
|
116
|
+
def break? = @command & 0x0c == 0x0c
|
|
117
|
+
|
|
118
|
+
# Plugs NOTHING, a TERMINAL or a LOOPBACK plug into the user port.
|
|
119
|
+
def plug(device)
|
|
120
|
+
@device = device
|
|
121
|
+
@incoming.clear
|
|
122
|
+
lines_changed
|
|
123
|
+
start_receiving
|
|
124
|
+
changed
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Bytes the terminal sends, one a character's time while DTR is
|
|
128
|
+
# asserted.
|
|
129
|
+
def feed(bytes)
|
|
130
|
+
return unless @device == TERMINAL
|
|
131
|
+
|
|
132
|
+
@incoming.concat(bytes)
|
|
133
|
+
start_receiving
|
|
134
|
+
changed
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# What the terminal has received since the last drain.
|
|
138
|
+
def drain
|
|
139
|
+
received = @received
|
|
140
|
+
@received = []
|
|
141
|
+
received
|
|
23
142
|
end
|
|
24
143
|
|
|
25
|
-
|
|
144
|
+
# Runs what falls due up to cycle `now`: the transmitter's character
|
|
145
|
+
# ends, then the receiver's.
|
|
146
|
+
def run!(now)
|
|
147
|
+
end_character while @transmit_at <= now
|
|
148
|
+
receive_character while @receive_at <= now
|
|
149
|
+
changed
|
|
150
|
+
end
|
|
26
151
|
|
|
27
152
|
def peek(addr)
|
|
28
153
|
case addr & 0x03
|
|
29
|
-
when
|
|
154
|
+
when 0
|
|
155
|
+
@receiver_full = false
|
|
156
|
+
@receive_data
|
|
157
|
+
when 1 then read_status
|
|
30
158
|
when 2 then @command
|
|
31
|
-
|
|
32
|
-
else 0
|
|
159
|
+
else @control
|
|
33
160
|
end
|
|
34
161
|
end
|
|
35
162
|
|
|
36
163
|
def poke(addr, value)
|
|
37
164
|
case addr & 0x03
|
|
38
|
-
when
|
|
39
|
-
when
|
|
40
|
-
when
|
|
165
|
+
when 0 then write_data(value)
|
|
166
|
+
when 1 then write_command(@command & 0xe0, clear_overrun: true)
|
|
167
|
+
when 2 then write_command(value)
|
|
168
|
+
else @control = value
|
|
41
169
|
end
|
|
170
|
+
changed
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# The status as a read finds it, without clearing the interrupt.
|
|
174
|
+
def status
|
|
175
|
+
status = @errors | (@lines & (DCD | DSR))
|
|
176
|
+
status |= RECEIVER_FULL if @receiver_full
|
|
177
|
+
status |= TRANSMITTER_EMPTY if @transmitter_empty
|
|
178
|
+
@irq ? status | IRQ : status
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
private
|
|
182
|
+
|
|
183
|
+
def read_status
|
|
184
|
+
value = status
|
|
185
|
+
@irq = false
|
|
186
|
+
changed
|
|
187
|
+
value
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def write_data(value)
|
|
191
|
+
@transmit_data = value
|
|
192
|
+
@transmitter_empty = false
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def write_command(value, clear_overrun: false)
|
|
196
|
+
was_on = transmitter_on?
|
|
197
|
+
@command = value
|
|
198
|
+
@errors &= ~OVERRUN if clear_overrun
|
|
199
|
+
start_transmitting if transmitter_on? && !was_on
|
|
200
|
+
stop_transmitting unless transmitter_on? || @shifting != IDLE
|
|
201
|
+
lines_changed
|
|
202
|
+
start_receiving
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def transmitter_on?
|
|
206
|
+
control = @command & 0x0c
|
|
207
|
+
control != 0 && control != 0x0c
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def interrupts? = @command.anybits?(0x01)
|
|
211
|
+
|
|
212
|
+
def receiver_interrupts? = @command & 0x03 == 0x01
|
|
213
|
+
|
|
214
|
+
def transmitter_interrupts? = @command & 0x0d == 0x05
|
|
215
|
+
|
|
216
|
+
def receiving? = dtr? && @control.anybits?(0x10)
|
|
217
|
+
|
|
218
|
+
def start_transmitting
|
|
219
|
+
@transmit_remainder = 0
|
|
220
|
+
@transmit_at = after(@clock.cycles, true)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def stop_transmitting
|
|
224
|
+
@transmit_at = NEVER
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# A character's end: the character shifted out goes to the line, and
|
|
228
|
+
# the transmitter takes the next byte or interrupts while it has none.
|
|
229
|
+
def end_character
|
|
230
|
+
sent = @shifting
|
|
231
|
+
@shifting = IDLE
|
|
232
|
+
deliver(sent) unless sent == IDLE
|
|
233
|
+
on = transmitter_on?
|
|
234
|
+
if on && !@transmitter_empty
|
|
235
|
+
@shifting = @transmit_data & word_mask
|
|
236
|
+
@transmitter_empty = true
|
|
237
|
+
end
|
|
238
|
+
@irq = true if on && @transmitter_empty && transmitter_interrupts?
|
|
239
|
+
if on || @shifting != IDLE
|
|
240
|
+
@transmit_at = after(@transmit_at, true)
|
|
241
|
+
else
|
|
242
|
+
stop_transmitting
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def deliver(byte)
|
|
247
|
+
case @device
|
|
248
|
+
when TERMINAL then @received << byte
|
|
249
|
+
when LOOPBACK then take(byte) if receiving?
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def start_receiving
|
|
254
|
+
return unless @receive_at == NEVER && !@incoming.empty? && receiving?
|
|
255
|
+
|
|
256
|
+
@receive_remainder = 0
|
|
257
|
+
@receive_at = after(@clock.cycles, false)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def receive_character
|
|
261
|
+
byte = @incoming[0]
|
|
262
|
+
@incoming.delete_at(0)
|
|
263
|
+
take(byte)
|
|
264
|
+
@receive_at = !@incoming.empty? && receiving? ? after(@receive_at, false) : NEVER
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# A whole character in from RxD: into the data register, or lost to
|
|
268
|
+
# an overrun while the last is unread. In echo mode it goes back out
|
|
269
|
+
# to the terminal.
|
|
270
|
+
def take(byte)
|
|
271
|
+
if @receiver_full
|
|
272
|
+
@errors |= OVERRUN
|
|
273
|
+
else
|
|
274
|
+
@receive_data = byte & word_mask
|
|
275
|
+
@receiver_full = true
|
|
276
|
+
@errors = 0
|
|
277
|
+
end
|
|
278
|
+
@received << byte if @device == TERMINAL && @command & 0x1c == 0x10
|
|
279
|
+
@irq = true if receiver_interrupts?
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# DCD and DSR as the device drives them, interrupting on a change.
|
|
283
|
+
def lines_changed
|
|
284
|
+
lines = modem_lines
|
|
285
|
+
return if lines == @lines
|
|
286
|
+
|
|
287
|
+
@lines = lines
|
|
288
|
+
@irq = true if receiver_interrupts?
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def modem_lines
|
|
292
|
+
case @device
|
|
293
|
+
when TERMINAL then 0
|
|
294
|
+
when LOOPBACK then dtr? ? 0 : DCD | DSR
|
|
295
|
+
else DCD | DSR
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def changed
|
|
300
|
+
@due = [@transmit_at, @receive_at].min
|
|
301
|
+
@clock.acia_changed(@irq && interrupts?, @due)
|
|
42
302
|
end
|
|
43
303
|
end
|
|
44
304
|
end
|