mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-12 15:44:05 +09:00
device files are mounted under the drive letter of dollarsign
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
let f = files.open("CON")
|
let f = files.open("$:/CON")
|
||||||
f.swrite("Hello, world! I'm just writing to a file named 'CON'\n")
|
f.swrite("Hello, world! I'm just writing to a file named 'CON'\n")
|
||||||
f.close()
|
f.close()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
let fout = files.open("FBIPF")
|
let fout = files.open("$:/FBIPF")
|
||||||
let fin = files.open(_G.shell.resolvePathInput(exec_args[1]).full)
|
let fin = files.open(_G.shell.resolvePathInput(exec_args[1]).full)
|
||||||
|
|
||||||
let ipfRead = fin.bread()
|
let ipfRead = fin.bread()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
let f = files.open("RND")
|
let f = files.open("$:/RND")
|
||||||
let mlen = 512
|
let mlen = 512
|
||||||
let m = sys.malloc(mlen)
|
let m = sys.malloc(mlen)
|
||||||
|
|
||||||
|
|||||||
@@ -94,15 +94,17 @@ _TVDOS.DRV.FS = {}
|
|||||||
class TVDOSFileDescriptor {
|
class TVDOSFileDescriptor {
|
||||||
|
|
||||||
constructor(path0, driverID) {
|
constructor(path0, driverID) {
|
||||||
if (driverID === undefined) {
|
if (path0.startsWith("$")) {
|
||||||
if (!files.reservedNames.includes(path0)) {
|
let devName = path0.substring(3)
|
||||||
throw Error(`${path0} is not a valid device file`)
|
|
||||||
|
if (!files.reservedNames.includes(devName)) {
|
||||||
|
throw Error(`${devName} is not a valid device file`)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._driveLetter = undefined
|
this._driveLetter = undefined
|
||||||
this._path = path0
|
this._path = path0
|
||||||
this._driverID = `DEV${path0}`
|
this._driverID = `DEV${devName}`
|
||||||
this._driver = _TVDOS.DRV.FS[`DEV${path0}`] // can't just put `driverID` here
|
this._driver = _TVDOS.DRV.FS[`DEV${devName}`] // can't just put `driverID` here
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let p = path0.replaceAll("/", "\\")
|
let p = path0.replaceAll("/", "\\")
|
||||||
@@ -111,7 +113,7 @@ class TVDOSFileDescriptor {
|
|||||||
p = p.substring(0, p.length - 1)
|
p = p.substring(0, p.length - 1)
|
||||||
}
|
}
|
||||||
this._driveLetter = p[0]
|
this._driveLetter = p[0]
|
||||||
this._path = p.substring(2) // detaches A:
|
this._path = p.substring(2) // detaches $:
|
||||||
this._driverID = driverID
|
this._driverID = driverID
|
||||||
this._driver = _TVDOS.DRV.FS[driverID]
|
this._driver = _TVDOS.DRV.FS[driverID]
|
||||||
serial.println(`TVDOSFileDescriptor input path: ${path0}, p = ${p}, driveLetter = ${this._driveLetter}, path = ${this._path}`)
|
serial.println(`TVDOSFileDescriptor input path: ${path0}, p = ${p}, driveLetter = ${this._driveLetter}, path = ${this._path}`)
|
||||||
@@ -810,6 +812,12 @@ files.open = (fullPath) => {
|
|||||||
if (fullPath[2] != '/' && fullPath[2] != '\\') throw Error("Expected full path with drive letter, got " + fullPath)
|
if (fullPath[2] != '/' && fullPath[2] != '\\') throw Error("Expected full path with drive letter, got " + fullPath)
|
||||||
let driveLetter = fullPath[0].toUpperCase()
|
let driveLetter = fullPath[0].toUpperCase()
|
||||||
let driver = _TVDOS.DRIVEFS[driveLetter]
|
let driver = _TVDOS.DRIVEFS[driveLetter]
|
||||||
|
|
||||||
|
// special device files ($:\NUL, $:\CON, etc)
|
||||||
|
if ("$" == driveLetter) {
|
||||||
|
return new TVDOSFileDescriptor(fullPath.toUpperCase())
|
||||||
|
}
|
||||||
|
|
||||||
return new TVDOSFileDescriptor(fullPath, driver)
|
return new TVDOSFileDescriptor(fullPath, driver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ if (!magicMatching) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decode input image
|
// decode input image
|
||||||
let ipfFile = files.open("FBIPF")
|
let ipfFile = files.open("$:/FBIPF")
|
||||||
graphics.clearText(); graphics.clearPixels(0); graphics.clearPixels2(0)
|
graphics.clearText(); graphics.clearPixels(0); graphics.clearPixels2(0)
|
||||||
ipfFile.pwrite(infilePtr, infile.size, 0)
|
ipfFile.pwrite(infilePtr, infile.size, 0)
|
||||||
sys.free(infilePtr)
|
sys.free(infilePtr)
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
\indexentry{boot process|hyperpage}{29}
|
\indexentry{boot process|hyperpage}{29}
|
||||||
\indexentry{coreutils (DOS)|hyperpage}{30}
|
\indexentry{coreutils (DOS)|hyperpage}{30}
|
||||||
\indexentry{applications (DOS)|hyperpage}{31}
|
\indexentry{applications (DOS)|hyperpage}{31}
|
||||||
\indexentry{pipe (DOS)|hyperpage}{33}
|
\indexentry{pipe (DOS)|hyperpage}{34}
|
||||||
\indexentry{filesystem (DOS)|hyperpage}{35}
|
\indexentry{filesystem (DOS)|hyperpage}{36}
|
||||||
\indexentry{file descriptor (DOS)|hyperpage}{35}
|
\indexentry{file descriptor (DOS)|hyperpage}{36}
|
||||||
\indexentry{device file|hyperpage}{37}
|
\indexentry{device file|hyperpage}{38}
|
||||||
\indexentry{input (DOS)|hyperpage}{39}
|
\indexentry{input (DOS)|hyperpage}{40}
|
||||||
\indexentry{gl (DOS)|hyperpage}{40}
|
\indexentry{gl (DOS)|hyperpage}{41}
|
||||||
|
|||||||
@@ -19,22 +19,22 @@
|
|||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
\item device file, \hyperpage{37}
|
\item device file, \hyperpage{38}
|
||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
\item file descriptor (DOS), \hyperpage{35}
|
\item file descriptor (DOS), \hyperpage{36}
|
||||||
\item filesystem (DOS), \hyperpage{35}
|
\item filesystem (DOS), \hyperpage{36}
|
||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
\item gl (DOS), \hyperpage{40}
|
\item gl (DOS), \hyperpage{41}
|
||||||
\item graphics (library), \hyperpage{26}
|
\item graphics (library), \hyperpage{26}
|
||||||
\item gzip (library), \hyperpage{12}
|
\item gzip (library), \hyperpage{12}
|
||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
\item input (DOS), \hyperpage{39}
|
\item input (DOS), \hyperpage{40}
|
||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
\item pipe (DOS), \hyperpage{33}
|
\item pipe (DOS), \hyperpage{34}
|
||||||
|
|
||||||
\indexspace
|
\indexspace
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
All \thedos-related features requires the DOS to be fully loaded.
|
All \thedos-related features requires the DOS to be fully loaded.
|
||||||
|
|
||||||
|
On this documentation, what would be a reverse solidus (e.g. directory separators) are typesetted using a slash; while they \emph{are} interchangeable, using the reverse solidus are recommended for path input.
|
||||||
|
|
||||||
|
|
||||||
\chapter{Bootstrapping}
|
\chapter{Bootstrapping}
|
||||||
@@ -59,10 +59,14 @@ Variables can be set or changed using \textbf{SET} commands.
|
|||||||
This chapter will only briefly list and describe the applications.
|
This chapter will only briefly list and describe the applications.
|
||||||
|
|
||||||
\begin{outline}
|
\begin{outline}
|
||||||
\1\dossynopsis{basica}{Invokens a BASIC interpreter stored in the ROM. If no BASIC rom is present, nothing will be done.}
|
\1\dossynopsis{basica}{Invokes a BASIC interpreter stored in the ROM. If no BASIC rom is present, nothing will be done.}
|
||||||
|
\1\dossynopsis{basic}{If your system is bundled with a software-based BASIC, this command will invoke the BASIC interpreter stored in the disk.}
|
||||||
\1\dossynopsis{color}{Changes the background and the foreground of the active session.}
|
\1\dossynopsis{color}{Changes the background and the foreground of the active session.}
|
||||||
\1\dossynopsis{command}{The default text-based DOS shell. Call with \code{command /fancy} for more \ae sthetically pleasing looks.}
|
\1\dossynopsis{command}{The default text-based DOS shell. Call with \code{command /fancy} for more \ae sthetically pleasing looks.}
|
||||||
|
\1\dossynopsis{decodeipf}{file}{Decodes the IPF-formatted image to the framebuffer using the graphics processor.}
|
||||||
|
\1\dossynopsis{drives}{Shows the list of the connected and mounted disk drives.}
|
||||||
\1\dossynopsis{edit}{path}{The interactive full-screen text editor.}
|
\1\dossynopsis{edit}{path}{The interactive full-screen text editor.}
|
||||||
|
\1\dossynopsis{encodeipf}{1/2 imagefile ipffile}{Encodes the given image file (.jpg, .png, .bmp, .tga) to the IPF format using the graphics hardware.}
|
||||||
\1\dossynopsis{false}{Returns errorlevel 1 upon execution.}
|
\1\dossynopsis{false}{Returns errorlevel 1 upon execution.}
|
||||||
\1\dossynopsis{hexdump}{path}{Prints out the contents of a file in hexadecimal view. Supports pipe.}
|
\1\dossynopsis{hexdump}{path}{Prints out the contents of a file in hexadecimal view. Supports pipe.}
|
||||||
\1\dossynopsis{less}{path}{Allows user to read the long text, even if they are wider and/or taller than the screen. Supports pipe.}
|
\1\dossynopsis{less}{path}{Allows user to read the long text, even if they are wider and/or taller than the screen. Supports pipe.}
|
||||||
@@ -168,7 +172,7 @@ Functions:
|
|||||||
|
|
||||||
\section{The Device Files}
|
\section{The Device Files}
|
||||||
|
|
||||||
\index{device file}Some devices are also virtualised through the file descriptor, and they are given a special path. (their fullPath does not contain a drive letter)
|
\index{device file}Some devices are also virtualised through the file descriptor, and they are given a special drive letter of \code{\$}. (e.g. \code{\$:/RND})
|
||||||
|
|
||||||
\begin{outline}
|
\begin{outline}
|
||||||
\1\inlinesynopsis{RND}{returns random bytes upon reading}
|
\1\inlinesynopsis{RND}{returns random bytes upon reading}
|
||||||
@@ -186,7 +190,7 @@ Functions:
|
|||||||
\2\argsynopsis{pwrite}{writes the bytes from the given pointer.}
|
\2\argsynopsis{pwrite}{writes the bytes from the given pointer.}
|
||||||
\2\argsynopsis{bwrite}{identical to \code{print()} except the given byte array will be casted to string.}
|
\2\argsynopsis{bwrite}{identical to \code{print()} except the given byte array will be casted to string.}
|
||||||
\2\argsynopsis{swrite}{identical to \code{print()}.}
|
\2\argsynopsis{swrite}{identical to \code{print()}.}
|
||||||
\1\inlinesynopsis{FBIPF}{decodes IPF-formatted image to the framebuffer. Use the \emph{Graphics} library for the encoding.}
|
\1\inlinesynopsis{FBIPF}{decodes IPF-formatted image to the framebuffer. Use the bundled \code{encodeipf.js} for the encoding.}
|
||||||
\2\argsynopsis{pwrite, bwrite}{decodes the given IPF binary data. Offsets and counts for \code{pwrite} are ignored.}
|
\2\argsynopsis{pwrite, bwrite}{decodes the given IPF binary data. Offsets and counts for \code{pwrite} are ignored.}
|
||||||
\end{outline}
|
\end{outline}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user