30

Je t'y verrais bien d'écrire 90000 lignes de code assembleur parfaitement commentées ! wink

31

32

Ok

33

C'est le nom du répertoire HOME sous AMS: "\x7f".
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

34

35

36

C'est parce que PpHd utilise une bidouille qui nécessite un A68k modifié, et comme cette bidouille est complètement inexploitable avec ld-tigcc, l'A68k de TIGCC ne la permet pas.

Prends plutôt les sources de PedroM-ld-tigcc.
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

37

38

39

40

Martial Demolins (./37) :
CE HSYM DEVRAIT PAS ÊTRE NUL S'IL Y A 0 FICHIERS DANS LE RÉPERTOIRE ?

Je ne crois pas.
Regarde Sym2HSym
Martial Demolins (./38) :
Ce code regarde bien s'il y a un répertoire après ? Si c'est bien ça, c'est ce qu'il faut modifier au niveau des répertoires pour ne pas avoir 0 dans la variable SYMFIND_HSYM.


Non. On est en No Recursion.
Sinon tes commentaires sont faux.
La récursion est faite dans \Error (On n'a pas de fichiers dans le repertoire ou on a dépassé le dernier fichier => déclence une erreur. En cas d'erreur, on regarde si on doit aller au répertoire suivant).

En gros ce qu'il faut faire, c'est ne pas effacer SYMFIND_HSYM lorsqu'on veut sortir en erreur (SymFindNextError), mais il faut tout revérifier pour être sûr qu'on ne l'a pas déjà corrompu avant (en le positionnant sur un pseudo HSYM qui n'existait pas et donc déclenchait une erreur).

41

Martial Demolins (./39) :
Je vais refaire la fonction, ça sera plus simple. Je comprends ton code, mais pas tout ton algo. ^^

C'est pas du tout compliqué surtout avec les explications précédentes.
Martial Demolins (./39) :
Est-ce que ton format de VAT est conforme à ça ? http://www.mirari.fr/kBDJ

Oui

42

43

44

Juste pou info:
+ On parle d'un programme de 120Ko

45

46

je note

47

48

Tiens, j'ai mis des commentaires:

;SYM_ENTRY *SymFindFirst (SYM_STR SymName, unsigned short Flags); 
SymFindFirst:
	moveq	#3,d0			; Mask to save the flags we want
	and.w	8(a7),d0		; Read the Flags
	move.w	d0,SYMFIND_FLAGS	; Save flags as global (Forget temp, twin, return_folder and collapse)
	cmp.w	#FO_SINGLE_FOLDER,d0	; Check if recursive scan or folder scan
	bne.s	\Home
		move.l	4(a7),a1		; Read the Folder Name
		move.l	a1,d0			; If NULL => Home directory
		beq.s	\Home
\cvt:			tst.b	-(a1) 		; Convert the SYM_STR to a standard str
			bne.s	\cvt
		addq.l	#1,a1
		cmpi.b	#$7F,(a1)		; Is it the Home Name ?
		beq.s	\Home			; yes 
		move.w	#FOLDER_LIST_HANDLE,a0	; Folder Handle in a0
		bsr	FindSymEntry		; Find the requested folder in the folder list
		move.l	a0,d0			; Check if 
		beq.s	SymFindNextError	; successfull
		move.w	SYM_ENTRY.hVal(a0),a0	; Read its handle
		bra.s	\folder
\Home:	move.w	#FOLDER_LIST_HANDLE,a0	; Folder Handle in a0
\folder:
	; Get the first entry in the folder 'a0'
	trap	#3			; Deref it
	addq.l	#2,a0			; Skip MAX item
	move.w	(a0)+,d1		; Read the number of files
	bsr	Sym2HSym		; Get the first SYM_ENTRY (a0 -> d0)
	tst.w	d1			; No file in folder ?
	beq.s	SymFindNextError	; Yes so report an error
	move.l	d0,SYMFIND_HSYM		; Save the current scanned file for future use.
	rts
	
SymFindNextError:
	clr.l	SYMFIND_HSYM
	suba.l	a0,a0
	rts
	
;SYM_ENTRY *SymFindNext (void); 
SymFindNext:
	suba.l	a0,a0
	move.l	SYMFIND_HSYM,d0	;Read the current scanned file
	beq.s	SymFindNextError ;If there is no saved file, report an error

	cmpi.w	#2,SYMFIND_FLAGS ; Check if we have to do a recursive scan or not.
	bne.s	\NoRecurse
	;; Check if the current scanned file is a folder.
	;; If so, we have to go down the folder to get its first entry
	;; If no, we have to continue scanning the folder.
	        bsr	DerefSym_Reg		; a0 -> SYM_ENTRY of the file / a1 -> Folder
		move.w	SYM_ENTRY.flags(a0),d1
		andi.w	#SF_FOLDER,d1		; Not a folder, so no recurse 
		beq.s	\NoRecurse
			;; The scanned file is a folder and we are in recursive mode:
			;; Return the first file of the folder
			; Go down the folder : first entry
			move.w	SYM_ENTRY.hVal(a0),a0
			trap	#3
			addq.l	#2,a0
			move.w	(a0)+,d1
			bsr	Sym2HSym		; First entry
			move.l	d0,SYMFIND_HSYM		; Save HSYM (FIXME?)
			tst.w	d1			; Check if there is no file
			beq.s	\EndOfFolder		; 
			rts
	;; An error (end of folder) was reported.
	;; If we are not in recursive mode, it is the end of SymFindNext
\EndOfFolder:
	cmpi.w	#2,SYMFIND_FLAGS		; Recurse
	bne.s	SymFindNextError
	        ;; In recursive mode, we have to go to the next folder
		move.l	SYMFIND_HSYM,d0			; Read the scanned file
		bsr	FindFolderHSymFromFileHSym_Reg	; Get the Folder high from the scanned file
		; Next Hsym in folder table
		add.w	#SYM_ENTRY.sizeof,d0            ; Increment the HSYM to get the next item in the folder table
		move.l	d0,SYMFIND_HSYM			; Save it (FIXME ?)
		bsr	DerefSym_Reg			; d0 -> a0 -> SYM_ENTRY of the folder / a1 -> Folder Home
		move.l	a0,d0				; Check if successful
		beq.s	SymFindNextError		; No report an error
		rts

	;; We don't have to do a recursive scan.
	;; Increment the HSYM by the size of an item to get a new item.
	;; Deref it (If the HSYM was out or range, the deref function returns NULL).
	;; If we have reached the end of the folder, report an error.
\NoRecurse:	; Next Hsym
		add.w	#SYM_ENTRY.sizeof,d0
		move.l	d0,SYMFIND_HSYM		;Save the HSYM (FIXME?)
		bsr	DerefSym_Reg		; a0 -> SYM_ENTRY of the file / a1 -> Folder
		move.l	a0,d0
		beq.s	\EndOfFolder
		rts

49

50

Une petite question sur ce qu'on veut:

Si SymfindNext renvoit fileA, puis fileB, puis NULL.
SymFindPrev renvoit fileA ou fileB ?

51

52

53

54

Ok, je regarderai

55

56

DerefSym_Reg ne détruisant pas d0, on doit pouvoir faire plus simple pour ton patch.

57

58

Non, mais c'est bien. D'ici 2 semaines tu me fais la maintenance complète de PedroM embarrassed

59

60