27Fermer29
PpHdLe 03/08/2009 à 11:01
Merci pour la correction de Tilp.
Lionel Debroux (./27) :
(même si, dans le cas où ça raccourcirait le code de PedroM, tu devrais à mon avis le changer: Link.asm est manifestement dans la section 24K qui était trop pleine l'autre jour).


J'ai corrigé pour PedroM:
--- a/src/Link.asm
+++ b/src/Link.asm
@@ -909,8 +909,9 @@ TranslatePacket                                     ; Translate Packet
                jsr     FreePacket
                ; Send var to the calc
                clr.b   (a2)                    ; NULL string
-               pea     (a2)                    ; Push SYM Name
-               jsr     sendcalc                ; Send var
+               move.l  a2,a0                   ; SYM Name to transfert
+               lea     HSYMtoNameWithoutFolder,a1 ; Convertion function (without folder)
+               jsr     sendcalc_reg            ; Send variable
                bra     LinkCmdSuccess          
 
 \RequestIDListing:
@@ -1054,15 +1055,16 @@ cmd_sendcalc:
        moveq   #1,d0
        unlk    a6
        rts
-       
+
 ;unsigned short sendcalc (SYM_STR SymName, short allowSysVars, unsigned short DevType, unsigned char *compat); 
 sendcalc:
        move.l  4(a7),a0                ; SymName
-       move.w  10(a7),d0               ; DevType
-       movem.l d3-d4/a2-a3,-(a7)
+       lea     HSYMtoName,a1           ; Convertion function void *convert (HSYM , Buffer) / Return in a1 the end of the buffer.
+sendcalc_reg:
+       movem.l d3-d4/a2-a5,-(a7)
        lea     -60(a7),a7
        move.l  a7,a3                   ; Temp usage for sending
-       move.w  d0,d3                   ; DevType (Not used yet :()
+       move.l  a1,a5                   ; Convertion function
        pea     (a0)                    ; SymStr
        jsr     SymFindPtr
        addq.l  #4,a7
@@ -1082,7 +1084,7 @@ sendcalc:
                move.w  #$21*256,(a1)+  ; Asm Type ;) Name Size = 0
                pea     (a1)            ; Convert 
                move.l  d0,-(a7)        ; HSym
-               jsr     HSYMtoName      ; Convert HSYM into folder\name
+               jsr     (a5)            ; Convert HSYM into folder\name
                addq.l  #4,a7
                sub.l   (a7)+,a1        ; Use side effet of HSYMtoName: a1 was the end of the buffer. Now a1.l = Size
                move.w  a1,d1
@@ -1124,7 +1126,7 @@ sendcalc:
        bra.s   \Done
 \Error:        moveq   #1,d0
 \Done: lea     60(a7),a7
-       movem.l (a7)+,d3-d4/a2-a3
+       movem.l (a7)+,d3-d4/a2-a5
        rts
        
 ;void getcalc (SYM_STR SymName); 


--- a/src/Vat.asm
+++ b/src/Vat.asm
@@ -905,6 +905,23 @@ HSYMtoName:
 \End:  rts
 
 
+;short HSYMtoName (HSym Sym, char *buffer);
+; Side Effect:
+;      Return in a1 the end of the buffer.
+HSYMtoNameWithoutFolder:
+       move.l  4(a7),d0        ; Get HSYM
+       jsr     DerefSym_Reg    ; Convert it to SYM_ENTRY *
+       move.l  8(a7),a1        ; Read buffer
+       move.l  a0,d0           ; Check if convertion was successfull
+       beq.s   \End            ; If not, end
+               moveq   #8-1,d0 ; Copy at most 8 characters
+\loopFile              move.b  (a0)+,d1
+                       beq.s   \EndFile
+                       move.b  d1,(a1)+
+                       dbf     d0,\loopFile
+\EndFile       clr.b   (a1)
+\End:  rts
+
 ; *** FInd a SYM ***
 
 ; Find a ANSI str file.

Même si je trouve bizarre de ne pas donner le folder (et on peut voir que le patch casse le naturel de la fonction). grin