; 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
; ----------------------------------;
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
; ----------------------------------; 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