-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathm2clock.mod
More file actions
44 lines (38 loc) · 1.03 KB
/
m2clock.mod
File metadata and controls
44 lines (38 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(*$Segment M2Clock*)
(*$RangeCheck+*)
(*$OverflowCheck+*)
IMPLEMENTATION MODULE M2Clock;
FROM SYSTEM IMPORT WORD, INLINE, GETREG;
FROM W65C816 IMPORT PHA, PLX, PLA, CPU;
PROCEDURE ReadTimeHex(); TOOL 0D03H;
PROCEDURE GetKeyTime(VAR t: KeyTime);
TYPE
aDateTime=
RECORD
CASE :CARDINAL OF
0: lv: LONGINT;
|
1: lo, hi: WORD;
|
2: minute, second: CHAR;
year, day: CHAR;
|
3: month, hour: CHAR;
weekday, null: CHAR;
END;
END;
VAR
hi, lo: aDateTime;
BEGIN
INLINE(PHA, PHA, PHA, PHA);
ReadTimeHex();
INLINE(PLA, PLX); (* pull the low longint *)
GETREG(CPU, lo.lv);
INLINE(PLA, PLX); (* pull the high longint *)
GETREG(CPU, hi.lv);
t.day := VAL(CARDINAL, (ORD(lo.year)*20B + ORD(hi.month))*40B +
ORD(lo.day));
t.minute := VAL(CARDINAL, ORD(hi.hour)*60 + ORD(lo.minute));
t.millisecond := VAL(CARDINAL, ORD(lo.second)*1000);
END GetKeyTime;
END M2Clock.