Date : Wed, 05 Aug 2009 21:04:05 +0100
From : mfirth@... (Michael Firth)
Subject: Level 4 FS Y2K query
----- Original Message -----
From: "Jonathan Graham Harston" <jgh@...>
To: <bbc-micro@...>
Sent: Wednesday, August 05, 2009 12:07 PM
Subject: Re: [BBC-Micro] Level 4 FS Y2K query
>> Message-ID: <971C5A27701644AABF7B086BA2040137@...>
>
> "Michael Firth" wrote:
>> However, when I create files (in particular using CopyFiles) the date is
>
> That's CopyFiles setting the file's update date to zero instead of
> either setting it to the source file's date or (if no source file
> date), leaving it alone as whatever the file server sets it to - ie
> "today".
>
It isn't just when I use CopyFiles, the dates don't work correctly for any
files I create.
For example if I do *SPOOL FILE, type some text, then do *SPOOL, to create a
new
text file, the created file still has a date of 1st Jan 1981. Similarly, if
I create and save a
BASIC program the behaviour is the same.
Is there a version of the L4FS code that is known to work?
Interestingly, it looks like the underlying RiscOS (3.11 in my case) stores
either the date
or a LOAD/EXEC address for the files - the file info screen for a given file
in a folder in
the desktop will display either one or the other.
Forgive my ignorance, but is this a limitation of RiscOS, or just the way
the desktop is
displaying things?
>> shown as 01.01.1981, and (today) the *DATE command returned "99th August
>> 1989".
>
> Nothing wrong with L4FS, it's your *DATE command.
>
> It's doing year%=1981+b1%DIV16 instead of
> year%=1981+b1%DIV16+(b0%AND&E0)DIV2 and day%=b0% instead of
> day%=b0% AND 31.
>
> A two-byte Acorn date is the following format:
> byte 0 : b0-b4 - day of month 0-31
> : b5-b7 - (year-1981)DIV16
> byte 1 : b0-b3 - month 0-15
> : b4-b7 - (year-1981)AND15
>
> See http://beebwiki.jonripley.com/OSFILE or
> http://mdfs.net/Docs/Comp/BBC/API/OSFILE.htm
>
I agree that its the DATE command (its an Acorn one, not my creation!)
that's wrong,
but it is querying the file server for the date. Before Johan posted the
disassembly, it
wasn't clear which end of the system had the problem.
Do you know of a working version of the *DATE command for the BBC B? (not
that
it really matters, but it would be nice to have)
I have at least two different copies of the DATE command, and both I've
tried give the
wrong date, but different wrong dates.
> The FDate BASIC library at http://mdfs.net/blib provides routines
> to convert file dates to and from human format, eg
>
> PROCf_date(X%!15):P.;day%;"/";month%;"/";year%
>
> In 6502 code, you'd do something like:
>
> LDA ctrl+15:AND #31:STA day
> LDA ctrl+16:AND #15:STA month
> LDA ctrl+16:LSR A:LSR A:LSR A:LSR A:STA year
> LDA ctrl+15:AND #&E0:LSR A:ORA year:STA year
>
> giving day=0..31, month=0..15, year=0..127
>
That's probably a useful starting point - I'll have a go at creating a
working version of the
command, if no one already knows of one.
Regards
Michael