;********************************************************
;*		FontASM 1.02				*
;* © Glorfindel 1993					*
;* Alias Guillaume Jay/Belier Production		*
;* V1.00 3492 octets	14/03/93			*
;* V1.01 3592 octets	20/03/93			*
;* -correction d'un bug lors du calcul des fontes propor*
;*  -tionnelles.					*
;* -optimisation de la source genérée			*
;* -Ram: repertoire destination par défaut		*
;* V1.02 3672 octets	13/04/93			*
;* -changement du systéme de chargement			*
;* -démarrage possible à partir du WorkBench		*
;* basé sur FontConverter.c				*
;* 		de Andreas Baum				*
;********************************************************
	incdir	"Langages:IncludeASM/"
	include	"Personnel/Base.i"
	Include	"personnel/MacroAffichage.i"
	include	"reqtools/tagitem.i"
	include	"ReqTools/reqtools.i"

RV	EquR		A5

	STRUCTURE	Variables,0
	CPTR		RTB
	CPTR		DosBase
	CPTR		StdOutPut
	CPTR 		ReqFontInfo
	CPTR		ReqFileInfo
	CPTR		NomFonte
	CPTR		NomFonteL
	ULONG		LongueurNomF
	ULONG		TailleFonte
	CPTR		PtrFonte
	CPTR		BufferFonte
	CPTR		FileHandleR
	CPTR		FileHandleE
	CPTR		Dir
	CPTR		Fichier
	CPTR		FileLockR
	CPTR		FileInfoBlockR
	CPTR		NomComplet
	CPTR		CharData
	CPTR		CharLoc
	CPTR		CharKern
	CPTR		CharSpace
	CPTR		WbMsg
	ULONG		LongueurD
	ULONG		DonneeL
	UWORD		Donnee
	UWORD		TailleY
	UWORD		TailleX
	UWORD		BaseLine
	UWORD		BoldSmear
	UWORD		Accessors
	UWORD		Modulo
	UBYTE		LoChar
	UBYTE		HiChar
	UBYTE		Style
	UBYTE		Flags
	UBYTE		FlagE
	LABEL		TailleV

Deb:
	Prepare		Exec
	AllocMemFC	#TailleV,RV
	AllocMemFC	#80,Dir(RV)
	AllocMemFC	#108,Fichier(RV)
	AllocMemFC	#188,NomComplet(RV)
	
	move.l		276(a6),a2
	tst.l		172(a2)
	bne.b		DepartCLI
DepartWB:
	lea		92(a2),a0
	LibC		WaitPort
	lea		92(a2),a0
	LibC		GetMsg
	move.l		d0,WbMsg(RV)
DepartCLI:
	bsr.w		OpenLib
	move.l		DosBase(RV),a6
	tst.l		WbMsg(RV)
	bne.b		OuvertureRAW
	LibC		OutPut
	Bra.b		OutPutTrouve
OuvertureRAW:
	lea		FenetreRAW(PC),a1
	move.l		a1,d1
	move.l		#1005,d2
	LibC		Open
OutPutTrouve:
	move.l		d0,StdOutPut(RV)
	lea		Titre(PC),a0
	bsr.w		Affiche
	bsr.w		OpenRTLib
	tst.l		(RV)
	beq.w		PasRTLib
	bsr.w		ObtenirFonte
	tst.b		FlagE(RV)
	bne.b		Fin
	bsr.w		ObtenirFichier
	tst.b		FlagE(RV)
	bne.b		Fin
	bsr.w		ChargerFonte
	tst.b		FlagE(RV)
	bne.b		Fin
	lea		EnProgres(PC),a0
	bsr.w		Affiche
	bsr.w		CalculFonte
	tst.b		FlagE(RV)
	bne.w		Fin
	lea		MessageFin(PC),a0
	bsr.w		Affiche	
Fin:
	bsr.w		CloseRTLib
FinRTLib:
	tst.l		WbMsg(RV)
	beq.b		PasDepartWB
	Prepare		DosBase
	move.l		#100,d1			;Laisser 2 secondes d'attente
	LibC		Delay			;pour lire les messages
	move.l		StdOutPut(RV),d1
	LibC		Close
PasDepartWB:
	bsr.w		CloseLib
	move.l		Dir(RV),a1
	move.l		#80,d0
	LibC		FreeMem
	move.l		Fichier(RV),a1
	move.l		#108,d0
	LibC		FreeMem
	move.l		NomComplet(RV),a1
	move.l		#188,d0
	LibC		FreeMem
	Tst.l		BufferFonte(RV)
	beq.b		PasBufFonte
	move.l		BufferFonte(RV),a1
	move.l		TailleFonte(RV),d0
	LibC		FreeMem
PasBufFonte:
	tst.l		NomFonte(RV)
	beq.b		FinErreurF
	move.l		NomFonte(RV),a1
	move.l		LongueurNomF(RV),d0
	LibC		FreeMem
	move.l		NomFonteL(RV),a1
	move.l		LongueurNomF(RV),d0
	LibC		FreeMem
FinErreurF:
	tst.l		WbMsg(RV)
	beq		PasBesoinDeRepondre
	LibC		Forbid
	move.l		WbMsg(RV),a1
	LibC		ReplyMsg
PasBesoinDeRepondre:
	move.l		#TailleV,d0
	move.l		RV,a1
	LibC		FreeMem
	moveq		#0,d0
	rts

Affiche:
	move.l		DosBase(RV),a6
	move.l		a0,d2
	moveq		#0,d3
NextCar:
	addq.b		#1,d3
	tst.b		(a0)+	;Combien de caratéres à afficher ?
	bne.b		NextCar
	subq.b		#1,d3
	move.l		StdOutPut(RV),d1
	tst.l		d1
	beq.b		FinAffiche
	LibC		Write
FinAffiche:
	rts

OpenLib:
	lea		DosName(PC),a1
	LibC		OldOpenLibrary
	move.l		d0,DosBase(RV)
	rts

CloseLib:
	move.l		DosBase(RV),a1
	ExecC		CloseLibrary
	rts

PasRTLib:
	lea		MessageErreur1(PC),a0
	bsr.b		Affiche
	bra.w		FinRTLib

OpenRTLib:
	lea		RTName(PC),a1
	ExecC		OldOpenLibrary
	move.l		d0,(RV)
	rts

CloseRTLib:
	move.l		(RV),a1
	ExecC		CloseLibrary
	rts

ObtenirFonte:
	move.l		(RV),a6
	movea.l		#0,a0
	move.l		#RT_FONTREQ,d0
	LibC		AllocRequestA
	move.l		d0,ReqFontInfo(RV)
	move.l		d0,a0
	move.l		#REQPOS_TOPLEFTSCR,(a0)   ; position
	move.l	#FREQF_COLORFONTS+FREQF_CHANGEPALETTE+FREQF_STYLE,rtfo_Flags(a0)

	lea		TitreReq(PC),a3
	move.l		ReqFontInfo(RV),a1		;ReqInfo
	lea		TagsFontReq(PC),a0
	LibC		FontRequestA
	tst.l		d0
	bne.b		ContinueOF
	move.b		#1,FlagE(RV)
	bra.w		FinOF
ContinueOF:
	move.l		ReqFontInfo(RV),a2
	lea		rtfo_Attr(a2),a2
	move.l		(a2),a0
	bsr.w		StrLen
	move.l		d0,d2
	addq.l		#7,d0				; pour placer "FONTS:"
	move.l		d0,LongueurNomF(RV)		;et la taille et le "/"
	Prepare		Exec
	AllocMemFC	d0,NomFonte(RV)
	AllocMemFC	LongueurNomF(RV),NomFonteL(RV)		;pour le listing
	move.l		NomFonte(RV),a1
	lea		Assign(PC),a0
	bsr.w		StrCopy
	move.l		(a2),a0
	bsr.w		StrCopy
	Push		a1
	move.l		NomFonteL(RV),a1
	move.l		(a2),a0
	bsr.w		StrCopy
	subq.l		#5,a1
	move.l		a1,a4
	Pop		a1
	subq.l		#5,a1
	move.b		#'/',(a1)+
	move.w		ta_YSize(a2),TailleY(RV)
	move.l		a1,a3	
	lea		TailleY(RV),a1
	lea		Format(PC),a0
	bsr.w		Int2Str				;finit le chemin
	lea		Format(PC),a0
	move.l		a4,a3
	lea		TailleY(RV),a1
	bsr.w		Int2Str				;Finit le nom listing
	move.l		NomFonteL(RV),a0
	move.l		Fichier(RV),a1
	bsr.w		StrCopy
	move.b		#".",(a1)+
	move.b		#"S",(a1)+
	move.l		(RV),a6
FinOF:
	move.l		ReqFontInfo(RV),a1
	LibC		FreeRequest
	tst.b		FlagE(RV)
	bne.w		PasDeFichierChoisi
	rts

ObtenirFichier:
	move.l		(RV),a6

	movea.l		#0,a0
	move.l		#RT_FILEREQ,d0
	LibC		AllocRequestA
	move.l		d0,ReqFileInfo(RV)
	move.l		d0,a0
	move.l		#REQPOS_POINTER,(a0)   ; position centre
	move.l		#-1,rtfi_WaitPointer(A0)	;Pointeur Busy
	movea.l		a0,a1
	lea		TagFileReq(PC),a0
	lea		RamDir(PC),a3
	move.l		a3,4(a0)
	LibC		ChangeReqAttrA

	move.l		Fichier(RV),a2
	lea		TitreFileReq(Pc),a3
	move.l		#0,a0
	move.l		ReqFileInfo(RV),a1
	LibC		FileRequestA
	tst.l		d0
	bne.b		ContinueOD
	move.b		#1,FlagE(RV)
	bra.b		FinOD
ContinueOD:
	move.l		ReqFileInfo(RV),a0
	move.l		rtfi_Dir(A0),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	move.l		Dir(RV),a0
	move.l		Fichier(RV),a1
	move.l		NomComplet(RV),a2
	bsr.b		TrouverNomComplet
FinOD:
	move.l		ReqFileInfo(RV),a1
	LibC		FreeRequest
	tst.b		FlagE(RV)
	bne.w		PasDeFichierChoisi
	rts

;A0 Dir A1: File A2 Destination
TrouverNomComplet:
	Push		a1
	movea.l		a2,a1
	bsr.w		StrLen
	tst.l		d0
	beq.b		CheminCourant
	bsr.w		StrCopy
	cmpi.b		#':',-(a1)
	beq.b		Racine
	addq.l		#1,a1
	move.b		#'/',(a1)
Racine:
	addq.l		#1,a1
CheminCourant:
	Pop		a0
	bsr.w		StrCopy
	rts

EcritInit:
	move.l		NomFonteL(RV),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	move.b		#'I',(a1)+
	move.b		#'n',(a1)+
	move.b		#'i',(a1)+
	move.b		#'t',(a1)+
	move.b		#':',(a1)+
	move.b		#10,(a1)+
	bsr.w		EcrireDonnee
	lea		Ligne1(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	move.b		#'N',(a1)+
	move.b		#'o',(a1)+
	move.b		#'m',(a1)+
	move.l		NomFonteL(RV),a0
	bsr.w		StrCopy
	lea		FinLigne1(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	lea		Ligne2(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.l		TailleY(RV),Donnee(RV)
	bsr.w		FormatW
	lea		Ligne3(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	clr.w		Donnee(RV)
	move.b		Style(RV),Donnee(RV)
	bsr.w		FormatB
	lea		Ligne4(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.b		Flags(RV),Donnee(RV)
	bsr.w		FormatB
	lea		Ligne5(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.w		TailleX(RV),Donnee(RV)
	bsr.w		FormatW
	lea		Ligne6(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.w		BaseLine(RV),Donnee(RV)
	bsr.w		FormatW
	lea		Ligne7(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.w		BoldSmear(RV),Donnee(RV)
	bsr.w		FormatW
	lea		Ligne8(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.w		Accessors(RV),Donnee(RV)
	bsr.w		FormatW
	lea		Ligne9(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	clr.l		Donnee(RV)
	move.b		LoChar(RV),Donnee(RV)
	bsr.w		FormatB
	lea		Ligne10(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	move.b		HiChar(RV),Donnee(RV)
	bsr.w		FormatB
	lea		Ligne11(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	
	lea		Ligne1(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	move.l		NomFonteL(RV),a0
	bsr.w		StrCopy
	lea		FinLigne1(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	lea		Ligne15(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	cmpi.l		#110,CharData(RV)
	beq.b		CharDataZero
	move.l		CharData(RV),d0
	subi.l		#110,d0
	move.l		d0,DonneeL(RV)
	lea		LigneAddL(PC),a0
	bsr.w		FormatL
	lea		Ligne16(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	bra.b		SuiteEcrireInit
CharDataZero:
	lea		Ligne22(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

SuiteEcrireInit:
	move.w		Modulo(RV),Donnee(RV)
	bsr.w		FormatW
	lea		Ligne12(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	cmpi.l		#110,CharData(RV)
	beq.b		PasLaPeineA2A0
	lea		Ligne17(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
PasLaPeineA2A0:
	move.l		CharLoc(RV),d0
	subi.l		#110,d0
	move.l		d0,DonneeL(RV)
	lea		LigneAddL(PC),a0
	bsr.w		FormatL
	lea		Ligne18(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee

	tst.l		CharSpace(RV)
	bne.b		PasSpaceZero
	lea		Ligne13(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	bra.b		SuiteEcritInit
PasSpaceZero:
	lea		Ligne17(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	move.l		CharSpace(RV),d0
	subi.l		#110,d0
	move.l		d0,DonneeL(RV)
	lea		LigneAddL(PC),a0
	bsr.w		FormatL
	lea		Ligne19(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
SuiteEcritInit:
	tst.l		CharKern(RV)
	bne.b		PasKernZero
	lea		Ligne14(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	bra.b		SuiteEcritInit2
PasKernZero:
	lea		Ligne17(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	move.l		CharKern(RV),d0
	subi.l		#110,d0
	move.l		d0,DonneeL(RV)
	lea		LigneAddL(PC),a0
	bsr.w		FormatL
	lea		Ligne20(PC),a0
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
SuiteEcritInit2:
	lea		Ligne21(PC),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	bsr.w		EcrireDonnee
	rts

ChargerFonte:
	Prepare		DosBase
	move.l		#1005,D2	; Old Mode
	move.l		NomFonte(RV),D1
	LibC		Open
	tst.l		d0
	beq.w		ErreurFichier
	move.l		D0,FileHandleR(RV)

	move.l		NomFonte(RV),D1
	move.l		#-2,d2		;Mode lecture
	LibC		Lock
	move.l		d0,FileLockR(RV)

	Prepare		Exec
	AllocMemFC	#260,FileInfoBlockR(RV)
	Prepare		DosBase
	move.l		FileLockR(RV),d1
	move.l		FileInfoBlockR(RV),d2
	LibC		Examine
	move.l		FileInfoBlockR(RV),a0
	move.l		124(a0),TailleFonte(RV)
	move.l		FileLockR(RV),d1
	LibC		UnLock
	Prepare		Exec
	move.l		FileInfoBlockR(RV),a1
	move.l		#260,d0
	LibC		FreeMem
	AllocMemFC	TailleFonte(RV),D0
	tst.l		d0
	beq.w		PasDeMemoire
	move.l		D0,BufferFonte(RV)

	Prepare		DosBase
	move.l		FileHandleR(RV),D1
	move.l		BufferFonte(RV),D2
	move.l		TailleFonte(RV),D3		; Nb d'octets à lire
	LibC		Read
	move.l		FileHandleR(RV),D1
	LibC		Close
FinLitFichier:
	rts

CalculFonte:
	movea.l		BufferFonte(RV),a0
	adda.w		#112,a0
	
	move.b		(a0)+,Style(RV)
	move.b		(a0)+,Flags(RV)
	move.w		(a0)+,TailleX(RV)
	move.w		(a0)+,BaseLine(RV)
	move.w		(a0)+,BoldSmear(RV)
	move.w		(a0)+,Accessors(RV)
	move.b		(a0)+,LoChar(RV)
	move.b		(a0)+,HiChar(RV)
	move.l		(a0)+,CharData(RV)
	move.w		(a0)+,Modulo(RV)
	move.l		(a0)+,CharLoc(RV)
	move.l		(a0)+,CharSpace(RV)
	move.l		(a0)+,CharKern(RV)
	move.l		a0,PtrFonte(RV)

	clr.l		d0
	clr.l		d1
	move.b		HiChar(RV),d0
	sub.b		LoChar(RV),d0
	addi.b		#2,d0
	mulu		#4,d0
	move		Modulo(RV),d1
	mulu		TailleY(RV),d1
	add.l		d1,d0	
	lsr.l		#1,d0			;D0/2
	tst.l		CharSpace(RV)
	beq.b		SuiteCalcFont1
	clr.l		d1
	move.b		HiChar(RV),d1
	sub.b		LoChar(RV),d1
	addq.l		#2,d1
	add.l		d1,d0
SuiteCalcFont1:
	tst.l		CharKern(RV)
	beq.b		SuiteCalcFont2
	clr.l		d1
	add.b		HiChar(RV),d1
	sub.b		LoChar(RV),d1
	addq.l		#2,d1
	add.l		d1,d0
SuiteCalcFont2:
	move.l		d0,LongueurD(RV)

	move.l		NomComplet(RV),d1
	move.l		#1006,d2
	LibC		Open
	move.l		d0,FileHandleE(RV)
	tst.l		d0
	beq.w		ErreurFichierD
	lea		TitreSource(PC),a0
	bsr.w		StrLen
	move.l		d0,d3
	move.l		a0,d2
	move.l		FileHandleE(RV),d1
	LibC		Write
	cmpi.l		#-1,d0
	beq.w		ErreurFichierD

	bsr.w		EcritInit
	move.l		NomFonteL(RV),a0
	move.l		Dir(RV),a1
	move.b		#'N',(a1)+
	move.b		#'o',(a1)+
	move.b		#'m',(a1)+
	bsr.w		StrCopy
	move.b		#':',(a1)+
	move.b		#9,(a1)+
	move.b		#'d',(a1)+
	move.b		#'c',(a1)+
	move.b		#'.',(a1)+
	move.b		#'b',(a1)+
	move.b		#9,(a1)+
	move.b		#34,(a1)+
	move.l		NomFonteL(RV),a0
	bsr.w		StrCopy
	move.b		#34,(a1)+
	move.b		#',',(a1)+
	move.b		#'0',(a1)+
	move.b		#10,(a1)+
	move.b		#0,(a1)
	bsr.w		EcrireDonnee

	move.l		NomFonteL(RV),a0
	move.l		Dir(RV),a1
	bsr.w		StrCopy
	move.b		#":",(a1)+
	move.b		#10,(a1)+
	move.b		#0,(a1)
	move.l		Dir(RV),d2
	move.l		Dir(RV),a0
	bsr.w		StrLen
	move.l		d0,d3
	move.l		FileHandleE(RV),d1
	LibC		Write
	cmpi.l		#-1,d0
	beq.w		ErreurFichierD

	move.b		#1,d5
	clr.l		d6
	move.l		LongueurD(RV),d7
DebutBoucleCF:
	cmpi.b		#1,d5
	bne.b		PasToutDebutLigne
	move.l		Dir(RV),a0		;met le dc.w
	move.b		#9,(a0)+
	move.b		#'d',(a0)+
	move.w		#'c.',(a0)+
	move.b		#'w',(a0)+
	move.b		#9,(a0)+
	move.b		#0,(a0)+
	move.l		Dir(RV),a0
	bsr.w		StrLen
	move.l		d0,d3
	move.l		a0,d2
	move.l		FileHandleE(RV),d1
	LibC		Write
	cmpi.l		#-1,d0
	beq.w		ErreurFichierD
PasToutDebutLigne:
	move.l		PtrFonte(RV),a0
	move.w		(a0)+,Donnee(RV)
	move.l		a0,PtrFonte(RV)

	move.l		d7,d4
	subq.l		#1,d4
	cmp.l		d6,d4
	bne.b		PasFinFichier
	move.b		#11,d5
	bsr.b		FormatDonnee
	suba.w		#1,a0
	move.b		#10,(a0)
	bsr.b		EcrireDonnee
PasFinFichier:
	cmpi.b		#9,d5
	bgt.b		PasDebutMilieuLigne
	bsr.b		FormatDonnee
	bsr.b		EcrireDonnee
PasDebutMilieuLigne:
	cmpi.b		#10,d5
	bne.b		PasFinLigne
	move.b		#0,d5
	bsr.b		FormatDonnee
	suba.w		#1,a0
	move.b		#10,(a0)
	bsr.b		EcrireDonnee
PasFinLigne:
	addq.l		#1,d6
	addq.b		#1,d5
	cmp.l		d6,d7
	bne.w		DebutBoucleCF
FinCalculFonte:
	tst.l		FileHandleE(RV)
	beq.b		SuiteFinCF
	move.l		FileHandleE(RV),d1
	LibC		Close
SuiteFinCF:	
	rts

FormatDonnee:
	move.l		Dir(RV),a3
	move.b		#'$',(a3)+
	lea		Donnee(RV),a1
	lea		FormatD(PC),a0
	bsr.w		Int2Str
	move.l		Dir(RV),a0
	adda.w		#5,a0
	move.b		#',',(a0)+
	move.b		#0,(a0)
	rts

EcrireDonnee:
	Prepare		DosBase
	move.l		FileHandleE(RV),d1
	move.l		Dir(RV),a0
	bsr.b		StrLen
	move.l		d0,d3
	move.l		a0,d2
	LibC		Write
	rts

ErreurFichier:
	move.b		#1,FlagE(RV)
	lea		MessageErreur2(PC),a0
	bsr.w		Affiche
	rts

ErreurFichierD:
	move.b		#1,FlagE(RV)
	lea		MessageErreur3(PC),a0
	bsr.w		Affiche
	bra.b		FinCalculFonte

PasDeMemoire:
	move.b		#1,FlagE(RV)
	lea		MessageErreur5(PC),a0
	bsr.w		Affiche
	rts
	
PasDeFichierChoisi:
	lea		MessageErreur4(PC),a0
	bsr.w		Affiche
	rts

;A0 Source
;renvoie D0 la longeur
StrLen:
	Push		a0
	clr.l		d0
BoucleStrLen:
	addq.l		#1,d0
	Tst.b		(a0)+
	bne.b		BoucleStrLen
	subq.l		#1,d0
	Pop		a0
	rts
;A0 Source A1 Destination
StrCopy:
	move.b		(a0)+,(a1)+
	tst.b		(a0)
	bne.b		StrCopy
	move.b		#0,(a1)
	rts

FormatW:
	move.l		Dir(RV),a1
	lea		LigneMoveW(PC),a0
	bsr.b		StrCopy
	move.l		a1,a3
	move.b		#'#',(a3)+
	move.b		#'$',(a3)+
	move.l		a3,a4
	addq		#4,a4
	lea		Donnee(RV),a1
	lea		FormatD(PC),a0
	bsr.b		Int2Str
	move.l		a4,a1
	move.b		#',',(a1)+
	rts

FormatB:
	move.l		Dir(RV),a1
	lea		LigneMoveB(PC),a0
	bsr.b		StrCopy
	move.l		a1,a3
	move.b		#'#',(a3)+
	move.b		#'$',(a3)+
	move.l		a3,a4
	addq		#2,a4
	lea		Donnee(RV),a1
	lea		FormatBy(PC),a0
	bsr.b		Int2Str
	move.l		a4,a1
	move.b		#',',(a1)+
	rts

FormatL:
	move.l		Dir(RV),a1
	bsr.b		StrCopy
	move.l		a1,a3
	move.b		#'#',(a3)+
	move.b		#'$',(a3)+
	move.l		a3,a4
	addq		#8,a4
	lea		DonneeL(RV),a1
	lea		FormatLo(PC),a0
	bsr.b		Int2Str
	move.l		a4,a1
	move.b		#',',(a1)+
	rts

;a0-> indicateur de formatage
;a1-> pointeur valeur à formater
;a3-> pointeur sur Destination
Int2Str:
	lea		PutChar(PC),a2
	ExecC		RawDoFmt
	rts
PutChar:
	move.b		d0,(a3)+
	rts


TagsFontReq:	dc.l	RTFO_Height,240,RT_TopOffset,10,TAG_END
TagFileReq:	dc.l	RTFI_Dir,0,0
RamDir:		dc.b	"Ram:",0
Format:		dc.b	"%d",0
FormatD:	dc.b	"%04x",0
FormatBy:	dc.b	"%02x",0
FormatLo:	dc.b	"%l08x",0
DosName:	dc.b	"dos.library",0
RTName:		dc.b	"reqtools.library",0
MessageErreur1:	Crayon3
		dc.b	10,9,"Il me FAUT la ReqTools.library !",10
		Normal
		dc.b	0
MessageErreur2:	Crayon3
		dc.b	10,9,"Fonte non trouvée ( en ROM ?) !",10
		Normal
		dc.b	0
MessageErreur3:	Crayon3
		dc.b	10,9,"Erreur avec le fichier destination !",10
		Normal
		dc.b	0
MessageErreur4:	Crayon3
		dc.b	10,9,"Arrêt de l'utilisateur !",10
		Normal
		dc.b	0
MessageErreur5:	Crayon3
		dc.b	10,9,"Pas assez de mémoire pour charger la fonte !",0
		Normal
		dc.b	0
Titre:		Gras
		dc.b	10,9,"FontASM"
		Normal
		dc.b	9,"V1.02",9,"13/04/1993",10
		Italique
		dc.b	9,"Par G.Jay de "
		Normal
		Crayon3
		Souligne
		dc.b	" Belier Production "
		Normal
		dc.b	10,10,0
EnProgres:	dc.b	"Conversion en cours, un peu de patience...",10,0
MessageFin:	dc.b	"Tout s'est passé sans probléme.",10,0
Assign:		dc.b	"FONTS:",0
TitreReq:		dc.b	"Choisissez une fonte",0
TitreFileReq:		dc.b	"Fichier destination :",0
TitreSource:		dc.b	"; Source genérée par FontAsm 1.02",10
		dc.b	"; © 1993 Jay Guillaume alias Glorfindel/Belier"
		dc.b	" Production",10,";-> a1 pointeur "
		dc.b	"sur Structure fonte à initialiser",10,10,0
Ligne1:		dc.b	9,"lea",9,9,0
FinLigne1:	dc.b	"(PC),a0",10,0
Ligne2:		dc.b	9,"move.l",9,9,"a0,10(a1)",10,0
LigneMoveW:	dc.b	9,"move.w",9,9,0
LigneMoveB:	dc.b	9,"move.b",9,9,0
LigneMoveL:	dc.b	9,"move.l",9,9,0
LigneAddL:	dc.b	9,"addi.l",9,9,0
Ligne3:		dc.b	"20(a1)",10,0
Ligne4:		dc.b	"22(a1)",10,0
Ligne5:		dc.b	"23(a1)",10,0
Ligne6:		dc.b	"24(a1)",10,0
Ligne7:		dc.b	"26(a1)",10,0
Ligne8:		dc.b	"28(a1)",10,0
Ligne9:		dc.b	"30(a1)",10,0
Ligne10:	dc.b	"32(a1)",10,0
Ligne11:	dc.b	"33(a1)",10,0
Ligne12:	dc.b	"38(a1)",10,0
Ligne13:	dc.b	9,"move.l",9,9,"#$00000000,44(a1)",10,0
Ligne14:	dc.b	9,"move.l",9,9,"#$00000000,48(a1)",10,0
Ligne15:	dc.b	9,"movea.l",9,9,"a0,a2",10,0
Ligne16:	dc.b	"a0",10
		dc.b	9,"move.l",9,9,"a0,34(a1)",10,0
Ligne17:	dc.b	9,"movea.l",9,9,"a2,a0",10,0
Ligne18:	dc.b	"a0",10,9,"move.l",9,9,"a0,40(a1)",10,0
Ligne19:	dc.b	"a0",10,9,"move.l",9,9,"a0,44(a1)",10,0
Ligne20:	dc.b	"a0",10,9,"move.l",9,9,"a0,48(a1)",10,0
Ligne21:	dc.b	9,"rts",10,10,0
Ligne22:	dc.b	9,"move.l",9,9,"a0,34(a1)",10,0
FenetreRAW:	dc.b	"RAW:240/100/400/70/FontAsm 1.02",0
