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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * Date - Print Date/Time
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Greetings; September 25, 1996
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * This 'Date' module, date5, has been expanded a wee bit to
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 * make it smart enough to handle dates to the year 2099.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 * In order to have it do it in a math conversion, I would have had to
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * make the 8 bit math it does into 16 bit, and there aren't enough
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * registers in the 6809 to pull that off in a reasonable code size.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 * So it still does 8 bit math, but only has a 1900-2099 year total
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 * range. This is more than the recently converted clock for the Disto
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 * 4n1 I just uploaded, as that clock now has a range from 1980 to 2079.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 * A simple subtraction determines if it prints a leading 20, and the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * contents of the register after the subtraction, or it reloads the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 * string pointer to point at 19 and reloads the year register to get
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 * the year 00-99 to print.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 * This contains no 6309 specific code, so Nitros9 and a 6309 cpu
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 * are not required to use it, box stock is fine.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 * Gene Heskett, <gene_heskett@wvlink.mpl.com>
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
38 *
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
39 * 8 2004/06/07 Rodney V. Hamilton
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
40 * Compacted date conversion and printing.
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 nam Date
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 ttl Print Date/Time
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 tylg set Prgrm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
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
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
52 edition set 8
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 mod eom,name,tylg,atrv,start,size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
56 org 0
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
57 sysyear rmb 1
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
58 sysmonth rmb 1
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
59 sysday rmb 1
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
60 syshour rmb 1
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
61 sysmin rmb 1
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
62 syssec rmb 1
1928
c7fe687a5cbd Minor source formatting
boisy
parents: 1603
diff changeset
63 bufptr rmb 2
c7fe687a5cbd Minor source formatting
boisy
parents: 1603
diff changeset
64 buffer rmb 40
c7fe687a5cbd Minor source formatting
boisy
parents: 1603
diff changeset
65 rmb 400
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 name fcs /Date/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
71 MonTable fcs '???'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
72 fcs 'January'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
73 fcs 'February'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
74 fcs 'March'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
75 fcs 'April'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
76 fcs 'May'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
77 fcs 'June'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
78 fcs 'July'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
79 fcs 'August'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
80 fcs 'September'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
81 fcs 'October'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
82 fcs 'November'
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
83 fcs 'December'
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 start pshs x
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
86 leax sysyear,u
1928
c7fe687a5cbd Minor source formatting
boisy
parents: 1603
diff changeset
87 leau buffer,u
c7fe687a5cbd Minor source formatting
boisy
parents: 1603
diff changeset
88 stu <bufptr
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 os9 F$Time
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
90 bsr Add2Buff go print the date in buffer
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
91 ldd [,s++] now, did we have a -t
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
92 andb #$DF
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
93 cmpd #$2D54 -T?
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
94 bne PrBuff wasn't
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 ldd #C$SPAC*256+C$SPAC else space it out
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 std ,u++
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
97 bsr DoTime and go add the time to the buffer
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
98 PrBuff lda #C$CR terminate the line to print
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 sta ,u+
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
100 lda #1 standard out
1928
c7fe687a5cbd Minor source formatting
boisy
parents: 1603
diff changeset
101 ldx <bufptr
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
102 ldy #40
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
103 os9 I$WritLn and go print it
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
104 bcs Exit
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 clrb
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
106 Exit os9 F$Exit
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
107
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
108 DoTime ldb <syshour
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
109 bsr Byte2ASC
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
110 ldb <sysmin
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 bsr L00AB
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
112 ldb <syssec
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
113 L00AB lda #':
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 sta ,u+
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
115 bra Byte2ASC
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
116
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
117 Add2Buff leay >MonTable,pcr point to month table
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
118 ldb <sysmonth get month byte
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
119 beq L00C4 branch if zero (illegal)
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
120 cmpb #12 compare against last month of year
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
121 bhi L00C4 if too high, branch
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
122 L00BD lda ,y+ get byte
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
123 bpl L00BD keep going if hi bit not set
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
124 decb else decrement month
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
125 bne L00BD if not 0, keep going
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 L00C4 bsr PrtStrng
924
c155aac72190 Made cosmetic changes
boisy
parents: 834
diff changeset
127 ldb <sysday
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
128 bsr Byte2ASC
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
129 ldd #C$COMA*256+C$SPAC get comma and space in D
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
130 std ,u++ store in buffer and increment twice
1603
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
131 lda <sysyear get year
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
132 ldb #19-1 century in B
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
133 CntyLp incb add a century
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
134 suba #100 subtract 100 yrs
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
135 bhs CntyLp until yr<0
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
136 adda #100 restore year to 00-99 range
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
137 pshs a save year
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
138 bsr Byte2ASC print century
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
139 puls b restore year & print
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
140
1603
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
141 * write B reg to buffer as 2-digit decimal ASCII
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
142 * we don't need to do 100s digit, value are 00-99
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
143 Byte2ASC lda #'0-1 start A out just below $30 (0)
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
144 Tens inca inc it
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
145 subb #10 subtract 10
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
146 bcc Tens if result >= 0, continue
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
147 sta ,u+ else save 10's digit
ecffde67b7be date command optimized by RVH
boisy
parents: 1325
diff changeset
148 addb #'0+10
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
149 stb ,u+ and 1's digit
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 * * * * * * * * * * *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 * make fcs strings printable
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 PrtStrng lda ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 anda #$7F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 sta ,u+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 lda ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 bpl PrtStrng
834
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
159 lda #C$SPAC
4a8e6693b9fe New option is -t, compacted a bit
boisy
parents: 0
diff changeset
160 sta ,u+
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 * * * * * * * * * * *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 * all done here folks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168