LYNX-library functions:
Please add :
#include <lynxlib.h>
to your C-source.
BCDAdd
int BCDAdd(BCD *pBCDVal1, BCD *pBCDVal2);
Returns the sum of the addition of the BCD-value pointed to by pBCDVal1
and the BCD-value pointed to by pBCDVal2.
The BCD-values can be stored in normal integer-variables.
BCDAddConst
int BCDAddConst(BCD *pBCDVal1, BCD BCDVal2);
Returns the sum of the addition of the BCD-constant BCDVal2
and the BCD-value pointed to by pBCDVal1.
The BCD-values can be stored in normal integer-variables.
BCDSub
int BCDSub(BCD *pBCDVal1, BCD *pBCDVal2);
Returns the sum of the subtraction of the BCD-value pointed to by pBCDVal2
from the BCD-value pointed to by pBCDVal1.
The BCD-values can be stored in normal integer-variables.
BCDSubConst
int BCDSubConst(BCD *pBCDVal1, BCD BCDVal2);
Returns the sum of the subtraction of the BCD-constant BCDVal2
from the BCD-value pointed to by pBCDVal1.
The BCD-values can be stored in normal integer-variables.
BCDToASCII
void BCDToASCII(BCD *pBCDVal, char *pText);
Converts the BCD-value pointed to by pBCDVal into four ASCII-characters
at the location pointed to by pText.
It does not append a trailing zero!
DrawFBox
void DrawFBox(int x, int y, int width, int height, char col);
Draws a filled box with width width and height height at pixel position x,y.
The colour index col is used to fill the box.
DrawLine
void DrawLine(int x1, int y1, int x2, int y2, char col);
Draws a line from x1,y1 to x2,y2 in colour col.
GetPixel
char GetPixel(char x, char y);
Returns the colour index of the pixel at position x,y.
SetPixel
void SetPixel(int x, int y, char col);
Sets the pixel at the position x,y to the colour index col.
DrawSprite
void DrawSprite(char *pSCB);
Draws a sprite (defined through the SpriteControlBlock at pSCB) into the render buffer.
See Chapter 6.4: Sprite Data Structure for a description.
EE_Erase
void EE_Erase(char cell);
Erases the given EEPROM-cell.
EE_Read
int EE_Read(char cell);
Reads the contents of a given EEPROM-cell.
EE_Write
void EE_Write(char cell, int value);
Writes the integer value to a given EEPROM-cell.
Flip
void Flip();
Changes the orientation of the screen and of the joypad buttons.
SetBuffers
void SetBuffers(char * pScreen, char * pRender, char *pCollide);
Sets the address of the current screen to pScreen and (to allow double-buffering)
the address of the rendering-buffer to pRender.
If you don't want double-buffering you can set pRender to 0.
If you want to use collision-detection, you can set pCollide
to the address of the collision-buffer, else set it to 0.
All three addresses should point to arrays of 8160 bytes, aligned to a 4 byte border.
SwapBuffers
void SwapBuffers();
Swaps the addresses of the rendering and the current screen buffer.
SetRGB
void SetRGB(char * pPalette);
Sets the colour palette to the 16 RGB values pointed to by pPalette.
32 bytes are representing the new palette:
GREEN0, GREEN1, ... GREENE, GREENF, BLUERED0, BLUERED1, ... , BLUEREDE, BLUEREDF
See Hardware addresses FDA0-FDBF.
random
int random();
Returns a random number out of 0..32767.
InitIRQ
void InitIRQ();
Initializes an IRQ-handler. It is needed by the 3 following routines, so use it first.
InstallIRQ
void InstallIRQ(int num, int (* funptr)() );
Point interrupt num (0 .. 7) to funptr. This routine does not enable the interrupt.
DeInstallIRQ
void DeInstallIRQ(int num);
Set interrupt num back to a dummy-ISR, which simply returns. It does not disable
the specific Interrupt.
Example:
...
InitIRQ(); /* now we may use IRQs */
Install(0,HBL); /* HBL is called every horizontal line interrupt */
EnableIRQ(0); /* use a macro defined in lynxlib.h */
CLI; /* another macro */
...
InstallUploader
void InstallUploader (char divider);
This installs a ComLynx-uploader like the BLL-loader.The baudrate is set to 1MHz/16/(divider+1)
with the same format :8E1.
lynxlib.h contains #defines:
Note:Do not call prior to InitIRQ !
TextOut
void TextOut(int x, int y, char forecol, char backcol, char *pText);
Prints up to 20 characters from the address pointed to by pText at
the pixel-position x,y with the foreground colour index forecol and
the background colour index backcol. If backcol = 0, the text is
printed in transparency-mode.
At the moment there is only one font with height of 11 pixels and
width of 8 pixels.
There is always a 11*8 pixel block of backcol-pixels appended to
the text.
TextOutExt
void TextOutExt(int x, int y, char forecol, char backcol, char *pText, int stretchx, int stretchy);
Prints up to 20 characters from the address pointed to by pText at
the pixel-position x,y with the foreground colour index forecol and
the background colour index backcol. If backcol = 0, the text is
printed in transparency-mode.
stretchx is used to stretch the horizontal text-dimension and
stretchy is used to stretch the vertical text-dimension.
At the moment there is only one font with height of 11 pixels and
width of 8 pixels.
There is always a 11*8 pixel block of backcol-pixels appended to
the text.
SmpInit
void SmpInit(char channel,char timer);
Initialize the sample-player.
channel is the desired audio-channel (0..3)
timer is the timer-number (0..7, 4 should not be used, 0 and 2 make no sense)
SmpStart
void SmpStart(char *sample);
sample is a pointer to a signed sample-header. To convert WAV samples use wav2lsf.
The sample - header is defined like this
struct {
char unpacked;
char lenhi;
char lenlo;
char divider;
char stereo;
char data[len];
}sample;
SmpStop
void SmpStop();
Stop the current sample.No need to call this function before SmpStart !
Tip: To halt the sample e.g. during pause:
void MyPause()
{
int sample;
if ( (sample = SmpActive()) ) // Note : "=" is correct here !!
DisableIRQ(my_smp_timer);
// do some other stuff.
// ...
// now leaving MyPause
if ( sample )
EnableIRQ(my_smp_timer);
}
SmpActive
int SmpActive();
Returns TRUE if a sample is playing.
HOME
(c) M. Domin and Bastian Schick
last modified 1998/01/28