Class: Badline::KernalTrap::Load

Inherits:
File
  • Object
show all
Defined in:
lib/badline/kernal_trap/load.rb

Overview

PC trap on the KERNAL serial LOAD routine ($F4A5, the default ILOAD vector target). Serves device 8 requests from a storage backend and returns to the caller with the routine’s register/zeropage contract; other devices fall through to the ROM.

Constant Summary collapse

ADDRESS =
0xf4a5
FILE_NOT_FOUND =
0x04

Constants inherited from File

File::DEVICE, File::MISSING_FILENAME

Instance Method Summary collapse

Methods inherited from File

#initialize

Methods included from IntegerHelper

#bcd, #bcd_to_i, #format16, #format8, #high_byte, #low_byte, #signed_int8, #uint16

Constructor Details

This class inherits a constructor from Badline::KernalTrap::File

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/badline/kernal_trap/load.rb', line 14

def call
  return unless active?

  name = filename
  if name.empty?
    error(MISSING_FILENAME)
  elsif (data = @storage.read_file(name))
    deliver(data)
  else
    error(FILE_NOT_FOUND)
  end
  return_to_caller
end