Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/date.asm @ 1748:949d4df97cca
Fixed some comments, made better use of symbolics
author | boisy |
---|---|
date | Thu, 03 Mar 2005 23:19:49 +0000 |
parents | ecffde67b7be |
children | c7fe687a5cbd |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Date - Print Date/Time | |
3 * | |
4 * $Id$ | |
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 * | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
27 * Edt/Rev YYYY/MM/DD Modified by |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
28 * Comment |
0 | 29 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
30 * 5 1996/09/25 Gene Heskett |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
31 * Made Y2K compliant. |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
32 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
33 * 6 1999/05/07 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
34 * Made compliant with 1900-2155. |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
35 * |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
36 * 7 2003/01/14 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
37 * New option is now -t, code compacted a bit. |
1603 | 38 * |
39 * 8 2004/06/07 Rodney V. Hamilton | |
40 * Compacted date conversion and printing. | |
0 | 41 |
42 nam Date | |
43 ttl Print Date/Time | |
44 | |
45 ifp1 | |
46 use defsfile | |
47 endc | |
48 | |
49 tylg set Prgrm+Objct | |
50 atrv set ReEnt+rev | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
51 rev set $00 |
1603 | 52 edition set 8 |
0 | 53 |
54 mod eom,name,tylg,atrv,start,size | |
55 | |
834 | 56 org 0 |
924 | 57 sysyear rmb 1 |
58 sysmonth rmb 1 | |
59 sysday rmb 1 | |
60 syshour rmb 1 | |
61 sysmin rmb 1 | |
62 syssec rmb 1 | |
0 | 63 u0006 rmb 2 |
64 u0008 rmb 440 | |
65 size equ . | |
66 | |
67 name fcs /Date/ | |
68 fcb edition | |
69 | |
834 | 70 MonTable fcs '???' |
71 fcs 'January' | |
72 fcs 'February' | |
73 fcs 'March' | |
74 fcs 'April' | |
75 fcs 'May' | |
76 fcs 'June' | |
77 fcs 'July' | |
78 fcs 'August' | |
79 fcs 'September' | |
80 fcs 'October' | |
81 fcs 'November' | |
82 fcs 'December' | |
0 | 83 |
84 start pshs x | |
924 | 85 leax sysyear,u |
0 | 86 leau u0008,u |
87 stu <u0006 | |
88 os9 F$Time | |
834 | 89 bsr Add2Buff go print the date in buffer |
90 ldd [,s++] now, did we have a -t | |
91 andb #$DF | |
92 cmpd #$2D54 -T? | |
93 bne PrBuff wasn't | |
0 | 94 ldd #C$SPAC*256+C$SPAC else space it out |
95 std ,u++ | |
834 | 96 bsr DoTime and go add the time to the buffer |
97 PrBuff lda #C$CR terminate the line to print | |
0 | 98 sta ,u+ |
834 | 99 lda #1 standard out |
0 | 100 ldx <u0006 |
834 | 101 ldy #40 |
102 os9 I$WritLn and go print it | |
103 bcs Exit | |
0 | 104 clrb |
834 | 105 Exit os9 F$Exit |
106 | |
924 | 107 DoTime ldb <syshour |
834 | 108 bsr Byte2ASC |
924 | 109 ldb <sysmin |
0 | 110 bsr L00AB |
924 | 111 ldb <syssec |
834 | 112 L00AB lda #': |
0 | 113 sta ,u+ |
834 | 114 bra Byte2ASC |
115 | |
116 Add2Buff leay >MonTable,pcr point to month table | |
924 | 117 ldb <sysmonth get month byte |
834 | 118 beq L00C4 branch if zero (illegal) |
119 cmpb #12 compare against last month of year | |
120 bhi L00C4 if too high, branch | |
121 L00BD lda ,y+ get byte | |
122 bpl L00BD keep going if hi bit not set | |
123 decb else decrement month | |
124 bne L00BD if not 0, keep going | |
0 | 125 L00C4 bsr PrtStrng |
924 | 126 ldb <sysday |
834 | 127 bsr Byte2ASC |
128 ldd #C$COMA*256+C$SPAC get comma and space in D | |
129 std ,u++ store in buffer and increment twice | |
1603 | 130 lda <sysyear get year |
131 ldb #19-1 century in B | |
132 CntyLp incb add a century | |
133 suba #100 subtract 100 yrs | |
134 bhs CntyLp until yr<0 | |
135 adda #100 restore year to 00-99 range | |
136 pshs a save year | |
137 bsr Byte2ASC print century | |
138 puls b restore year & print | |
834 | 139 |
1603 | 140 * write B reg to buffer as 2-digit decimal ASCII |
141 * we don't need to do 100s digit, value are 00-99 | |
142 Byte2ASC lda #'0-1 start A out just below $30 (0) | |
143 Tens inca inc it | |
144 subb #10 subtract 10 | |
145 bcc Tens if result >= 0, continue | |
146 sta ,u+ else save 10's digit | |
147 addb #'0+10 | |
834 | 148 stb ,u+ and 1's digit |
0 | 149 rts |
150 | |
151 * * * * * * * * * * * | |
152 * make fcs strings printable | |
153 PrtStrng lda ,y | |
154 anda #$7F | |
155 sta ,u+ | |
156 lda ,y+ | |
157 bpl PrtStrng | |
834 | 158 lda #C$SPAC |
159 sta ,u+ | |
0 | 160 rts |
161 | |
162 * * * * * * * * * * * | |
163 * all done here folks | |
164 emod | |
165 eom equ * | |
166 end | |
167 |