comparison CoCoOS9/level2v3/CMDS/date.asm @ 31:bd2b07db8917 cocoos9lv2v3

CoCoOS9 version
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Jul 2018 15:16:13 +0900
parents
children
comparison
equal deleted inserted replaced
30:7b1b25ff010a 31:bd2b07db8917
1 ********************************************************************
2 * Date - Print Date/Time
3 *
4 * $Id: date.asm,v 1.1.1.1 2001/02/21 23:30:54 boisy Exp $
5 *
6 * Greetings; September 25, 1996
7 *
8 * This 'Date' module, date5, has been expanded a wee bit to
9 * make it smart enough to handle dates to the year 2099.
10 *
11 * In order to have it do it in a math conversion, I would have had to
12 * make the 8 bit math it does into 16 bit, and there aren't enough
13 * registers in the 6809 to pull that off in a reasonable code size.
14 * So it still does 8 bit math, but only has a 1900-2099 year total
15 * range. This is more than the recently converted clock for the Disto
16 * 4n1 I just uploaded, as that clock now has a range from 1980 to 2079.
17 * A simple subtraction determines if it prints a leading 20, and the
18 * contents of the register after the subtraction, or it reloads the
19 * string pointer to point at 19 and reloads the year register to get
20 * the year 00-99 to print.
21 *
22 * This contains no 6309 specific code, so Nitros9 and a 6309 cpu
23 * are not required to use it, box stock is fine.
24 *
25 * Gene Heskett, <gene_heskett@wvlink.mpl.com>
26 *
27 * Ed. Comments Who YY/MM/DD
28 * ------------------------------------------------------------------
29 * 5 Made Y2K compliant GH 96/09/25
30 * 6 Made compliant with 1900-2155 BGP 99/05/07
31
32 nam Date
33 ttl Print Date/Time
34
35 ifp1
36 use defsfile
37 endc
38
39 tylg set Prgrm+Objct
40 atrv set ReEnt+rev
41 rev set $01
42 edition set 6
43
44 mod eom,name,tylg,atrv,start,size
45
46 SysYear rmb 1
47 SysMonth rmb 1
48 SysDay rmb 1
49 SysHour rmb 1
50 SysMin rmb 1
51 SysSec rmb 1
52 u0006 rmb 2
53 u0008 rmb 440
54 size equ .
55
56 name fcs /Date/
57 fcb edition
58
59 DtComa fcs ', '
60 MonTable fcs '??? '
61 fcs 'January '
62 fcs 'February '
63 fcs 'March '
64 fcs 'April '
65 fcs 'May '
66 fcs 'June '
67 fcs 'July '
68 fcs 'August '
69 fcs 'September '
70 fcs 'October '
71 fcs 'November '
72 fcs 'December '
73
74 start pshs x
75 leax ,u
76 leau u0008,u
77 stu <u0006
78 os9 F$Time
79 bsr PrntDate go print the date in buffer
80 lda [,s++] now, did we have a -t
81 eora #$54 option on the commandline?
82 anda #$DF
83 bne L008C wasn't a t
84 ldd #C$SPAC*256+C$SPAC else space it out
85 std ,u++
86 bsr L00A1 and go add the time to the buffer
87 L008C lda #C$CR terminate the line to print
88 sta ,u+
89 lda #1 standard out
90 ldx <u0006
91 ldy #$0028
92 os9 I$WritLn and go print it
93 bcs L009E
94 clrb
95 L009E os9 F$Exit
96 L00A1 ldb <SysHour
97 bsr L00D2
98 ldb <SysMin
99 bsr L00AB
100 ldb <SysSec
101 L00AB lda #$3A
102 sta ,u+
103 bra L00D2
104 PrntDate leay >MonTable,pcr
105 ldb <SysMonth
106 beq L00C4
107 cmpb #$0C
108 bhi L00C4
109 L00BD lda ,y+
110 bpl L00BD
111 decb
112 bne L00BD
113 L00C4 bsr PrtStrng
114 ldb <SysDay
115 bsr L00D2
116 leay >DtComa,pcr
117 bsr PrtStrng
118 ldb <SysYear get year
119 cmpb #100 compare against 100 (2000)
120 blo is19 if less than, it's 19XX, so branch
121 subb #100 else subtract 100
122 cmpb #100 compare against 100
123 blo is20 if less than, it's 20XX, so branch
124 subb #100
125 pshs b
126 ldb #21
127 bra pr
128 is20 pshs b
129 ldb #20
130 bra pr
131 is19 pshs b
132 ldb #19
133 pr bsr L00D2
134 puls b
135 L00D2 lda #$2F
136 L00D4 inca
137 subb #$64
138 bcc L00D4
139 sta ,u+
140 cmpa #$30
141 bne L00E1
142 leau -1,u
143 L00E1 lda #$3A
144 L00E3 deca
145 addb #$0A
146 bcc L00E3
147 sta ,u+
148 addb #$30
149 stb ,u+
150 rts
151
152 * * * * * * * * * * *
153 * make fcs strings printable
154 PrtStrng lda ,y
155 anda #$7F
156 sta ,u+
157 lda ,y+
158 bpl PrtStrng
159 rts
160
161 * * * * * * * * * * *
162 * all done here folks
163 emod
164 eom equ *
165 end
166