Date : Wed, 05 Aug 2009 12:07:26 +0100
From : jgh@... (Jonathan Graham Harston)
Subject: Level 4 FS Y2K query
"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".
> 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
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
--
J.G.Harston - jgh@... - mdfs.net/User/JGH
NOBODY expects the MACRO ARGUMENT INQUISITION! Our chief weapon is
unexpected addressing modes... unexpected addressing modes and local
branches out of range. Our two weapons are unexpected addressing modes and
local branches out of range and quoted argument lists. Our *three* weapons
are unexpected addressing modes, local branches out of range, quoted
argument lists, and an almost fanatical devotion to the pope. *Amongst* our
weapons are such elements as unexpected addressing modes, local branches out
of range... I'll come in again.