[N-World Contents] [Book Contents] [Prev] [Next] [Index]

Functions


This section describes the Lisp functions you'll need to extend and customize Saturn Express to satisfy your specific requirements.


Setting up for Development Work

If you're going to doing any development work (e.g., to extend the functionality of the Saturn Express), you'll need to make sure you start N·World properly.

Starting in Debug Mode

Starting in debug mode gives you access to the interactive LISP listener.

To start N·World in debug mode, use the following commands at a prompt in a UNIX shell window:

unix>nworld-3-0 -debug t

where "3-0" is the release version of the current N·World product.

Style Conventions

In the following examples, a pound sign followed by an "x" preceding a value indicates that the value is in hexadecimal format. For example:

#x10

is equivalent to decimal 16.

Keyword Arguments

Keyword or "optional" arguments are specified in pairs, using the following syntax:

:name value

Such arguments are specified after all required arguments.


Sega Function Definitions

OPEN-SEGA-CONNECTION

Establishes a SCSI connection to the Sega Cartdev.

Required Arguments:

None.

Returns:

-1 if the connection could not be made.

or

A positive number that corresponds to the SCSI address of the CartDev.

Sample Syntax:

(sega:open-sega-connection)

CLOSE-SEGA-CONNECTION

Closes the SCSI connection to the Sega CartDev (if open).

Required Arguments:

None.

Returns:

0

Sample Syntax:

(sega:close-sega-connection)

CONTROL-GAME

Sends a game control command to the cartdev. (These commands are described in the Sega SGL manual.)

For example, 0x00 0x16 performs a system reset.

Arguments:

Table 4.1 Required arguments
Argument Type Description
category

value

Possible values are described in the MARS/SATURN CartDev SCSI Interface Specification on pp. 3-9.

command

value

Returns:

0

Sample Syntax:

(sega:control-game #x00 #x16)

GET-REGISTER

Get the status of the registers on the Sega Saturn.

Required Arguments:

None

Returns:

0

Sample Syntax:

(sega:get-register)

SET-REGISTER

Sets the value of a register on the Sega Saturn.

Required Arguments:

Table 4.2 Required arguments
Argument Type
register-name

value

Returns:

0

Sample Syntax:

(sega:set-register "PC" #x06004000)

Note. The value following set-register must be enclosed in quotation marks.

DUMP-MEMORY

Dump the memory on the Sega.

Optional arguments:

Table 4.3 Optional arguments
Argument Type Default
command

value ("db", "dw", or "dl")

"db" = dump byte

"dw" = dump word

"dl" = dump long

"db"

address

number

0

count

number

#x20

Returns:

0

Sample Syntax:

(sega:dump-memory :address #x06004000 :command "db")

Note. The value following :command must be enclosed in quotation marks.

FILL-MEMORY

Fill an area in Sega Saturn memory with a single value (e.g., to clear a memory area).

Required Arguments:

Table 4.4 Required arguments
Argument Type
address

number

data

number

Optional Arguments:

Table 4.5 Optional arguments
Argument Type Default
command

value ("fb", "fw", or "fl")

"fb" = fill byte

"fw" = fill word

"fl" = fill long

"fb"

data

number

1

Returns:

0

Sample Syntax:

(sega:fill-memory #x06004000 0 :count 20 :command "fb")

Note. The value following :command must be enclosed in quotation marks.

FILL-MEMORY-BLOCK

Fill a memory block on the Sega Saturn from an array in c-memory (e.g., with an XTIM array).

Required Arguments:

Table 4.6 Required arguments
Argument Type
address

number

data

c array

count

number

Returns:

0

Sample Syntax:

(sega:fill-memory-block #x06004000 xtim-array 100)

GO-SEGA

Start the Sega Saturn running at the address pointed to by the register "PC".

Required Arguments:

None

Returns :

0

Sample Syntax:

(sega:go-sega)

STOP-SEGA

Stop the Sega Saturn from running the current program.

Required Arguments:

None

Returns:

0

Sample Syntax:

(sega:stop-sega)

DISASSEMBLE-SEGA

Disassemble an area in Sega Saturn memory.

Optional arguments:

Table 4.7 Optional arguments
Argument Type
address

number

count

number

Returns:

0

Sample Syntax:

(sega:disassemble-sega :address #x06004000)

LOAD-MONITOR

Load the Sega Saturn's command monitor into the Sega Saturn.

Optional arguments:

Table 4.8 Optional arguments
Argument Type Default
pathname

pathname

"/usr/local/ngc/plugin/sega/satmon.bin"

Returns:

0

Sample Syntax:

(sega:load-monitor)

LOAD-BINARY

Load a binary file into the Sega Saturn.

Required Arguments:

Table 4.9 Required arguments
Argument Type
pathname

pathname

address

number

Returns:

0

Sample Syntax:

(sega:load-binary "/usr/local/ngc/plugin/sega/satmon.bin" #x06000000)

LOAD-COFF

Loads a COFF file into the Sega Saturn.

Required Arguments:

Table 4.10 Required arguments
Argument Type Description
pathname

pathname

executep

boolean

This sets the "pc" register to the start position of the COFF file (either t or nil).

Returns:

0

Sample Syntax:

(sega:load-coff "/usr/local/ngc/plugin/sega/nichimen.cof" nil)

NMI

Send a non-maskable interrupt to the Sega Saturn.

Required Arguments:

Table 4.11 Required arguments
Argument Type Description
count

number

The number of interrupts being sent.

Returns:

0

Sample Syntax:

(sega:nmi 5)

MAKE-SEGA-COLOR

Create a 16-bit color for the Sega Saturn.

A Sega color is a 16-bit representation of an RGB color, using 5 bits for each component, in the order of B-G-R, with the most significant bit set.

For example:

1 00000 00000 11111

would be a pure red.

Required Arguments:

Table 4.12 Required arguments
Argument Type
color

color

Returns:

A 16-bit representation of the color.

Sample Syntax:

(sega:make-sega-color (gi::make-rgb-color 1 0 0))

MAKE-SEGA-FLOAT

Create a floating point decimal number in the representation that the Sega Saturn expects.

Sega floats are described in the Sega Saturn Programmer's Tutorial, on p. 1-8.

Required Arguments:

Table 4.13 Required arguments
Argument Type
number

number

Returns:

A Sega float.

Sample Syntax:

(sega:make-sega-float 16.5)

MAKE-SEGA-ANGLE

Create an angle in the representation that the Sega Saturn expects.

Sega angles are described in the Sega Saturn Programmer's Tutorial, on p. 1-8.

Required Arguments:

Table 4.14 Required arguments
Argument Type
angle

number

Returns:

A Sega angle.

Sample Syntax:

(sega:make-sega-angle 45)

WRITE-GEO-OBJECT-TO-SEGA-FILE

Write a terminal geometry object to file in the SGL format.

Required Arguments:

Table 4.15 Required arguments
Argument Type
object

A terminal geometry object

Optional Arguments:

Table 4.16 Optional arguments
Argument Type Default
pathname

pathname

"/tmp/sega/"

Returns:

None

Sample Syntax:

(sega:write-geo-object-to-sega-file object)

START-SEGA

Reset or establish the connection to the Sega CartDev.

Required Arguments:

None

Returns:

None

Sample Syntax:

(sega:start-sega)

SEGAFY

Convert and send a geometry object to the sega.

Optional Arguments:

Table 4.17 Optional arguments
Argument Type
object

A terminal geometry object

Returns:

nil

Sample Syntax:

(sega:segafy)

Saturn Express Variables

*scsi-id*

This is the current SCSI ID# for the Sega CartDev.



[N-World Contents] [Book Contents] [Prev] [Next] [Index]

Another fine product from Nichimen documentation!

Copyright © 1996, Nichimen Graphics Corporation. All rights reserved.