Class: Badline::ChroutTrap
- Inherits:
-
Object
- Object
- Badline::ChroutTrap
- Defined in:
- lib/badline/chrout_trap.rb
Overview
Observe-only PC trap on the KERNAL CHROUT routine ($FFD2). Records each character written while the KERNAL is banked in, then lets execution fall through to the ROM, so the screen output is unaffected. Used for headless capture of program output.
Constant Summary collapse
- ADDRESS =
0xffd2
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(cpu:, bus:) ⇒ ChroutTrap
constructor
A new instance of ChroutTrap.
- #inspect ⇒ Object
Constructor Details
#initialize(cpu:, bus:) ⇒ ChroutTrap
Returns a new instance of ChroutTrap.
13 14 15 16 17 |
# File 'lib/badline/chrout_trap.rb', line 13 def initialize(cpu:, bus:) @cpu = cpu @bus = bus @output = +"" end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/badline/chrout_trap.rb', line 11 def output @output end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'lib/badline/chrout_trap.rb', line 19 def call @output << ascii(@cpu.a) if @bus.io_port.kernal? end |
#inspect ⇒ Object
23 24 25 |
# File 'lib/badline/chrout_trap.rb', line 23 def inspect "#<#{self.class.name} output=#{@output.inspect}>" end |