Module

general

General functions.

Classes

StopWatch

Members

# inner DEBUG

Properties:
Name Type Description
DEBUG boolean enable/disable Debug() output.

# inner JSBOOT_DIR

Properties:
Name Type Description
JSBOOT_DIR string path of the JSBOOT directory

# inner JSBOOT_ZIP

Properties:
Name Type Description
JSBOOT_ZIP string path/name of the JSBOOT.ZIP

# inner navigator

Properties:
Name Type Description
navigator.appName String can be used to detect jSH

# inner PACKAGE_DIR

Properties:
Name Type Description
PACKAGE_DIR string path of the JSBOOT packages directory

# inner PARALLEL

parallel port IO register definitions. [*] CONTROL.BIDI must be set to 1 in order to read from DATA. Not supported by all ports!
Properties:
Name Type Description
DATA.BIT0 * Data 0, pin 2 (out/in*)
DATA.BIT1 * Data 1, pin 3 (out/in*)
DATA.BIT2 * Data 2, pin 4 (out/in*)
DATA.BIT3 * Data 3, pin 5 (out/in*)
DATA.BIT4 * Data 4, pin 6 (out/in*)
DATA.BIT5 * Data 5, pin 7 (out/in*)
DATA.BIT6 * Data 6, pin 8 (out/in*)
DATA.BIT7 * Data 7, pin 9 (out/in*)
STATUS.BUSY * pin 11, inverted (in)
STATUS.ACK * pin 10 (in)
STATUS.PAPER_OUT * pin 12 (in)
STATUS.SELECT_IN * pin 13 (in)
STATUS.ERROR * pin 15 (in)
STATUS.TIMEOUT * LPTStatus() only
CONTROL.BIDI * this bit must be set in order to read DATA
CONTROL.SELECT_OUT * pin 17, inverted (out)
CONTROL.RESET * pin 16 (out)
CONTROL.LINEFEED * pin 14, inverted (out)
CONTROL.STROBE * pin 1, inverted (out)

# inner RAW_BLOCKSIZE

Properties:
Name Type Description
RAW_BLOCKSIZE number size of sectors when reading/writing raw disks.

# inner RAW_HDD_FLAG

Properties:
Name Type Description
RAW_HDD_FLAG number index for HDDs when using raw disk functions.

# inner ZIP_DELIM

Properties:
Name Type Description
ZIP_DELIM string delimiter between ZIP filename and entry name.

Methods

# inner CharCode(s)

get char code.
Parameters:
Name Type Description
s string a string
the ASCII-code of the first character.

# inner CtrlBreak(enable)

Controls the handling of CTRL-C/BREAK. Note: - MS-DOS and FreeDOS do support it, but only if the program reads/writes from/to the console - DOSBox-X does support it, but only if the program does reads from the console (this will be fixed to behave like MS-DOS/FreeDOS) - plain DOSBox does not support CTRL-C/CTRL-BREAK at all
Parameters:
Name Type Description
enable boolean true to enable CTRL-C/BREAK handling (default) or false to suppress it.

# inner Debug(s)

Write data to JSLOG.TXT logfile.
Parameters:
Name Type Description
s string the string to print.

# inner Debugln(s)

Write data to JSLOG.TXT logfile with a newline.
Parameters:
Name Type Description
s string the string to print.

# inner Exit(codeopt)

Exit jSH.
Parameters:
Name Type Attributes Description
code number <optional>
exit code to return to DOS.

# inner Gc(info)

Run garbage collector, print statistics to logfile if 'info==true'.
Parameters:
Name Type Description
info boolean true to print collection stats to logfile.

# inner GetLoadedLibraries() → {Array.<string>}

Get a list of loaded native libraries.
a list of loaded libraries.
Array.<string>

# inner Include(name)

include a module. The exported functions are copied into global scope.
Parameters:
Name Type Description
name string module file name.
See:
  • Require

# inner InPortByte(port) → {number}

read a byte value from a hardware io-port.
Parameters:
Name Type Description
port number port address to read from.
8-bit value read from port.
number

# inner InPortLong(port) → {number}

read a long value from a hardware io-port.
Parameters:
Name Type Description
port number port address to read from.
32-bit value read from port.
number

# inner InPortWord(port) → {number}

read a word value from a hardware io-port.
Parameters:
Name Type Description
port number port address to read from.
16-bit value read from port.
number

# inner LoadLibrary(name)

Load and initialize a native library (DXE). Native libraries must reside in the directory jSH.EXE was started from!
Parameters:
Name Type Description
name string the base name of the library (e.g. if the library is called "foo.dxe" on disk you need to call LoadLibrary("foo")).

# inner LoadModule()

Alias for LoadLibrary().
See:
  • LoadLibrary()

# inner LPTRawControl(port, bits)

write bits to LPT control register.
Parameters:
Name Type Description
port number port number (0-3).
bits number data to write
See:
  • GetParallelPorts

# inner LPTRawData(port, data) → {number}

read/write data to LPT data register.
Parameters:
Name Type Description
port number port number (0-3).
data number data to write, null to read
See:
  • GetParallelPorts
current LPT value if data was null.
number

# inner LPTRawStatus(port)

read status register of LPT port.
Parameters:
Name Type Description
port number port number (0-3).
See:
  • GetParallelPorts

# inner LPTReset(port)

reset parallel port.
Parameters:
Name Type Description
port number port number (0-3).
See:
  • GetParallelPorts

# inner LPTSend(port, data)

send data to parallel port.
Parameters:
Name Type Description
port number port number (0-3).
data string data to transfer.
See:
  • GetParallelPorts

# inner LPTStatus(port)

read parallel port status.
Parameters:
Name Type Description
port number port number (0-3).
See:
  • GetParallelPorts

# inner MemoryInfo() → {MemInfo}

Get information system memory.
an info object.
MemInfo

# inner NoSound()

Stop playing sound.

# inner OutPortByte(port, value)

write a byte value to a hardware io-port.
Parameters:
Name Type Description
port number port address to write to.
value number 8-bit value to write to port.

# inner OutPortLong(port, value)

write a long value to a hardware io-port.
Parameters:
Name Type Description
port number port address to write to.
value number 32-bit value to write to port.

# inner OutPortWord(port, value)

write a word value to a hardware io-port.
Parameters:
Name Type Description
port number port address to write to.
value number 16-bit value to write to port.

# inner POST(val)

Write the given value to io-port 80h to be displayed by a POST card.
Parameters:
Name Type Description
val number value to write to 0x80.

# inner Print(s)

Write data to stdout.
Parameters:
Name Type Description
s string the string to print.

# inner Println(s)

Write data to stdout with a newline.
Parameters:
Name Type Description
s string the string to print.

# inner Quit(codeopt)

Exit jSH.
Parameters:
Name Type Attributes Description
code number <optional>
exit code to return to DOS.

# inner RandomInt(min, max) → {number}

get random integer between min and max (or between 0 and min if max is not provided).
Parameters:
Name Type Description
min number min
max number max
an integer between min and max.
number

# inner Require(name)

import a module. DOjS modules must put all exported symbols into an object called 'exports'.
Parameters:
Name Type Description
name string module file name.
the imported module.
Example
exports.myVar = 0;               // will be exported
exports.myFunc = function() {};  // will also be exported
var localVar;                    // will only be accessible in the module
function localFunction() {};     // will also only be accessible in the module

# inner RequireFile(name, fname)

try a specific filename which can ba a plain file or a ZIP-file entry. Throws an Exception if the file cant be read.
Parameters:
Name Type Description
name string module name.
fname string the file name to try.
the imported module.

# inner Sound(freq)

Play a sound with given frequency using the PC speaker.
Parameters:
Name Type Description
freq number sound frequency.

# inner StartupInfo()

print startup info with screen details.

# inner System(cmd) → {number}

Run given commandline.
Parameters:
Name Type Description
cmd string command line.
exit code of command.
number
General functions.

Classes

StopWatch

Members

# inner DEBUG

Properties:
Name Type Description
DEBUG boolean enable/disable Debug() output.

# inner JSBOOT_DIR

Properties:
Name Type Description
JSBOOT_DIR string path of the JSBOOT directory

# inner JSBOOT_ZIP

Properties:
Name Type Description
JSBOOT_ZIP string path/name of the JSBOOT.ZIP

# inner navigator

Properties:
Name Type Description
navigator.appName String can be used to detect jSH

# inner PACKAGE_DIR

Properties:
Name Type Description
PACKAGE_DIR string path of the JSBOOT packages directory

# inner PARALLEL

parallel port IO register definitions. [*] CONTROL.BIDI must be set to 1 in order to read from DATA. Not supported by all ports!
Properties:
Name Type Description
DATA.BIT0 * Data 0, pin 2 (out/in*)
DATA.BIT1 * Data 1, pin 3 (out/in*)
DATA.BIT2 * Data 2, pin 4 (out/in*)
DATA.BIT3 * Data 3, pin 5 (out/in*)
DATA.BIT4 * Data 4, pin 6 (out/in*)
DATA.BIT5 * Data 5, pin 7 (out/in*)
DATA.BIT6 * Data 6, pin 8 (out/in*)
DATA.BIT7 * Data 7, pin 9 (out/in*)
STATUS.BUSY * pin 11, inverted (in)
STATUS.ACK * pin 10 (in)
STATUS.PAPER_OUT * pin 12 (in)
STATUS.SELECT_IN * pin 13 (in)
STATUS.ERROR * pin 15 (in)
STATUS.TIMEOUT * LPTStatus() only
CONTROL.BIDI * this bit must be set in order to read DATA
CONTROL.SELECT_OUT * pin 17, inverted (out)
CONTROL.RESET * pin 16 (out)
CONTROL.LINEFEED * pin 14, inverted (out)
CONTROL.STROBE * pin 1, inverted (out)

# inner RAW_BLOCKSIZE

Properties:
Name Type Description
RAW_BLOCKSIZE number size of sectors when reading/writing raw disks.

# inner RAW_HDD_FLAG

Properties:
Name Type Description
RAW_HDD_FLAG number index for HDDs when using raw disk functions.

# inner ZIP_DELIM

Properties:
Name Type Description
ZIP_DELIM string delimiter between ZIP filename and entry name.

Methods

# inner CharCode(s)

get char code.
Parameters:
Name Type Description
s string a string
the ASCII-code of the first character.

# inner CtrlBreak(enable)

Controls the handling of CTRL-C/BREAK. Note: - MS-DOS and FreeDOS do support it, but only if the program reads/writes from/to the console - DOSBox-X does support it, but only if the program does reads from the console (this will be fixed to behave like MS-DOS/FreeDOS) - plain DOSBox does not support CTRL-C/CTRL-BREAK at all
Parameters:
Name Type Description
enable boolean true to enable CTRL-C/BREAK handling (default) or false to suppress it.

# inner Debug(s)

Write data to JSLOG.TXT logfile.
Parameters:
Name Type Description
s string the string to print.

# inner Debugln(s)

Write data to JSLOG.TXT logfile with a newline.
Parameters:
Name Type Description
s string the string to print.

# inner Exit(codeopt)

Exit jSH.
Parameters:
Name Type Attributes Description
code number <optional>
exit code to return to DOS.

# inner Gc(info)

Run garbage collector, print statistics to logfile if 'info==true'.
Parameters:
Name Type Description
info boolean true to print collection stats to logfile.

# inner GetLoadedLibraries() → {Array.<string>}

Get a list of loaded native libraries.
a list of loaded libraries.
Array.<string>

# inner Include(name)

include a module. The exported functions are copied into global scope.
Parameters:
Name Type Description
name string module file name.
See:
  • Require

# inner InPortByte(port) → {number}

read a byte value from a hardware io-port.
Parameters:
Name Type Description
port number port address to read from.
8-bit value read from port.
number

# inner InPortLong(port) → {number}

read a long value from a hardware io-port.
Parameters:
Name Type Description
port number port address to read from.
32-bit value read from port.
number

# inner InPortWord(port) → {number}

read a word value from a hardware io-port.
Parameters:
Name Type Description
port number port address to read from.
16-bit value read from port.
number

# inner LoadLibrary(name)

Load and initialize a native library (DXE). Native libraries must reside in the directory jSH.EXE was started from!
Parameters:
Name Type Description
name string the base name of the library (e.g. if the library is called "foo.dxe" on disk you need to call LoadLibrary("foo")).

# inner LoadModule()

Alias for LoadLibrary().
See:
  • LoadLibrary()

# inner LPTRawControl(port, bits)

write bits to LPT control register.
Parameters:
Name Type Description
port number port number (0-3).
bits number data to write
See:
  • GetParallelPorts

# inner LPTRawData(port, data) → {number}

read/write data to LPT data register.
Parameters:
Name Type Description
port number port number (0-3).
data number data to write, null to read
See:
  • GetParallelPorts
current LPT value if data was null.
number

# inner LPTRawStatus(port)

read status register of LPT port.
Parameters:
Name Type Description
port number port number (0-3).
See:
  • GetParallelPorts

# inner LPTReset(port)

reset parallel port.
Parameters:
Name Type Description
port number port number (0-3).
See:
  • GetParallelPorts

# inner LPTSend(port, data)

send data to parallel port.
Parameters:
Name Type Description
port number port number (0-3).
data string data to transfer.
See:
  • GetParallelPorts

# inner LPTStatus(port)

read parallel port status.
Parameters:
Name Type Description
port number port number (0-3).
See:
  • GetParallelPorts

# inner MemoryInfo() → {MemInfo}

Get information system memory.
an info object.
MemInfo

# inner NoSound()

Stop playing sound.

# inner OutPortByte(port, value)

write a byte value to a hardware io-port.
Parameters:
Name Type Description
port number port address to write to.
value number 8-bit value to write to port.

# inner OutPortLong(port, value)

write a long value to a hardware io-port.
Parameters:
Name Type Description
port number port address to write to.
value number 32-bit value to write to port.

# inner OutPortWord(port, value)

write a word value to a hardware io-port.
Parameters:
Name Type Description
port number port address to write to.
value number 16-bit value to write to port.

# inner POST(val)

Write the given value to io-port 80h to be displayed by a POST card.
Parameters:
Name Type Description
val number value to write to 0x80.

# inner Print(s)

Write data to stdout.
Parameters:
Name Type Description
s string the string to print.

# inner Println(s)

Write data to stdout with a newline.
Parameters:
Name Type Description
s string the string to print.

# inner Quit(codeopt)

Exit jSH.
Parameters:
Name Type Attributes Description
code number <optional>
exit code to return to DOS.

# inner RandomInt(min, max) → {number}

get random integer between min and max (or between 0 and min if max is not provided).
Parameters:
Name Type Description
min number min
max number max
an integer between min and max.
number

# inner Require(name)

import a module. DOjS modules must put all exported symbols into an object called 'exports'.
Parameters:
Name Type Description
name string module file name.
the imported module.
Example
exports.myVar = 0;               // will be exported
exports.myFunc = function() {};  // will also be exported
var localVar;                    // will only be accessible in the module
function localFunction() {};     // will also only be accessible in the module

# inner RequireFile(name, fname)

try a specific filename which can ba a plain file or a ZIP-file entry. Throws an Exception if the file cant be read.
Parameters:
Name Type Description
name string module name.
fname string the file name to try.
the imported module.

# inner Sound(freq)

Play a sound with given frequency using the PC speaker.
Parameters:
Name Type Description
freq number sound frequency.

# inner StartupInfo()

print startup info with screen details.

# inner System(cmd) → {number}

Run given commandline.
Parameters:
Name Type Description
cmd string command line.
exit code of command.
number