[SLOF] [PATCH v2] fat-files: Fix access to FAT32 dir/files when cluster > 16-bits
Thomas Huth
thuth at redhat.com
Thu Jun 9 18:32:03 AEST 2016
On 09.06.2016 10:21, Segher Boessenkool wrote:
> On Thu, Jun 09, 2016 at 09:35:42AM +0200, Thomas Huth wrote:
>>> : (find-file) ( -- cluster file-len is-dir? true | false )
>>> data @ BEGIN dup data @ #data @ + < WHILE
>>> dup dos-name b comp WHILE 20 + REPEAT
>>> - dup 1a + 2c@ bwjoin swap dup 1c + 4c@ bljoin swap 0b + c@ 10 and 0<> true
>>> + dup get-cluster
>>> + swap dup 1c + 4c@ bljoin swap 0b + c@ 10 and 0<> true
>>> ELSE drop false THEN ;
>>
>> Unrelated to your patch, but: WTF? Where's the IF-statement for that
>> ELSE? ... must be some magic code by Segher again ... ;-)
>
> Heh. Nothing magic, just
>
> BEGIN ... WHILE ... WHILE ... REPEAT ... ELSE ... THEN
>
> 1: BEGIN
> ...
> WHILE \ if 0, goto 3
> ...
> WHILE \ if 0, goto 2
> ...
> REPEAT \ goto 1
> 2: ...
> ELSE \ goto 4
> 3: ...
> THEN
> 4:
>
> so just an indeterminate loop with two exits.
Wow ... and I thought I basically would be able nowadays to understand
most of the Forth code that you wrote ... looks like I was wrong 8-)
Thanks for the explanation!
Thomas
More information about the SLOF
mailing list