Thank you for trying LFLIB!

LFLIB is a 13h library with lots of routines written in 386 assembly language.

Programming:
	Frej Kling

Contacts:
	frej@multi.fi
	http://www.multi.fi/~frej/

Current routines:
SolidPut, TransPut, TLPut, PZPut, RPut, PZYPut
ClippedGet, SolidGet, BufToVGA, TransMemCopy
MemCopy, BufCls, MouseReset, MouseXYB, MouseBounds
MouseShow, MouseHide, SetPalette, GetPalette, BMPSave
BMPLoad, BufPoint, BufPset, BufLine, BufEllipse
FilledBox, SetClipBox, AntiAl, Set13h, Set3h
PrintChar, DelayMilliSecond, WaitR, PeekB, PokeB




	-1 always works as a non transparent color, and in PrintChar it
	   works as a transparent color.

Lets start with the put/get routines
------------------------------
	SolidPut x1%, y1%, fromseg%, fromofs%, toseg%, toofs%
Example
	SolidPut 0, 0, VARSEG(Sprite(0)), VARPTR(Sprite(0)), &HA000, 0
Note
	&HA000 is where the vga memory starts.
	Don't let x1% and y1% fall out of range!
	This a fast put!
------------------------------
	TransPut x1%, y1%, fromseg%, fromofs%, toseg%, toofs%, tcolor%
Example
	'Same as SolidPut but it supports transparency and clipping, and it's slower.
Note
	Supports transparency and clipping.
------------------------------
        TLPut x1%, y1%, fromseg%, fromofs%, toseg%, toofs%, tcolor%
Example
	'Same as SolidPut but it supports transparency, clipping and tranlucency, and it's slower.
Note
	Make sure you have a gradient palette.
	Supports transparency and clipping.
------------------------------
	PZPut x1%, y1%, newx%, newy%, VARSEG(Sprite(0)), VARPTR(Sprite(0)), &HA000, 0
Example
	'Lets say your old sprite (Sprite(0))) is 50x50 and you want to zoom it to 100x100.
	PZPut 0, 0, 100, 100, fromseg%, fromofs%, toseg%, toofs%, tcolor%
Note
	Supports transparency and clipping.
------------------------------
	PZYPut x1%, y1%, newx%, newy%, VARSEG(Sprite(0)), VARPTR(Sprite(0)), &HA000, 0
Example
	None.
Note
	This sub was just made to test something,
	look in pzyput.bas for a demonstration.
------------------------------
	RPut angle%, x1%, y1%, fromseg%, fromofs%, toseg%, toofs%, tcolor%
Example
	'This would make an upside-down image of the sprite.
	RPut 180, 0, 0, VARSEG(Sprite(0)), VARPTR(Sprite(0)), &HA000, 0
Note
	Supports transparency and clipping.
------------------------------
	SolidGet x1%, y1%, x2%, y2%, fromseg%, fromofs%, toseg%, toofs%
Example
	SolidGet 0, 0, 49, 49, &HA000, 0, VARSEG(Sprite(0)), VARPTR(Sprite(0))
Note
	Don't let x1%, y1%, x2% and y2% fall out of range!
	This a fast get!
------------------------------
	ClippedGet x1%, y1%, x2%, y2%, fromseg%, fromofs%, toseg%, toofs%
Example
	'Same as SolidGet but it supports clipping, and it is slower.
Note
	Supports clipping.


******************************
The mem copy routines
------------------------------
	BufToVGA fromseg%, fromofs%
Example
	'This would copy screenbuffer (ScreenBuffer(0)) to VGA memory.
	BufToVGA VARSEG(ScreenBuffer(0)), VARPTR(ScreenBuffer(0))
Note
	None.	
------------------------------
	MemCopy fromseg%, fromofs%, toseg%, toofs%
Example
	'This would copy buffer (Buffer(0)) to screenbuffer (ScreenBuffer(0)).
	MemCopy VARSEG(Buffer(0)), VARPTR(Buffer(0)), VARSEG(ScreenBuffer(0)), VARPTR(ScreenBuffer(0))
Note
	None.
------------------------------
	TransMemCopy fromseg%, fromofs%, toseg%, toofs%, tcolor%
Example
	'This would copy buffer (Buffer(0)) to VGA memory and ignore color 0.
	TransMemCopy VARSEG(Buffer(0)), VARPTR(Buffer(0)), &HA000, 0, 0
Note
	Could be used to make parallax scrolling.
	Supports transparency.
------------------------------
	BufCls col%, toseg%, toofs%
Example
	'This would clear the VGA memory to color 0.
	BufCls 0, &HA000, 0
Note
	None.


******************************
The mouse routines

------------------------------
	MouseReset
Example
	'Returns -1 in reset% if a mouse was found.
	reset% = MouseReset
Note
	None.
------------------------------
	MouseXYB x1%, y1%, b%
Example
	'Returns mouse x, y and button status.
	MouseXYB x1%, y1%, b%
Note
	None.
------------------------------
	MouseBounds x1%, y1%, x2%, y2%
Example
	'Sets the mouse boundaries to 0, 0 and 319, 199.
	MouseBounds 0, 0, 319, 199
Note
	None.
------------------------------
	MouseShow
Example
	'Shows the mouse pointer.
	MouseShow
Note
	None.
------------------------------
	MouseHide
Example
	'Hides the mouse pointer.
	MouseHide
Note
	None.


******************************
The palette routines
------------------------------
	SetPalette r%, g%, b%, col%
Example
	'Sets color (col%) to red (r%), green (g%) and blue (b%).
	SetPalette r%, g%, b%, col%
Note
	None.
------------------------------
	GetPalette r%, g%, b%, col%
Example
	'Gets the red (r%), green (g%) and blue (b%) vaules from color (col%).
	GetPalette r%, g%, b%, col%
Note
	None.


******************************
The image routines
------------------------------
	BMPSave fromseg%, fromofs%, nameseg%, nameofs%
Example
	'Saves a 320x200 BMP image from fromseg% and fromofs%.
	filename$ = "image.bmp" + CHR$(0) 'CHR$(0) to indicate end of filename.
	BMPSave &HA000, 0, VARSEG(filename$), SADD(filename$)
Note
	None.
------------------------------
	BMPLoad toseg%, toofs%, nameseg%, nameofs%
Example
	'Almost same as BMPSave.
Note
	None.


******************************
The drawing routines
------------------------------
	BufPoint% x1%, y1%, fromseg%, fromofs%
Example
	'Gets a pixel color from x1%, y1%
	col% = BufPoint 0, 0, &HA000, 0
Note
	Supports clipping.
------------------------------
	BufPset x1%, y1%, col%, toseg%, toofs%
Example
	'Puts a pixel to x1%, y% with color c%
	BufPset 0, 0, 15, &HA000, 0
Note
	Supports clipping.
------------------------------
	BufLine x1%, y1%, x2%, y2%, col%, toseg%, toofs%
Example
	'Draws a line from x1%, y1% to x2%, y2% with color c%.
	BufLine 0, 0, 319, 199, 15, &HA000, 0
Note
	Supports clipping.
------------------------------
	BufEllipse x1%, y1%, xr%, yr%, col%, toseg%, toofs%
Example
	'Draws a ellipse at x1%, y1% with x radius (xr%), y radius (yr%) and col%.
	BufEllipse x1%, y1%, xr%, yr%, col%, toseg%, toofs%
Note
	Supports clipping.
------------------------------
	FilledBox x1%, y1%, x2%, y2%, col%, toseg%, toofs%
Example
	'Draws a filled box from 0, 0 to 100, 100.
	FilledBox 0, 0, 100, 100, 15, &HA000, 0
Note
	Supports clipping.
	Can be used to draw straight lines


******************************
Misc routines
------------------------------
	SetClipBox ClipX1%, ClipY1%, ClipX2%, ClipY2%
Example
	'Sets the clipping box to 0, 0 and 319, 199.
	SetClipBox 0, 0, 319, 199
Note
	None.
------------------------------
	AntiAl fromseg%, fromofs%, toseg%, toofs%
Example
	'This anti aliases buffer (Buffer(0)) and places it in buffer (Buffer(0)). (hope i spelled that right)
	AntiAl VARSEG(Buffer(0)), VARPTR(Buffer(0)), VARSEG(Buffer(0)), VARPTR(Buffer(0))
Note
	None.
------------------------------
	Set13h
Example
	'Set the screen mode to 13h (VGA mode).
	Set13h
Note
	None.
------------------------------
	Set3h
Example
	'Set the screen mode to 3h (TEXT mode).
	Set3h
Note
	None.
------------------------------
	PrintChar x1%, y1%, fcol%, bcol%, char%, fontseg%, fontofs%, toseg%, toofs%
Example
	OPEN "fonts.inc" FOR BINARY AS #1 'This loads the font included
	c$ = " "			  'with LFLIB.
	DIM SHARED font(2100) AS INTEGER
	DEF SEG = VARSEG(font(0))
	FOR x = 0 TO LOF(1)
		GET #1, , c$
		POKE x, ASC(c$)
	NEXT
	CLOSE #1
	'fcol% is then font color, bcol% if the background color, char% if
	'the ascii value of the char to print.
	fcol% = 15
	bcol% = 0
	char% = ASC("A")
	PrintChar 0, 0, fcol%, bcol%, char%, VARSEG(font(0)), VARPTR(font(0)), &HA000, 0
Note
	Supports transparency and clipping.
------------------------------
	DelayMilliSecond delay%
Example
	'This delays you program n% milli second.
	DealyMilliSecond n%
Note
	None.
------------------------------
	WaitR
Example
	'This waits on a vertical retrace.
	WaitR
Note
	None.
------------------------------
	PokeB
Example
	'This would Poke 1 into A000:0000.
	PokeB 1, &HA000, 0
Note
	Works as qb's POKE.
------------------------------
	PokeB
Example
	'This would Peek from A000:0000.
	c% = PeekB (&HA000, 0)
Note
	Works as qb's PEEK.
------------------------------



The font format

Offset            |Description
^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^^^
0                 |Y size of the font
1                 |Font data starts here
Ysize * 256 + 1   |Last char 

The font format is really simple, each line of a char is 
represented by a byte.
Lets say "A" would look like this:

Binary     Decimal
00111100   60       <- This is a "line"
01100110   102
11000011   195
11000011   195
11111111   255
11000011   195
11000011   195
11000011   195

Got it? :)