![]() | Thanks to Lars Skovlund and Francois Boyer for additional information! |
In SCI0, calls to the SCI kernel are initiated by using the callk opcode. callk has the opcode 0x42 or 0x43; 0x42 takes one 16 bit little endian and one 8 bit paramter, 0x43 takes two 8 bit parameters. The first parameter is the number of the kernel function to be called, the second number undetermined (as of yet).
Opcode summary:
op 0x42: callk W kfunct, B kparams (4 bytes) |
op 0x43: callk B kfunct, B kparams (3 bytes) |
The number of parameters passed to the kernel function are determined by kparam. A total number of (kparams+2) bytes are removed from the local stack and passed on to the kernel function. The first two of those bytes are apparently always created by pushing the number of following bytes. For example, if Load(view, 10) is called, then we've got two word parameters, "view" (0x0080) and "10" (0x000a). So the callk function would have kparams set to 4; this value would be pushed to the stack first, followed by the two parameters. So the stack would look like this (left means lower address, byte ordering little endian):
02 00 80 00 0a 00
before calling Load().
Return values are returned into the accumulator, unless stated otherwise. If return type is stated as (void), then the accumulator is not modified.
SCI0 uses only little endian 16 bit integer values for parameters. However, this document distinguishes between different uses of those integers by defining the following variable types:
(word): 16 bit signed little endian integer |
(HeapPtr): As (word); interpreted as a pointer to a heap address |
(DblList): As (HeapPtr); interpreted as offset of a doubly linked list |
(Node): As (HeapPtr); interpreted as offset of a list node |
(&FarPtr): As (HeapPtr); interpreted as the 32 bit pointer stored at the referenced heap address |
(Point): A sequence of two (word)s to describe a point on the screen, with the y coordinate being the first in the sequence. |
(Rect): A sequence of four (word)s describing a rectangle. If you read "(Rect) foo", think "(word) foo_ymin, (word) foo_xmin, (word) foo_ymax, (word) foo_xmax" instead. |
(String): If greater than or equal to 1000, this is the heap address of a text string. If less than 1000, it is the number of a text resource, and immediately followed by another word that contains the number of the string inside the text resource. |
Parameters in brackets (like "[foo]") are optional.
Most functions exit gracefully if either a NULL HeapPtr or DblList is provided.
(word) ResType: The resource type number | 0x80 (as in the patch files) |
(word) ResNr: The resource number |
Returns: (&FarPtr) : A HeapPtr pointing to an actual pointer on the heap.
Loads a resource. The returned HeapPtr points to a special point on the heap where a pointer (32 bits) to the memory location of the specified resource is located. If the resource type equals sci_memory, the resource number is interpreted as a memory size instead; the specified number of bytes is allocated dynamically, and a handle returned.
(word) ResType: The resource type number | 0x80 |
(word) ResNr: The resource number |
Returns: (void)
This function unloads a resource identified by its ResType and ResNr, NOT by the HeapPtr it has been loaded to, except for sci_memory resources, where the parameters are the memory resource type and the handle.
(word) ScriptNr: Number of the script to reference |
(word) DispatchNr: Number of the Dispatch entry inside the script to reference |
Returns: (HeapPtr) : The address pointed to by the specified element of the dispatch/exports table (script block type #7)
This function returns the address pointed to by an element of a script's dispatch table.
(word) ScriptNumber |
Returns: (void)
Disposes a script. Unloads it, removes its entries from the class table, and frees the associated heap memory.
(HeapPtr) object: The object to clone |
Returns: (HeapPtr) The address of the clone
This function clones a Class or Object by copying it as a whole and mofifying the -info- selector so that it contains 1. Objects with -info- set to 0x8000 (Classes) are stripped of their selector name area, and both Objects and Classes are stripped of the function selector area.
(HeapPtr) clone: The clone to dispose |
Returns: (void)
Frees all memory associated with a cloned object (as produced by Clone()).
(HeapPtr) suspected_object: The address of something that is suspected to be an object. |
Returns: (int) 1 if there is an object at the specified address, 0 if not.
This function checks whether the supplied heap pointer is valid and returns 0 if not, then proceeds to testing whether an object is at the indexed heap position. If it is, 1 is returned, 0 otherwise.
(word) PicNr: The resource number of the picture to draw | |||||||||||||||||||
(word)
Animation: One of the following animation modes:
| |||||||||||||||||||
(word)
Flags:
| |||||||||||||||||||
(word) DefaultPalette: The default palette number to use for drawing |
Returns: (void)
The second parameter does not appear to affect anything. In QfG1, it appears to be set to 0x64 constantly. DefaultPalette is used to differentiate between day and night in QfG1. Palette 1 is used for "night" pictures, Palette 0 for "day" pictures there. The picture is drawn to the background image (which is used for restauration of everything with the exception of the mouse pointer). To bring it to the foreground, Animate() must be used.
[(word) NewPicNotValid]: The new value of the "PicNotValid" flag. |
Returns: (word) : The previous value of the "PicNotValid" flag
This sets the PicNotValid flag that determines whether or not the current background picture should be considered "valid" by the other kernel functions.
[(DblList) ViewList]: List of views that are to be drawn on top of the background picture |
(word) <unknown> |
Returns: (void)
This function draws a background picture plus some views to the foreground. If the background picture had not been drawn previously, it is animated with the animation style set during kDrawPic (see the section called Kernel function 0x08: DrawPic(word[, word, word, word])). Drawing the views is a rather complex issue. Refer to the section called Views and animation in SCI in Chapter 6 for its description.
(HeapPtr) object: The object which the view selector should be taken from |
Returns: (word) The number of loops in the view
This function looks up the view selector in the specified object, loads the view resource associated with it, and checks for the number of animation loops in the view.
HeapPtr object: The object which the selectors should be taken from |
Returns: (word) The number of cels in the loop
This function looks up one specific loop in a specific view (both are taken from selectors with the same name from the object pointed to by the parameter) and returns the number of cels (animation frames) in it.
(HeapPtr) view: The view we're searching in loop: The loop the cel is contained in cel: The cel we're interested in |
Returns: (word) The width of the cel identified by the tuple (view, loop, cel).
(HeapPtr) view: The view we're searching in loop: The loop the cel is contained in cel: The cel we're interested in |
Returns: (word) The height of the cel identified by the tuple (view, loop, cel).
(word) view: Number of the view resource to display |
(word) loop: Number of the loop in the view resource to display |
(word) cel: Number of the cel inside the loop to display |
(Point) pos: Position the cel should be drawn to |
(word) priority: Priority to draw the cel with |
Returns: (void)
Explicitly draws a cel, specified by the complete tuple (view, loop, cel), to a specified position. Invalid loop/cel values are assumed to be 0.
(DblList) picviews: A doubly linked list of PicViews, i.e. objects that are drawn statically onto the background picture |
Returns: (void)
This function stores the list of PicViews for later use by the Animate() syscall. See the section called Kernel function 0x0b: Animate([DblList], [word]) for more details.
kfunct NewWindow
(Rect Boundaries, HeapPtr Title, word Flags, word Priority, word FGColor, word BGColor);
(Rect) Boundaries: The bounding rectangle of the window | |||||
(HeapPtr) Title: A pointer to the window title | |||||
(word)
Flags:
| |||||
(word) Priority: The priority at which the window should be drawn, or -1 to force on-top drawing | |||||
(word) FGColor: The foreground color for the window | |||||
(word) BGColor: The background color |
Returns: (HeapPtr) : The position of the window structure on the heap
This function creates a window (see also the section called Windows, Dialogs and Controls in Chapter 3), sets this window as the active port, draws the window (if neccessary), and returns with the window's heap address.
Returns: (HeapPtr) : A pointer to a record with the internal representation of the currently active port.
Returns a heap pointer to a port structure.
(HeapPtr) NewPort: The new port to set |
Returns: (void)
This selects the new port which many kernel functions will draw to.
If 0 is passed, the window manager port is selected. The picture window is not accessible using this call. Only other kernel calls like KDrawPic may activate the picture window - and they always save the old port and restore it before they return.
(HeapPtr) Window: The heap address of the window to destroy |
Returns: (void)
Destroys a window and frees the associated heap structure.
(HeapPtr) Control: The heap address of the Control to draw |
Returns: (void)
This function draws a Control (see the section called Windows, Dialogs and Controls in Chapter 3 for details). Please note that the correct port must be selected beforehand.
(HeapPtr) Control: The control to highlight |
Returns: (void)
This function is used to highlight a control by drawing it with an inverted color scheme. It requires the correct port to be set beforehand. See the section called Windows, Dialogs and Controls in Chapter 3 for details on the windowing/Control system.
(HeapPtr) Control: A heap pointer to the Control to edit |
Returns: (void)
This function will give control to the kernel and allow the editing of a type 3 (Edit window) Control (see the section called Windows, Dialogs and Controls in Chapter 3 for a description of the control system). If it is called to edit a Control which is not of type 3, it returns without error. Please note that the correct port (usually the window which the Control was drawn in) must be selected beforehand.
(HeapPtr) dest: The destination to write the rectangle to |
(HeapPtr) src: A pointer to the string to analyze |
(word) font: The number of the font resource to use for this check |
(word) maxwidth: The maximum width to allow for the text (defaults to 192) |
Returns: (void)
This function calculates the width and height the specified text will require to be displayed with the specified font and the specified maximum width. The result will be written to the (you guessed it) specified destination on the heap. The result is a rectangle structure: The first four bytes equal to zero, the next word is the height, and the last word is the width.
(String) text: The text to work with | |||||||||
(word)
commands...: A sequence of commands with parameters:
|
Returns: (void) or (&FarPtr) (see above)
This function executes the specified commands, then draws the supplied text to the active port (unless command 108 was executed).
(word)
Flags: A bitfield:
| ||
(HeapPtr) Event: An Object on the stack which the results are written to. |
Returns: (word): 0 if a null event was created, 1 otherwise.
This function fills an Event object with data from the event queue. The results are written to the "type", "message" and "modifiers" selectors. See the section called Event handling in SCI in Chapter 6 for details.
(HeapPtr) Event: pointer to the Event object to convert |
Returns: (void)
This function converts a screen-relative event to a port-relative one, using the currently active port.
(HeapPtr) Event: pointer to the Event object to convert |
Returns: (void)
This function converts a port-relative event to a screen-relative one, using the currently active port.
(HeapPtr) Event: pointer to the Event object to convert |
Returns: (HeapPtr): A pointer to the converted object
This function converts a keyboard event to a movement event, if possible. Otherwise, the function returns without error. See the section called Event handling in SCI in Chapter 6 for details.
(word) mode: 1 to draw, 0 to clear |
Returns: (void)
Either draws or clears (overdraws with black) the menu bar.
(HeapPtr) event: The event to interpret |
(word) flag: (unknown) |
Returns: (word) The menu index of a selected option, -1 if no menu option was selected, or 0 if the event passed through all of the menu system's filters.
This function interprets the event passed to it by running several checks. First, it tries to determine whether the menu system was activated by pressing the ESC key or clicking on the menu bar. In this case, the interpreter takes over and waits for the player to select a menu option. It then returns the menu option selected (menu number, starting at 1, in the upper 8 bits, item number, starting at 1 as well, in the lower part) or -1 if no active menu item was selected. In any case, the event is claimed. If the menu system was not activated by the event, it checks the event against the key commands or Said Blocks associated with each menu entry. If there is a match, the menu coordinate tuple is returned and the event is claimed, otherwise, 0 is returned.
(HeapPtr) title: The menu title |
(HeapPtr) content: The menu options |
Returns: (void)
This function adds a menu to the menu bar. The menu title is passed in the first parameter, the second parameter contains a heap pointer to the menu entries. They are contained in one single string; the following special characters/character combinations are used:
'`': Right justify the following text |
':': Menu item separator |
"--!": Seperation line: This menu item is just a separator |
'#': Function key. This is replaced by an F for displaying |
'^': Control key. This is replaced by \001 (CTRL) for displaying |
(HeapPtr) text: The text to draw |
Returns: (void)
Draws the specified text to the title bar
(HeapPtr) event: The event to generate |
(HeapPtr) input: The input line to parse |
Returns: (word) 1 on success, 0 otherwise
This function parses the input line and generates a parse event (type 0x80). See the section called The Parser in Chapter 6 and the section called Event handling in SCI in Chapter 6 for details.
(HeapPtr) said_block: Pointer to a Said block |
Returns: (word) 1 if the line last parsed meets the criteria of the supplied said_block, 0 otherwise.
This function is only invoked after Parse() was called, and works on output generated by this function. See the section called The Parser in Chapter 6 and the section called Event handling in SCI in Chapter 6 for details.
(DblList) list: List of script objects to examine |
Returns: (void)
This function sets the synonyms used by the parser. Synonyms are used to replace specified word groups with other word groups. The list contains a collection of script objects; all synonyms defined by the corresponding script (which can be identified by evaluating the 'number' selector of the script object) are added to the list of active synonyms.
Returns: (word) 1 if a mouse is available, 0 if not.
This function simply returns a flag containing the availability of a pointing device.
(word) resource: The cursor resource to use for drawing the mouse pointer |
(word) visible: 1 if the mouse pointer should be visible, 0 if not |
(Point) coordinates: The coordinates (relative to the wm-port) to move the mouse pointer to |
Returns: (void)
This function can change the appearance and position of the mouse pointer. If no position is provided, the position remains unchanged.
(String) fname: The file name |
(word) mode: The mode to open the file with |
Returns: (word) a file handle on success, 0 on error
Tries to open or create a file in the CWD with the specified file name. The following modes are valid:
0: open or fail: Try to open file, abort if not possible |
1: open or create: Try to open file, create it if it doesn't exist |
2: create: Create the file, destroying any content it might have had |
(word) filehandle: Handle of the file to write to |
(String) data: The string to write to the file |
Returns: (void)
Writes a zero-terminated string to a file
(String) dest: Pointer to the destination buffer |
(word) maxsize: Maximum number of bytes to read |
(word) handle: Handle of the file to read from |
Returns: (void)
(word) filehandle: Handle of the file to close |
Returns: (void)
Closes a previously opened file.
(String) game_id: The game object's ID string (e.g. "SQ3") |
(word) save_nr: "slot" the game is to be saved to |
(String) save_description: String description of the game |
(String) version: Stringified game version number |
Returns: (word) 1 on success, 0 if an error occured while saving
This function saves the game state (heap, windows, call stack, view list, sound state etc.) to the savegame with the numeric id save_nr and the description save_description. game_id and version are stored alongside, for verification when the game state is restored.
(String) game_id: The game object's ID string |
(word) save_nr: Number of the save game to restore |
(String) version: The game object's version number |
Returns: (void)
This function restores a previously saved game. It should only return if restoring failed.
Returns: never
If this function is invoked, the following things happen:
The restarting flag is set |
The menu bar structure is destroyed |
All sounds are stopped |
All scripts are removed from the script table |
The heap status is reset, but the heap is not cleared |
(word) action: The sound command subfunction number |
Returns: (see below)
'action' may be one of the following:
0x0: INIT |
0x1: PLAY |
0x2: NOP |
0x3: DISPOSE |
0x4: SET_SOUND |
0x5: STOP |
0x6: SUSPEND |
0x7: RESUME |
0x8: VOLUME |
0x9: UPDATE |
0xa: FADE |
0xb: CHECK_DRIVER |
0xc: ALL_STOP |
(word) 0: subfunction identifier |
(Object) sound_obj: The sound object affected |
Returns: (void)
Initializes the specified sound object. This will set the 'status' selector of the object to 1 ('initialized'), and load the sound indicated by the 'number' selector into the sound driver.
(word) 1: The subfunction identifier |
(Object) sound_obj: The sound object affected |
Returns: (void)
Starts to play the song represented by the specified sound object. This will also set the 'status' selector of the object to 2 ('playing').
(word) 2: The sound command subfunction number |
Returns: (void)
No action appears to be associated with this subfunction call.
(word) 3: The sound command subfunction number |
(Object) sound_obj: The sound object affected |
Returns: (void)
Removes the song indexed by a sound object from the sound server song list
(word) 4: The sound command subfunction number |
(word) state: 1 if sound should be active, 0 if it should be turned off |
Returns: (word) 1 if currently active, 0 if currently muted.
This function completely mutes or un-mutes the sound subsystem. If called with no parameters, it returns the current status.
(word) 5: The sound command subfunction number |
(Object) sound_obj: The sound object affected |
Returns: (void)
Stops playing the song represented by the specified sound object. This will set the object's 'state' selector to 0 ('stopped').
(word) 6: The sound command subfunction number |
(Object) sound_obj: The sound object affected |
Returns: (void)
Suspends the song associated with the specified sound object. Its state is buffered, so that it can be resumed later on. The sound object's 'state' selector is set to 3 ('suspended').
(word) 7: The sound command subfunction number |
(Object) sound_obj: The sound object affected |
Returns: (void)
Resumes a previously suspended song. The 'state' selector is set to 2 ('playing').
(word) 8: The sound command subfunction number |
(word) volume: An optional volume parameter |
Returns: (word) The currently set sound volume (0 to 0xf)
This subfunction retrieves and returns the current sound volume. If a second parameter is supplied the volume will be set to the value of this parameter.
(word) 9: The sound command subfunction number |
(Object) sound_obj: The sound object affected |
Returns: (void)
Notifies the sound server that a sound object was modified. The song priority and number of loops (stored in the 'priority' and 'loop' selectors, respectively) are re-evaulated by the sound system.
(word) 0xa: The sound command subfunction number |
(Object) sound_obj: The sound object affected |
Returns: (void)
Fades the specified song. Fading takes approximately two seconds. The song status is set to 'stopped' (0) afterwards.
(word) 0xb: The sound command subfunction number |
Returns: (word) 1 if the sound driver was installed successfully, 0 if not
(word) 0xc: The sound command subfunction number |
Returns: (void)
Stops all music and sound effects.
Returns: (DblList) The address of a new node list on the heap
This function allocates and initializes a node list containing no elements.
(NodeList) list: The list to dispose |
Returns: (void)
Frees all memory associated to a list
(word) key: The node key (used for searching the list) |
(word) value: The node value |
Returns: (Node) A new node
This function allocates a new node and initializes it with the key and value passed as parameters.
(DblList) list: The list to examine |
Returns: (Node) The first node of the list, or 0 if the list is empty
(DblList) list: The list to examine |
Returns: (Node) The last node of the list, or 0 if the list is empty
(DblList) list: The list to check |
Returns: (int) 1 if list is an empty list, 0 if it isn't.
(Node) node: The node whose succcessor is to be found |
Returns: (Node) The node following the supplied node, or 0 if none is available
(Node) node: The node whose predecessor is to be determined |
Returns: (Node) The supplied node's predecessor, or 0 if the node has no predecessor
(Node) node: The node whose value is to be determined |
Returns: (word) The value associated with the specified node
(DblList) list: The list to insert into |
(Node) ref_node: The node in list to insert after |
(Node) new_node: The node to insert |
Returns: (void)
This function inserts new_node into list as the immediate successor of ref_node.
(DblList) list: The list the node is to be added to |
(Node) node: The node to add |
Returns: (void)
This function adds a node to the beginning of a doubly linked list.
(DblList) list: The list to add the node to |
(Node) node: The node to add to the list |
Returns: (void)
This function adds the specified node to the end of the specified list.
(DblList) list: The list in which the key is to be sought |
(word) key: The key to seek |
Returns: (Node) The node containing the key, or 0 if no node contains it
This function searches for a specific key in the nodes of a doubly linked list.
(DblList) list: The list to examine |
(word) key: The key to find |
Returns: (void)
This function searches in the supplied list for the specified key and removes the node containing it, if any can be found.
(word) min: The minimum result |
(word) max: The maximum result |
Returns: (word) A random number between min and max (inclusive)
(word) value: The value to absolutize |
Returns: (word) The absolute value of the specified parameter
This function interprets the supplied value as a signed value and returns its absolute value.
(word) value: The value to draw the square root out of |
Returns: (word) The square root of the supplied value
(Point) origin: The point to look from |
(Point) destination: The point to look to |
Returns: (word) A positive angle between the two points, relative to the screen coordinate axis.
This function returns approximately the following value: -(180.0/PI * atan2(destination.y - origin.y, destination.x - origin.x)) + 180; Where atan2(double, double) is the libm function.
(Point) foo: A point in two-dimensional integer space |
(Point) bar: Another two-dimensional integer point |
Returns: (int) The euklidian distance between the points foo and bar
(word) ticks: The number of game ticks (60 Hz beats) to wait |
Returns: (word) The time passed in between the finish of the last Wait() syscall
(wrod) mode: If this parameter is supplied, the time of day is returned. |
Returns: (word) Either the time of day in seconds, or the elapsed number of ticks since the interpreter started.
This function is somewhat strange, because it determines its behaviour not by the value of a parameter passed, but by its presence instead. Please note that the time of day in this case does not distinguish between am and pm.
(HeapPtr) string: The string whose terminator should be found |
Returns: (HeapPtr) The address of the null terminator of the indexed string
(HeapPtr) dest: The string whose end is appended to |
(HeapPtr) source: The string to append |
Returns: (HeapPtr) dest
This function concatenates two strings on the heap.
(HeapPtr) foo: The one string to compare |
(HeapPtr) bar: The other string to compare |
(int) width: The maximum number of characters to compare |
Returns: (word) -1 if foo is less than bar, 0 if both are equal, 1 if foo is greater than bar
This function simply encapsulates the libc strcmp(char *, char *) and strncmp(char *, char *, int) functions.
(HeapPtr) string: The string whose length should be calculated |
Returns: (word) The length of the specified string.
(HeapPtr) dest: The destination to copy the string to |
(HeapPtr) src: The source from which the string is to be copied |
(word) length: The maximum length of the string to copy |
Returns: (HeapPtr) dest
Copies a string, plus the trailing \0 terminator. The length of the string may be reduced with the optional length parameter. This function simply encapsulates the libc strcpy(char *, char *) and strncpy(char *, char *, int) fucntions.
(HeapPtr) dest: The heap destination to write to |
(String) format: The format to use |
(misc) parameters: The values and strings to insert |
Returns: (HeapPtr) dest
This syscall acts as a frontend to the libc sprintf(char *, char *) function.
(word) resnr: Number of the text resource to retreive the text from |
(word) stringnr: Number of the string inside the resource to retreive |
(HeapPtr) dest: The destination to write the text to |
Returns: (HeapPtr) dest
Retreives a string from a text resource and puts it on the heap.
(HeapPtr) src: The address of the string to interpret as a number |
Returns: (word) The numeric value of the supplied string
This function acts as a frontend to the libc atoi(char *) function, with one exception: Numbers beginning with a '$' are interpreted as hexadecimal numbers.
(HeapPtr) view_obj: The view object whose base is to be set |
Returns: (void)
This method is used to set the bounding rectangle of a view. The bounding rectangle is specified by the set {brLeft, brRight, brTop, brBottom} of selectors, which indicate the window-relative boundary points of the object's bounding rectangle. The rectangle defined here is used for colission detection, among other things.
The algorithm employed by FreeSCI to determine these values appears to be either identical or very close to the original algorithm; it depends several of the object's selectors (x, y, z, ystep, view) the width and height of the view indicated by its (view, loop, cel) selectors, and that view's horizontal and vertical pixel offset modifyers (xmod, ymod). The algorithm works as follows:
brLeft := x - xmod - width / 2 brRight := brLeft + width brBottom := y - z - ymod + 1 brTop := brBottom - ystep |
(HeapPtr) object: The object whose loop selector is to be set |
(word) angle: The angle which is to be used as a base to choose the loop angle |
Returns: (void)
This function sets the loop selector of the specified object to a value implied by the 'angle' parameter, according to the following table:
(HeapPtr) obj: The object to test |
(DblList) clip_list: An optional list of objects to test obj against |
Returns: (int) 1 if obj can be where it is, 0 if not.
This function first retreives obj's signal and illegalBits selectors, plus its brRect (boundary rectangle, consisting of brTop, brBottom, brLeft and brRight). If either of the DONT_RESTORE or IGNORE_ACTOR flags is set, the function returns 1, otherwise it proceeds with verifying that
illegalBits bitwise-AND the disjunction of all elements of { 2n | ∃ a pixel with the color value n inside the control map zone delimited by obj's brRect} equals 0 |
¬∃pic,pic∈clip_list. (pic::signal & (DONT_RESTORE | IGNORE_ACTOR)) = 0 ∧ pic::brRect ∩ obj::brRect ≠ ∅ |
(word) map: The map to check (bit 0: visual, bit 1: priority, bit 2: special) |
(Point) or (Rect) Area: The point or rectangle that is to be scanned |
Returns: (word) The resulting bitfield
This function scans the indicated point or area on the specified map, and sets the bit corresponding to each color value found correspondingly. For example, if scanning map 4 (special) would touch two areas, one with color value 1 and one with color value 10, the resulting return value would be 0x0402 (binary 0000010000000010). See also the section called Pictures and movement control in Chapter 3.
(HeapPtr) mover: The mover object to initialize |
(word) step_factor: A factor to multiply the step size with (defaults to 1) |
Returns: (void)
Initializes a mover object for bresenham movement from the object's client's coordinates to the coordinates specified by its own pair of (x,y) selectors. To do this, it retreives the mover's client, and calculates the result values according to the algorithm for determining the initial values for iterative line drawing according to the Bresenham line algorithm:
client := mover::client δx := mover::x - client::x δy := mover::y - client::y vxmax := client::xStep * step_factor vymax := client::yStep * step_factor numstepsx := |δx / vxmax| numstepsy := |δy / vymax| IF numstepsx > numstepsy THEN numsteps := numstepsx mover::b_xAxis := 1 δ0 := δx δ1 := δy s := client::yStep ELSE numsteps := numstepsy mover::b_xAxis := 0 δ1 := δx δ0 := δy s := client::xStep FI mover::dx := δx / numsteps mover::dy := δy / numsteps mover::b_di := - |δ0| mover::b_i1 := 2 * (|δ1| - |s * numsteps|) * |δ0| mover::b_incr := δ1 / |δ1| mover::b_i2 := mover::b_d1 * 2 |
Returns: (void)
This function forces the interpreter to enter debug mode. It is equivalent to pressing LShift-RShift-PadMinus.
(word) mode: 0 to 4 (see below) |
Returns: (word) The amount of free memory on the heap, in bytes
This function returns the total amount of free memory on the heap if mode == 0. If mode equals 1, the total size of the largest chunk of heap memory is returned. In mode 2, the size of the largest available hunk memory block is returned, and mode 3 returns the total amount of free hunk memory, shiftet to the right by 4 bits.
Mode 4 was apparently introduced in SCI01 and reports the amount of free memory provided by DOS in paragraphs.
(String) game_id: The game ID as a string |
(String) strspace: The string which the result should be stored in |
(HeapPtr *) ptrs: The array of pointers which the string pointers are to be stored in |
Returns: (word) The number of savegames for the specified game_id.
Returns an array of strings describing the existing save games for game_id. The strings are put into strspace one by one, and heap pointers to each of them are put into the ptrs array. The number of saved games is returned in the accumulator.
(HeapPtr) address: The address to write to |
Returns: (HeapPtr) The supplied address
This function retreives the current working directory (CWD) and stores its string representation at the location pointed to by the supplied parameter.
![]() | FreeSCI returns a sub-directory of the user's home directory, if applicable, instead of the cwd. |
(String) path: The path to examine |
Returns: (word) 1 if saving is possible, 0 otherwise
Returns TRUE if there would be enough space left on the specified path to save the current game (but doesn't actually save).
(String) src: The string to read from |
(word) offset: The offset inside the string |
(char) replacement: An optional replacement value for the indexed character |
Returns: (char) The character requested
This function retreives a single character from a string. Optionally, if replacement is set, the source character will be replaced with the specified replacement.
(word) sub_function: A numeric value from 0 to 3, inclusive. See below. |
(String) string1: See below. |
(String) string2: See below. |
Returns: See below
Depending on the value of sub_function, this system call executes one of four defined actions:
0: GET_DEVICE |
1: GET_CURRENT_DEVICE |
2: PATHS_EQUAL |
3: IS_FLOPPY |
(word) GET_DEVICE: Constant sub-function identifier (0) |
(String) input: A path whose device identifier should be extracted |
(String) output: The destination of the device identifier |
Returns: (HeapPtr) Points to the terminating zero character of output
GET_DEVICE returns the drive/device on which "input" resides in output (and a pointer to the terminating NULL in the accumulator).
(word) GET_CURRENT_DEVICE: Constant sub-function identifier (1) |
(String) output: The destination which the CWD device identifier should be written to. |
Returns: (HeapPtr) Points to the terminating null character of output
GET_CURRENT_DEVICE returns the drive/device that contains the current working directory (and a pointer to the terminating NULL in the accumulator)
(word) PATHS_EQUAL: Constant sub-function identifier (2) |
(String) path1: First path to compare |
(String) path2: Second path to compare |
Returns: (word) 1 if path1 and path2 point to the same physical location, 0 otherwise.
PATHS_EQUAL returns TRUE if the two supplied paths point to the same place.
(word) IS_FLOPPY: Constant sub-function identifier (3) |
(String) path: |
Returns: (word) 1 if path is on a floppy disk, 0 otherwise
PATHS_EQUAL returns TRUE if the two supplied paths point to the same place.
Returns: (String)
This function returns the heap position allocated to store the string representation of the save game directory. This heap space is allocated automatically during startup.
(String) game_id: The savegame ID string |
(word) game_nr: The savegame number |
(String) version: An optional game version string |
Returns: (word) 1 if the savegame is loadable, 0 otherwise
Returns TRUE if the specified save game is valid and loadable (i.e., not for another game/interpreter/version).
(word) subfunction: Always 0x0c |
(word) param: Parameter for the subfunction, purpose unknown. |
Returns: (void)