# Members

#### # inner ARGS

##### Properties:

Name | Type | Description
--- | --- | ---
`ARGS` | Array.<string> | the command line arguments including the script name.

#### # inner DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`DEBUG` | boolean | enable/disable Debug() output.

#### # inner DOJS_VERSION

##### Properties:

Name | Type | Description
--- | --- | ---
`DOJS_VERSION` | number | the version

#### # inner FILE

file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open file in read mode.
`WRITE` | * | open file in write mode (truncating existing contents)
`APPEND` | * | open file in append mode.

#### # inner Height

##### Properties:

Name | Type | Description
--- | --- | ---
`Height` | number | screen height, alternative to calling SizeY()

#### # inner IPX_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`IPX_AVAILABLE` | boolean | true if networking is available.

#### # inner KEY

keyboard input.

##### Properties:

Name | Type | Description
--- | --- | ---
`Code` | * | key definitions.

#### # inner MOUSE

event interface.

##### Properties:

Name | Type | Description
--- | --- | ---
`Mode.NONE` | * | no cursor
`Mode.ARROW` | * | arrow cursor
`Mode.BUSY` | * | busy cursor
`Mode.QUESTION` | * | questionmark cursor
`Mode.CURSOR_EDIT` | * | edit cursor
`Buttons` | * | mouse button definitions
`LEFT` | * |
`RIGHT` | * |
`MIDDLE` | * |

#### # inner MOUSE_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE_AVAILABLE` | boolean | true if mouse is available.

#### # 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 REMOTE_DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`REMOTE_DEBUG` | boolean | enable/disable Debug() sending via IPX.

#### # inner SOUND

sound input selection.

##### Properties:

Name | Type | Description
--- | --- | ---
`Input.MIC` | * | use microphone input
`Input.LINE` | * | use line input
`Input.CD` | * | use CD input
`Bits.BITS8` | * | use 8 bits
`Bits.BITS16` | * | use 16 bits

#### # inner SOUND_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`SOUND_AVAILABLE` | boolean | true if sound is available.

#### # inner SYSTEM

System() flags for subsystem shutdown/restart.

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE` | * | de/reinit mouse
`SOUND` | * | de/reinit sound
`JOYSTICK` | * | de/reinit joystick
`KEYBOARD` | * | de/reinit keyboard
`TIMER` | * | de/reinit timer

#### # inner Width

##### Properties:

Name | Type | Description
--- | --- | ---
`Width` | number | screen width, alternative to calling SizeX()

#### # inner ZIP_DELIM

##### Properties:

Name | Type | Description
--- | --- | ---
`ZIP_DELIM` | string | delimiter between ZIP filename and entry name.

#### # inner ZIPFILE

ZIP file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open ZIP file in read mode.
`WRITE` | * | open ZIP file in write mode (truncating existing contents)
`APPEND` | * | open ZIP file in append mode.

# Methods

#### # inner _Debug(str)

Internal debug which does not redirect to IPX if enabled.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner BytesToString(data) → {string}

Convert byte array to ASCII string. The string is terminated at the first NULL byte or at array length (whichever comes first).

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Array.<number> | array of numbers.

Returns:

a string.

Type: string

#### # inner CharCode(s)

get char code.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | a string

Returns:

the ASCII-code of the first character.

#### # inner CompareKey(k, s)

compare a keycode with a character.

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | keycode from an Event
`s` | string | a string with one char

#### # inner Debug(str)

print javascript debug output if DEBUG is true.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner Dump(obj)

print an object as JSON to logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | * | the object to print

#### # inner FlushLog()

Flushes, closes and re-opens the current logfile. This is useful if you want to read the current logfile contents from a runing program.

#### # 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 GetFramerate() → {number}

Current frame rate.

Returns:

current framerate.

Type: number

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

Get a list of loaded native libraries.

Returns:

a list of loaded libraries.

Type: Array.<string>

#### # inner GetParallelPorts() → {Array.<number>}

get available parallel ports.

Returns:

list of available parallel ports and their addresses.

Type: Array.<number>

#### # inner GetRandomInt(max)

get a random integer between [0..max[

##### Parameters:

Name | Type | Description
--- | --- | ---
`max` | number | max value to return (eclusive).

#### # inner GetSerialPorts() → {Array.<number>}

get available serial ports.

Returns:

list of available serial ports and their addresses.

Type: Array.<number>

#### # 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 Info(str)

Print info message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner InPortByte(port) → {number}

read a byte value from a hardware io-port.

##### Parameters:

Name | Type | Description
--- | --- | ---
`port` | number | port address to read from.

Returns:

8-bit value read from port.

Type: 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.

Returns:

32-bit value read from port.

Type: 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.

Returns:

16-bit value read from port.

Type: number

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

Get directory listing.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dname` | string | name of directory to list.

Throws:

Throws an error if listing fails.

Returns:

array of entry names.

Type: Array.<string>

#### # 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

Returns:

current LPT value if data was null.

Type: 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.

Returns:

an info object.

Type: MemInfo

#### # inner MkDir(name)

make a directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the new directory

#### # inner MouseSetCursorMode(mode)

Change mode of the mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mode` | * | a mode from MOUSE.

#### # inner MouseSetLimits(x1, y1, x2, y2)

Limit mouse movement.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x1` | number | start x coordinate.
`y1` | number | start y coordinate.
`x2` | number | end x coordinate.
`y2` | number | end y coordinate.

#### # inner MouseSetSpeed(x, y)

Set mouse speed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | horizontal speed.
`y` | number | vertical speed.

#### # inner MouseShowCursor(b)

Show hide mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`b` | boolean | true or false.

#### # inner MouseWarp(x, y)

Move mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | x coordinate.
`y` | number | y coordinate.

#### # inner MsecTime() → {number}

Get ms timestamp.

Returns:

ms time.

Type: number

#### # inner NamedFunction(p, s, fopt)

parse a string into a function. Works like Function() by a source file name can be provided.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`p` | string |  | name of the single parameter.
`s` | string |  | the source of the function.
`f` | string | <optional> | an optional filename where the source came from.

#### # 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 JSLOG.TXT logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # inner Println(s)

Write data to JSLOG.TXT logfile with a newline.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # 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

Returns:

an integer between min and max.

Type: number

#### # inner Read(filename) → {string}

Load the contents of a file into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner ReadZIP(filename, entryname) → {string}

Load the contents of a ZIP file entry into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.
`entryname` | string | name of entry in the ZIP file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner Rename(from, to)

rename file/directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`from` | string | old name
`to` | string | new name

#### # 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.

Returns:

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.

Returns:

the imported module.

#### # inner RmDir(name)

remove a directory (must be empty).

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the directory.

#### # inner RmFile(name)

remove a file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the file.

#### # inner SetExitKey(key)

Change the exit key from ESCAPE to any other keycode from KEY}.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | number |

#### # inner SetFramerate(rate)

Set maximum frame rate. If Loop takes longer than '1/rate' seconds then the framerate will not be reached.

##### Parameters:

Name | Type | Description
--- | --- | ---
`rate` | number | max frame rate wanted.

#### # inner Sleep(ms)

Sleep for the given number of ms.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ms` | number | time to sleep.

#### # inner StartupInfo()

print startup info with screen details.

#### # inner Stat(name) → {StatInfo}

Get information about a file / directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | name of the file to get info for.

Throws:

Throws an error if stat fails.

Returns:

an info object.

Type: StatInfo

#### # inner Stop()

DOjS will exit after the current call to Loop.

#### # inner StopWatch()

create stop watch for benchmarking

#### # inner StringToBytes(str) → {Array.<number>}

Convert ASCII string to byte array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | string to convert.

Returns:

array of numbers.

Type: Array.<number>

#### # inner System(cmd, flags) → {number}

Run a DOS command.

##### Parameters:

Name | Type | Description
--- | --- | ---
`cmd` | string | the command to execute with its parameters.
`flags` | SYSTEM | flags indicating which subsystems to shutdown (if any) during execution of cmd.

Returns:

the return code of the command.

Type: number

#### # inner ZipPrefix(fname) → {string}

prefix a filename with the ZIP file the started script came from. The filename is not modified if the script was not loaded from a ZIP file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fname` | string | file name.

Returns:

a ZIP-filename if the running script was loaded from a ZIP file or the passed filename.

Type: string

Other properties

# Members

#### # inner ARGS

##### Properties:

Name | Type | Description
--- | --- | ---
`ARGS` | Array.<string> | the command line arguments including the script name.

#### # inner DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`DEBUG` | boolean | enable/disable Debug() output.

#### # inner DOJS_VERSION

##### Properties:

Name | Type | Description
--- | --- | ---
`DOJS_VERSION` | number | the version

#### # inner FILE

file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open file in read mode.
`WRITE` | * | open file in write mode (truncating existing contents)
`APPEND` | * | open file in append mode.

#### # inner Height

##### Properties:

Name | Type | Description
--- | --- | ---
`Height` | number | screen height, alternative to calling SizeY()

#### # inner IPX_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`IPX_AVAILABLE` | boolean | true if networking is available.

#### # inner KEY

keyboard input.

##### Properties:

Name | Type | Description
--- | --- | ---
`Code` | * | key definitions.

#### # inner MOUSE

event interface.

##### Properties:

Name | Type | Description
--- | --- | ---
`Mode.NONE` | * | no cursor
`Mode.ARROW` | * | arrow cursor
`Mode.BUSY` | * | busy cursor
`Mode.QUESTION` | * | questionmark cursor
`Mode.CURSOR_EDIT` | * | edit cursor
`Buttons` | * | mouse button definitions
`LEFT` | * |
`RIGHT` | * |
`MIDDLE` | * |

#### # inner MOUSE_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE_AVAILABLE` | boolean | true if mouse is available.

#### # 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 REMOTE_DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`REMOTE_DEBUG` | boolean | enable/disable Debug() sending via IPX.

#### # inner SOUND

sound input selection.

##### Properties:

Name | Type | Description
--- | --- | ---
`Input.MIC` | * | use microphone input
`Input.LINE` | * | use line input
`Input.CD` | * | use CD input
`Bits.BITS8` | * | use 8 bits
`Bits.BITS16` | * | use 16 bits

#### # inner SOUND_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`SOUND_AVAILABLE` | boolean | true if sound is available.

#### # inner SYSTEM

System() flags for subsystem shutdown/restart.

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE` | * | de/reinit mouse
`SOUND` | * | de/reinit sound
`JOYSTICK` | * | de/reinit joystick
`KEYBOARD` | * | de/reinit keyboard
`TIMER` | * | de/reinit timer

#### # inner Width

##### Properties:

Name | Type | Description
--- | --- | ---
`Width` | number | screen width, alternative to calling SizeX()

#### # inner ZIP_DELIM

##### Properties:

Name | Type | Description
--- | --- | ---
`ZIP_DELIM` | string | delimiter between ZIP filename and entry name.

#### # inner ZIPFILE

ZIP file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open ZIP file in read mode.
`WRITE` | * | open ZIP file in write mode (truncating existing contents)
`APPEND` | * | open ZIP file in append mode.

# Methods

#### # inner _Debug(str)

Internal debug which does not redirect to IPX if enabled.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner BytesToString(data) → {string}

Convert byte array to ASCII string. The string is terminated at the first NULL byte or at array length (whichever comes first).

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Array.<number> | array of numbers.

Returns:

a string.

Type: string

#### # inner CharCode(s)

get char code.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | a string

Returns:

the ASCII-code of the first character.

#### # inner CompareKey(k, s)

compare a keycode with a character.

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | keycode from an Event
`s` | string | a string with one char

#### # inner Debug(str)

print javascript debug output if DEBUG is true.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner Dump(obj)

print an object as JSON to logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | * | the object to print

#### # inner FlushLog()

Flushes, closes and re-opens the current logfile. This is useful if you want to read the current logfile contents from a runing program.

#### # 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 GetFramerate() → {number}

Current frame rate.

Returns:

current framerate.

Type: number

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

Get a list of loaded native libraries.

Returns:

a list of loaded libraries.

Type: Array.<string>

#### # inner GetParallelPorts() → {Array.<number>}

get available parallel ports.

Returns:

list of available parallel ports and their addresses.

Type: Array.<number>

#### # inner GetRandomInt(max)

get a random integer between [0..max[

##### Parameters:

Name | Type | Description
--- | --- | ---
`max` | number | max value to return (eclusive).

#### # inner GetSerialPorts() → {Array.<number>}

get available serial ports.

Returns:

list of available serial ports and their addresses.

Type: Array.<number>

#### # 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 Info(str)

Print info message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner InPortByte(port) → {number}

read a byte value from a hardware io-port.

##### Parameters:

Name | Type | Description
--- | --- | ---
`port` | number | port address to read from.

Returns:

8-bit value read from port.

Type: 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.

Returns:

32-bit value read from port.

Type: 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.

Returns:

16-bit value read from port.

Type: number

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

Get directory listing.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dname` | string | name of directory to list.

Throws:

Throws an error if listing fails.

Returns:

array of entry names.

Type: Array.<string>

#### # 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

Returns:

current LPT value if data was null.

Type: 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.

Returns:

an info object.

Type: MemInfo

#### # inner MkDir(name)

make a directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the new directory

#### # inner MouseSetCursorMode(mode)

Change mode of the mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mode` | * | a mode from MOUSE.

#### # inner MouseSetLimits(x1, y1, x2, y2)

Limit mouse movement.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x1` | number | start x coordinate.
`y1` | number | start y coordinate.
`x2` | number | end x coordinate.
`y2` | number | end y coordinate.

#### # inner MouseSetSpeed(x, y)

Set mouse speed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | horizontal speed.
`y` | number | vertical speed.

#### # inner MouseShowCursor(b)

Show hide mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`b` | boolean | true or false.

#### # inner MouseWarp(x, y)

Move mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | x coordinate.
`y` | number | y coordinate.

#### # inner MsecTime() → {number}

Get ms timestamp.

Returns:

ms time.

Type: number

#### # inner NamedFunction(p, s, fopt)

parse a string into a function. Works like Function() by a source file name can be provided.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`p` | string |  | name of the single parameter.
`s` | string |  | the source of the function.
`f` | string | <optional> | an optional filename where the source came from.

#### # 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 JSLOG.TXT logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # inner Println(s)

Write data to JSLOG.TXT logfile with a newline.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # 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

Returns:

an integer between min and max.

Type: number

#### # inner Read(filename) → {string}

Load the contents of a file into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner ReadZIP(filename, entryname) → {string}

Load the contents of a ZIP file entry into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.
`entryname` | string | name of entry in the ZIP file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner Rename(from, to)

rename file/directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`from` | string | old name
`to` | string | new name

#### # 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.

Returns:

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.

Returns:

the imported module.

#### # inner RmDir(name)

remove a directory (must be empty).

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the directory.

#### # inner RmFile(name)

remove a file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the file.

#### # inner SetExitKey(key)

Change the exit key from ESCAPE to any other keycode from KEY}.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | number |

#### # inner SetFramerate(rate)

Set maximum frame rate. If Loop takes longer than '1/rate' seconds then the framerate will not be reached.

##### Parameters:

Name | Type | Description
--- | --- | ---
`rate` | number | max frame rate wanted.

#### # inner Sleep(ms)

Sleep for the given number of ms.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ms` | number | time to sleep.

#### # inner StartupInfo()

print startup info with screen details.

#### # inner Stat(name) → {StatInfo}

Get information about a file / directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | name of the file to get info for.

Throws:

Throws an error if stat fails.

Returns:

an info object.

Type: StatInfo

#### # inner Stop()

DOjS will exit after the current call to Loop.

#### # inner StopWatch()

create stop watch for benchmarking

#### # inner StringToBytes(str) → {Array.<number>}

Convert ASCII string to byte array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | string to convert.

Returns:

array of numbers.

Type: Array.<number>

#### # inner System(cmd, flags) → {number}

Run a DOS command.

##### Parameters:

Name | Type | Description
--- | --- | ---
`cmd` | string | the command to execute with its parameters.
`flags` | SYSTEM | flags indicating which subsystems to shutdown (if any) during execution of cmd.

Returns:

the return code of the command.

Type: number

#### # inner ZipPrefix(fname) → {string}

prefix a filename with the ZIP file the started script came from. The filename is not modified if the script was not loaded from a ZIP file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fname` | string | file name.

Returns:

a ZIP-filename if the running script was loaded from a ZIP file or the passed filename.

Type: string

# Members

#### # inner ARGS

##### Properties:

Name | Type | Description
--- | --- | ---
`ARGS` | Array.<string> | the command line arguments including the script name.

#### # inner DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`DEBUG` | boolean | enable/disable Debug() output.

#### # inner DOJS_VERSION

##### Properties:

Name | Type | Description
--- | --- | ---
`DOJS_VERSION` | number | the version

#### # inner FILE

file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open file in read mode.
`WRITE` | * | open file in write mode (truncating existing contents)
`APPEND` | * | open file in append mode.

#### # inner Height

##### Properties:

Name | Type | Description
--- | --- | ---
`Height` | number | screen height, alternative to calling SizeY()

#### # inner IPX_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`IPX_AVAILABLE` | boolean | true if networking is available.

#### # inner KEY

keyboard input.

##### Properties:

Name | Type | Description
--- | --- | ---
`Code` | * | key definitions.

#### # inner MOUSE

event interface.

##### Properties:

Name | Type | Description
--- | --- | ---
`Mode.NONE` | * | no cursor
`Mode.ARROW` | * | arrow cursor
`Mode.BUSY` | * | busy cursor
`Mode.QUESTION` | * | questionmark cursor
`Mode.CURSOR_EDIT` | * | edit cursor
`Buttons` | * | mouse button definitions
`LEFT` | * |
`RIGHT` | * |
`MIDDLE` | * |

#### # inner MOUSE_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE_AVAILABLE` | boolean | true if mouse is available.

#### # 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 REMOTE_DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`REMOTE_DEBUG` | boolean | enable/disable Debug() sending via IPX.

#### # inner SOUND

sound input selection.

##### Properties:

Name | Type | Description
--- | --- | ---
`Input.MIC` | * | use microphone input
`Input.LINE` | * | use line input
`Input.CD` | * | use CD input
`Bits.BITS8` | * | use 8 bits
`Bits.BITS16` | * | use 16 bits

#### # inner SOUND_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`SOUND_AVAILABLE` | boolean | true if sound is available.

#### # inner SYSTEM

System() flags for subsystem shutdown/restart.

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE` | * | de/reinit mouse
`SOUND` | * | de/reinit sound
`JOYSTICK` | * | de/reinit joystick
`KEYBOARD` | * | de/reinit keyboard
`TIMER` | * | de/reinit timer

#### # inner Width

##### Properties:

Name | Type | Description
--- | --- | ---
`Width` | number | screen width, alternative to calling SizeX()

#### # inner ZIP_DELIM

##### Properties:

Name | Type | Description
--- | --- | ---
`ZIP_DELIM` | string | delimiter between ZIP filename and entry name.

#### # inner ZIPFILE

ZIP file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open ZIP file in read mode.
`WRITE` | * | open ZIP file in write mode (truncating existing contents)
`APPEND` | * | open ZIP file in append mode.

# Methods

#### # inner _Debug(str)

Internal debug which does not redirect to IPX if enabled.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner BytesToString(data) → {string}

Convert byte array to ASCII string. The string is terminated at the first NULL byte or at array length (whichever comes first).

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Array.<number> | array of numbers.

Returns:

a string.

Type: string

#### # inner CharCode(s)

get char code.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | a string

Returns:

the ASCII-code of the first character.

#### # inner CompareKey(k, s)

compare a keycode with a character.

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | keycode from an Event
`s` | string | a string with one char

#### # inner Debug(str)

print javascript debug output if DEBUG is true.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner Dump(obj)

print an object as JSON to logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | * | the object to print

#### # inner FlushLog()

Flushes, closes and re-opens the current logfile. This is useful if you want to read the current logfile contents from a runing program.

#### # 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 GetFramerate() → {number}

Current frame rate.

Returns:

current framerate.

Type: number

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

Get a list of loaded native libraries.

Returns:

a list of loaded libraries.

Type: Array.<string>

#### # inner GetParallelPorts() → {Array.<number>}

get available parallel ports.

Returns:

list of available parallel ports and their addresses.

Type: Array.<number>

#### # inner GetRandomInt(max)

get a random integer between [0..max[

##### Parameters:

Name | Type | Description
--- | --- | ---
`max` | number | max value to return (eclusive).

#### # inner GetSerialPorts() → {Array.<number>}

get available serial ports.

Returns:

list of available serial ports and their addresses.

Type: Array.<number>

#### # 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 Info(str)

Print info message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner InPortByte(port) → {number}

read a byte value from a hardware io-port.

##### Parameters:

Name | Type | Description
--- | --- | ---
`port` | number | port address to read from.

Returns:

8-bit value read from port.

Type: 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.

Returns:

32-bit value read from port.

Type: 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.

Returns:

16-bit value read from port.

Type: number

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

Get directory listing.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dname` | string | name of directory to list.

Throws:

Throws an error if listing fails.

Returns:

array of entry names.

Type: Array.<string>

#### # 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

Returns:

current LPT value if data was null.

Type: 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.

Returns:

an info object.

Type: MemInfo

#### # inner MkDir(name)

make a directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the new directory

#### # inner MouseSetCursorMode(mode)

Change mode of the mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mode` | * | a mode from MOUSE.

#### # inner MouseSetLimits(x1, y1, x2, y2)

Limit mouse movement.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x1` | number | start x coordinate.
`y1` | number | start y coordinate.
`x2` | number | end x coordinate.
`y2` | number | end y coordinate.

#### # inner MouseSetSpeed(x, y)

Set mouse speed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | horizontal speed.
`y` | number | vertical speed.

#### # inner MouseShowCursor(b)

Show hide mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`b` | boolean | true or false.

#### # inner MouseWarp(x, y)

Move mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | x coordinate.
`y` | number | y coordinate.

#### # inner MsecTime() → {number}

Get ms timestamp.

Returns:

ms time.

Type: number

#### # inner NamedFunction(p, s, fopt)

parse a string into a function. Works like Function() by a source file name can be provided.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`p` | string |  | name of the single parameter.
`s` | string |  | the source of the function.
`f` | string | <optional> | an optional filename where the source came from.

#### # 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 JSLOG.TXT logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # inner Println(s)

Write data to JSLOG.TXT logfile with a newline.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # 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

Returns:

an integer between min and max.

Type: number

#### # inner Read(filename) → {string}

Load the contents of a file into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner ReadZIP(filename, entryname) → {string}

Load the contents of a ZIP file entry into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.
`entryname` | string | name of entry in the ZIP file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner Rename(from, to)

rename file/directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`from` | string | old name
`to` | string | new name

#### # 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.

Returns:

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.

Returns:

the imported module.

#### # inner RmDir(name)

remove a directory (must be empty).

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the directory.

#### # inner RmFile(name)

remove a file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the file.

#### # inner SetExitKey(key)

Change the exit key from ESCAPE to any other keycode from KEY}.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | number |

#### # inner SetFramerate(rate)

Set maximum frame rate. If Loop takes longer than '1/rate' seconds then the framerate will not be reached.

##### Parameters:

Name | Type | Description
--- | --- | ---
`rate` | number | max frame rate wanted.

#### # inner Sleep(ms)

Sleep for the given number of ms.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ms` | number | time to sleep.

#### # inner StartupInfo()

print startup info with screen details.

#### # inner Stat(name) → {StatInfo}

Get information about a file / directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | name of the file to get info for.

Throws:

Throws an error if stat fails.

Returns:

an info object.

Type: StatInfo

#### # inner Stop()

DOjS will exit after the current call to Loop.

#### # inner StopWatch()

create stop watch for benchmarking

#### # inner StringToBytes(str) → {Array.<number>}

Convert ASCII string to byte array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | string to convert.

Returns:

array of numbers.

Type: Array.<number>

#### # inner System(cmd, flags) → {number}

Run a DOS command.

##### Parameters:

Name | Type | Description
--- | --- | ---
`cmd` | string | the command to execute with its parameters.
`flags` | SYSTEM | flags indicating which subsystems to shutdown (if any) during execution of cmd.

Returns:

the return code of the command.

Type: number

#### # inner ZipPrefix(fname) → {string}

prefix a filename with the ZIP file the started script came from. The filename is not modified if the script was not loaded from a ZIP file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fname` | string | file name.

Returns:

a ZIP-filename if the running script was loaded from a ZIP file or the passed filename.

Type: string

# Members

#### # inner ARGS

##### Properties:

Name | Type | Description
--- | --- | ---
`ARGS` | Array.<string> | the command line arguments including the script name.

#### # inner DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`DEBUG` | boolean | enable/disable Debug() output.

#### # inner DOJS_VERSION

##### Properties:

Name | Type | Description
--- | --- | ---
`DOJS_VERSION` | number | the version

#### # inner FILE

file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open file in read mode.
`WRITE` | * | open file in write mode (truncating existing contents)
`APPEND` | * | open file in append mode.

#### # inner Height

##### Properties:

Name | Type | Description
--- | --- | ---
`Height` | number | screen height, alternative to calling SizeY()

#### # inner IPX_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`IPX_AVAILABLE` | boolean | true if networking is available.

#### # inner KEY

keyboard input.

##### Properties:

Name | Type | Description
--- | --- | ---
`Code` | * | key definitions.

#### # inner MOUSE

event interface.

##### Properties:

Name | Type | Description
--- | --- | ---
`Mode.NONE` | * | no cursor
`Mode.ARROW` | * | arrow cursor
`Mode.BUSY` | * | busy cursor
`Mode.QUESTION` | * | questionmark cursor
`Mode.CURSOR_EDIT` | * | edit cursor
`Buttons` | * | mouse button definitions
`LEFT` | * |
`RIGHT` | * |
`MIDDLE` | * |

#### # inner MOUSE_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE_AVAILABLE` | boolean | true if mouse is available.

#### # 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 REMOTE_DEBUG

##### Properties:

Name | Type | Description
--- | --- | ---
`REMOTE_DEBUG` | boolean | enable/disable Debug() sending via IPX.

#### # inner SOUND

sound input selection.

##### Properties:

Name | Type | Description
--- | --- | ---
`Input.MIC` | * | use microphone input
`Input.LINE` | * | use line input
`Input.CD` | * | use CD input
`Bits.BITS8` | * | use 8 bits
`Bits.BITS16` | * | use 16 bits

#### # inner SOUND_AVAILABLE

##### Properties:

Name | Type | Description
--- | --- | ---
`SOUND_AVAILABLE` | boolean | true if sound is available.

#### # inner SYSTEM

System() flags for subsystem shutdown/restart.

##### Properties:

Name | Type | Description
--- | --- | ---
`MOUSE` | * | de/reinit mouse
`SOUND` | * | de/reinit sound
`JOYSTICK` | * | de/reinit joystick
`KEYBOARD` | * | de/reinit keyboard
`TIMER` | * | de/reinit timer

#### # inner Width

##### Properties:

Name | Type | Description
--- | --- | ---
`Width` | number | screen width, alternative to calling SizeX()

#### # inner ZIP_DELIM

##### Properties:

Name | Type | Description
--- | --- | ---
`ZIP_DELIM` | string | delimiter between ZIP filename and entry name.

#### # inner ZIPFILE

ZIP file mode definition.

##### Properties:

Name | Type | Description
--- | --- | ---
`READ` | * | open ZIP file in read mode.
`WRITE` | * | open ZIP file in write mode (truncating existing contents)
`APPEND` | * | open ZIP file in append mode.

# Methods

#### # inner _Debug(str)

Internal debug which does not redirect to IPX if enabled.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner BytesToString(data) → {string}

Convert byte array to ASCII string. The string is terminated at the first NULL byte or at array length (whichever comes first).

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Array.<number> | array of numbers.

Returns:

a string.

Type: string

#### # inner CharCode(s)

get char code.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | a string

Returns:

the ASCII-code of the first character.

#### # inner CompareKey(k, s)

compare a keycode with a character.

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | keycode from an Event
`s` | string | a string with one char

#### # inner Debug(str)

print javascript debug output if DEBUG is true.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner Dump(obj)

print an object as JSON to logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | * | the object to print

#### # inner FlushLog()

Flushes, closes and re-opens the current logfile. This is useful if you want to read the current logfile contents from a runing program.

#### # 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 GetFramerate() → {number}

Current frame rate.

Returns:

current framerate.

Type: number

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

Get a list of loaded native libraries.

Returns:

a list of loaded libraries.

Type: Array.<string>

#### # inner GetParallelPorts() → {Array.<number>}

get available parallel ports.

Returns:

list of available parallel ports and their addresses.

Type: Array.<number>

#### # inner GetRandomInt(max)

get a random integer between [0..max[

##### Parameters:

Name | Type | Description
--- | --- | ---
`max` | number | max value to return (eclusive).

#### # inner GetSerialPorts() → {Array.<number>}

get available serial ports.

Returns:

list of available serial ports and their addresses.

Type: Array.<number>

#### # 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 Info(str)

Print info message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | the message to print.

#### # inner InPortByte(port) → {number}

read a byte value from a hardware io-port.

##### Parameters:

Name | Type | Description
--- | --- | ---
`port` | number | port address to read from.

Returns:

8-bit value read from port.

Type: 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.

Returns:

32-bit value read from port.

Type: 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.

Returns:

16-bit value read from port.

Type: number

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

Get directory listing.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dname` | string | name of directory to list.

Throws:

Throws an error if listing fails.

Returns:

array of entry names.

Type: Array.<string>

#### # 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

Returns:

current LPT value if data was null.

Type: 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.

Returns:

an info object.

Type: MemInfo

#### # inner MkDir(name)

make a directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the new directory

#### # inner MouseSetCursorMode(mode)

Change mode of the mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mode` | * | a mode from MOUSE.

#### # inner MouseSetLimits(x1, y1, x2, y2)

Limit mouse movement.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x1` | number | start x coordinate.
`y1` | number | start y coordinate.
`x2` | number | end x coordinate.
`y2` | number | end y coordinate.

#### # inner MouseSetSpeed(x, y)

Set mouse speed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | horizontal speed.
`y` | number | vertical speed.

#### # inner MouseShowCursor(b)

Show hide mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`b` | boolean | true or false.

#### # inner MouseWarp(x, y)

Move mouse cursor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | x coordinate.
`y` | number | y coordinate.

#### # inner MsecTime() → {number}

Get ms timestamp.

Returns:

ms time.

Type: number

#### # inner NamedFunction(p, s, fopt)

parse a string into a function. Works like Function() by a source file name can be provided.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`p` | string |  | name of the single parameter.
`s` | string |  | the source of the function.
`f` | string | <optional> | an optional filename where the source came from.

#### # 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 JSLOG.TXT logfile.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # inner Println(s)

Write data to JSLOG.TXT logfile with a newline.

##### Parameters:

Name | Type | Description
--- | --- | ---
`s` | string | the string to print.

#### # 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

Returns:

an integer between min and max.

Type: number

#### # inner Read(filename) → {string}

Load the contents of a file into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner ReadZIP(filename, entryname) → {string}

Load the contents of a ZIP file entry into a string. Throws exception if loading fails.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | name of file to read.
`entryname` | string | name of entry in the ZIP file to read.

Throws:

Throws an error if reading fails.

Returns:

the contents of the file.

Type: string

#### # inner Rename(from, to)

rename file/directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`from` | string | old name
`to` | string | new name

#### # 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.

Returns:

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.

Returns:

the imported module.

#### # inner RmDir(name)

remove a directory (must be empty).

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the directory.

#### # inner RmFile(name)

remove a file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | path/name of the file.

#### # inner SetExitKey(key)

Change the exit key from ESCAPE to any other keycode from KEY}.

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | number |

#### # inner SetFramerate(rate)

Set maximum frame rate. If Loop takes longer than '1/rate' seconds then the framerate will not be reached.

##### Parameters:

Name | Type | Description
--- | --- | ---
`rate` | number | max frame rate wanted.

#### # inner Sleep(ms)

Sleep for the given number of ms.

##### Parameters:

Name | Type | Description
--- | --- | ---
`ms` | number | time to sleep.

#### # inner StartupInfo()

print startup info with screen details.

#### # inner Stat(name) → {StatInfo}

Get information about a file / directory.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | name of the file to get info for.

Throws:

Throws an error if stat fails.

Returns:

an info object.

Type: StatInfo

#### # inner Stop()

DOjS will exit after the current call to Loop.

#### # inner StopWatch()

create stop watch for benchmarking

#### # inner StringToBytes(str) → {Array.<number>}

Convert ASCII string to byte array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | string to convert.

Returns:

array of numbers.

Type: Array.<number>

#### # inner System(cmd, flags) → {number}

Run a DOS command.

##### Parameters:

Name | Type | Description
--- | --- | ---
`cmd` | string | the command to execute with its parameters.
`flags` | SYSTEM | flags indicating which subsystems to shutdown (if any) during execution of cmd.

Returns:

the return code of the command.

Type: number

#### # inner ZipPrefix(fname) → {string}

prefix a filename with the ZIP file the started script came from. The filename is not modified if the script was not loaded from a ZIP file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fname` | string | file name.

Returns:

a ZIP-filename if the running script was loaded from a ZIP file or the passed filename.

Type: string