- AllocCardMem:
-
Synopsis: | AllocCardMem(bi, size, force, system); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | ULONG size |
d1.w: | BOOL force |
d2.w: | BOOL system |
This function allocates a chunk of graphics board memory from the
available free board memory and returns a pointer to that chunk.
If the flags force and system are set, the function may internally
free other chunks to be able to get that much memory. But therefore
a mechanism is needed that is available in the rtg.library only.
Therefore you should leave this function alone.
- FreeCardMem:
-
Synopsis: | FreeCardMem(bi, membase); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | APTR membase |
This function frees a chunk of graphics board memory. The size of the
memory must be accounted for internally. Normally, you will leave this
function as it is, too.
- SetSwitch:
-
Synopsis: | SetSwitch(bi, state); |
Inputs: | a0: | struct BoardInfo *bi |
d0.w: | BOOL state |
This function should set a board switch to let the Amiga signal pass
through when supplied with a 0 in d0 and to show the board signal if
a 1 is passed in d0. You should remember the current state of the
switch to avoid unneeded switching. If your board has no switch, then
simply supply a function that does nothing except a RTS.
- SetColorArray:
-
Synopsis: | SetColorArray(bi, startindex, count); |
Inputs: | a0: | struct BoardInfo *bi |
d0.w: | UWORD startindex |
d1.w: | UWORD count |
When this function is called, your driver has to fetch "count" color
values starting at "startindex" from the CLUT field of the BoardInfo
structure and write them to the hardware. The color values are always
between 0 and 255 for each component regardless of the number of bits
per cannon your board has. So you might have to shift the colors
before writing them to the hardware.
- SetDAC:
-
Synopsis: | SetDAC(bi, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d7: | RGBFTYPE RGBFormat |
This function is called whenever the RGB format of the display changes,
e.g. from chunky to TrueColor. Usually, all you have to do is to set
the RAMDAC of your board accordingly.
- SetGC:
-
Synopsis: | SetGC(bi, mi, border); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct ModeInfo *mi |
d0: | BOOL border |
This function is called whenever another ModeInfo has to be set. This
function simply sets up the CRTC and TS registers to generate the
timing used for that screen mode. You should not set the DAC, clocks
or linear start adress. They will be set by other functions when
appropriate.
- SetPanning:
-
Synopsis: | SetPanning(bi, Memory, Width, XOffset, YOffset, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | UBYTE *Memory |
d0: | UWORD Width |
d1: | WORD XOffset |
d2: | WORD YOffset |
d7: | RGBFTYPE RGBFormat |
This function sets the view origin of a display which might also be
overscanned. In register a1 you get the start address of the screen
bitmap as an Amiga memory address. You will have to subtract the
base address of the board memory from that value to get the
memory start offset within the board. Then you get the offset in
pixels of the left upper edge of the visible part of an overscanned
display. From these values you will have to calculate the
LinearStartingAddress fields of the CRTC registers and set the
correct values for pixel panning if supported by your VGA chip.
- CalculateBytesPerRow:
-
Synopsis: | CalculateBytesPerRow(bi, Width, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | UWORD Width |
d7: | RGBFTYPE RGBFormat |
Result: | d0: | UWORD Count |
This function calculates the amount of bytes needed for a line of
"Width" pixels in the given RGBFormat. The S3 Trio64 for example
only supports blitter operations only for some fixed line lengths
and therefore the supplied width value has to be rounded up.
- CalculateMemory:
-
Synopsis: | CalculateMemory(bi, Memory, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | UBYTE *Memory |
d7: | RGBFTYPE RGBFormat |
Result: | d0: | UBYTE *Address |
This function transforms logical into physical memory addresses. This
is normally the same value except for planar bitmaps that use physical
offset addresses that are only a forth of the logical offset because
the VGA chips store these bitmaps in a different way.
Chip architectures that offer byte-swapping capabilities could use
this function to translate the logical address to the desired aperture
window.
- GetCompatibleFormats:
-
Synopsis: | GetCompatibleFormats(bi, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d7: | RGBFTYPE RGBFormat |
Result: | d0: | ULONG mask of formats |
This function gets a long work representing all RGBFormats that can
coexist simultaneously on the board with a bitmap of the supplied
RGBFormat. This is used when a bitmap is put to the board in order
to check all bitmaps currently on board if they have to leave. This
is for example the case with Cirrus based boards where all chunky
and Hi/TrueColor bitmaps must leave whenever a planar bitmap needs
to be put to the board, because the formats cannot share the board
due to restrictions by that VGA chips.
- SetDisplay:
-
Synopsis: | SetDisplay(bi, state); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | BOOL state |
This function enables and disables the video display. On VGA chips
this is usually done by changing bit 5 of the TS_TSMode register.
The display will become black but the display syncs are still
generated.
- ResolvePixelClock:
-
Synopsis: | ResolvePixelClock(bi, mi, clock, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct ModeInfo *mi |
d0: | LONG pixelclock |
d7: | RGBFTYPE RGBFormat |
Result: | d0: | ULONG index |
This function returns the index number of the pixel clock rate that
suits best to the clock rate and RGBFormat supplied according to the
clock rates available and writes the corresponding clock parameters
to the ModeInfo structure.
- GetPixelClock:
-
Synopsis: | GetPixelClock(bi, mi, index, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct ModeInfo *mi |
d0: | ULONG index |
d7: | RGBFTYPE RGBFormat |
Result: | d0: | ULONG pixelclock |
This function retrieves the effective pixel clock at position "index"
of the pixel clock array. On some chips you have to take the given
RGBFormat into account, e.g. with the CirrusGD542X you have to divide
the raw pixel clock by three to get the effective pixel clock when
using TrueColor modes.
- SetClock:
-
Synopsis: | SetClock(bi); |
Inputs: | a0: | struct BoardInfo *bi |
This function writes the clock parameters of the ModeInfo that is
currently active (bi->ModeInfo) to the hardware.
- SetMemoryMode:
-
Synopsis: | SetMemoryMode(bi, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d7: | RGBFTYPE RGBFormat |
This function sets the memory interface of the chip to use an
appropriate setting for the given RGBFormat. For example when using
RGBFB_PLANAR, you will have to disable "chain 4 mode". It will
be called each time system functions access the onboard memory using
the specified RGBFormat.
If you have to configure the board to allow another access mode,
e.g. byte-swapping, this would be the right place.
This function must preserve all registers!
- SetWriteMask:
-
Synopsis: | SetWriteMask(bi, mask); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | UBYTE mask |
This function sets the TS_WritePlaneMask register which is used for
planar modes.
This function must preserve all registers!
- SetClearMask:
-
Synopsis: | SetClearMask(bi, mask); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | UBYTE mask |
This function sets the GDC_EnableSetReset register to the "mask" value
and clears the GDC_SetReset register. This is used for planar modes.
- SetReadPlane:
-
Synopsis: | SetReadPlane(bi, plane); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | UBYTE plane |
This function sets the GDC_ReadPlaneSelect register to the "plane"
value. This is used for planar modes.
- WaitVerticalSync:
-
Synopsis: | WaitVerticalSync(bi); |
Inputs: | a0: | struct BoardInfo *bi |
This function waits for the next vertical retrace.
- SetInterrupt:
-
Synopsis: | SetInterrupt(bi, state); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | state |
This function disables or enables the optional board interrupts.
Interrupts are disabled automatically during screen switches to
avoid problems.
- WaitBlitter:
-
Synopsis: | WaitBlitter(bi); |
Inputs: | a0: | struct BoardInfo *bi |
This function waits for the completion of any pending blitter operations.
- SetSprite:
-
Synopsis: | SetSprite(bi, activate, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | BOOL activate |
d7: | RGBFTYPE RGBFormat |
This function activates or deactivates the hardware sprite.
- SetSpritePosition:
-
Synopsis: | SetSpritePosition(bi, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d7: | RGBFTYPE RGBFormat |
This function sets the hardware mouse sprite position according to
the values in the BoardInfo structure.
MouseX and MouseY are the coordinates relative to the screen bitmap.
XOffset and YOffset must be subtracted to account for possible
screen panning.
- SetSpriteImage:
-
Synopsis: | SetSpriteImage(bi, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d7: | RGBFTYPE RGBFormat |
This function gets new sprite image data from the MouseImage field of
the BoardInfo structure and writes it to the board.
There are three possible cases:
- BIB_HIRESSPRITE is set:
skip the first two long words and the following sprite data is
arranged as an array of two longwords. Those form the two bit
planes for one image line respectively.
- BIB_HIRESSPRITE and BIB_BIGSPRITE are not set:
skip the first two words and the following sprite data is
arranged as an array of two words. Those form the two bit
planes for one image line respectively.
- BIB_HIRESSPRITE is not set and BIB_BIGSPRITE is set:
skip the first two words and the following sprite data is
arranged as an array of two words. Those form the two bit
planes for one image line respectively. You have to double
each pixel horizontally and vertically. All coordinates used
in this case already assume a zoomed sprite, only the sprite
data is not zoomed yet. You will have to compensate for this
when accounting for hotspot offsets and sprite dimensions.
- SetSpriteColor:
-
Synopsis: | SetSpriteColor(bi, index, red, green, blue, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
d0.b: | index |
d1.b: | red |
d2.b: | green |
d3.b: | blue |
d7: | RGBFTYPE RGBFormat |
This function changes one of the possible three colors of the
hardware sprite.
- BlitPlanar2Chunky:
-
Synopsis: | BlitPlanar2Chunky(bi, bm, ri, SrcX, SrcY, DstX, DstY, SizeX, SizeY, MinTerm, Mask); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct BitMap *bm |
a2: | struct RenderInfo *ri |
d0.w: | SrcX |
d1.w: | SrcY |
d2.w: | DstX |
d3.w: | DstY |
d4.w: | SizeX |
d5.w: | SizeY |
d6.b: | MinTerm |
d7.b: | Mask |
This function is currently used to blit from planar bitmaps within
system memory to chunky bitmaps on the board. Watch out for plane
pointers that are 0x00000000 (represents a plane with all bits "0")
or 0xffffffff (represents a plane with all bits "1").
- FillRect:
-
Synopsis: | FillRect(bi, ri, X, Y, Width, Height, Pen, Mask, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct RenderInfo *ri |
d0.w: | X |
d1.w: | Y |
d2.w: | Width |
d3.w: | Height |
d4.l: | Pen |
d5.b: | Mask |
d7.l: | RGBFormat |
This function fills a rectangular area on the board with a given pen
or Hi/TrueColor value. It is called by BltBitMap, BltPattern, SetRast
and to clear or init a bitmap on the board.
- InvertRect:
-
Synopsis: | InvertRect(bi, ri, X, Y, Width, Height, Mask, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct RenderInfo *ri |
d0.w: | X |
d1.w: | Y |
d2.w: | Width |
d3.w: | Height |
d4.l: | Mask |
d7.l: | RGBFormat |
This function is used to invert a rectangular area on the board. It
is called by BltBitMap, BltPattern and BltTemplate.
- BlitRect:
-
Synopsis: | BlitRect(bi, ri, SrcX, SrcY, DstX, DstY, SizeX, SizeY, Mask, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct RenderInfo *ri |
d0.w: | SrcX |
d1.w: | SrcY |
d2.w: | DstX |
d3.w: | DstY |
d4.w: | SizeX |
d5.w: | SizeY |
d6.b: | Mask |
d7.l: | RGBFormat |
This function is used to copy a rectangle within one pixel area on the
board. It is called by BltBitMap.
- BlitTemplate:
-
Synopsis: | BlitTemplate(bi, ri, template, X, Y, Width, Height, Mask, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct RenderInfo *ri |
a2: | struct Template *template |
d0.w: | X |
d1.w: | Y |
d2.w: | Width |
d3.w: | Height |
d4.w: | Mask |
d7.l: | RGBFormat |
This function is used to paint a template on the board memory using
the blitter. It is called by BltPattern and BltTemplate. The template
consists of a b/w image using a single plane of image data which will
be expanded to the destination RGBFormat using ForeGround and BackGround
pens as well as draw modes.
- BlitPattern:
-
Synopsis: | BlitPattern(bi, ri, pattern, X, Y, Width, Height, Mask, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct RenderInfo *ri |
a2: | struct Pattern *pattern |
d0.w: | X |
d1.w: | Y |
d2.w: | Width |
d3.w: | Height |
d4.w: | Mask |
d7.l: | RGBFormat |
This function is used to paint a pattern on the board memory using
the blitter. It is called by BltPattern, if a AreaPtrn is used with
positive AreaPtSz. The pattern consists of a b/w image using a single
plane of image data which will be expanded repeatedly to the destination
RGBFormat using ForeGround and BackGround pens as well as draw modes.
The width of the pattern data is always 16 pixels (one word) and the
height is calculated as 2^Size. The data must be shifted up and to the
left by XOffset and YOffset pixels at the beginning.
- DrawLine:
-
This function is currently not used.
- BlitRectNoMaskComplete:
-
Synopsis: | BlitRectNoMaskComplete(bi, sri, dri, SrcX, SrcY, DstX, DstY, SizeX, SizeY, OpCode, RGBFormat); |
Inputs: | a0: | struct BoardInfo *bi |
a1: | struct RenderInfo *sri |
a2: | struct RenderInfo *dri |
d0.w: | SrcX |
d1.w: | SrcY |
d2.w: | DstX |
d3.w: | DstY |
d4.w: | SizeX |
d5.w: | SizeY |
d6.b: | OpCode |
d7.l: | RGBFormat |
This function is used to blit a rectangle from one area of pixels
to another area using all possible opcodes but without mask.
- ResetChip:
-
Synopsis: | ResetChip(bi); |
Inputs: | a0: | struct BoardInfo *bi |
This function is currently not used. Its purpose will be to provide
a mechanism to initialize the card after a Picasso96API client has
used the board with direct accesses to the hardware.
- SetDPMSLevel:
-
Synopsis: | SetDPMSLevel(bi, DPMSLevel); |
Inputs: | a0: | struct BoardInfo *bi |
d0: | ULONG DPMSLevel |
This function sets the DPMS level supplied. Valid values are (see boardinfo.h):
- DPMS_ON (normal operation),
- DPMS_STANDBY (Optional state of minimal power reduction),
- DPMS_SUSPEND (Significant reduction of power consumption),
- DPMS_OFF (Monitor off, lowest level of power consumption)
- GetFeatureAttrs:
- CreateFeature:
- SetFeatureAttrs:
- DeleteFeature:
-
These functions handle the use of special features like flicker
fixer, video and other modules. If you need these, please call for
assistance. :-))