Assembly Techniques: Millennia
by Martyn Fox

This application is a new version of a program published in The Micro User
around 1990. The original program was written in Basic. This version was
written in assembly language as described in the article on page 17 of the
magazine.

The application shows a one-month-to-a-view calendar for any month from
January 1 AD to December 9999 AD. The month may be displayed with the weeks
beginning on either Sunday or Monday.

The calendar conforms to the British calendar which changed from the Julian
to the Gregorian calendar in September 1752.

It is possible to step forwards or backwards through the months or years.
Alternatively, a chosen month and year may be entered by means of a dialogue
box. The month may be entered by name (which may be any unambiguous
abbreviation) or by its number.

For convenience, the year number may be entered as a two-digit number. This
number is taken to refer to a year within a span of 100 years containing the
current year. How much of this period is before the current year and how much
after may be set in a dialogue box. This number, together with the day on
which the displayed weeks start, may be saved in a file to set the
application's startup conditions.

Double-clicking on the application icon in the directory window runs the
application and installs its icon on the icon bar. Clicking on this icon
opens the calendar window, showing the current month, with the current date
highlighted in yellow.

Clicking Select on one of the left-hand pair of arrows moves onwards or
backwards one month. Clicking on the right-hand pair moves onwards or
backwards one year. Adjust has the opposite effect to Select.

A double-click with Adjust anywhere in the window other than on the arrow
buttons returns the calendar to the current month (this will also happen if
you click Adjust on the icon bar icon). A double-click with Select will open
the dialogue box which allows a new month and year to be set. This dialogue
box can also be opened from the main menu.

The month may be entered either as its name, which can be abbreviated, or as
its number 1 - 12. Any abbreviation must contain sufficient letters to be
distinguishable from the name of an earlier month.

If the year number is less than 100, the resulting year will depend on the
'1st century' button in the dialogue box. If this is ticked, the year will be
in the first century AD, i.e. between 1 and 99.

If the '1st century' button is not ticked, the year will be within 100 years
of the current year. The century to which this refers may be determined by
the '2-digit year' icon in the choices dialogue box (accessible from the
menu). This shows how many years in the future the figure may refer to. If,
for example, the '2-digit year' icon is set to 20 (the default value) and the
current year is 1998, any two-digit number will refer to a year between 1918
and 2017. Thus '12' will be translated as 2012 and '56' as 1956.

A shift-double-click with either Select or Adjust will put a text string
containing the date into the keyboard buffer. The format of the string may be
selected via the Choices dialogue box, using the same symbols as in the Alarm
application. Note that, because the string is produced by the operating
system, this feature is only available for the years between 1900 and 2247.

Notes on the Julian Calendar
============================

I am indebted to Mr. Michael Leete of Rowarth, Cheshire for most of the
following information.

This application shows the British calendar, which changed from the Julian to
the Gregorian calendar in September 1752.

Under the Julian calendar, introduced by Julius Caesar, every forth year was
a leap year. In the 16th century, it was realised that the length of the year
was slightly less than 365.25 days, and that there had been too many leap
years - about ten since the beginning of the Christian epoch. A new calendar
was devised in 1582, under the auspices of Pope Gregory XIII, in which three
leap years were omitted every 400 years, when the year number was divisible
by 100 but not 400.

To change to this new Gregorian calendar meant dropping ten days from the
calendar. Various European countries changed over the next 200 years or so,
depending on how strongly they adhered to the Roman Catholic Church.  Britain
did not change until 1752, by which time they had had an extra leap year, in
1700, so that eleven days had to be dropped. In order to make the change, the
2nd of September was followed by the 14th. The peasants revolted, thinking
that eleven days were being cut from their lives,  shouting "Give us back our
eleven days!"

The Christian epoch, which was later named Anno Domini by Bede, was invented
by Dionysius Exiguus in 532 AD. He calculated the year in which the
Annunciation was thought to have occurred, called this year one, and counted
the years from this date. For this reason, the calendar year  changed at the
time of the Annunciation, about a week before the end of March. The
historical year began on 1st January. This means that the months January,
February and March could be thought of as being either at the start of the
historical year, or at the end of the preceding calendar year. Historians
customarily write such dates as "February 1749/50". The year 1751 was
shortened by three months, so that 1752 began on 1st January. This calendar
shows only historical years.

The basic calendar was invented by the Romans, with months alternating in
length between 30 and 31 days. Julius Caesar, with the help of astronomers,
determined that the year was 365.25 days long. He introduced a calendar with
an intercalation in February, when two successive days were dated
identically, and started this system in what turned out to be 45 BC. In the
following year, he was murdered and the Senate, who were obviously not great
mathematicians, ordered intercalations every three years. The Emperor
Octavian came along, changed his name to Augustus and decided to name a month
after himself, like Julius Caesar, who had July, with 31 days. He chose the
following month, but, not wanting to have fewer days than  Julius, he
determined that August should have 31 days, and messed up the alternating
system of 30 and 31 days. He realised that there had been too many
intercalations and decreed that there would not be another until 8 AD. For
this reason, 4 AD was not a leap year.

Before 1000 AD, and certainly before the Synod of Whitby (664 AD), there were
a variety of ways of counting the dates, so any calendar before then is a
trifle vague. This application, however, shows the system that was decided
upon, projected backwards to 1 AD.

Copyright  RISC User 1999
