OSDN Git Service

encore un lot de bogues... corrigées
[fast-forth/master.git] / forthMSP430FR_SD_ACCEPT.asm
index e4e035d..e71927a 100644 (file)
@@ -21,7 +21,7 @@
 ;Z SD_ACCEPT  addr addr len -- addr' len'  get line to interpret from a SD Card file
 ; note : addr = TIB, addr' = PAD
 ; defered word ACCEPT is redirected here by the word LOAD"
-; sequentially move an input line ended by CRLF from BUFFER to PAD
+; sequentially move an input line ended by CRLF from SD_BUF to PAD
 ;   if end of buffer is reached before CRLF, asks Read_HandledFile to fill buffer with next sector
 ;   then move the end of the line.
 ; when all LOAD"ed files are read, redirects defered word ACCEPT to (ACCEPT) and restore interpret pointers.
 ; used variables : BufferPtr, BufferLen
 
 ; ----------------------------------;
-;    FORTHWORD "SD_ACCEPT"          ; TIB TIB TIB_LEN -- PAD|SDIB len'
+;    FORTHWORD "SD_ACCEPT"          ; CIB CIB CPL -- CIB len
 ; ----------------------------------;
-SD_ACCEPT                           ; sequentially move from BUFFER to SDIB (or PAD) a line of chars delimited by CRLF
-; ----------------------------------; up to TIB_LEN = 80 chars
+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
 ; ----------------------------------;
@@ -41,20 +41,13 @@ StartNewLine                        ;
 ; ----------------------------------;
     MOV &CurrentHdl,T               ; prepare a link for the next LOADed file...
     MOV &BufferPtr,HDLW_BUFofst(T)  ; ...see usage : HandleComplements
-; ----------------------------------; -- TIB TIB len
-    .IFDEF RAM_1K                   ; use PAD as SD Input Buffer because the lack of RAM
-    MOV     #PAD_ORG,W              ;               W=dst
-    .ELSEIF                         ; use SDIB as SD Input Buffer
-    MOV     #SDIB,W                 ;               W=dst
-    .ENDIF
-    MOV     W,2(PSP)                ; -- StringOrg' TIB TIB_LEN
-    MOV     TOS,0(PSP)              ; -- StringOrg' TIB_LEN TIB_LEN
-    MOV     #0,TOS                  ; -- StringOrg' TIB_LEN Count
+; ----------------------------------; -- CIB CIB CPL
+    MOV     2(PSP),W                ;               W=dst
+    MOV     TOS,0(PSP)              ; -- CIB CPL CPL
+    MOV     #0,TOS                  ; -- CIB CPL Count
 ; ----------------------------------;
 SDA_InitSrcAddr                     ; <== SDA_GetFileNextSector
 ; ----------------------------------;
-    CMP     #0,&BufferLen           ; test if input buffer is empty (EOF)
-    JZ      SDA_GoToInterpret       ; yes, to interpret an empty line (to do nothing)
     MOV     &BufferPtr,X            ;               X=src
     JMP     SDA_ComputeChar         ;
 ; ----------------------------------;
@@ -67,7 +60,7 @@ SDA_ComputeChar                     ;
 ; ----------------------------------;
     CMP     &BufferLen,X            ; 3 BufferPtr >= BufferLen ?
     JHS     SDA_GetFileNextSector   ; 2 yes
-    MOV.B   BUFFER(X),Y             ; 3 Y = char
+    MOV.B   SD_BUF(X),Y             ; 3 Y = char
     ADD     #1,X                    ; 1 increment input BufferPtr
     CMP.B   #32,Y                   ; 2 ascii printable char ?
     JHS     SDA_MoveChar            ; 2 yes
@@ -77,23 +70,20 @@ SDA_ComputeChar                     ;
 SDA_EndOfLine                       ;
 ; ----------------------------------;
     MOV     X,&BufferPtr            ; yes  save BufferPtr for next line
-; ----------------------------------;
-SDA_GoToInterpret                   ; -- StringOrg' TIB_LEN len'
-; ----------------------------------;
-    ADD     #2,PSP                  ; -- StringOrg' len'
+    ADD     #2,PSP                  ; -- CIB len
     MOV     @RSP+,IP                ;
     MOV     @IP+,PC                 ; ===> unique output
 ; ----------------------------------;
 SDA_MoveChar                        ;
 ; ----------------------------------;
-    CMP     @PSP,TOS                ; 2 count = TIB_LEN ?
-    JZ      YEMIT                   ; 2 yes, don't move char to dst
+    CMP     @PSP,TOS                ; 2 count = CPL ?
+    JZ      YEMIT1                  ; 2 yes, don't move char to dst
     MOV.B   Y,0(W)                  ; 3 move char to dst
     ADD     #1,W                    ; 1 increment dst addr
     ADD     #1,TOS                  ; 1 increment count of moved chars
-    JMP     YEMIT                   ; 9/6~ send echo to terminal if ECHO, do nothing if NOECHO
+    JMP     YEMIT1                  ; 9/6~ send echo to terminal if ECHO, do nothing if NOECHO
 ; ----------------------------------; 32/29~ char loop, add 14~ for readsectorW ==> 46/43~ ==> 174/186 kbytes/s @ 8MHz
-SDA_GetFileNextSector               ; StringOrg' TIB_LEN Count --
+SDA_GetFileNextSector               ; CIB CPL Count --
 ; ----------------------------------;
     PUSH    W                       ; save dst
     CALL    #Read_File              ; that resets BufferPtr