<commit_before>package ucesoft.c64.peripheral.drive

import ucesoft.c64.peripheral.bus.IECBus
import ucesoft.c64.peripheral.bus.IECBusDevice
import ucesoft.c64.formats.D64
import ucesoft.c64.peripheral.bus.BusDataIterator
import scala.collection.mutable.ListBuffer

abstract class AbstractDrive(bus: IECBus, device: Int = 9) extends IECBusDevice(bus, device) with Drive {
  protected var status = 0
  protected val ERROR_CODES : Map[Int,String] 
  
  protected case class DirEntry(name:String,byteSize:Int,isDirectory:Boolean)
  
  // register itself to bus
  bus.registerListener(this)
  
  def isDeviceReady = true
  def init {}
  def setDriveReader(driveReader: D64) {}
  
  protected def setStatus(code: Int) = status = code
  protected def sendStatus {
    import BusDataIterator._
    channels(channel).dataToSend = Some(new StringDataIterator("%02d,%s,00,00".format(status, ERROR_CODES(status)) + 13.toChar))
  }
  
  override def reset {
    super.reset
  }
  
  protected def getDirectoryEntries(path:String) : List[DirEntry]
  
  protected def handleChannel15
  
  protected def loadDirectory(path:String,pathName:String) : BusDataIterator = {
    val out = new ListBuffer[Int]
    // set start address to $0801
    out.append(0x01)
    out.append(0x08)
    var ptr = 0x801    
    // write next line address
    ptr += 30
    out.append(ptr & 0xFF)  // L<commit_msg>Modifications for new Floppy support<commit_after>package ucesoft.c64.peripheral.drive

import ucesoft.c64.peripheral.bus.IECBus
import ucesoft.c64.peripheral.bus.IECBusDevice
import ucesoft.c64.peripheral.bus.BusDataIterator
import scala.collection.mutable.ListBuffer

abstract class AbstractDrive(bus: IECBus, device: Int = 9) extends IECBusDevice(bus, device) with Drive {
  protected var status = 0
  protected val ERROR_CODES : Map[Int,String] 
  
  protected case class DirEntry(name:String,byteSize:Int,isDirectory:Boolean)
  
  // register itself to bus
  bus.registerListener(this)
  
  def isDeviceReady = true
  def init {}
  def setDriveReader(driveReader: Floppy) {}
  
  protected def setStatus(code: Int) = status = code
  protected def sendStatus {
    import BusDataIterator._
    channels(channel).dataToSend = Some(new StringDataIterator("%02d,%s,00,00".format(status, ERROR_CODES(status)) + 13.toChar))
  }
  
  override def reset {
    super.reset
  }
  
  protected def getDirectoryEntries(path:String) : List[DirEntry]
  
  protected def handleChannel15
  
  protected def loadDirectory(path:String,pathName:String) : BusDataIterator = {
    val out = new ListBuffer[Int]
    // set start address to $0801
    out.append(0x01)
    out.append(0x08)
    var ptr = 0x801    
    // write next line address
    ptr += 30
    out.append(ptr & 0xFF)  // L
{'fraction_non_alphanumeric': 0.09348854128774099, 'fraction_numerical': 0.029101491451436885, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6200918', 'n_tokens_mistral': 948, 'n_tokens_neox': 888, 'n_words': 207}