Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/date.asm @ 2798:b70d93f8d7ce lwtools-port
Updated coco1/modules/makefile and coco3/modules/makefile to help resolve issues with i(x) and s(x) descriptors.
Updated level1/coco1/modules/makefile & level2/coco3/modules/makefile
so that correct values would be sent to assembler when
building superdesc.asm for s(x).dd and i(x).dd descriptors.
author | drencor-xeen |
---|---|
date | Mon, 28 Jan 2013 16:13:05 -0600 |
parents | c7fe687a5cbd |
children |
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 | |
1928 | 63 bufptr rmb 2 |
64 buffer rmb 40 | |
65 rmb 400 | |
0 | 66 size equ . |
67 | |
68 name fcs /Date/ | |
69 fcb edition | |
70 | |
834 | 71 MonTable fcs '???' |
72 fcs 'January' | |
73 fcs 'February' | |
74 fcs 'March' | |
75 fcs 'April' | |
76 fcs 'May' | |
77 fcs 'June' | |
78 fcs 'July' | |
79 fcs 'August' | |
80 fcs 'September' | |
81 fcs 'October' | |
82 fcs 'November' | |
83 fcs 'December' | |
0 | 84 |
85 start pshs x | |
924 | 86 leax sysyear,u |
1928 | 87 leau buffer,u |
88 stu <bufptr | |
0 | 89 os9 F$Time |
834 | 90 bsr Add2Buff go print the date in buffer |
91 ldd [,s++] now, did we have a -t | |
92 andb #$DF | |
93 cmpd #$2D54 -T? | |
94 bne PrBuff wasn't | |
0 | 95 ldd #C$SPAC*256+C$SPAC else space it out |
96 std ,u++ | |
834 | 97 bsr DoTime and go add the time to the buffer |
98 PrBuff lda #C$CR terminate the line to print | |
0 | 99 sta ,u+ |
834 | 100 lda #1 standard out |
1928 | 101 ldx <bufptr |
834 | 102 ldy #40 |
103 os9 I$WritLn and go print it | |
104 bcs Exit | |
0 | 105 clrb |
834 | 106 Exit os9 F$Exit |
107 | |
924 | 108 DoTime ldb <syshour |
834 | 109 bsr Byte2ASC |
924 | 110 ldb <sysmin |
0 | 111 bsr L00AB |
924 | 112 ldb <syssec |
834 | 113 L00AB lda #': |
0 | 114 sta ,u+ |
834 | 115 bra Byte2ASC |
116 | |
117 Add2Buff leay >MonTable,pcr point to month table | |
924 | 118 ldb <sysmonth get month byte |
834 | 119 beq L00C4 branch if zero (illegal) |
120 cmpb #12 compare against last month of year | |
121 bhi L00C4 if too high, branch | |
122 L00BD lda ,y+ get byte | |
123 bpl L00BD keep going if hi bit not set | |
124 decb else decrement month | |
125 bne L00BD if not 0, keep going | |
0 | 126 L00C4 bsr PrtStrng |
924 | 127 ldb <sysday |
834 | 128 bsr Byte2ASC |
129 ldd #C$COMA*256+C$SPAC get comma and space in D | |
130 std ,u++ store in buffer and increment twice | |
1603 | 131 lda <sysyear get year |
132 ldb #19-1 century in B | |
133 CntyLp incb add a century | |
134 suba #100 subtract 100 yrs | |
135 bhs CntyLp until yr<0 | |
136 adda #100 restore year to 00-99 range | |
137 pshs a save year | |
138 bsr Byte2ASC print century | |
139 puls b restore year & print | |
834 | 140 |
1603 | 141 * write B reg to buffer as 2-digit decimal ASCII |
142 * we don't need to do 100s digit, value are 00-99 | |
143 Byte2ASC lda #'0-1 start A out just below $30 (0) | |
144 Tens inca inc it | |
145 subb #10 subtract 10 | |
146 bcc Tens if result >= 0, continue | |
147 sta ,u+ else save 10's digit | |
148 addb #'0+10 | |
834 | 149 stb ,u+ and 1's digit |
0 | 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 | |
834 | 159 lda #C$SPAC |
160 sta ,u+ | |
0 | 161 rts |
162 | |
163 * * * * * * * * * * * | |
164 * all done here folks | |
165 emod | |
166 eom equ * | |
167 end | |
168 |