English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 16 January 2012, 14:36   #1
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
Open-source graphics library

Due full ASM version of dos library is almost finished (less than 6 kB of C code must be reworked), I started next open project. This time it's graphics library v40.24.
Resourced version is available here:

http://wt.exotica.org.uk/test.html

This is virgin (unchanged by me) version. If someone want then can start to optimise ASM parts and rework C parts for reach maximum speed.
Perhaps final version of graphics library can has ~70KB.

For LoadModule and ROM 3.1 users, 43 byte of graphics.library must be changed
from $28 (old version) to $29 (new version).
Don_Adan is offline  
Old 16 January 2012, 16:37   #2
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Nice!!!
I hope someone or you can rework it
mfilos is offline  
Old 16 January 2012, 19:18   #3
gulliver
BoingBagged
 
gulliver's Avatar
 
Join Date: Aug 2007
Location: The South of nowhere
Age: 46
Posts: 2,358
Great!
I am glad you tackled on this one
gulliver is offline  
Old 17 January 2012, 09:48   #4
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,801
IMHO it would be better to optimize the C code of Aros for 68k to produce better ASM.
But it's an interesting project if you comment the code.
Maybe this could improve Aros compatibility by understanding better some part of the original code. (mostly I suppose undocumented ones)
kamelito is offline  
Old 17 January 2012, 23:30   #5
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
Yes either way it's a great idea + you could talk to PeterK for some ideas.
NovaCoder is offline  
Old 18 January 2012, 08:07   #6
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
Thread subscribed! go Don, get it On!
Bamiga2002 is offline  
Old 17 November 2012, 17:05   #7
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
First gfx (_LVOSetRGB32CM) routine is reworked and fixed. For now I don't update GFX31.lzx archive. I will make this after more changes/fixes (perhaps ~5 routines).

Code:
; _LVOSetRGB32CM (final version - 17 XI 2012)
; input   D0/D1/D2/D3/A0
; output  none
; changed D0/D1/A0/A1

;SetRGB32CM	CMP.W	2(A0),D0
;	BGE.S	lbC008E6C
;	MOVE.L	D4,-(SP)
;	MOVEA.L	4(A0),A1
;	TST.B	1(A0)
;	MOVEA.L	12(A0),A0
;	BNE.S	lbC008E1A
;	MOVEA.L	A1,A0
;lbC008E1A	ADD.W	D0,D0
;	ADDA.W	D0,A0
;	ADDA.W	D0,A1
;	SWAP	D1
;	SWAP	D2
;	SWAP	D3
;	MOVE.W	D1,D0
;	LSR.W	#4,D0
;	AND.W	#$F00,D0
;	MOVE.W	D2,D4
;	LSR.W	#8,D4
;	AND.W	#$F0,D4
;	OR.W	D4,D0
;	MOVE.W	D3,D4
;	ROL.W	#4,D4
;	AND.W	#15,D4
;	OR.W	D4,D0
;	MOVE.W	(A1),D4
;	AND.W	#$8000,D4
;	OR.W	D4,D0
;	MOVE.W	D0,(A1)
;	MOVE.W	D1,D0
;	AND.W	#$F00,D0
;	MOVE.W	D2,D4
;	LSR.W	#4,D4
;	AND.W	#$F0,D4
;	OR.W	D4,D0
;	MOVE.W	D3,D4			; bug, missing lsr.w #8,D4
;	AND.W	#15,D4
;	OR.W	D4,D0
;	MOVE.W	D0,(A0)
;	MOVE.L	(SP)+,D4
;	SWAP	D2
;	SWAP	D3
;lbC008E6C	RTS

;	dc.w	0

SetRGB32CM
	cmp.w	2(A0),D0
	bge.b	QuitRGB32
	move.l	4(A0),A1
	tst.b	1(A0)
	move.l	12(A0),A0
	bne.b	SkipRGB32
	move.l	A1,A0
SkipRGB32
	add.w	D0,D0
	add.w	D0,A0
	add.w	D0,A1
	swap	D1
	swap	D2
	swap	D3
	move.w	D2,D0			; %1111111100000000
	lsr.w	#4,D0			; %0000111111110000
	move.b	D0,D1			; %1111111111110000
	lsl.l	#4,D1			; %1111111100000000
	move.w	D3,D0			; %1111111100000000
	lsr.w	#4,D0			; %0000111111110000
	move.b	D0,D1			; %1111111111110000
	lsr.w	#4,D1			; %0000111111111111
	move.w	D1,(A0)			; %0000111111111111
	cmp.l	A0,A1
	beq.b	SwapRGB32
	and.w	#$8000,(A1)		; %1000000000000000
	move.w	D2,D1			; %1111111100000000
	lsr.l	#4,D1			; %1111111111110000
	lsr.w	#4,D0			; %0000000011111111
	move.b	D0,D1			; %1111111111111111
	lsr.w	#4,D1			; %0000111111111111
	or.w	D1,(A1)			; %1000111111111111
SwapRGB32
	swap	D2
	swap	D3
QuitRGB32
	rts

Last edited by Don_Adan; 17 November 2012 at 18:59.
Don_Adan is offline  
Old 18 November 2012, 00:08   #8
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Nice! \o/
mfilos is offline  
Old 12 December 2012, 16:35   #9
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
First versions of graphics library with changed code are available.
Reworked/optimised: InitGels, InitBitMap, InitView, InitVPort, RemVSprite,
AllocDBufInfo, SetRGB32CM routines. Fixed EraseRect routine.
Used WritePixelArray8 and WritePixelLine8 routines from Romfixes 2.1
for 68000+ version.
Used WritePixelArray8, WritePixelLine8 and WriteChunkyPixels routines
from BlazeWCP 1.74 by Rick Pratt for 68020+ version.

Code:
; _LVOInitGels (final version - 18 XI 2012)
; input   A0/A1/A2
; output  none
; changed D0/D1/A0/A1

;InitGels	LINK	A5,#-4
;	MOVEM.L	A2-A4,-(SP)
;	EXG	A2,A1
;	MOVEA.L	A0,A3
;	MOVE.L	A1,-4(A5)
;	MOVEA.L	-4(A5),A0
;	MOVE.L	A3,2(A0)
;	MOVE.L	A2,6(A0)
;	MOVE.L	A2,(A3)
;	MOVE.L	A2,12(A3)
;	SUBA.L	A0,A0
;	MOVE.L	A0,(A2)
;	MOVE.L	A0,4(A3)
;	MOVE.L	A3,4(A2)
;	MOVE.W	#$7FFF,D0
;	MOVE.W	D0,$16(A2)
;	MOVE.W	D0,$10(A2)
;	MOVE.W	#$8001,D1
;	MOVE.W	D1,$16(A3)
;	MOVE.W	D1,$10(A3)
;	MOVE.W	D0,$18(A2)
;	MOVE.W	D0,$12(A2)
;	MOVE.W	D1,$18(A3)
;	MOVE.W	D1,$12(A3)
;	MOVEA.L	-4(A5),A4
;	MOVEA.L	$12(A4),A1
;	MOVE.L	A1,D0
;	BEQ.S	lbC0188E6
;	MOVE.L	A0,(A1)
;lbC0188E6	MOVEM.L	(SP)+,A2-A4
;	UNLK	A5
;	RTS

InitGels
	movem.l	A0/A1,2(A2)
	move.l	A0,D0
	move.l	A1,(A0)+	; 0-4
	clr.l	(A0)+		; 4-8
	addq.l	#4,A0		; 8-12
	move.l	A1,(A0)+	; 12-16
	move.l	#$80018001,D1
	move.l	D1,(A0)+	; 16-20
	addq.l	#2,A0		; 20-22
	move.l	D1,(A0)		; 22
	clr.l	(A1)+		; 0-4
	move.l	D0,(A1)+	; 4-8
	move.l	#$7FFF7FFF,D1
	addq.l	#8,A1		; 8-16
	move.l	D1,(A1)+	; 16-20
	addq.l	#2,A1		; 20-22
	move.l	D1,(A1)		; 22
	move.l	$12(A2),D0
	beq.b	ExitIG
	move.l	D0,A0
	clr.l	(A0)
ExitIG
	rts
Code:
; _LVOInitBitMap (final version - 18 XI 2012)
; input   D0/D1/D2/A0
; output  none
; changed D1/A0

;InitBitMap	CLR.B	4(A0)
;	CLR.W	6(A0)
;	MOVE.W	D2,2(A0)
;	MOVE.B	D0,5(A0)
;	ADD.W	#15,D1
;	ASR.W	#4,D1
;	ADD.W	D1,D1
;	MOVE.W	D1,(A0)
;	RTS

InitBitMap
	add.w	#15,D1
	lsr.w	#4,D1
	add.w	D1,D1
	move.w	D1,(A0)+
	move.w	D2,(A0)+
	clr.l	(A0)
	move.b	D0,1(A0)
	rts
Code:
; _LVOInitView (final version - 18 XI 2012)
; input   A1
; output  none
; changed A1

;InitView	MOVEA.L	A1,A0
;	MOVEQ	#$12,D0
;	BSR.W	ClearBuffy
;	MOVE.W	#$2C,12(A1)
;	MOVE.W	#$81,14(A1)
;	RTS

InitView
	clr.l	(A1)+		;0-4
	clr.l	(A1)+		;4-8
	clr.l	(A1)+		;8-12
	move.l	#$2C0081,(A1)+	;12-16
	clr.w	(A1)+		;16-18
	rts
Code:
; _LVOInitVPort (final version - 18 XI 2012)
; input   A0
; output  none
; changed D0/A0

;InitVPort	MOVEA.L	A0,A1
;	MOVEQ	#$28,D0
;	BSR.W	ClearBuffy
;	MOVE.B	#$24,$22(A1)
;	RTS

InitVPort
	moveq	#10-1,D0
ClearIVP
	clr.l	(A0)+
	dbf	D0,ClearIVP
	move.b	#$24,-6(A0)
	rts
Code:
; _LVORemVSprite (final version - 18 XI 2012)
; input   A0
; output  none
; changed A0/A1

;RemVSprite	MOVE.L	A3,-(SP)
;	MOVEA.L	A0,A3
;	MOVEA.L	4(A3),A0
;	MOVEA.L	(A3),A1
;	MOVE.L	A1,(A0)
;	MOVEA.L	(A3),A0
;	MOVE.L	4(A3),4(A0)
;	MOVEA.L	(SP)+,A3
;	RTS

RemVSprite
	move.l	(A0)+,A1
	move.l	(A0),A0
	move.l	A1,(A0)
	move.l	A0,4(A1)
	rts
Code:
; _LVOAllocDBufInfo (final version - 21 XI 2012)
; input   none
; output  D0
; changed D0/D1/A0/A1

;AllocDBufInfo	MOVE.L	A6,-(SP)
;	MOVEA.L	$1A4(A6),A6
;	MOVEQ	#$54,D0
;	MOVE.L	#$10000,D1
;	JSR	-$C6(A6)
;	MOVEA.L	(SP)+,A6
;	RTS

AllocDBufInfo
	move.l	A6,-(SP)
	move.l	$1A4(A6),A6		; exec base
	moveq	#$54,D0
	moveq	#1,D1
	swap	D1
	jsr	-$C6(A6)		; AllocMem
	move.l	(SP)+,A6
	rts
Code:
; _LVOEraseRect (final version - 21 XI 2012)
; input   D0/D1/D2/D3/A1
; output  none
; changed D0/D1/A0/A1

;EraseRect	TST.L	(A1)
;	BEQ.S	lbC0093C0
;	MOVEM.L	A2/A5,-(SP)
;	MOVEA.L	(A1),A5
;	JSR	-$1B0(A6)
;	MOVEA.L	$76(A5),A0
;	MOVEM.W	D0-D3,-(SP)
;	MOVEA.L	SP,A2
;	MOVE.L	A6,-(SP)
;	MOVEA.L	$1C8(A6),A6
;	JSR	-$D8(A6)
;	MOVEA.L	(SP)+,A6
;	ADDQ.L	#8,SP
;	JSR	-$1B6(A6)
;	MOVEM.L	(SP)+,A2/A5
;	RTS

;lbC0093C0	MOVEM.L	D4-D6,-(SP)	; bug here, missing D2/D3
;	MOVEA.L	A1,A0
;	SUB.L	D0,D2
;	ADDQ.L	#1,D2
;	MOVE.L	D2,D4
;	MOVE.L	D0,D2
;	SUB.L	D1,D3
;	ADDQ.L	#1,D3
;	MOVE.L	D3,D5
;	MOVE.L	D1,D3
;	MOVEQ	#0,D6
;	JSR	-$228(A6)
;	MOVEM.L	(SP)+,D4-D6
;	RTS

;	dc.w	0

EraseRect
	tst.l	(A1)
	beq.b	ClipER
	movem.l	A2/A5/A6,-(SP)
	move.l	(A1),A5			; A5 input
	bsr.b	LockLayerRom 		; all registers preserved
	move.l	$76(A5),A0
	movem.w	D0-D3,-(SP)
	move.l	SP,A2
	move.l	$1C8(A6),A6		; layers lib base ?
	jsr	-$D8(A6)		; -216 layers LVO
	bsr.b	UnlockLayerRom
	movem.l	(SP)+,D0/D1/A2/A5/A6
	rts

ClipER
	movem.l	D2-D6,-(SP)
	move.l	A1,A0
	sub.l	D0,D2
	addq.l	#1,D2
	move.l	D2,D4
	move.l	D0,D2
	sub.l	D1,D3
	addq.l	#1,D3
	move.l	D3,D5
	move.l	D1,D3
	moveq	#0,D6
	jsr	-$228(A6)		; ClipBlit
	movem.l	(SP)+,D2-D6
	rts
Don_Adan is offline  
Old 12 December 2012, 17:36   #10
wXR
Registered User
 
Join Date: Mar 2009
Location: New York
Posts: 552
github... github... giiiiiiiithuuuuuuuubbbbbb
wXR is offline  
Old 13 December 2012, 13:10   #11
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
Are you saving much space with these optimisations?
Mrs Beanbag is offline  
Old 13 December 2012, 13:36   #12
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
Me wants it, me downloads it...
Bamiga2002 is offline  
Old 13 December 2012, 15:07   #13
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,645
I really love the work you are doing here. It would be great if one of the most experienced chaps here like mfilos write a tutorial on how to build a custom kickstart with all these optimizations and fixes!
Amiga1992 is offline  
Old 13 December 2012, 20:57   #14
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
But I already made such a tutorial
http://mfilos.blogspot.gr/p/guides.html

You just need to replace the original modules from the extracted 3.1 ROM with the new ones
mfilos is offline  
Old 13 December 2012, 21:22   #15
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,645
Hmmm I'm an idiot, admitted. I thought it didn't cover how to include these new libraries.
I'll have to go through this. I want to make a special ROM for my A1200.
Amiga1992 is offline  
Old 14 December 2012, 09:08   #16
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
DonAdan your Graphics.library doesn't seem to cause any issues so far on my test A600 setup
/kudos

Awesome job there
mfilos is offline  
Old 14 December 2012, 10:41   #17
apex
Registered User
 
apex's Avatar
 
Join Date: Apr 2010
Location: Amigaplanet
Posts: 645
Working fine here.
apex is offline  
Old 14 December 2012, 15:53   #18
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
Quote:
Originally Posted by Mrs Beanbag View Post
Are you saving much space with these optimisations?
No, only a few bytes, due I optimised short routines first. Also BlazeWCP code is big enough. Anyway I want to reduce size of final version to 70-80KB, if I made this version.
Don_Adan is offline  
Old 14 December 2012, 15:53   #19
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
Quote:
Originally Posted by mfilos View Post
But I already made such a tutorial
http://mfilos.blogspot.gr/p/guides.html

You just need to replace the original modules from the extracted 3.1 ROM with the new ones
Great tutorial, thanks for making this!
Bamiga2002 is offline  
Old 14 December 2012, 17:03   #20
wXR
Registered User
 
Join Date: Mar 2009
Location: New York
Posts: 552
Is Boing Bag 4 going to be the only place where awesome patches like this are hosted? I hope we can always get to it, years from now.
wXR is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open-source dos.library Don_Adan Coders. System 273 02 September 2020 00:42
Realistic Open Source Ports fishyfish Retrogaming General Discussion 1 25 June 2013 08:10
Can't open version 36 of graphics.library Lambizkit support.Apps 1 07 November 2007 08:00
NewsRog goes Open Source Paul News 0 04 December 2004 16:37
BlitzBasic - Is now open source Djay Amiga scene 2 08 February 2003 01:09

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:04.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13083 seconds with 14 queries