Difference: MicroSdBlocks (45 vs. 46)

Revision 462020-08-29 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 214 to 214
  The FIL data structure can be created as follows:

Changed:
<
<
create fil /FIL allot
>
>
create fil /FIL allot ok.
 

See also f_open.

Print current directory:


Changed:
<
<
256 buffer: path path 256 f_getcwd drop strlen type
>
>
256 buffer: path[RET] ok. path 256 f_getcwd drop strlen type[RET] / ok. or easier with unix like command pwd:
pwd[RET]
/ ok.

 

Change current directory


Changed:
<
<
path 256 accept common path swap str0term drop f_chdir .
>
>
path 256 accept[RET] common[RET] ok. path swap 2dup str0term drop f_chdir .[RET] 0 ok. pwd[RET] /common ok.
 
Added:
>
>
path dup .str" /fsr" f_chdir .[RET] 0 ok.
pwd[RET]
/fsr ok.
 

Data Structures

Line: 361 to 372
 Caution! There must be space for the 0 character at the end of the string.
: str0term ( cadr len -- cadr len )

Deleted:
<
<
2dup
  + 0 swap c! ;
Line: 471 to 481
 

C-String Helpers

Changed:
<
<
Middleware like FatFs and RTOS expect C strings (0 terminated strings).
>
>
Middleware like FatFs and RTOS expect C strings (see null-terminated string). In Forth, the preferred representation of strings on the stack is c-addr u-count, where c-addr is the address of the first character and u-count is the number of characters in the string.
 

Changed:
<
<
str0term ( cadr len -- cadr len ) null-terminated string strlen ( c-addr -- c-addr len ) calculate the length of a C string
>
>
str0term ( c-addr len -- ) make Forth string null-terminated, be sure the buffer is long enough to accept an additional 0 character. strlen ( c-addr -- c-addr len ) calculate the length of a C string, Forth string compatible
 .str" ( c-addr "text" -- len ) copy string into buffer
Changed:
<
<
.( ( "text) -- )
>
>
.( ( "text) -- ) Mecrisp's ." is working only in compile mode
 
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback