FujiNetWIFI/fujinet-firmware

Improve CP/M file performance.

開放

#917 建立於 2025年4月24日

 (0 則留言) (0 個反應) (0 位負責人)C (89 個分叉)auto 404
enhancementhelp wanted

倉庫指標

星標
 (284 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

File I/O is slow in CP/M.

This is because for each BIOS read sector:

  • The file is opened
  • The sector is read
  • The file is closed.

A similar pattern is done for the other methods I list below, it's very atomic, but very slow.

Calls to OpenFile() in lib/runcpm/disk.h call _sys_openfile(): https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L153 and read sequential: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L223 and write sequential: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L263 and read random: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L293 and write random: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L339

This needs to be extended to hold onto the file handle, and not open the file again if it has already been opened, thus avoiding the file_open call if needed, and finding out when to best close the file when it is no longer needed (so we don't leak file descriptors! A timer?)

-Thom

貢獻者指南