OSDN Git Service

V309 Modified APPEND" in the long run, clusters can become non-contiguous
[fast-forth/master.git] / forthMSP430FR_SD_ACCEPT.asm
index 03f01f8..63c0e13 100644 (file)
 ; used variables : BufferPtr, BufferLen
 ; EMIT uses only IP TOS and Y registers
 ; ==================================;
-;    FORTHWORD "SD_ACCEPT"          ; SDIB_org SDIB_org CPL -- SDIB len        94 bytes
+;    FORTHWORD "SD_ACCEPT"          ; SDIB_org SDIB_org SDIB_len -- SDIB len        94 bytes
 ; ==================================;
 SD_ACCEPT                           ; sequentially move from SD_BUF to SDIB (PAD if RAM=1k) a line of chars delimited by CRLF
 ; ----------------------------------; up to CPL = 80 chars
         PUSH    IP                  ;
         MOV     #SDA_YEMIT_RET,IP   ; set YEMIT return
 ; ----------------------------------;
-StartNewLine                        ; -- SDIB_org SDIB_org CPL
-; ----------------------------------;
         MOV &CurrentHdl,T           ; prepare a link for a next LOADed file, if any...
         MOV &BufferPtr,HDLW_BUFofst(T)  ; ...see usage : GetFreeHandle(CheckCaseOfLoadFileToken)
 ; ----------------------------------;
-SDA_InitDstAddr                     ;
+; SDA_InitDstAddr                   ;
 ; ----------------------------------;
-        MOV     @PSP+,W             ; -- SDIB_org CPL   W=SDIB_ptr
-        MOV     TOS,X               ;                   X=SDIB_len
+        MOV     @PSP+,W             ; -- SDIB_org SDIB_len  W=SDIB_ptr
+        MOV     TOS,X               ;                       X=SDIB_len
         MOV     #0,TOS              ; -- SDIB_org len   of moved bytes from SD_buf to SDIB
 ; ----------------------------------;
 SDA_InitSrcAddr                     ; <== SDA_GetFileNextSect
@@ -63,7 +61,7 @@ SDA_EndOfLine                       ; -- SDIB_org len
 ; ----------------------------------;
 SDA_MoveChar                        ;
 ; ----------------------------------;
-        CMP     X,TOS               ; 1 len = CPL ?
+        CMP     TOS,X               ; 1 len = SDIB_len ?
         JZ      YEMIT               ; 2 yes, don't move char to dst
         MOV.B   Y,0(W)              ; 3 move char to dst
         ADD     #1,W                ; 1 increment SDIB_ptr
@@ -72,8 +70,8 @@ SDA_MoveChar                        ;
 ; ----------------------------------; 29/26~ char loop, add 14~ for readsectorW one char ==> 43/40~ ==> 186/200 kbytes/s @ 8MHz
 SDA_GetFileNextSect                 ; -- SDIB_org len
 ; ----------------------------------;
-        PUSHM   #2,W                ; save SD_buf_ptr, SD_buf_len
-        CALL    #Read_File          ; that resets BufferPtr
-        POPM    #2,W                ; restore SD_buf_ptr, SD_buf_len
+        PUSHM   #2,W                ; save SDIB_ptr, SDIB_len
+        CALL    #Read_File          ; which clears SD_buf_ptr and set SD_buf_len
+        POPM    #2,W                ; restore SDIB_ptr, SDIB_len
         JMP     SDA_InitSrcAddr     ; loopback to end the line
 ; ----------------------------------;
\ No newline at end of file