English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 23 January 2012, 14:27   #1
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Open source small ROM parts

I started next small project. This time I reworked/updated short Amiga ROM modules.

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

At first new filesystem.resource with DOS6/DOS7/DOS8 support. Seems that DOS7 and DOS8
now works for Amiga68k.

Here is filesystem.resource source.

Code:
; Resourced version of filesystem.resource (40.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only
 
; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.
 
;lbC000000    ILLEGAL
;    dc.l    lbC000000
;    dc.l    lbW00019E
;    dc.l    $1280850
;    dc.l    FileSystemres.MSG
;    dc.l    filesysres401.MSG
;    dc.l    lbC000098
;FileSystemres.MSG    dc.b    'FileSystem.resource',0
;filesysres401.MSG    dc.b    'filesysres 40.1 (15.2.93)',$D,$A,0
 
;lbC00004A    MOVEA.L    $12(A5),A2
;lbC00004E    MOVE.L    (A2),D0
;    BEQ.S    lbC00005E
;    CMP.L    14(A2),D2
;    BEQ.S    lbC00005C
;    MOVEA.L    D0,A2
;    BRA.S    lbC00004E
 
;lbC00005C    MOVEQ    #1,D0
;lbC00005E    RTS
 
;lbC000060    MOVE.L    #$10001,D1
;    JSR    -$C6(A6)
;    TST.L    D0
;    BEQ.S    lbC000080
;    MOVEA.L    D0,A2
;    LEA    $1A(A5),A0
;    MOVEA.L    (A0),A1
;    MOVE.L    A2,(A0)
;    SUBQ.L    #4,A0
;    MOVEM.L    A0/A1,(A2)
;    MOVE.L    A2,(A1)
;lbC000080    RTS
 
;lbC000082    MOVE.L    D2,14(A2)
;    MOVE.L    D1,$12(A2)
;    CLR.L    $16(A2)
;    LEA    filesysres401.MSG(PC),A0
;    MOVE.L    A0,10(A2)
;    RTS
 
;lbC000098    MOVEM.L    D2/A2/A3/A5,-(SP)
;    LEA    FileSystemres.MSG(PC),A1
;    JSR    -$1F2(A6)
;    TST.L    D0
;    BEQ.S    lbC0000F6
;    MOVEA.L    D0,A5
;    MOVE.L    #$444F5305,D2
;lbC0000B0    BSR.S    lbC00004A
;    BNE.S    lbC0000BA
;    MOVEQ    #$1A,D0
;    BSR.S    lbC000060
;    BEQ.S    lbC0000CC
;lbC0000BA    MOVE.L    #$280001,D1
;    CMP.L    $12(A2),D1
;    BLE.S    lbC0000C8
;    BSR.S    lbC000082
;lbC0000C8    SUBQ.B    #1,D2
;    BNE.S    lbC0000B0
;lbC0000CC    MOVE.L    #$554E4901,D2
;    BSR.L    lbC00004A
;    BNE.S    lbC0000EE
;    MOVEQ    #$2A,D0
;    BSR.S    lbC000060
;    BEQ.S    lbC0000EE
;    MOVEQ    #0,D1
;    BSR.S    lbC000082
;    BSET    #3,$19(A2)
;    BSET    #7,$26(A2)
;lbC0000EE    MOVEQ    #0,D0
;lbC0000F0    MOVEM.L    (SP)+,D2/A2/A3/A5
;    RTS
 
;lbC0000F6    MOVEQ    #$33,D0
;    ROL.L    #2,D0
;    MOVE.L    #$10001,D1
;    JSR    -$C6(A6)
;    TST.L    D0
;    BEQ.S    lbC0000EE
;    MOVEA.L    D0,A5
;    MOVE.B    #8,8(A5)
;    LEA    FileSystemres.MSG(PC),A0
;    MOVE.L    A0,10(A5)
;    LEA    filesysres401.MSG(PC),A0
;    MOVE.L    A0,14(A5)
;    LEA    $12(A5),A3
;    MOVE.L    A3,8(A3)
;    ADDQ.L    #4,A3
;    CLR.L    (A3)
;    MOVE.L    A3,-(A3)
;    LEA    $20(A5),A2
;    MOVE.L    #$444F5305,D2
;lbC000138    MOVE.L    #$280001,D1
;    BSR.L    lbC000082
;    MOVEA.L    A3,A0
;    MOVEA.L    A2,A1
;    ADDQ.L    #4,A0
;    MOVE.L    4(A0),D0
;    MOVE.L    A1,4(A0)
;    EXG    D0,A0
;    MOVEM.L    D0/A0,(A1)
;    MOVE.L    A1,(A0)
;    ADDA.W    #$1A,A2
;    SUBQ.B    #1,D2
;    BNE.S    lbC000138
;    LEA    $A2(A5),A2
;    MOVE.L    #$554E4901,D2
;    MOVEQ    #0,D1
;    BSR.L    lbC000082
;    MOVEA.L    A3,A0
;    MOVEA.L    A2,A1
;    ADDQ.L    #4,A0
;    MOVE.L    4(A0),D0
;    MOVE.L    A1,4(A0)
;    EXG    D0,A0
;    MOVEM.L    D0/A0,(A1)
;    MOVE.L    A1,(A0)
;    BSET    #3,$19(A2)
;    BSET    #7,$26(A2)
;    MOVEA.L    A5,A1
;    JSR    -$1E6(A6)
;    MOVE.L    A5,D0
;    BRA.L    lbC0000F0
 
;lbW00019E
 
MatchTag
    ILLEGAL                ; match word
    dc.l    MatchTag        ; match tag
    dc.l    EndSkip            ; end skip
    dc.b    1            ; flags
    dc.b    $2E            ; version
    dc.b    8            ; type
    dc.b    $50            ; priority
Values
    dc.l    FileSystemres.MSG    ; name
    dc.l    filesysres401.MSG    ; id string
    dc.l    InitResource        ; init code
 
; static values
 
    dc.l    $444F5308        ; DOS8
    dc.l    $554E4901        ; UNI1
    dc.l    $002E0000        ; fse_Version (46.0)
    dc.l    $00010001        ; cleared mem flags
 
CheckID
    move.l    $12(A5),D0        ; fsr_FileSysEntries
Next
    move.l    D0,A2
    move.l    (A2),D0
    beq.b    NoEntry
    cmp.l    14(A2),D5        ; fse_DosType
    bne.b    Next
    moveq    #1,D0
NoEntry    
    rts
 
InitResource
    movem.l    D2-D7/A2/A4/A5,-(SP)
    movem.l    Values(PC),D2-D7/A4
    moveq    #0,D4
    exg    D4,A4
    move.l    D2,A1
    jsr    -$1F2(A6)        ; OpenResource
    tst.l    D0
    beq.b    FirstTime
    move.l    D0,A5
NextDOS    bsr.b    CheckID
    bne.b    Found
    moveq    #$1A,D0
    bsr.b    AllocAndLink
    beq.b    Failed
Found
    cmp.l    $12(A2),D7        ; check for FFS Vxx.x
    ble.b    InRange
    bsr.b    SetInfo
InRange
    subq.b    #1,D5
    bne.b    NextDOS
Failed
    move.l    D6,D5            ; UNI1
    bsr.b    CheckID
    bne.b    Bug
    moveq    #$2A,D0
    bsr.b    AllocAndLink
    beq.b    Quit
    bsr.b    SetInfoZero
    bsr.b    SetMe
;    bra.b    SetPtr        ; possible bug for me, missing branch here
Bug    moveq    #0,D0        ; or here must be move.l A5,D0
Quit
    movem.l    (SP)+,D2-D7/A2/A4/A5
    rts
 
AllocAndLink
    move.l    D4,D1
    jsr    -$C6(A6)        ; AllocMem
    tst.l    D0
    beq.b    NoMemory
    move.l    D0,A2
AddHead
    lea    $1A(A5),A0
    move.l    (A0),A1
    move.l    A2,(A0)
    subq.l    #4,A0
    movem.l    A0/A1,(A2)
    move.l    A2,(A1)
NoMemory
    rts
 
SetInfoZero
    moveq    #0,D7
SetInfo
    movem.l    D3/D5/D7/A4,10(A2)
    rts
 
FirstTime
    moveq    #71,D0
    lsl.w    #2,D0        ; 284=32(head)+8*26(8xDOS)+42(UNI)+2(unused)
    move.l    D4,D1
    jsr    -$C6(A6)        ; AllocMem
    tst.l    D0
    beq.b    Quit
    move.l    D0,A5
    addq.l    #8,D0
    move.l    D0,A2
    move.w    #$800,(A2)+        ; 8 - type
    move.l    D2,(A2)+        ; 10
    move.l    D3,(A2)+        ; 14
    move.l    A2,8(A2)        ; 18
    addq.l    #4,A2
    move.l    A2,-(A2)
    lea    $20(A5),A2
LoopDos
    bsr.b    SetInfo
    bsr.b    AddHead
    lea    $1A(A2),A2
    subq.b    #1,D5
    bne.b    LoopDos
    move.l    D6,D5            ; UNI1
    bsr.b    SetInfoZero
    bsr.b    AddHead
    bsr.b    SetMe
    move.l    A5,A1
    jsr    -$1E6(A6)        ; AddResource
SetPtr
    move.l    A5,D0
    bra.b    Quit
 
SetMe
    bset    #3,$19(A2)
    bset    #7,$26(A2)
    rts
 
FileSystemres.MSG    dc.b    'FileSystem.resource',0
filesysres401.MSG    dc.b    'filesysres 46.0 (21.1.2012)',$D,$A,0
    cnop    0,4
EndSkip
Don_Adan is offline  
AdSense AdSense  
Old 23 January 2012, 14:29   #2
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Here is misc.resource source.

Code:
; Resourced version of misc.resource (37.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;lbC03FE6C	ILLEGAL
;	dc.l	lbC03FE6C
;	dc.l	lbW03FF1C
;	dc.l	$1250846
;	dc.l	miscresource.MSG
;	dc.l	misc3718191.MSG
;	dc.l	lbC03FEAC
;miscresource.MSG	dc.b	'misc.resource',0
;misc3718191.MSG	dc.b	'misc 37.1 (8.1.91)',$D,$A,0
;	dc.b	0
;	dc.b	0
;	dc.b	0

;lbC03FEAC	MOVE.L	A2,-(SP)
;	LEA	lbW03FF14(PC),A0
;	LEA	lbW03FECC(PC),A1
;	SUBA.L	A2,A2
;	MOVEQ	#$32,D0
;	JSR	-$54(A6)
;	TST.L	D0
;	BEQ.S	lbC03FEC8
;	MOVEA.L	D0,A1
;	JSR	-$1E6(A6)
;lbC03FEC8	MOVEA.L	(SP)+,A2
;	RTS

;lbW03FECC	dc.w	$A008
;	dc.w	$800
;	dc.w	$800A
;	dc.l	miscresource.MSG
;	dc.l	$A00E0600
;	dc.l	$90140025
;	dc.l	$90160001
;	dc.w	0

;lbC03FEE4	MOVEA.L	4.W,A0
;	EXG	A0,A6
;	LSL.W	#2,D0
;	MOVE.W	D0,D1
;	ADDQ.B	#1,$127(A6)
;	MOVE.L	$22(A0,D1.W),D0
;	BNE.S	lbC03FEFC
;	MOVE.L	A1,$22(A0,D1.W)
;lbC03FEFC	MOVE.L	A6,-(SP)
;	MOVEA.L	4.W,A6
;	JSR	-$8A(A6)	; Permit - This call is guaranteed to preserve all registers.
;	MOVEA.L	(SP)+,A6
;	EXG	A0,A6
;	RTS

;lbC03FF0C	LSL.W	#2,D0
;	CLR.L	$22(A6,D0.W)
;	RTS

;lbW03FF14	dc.w	$FFFF
;	dc.w	lbC03FEE4-lbW03FF14
;	dc.w	lbC03FF0C-lbW03FF14
;	dc.w	$FFFF
;lbW03FF1C

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	1			; flags
	dc.b	$26			; version
	dc.b	8			; type
	dc.b	$46			; priority
	dc.l	miscresource.MSG	; name
	dc.l	misc3718191.MSG		; id string
	dc.l	InitResource		; init code

InitResource
	move.l	A2,-(SP)
	lea	Vectors(PC),A0		; Vectors
	lea	Structure(PC),A1	; Structure
	sub.l	A2,A2			; init
	moveq	#$32,D0			; dSize
	jsr	-$54(A6)		; MakeLibrary
	move.l	(SP)+,A2
	tst.l	D0
	beq.b	Failed
	move.l	D0,A1
	jmp	-$1E6(A6)		; AddResource

Structure
	dc.w	$A008			; base offset $8
	dc.w	$0800			; type
	dc.w	$800A			; base offset $A
	dc.l	miscresource.MSG	; name
	dc.w	$A00E			; base offset $E
	dc.w	$0600			; id ???
	dc.w	$9014			; base offset $14
	dc.w	$0026			; version
	dc.w	$9016			; base offset $16
	dc.w	0			; revision
	dc.w	0			; no more

; D0 - input
; A1 - input
; A6 - resource base

AllocMiscResource
	move.l	A6,-(SP)
	lsl.w	#2,D0
	lea	$22(A6,D0.W),A0
	move.l	4.W,A6
	addq.b	#1,$127(A6)
	move.l	(A0),D0
	bne.b	Permit
	move.l	A1,(A0)
Permit
	jsr	-$8A(A6)	; Permit - This call is guaranteed to preserve all registers.
	move.l	(SP)+,A6
Failed
	rts

; D0 - input
; A6 - resource base

FreeMiscResource
	lsl.w	#2,D0
	clr.l	$22(A6,D0.W)
	rts

Vectors
	dc.w	$FFFF
	dc.w	AllocMiscResource-Vectors	;  -6 _LVOAllocMiscResource
	dc.w	FreeMiscResource-Vectors	; -12 _LVOFreeMiscResource
	dc.w	$FFFF

miscresource.MSG	dc.b	'misc.resource',0
misc3718191.MSG	dc.b	'misc 38.0 (21.1.2012)',$D,$A,0
	cnop	0,4
EndSkip
Don_Adan is offline  
Old 23 January 2012, 16:49   #3
Bamiga2002
BlizzardPPC'less

Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 40
Posts: 3,210
Send a message via MSN to Bamiga2002
You dude are on ROMoroids!
Cool project!
Bamiga2002 is offline  
Old 25 January 2012, 14:06   #4
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Here is potgo.resource source.

Code:
; Resourced version of potgo.resource (37.4) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;lbC03FD34	ILLEGAL
;	dc.l	lbC03FD34
;	dc.l	lbW03FE6A
;	dc.l	$81250864
;	dc.l	potgoresource.MSG0
;	dc.l	potgo37428191.MSG
;	dc.l	lbW03FD74
;potgoresource.MSG0	dc.b	'potgo.resource',0
;potgo37428191.MSG	dc.b	'potgo 37.4 (28.1.91)',$D,$A,0
;lbW03FD74	dc.l	$2A
;	dc.l	lbW03FD84
;	dc.l	lbW03FD8E
;	dc.l	lbC03FD9E
;lbW03FD84	dc.w	$FFFF
;	dc.w	lbC03FDAE-lbW03FD84
;	dc.w	lbC03FE1C-lbW03FD84
;	dc.w	lbC03FE32-lbW03FD84
;	dc.w	$FFFF
;lbW03FD8E	dc.w	$A008
;	dc.w	$800
;	dc.w	$800A
;	dc.l	potgoresource.MSG0
;	dc.l	$A00E0600
;	dc.w	0

;lbC03FD9E	MOVEA.L	D0,A0
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.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	$81			; flags
	dc.b	$26			; version
	dc.b	8			; type
	dc.b	$64			; priority
	dc.l	potgoresource.MSG	; name
	dc.l	potgo37428191.MSG	; id string
	dc.l	MakeLibrary		; init
MakeLibrary
	dc.l	$2A			; dSize
	dc.l	Vectors
	dc.l	Structure
	dc.l	Init
Vectors
	dc.w	$FFFF
	dc.w	AllocPotBits-Vectors		;  -6 _LVOAllocPotBits
	dc.w	FreePotBits-Vectors		; -12 _LVOFreePotBits
	dc.w	WritePotgo-Vectors		; -18 _LVOWritePotgo
	dc.w	$FFFF
Structure
	dc.w	$A008			; base offset $8
	dc.w	$800			; type
	dc.w	$800A			; base offset $A
	dc.l	potgoresource.MSG	; name
	dc.w	$A00E			; base offset $E
	dc.w	$600			; id ???
	dc.w	0

Init
	move.l	D0,A0
	move.w	#$FF00,$DFF034
	move.l	A6,$22(A0)
	rts

; D0 - input
; A6 - resource base

FreePotBits
	and.w	#$5501,D0		; %0101010100000001
	move.w	D0,D1			; %0101010100000001
	add.w	D1,D1			; %1010101000000010
	and.w	#$AA00,D1		; %1010101000000000
	or.w	D1,D0			; %1111111000000001
	not.w	D0			; %0000000111111110
	and.w	D0,$26(A6)
	rts

; D0 - input
; A6 - resource base

AllocPotBits
	bsr.b	AddPot
	move.w	$26(A6),D1
	move.w	D1,-(SP)
	and.w	#$5500,D1
	add.w	D1,D1
	or.w	(SP),D1
	not.w	D1
	and.w	D1,D0
	btst	#0,D0
	beq.b	TestPot
	move.w	(SP),D1
	lsr.w	#1,D1
	not.w	D1
	and.w	#$5500,D1
	and.w	(SP),D1
	beq.b	TestPot
	bclr	#0,D0
TestPot
	move.w	(SP)+,D1
	btst	#0,D1
	beq.b	EvenPot
	move.w	D0,D1
	lsr.w	#1,D1
	and.w	#$5500,D0
	and.w	D1,D0
	move.w	D0,D1
	add.w	D1,D1
	or.w	D1,D0
EvenPot
	and.w	#$FF01,D0
	or.w	D0,$26(A6)
SubPot
	subq.b	#1,$126(A0)
	bge.b	More
	move.w	#$C000,$DFF09A
More
	rts

AddPot
	move.l	$22(A6),A0
	move.w	#$4000,$DFF09A
	addq.b	#1,$126(A0)
	rts

; D0 - input
; D1 - input
; A6 - resource base

WritePotgo
	and.w	D1,D0
	not.w	D1
	bsr.b	AddPot
	and.w	D1,$28(A6)
	or.w	$28(A6),D0
	move.w	D0,$DFF034
	clr.b	D0
	move.w	D0,$28(A6)
	bra.b	SubPot

potgoresource.MSG	dc.b	'potgo.resource',0
potgo37428191.MSG	dc.b	'potgo 38.0 (23.1.2012)',$D,$A,0
	cnop	0,4
EndSkip
Don_Adan is offline  
Old 26 January 2012, 14:00   #5
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Here is battmem.resource source.
Original version has one small (?) bug.

Code:
; Resourced version of battmem.resource (39.2) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;lbC03FB50	ILLEGAL
;	dc.l	lbC03FB50
;	dc.l	lbC03FD34
;	dc.l	$1270845
;	dc.l	battmemresour.MSG
;	dc.l	battmem392639.MSG
;	dc.l	lbC03FBD4
;battmemresour.MSG	dc.b	'battmem.resource',0,0
;battclockreso.MSG1	dc.b	'battclock.resource',0,0
;battmem392639.MSG	dc.b	'battmem 39.2 (6.3.92)',$D,$A,0
;lbW03FBA8	dc.w	$FFFF
;	dc.w	lbC03FC2C-lbW03FBA8
;	dc.w	lbC03FC3E-lbW03FBA8
;	dc.w	lbC03FC50-lbW03FBA8
;	dc.w	lbC03FCC2-lbW03FBA8
;	dc.w	$FFFF
;lbW03FBB4	dc.w	$A008
;	dc.w	$800
;	dc.w	$800A
;	dc.l	battmemresour.MSG
;	dc.l	$A00E0600
;	dc.l	$90140027
;	dc.l	$90160002
;	dc.w	$8018
;	dc.l	battmem392639.MSG
;	dc.l	0

;lbC03FBD4	MOVEM.L	D2/A2/A3/A6,-(SP)
;	SUBA.L	A2,A2
;	LEA	battclockreso.MSG1(PC),A1
;	JSR	-$1F2(A6)
;	TST.L	D0
;	BEQ.S	lbC03FC24
;	MOVEA.L	D0,A3
;	LEA	lbW03FBA8(PC),A0
;	LEA	lbW03FBB4(PC),A1
;	SUBA.L	A2,A2
;	MOVEQ	#$5A,D0
;	JSR	-$54(A6)
;	MOVEA.L	D0,A2
;	TST.L	D0
;	BEQ.S	lbC03FC24
;	MOVE.L	#0,$22(A2)	; bug !!! must be move.w or $20(A2)
;	MOVE.L	A6,$24(A2)
;	MOVE.L	A3,$28(A2)
;	LEA	$2C(A2),A0
;	JSR	-$22E(A6)
;	MOVEA.L	A2,A1
;	JSR	-$1E6(A6)
;	MOVEA.L	A2,A6
;	MOVEQ	#0,D1
;	MOVEQ	#1,D2
;	BSR.S	lbC03FC50
;lbC03FC24	MOVE.L	A2,D0
;	MOVEM.L	(SP)+,D2/A2/A3/A6
;	RTS

;lbC03FC2C	LEA	$2C(A6),A0
;	MOVE.L	A6,-(SP)
;	MOVEA.L	$24(A6),A6
;	JSR	-$234(A6)
;	MOVEA.L	(SP)+,A6
;	RT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VE.L	D0,D5
;	MOVE.L	D1,D3
;	MOVE.L	D1,D4
;	ANDI.L	#7,D4
;	LSR.L	#3,D3
;	BEQ.S	lbC03FD08
;	MOVEQ	#8,D2
;lbC03FCF2	MOVE.L	D5,D1
;	MOVE.B	(A2)+,D0
;	MOVE.L	A6,-(SP)
;	MOVEA.L	$28(A6),A6
;	JSR	-$1E(A6)
;	MOVEA.L	(SP)+,A6
;	ADDQ.L	#8,D5
;	SUBQ.L	#1,D3
;	BNE.S	lbC03FCF2
;lbC03FD08	MOVE.L	D4,D2
;	BEQ.S	lbC03FD1C
;	MOVE.L	D5,D1
;	MOVE.B	(A2)+,D0
;	MOVE.L	A6,-(SP)
;	MOVEA.L	$28(A6),A6
;	JSR	-$1E(A6)
;	MOVEA.L	(SP)+,A6
;lbC03FD1C	MOVEM.L	(SP)+,D2-D5/A2
;	LEA	$2C(A6),A0
;	MOVE.L	A6,-(SP)
;	MOVEA.L	$24(A6),A6
;	JSR	-$23A(A6)
;	MOVEA.L	(SP)+,A6
;	MOVEQ	#0,D0
;	RTS

;lbC03FD34

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	1			; flags
	dc.b	$28			; version
	dc.b	8			; type
	dc.b	$45			; priority
	dc.l	battmemresour.MSG	; name
	dc.l	battmem392639.MSG	; id string
	dc.l	InitResource		; init code
Vectors
	dc.w	$FFFF
	dc.w	ObtainBattSemaphore-Vectors	;  -6 _LVOObtainBattSemaphore
	dc.w	ReleaseBattSemaphore-Vectors	; -12 _LVOReleaseBattSemaphore
	dc.w	ReadBattMem-Vectors		; -18 _LVOReadBattMem
	dc.w	WriteBattMem-Vectors		; -24 _LVOWriteBattMem
	dc.w	$FFFF
Structure
	dc.w	$A008			; base offset $8
	dc.w	$0800			; type
	dc.w	$800A			; base offset $A
	dc.l	battmemresour.MSG	; name
	dc.w	$A00E			; base offset $E
	dc.w	$0600			; id ???
	dc.w	$9014			; base offset $14
	dc.w	$0028			; version
	dc.w	$9016			; base offset $16
	dc.w	$0000			; revision
	dc.w	$8018			; base offset $18
	dc.l	battmem392639.MSG	; id string
	dc.w	0			; no more

InitResource
	movem.l	D2/A2/A3/A6,-(SP)
	lea	battclockreso.MSG1(PC),A1
	jsr	-$1F2(A6)		; OpenResource
	tst.l	D0
	beq.b	Quit
	move.l	D0,A3
	lea	Vectors(PC),A0
	lea	Structure(PC),A1
	sub.l	A2,A2
	moveq	#$5A,D0			; dSize
	jsr	-$54(A6)		; MakeLibrary
	tst.l	D0
	beq.b	Quit
	move.l	D0,A2
	lea	$22(A2),A0
	clr.w	(A0)+			; possible bug here
	move.l	A6,(A0)+		; exec base
	move.l	A3,(A0)+		; battclock base, set A0
	jsr	-$22E(A6)		; InitSemaphore
	move.l	A2,A1
	jsr	-$1E6(A6)		; AddResource
	move.l	A2,A6
	moveq	#0,D1
	moveq	#1,D2
	bsr.b	ReadBattMem
	move.l	A2,D0			; resource base
Quit
	movem.l	(SP)+,D2/A2/A3/A6
	rts

ObtainBattSemaphore
	lea	-$234.W,A1
	bra.b	SemaphoreMain		; ObtainSemaphore

ReleaseBattSemaphore
	lea	-$23A.W,A1
SemaphoreMain
	lea	$2C(A6),A0
	move.l	A6,-(SP)
	move.l	$24(A6),A6		; exec base
	jsr	(A6,A1.W)		; ReleaseSemaphore
	move.l	(SP)+,A6
	rts

; D1 - input
; D2 - input
; A6 - resource base

ReadBattMem
	lea	ReadBatt(PC),A1
	bra.b	BattMain

; D1 - input
; D2 - input
; A6 - resource base

WriteBattMem
	lea	WriteBatt(PC),A1
BattMain
	movem.l	D2-D7/A2/A3/A6,-(SP)
	move.l	A0,A2
	move.l	A1,A3
	move.l	D0,D5
	move.l	D1,D3
	lea	$24(A6),A0
	move.l	(A0)+,A6		; exec base
	move.l	(A0)+,D6		; battclock base, set A0
	move.l	A0,D7			; backup A0
	jsr	-$234(A6)		; ObtainSemaphore
	exg	D6,A6			; battclock base
	moveq	#7,D4
	and.l	D3,D4
	lsr.l	#3,D3
	beq.b	SkipBatt
	moveq	#8,D2
LoopBatt
	jsr	(A3)	
	addq.l	#8,D5
	subq.l	#1,D3
	bne.b	LoopBatt
SkipBatt
	move.l	D4,D2
	beq.b	LastBatt
	jsr	(A3)
LastBatt
	exg	D6,A6			; exec base
	move.l	D7,A0
	jsr	-$23A(A6)		; ReleaseSemaphore
	movem.l	(SP)+,D2-D7/A2/A3/A6
	moveq.l	#0,D0
	rts

WriteBatt
	move.l	D5,D1
	move.b	(A2)+,D0		; write
	jmp	-$1E(A6)		; PrivateFunction2

ReadBatt
	move.l	D5,D1
	jsr	-$18(A6)		; PrivateFunction1
	move.b	D0,(A2)+		; read
	rts

battmemresour.MSG	dc.b	'battmem.resource',0
battclockreso.MSG1	dc.b	'battclock.resource',0
battmem392639.MSG	dc.b	'battmem 40.0 (25.1.2012)',$D,$A,0

EndSkip
Don_Adan is offline  
Old 29 January 2012, 15:58   #6
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Optimised potgo.resource, thanks to Mcoder for the help.
Here is A4000 bonus source.

Code:
; Resourced version of A4000 bonus (40.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	1			; flags
	dc.b	$28			; version
	dc.b	0			; type
	dc.b	$65			; priority
	dc.l	A4000bonus.MSG		; name
	dc.l	bonus40115293.MSG	; id string
	dc.l	Init			; init code

Init
	MOVEM.L	D2-D7/A2-A5,-(SP)
	BTST	#2,$129(A6)		; 68030/68040 CPU check
	BEQ.B	Quit
	MOVEQ	#$66,D0
	MOVEQ	#2,D1			; chipmem
	JSR	-$C6(A6)		; AllocMem
	TST.L	D0
	BEQ.B	Quit
	MOVEA.L	D0,A1
	MOVEA.L	D0,A5
	LEA	userFunc(PC),A0
	MOVEQ	#$32,D0
Copy
	MOVE.W	(A0)+,(A1)+
	DBF	D0,Copy
	JSR	-$27C(A6)		; CacheClearU (no input)
	BTST	#3,$129(A6)		; 68040 CPU check
	SEQ	D3			; D3 input
	MOVEQ	#0,D0
	MOVEQ	#-1,D1
	JSR	-$288(A6)		; CacheControl (D0/D1 input)
	MOVE.L	D0,-(SP)		; output
	JSR	-$1E(A6)		; Supervisor (A5 input)
	MOVE.L	(SP)+,D0
	MOVE.L	D0,D1
	JSR	-$288(A6)		; CacheControl (D0/D1 input)
	MOVEA.L	A5,A1
	MOVEQ	#$66,D0
	JSR	-$D2(A6)		; FreeMem
Quit
	MOVEM.L	(SP)+,D2-D7/A2-A5
	MOVEQ	#0,D0
	RTS

userFunc
	ORI.W	#$700,SR
	LEA	$DE0003,A4
	LEA	$7F7FFF0,A3
	MOVEQ	#7,D2
	CMPI.B	#$7F,$40(A4)
	BEQ.B	Exit
	MOVEM.L	(A3),D4-D7
	MOVEA.L	A3,A2
	MOVE.L	A2,(A2)+
	MOVE.L	A2,(A2)+
	MOVE.L	A2,(A2)+
	MOVE.L	A2,(A2)+
	MOVE.L	D2,D0
	OR.B	(A4),D0
	NOP
	MOVE.B	D0,(A4)
Loop1	NOP
	MOVE.B	(A4),D1
	AND.B	D2,D1
	CMP.B	D2,D1
	BNE.B	Loop1
	MOVE.L	D2,D0
	MOVEQ	#3,D1
Compare	CMPA.L	-(A2),A2
	DBNE	D1,Compare
	BNE.B	Skip
	MOVEQ	#4,D0
	AND.B	D3,D0
	ADDQ.L	#1,D0
Skip	NOT.L	D0
	AND.B	(A4),D0
	NOP
	MOVE.B	D0,(A4)
	AND.B	D2,D0
Loop2	NOP
	MOVE.B	(A4),D1
	AND.B	D2,D1
	CMP.B	D0,D1
	BNE.B	Loop2
	MOVEM.L	D4-D7,(A3)
Exit	RTE

A4000bonus.MSG	dc.b	'A4000 bonus',0
bonus40115293.MSG	dc.b	'bonus 40.1 (15.2.93)',$D,$A,0
	dc.b	0
	cnop	0,4
EndSkip
Don_Adan is offline  
Old 01 February 2012, 14:53   #7
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Here is mathffp.library source.

Code:
; Resourced version of mathffp.library (40.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;lbC040944	ILLEGAL
;	dc.l	lbC040944
;	dc.l	lbC040DE0
;	dc.l	$80280988
;	dc.l	mathffplibrar.MSG
;	dc.l	mathffp401163.MSG
;	dc.l	lbL040988
;mathffplibrar.MSG	dc.b	'mathffp.library',0
;mathffp401163.MSG	dc.b	'mathffp 40.1 (16.3.93)',$D,$A,0
;	dc.b	0
;lbL040988	dc.l	$22
;	dc.l	lbW0409C8
;	dc.l	lbW040998
;	dc.l	0
;lbW040998	dc.w	$A008
;	dc.w	$900
;	dc.w	$800A
;	dc.l	mathffplibrar.MSG
;	dc.l	$A00E0600
;	dc.l	$90140028
;	dc.l	$90160001
;	dc.w	$8018
;	dc.l	mathffp401163.MSG
;	dc.w	0

;lbC0409B6	ADDQ.W	#1,$20(A6)
;	MOVE.L	A6,D0
;	RTS

;lbC0409BE	SUBQ.W	#1,$20(A6)
;lbC0409C2	MOVEQ	#0,D0
;	RTS

;	dc.w	0
;lbW0409C8	dc.w	$FFFF
;	dc.w	lbC0409B6-lbW0409C8
;	dc.w	lbC0409BE-lbW0409C8
;	dc.w	lbC0409C2-lbW0409C8
;	dc.w	lbC0409C2-lbW0409C8
;	dc.w	lbC0409EC-lbW0409C8
;	dc.w	lbC040A40-lbW0409C8
;	dc.w	lbC040A78-lbW0409C8
;	dc.w	lbC040AB4-lbW0409C8
;	dc.w	lbC040ADC-lbW0409C8
;	dc.w	lbC040AE2-lbW0409C8
;	dc.w	lbC040B06-lbW0409C8
;	dc.w	lbC040AEC-lbW0409C8
;	dc.w	lbC040BFC-lbW0409C8
;	dc.w	lbC040CC4-lbW0409C8
;	dc.w	lbC040D46-lbW0409C8
;	dc.w	lbC040D3C-lbW0409C8
;	dc.w	$FFFF

;lbC0409EC	MOVE.B	D0,D1
;	BMI.S	lbC040A14
;	BEQ.S	lbC040A04
;	CLR.B	D0
;	SUB.B	#$41,D1
;	BMI.S	lbC040A10
;	SUB.B	#$1F,D1
;	BPL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MOVE.L	D1,D3
;	SWAP	D3
;	CLR.W	D0
;	DIVU.W	D3,D0
;	SWAP	D5
;	BMI.S	lbC040D28
;	MOVE.W	D0,D5
;	ADD.L	D5,D5
;	SUBQ.B	#1,D4
;	MOVE.W	D5,D0
;lbC040D28	MOVE.W	D0,D5
;	ADD.L	#$80,D5
;	MOVE.L	D5,D0
;	MOVE.B	D4,D0
;	BEQ.S	lbC040CBC
;	MOVEM.L	(SP)+,D3-D5
;	RTS

;lbC040D3C	BSR.L	lbC040AE2
;	BSR.S	lbC040D46
;	BRA.L	lbC040AE2

;lbC040D46	MOVE.B	D0,D1
;	BMI.S	lbC040D72
;	BEQ.S	lbC040D6C
;	CLR.B	D0
;	SUB.B	#$41,D1
;	BMI.S	lbC040D6E
;	SUB.B	#$1F,D1
;	BPL.S	lbC040D62
;	NEG.B	D1
;	LSR.L	D1,D0
;	LSL.L	D1,D0
;	NEG.B	D1
;lbC040D62	ADD.B	#$1F,D1
;	ADD.B	#$41,D1
;	MOVE.B	D1,D0
;lbC040D6C	RTS

;lbC040D6E	MOVEQ	#0,D0
;	RTS

;lbC040D72	BSR.L	lbC040AE2
;	MOVE.L	D0,-(SP)
;	BSR.S	lbC040D46
;	MOVE.L	D0,-(SP)
;	MOVE.L	D0,D1
;	MOVE.L	4(SP),D0
;	BSR.L	lbC040AEC
;	MOVEM.L	(SP),D0
;	BEQ.S	lbC040D96
;	MOVE.L	#$80000041,D1
;	BSR.L	lbC040B06
;lbC040D96	ADDQ.L	#8,SP
;	BRA.L	lbC040AE2

;	dc.b	'MC68343 FLOATING POINT FIRMWARE(C) COPYRIGHT'
;	dc.b	' 1981 BY MOTOROLA INC.',0,0

;lbC040DE0

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	$80			; flags
	dc.b	$29			; version
	dc.b	9			; type
	dc.b	$88			; priority
	dc.l	mathffplibrar.MSG	; name
	dc.l	mathffp401163.MSG	; id string
	dc.l	MakeLibrary
MakeLibrary
	dc.l	$22			; dSize
	dc.l	Vectors
	dc.l	Structure
	dc.l	0			; Init
Structure
	dc.w	$A008			; base offset $8
	dc.w	$900			; type
	dc.w	$800A			; base offset $A
	dc.l	mathffplibrar.MSG	; name
	dc.w	$A00E			; base offset $E
	dc.w	$0600			; id ???
	dc.w	$9014			; base offset $14
	dc.w	$0029			; version
	dc.w	$9016			; base offset $16
	dc.w	$0000			; revision
	dc.w	$8018			; base offset $18
	dc.l	mathffp401163.MSG	; id string
	dc.w	0			; no more

LibOpen
	addq.w	#1,$20(A6)
	move.l	A6,D0
	rts

Vectors	dc.w	$FFFF
	dc.w	LibOpen-Vectors			;  -6 _LVOLibOpen
	dc.w	LibClose-Vectors		; -12 _LVOLibClose
	dc.w	LibExpunge-Vectors		; -18 _LVOLibExpunge
	dc.w	LibReserved-Vectors		; -24 _LVOLibReserved
	dc.w	SPFix-Vectors			; -30 * _LVOSPFix
	dc.w	SPFlt-Vectors			; -36 _LVOSPFlt
	dc.w	SPCmp-Vectors			; -42 * _LVOSPCmp
	dc.w	SPTst-Vectors			; -48 * _LVOSPTst
	dc.w	SPAbs-Vectors			; -54 * _LVOSPAbs
	dc.w	SPNeg-Vectors			; -60 * _LVOSPNeg
	dc.w	SPAdd-Vectors			; -66 _LVOSPAdd
	dc.w	SPSub-Vectors			; -72 _LVOSPSub
	dc.w	SPMul-Vectors			; -78 * _LVOSPMul
	dc.w	SPDiv-Vectors			; -84 * _LVOSPDiv
	dc.w	SPFloor-Vectors			; -90 * _LVOSPFloor
	dc.w	SPCeil-Vectors			; -96 * _LVOSPCeil
	dc.w	$FFFF


SPFlt	MOVEQ	#$5F,D1
	TST.L	D0
	BEQ.B	FltZero
	BPL.B	FltPlus
	MOVEQ	#-$20,D1
	NEG.L	D0
	BVS.B	FltBvs
	SUBQ.B	#1,D1
FltPlus	CMP.L	#$7FFF,D0
	BHI.B	FltDBMI
	SWAP	D0
	SUB.B	#$10,D1
FltDBMI	ADD.L	D0,D0
	DBMI	D1,FltDBMI
	TST.B	D0
	BPL.B	FltBvs
	ADD.L	#$100,D0
	BCC.B	FltBvs
	ROXR.L	#1,D0
	ADDQ.B	#1,D1
FltBvs	MOVE.B	D1,D0
FltZero	RTS


SPCmp	tst.b	D1
	bpl.b	PlusCmp
	tst.b	D0
	bpl.b	PlusCmp
	exg	D0,D1
PlusCmp
	cmp.b	D1,D0
	bne.b	TestCmp
	cmp.l	D1,D0
TestCmp
	bsr.b	GetCC
	blt.b	OneCmp
	bgt.b	MinusOneCmp
ZeroCmp
	moveq	#0,D0
	bra.b	QuitCmp

MinusOneCmp
	moveq	#-1,D0
	bra.b	QuitCmp
OneCmp
	moveq	#1,D0
	bra.b	QuitCmp
GetCC
	pea	(A6)
	move.l	4.W,A6
	jsr	-$210(A6)			; GetCC
	move.l	(SP)+,A6
	move.w	D0,D1
QuitCmp
	move.w	D1,CCR
	rts


SPTst
	tst.b	D1
	bsr.b	GetCC
	blt.b	MinusOneCmp
	bgt.b	OneCmp
	bra.b	ZeroCmp


SPAbs	and.b	#$7F,D0
	rts


SPDiv
	movem.l	D3-D5,-(SP)
	move.b	D1,D5
	beq.b	DivZero
	move.l	D0,D4
	beq.b	DivQuit
	moveq	#-$80,D3
	add.w	D5,D5
	add.w	D4,D4
	eor.b	D3,D5
	eor.b	D3,D4
	sub.b	D5,D4
	bvs.b	DivOflow
	clr.b	D0
	swap	D0
	swap	D1
	cmp.w	D1,D0
	bmi.b	DivMinus
	addq.b	#2,D4
	bvs.b	DivOverflow
	ror.l	#1,D0
DivMinus
	swap	D0
	move.b	D3,D5
	eor.w	D5,D4
	lsr.w	#1,D4
	move.l	D0,D3
	divu.w	D1,D3
	move.w	D3,D5
	mulu.w	D1,D3
	sub.l	D3,D0
	swap	D0
	swap	D1
	move.w	D1,D3
	clr.b	D3
	mulu.w	D5,D3
	sub.l	D3,D0
	bcc.b	DivOK
DivMore
	subq.w	#1,D5
	add.l	D1,D0
	bcc.b	DivMore
DivOK
	move.l	D1,D3
	swap	D3
	clr.w	D0
	divu.w	D3,D0
	swap	D5
	bmi.b	DivNorm
	move.w	D0,D5
	add.l	D5,D5
	subq.b	#1,D4
	move.w	D5,D0
DivNorm
	move.w	D0,D5
	add.l	#$80,D5
	move.l	D5,D0
	move.b	D4,D0
	beq.b	DivUnder
DivQuit
	movem.l	(SP)+,D3-D5
	rts

DivZero
	divu.w	#0,D0			; call divide by zero handler
	bra.b	DivSkip
DivOverflow
	swap	D1
	swap	D0
DivFlow
	eor.b	D1,D0
DivSkip
	or.l	#$FFFFFF7F,D0
	tst.b	D0
	or.b	#2,CCR			; SET OVERFLOW BIT ON
	bra.b	DivQuit

MulUnder
DivOflow
	bmi.b	DivFlow
MulZero
DivUnder
	moveq	#0,D0
	bra.b	DivQuit

MulNorma
	subq.b	#1,D5
	bvs.b	MulZero
	bcs.b	MulZero
	moveq	#$40,D4
	add.l	D4,D0
	add.l	D0,D0
	bcc.b	MulNumber
	roxr.l	#1,D0
	addq.b	#1,D5
MulNumber
	move.b	D5,D0
	beq.b	MulZero
	bra.b	MulQuit


SPMul
	movem.l	D3-D5,-(SP)
	move.b	D0,D5
	beq.b	MulQuit
	move.b	D1,D4
	beq.b	MulZero
	add.w	D5,D5
	add.w	D4,D4
	moveq	#-$80,D3
	eor.b	D3,D4
	eor.b	D3,D5
	add.b	D4,D5
	bvs.b	MulUnder
	move.b	D3,D4
	eor.w	D4,D5
	ror.w	#1,D5
	swap	D5
	move.w	D1,D5
	clr.b	D0
	clr.b	D5
	move.w	D5,D4
	mulu.w	D0,D4
	swap	D4
	move.l	D0,D3
	swap	D3
	mulu.w	D5,D3
	add.l	D3,D4
	swap	D1
	move.l	D1,D3
	mulu.w	D0,D3
	add.l	D3,D4
	clr.w	D4
	addx.b	D4,D4
	swap	D4
	swap	D0
	mulu.w	D1,D0
	swap	D1
	swap	D5
	add.l	D4,D0
	bpl.b	MulNorma
	add.l	#$80,D0
	move.b	D5,D0
	beq.b	MulZero
MulQuit
	movem.l	(SP)+,D3-D5
	rts

SPFix
	move.b	D0,D1
	bmi.b	FixMinus
	beq.b	FixQuit
	sub.b	#$41,D1
	bmi.b	Zero
	sub.b	#$1F,D1
	bpl.b	FixPlus
	clr.b	D0
	neg.b	D1
	lsr.l	D1,D0
FixQuit
	rts

FixPlus
	moveq	#-1,D0
	lsr.l	#1,D0
	bra.b	FixCCR

FixMinus
	sub.b	#$C1,D1
	bmi.b	Zero
	clr.b	D0
	sub.b	#$1F,D1
	bpl.b	FixOflow
	neg.b	D1
	lsr.l	D1,D0
	neg.l	D0
	rts

FixOflow
	bne.b	FixOver
	neg.l	D0
	bmi.b	FixQuit
FixOver
	moveq	#1,D0
	ror.l	#1,D0
FixCCR
	or.b	#2,CCR			; SET OVERFLOW BIT ON
	rts

LibClose
	subq.w	#1,$20(A6)
LibReserved
LibExpunge
Zero
	moveq	#0,D0
	rts


SPCeil	bsr.b	SPNeg
	bsr.b	SPFloor


SPNeg	tst.b	D0
	beq.b	ZeroNeg
	eor.b	#$80,D0
ZeroNeg
	rts


SPFloor
	move.b	D0,D1
	bmi.b	MinusFloor
	beq.b	QuitFloor
	sub.b	#$41,D1
	bmi.b	Zero
	sub.b	#$1F,D1
	bpl.b	PlusFloor
	neg.b	D1
	lsr.l	D1,D0
	lsl.l	D1,D0
	neg.b	D1
PlusFloor
	add.b	#$60,D1
	move.b	D1,D0
QuitFloor
	rts

MinusFloor
	bsr.b	SPNeg
	move.l	D0,-(SP)
	bsr.b	SPFloor
	move.l	(SP),D1
	exg	D0,D1
	move.l	D1,-(SP)
	bsr.b	SPSub
	movem.l	(SP)+,D0/D1
	beq.b	SPNeg
	move.l	#$80000041,D1
	bsr.b	SPAdd
	bra.b	SPNeg

SPSub
	movem.l	D3-D5,-(SP)
	moveq	#-128,D3
	move.b	D1,D4
	beq.b	NoChange
	eor.b	D3,D4
	bmi.b	Minus1
	move.b	D0,D5
	bmi.b	Minus2
	bne.b	Back1
Result
	move.l	D1,D0
	bra.b	Restore

Large	cmp.b	#$E8,D5
	ble.b	Result
	neg.b	D5
	clr.b	D0
	lsr.l	D5,D0
	move.l	D1,D5
	move.b	D3,D5
	add.l	D5,D0
	bcs.b	Carry
	bra.b	Restore

NoChange
	tst.b	D0
	bra.b	QuitAdd

SPAdd	movem.l	D3-D5,-(SP)
	moveq	#-128,D3
	move.b	D1,D4
	bmi.b	Minus1
	beq.b	NoChange
	move.b	D0,D5
	bmi.B	Minus2
	beq.b	Result
Back1
	sub.b	D4,D5
	bmi.b	Large
	move.b	D0,D4
	cmp.b	#$18,D5
	bcc.b	NoChange
	move.b	D3,D0
	move.l	D1,D3
	clr.b	D3
	lsr.l	D5,D3
	add.l	D3,D0
	bcs.b	Carry
Restore
	move.b	D4,D0
QuitAdd
	movem.l	(SP)+,D3-D5
	rts

Carry
	roxr.l	#1,D0
	addq.b	#1,D4
	bvs.b	Overflow
	bcc.b	Restore
Overflow
	moveq	#-1,D0
	subq.b	#1,D4
	move.b	D4,D0
	or.b	#2,CCR
	bra.b	QuitAdd

Minus1	move.b	D0,D5
	bmi.b	Back1
	beq.b	Result
Minus2
	eor.b	D3,D5
	sub.b	D4,D5
	beq.b	Equal
	bmi.b	Large2
	cmp.b	#$18,D5
	bcc.b	NoChange
	move.b	D0,D4
	move.b	D3,D0
	move.l	D1,D3
Back2	clr.b	D3
	lsr.l	D5,D3
	sub.l	D3,D0
	bmi.b	Restore
Back3	move.b	D4,D5
Back4	clr.b	D0
	subq.b	#1,D4
	cmp.l	#$7FFF,D0
	bhi.b	Shift
	swap	D0
	sub.b	#$10,D4
Shift	add.l	D0,D0
	dbmi	D4,Shift
	eor.b	D4,D5
	bmi.b	Under
	move.b	D4,D0
	bne.b	QuitAdd
Under
	moveq	#0,D0
	bra.b	QuitAdd

Large2	cmp.b	#$E8,D5
	ble.w	Result
	neg.b	D5
	move.l	D0,D3
	move.l	D1,D0
	move.b	#$80,D0
	bra.b	Back2

Equal	move.b	D0,D5
	exg	D5,D4
	move.b	D1,D0
	sub.l	D1,D0
	beq.b	Under
	bpl.b	Back3
	neg.l	D0
	move.b	D5,D4
	bra.b	Back4

mathffplibrar.MSG	dc.b	'mathffp.library',0
mathffp401163.MSG	dc.b	'mathffp 41.0 (1.2.2012)',$D,$A,0

	cnop	0,4
EndSkip
Here are original Motorola's FFP (commented) source code.
Attached Files
File Type: lzx mathffp.lzx (8.1 KB, 243 views)
Don_Adan is offline  
Old 14 February 2012, 14:02   #8
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Misc.resource structures optimised by meynaf. Thanks.

Code:
; Resourced version of misc.resource (37.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Bart 'Kodiak' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;lbC03FE6C	ILLEGAL
;	dc.l	lbC03FE6C
;	dc.l	lbW03FF1C
;	dc.l	$1250846
;	dc.l	miscresource.MSG
;	dc.l	misc3718191.MSG
;	dc.l	lbC03FEAC
;miscresource.MSG	dc.b	'misc.resource',0
;misc3718191.MSG	dc.b	'misc 37.1 (8.1.91)',$D,$A,0
;	dc.b	0
;	dc.b	0
;	dc.b	0

;lbC03FEAC	MOVE.L	A2,-(SP)
;	LEA	lbW03FF14(PC),A0
;	LEA	lbW03FECC(PC),A1
;	SUBA.L	A2,A2
;	MOVEQ	#$32,D0
;	JSR	-$54(A6)
;	TST.L	D0
;	BEQ.S	lbC03FEC8
;	MOVEA.L	D0,A1
;	JSR	-$1E6(A6)
;lbC03FEC8	MOVEA.L	(SP)+,A2
;	RTS

;lbW03FECC	dc.w	$A008
;	dc.w	$800
;	dc.w	$800A
;	dc.l	miscresource.MSG
;	dc.l	$A00E0600
;	dc.l	$90140025
;	dc.l	$90160001
;	dc.w	0

;lbC03FEE4	MOVEA.L	4.W,A0
;	EXG	A0,A6
;	LSL.W	#2,D0
;	MOVE.W	D0,D1
;	ADDQ.B	#1,$127(A6)
;	MOVE.L	$22(A0,D1.W),D0
;	BNE.S	lbC03FEFC
;	MOVE.L	A1,$22(A0,D1.W)
;lbC03FEFC	MOVE.L	A6,-(SP)
;	MOVEA.L	4.W,A6
;	JSR	-$8A(A6)	; Permit - This call is guaranteed to preserve all registers.
;	MOVEA.L	(SP)+,A6
;	EXG	A0,A6
;	RTS

;lbC03FF0C	LSL.W	#2,D0
;	CLR.L	$22(A6,D0.W)
;	RTS

;lbW03FF14	dc.w	$FFFF
;	dc.w	lbC03FEE4-lbW03FF14
;	dc.w	lbC03FF0C-lbW03FF14
;	dc.w	$FFFF
;lbW03FF1C

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	$81			; flags
	dc.b	$26			; version
	dc.b	8			; type
	dc.b	$46			; priority
	dc.l	miscresource.MSG	; name
	dc.l	misc3718191.MSG		; id string
	dc.l	MakeLibrary		; init

MakeLibrary
	dc.l	$32			; $22=struct library, +4.l
	dc.l	Vectors
	dc.l	Structure		; cf. exec/InitStruct
	dc.l	0			; init code (0=none)

Structure
	dc.w	$A608			; off=08, siz=.b, len=6+1
	dc.b	8			; type=resource (8)
	dc.b	0			; pri (9)
	dc.l	miscresource.MSG	; name (a)
	dc.b	6			; flags (e)
	dc.b	0			; pad
	dc.w	$9114			; off=14, siz=.w, len=1+1
	dc.w	38,0			; old 37,1
	dc.w	0			; no more

; D0 - input
; A1 - input
; A6 - resource base

AllocMiscResource
	move.l	A6,-(SP)
	lsl.w	#2,D0
	lea	$22(A6,D0.W),A0
	move.l	4.W,A6
	addq.b	#1,$127(A6)
	move.l	(A0),D0
	bne.b	Permit
	move.l	A1,(A0)
Permit
	jsr	-$8A(A6)	; Permit - This call is guaranteed to preserve all registers.
	move.l	(SP)+,A6
	rts

; D0 - input
; A6 - resource base

FreeMiscResource
	lsl.w	#2,D0
	clr.l	$22(A6,D0.W)
	rts

Vectors
	dc.w	$FFFF
	dc.w	AllocMiscResource-Vectors	;  -6 _LVOAllocMiscResource
	dc.w	FreeMiscResource-Vectors	; -12 _LVOFreeMiscResource
	dc.w	$FFFF

miscresource.MSG	dc.b	'misc.resource',0
misc3718191.MSG	dc.b	'misc 38.0 (13.2.2012)',$D,$A,0
	cnop	0,4
EndSkip
Don_Adan is offline  
Old 17 October 2012, 09:17   #9
apex
Registered User
 
Join Date: Apr 2010
Location: Amigaplanet
Posts: 355
Don, you are the ROMGOD! Thank you for your work...
apex is offline  
Old 17 October 2012, 09:46   #10
mfilos
Paranoid Amigoid

mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 39
Posts: 1,576
All these mini modules, work just fine in my custom 3.9 ROM using also the newest DOS.library without issues!
Keep up the good work mate
mfilos is offline  
Old 19 October 2012, 03:16   #11
Ratte
Registered User
 
Join Date: Sep 2008
Location: Germany
Posts: 315
Quote:
Originally Posted by mfilos View Post
All these mini modules,...
whats next?
wbfind
Ratte is offline  
Old 04 November 2012, 18:24   #12
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Quote:
Originally Posted by Ratte View Post
whats next?
wbfind
If you want, I can try, but I'm lazy and a few busy, due my bet with Phil (10 months to finish). I started to optimise/rework some other ROM parts, f.e. trackdisk device, scsi device, exec library. If you have any ideas, you can always tell me.
Don_Adan is offline  
Old 09 November 2012, 18:01   #13
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Two more ROM-s part is now available.
Wbfind (original in C), especially for Ratte, not tested by me.

Code:
; Resourced version of wbfind (40.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Barry 'Bart' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Bob 'Kodiak' Burns, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;MatchTag
;	ILLEGAL				; match word
;	dc.l	MatchTag		; match tag
;	dc.l	EndSkip			; end skip
;	dc.b	4			; flags
;	dc.b	$28			; version
;	dc.b	0			; type
;	dc.b	$92			; priority
;	dc.l	wbfind4017693.MSG	; name
;	dc.l	wbfind4017693.MSG	; id string
;	dc.l	Init			; init code
;wbfind4017693.MSG	dc.b	'wbfind 40.1 (7.6.93)',$D,$A,0
;	dc.b	'Nq',0
;lbL000034	dc.l	0

;	LEA	lbL000034(PC),A0
;	JMP	lbC0001CE

;lbW000042	dc.w	0

;Init	SUBA.W	#12,SP
;	MOVEM.L	D2/D6/D7/A2-A6,-(SP)
;	MOVEA.L	A6,A5			; exec base
;	MOVE.L	A6,$28(SP)		; exec base
;	LEA	doslibrary.MSG(PC),A1
;	MOVEQ	#$25,D0
;	JSR	-$228(A6)		; open library
;	MOVEA.L	D0,A4			; dos base
;	MOVE.L	D0,$24(SP)		; dos base
;	BEQ.L	lbC000174
;	LEA	lbW000042,A0
;	MOVE.L	A0,D7
;	LEA	lbL000034,A1
;	SUB.L	A1,D7
;	LEA	LIBSworkbench.MSG(PC),A0
;	MOVE.L	A0,D1
;	MOVEQ	#-2,D2
;	MOVEA.L	A4,A6			; dos library
;	JSR	-$54(A6)		; Lock
;	MOVE.L	D0,D6
;	BEQ.S	lbC000092
;	MOVE.L	D6,D1
;	JSR	-$5A(A6)		; UnLock
;	BRA.L	lbC00016C

;lbC000092	LEA	lbW000042,A0
;	MOVE.L	A0,D0
;	LEA	lbL000034,A1
;	SUB.L	A1,D0
;	MOVEQ	#$64,D1
;	ADD.L	D1,D0
;	MOVE.L	#$10001,D1
;	MOVEA.L	A5,A6
;	JSR	-$2AC(A6)			; AllocVec
;	MOVE.L	D0,$20(SP)
;	BEQ.L	lbC00016C
;	MOVEA.L	D0,A1
;	LEA	lbL000034,A0
;	MOVE.L	D7,D0
;	JSR	-$270(A6)
;	JSR	-$27C(A6)
;	MOVEQ	#9,D1
;	MOVEA.L	A4,A6
;	JSR	-$28E(A6)		; LockDosList
;	MOVEA.L	D0,A2
;	BRA.S	lbC00011C

;lbC0000D8	ADDA.L	D7,A3
;	MOVEA.L	A3,A5
;	MOVE.L	$28(A2),D0
;	ASL.L	#2,D0
;	MOVEA.L	D0,A0
;	LEA	1(A0),A4
;	MOVE.B	(A0),D6
;	EXT.W	D6
;	EXT.L	D6
;	BRA.S	lbC0000F2

;lbC0000F0	MOVE.B	(A4)+,(A5)+
;lbC0000F2	MOVE.L	D6,D0
;	SUBQ.L	#1,D6
;	TST.L	D0
;	BNE.S	lbC0000F0
;	LEA	libsworkbench.MSG(PC),A4
;lbC0000FE	MOVE.B	(A4)+,D0
;	MOVE.B	D0,(A5)+
;	BNE.S	lbC0000FE
;	MOVEA.L	$24(SP),A4		; dos base
;	MOVE.L	A3,D1
;	MOVEQ	#-2,D2
;	MOVEA.L	A4,A6
;	JSR	-$54(A6)		; Lock
;	MOVE.L	D0,D6
;	BEQ.S	lbC00011C
;	MOVE.L	D6,D1
;	JSR	-$5A(A6)		; UnLock
;lbC00011C	MOVE.L	A2,D1
;	MOVEQ	#9,D2
;	MOVEA.L	A4,A6
;	JSR	-$2B2(A6)		; NextDosEntry
;	MOVEA.L	D0,A2
;	MOVEA.L	$20(SP),A3
;	TST.L	D0
;	BEQ.S	lbC000134
;	TST.L	D6
;	BEQ.S	lbC0000D8
;lbC000134	MOVEQ	#9,D1
;	MOVEA.L	A4,A6
;	JSR	-$294(A6)		; UnLockDosList
;	MOVEA.L	$28(SP),A5
;	TST.L	D6
;	BEQ.S	lbC000164
;	MOVEA.L	A5,A6			; exec base
;	JSR	-$84(A6)		; Forbid
;	LEA	$FFFFFDD8,A0		; funcOffset A0.W
;	LEA	4(A3),A1
;	MOVE.L	A1,D0			; funcEntry D0
;	MOVEA.L	A5,A1			; library A1
;	JSR	-$1A4(A6)		; SetFunction
;	MOVE.L	D0,(A3)
;	JSR	-$8A(A6)		; Permit
;	BRA.S	lbC00016C

;lbC000164	MOVEA.L	A3,A1
;	MOVEA.L	A5,A6
;	JSR	-$2B2(A6)		; FreeVec
;lbC00016C	MOVEA.L	A4,A1
;	MOVEA.L	A5,A6
;	JSR	-$19E(A6)		; CloseLibrary
;lbC000174	MOVEQ	#0,D0
;	MOVEM.L	(SP)+,D2/D6/D7/A2-A6
;	ADDA.W	#12,SP
;	RTS

;doslibrary.MSG	dc.b	'dos.library',0
;LIBSworkbench.MSG	dc.b	'LIBS:workbench.library',0,0
;libsworkbench.MSG	dc.b	':libs/workbench.library',0
;workbenchlibr.MSG	dc.b	'workbench.library',0

;lbC0001CE	SUBQ.W	#4,SP
;	MOVEM.L	D6/D7/A2-A6,-(SP)
;	MOVE.L	D0,D7
;	MOVEA.L	A1,A4			; library name
;	MOVEA.L	A0,A5
;	MOVEA.L	(A5),A3
;	MOVE.L	A6,$1C(SP)
;	JSR	(A3)
;	MOVE.L	D0,D6
;	BNE.S	lbC00021C
;	LEA	workbenchlibr.MSG(PC),A2
;	BRA.S	lbC0001F0

;lbC0001EC	ADDQ.L	#1,A4
;	ADDQ.L	#1,A2
;lbC0001F0	MOVE.B	(A4),D0
;	BEQ.S	lbC0001F8
;	CMP.B	(A2),D0
;	BEQ.S	lbC0001EC
;lbC0001F8	MOVE.B	(A4),D0
;	CMP.B	(A2),D0
;	BNE.S	lbC00021C
;	LEA	lbW000042,A0
;	MOVE.L	A0,D0
;	LEA	lbL000034,A1
;	SUB.L	A1,D0
;	MOVEA.L	A5,A1
;	ADDA.L	D0,A1
;	MOVE.L	D7,D0
;	MOVEA.L	$1C(SP),A6
;	JSR	(A3)
;	MOVE.L	D0,D6
;lbC00021C	MOVE.L	D6,D0
;	MOVEM.L	(SP)+,D6/D7/A2-A6
;	ADDQ.W	#4,SP
;	RTS

;	dc.w	0

;EndSkip

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	4			; flags
	dc.b	$29			; version
	dc.b	0			; type
	dc.b	$92			; priority
	dc.l	wbfind4017693.MSG	; name
	dc.l	wbfind4017693.MSG	; id string
	dc.l	Init			; init code

BaseWB
	dc.l	0
	lea	BaseWB(PC),A0
	jmp	NewOpenLibrary		; don't optimise/change this !!!
BaseWBEnd

Init
	movem.l	D2/D6/D7/A3-A6,-(SP)
	move.l	A6,A5			; exec base
	moveq	#4,D0			; dos library
	jsr	-$32A(A6)		; TaggedOpenLibrary
	move.l	D0,D7			; dos base
	beq.b	Error
	lea	LIBSworkbench.MSG(PC),A0
	move.l	A0,D1
	moveq	#-2,D2
	move.l	D7,A6			; dos base
	jsr	-$54(A6)		; Lock
	move.l	D0,D6
	beq.b	AllocVec
	move.l	D6,D1
	jsr	-$5A(A6)		; UnLock
	move.l	A5,A6
	bra.b	Close

AllocVec
	moveq	#$64+(BaseWBEnd-BaseWB),D0
	move.l	#$10001,D1		; cleared chip mem
	move.l	A5,A6
	jsr	-$2AC(A6)		; AllocVec
	tst.l	D0
	beq.b	Close
	move.l	D0,A3
	move.l	D0,A1
	lea	BaseWB(PC),A0
	moveq	#(BaseWBEnd-BaseWB),D0
	jsr	-$270(A6)		; CopyMem
	jsr	-$27C(A6)		; CacheClearU
	moveq	#9,D1
	move.l	D7,A6			; dos base
	jsr	-$28E(A6)		; LockDosList
	move.l	D0,A4
	bra.b	Next

Free
	move.l	A3,A1
	move.l	A5,A6
	jsr	-$2B2(A6)		; FreeVec
Close
	move.l	D7,A1
	jsr	-$19E(A6)		; CloseLibrary
	moveq	#0,D0
Error
	movem.l	(SP)+,D2/D6/D7/A3-A6
	rts

Loop
	lea	BaseWBEnd-BaseWB(A3),A1	; destination
	move.l	A1,D1			; for Lock
	move.l	$28(A4),A0
	add.l	A0,A0
	add.l	A0,A0
	moveq	#0,D0
	move.b	(A0)+,D0		; source
	bra.b	DoCopy

CopyName
	move.b	(A0)+,(A1)+
DoCopy
	dbf	D0,CopyName
	lea	libsworkbench.MSG(PC),A0
Copy
	move.b	(A0)+,(A1)+
	bne.b	Copy
	moveq	#-2,D2
	jsr	-$54(A6)		; Lock
	move.l	D0,D6
	beq.b	Next
	move.l	D6,D1
	jsr	-$5A(A6)		; UnLock
Next
	move.l	A4,D1
	moveq	#9,D2
	jsr	-$2B2(A6)		; NextDosEntry
	tst.l	D0
	beq.b	Unlock
	move.l	D0,A4
	tst.l	D6
	beq.b	Loop
Unlock
	moveq	#9,D1
	jsr	-$294(A6)		; UnLockDosList
	tst.l	D6
	beq.b	Free
	move.l	A5,A6			; exec base
	jsr	-$84(A6)		; Forbid
	lea	-552.W,A0		; funcOffset A0.W
	move.l	A3,D0
	addq.l	#4,D0			; funcEntry D0
	move.l	A5,A1			; library A1
	jsr	-$1A4(A6)		; SetFunction
	move.l	D0,(A3)
	jsr	-$8A(A6)		; Permit
	bra.b	Close

; D0 - input (lib version)
; A0 - input (BaseWB)
; A1 - input (lib name)
; D0 - output (lib base)

NewOpenLibrary
	movem.l	D0/A0/A1,-(SP)
	move.l	(A0),A0
	jsr	(A0)
	move.l	D0,D1
	beq.b	Extra
NoFound
	lea	12(SP),SP
	rts
Extra
	moveq	#17,D1			; size of library name
	move.l	8(SP),A0
	lea	workbenchlibr.MSG(PC),A1
CheckName
	cmpm	(A0)+,(A1)+
	bne.b	NoFound
	dbf	D1,CheckName
	movem.l	(SP)+,D0/A0/A1
	lea	BaseWBEnd-BaseWB(A0),A1
	move.l	(A0),A0
	jmp	(A0)

LIBSworkbench.MSG	dc.b	'LIBS:workbench.library',0
libsworkbench.MSG	dc.b	':libs/'
workbenchlibr.MSG	dc.b	'workbench.library',0

wbfind4017693.MSG	dc.b	'wbfind 41.0 (5.9.2012)',$D,$A,0
	cnop	0,4
EndSkip
Here is wbtask (original in ASM), not tested by me. Thanks to Thor for help.

Code:
; Resourced version of wbtask (39.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Barry 'Bart' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Bob 'Kodiak' Burns, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;MatchTag
;	ILLEGAL				; match word
;	dc.l	MatchTag		; match tag
;	dc.l	EndSkip			; end skip
;	dc.b	0			; flags
;	dc.b	$27			; version
;	dc.b	1			; type
;	dc.b	$88			; priority
;	dc.l	workbenchtask.MSG	; name
;	dc.l	wbtag39120492.MSG	; id string
;	dc.l	Init			; init code

;Init
;	dc.l	0
;	MOVEQ	#0,D2
;	BRA.S	lbC03FF4E

;	dc.l	0
;	MOVEQ	#1,D2
;	BRA.S	lbC03FF4E

;	dc.l	0
;	MOVEQ	#2,D2
;lbC03FF4E	MOVEM.L	D2/A2/A3/A6,-(SP)
;	MOVEA.L	4.W,A6
;	MOVEA.L	$114(A6),A2
;	LEA	workbenchtask.MSG(PC),A0
;	MOVE.L	A0,10(A2)
;	CMPI.W	#2,D2
;	BNE.S	lbC03FF7A
;	LEA	$5C(A2),A0
;	JSR	-$180(A6)		; WaitPort
;	LEA	$5C(A2),A0
;	JSR	-$174(A6)		; GetMsg
;	MOVEA.L	D0,A3
;lbC03FF7A	MOVEQ	#10,D0		; workbench library
;	JSR	-$32A(A6)		; TaggedOpenLibrary
;	TST.L	D0
;	BEQ.S	lbC03FFA8
;	MOVEA.L	D0,A6			; workbench library base
;	CMPI.W	#2,D2
;	BEQ.S	lbC03FF92
;	MOVE.W	D2,D0
;	MOVEQ	#0,D1
;	BRA.S	lbC03FF9A

;lbC03FF92	MOVE.L	$18(A3),D0
;	MOVE.L	$14(A3),D1
;lbC03FF9A	JSR	-$2A(A6)	; workbench LVO's
;	MOVEA.L	A6,A1			; workbench library base
;	MOVEA.L	4.W,A6
;	JSR	-$19E(A6)		; CloseLibrary
;lbC03FFA8	CMPI.W	#2,D2
;	BNE.S	lbC03FFB4
;	MOVEA.L	A3,A1
;	JSR	-$17A(A6)		; ReplyMsg
;lbC03FFB4	MOVEM.L	(SP)+,D2/A2/A3/A6
;	RTS

;workbenchtask.MSG	dc.b	'workbench.task',0
;wbtag39120492.MSG	dc.b	'wbtag 39.1 (20.4.92)',$D,$A,0
;EndSkip

MatchTag
	ILLEGAL				; match word
	dc.l	MatchTag		; match tag
	dc.l	EndSkip			; end skip
	dc.b	0			; flags
	dc.b	$28			; version
	dc.b	1			; type
	dc.b	$88			; priority
	dc.l	workbenchtask.MSG	; name
	dc.l	wbtag39120492.MSG	; id string
	dc.l	Init			; init code

; The reason for the "NULL" bytes is that this is a "fake" segment list, 
; which is because loadwb (at least up to v34) started
; the workbench via CreateProc(). Thus, the init pointer does not point to 
; code to be executed in this case, but it is rather picked
; up by loadwb, divided by four and passed into CreateProc() for starting 
; the workbench task (actually, process). An offset is added
; to this BPTR to implement various workbench parameters, i.e. "loadwb 
; -debug" uses another entry point, loads d2 with a different
; value, and by that, configures the workbench differently through its 
; init function.

; D2 is used as an input register to specify how the workbench is loaded, 
; i.e. which options it was loaded with.

Init
	dc.l	0
	moveq	#0,D2
	bra.b	TaskMe

	dc.l	0
	moveq	#1,D2
	bra.b	TaskMe

	dc.l	0
	moveq	#2,D2
TaskMe
	movem.l	D2/D3/A2/A6,-(SP)
	move.l	4.W,A6
	moveq	#10,D0			; workbench library
	jsr	-$32A(A6)		; TaggedOpenLibrary
	move.l	D0,D3			; workbench lib base
	beq.b	Quit
	move.l	$114(A6),A2
	lea	workbenchtask.MSG(PC),A0
	move.l	A0,10(A2)
	move.l	D2,D0
	moveq	#0,D1
	subq.w	#2,D2
	bne.b	Private
	lea	$5C(A2),A0
	jsr	-$180(A6)		; WaitPort
	lea	$5C(A2),A0
	jsr	-$174(A6)		; GetMsg
	move.l	D0,A2
	move.l	$14(A2),D1
	move.l	$18(A2),D0
Private
	exg	D3,A6			; workbench lib base
	jsr	-$2A(A6)		; wb private LVO
	move.l	A6,A1
	exg	D3,A6			; exec base
	jsr	-$19E(A6)		; CloseLibrary
	tst.w	D2
	bne.b	Quit
	move.l	A2,A1
	jsr	-$17A(A6)		; ReplyMsg
Quit
	movem.l	(SP)+,D2/D3/A2/A6
	rts

workbenchtask.MSG	dc.b	'workbench.task',0
wbtag39120492.MSG	dc.b	'wbtag 40.0 (8.11.2012)',$D,$A,0
EndSkip
Don_Adan is offline  
Old 10 November 2012, 12:06   #14
Arnie
R.I.P Smudge 18-08-16

Arnie's Avatar
 
Join Date: Aug 2005
Location: Leicester/UK
Age: 60
Posts: 3,862
Nice work

Any chance of carddisk.resource to include CF0: in the boot menu ?
Arnie is offline  
Old 10 November 2012, 14:18   #15
mfilos
Paranoid Amigoid

mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 39
Posts: 1,576
Tested these modules as well and work like a charm

@Arnie
It's not that simple mate.
You also need a modified compactflash.device which certainly needs permissions from the author.
mfilos is offline  
Old 10 November 2012, 18:40   #16
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Quote:
Originally Posted by Arnie View Post
Nice work

Any chance of carddisk.resource to include CF0: in the boot menu ?
I want to rework of carddisk.resource to, but I don't know if I'm good enough to add support for CF0: in bootmenu. This is dependent to some things.
Don_Adan is offline  
Old 10 November 2012, 20:04   #17
Arnie
R.I.P Smudge 18-08-16

Arnie's Avatar
 
Join Date: Aug 2005
Location: Leicester/UK
Age: 60
Posts: 3,862
Quote:
Originally Posted by mfilos View Post
Tested these modules as well and work like a charm

@Arnie
It's not that simple mate.
You also need a modified compactflash.device which certainly needs permissions from the author.
Hi mfilos,

What's wrong with the compactflash.device... i.e., what needs to be altered?

Messing around with the carddisk.resource in hex editor, I managed to get CF0: in the boot menu but the parameters for CF cards are for CC0: and I don't know how to change them?

I could get the 3.9 rom to boot in WinUAE but not in my Amiga 600 so I couldn't test it to see if it booted CF0:

Last edited by Arnie; 14 February 2013 at 22:44.
Arnie is offline  
Old 11 November 2012, 23:03   #18
Ratte
Registered User
 
Join Date: Sep 2008
Location: Germany
Posts: 315
Quote:
Originally Posted by Don_Adan View Post
Here is A4000 bonus source.

Code:
; Resourced version of A4000 bonus (40.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
 
....
 
A4000bonus.MSG    dc.b    'A4000 bonus',0
bonus40115293.MSG    dc.b    'bonus 40.1 (15.2.93)',$D,$A,0
    dc.b    0
    cnop    0,4
EndSkip
A4000 & A3000 are equal.

Better start helping aros68k ...
Ratte is offline  
Old 17 November 2012, 16:59   #19
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 938
Quote:
Originally Posted by Ratte View Post
A4000 & A3000 are equal.
I know, both versions are identical except ID string. This ROM part is perhaps used by some programs to detect A3000 and A4000.

Quote:
Originally Posted by Ratte View Post
Better start helping aros68k ...
I know only 68K ASM, and don't want to learn C.

Optimised version of wbfind is available.

Code:
; Resourced version of wbfind (40.1) from Amiga ROM 3.1 for Amiga68k ROM 1.0
; For easy recognition all changes are done using lower cases and ";" signs
; Original code is removed with ";" signs
; New code is added using lower cases only

; We made it...
; OS Group: Bryce Nesbitt, Michael Sinz, Peter Cherna, Darren Greenwald, Randell Jesup, Jerry Horanoff
; GFX: Allan Havemose, Barry 'Bart' Whitebook, Spence Shanson, Steve Beats, Chris Green, Ray Brand, Jim Barkley
; Special Projects: Eric Cotton, Martin Hunt, Bill Koester, Martin Taillefer, Brian Jackson, Kaori Kuwata, David Junod, Palmyra Pawlik, Kevin Klop
; NET: Brian Jackson, Greg Miller, Kenneth Dyke
; GUI: Peter Cherna, Martin Taillefer, David Junod, Kaori Kuwata
; Others: Andy Finkel, Dale 'Duck' Luck, Jim 'Jimm' Mackraz, Bob 'Kodiak' Burns, Jeff Porter, Carolyn Scheppner, David Haynie,
; Lauren Brown, CATS (Commodore Amiga Technical Support), QA (Quality Assurance), SA (Software Assurance)
; Thanks to: Bill Hawes, Software Distillery
; Better than ever.

;MatchTag
;    ILLEGAL                ; match word
;    dc.l    MatchTag        ; match tag
;    dc.l    EndSkip            ; end skip
;    dc.b    4            ; flags
;    dc.b    $28            ; version
;    dc.b    0            ; type
;    dc.b    $92            ; priority
;    dc.l    wbfind4017693.MSG    ; name
;    dc.l    wbfind4017693.MSG    ; id string
;    dc.l    Init            ; init code
;wbfind4017693.MSG    dc.b    'wbfind 40.1 (7.6.93)',$D,$A,0
;    dc.b    'Nq',0
;lbL000034    dc.l    0

;    LEA    lbL000034(PC),A0
;    JMP    lbC0001CE

;lbW000042    dc.w    0

;Init    SUBA.W    #12,SP
;    MOVEM.L    D2/D6/D7/A2-A6,-(SP)
;    MOVEA.L    A6,A5            ; exec base
;    MOVE.L    A6,$28(SP)        ; exec base
;    LEA    doslibrary.MSG(PC),A1
;    MOVEQ    #$25,D0
;    JSR    -$228(A6)        ; open library
;    MOVEA.L    D0,A4            ; dos base
;    MOVE.L    D0,$24(SP)        ; dos base
;    BEQ.L    lbC000174
;    LEA    lbW000042,A0
;    MOVE.L    A0,D7
;    LEA    lbL000034,A1
;    SUB.L    A1,D7
;    LEA    LIBSworkbench.MSG(PC),A0
;    MOVE.L    A0,D1
;    MOVEQ    #-2,D2
;    MOVEA.L    A4,A6            ; dos library
;    JSR    -$54(A6)        ; Lock
;    MOVE.L    D0,D6
;    BEQ.S    lbC000092
;    MOVE.L    D6,D1
;    JSR    -$5A(A6)        ; UnLock
;    BRA.L    lbC00016C

;lbC000092    LEA    lbW000042,A0
;    MOVE.L    A0,D0
;    LEA    lbL000034,A1
;    SUB.L    A1,D0
;    MOVEQ    #$64,D1
;    ADD.L    D1,D0
;    MOVE.L    #$10001,D1
;    MOVEA.L    A5,A6
;    JSR    -$2AC(A6)            ; AllocVec
;    MOVE.L    D0,$20(SP)
;    BEQ.L    lbC00016C
;    MOVEA.L    D0,A1
;    LEA    lbL000034,A0
;    MOVE.L    D7,D0
;    JSR    -$270(A6)
;    JSR    -$27C(A6)
;    MOVEQ    #9,D1
;    MOVEA.L    A4,A6
;    JSR    -$28E(A6)        ; LockDosList
;    MOVEA.L    D0,A2
;    BRA.S    lbC00011C

;lbC0000D8    ADDA.L    D7,A3
;    MOVEA.L    A3,A5
;    MOVE.L    $28(A2),D0
;    ASL.L    #2,D0
;    MOVEA.L    D0,A0
;    LEA    1(A0),A4
;    MOVE.B    (A0),D6
;    EXT.W    D6
;    EXT.L    D6
;    BRA.S    lbC0000F2

;lbC0000F0    MOVE.B    (A4)+,(A5)+
;lbC0000F2    MOVE.L    D6,D0
;    SUBQ.L    #1,D6
;    TST.L    D0
;    BNE.S    lbC0000F0
;    LEA    libsworkbench.MSG(PC),A4
;lbC0000FE    MOVE.B    (A4)+,D0
;    MOVE.B    D0,(A5)+
;    BNE.S    lbC0000FE
;    MOVEA.L    $24(SP),A4        ; dos base
;    MOVE.L    A3,D1
;    MOVEQ    #-2,D2
;    MOVEA.L    A4,A6
;    JSR    -$54(A6)        ; Lock
;    MOVE.L    D0,D6
;    BEQ.S    lbC00011C
;    MOVE.L    D6,D1
;    JSR    -$5A(A6)        ; UnLock
;lbC00011C    MOVE.L    A2,D1
;    MOVEQ    #9,D2
;    MOVEA.L    A4,A6
;    JSR    -$2B2(A6)        ; NextDosEntry
;    MOVEA.L    D0,A2
;    MOVEA.L    $20(SP),A3
;    TST.L    D0
;    BEQ.S    lbC000134
;    TST.L    D6
;    BEQ.S    lbC0000D8
;lbC000134    MOVEQ    #9,D1
;    MOVEA.L    A4,A6
;    JSR    -$294(A6)        ; UnLockDosList
;    MOVEA.L    $28(SP),A5
;    TST.L    D6
;    BEQ.S    lbC000164
;    MOVEA.L    A5,A6            ; exec base
;    JSR    -$84(A6)        ; Forbid
;    LEA    $FFFFFDD8,A0        ; funcOffset A0.W
;    LEA    4(A3),A1
;    MOVE.L    A1,D0            ; funcEntry D0
;    MOVEA.L    A5,A1            ; library A1
;    JSR    -$1A4(A6)        ; SetFunction
;    MOVE.L    D0,(A3)
;    JSR    -$8A(A6)        ; Permit
;    BRA.S    lbC00016C

;lbC000164    MOVEA.L    A3,A1
;    MOVEA.L    A5,A6
;    JSR    -$2B2(A6)        ; FreeVec
;lbC00016C    MOVEA.L    A4,A1
;    MOVEA.L    A5,A6
;    JSR    -$19E(A6)        ; CloseLibrary
;lbC000174    MOVEQ    #0,D0
;    MOVEM.L    (SP)+,D2/D6/D7/A2-A6
;    ADDA.W    #12,SP
;    RTS

;doslibrary.MSG    dc.b    'dos.library',0
;LIBSworkbench.MSG    dc.b    'LIBS:workbench.library',0,0
;libsworkbench.MSG    dc.b    ':libs/workbench.library',0
;workbenchlibr.MSG    dc.b    'workbench.library',0

;lbC0001CE    SUBQ.W    #4,SP
;    MOVEM.L    D6/D7/A2-A6,-(SP)
;    MOVE.L    D0,D7
;    MOVEA.L    A1,A4            ; library name
;    MOVEA.L    A0,A5
;    MOVEA.L    (A5),A3
;    MOVE.L    A6,$1C(SP)
;    JSR    (A3)
;    MOVE.L    D0,D6
;    BNE.S    lbC00021C
;    LEA    workbenchlibr.MSG(PC),A2
;    BRA.S    lbC0001F0

;lbC0001EC    ADDQ.L    #1,A4
;    ADDQ.L    #1,A2
;lbC0001F0    MOVE.B    (A4),D0
;    BEQ.S    lbC0001F8
;    CMP.B    (A2),D0
;    BEQ.S    lbC0001EC
;lbC0001F8    MOVE.B    (A4),D0
;    CMP.B    (A2),D0
;    BNE.S    lbC00021C
;    LEA    lbW000042,A0
;    MOVE.L    A0,D0
;    LEA    lbL000034,A1
;    SUB.L    A1,D0
;    MOVEA.L    A5,A1
;    ADDA.L    D0,A1
;    MOVE.L    D7,D0
;    MOVEA.L    $1C(SP),A6
;    JSR    (A3)
;    MOVE.L    D0,D6
;lbC00021C    MOVE.L    D6,D0
;    MOVEM.L    (SP)+,D6/D7/A2-A6
;    ADDQ.W    #4,SP
;    RTS

;    dc.w    0

;EndSkip

MatchTag
    ILLEGAL                ; match word
    dc.l    MatchTag        ; match tag
    dc.l    EndSkip            ; end skip
    dc.b    4            ; flags
    dc.b    $29            ; version
    dc.b    0            ; type
    dc.b    $92            ; priority
    dc.l    wbfind4017693.MSG    ; name
    dc.l    wbfind4017693.MSG    ; id string
    dc.l    Init            ; init code

Init
    movem.l    D2/D6/D7/A3-A6,-(SP)
    move.l    A6,A5            ; exec base
    moveq    #4,D0            ; dos library
    jsr    -$32A(A6)        ; TaggedOpenLibrary
    move.l    D0,D7            ; dos base
    beq.b    Error
    lea    LIBSworkbench.MSG(PC),A0
    move.l    A0,D1
    moveq    #-2,D2
    move.l    D7,A6            ; dos base
    jsr    -$54(A6)        ; Lock
    move.l    D0,D6
    beq.b    AllocVec
    move.l    D6,D1
    jsr    -$5A(A6)        ; UnLock
    move.l    A5,A6
    bra.b    Close

AllocVec
    moveq    #(32+24+4+NewOpenLibraryEnd-NewOpenLibrary),D0
    moveq    #1,D1            ; fast mem
    move.l    A5,A6
    jsr    -$2AC(A6)        ; AllocVec
    tst.l    D0
    beq.b    Close
    move.l    D0,A1
    clr.l    (A1)+
    move.l    A1,A3
    lea    NewOpenLibrary(PC),A0
    moveq    #(NewOpenLibraryEnd-NewOpenLibrary),D0
    jsr    -$270(A6)        ; CopyMem
    jsr    -$27C(A6)        ; CacheClearU
    moveq    #9,D1
    move.l    D7,A6            ; dos base
    jsr    -$28E(A6)        ; LockDosList
    move.l    D0,A4
    bra.b    Next

Free
    subq.l    #4,A3
    move.l    A3,A1
    move.l    A5,A6
    jsr    -$2B2(A6)        ; FreeVec
Close
    move.l    D7,A1
    jsr    -$19E(A6)        ; CloseLibrary
    moveq    #0,D0
Error
    movem.l    (SP)+,D2/D6/D7/A3-A6
    rts

Loop
    lea    NewOpenLibraryEnd-NewOpenLibrary(A3),A1    ; destination
    move.l    A1,D1            ; for Lock
    move.l    $28(A4),A0
    add.l    A0,A0
    add.l    A0,A0
    moveq    #0,D0
    move.b    (A0)+,D0        ; source
    bra.b    DoCopy

CopyName
    move.b    (A0)+,(A1)+
DoCopy
    dbf    D0,CopyName
    lea    libsworkbench.MSG(PC),A0
Copy
    move.b    (A0)+,(A1)+
    bne.b    Copy
    moveq    #-2,D2
    jsr    -$54(A6)        ; Lock
    move.l    D0,D6
    beq.b    Next
    move.l    D6,D1
    jsr    -$5A(A6)        ; UnLock
Next
    move.l    A4,D1
    moveq    #9,D2
    jsr    -$2B2(A6)        ; NextDosEntry
    tst.l    D0
    beq.b    Unlock
    move.l    D0,A4
    tst.l    D6
    beq.b    Loop
Unlock
    moveq    #9,D1
    jsr    -$294(A6)        ; UnLockDosList
    tst.l    D6
    beq.b    Free
    move.l    A5,A6            ; exec base
    jsr    -$84(A6)        ; Forbid
    lea    -552.W,A0        ; funcOffset A0.W
    move.l    A3,D0            ; funcEntry D0
    move.l    A5,A1            ; library A1
    jsr    -$1A4(A6)        ; SetFunction
    move.l    D0,-(A3)
    jsr    -$8A(A6)        ; Permit
    bra.b    Close

; D0 - input (lib version)
; A1 - input (lib name)
; D0 - output (lib base)

NewOpenLibrary
    move.l    D0,-(SP)
    move.l    A1,-(SP)
    move.l    NewOpenLibrary-4(PC),A0
    jsr    (A0)
    move.l    (SP)+,A1
    move.l    D0,D1
    beq.b    Check
NoWBlib
    addq.l    #4,SP
    rts
Check
    moveq    #18-1,D1            ; size of library name
    lea    workbenchlibr.MSG(PC),A0
CheckName
    cmpm    (A0)+,(A1)+
    bne.b    NoWBlib
    dbf    D1,CheckName
    move.l    (SP)+,D0        ; version
    lea    NewOpenLibraryEnd(PC),A1
    move.l    NewOpenLibrary-4(PC),A0
    jmp    (A0)
NewOpenLibraryEnd

LIBSworkbench.MSG    dc.b    'LIBS:workbench.library',0
libsworkbench.MSG    dc.b    ':libs/'
workbenchlibr.MSG    dc.b    'workbench.library',0

wbfind4017693.MSG    dc.b    'wbfind 41.0 (17.11.2012)',$D,$A,0
    cnop    0,4
EndSkip
Don_Adan is offline  
Old 20 November 2012, 12:56   #20
Minuous
Coder/webmaster/gamer
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 1,745
So, as I read it, the ones which have been improved are:

filesystem.resource with DOS6/DOS7/DOS8 support
battmem.resource bug fix
misc.resource optimized
potgo.resource optimized

I am planning to incorporate these into the next version of BB4 if you don't object?
Minuous is offline  
AdSense AdSense  
 


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 scsi device Don_Adan Coders. System 76 06 December 2015 00:50
Open-source dos.library Don_Adan Coders. System 271 28 October 2015 19:28
Realistic Open Source Ports fishyfish Retrogaming General Discussion 1 25 June 2013 08:10
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 12:00.


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