ùúùúÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿ**k†*SOS ; for save our sources!


	include	include:negative_all.i

*******************************************
**  negative.library v0.41 (ASM-Source)  **
**        Code by:   juen/nah-kolor      **
*******************************************

;internal library for negative crew! not for spread!

;Struktura biblioteki w pamieci:

***************************
* Funkcje standardowe:	  *
***************************
*  -24	 * ExtFuncLib	  *
*  -18	 * ExpungeLibrary *
*  -12	 * CloseLibrary	  *
*  -6	 * OpenLibrary	  *
***************************
* Baza biblioteki	  *
***************************
*   0	 * Struct Library *
***************************
* Wlasne dane biblioteki  *
***************************
*   34	 * LIB_BASE	  *
*  ....  * ...		  *
***************************

;juenized:

; offset.revision, function(regs)(args)

; -30.000, loaddiskfont(d0,a0)(size,name+0) -> d0=fontbase, d1=error
; -36.000, searchforwhite(a0)(winbase) -> d0=color, -1=not found!
; -42.000, searchforblack(a0)(winbase) -> d0=color, -1=not found!
; -48.000, searchforgray(a0)(winbase) -> d0=color, -1=not found!
; -54.000, setmaincolours(d0/d1/d2)(white,black,gray)
; -60.000, border(a0,d0/d1/d2/d3/d4)(rp,x,y,xsize,ysize,type)
; -66.000, hl(a0,d0/d1/d2)(rp,x,y,xmax)
; -72.000, xenaddgadget(a0/a1,d0/d1/d2/d3/d4)(wb,buf(364b),x,y,xsize,ys,number)
; -78.000, vl(a0,d0/d1/d2)(rp,x,y,xmax)
; -84.000, centerwindow(a0/a1)(intbase,window) -> a6=intbase a0=window
; -90.000, searchforcolour(a0,d0)(winbase,colour.w) -> d0=number.b or -1
; -96.000, getgadgetptr(a0,d1)(first_gadget,number.w) -> a0=ptr or d0=-1
;-102.000, makegui(a0,a1)(gui,window)
;-108.000, bintoascii(d0,a0)(bin,ascii)
;-114.000, addstringgadget(a0/a1,d0/d1/d2/d3/d4/d5)(wb,buf(337b),x,y,xs,ys,gid,
;								maxchars)
;v0.3:
;-120.000, asciicreator(a0,d0/d1/d2/d3/d4/d5)(logos,output,nazwa,under,tag,bg,
;								cut)

* exec.library
_LVOFreeMem	equ	-210
_LVORemove	equ	-252
;-----------------------
;Struktura NODE=14 bajtow	;	\
LIB_FLAGS	equ	14	;B	 |
LIB_pad		equ	15	;B	 |
LIB_NEGSIZE	equ	16	;W	 |
LIB_POSSIZE	equ	18	;W	  \Struktura Library dla kazdej bibl
LIB_VERSION	equ	20	;W	  /krora ma rozmiar 34 bajty!
LIB_REVISION	equ	22	;W	 |
LIB_IDSTRING	equ	24	;L	 |
LIB_SUM		equ	28	;L	 |
LIB_OPENCNT	equ	32	;W	/

LIB_SIZE	equ	34	;L	To jest juz wlasne pole dla tej bibl!
;-----------------------
FLAG_SUMMING	equ	0		* we are currently checksumming
FLAG_CHANGED	equ	1		* we have just changed the lib
FLAG_SUMUSED	equ	2		* set if we should bother to sum
FLAG_DELEXP	equ	3		* delayed expunge
;------------------------------------------------
MyLibraryStart
	moveq	#-1,d0		;Ten kod jest potrzebny, gdyby ktos chcial
	rts			;uruchomic bibl. jak zwykly EXECUTABLE!
				;Nie spowoduje przez to zawieszenia AMIGI!

;------------------------------------------------ RESIDENT structure
.MyLib	dc.w	$4AFC				;$4AFC=ILLEGAL
	dc.l	.MyLib,MyLibraryEnd		;Poczatek, Koniec bibl.
	dc.b	%10000000			;FLAGS-= tu AUTO_INIT
	dc.b	0				;VERSION - tu 1.00
	dc.b	9				;TYPE - tu LIBRARY
	dc.b	0				;PRIorytet bibl = tu 0
	dc.l	.LibName,.LibID,.LibInit	;nazwa,identyfikacja,inicjacja
;----------
.LibName	dc.b	"negative.library",0
.LibID		dc.b	"negative.library v0.4 (06.05.2003) by Juen/Appendix",13,10,0
;-----------------------
.LibInit
	dc.l	LIB_SIZE+4	;Rozmiar bazy bibliteki - tu 34+4 (wlasne)
	dc.l	.Jumps		;Tablica skokow dla tej bibl
	dc.l	0		;NIE WYKORZYSTYWANE!
	dc.l	InitLibrary	;Adres procedury INICJUJACEJ!

;---------- Tablica skokow STANDARDOWYCH dla kazdej biblioteki
.Jumps	dc.l	OpenLibrary,CloseLibrary,ExpungeLibrary,ExtFuncLib

;---------- Tutaj zaczynaja sie skoki specyficzne dla danej biblioteki

	;juen

	dc.l	p_LVOLoadDiskFont	;-30
	dc.l	p_LVOSearchForWhite	;-36
	dc.l	p_LVOSearchForBlack	;-42
	dc.l	p_LVOSearchForGray	;-48
	dc.l	p_LVOSetMainColours	;-54
	dc.l	p_LVOBox		;-60
	dc.l	p_LVOHl			;-66
	dc.l	p_LVOXENAddGadget	;-72
	dc.l	p_LVOVl			;-78
	dc.l	p_LVOCenterWindow	;-84
	dc.l	p_LVOSearchForColour	;-90
	dc.l	p_LVOGetGadgetPTR	;-96
	dc.l	p_LVOMakeGUI		;-102
	dc.l	p_LVOBinToAscii		;-108
	dc.l	p_LVOAddStringGadget	;-114
	dc.l	p_LVOAsciiCreator	;-120

;---------- Koniec tablicy skokow
	dc.l	-1

	even


;------------------------------------------------ STANDARD functions
InitLibrary
	exg	a0,d0			;A0-Adres bazy naszej biblioteki D0-rozmiar
	move.l	d0,LIB_SIZE(a0)		;Zapamietanie rozmiaru bazy
	move.w	#41,LIB_REVISION(a0)	;Tutaj mozesz wpisac SETNE wersji bibl.
	exg	a0,d0
	rts
;-----------------------
OpenLibrary
	addq.w	#1,LIB_OPENCNT(a6)		;Zwiekszenie liczby uzytkownikow
	bclr	#FLAG_DELEXP,LIB_FLAGS(a6)	;Opoznienie usuwania biblioteki
						;nie potrzebne!
	move.l	a6,d0				;Zwrot adresu bazy biblioteki
	rts
;-----------------------
CloseLibrary
	subq.w	#1,32(a6)			;Zmniejszenie liczby uzytkownikow
	bne.b	ExtFuncLib			;Skok jesli sa jeszcze jacys!
	btst	#FLAG_DELEXP,LIB_FLAGS(a6)
	beq.b	ExtFuncLib
	rts
;-----------------------
ExpungeLibrary
	tst.w	LIB_OPENCNT(a6)		;Sprawdzenie, czy sa uzytkownicy bibl.
	bne.b	.NoRemove		;TAK! = Usuniecie bibl. NIEMOZLIWE!

	movem.l	d2/a5/a6,-(sp)
	move.l	LIB_SIZE(a6),d2		;Pobranie rozmiaru bazy bibl.
					;zapamietanego wczesniej przy INICJACJI!
	move.l	a6,a5			;Adres bazy bibl. A5
	move.l	4.w,a6
	move.l	a5,a1			;Adres bazy bibl. (Struct NODE)
	jsr	_LVORemove(a6)		;Usuniecie bibl z listy wszystkich
	move.l	a5,a1			;Adres bazy bibl do A1
	moveq	#0,d0
	move.w	LIB_NEGSIZE(a5),d0	;Rozmiar tablicy wektorow
	sub.w	d0,a1
	add.w	LIB_POSSIZE(a5),d0	;Rozmiar samej bazy naszej biblioteki
	jsr	_LVOFreeMem(a6)		;Zwolnienie pamieci zajmowanej przez
					;baze naszej bibl. i jej wektory!
	move.l	d2,d0
	movem.l	(sp)+,d2/a5/a6
	rts
.NoRemove
	bset	#FLAG_DELEXP,LIB_FLAGS(a6)
					;Ustawienie bitu odpowiedzialnego
					;za opoznienie w usuwaniu bibl. z pamieci
					;jesli np. sa jacys uzytkownicy!
;----------
;	moveq	#0,d0			;W tym przypadku ten kod nie jest
;	rts				;potrzebny gdyz jest dalej!
;-----------------------
ExtFuncLib				;Funkcja, ktora nie jest wykorzystywana
					;na czas terazniejszy. Pozostawiona
	moveq	#0,d0			;do uzycia w przyszlosci!
	rts



p_LVOLoadDiskFont:

	move.w	d0,font_size
	move.w	d0,font_size_the_second

	lea	font_name,a1
.x	move.b	(a0)+,(a1)+
	cmp.b	#0,(a0)
	bne.s	.x
	move.b	(a0)+,(a1)

	move.l	4.w,a6
	lea	diskname,a1
	jsr	-408(a6)	;Open diskfont.library
	tst	d0
	bne.s	.ok1
	moveq	#0,d0		;error
	moveq	#1,d1		;no diskfont.library
	rts

.ok1	move.l	d0,diskbase
	lea	font,a0	;textAttr
	move.l	DiskBase,a6
	jsr	-30(a6)
	moveq	#0,d1
	rts

FONT:	DC.L	FONT_NAME
font_size:
	DC.W	8
	DC.B	0,0
font_size_the_second:
	DC.W	8

FONT_NAME:
	blk.b	255

diskname	dc.b	'diskfont.library',0
diskbase	dc.l	0
	even



opengfx	move.l	4.w,a6
	lea	gfxname,a1
	jsr	-408(a6)
	move.l	d0,gfxbase
	rts

openint	move.l	4.w,a6
	lea	intname,a1
	jsr	-408(a6)	;Open intuition.library
	move.l	d0,intbase
	rts

p_LVOSearchForWhite:

	move.l	a0,a5

	jsr	opengfx
	jsr	openint
	move.l	intbase,a6
	move.l	a5,a0
	jsr	-300(a6)
	move.l	d0,WinVPort
	move.l	d0,a0
	move.l	4(a0),ColorMap
GetRGB4	move.l	GfxBase(pc),a6
	moveq	#0,d7
	lea	wb_pal,a5
.Loop	move.l	d7,d0
	move.l	ColorMap(pc),a0
	jsr	-582(a6)
	move.w	d0,(a5)+
	addq.b	#1,d7
	cmp.b	#0,d7
	bne.s	.loop

	move.l	#$0FFF,d2	; w sumie nie ma bola, bialy musi byc!
	bsr	check_colour	; ( a jak nie to inne kombinacje... )
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0eee,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0Fee,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0FFe,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0FeF,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0eFe,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0eeF,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

.ok	rts


check_colour
	move.l	#255-1,d0
	moveq	#0,d1
	lea	wb_pal,a0
.x	moveq	#0,d3
	move.w	(a0)+,d3
	cmp.w	d2,d3
	beq.s	.found
	addq.b	#1,d1
	dbf	d0,.x
	bra.s	.notfound
.found	move.l	d1,d0
	rts
.notfound
	moveq	#-1,d0
	rts

gfxname		dc.b	'graphics.library',0
intname		dc.b	'intuition.library',0
intbase		dc.l	0
gfxbase		dc.l	0
winvport	dc.l	0

ColorMap	dc.l	0
wb_pal		ds.b	255*2
		ds.b	255*2
	even


p_LVOSearchForBlack:

	move.l	a0,a5

	jsr	opengfx
	jsr	openint
	move.l	d0,a6
	move.l	a5,a0
	jsr	-300(a6)
	move.l	d0,WinVPort
	move.l	d0,a0
	move.l	4(a0),ColorMap
	move.l	GfxBase(pc),a6
	moveq	#0,d7
	lea	wb_pal,a5
.Loop	move.l	d7,d0
	move.l	ColorMap(pc),a0
	jsr	-582(a6)
	move.w	d0,(a5)+
	addq.b	#1,d7
	cmp.b	#0,d7
	bne.s	.loop

	move.l	#$0000,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0111,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0100,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0110,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0101,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0010,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.s	.ok

	move.l	#$0001,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0222,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0333,d2	;ostateczna ostatecznosc!
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

.ok	rts


p_LVOSearchForGray:

	move.l	a0,a5

	jsr	opengfx
	jsr	openint
	move.l	d0,a6
	move.l	a5,a0
	jsr	-300(a6)
	move.l	d0,WinVPort
	move.l	d0,a0
	move.l	4(a0),ColorMap
	move.l	GfxBase(pc),a6
	moveq	#0,d7
	lea	wb_pal,a5
.Loop	move.l	d7,d0
	move.l	ColorMap(pc),a0
	jsr	-582(a6)
	move.w	d0,(a5)+
	addq.b	#1,d7
	cmp.b	#0,d7
	bne.s	.loop

	move.l	#$0999,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0888,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0899,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0889,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0898,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0989,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0998,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0777,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0887,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0878,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0788,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0878,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0787,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0887,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0666,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0555,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0444,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0566,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0656,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0665,d2
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0000,d2	;ostateczna ostatecznosc ostatecznosci!!!!
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok

	move.l	#$0111,d2	;ostateczna ostatecznosc ostatecznosci!!!!
	bsr	check_colour
	cmp.l	#-1,d0
	bne.w	.ok


.ok	rts


p_LVOSetMainColours:

	move.b	d0,PenWhite
	move.b	d1,PenBlack
	move.b	d2,PenGray

	rts


p_LVOBox:

	movem.l d0-a6,-(sp)		;wartosci na stos

	jsr	openint

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu

	cmp.l	#0,d4
	bne.s	.n0
	move.l	#border_type1,a1
	move.w	d2,bt1x1
	move.w	d2,bt1x2
	move.w	d3,bt1y1
	move.w	d3,bt1y2
	subq.l	#1,d2
	subq.l	#1,d3
	move.w	d2,bt1x4
	move.w	d2,bt1x5
	move.w	d3,bt1y4
	move.w	d3,bt1y5
	subq.l	#1,d2
	subq.l	#1,d3
	move.w	d2,bt1x3
	move.w	d3,bt1y3
	move.b	PenBlack,bt1p1
	move.b	PenWhite,bt1p2
	move.b	PenGray,bt1p3
	bra.w	.ok
.n0	cmp.l	#1,d4
	bne.s	.n1
	move.l	#border_type2,a1
	move.w	d2,b2x1
	move.w	d2,b2x2
	move.w	d3,b2y1
	move.w	d3,b2y2
	move.w	d2,b2x3
	move.w	d3,b2y3
	move.b	PenWhite,bt2p1
	move.b	PenBlack,bt2p2
	bra.w	.ok
.n1	cmp.l	#2,d4
	bne.s	.n2
	move.l	#border_type3,a1
	move.w	d2,b3x1
	move.w	d2,b3x2
	move.w	d2,b3x3
	move.w	d3,b3y1
	move.w	d3,b3y2
	move.w	d3,b3y3
	subq.l	#1,d2
	subq.l	#1,d3
	move.w	d2,b3x4
	move.w	d2,b3x5
	move.w	d3,b3y4
	move.w	d3,b3y5
	move.b	PenWhite,bt3p1
	move.b	PenBlack,bt3p2
	move.b	PenBlack,bt3p3
	bra.w	.ok
.n2	cmp.l	#3,d4
	bne.s	.n3
	move.l	#border_type4white,a1
	move.w	d2,bt4wx1
	move.w	d2,bt4wx2
	move.w	d3,bt4wy1
	move.w	d3,bt4wy2
	move.b	PenWhite,bt4wp1
	bra.s	.ok
.n3	cmp.l	#4,d4
	bne.s	.n4
	move.l	#border_type4black,a1
	move.w	d2,bt4bx1
	move.w	d2,bt4bx2
	move.w	d3,bt4by1
	move.w	d3,bt4by2
	move.b	Penblack,bt4bp1
	bra.s	.ok
.n4	cmp.l	#5,d4
	bne.s	.n5
	move.l	#border_type4gray,a1
	move.w	d2,bt4gx1
	move.w	d2,bt4gx2
	move.w	d3,bt4gy1
	move.w	d3,bt4gy2
	move.b	Pengray,bt4gp1
	bra.s	.ok
.n5

	rts

.ok	move.l	intbase,a6
	jsr	-108(a6)		;drawborder()
	rts


border_type1	dc.w	0,0		;gadget like XEN!
bt1p1		dc.b	0,0
		dc.b	1
		dc.b	5
		dc.l	border1.1xy
		dc.l	border1.2
border1.1xy	dc.w	0,0
bt1x1		dc.w	0,0
bt1x2		dc.w	0
bt1y1		dc.w	0,0
bt1y2		dc.w	0,0,0,0
border1.2	dc.w	0,0
bt1p2		dc.b	0,0
		dc.b	1
		dc.b	3
		dc.l	border1.2xy
		dc.l	border1.3
border1.2xy	dc.w	1
bt1y3		dc.w	0,1,1
bt1x3		dc.w	0,1,0
border1.3	dc.w	0,0
bt1p3		dc.b	0,0
		dc.b	1
		dc.b	3
		dc.l	border1.3xy
		dc.l	0
border1.3xy	dc.w	1
bt1y4		dc.w	0
bt1x4		dc.w	0
bt1y5		dc.w	0
bt1x5		dc.w	0,1,0


border_type2	dc.w	0,0		;3d standard gadget
bt2p1		dc.b	2,0
		dc.b	1
		dc.b	3
		dc.l	border2.1xy
		dc.l	border2.2
border2.1xy	dc.w	0
b2y1		dc.w	4
b2x1		dc.w	3
b2y2		dc.w	4
b2x2		dc.w	3,0,0
border2.2	dc.w	0,0
bt2p2		dc.b	1,0
		dc.b	1
		dc.b	3
		dc.l	border2.2xy
		dc.l	0
border2.2xy
b2x3		dc.w	3,0,0,0,0
b2y3		dc.w	4,0

border_type3	dc.w	0,0
bt3p1		dc.b	2,0
		dc.b	1
		dc.b	5
		dc.l	border3.1xy
		dc.l	border3.2
border3.1xy	dc.w	1,1
b3x1		dc.w	3,1
b3x2		dc.w	3
b3y1		dc.w	4,1
b3y2		dc.w	4,1,1,0
border3.2	dc.w	0,0
bt3p2		dc.b	1,0
		dc.b	1
		dc.b	3
		dc.l	border3.2xy
		dc.l	border3.3
border3.2xy	dc.w	2
b3y4		dc.w	4
b3x4		dc.w	3
b3y5		dc.w	4
b3x5		dc.w	3,2,0
border3.3	dc.w	0,0
bt3p3		dc.b	1,0
		dc.b	1
		dc.b	3
		dc.l	border3.3xy
		dc.l	0
border3.3xy	dc.w	0
b3y3		dc.w	4,0,0
b3x3		dc.w	3,0,0

PenWhite	dc.b	0
PenBlack	dc.b	0
PenGray		dc.b	0

border_type4white
		dc.w	0,0		;white bar
bt4wp1		dc.b	0,0
		dc.b	1
		dc.b	5
		dc.l	border4w.1xy
		dc.l	0
border4w.1xy	dc.w	0,0
bt4wx1		dc.w	0,0
bt4wx2		dc.w	0
bt4wy1		dc.w	0,0
bt4wy2		dc.w	0,0,0,0

border_type4black
	dc.w	0,0		;black bar
bt4bp1		dc.b	0,0
		dc.b	1
		dc.b	5
		dc.l	border4b.1xy
		dc.l	0
border4b.1xy	dc.w	0,0
bt4bx1		dc.w	0,0
bt4bx2		dc.w	0
bt4by1		dc.w	0,0
bt4by2		dc.w	0,0,0,0

border_type4gray
		dc.w	0,0	;gray bar
bt4gp1		dc.b	0,0
		dc.b	1
		dc.b	5
		dc.l	border4g.1xy
		dc.l	0
border4g.1xy	dc.w	0,0
bt4gx1		dc.w	0,0
bt4gx2		dc.w	0
bt4gy1		dc.w	0,0
bt4gy2		dc.w	0,0,0,0



	even

p_LVOHl:

	movem.l d0-a6,-(sp)		;wartosci na stos

	jsr	openint

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	moveq	#0,d0
	move.b	PenBlack,d0
	jsr	-342(a6)

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	jsr	-240(a6)		;move

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	d2,d0
	move.l	d1,d2
	move.l	a0,a1
	jsr	-246(a6)

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	moveq	#0,d0
	move.b	PenWhite,d0
	jsr	-342(a6)

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	addq.l	#1,d1
	jsr	-240(a6)		;move

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu

	move.l	gfxbase,a6
	move.l	d2,d0
	addq.l	#1,d1
	move.l	a0,a1
	jsr	-246(a6)
	rts

;a0	;winbase
;a1	;gadgetstructure(337b)
;d0	;x
;d1	;y
;d2	;xs
;d3	;ys
;d4	;gadgetid
;d5	;maxlen

p_LVOAddStringGadget:

	movem.l d0-a6,-(sp)		;wartosci na stos

	jsr	openint

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	a1,a2
	move.l	#0,(a2)+		;budowa gadgetu
	move.w	d0,(a2)+		;x
	move.w	d1,(a2)+		;y
	move.w	d2,(a2)+		;xsize
	move.w	d3,(a2)+		;ysize
	move.w	#$80,(a2)+		;stringgadget
	move.w	#$3,(a2)+
	move.w	#$4,(a2)+
	move.l	#0,(a2)+
	move.l	#0,(a2)+
	move.l	#0,(a2)+
	move.l	#0,(a2)+

	move.l	a2,a1
	move.l	#0,(a2)+
	move.w	d4,(a2)+
	move.l	#0,(a2)+		;koniec

	move.l	a2,(a1)			;stringgadget structure
	move.l	a2,a1
	move.l	#0,(a2)+
	move.l	#0,(a2)+
	move.w	#0,(a2)+
	move.w	d5,(a2)+
	move.w	#0,(a2)+
	move.w	#0,(a2)+
	move.w	#0,(a2)+
	move.w	#0,(a2)+
	move.w	#0,(a2)+
	move.w	#0,(a2)+
	move.l	#0,(a2)+
	move.l	#0,(a2)+
	move.l	#0,(a2)+		;end
	move.l	a2,(a1)			;80b+256
	move.l	a2,long

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu

	move.l	a0,a5
	move.l	a1,a4

	move.l	intbase,a6
	moveq	#-1,d0
	jsr	-42(a6)

	move.l	intbase,a6
	move.l	a5,a1
	move.l	a4,a0
	move.l	#0,a2
	jsr	-222(a6)

	move.l	long,a0

	rts


p_LVOXENAddGadget:

	movem.l d0-a6,-(sp)		;wartosci na stos

	move.w	d2,bt1x1
	move.w	d2,bt1x2
	move.w	d3,bt1y1
	move.w	d3,bt1y2
	subq.l	#1,d2
	subq.l	#1,d3
	move.w	d2,bt1x4
	move.w	d2,bt1x5
	move.w	d3,bt1y4
	move.w	d3,bt1y5
	subq.l	#1,d2
	subq.l	#1,d3
	move.w	d2,bt1x3
	move.w	d3,bt1y3
	move.b	PenBlack,bt1p1
	move.b	PenWhite,bt1p2
	move.b	PenGray,bt1p3

	jsr	openint

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu

	move.l	a1,a2

	move.l	#0,(a2)+		;budowa gadgetu
	move.w	d0,(a2)+		;x
	move.w	d1,(a2)+		;y
	move.w	d2,(a2)+		;xsize
	move.w	d3,(a2)+		;ysize
	move.w	#$2,(a2)+
	move.w	#$3,(a2)+
	move.w	#$1,(a2)+

;	move.l	#border_type1,(a2)+
	move.l	a2,a6
	adda.l	#4,a2

;	move.l	#border_type1_2,(a2)+
	move.l	a2,a4
	adda.l	#4,a2

;	move.l	#xengad_text,(a2)+
	move.l	a2,a5
	adda.l	#4,a2

	move.l	#0,(a2)+
	move.l	#0,(a2)+
	move.w	d4,(a2)+
	move.l	#0,(a2)+

	move.l	a2,(a5)	;text

	move.b	PenBlack,(A2)+
	move.w	#0,(a2)+
	move.b	#0,(a2)+
	move.w	d6,(a2)+
	move.w	d7,(a2)+
	move.l	#0,(a2)+
	move.l	d5,(a2)+
	move.l	#0,(a2)+

	move.l	a2,(a4)	;border1.2

	move.l	#0,(a2)+
	move.b	PenBlack,(a2)+
	move.b	#0,(a2)+
	move.b	#1,(a2)+
	move.b	#5,(a2)+

	move.l	a2,a4
	addq.l	#4,a2
	move.l	a2,a5
	addq.l	#4,a2

	move.l	a2,(a4)
	move.l	#0,(a2)+
	move.w	d2,(a2)+
	move.w	#0,(a2)+
	move.w	d2,(a2)+
	move.w	d3,(a2)+
	move.w	#0,(a2)+
	move.w	d3,(a2)+
	move.w	#0,(a2)+
	move.b	#0,(a2)+

	move.l	a2,(a5)

	move.l	#0,(a2)+
	move.b	PenGray,(a2)+
	move.b	#0,(a2)+
	move.b	#1,(a2)+
	move.b	#3,(a2)+

	move.l	a2,a4
	addq.l	#4,a2
	move.l	a2,a5
	addq.l	#4,a2

	move.l	a2,(a4)
	move.w	#1,(a2)+

	move.w	d3,(a2)
	subq.w	#2,(a2)+
	move.w	#1,(a2)+
	move.w	#1,(a2)+
	move.w	d2,(a2)
	subq.w	#2,(a2)+
	move.w	#1,(a2)+
	move.w	#0,(a2)+

	move.l	a2,(a5)
	move.l	#0,(a2)+
	move.b	PenWhite,(a2)+
	move.b	#0,(a2)+
	move.b	#1,(a2)+
	move.b	#3,(a2)+

	move.l	a2,a4
	addq.l	#4,a2
	move.l	#0,(a2)+
	move.l	a2,(a4)

	move.w	#1,(a2)+
	move.w	d3,(a2)
	subq.w	#1,(a2)+
	move.w	d2,(a2)
	subq.w	#1,(a2)+
	move.w	d3,(a2)
	subq.w	#1,(a2)+
	move.w	d2,(a2)
	subq.w	#1,(a2)+
	move.w	#1,(a2)+
	move.w	#0,(a2)+

	move.l	a2,(a6)		;border1

	move.l	#0,(a2)+
	move.b	PenBlack,(a2)+
	move.b	#0,(a2)+
	move.b	#1,(a2)+
	move.b	#5,(a2)+

	move.l	a2,a4
	addq.l	#4,a2
	move.l	a2,a5
	addq.l	#4,a2

	move.l	a2,(a4)
	move.l	#0,(a2)+
	move.w	d2,(a2)+
	move.w	#0,(a2)+
	move.w	d2,(a2)+
	move.w	d3,(a2)+
	move.w	#0,(a2)+
	move.w	d3,(a2)+
	move.w	#0,(a2)+
	move.b	#0,(a2)+

	move.l	a2,(a5)

	move.l	#0,(a2)+
	move.b	PenWhite,(a2)+
	move.b	#0,(a2)+
	move.b	#1,(a2)+
	move.b	#3,(a2)+

	move.l	a2,a4
	addq.l	#4,a2
	move.l	a2,a5
	addq.l	#4,a2

	move.l	a2,(a4)
	move.w	#1,(a2)+

	move.w	d3,(a2)
	subq.w	#2,(a2)+
	move.w	#1,(a2)+
	move.w	#1,(a2)+
	move.w	d2,(a2)
	subq.w	#2,(a2)+
	move.w	#1,(a2)+
	move.w	#0,(a2)+

	move.l	a2,(a5)
	move.l	#0,(a2)+
	move.b	PenGray,(a2)+
	move.b	#0,(a2)+
	move.b	#1,(a2)+
	move.b	#3,(a2)+

	move.l	a2,a4
	addq.l	#4,a2
	move.l	#0,(a2)+
	move.l	a2,(a4)

	move.w	#1,(a2)+
	move.w	d3,(a2)
	subq.w	#1,(a2)+
	move.w	d2,(a2)
	subq.w	#1,(a2)+
	move.w	d3,(a2)
	subq.w	#1,(a2)+
	move.w	d2,(a2)
	subq.w	#1,(a2)+
	move.w	#1,(a2)+
	move.w	#0,(a2)+	;by juen! mam nadzieje ze docenisz moj
				;wysilek przy ukladaniu tych struktur :)

;---

	move.l	a0,a5
	move.l	a1,a4

	move.l	intbase,a6
	moveq	#-1,d0
	jsr	-42(a6)

	move.l	intbase,a6
	move.l	a5,a1
	move.l	a4,a0
	move.l	#0,a2
	jsr	-222(a6)

	rts


p_LVOVl:

	movem.l d0-a6,-(sp)		;wartosci na stos

	jsr	opengfx

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	moveq	#0,d0
	move.b	PenBlack,d0
	jsr	-342(a6)

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	jsr	-240(a6)		;move

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	d2,d1
	move.l	a0,a1
	jsr	-246(a6)

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	moveq	#0,d0
	move.b	PenWhite,d0
	jsr	-342(a6)

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu
	movem.l d0-a6,-(sp)		;wartosci na stos

	move.l	gfxbase,a6
	move.l	a0,a1
	addq.l	#1,d0
	jsr	-240(a6)		;move

	movem.l (sp)+,d0-a6		;zwrocenie wartosci ze stosu

	move.l	gfxbase,a6
	addq.l	#1,d0
	move.l	d2,d1
	move.l	a0,a1
	jsr	-246(a6)
	rts


p_LVOCenterWindow:

	move.l	a0,a6
	move.l	$3c(a0),a0
	moveq	#0,d0
	moveq	#0,d1
	move.w	12(a0),d0	;szer ekranu
	move.w	14(a0),d1	;wysokosc ekranu

	moveq	#0,d2
	moveq	#0,d3

	move.w	4(a1),d2	;szer okna
	move.w	6(a1),d3	;wys okna

	sub.l	d2,d0
	move.l	d0,d4
	divu.l	#2,d4
	sub.l	d4,d0		;pozycja okna x

	sub.l	d3,d1
	move.l	d1,d4
	divu.l	#2,d4
	sub.l	d4,d1

	move.w	d0,(a1)
	move.w	d1,2(a1)

	move.l	a1,a0

	rts

p_LVOSearchForColour:

	move.l	a0,a5
	move.l	d0,d6

	jsr	opengfx
	jsr	openint
	move.l	intbase,a6
	move.l	a5,a0
	jsr	-300(a6)
	move.l	d0,WinVPort
	move.l	d0,a0
	move.l	4(a0),ColorMap
	move.l	GfxBase(pc),a6
	moveq	#0,d7
	lea	wb_pal,a5
.Loop	move.l	d7,d0
	move.l	ColorMap(pc),a0
	jsr	-582(a6)
	move.w	d0,(a5)+
	addq.b	#1,d7
	cmp.b	#0,d7
	bne.s	.loop

	move.l	d6,d2
	bsr	check_colour
.ok	rts


p_LVOGetGadgetPTR
	clr.l	d7
	move.w	d0,d7	

.loop	move.l	a0,a2
	move.l	(a0)+,a1
	adda.l	#34,a0
	cmp.w	(a0),d7
	beq.s	.ok

	move.l	a1,a0
	cmp.l	#0,a0
	beq.s	.notok

	bra.s	.loop

.notok	moveq	#-1,d0
	rts

.ok	move.l	d7,d0
	move.l	a2,a0
	rts

p_LVOMakeGUI:

	move.l	a1,winbase
	move.l	a0,temp

	move.l	4.w,a6
	lea	gfxname,a1
	jsr	-408(a6)
	move.l	d0,gfxbase

.loop	move.l	temp,a0
	cmp.l	#N_GUI_END,(a0)
	beq.w	.end

	cmp.l	#N_GUI_BOX,(a0)
	beq.w	.makebox
	cmp.l	#N_GUI_TEXT,(a0)
	beq.s	.puttext
	cmp.l	#N_GUI_HL,(a0)
	beq.w	.makehl
	cmp.l	#N_GUI_VL,(a0)
	beq.w	.makevl
	cmp.l	#N_GUI_XENGADGET,(a0)
	beq.w	.makexengadget
	cmp.l	#N_GUI_ADDSTRING,(a0)
	beq.w	.makeaddstring

	bra.w	.end

.puttext
	adda.l	#4,a0

	move.l	a0,temp
	move.l	winbase,a1
	move.l	$32(a1),a1
	move.l	gfxbase(pc),a6
	moveq	#0,d0
	move.b	PenBlack,d0
	jsr	-342(a6)
	move.l	temp,a0

	move.l	(a0)+,d0
	move.l	(a0)+,d1
	move.l	a0,temp
	move.l	winbase,a1
	move.l	$32(a1),a1
	move.l	gfxbase,a6
	jsr	-240(a6)	

	move.l	temp,a0
	move.l	(a0)+,a1
	move.l	a0,temp
	move.l	a1,a0
	moveq	#0,d0
.l	addq.l	#1,d0
	cmp.b	#0,(a1)+
	bne.s	.l
	subq.l	#1,d0

	move.l	winbase,a1
	move.l	$32(a1),a1
	move.l	gfxbase(pc),a6	;napisz
	jsr	-60(a6)
	bra.l	.loop


.makebox
	adda.l	#4,a0
	move.l	(a0)+,d0
	move.l	(a0)+,d1
	move.l	(a0)+,d2	
	move.l	(a0)+,d3
	move.l	(a0)+,d4
	move.l	a0,temp
	move.l	winbase,a0
	move.l	$32(a0),a0
	jsr	p_LVOBox
	bra.l	.loop

.makehl	adda.l	#4,a0
	move.l	(a0)+,d0
	move.l	(a0)+,d1
	move.l	(a0)+,d2
	move.l	a0,temp
	move.l	winbase,a0
	move.l	$32(a0),a0
	jsr	p_LVOHl
	bra.l	.loop

.makevl	adda.l	#4,a0
	move.l	(a0)+,d0
	move.l	(a0)+,d1
	move.l	(a0)+,d2
	move.l	a0,temp
	move.l	winbase,a0
	move.l	$32(a0),a0
	jsr	p_LVOVl
	bra.l	.loop

.makeaddstring
	adda.l	#4,a0
	move.l	(a0)+,a1
	move.l	(a0)+,d0
	move.l	(a0)+,d1
	move.l	(a0)+,d2
	move.l	(a0)+,d3
	move.l	(a0)+,d4
	move.l	(a0)+,d5
	move.l	a0,temp
	move.l	winbase,a0
	jsr	p_LVOAddStringGadget
	bra.l	.loop

.makexengadget
	adda.l	#4,a0
	move.l	(a0)+,a1
;	move.l	(a1),a1
	move.l	(a0)+,d0
	move.l	(a0)+,d1
	move.l	(a0)+,d2
	move.l	(a0)+,d3
	move.l	(a0)+,d4
	move.l	(a0)+,d5
	move.l	(a0)+,d6
	move.l	(a0)+,d7
	move.l	a0,temp
	move.l	winbase,a0
	jsr	p_LVOXENAddGadget
	bra.l	.loop

.end	rts

temp	dc.l	0
winbase	dc.l	0

p_LVOBinToAscii:
BinToASCII	movem.l	d0-d2/a0-a1,-(sp)	;bintoascii Dëbola'97, thanx
		lea	.Dzielnik(pc),a1
		moveq	#8-1,d2
.Loop01		moveq	#$30,d1
.Loop02		addq.b	#1,d1
		sub.l	(a1),d0
		bcc.s	.Loop02
		subq.b	#1,d1
		add.l	(a1),d0	
		move.b	d1,(a0)+
		lea	4(a1),a1
		dbf	d2,.Loop01
		movem.l	(sp)+,d0-d2/a0-a1
		rts
;-------------
.Dzielnik
	dc.l	10000000,01000000
	dc.l	00100000,00010000
	dc.l	00001000,00000100
	dc.l	00000010,00000001
;----------------------------

long	dc.l	0

;zaczerpniete z AsciiCreator v0.5 z wylaczeniem file_id.diz
;AsciiCreator by Juen/Negative, ascii fonts by Da5h'sfish! [juen] :)

asciioutput	dc.l	0
background	dc.b	0
cutchars	dc.b	0
underscore	dc.b	0
wheretag	dc.b	0
logosname	dc.b	0
log		dc.l	0
		even

p_LVOAsciiCreator:

	move.l	d0,asciioutput
	move.b	#0,logosname	;d1
	move.b	d2,underscore
	move.b	d3,wheretag
	move.b	d4,background
	move.b	d5,cutchars

	move.l	a0,log

	lea	dosname,a1
	move.l	4,a6
	jsr	-408(a6)
	move.l	d0,dosbase

	move.l	log,a4
	bsr	makea
	tst	d0
	beq.s	.ok
	moveq	#-1,d0
	rts
.ok	moveq	#0,d0
	rts

makea	moveq	#0,d5
	lea	line1,a2
	moveq	#5-1,d6
megaloop:	;)
	move.l	a4,a5
ml	sub.l	d7,d7
	move.b	(a5)+,d7
	tst.b	d7
	beq.w	doseno
	cmp.b	#$a,d7
	beq.w	doseno
	lea	fonts,a0
.ll	cmp.b	#"!",(a0)
	beq.s	.ch
.l	cmp.b	#$a,(a0)+
	bne.s	.l
	bra.s	.ll
.ch	addq.l	#1,a0
	cmp.b	#"E",(a0)
	beq.w	dosee
	cmp.b	(a0),d7
	bne.s	.l

	addq.l	#2,a0

	;przelicz dlugosc linii
	move.l	a0,a1
	moveq	#0,d0
.x	addq.l	#1,d0
	cmp.b	#$a,(a1)+
	bne.s	.x

	move.l	d5,d3
	mulu.l	d0,d3
	adda.l	d3,a0
	move.l	a0,baq

	adda.l	d0,a0

	tst.b	d6	;czy ostatnia
	bne.s	ok	;i ustawic miejsce na taga?

	sub.l	d1,d1
	move.b	(a5),d1

	cmp.b	#$a,d1
	beq.s	.last
	tst.b	d1
	bne.w	ok	;czy ostatnia litera?

.last
	suba.l	#1,a0
.n	cmp.b	#" ",-(a0)
	bne.s	.nt
	subq.l	#1,d0
	tst.l	d0
	beq.s	ml
	bra.s	.n
.nt
ok	subq.l	#1,d0

	jsr	_print
	bra.w	ml

doseno
	tst.b	d6
	beq.s	noenta
	move.b	#$a,(a2)+
	addq.l	#1,d5
	move.l	d5,d0
	lea	line1,a2
	mulu.l	#LINEBUF,d0
	adda.l	d0,a2
noenta	dbf	d6,megaloop

dose	tst.b	cutchars
	beq.w	nocut
;	print	"Ciëcie linii wedîug opcji..."
nocut
	;wszystko wporzo, wrzucmy wiec taga!
	move.b	#$a,(a2)

	;# INTELIGENTNE WSTAWIANIE TAGA
	cmp.b	#2,wheretag
	beq.l	notag
;	print	"Wstawiam taga..."
	move.l	a2,a3
	cmp.b	#1,wheretag
	beq.s	.tagfirst

.inloop	suba.l	#1,a2
	cmp.b	#$a,(a2)
	beq.s	.onlast
	cmp.b	#"@",(a2)
	beq.w	.inloop
.free	adda.l	#1,a2
	cmp.l	#"@@@@",(a2)
	bne.s	.nofree
	move.l	#TAG,(a2)
	bra.s	.ok
.nofree	suba.l	#1,a2
	bra.s	.inloop

.onlast	move.l	#TAG,(a3)+
.ok	move.b	#10,(a3)
	bra.w	.tagok

.tagfirst
	lea	line5,a2
.l	cmp.b	#$a,(a2)
	beq.s	.forg
	cmp.b	#"@",(a2)+
	beq.s	.l
	suba.l	#2,a2
	cmp.b	#$a,(a2)
	beq.s	.forg
	suba.l	#1,a2
	cmp.b	#$a,(a2)
	beq.s	.forg
	suba.l	#1,a2
	cmp.b	#$a,(a2)
	beq.s	.forg
	suba.l	#1,a2
	cmp.b	#$a,(a2)
	beq.s	.forg
	move.l	#TAG,(a2)
	move.b	#$a,(a3)
	bra.s	.tagok

.forg	lea	line5,a2
	bra.w	.fl

.fl	cmp.b	#$a,(a2)
	beq.s	.fspectag
	cmp.l	#"@@@@",(a2)
	beq.s	.ffree
	adda.l	#1,a2
	bra.s	.fl
.fspectag
	move.l	#TAG,(a3)+
	move.b	#$a,(a3)
	bra.s	.tagok
.ffree	move.l	#TAG,(a2)
	move.b	#$a,(a3)
	bra.w	.tagok

.tagok
notag

	;#PODKRESLENIE (NO JASNE ZE INTELIGENTNE)
	tst.b	underscore
	beq.s	nounderscore
;	print	"Tworzë podkreôlenie..."
	lea	line5,a0
.un5l	cmp.b	#$a,(a0)
	beq.s	.un5
	cmp.b	#"@",(a0)
	bne.s	.un5n
	move.b	#"=",(a0)
.un5n	adda.l	#1,a0
	bra.s	.un5l
.un5
nounderscore

	;#TLO (TAKZE INTELIGENTNE ;])
	tst.b	background
	beq.w	backgroundok
;	PRINT	"Generuje podkîad..."
	cmp.b	#1,background
	bne.w	.nodotdither1
	lea	line1,a0
.dd1_1l	cmp.b	#$a,(a0)
	beq.s	.dd1_1
	cmp.b	#"@",(a0)
	bne.s	.dd1_1n
	move.b	#"·",(a0)
.dd1_1n	adda.l	#1,a0
	bra.s	.dd1_1l
.dd1_1	lea	line2,a0
.dd1_2l	cmp.b	#$a,(a0)
	beq.s	.dd1_2
	cmp.b	#"@",(a0)
	bne.s	.dd1_2n
	move.b	#".",(a0)
.dd1_2n	adda.l	#1,a0
	bra.s	.dd1_2l
.dd1_2	lea	line3,a0
.dd1_3l	cmp.b	#$a,(a0)
	beq.s	.dd1_3
	cmp.b	#"@",(a0)
	bne.s	.dd1_3n
	move.b	#"½",(a0)
.dd1_3n	adda.l	#1,a0
	bra.s	.dd1_3l
.dd1_3	lea	line4,a0
.dd1_4l	cmp.b	#$a,(a0)
	beq.s	.dd1_4
	cmp.b	#"@",(a0)
	bne.s	.dd1_4n
	move.b	#"¼",(a0)
.dd1_4n	adda.l	#1,a0
	bra.s	.dd1_4l
.dd1_4	lea	line5,a0
.dd1_5l	cmp.b	#$a,(a0)
	beq.s	.dd1_5
	cmp.b	#"@",(a0)
	bne.s	.dd1_5n
	move.b	#"¾",(a0)
.dd1_5n	adda.l	#1,a0
	bra.s	.dd1_5l
.dd1_5

.nodotdither1
backgroundok

	tst.b	background
	bne.s	nieczysc
;	print	"Czyszcze powierzchnie..."
	lea	line1,a0
	move.l	#(linebuf*5)-1,d0
.x	cmp.b	#"@",(a0)
	bne.w	.o
	move.b	#" ",(a0)
.o	adda.l	#1,a0
	dbf	d0,.x
nieczysc

	move.l	#line1,d2
	lea	line1,a0
	moveq	#0,d3
.x1	addq.l	#1,d3
	cmp.b	#$a,(a0)+
	bne.s	.x1
	move.l	asciioutput,d1
	move.l	dosbase,a6
	jsr	-48(a6)

	move.l	#line2,d2
	lea	line2,a0
	moveq	#0,d3
.x2	addq.l	#1,d3
	cmp.b	#$a,(a0)+
	bne.s	.x2
	move.l	asciioutput,d1
	move.l	dosbase,a6
	jsr	-48(a6)

	move.l	#line3,d2
	lea	line3,a0
	moveq	#0,d3
.x3	addq.l	#1,d3
	cmp.b	#$a,(a0)+
	bne.s	.x3
	move.l	asciioutput,d1
	move.l	dosbase,a6
	jsr	-48(a6)

	move.l	#line4,d2
	lea	line4,a0
	moveq	#0,d3
.x4	addq.l	#1,d3
	cmp.b	#$a,(a0)+
	bne.s	.x4
	move.l	asciioutput,d1
	move.l	dosbase,a6
	jsr	-48(a6)

	move.l	#line5,d2
	lea	line5,a0
	moveq	#0,d3
.x5	addq.l	#1,d3
	cmp.b	#$a,(a0)+
	bne.s	.x5
	move.l	asciioutput,d1
	move.l	dosbase,a6
	jsr	-48(a6)

	move.l	#enta,d2
	moveq	#1,d3
	move.l	asciioutput,d1
	move.l	dosbase,a6
	jsr	-48(a6)

	moveq	#0,d0
	rts

dosee	moveq	#-1,d0
	rts

_print	movem.l d0-a1,-(sp)		;wartosci na stos
	move.l	baq,a0
	move.l	d0,d3
	tst	d3
	beq.s	.ax
.x	subq.l	#1,d3
	move.b	(a0)+,(a2)+
	tst.l	d3
	bne.s	.x
.ax	sub.l	d1,d1
	move.b	(a5),d1
	cmp.b	#$a,d1
	beq.s	.nocut	;ostatniej nie tniemy!
	tst.b	d1
	beq.s	.nocut
	sub.l	d0,d0
	move.b	cutchars,d0
	suba.l	d0,a2
.nocut	movem.l (sp)+,d0-a1		;zwrocenie wartosci ze stosu
	rts

MAXCHARS	=	40
LINEBUF		=	MAXCHARS*14
TAG		=	"[d5]"

dosname	dc.b	'dos.library',0
enta	dc.b	$a
dosbase	dc.l	0
baq	dc.l	0
baq3	ds.b	MAXCHARS+1
line1	ds.b	LINEBUF
line2	ds.b	LINEBUF
line3	ds.b	LINEBUF
line4	ds.b	LINEBUF
line5	ds.b	LINEBUF
fonts:	incbin	scena:!scena/ascii/.charset


;------------------------------------------------
MyLibraryEnd
	end


*SEN
