Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/setime.asm @ 2152:74fb212cb659
Changelog comes from higher up
author | boisy |
---|---|
date | Wed, 14 May 2008 02:13:22 +0000 |
parents | 84ea83668304 |
children |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Setime - Set Date/Time | |
3 * | |
4 * $Id$ | |
5 * | |
6 * This is a Setime for use when a Y2K compliant system is required. | |
7 * | |
8 * This is somewhat of a cheat in that any attempts to do a full | |
9 * 4 digit conversion on the entered date string would have | |
10 * seriously broken the nice, generally compact codeing of the | |
11 * original setime module. I didn't want to do that, so I cheated | |
12 * and simply added one more byte to the date packet image it builds | |
13 * on the stack. Its conversion algorithm does 2 digits per pass/byte | |
14 * so if you enter 1998 (You MUST now enter the year as a 4 digit | |
15 * value!), this image will have a $13 as itas first and unused | |
16 * digit, if you enter a 20xx date, it will be a $14. | |
17 * | |
18 * I check this value after the rest of the conversion is all | |
19 * done, and if its $14 (or more), an extra 100 ($64) is added to the | |
20 * os9 year byte before the system F$STime call is made, pointing | |
21 * the F$STime call at only the normal 6 byte packet of time data. | |
22 * | |
23 * I've played with this maybe 20 minutes. Hopefully you can use | |
24 * this into the next century without any further concerns about | |
25 * the "Y2K" problem. | |
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 * 10 ????/??/?? 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 * 11 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 totally compliant for 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 * 12 2002/07/20 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
37 * Typing a CR at the prompt no longer sets the time to a bogus value. |
0 | 38 |
39 nam Setime | |
40 ttl Set Date/Time | |
41 | |
42 * Disassembled 96/09/26 00:34:54 by Dsm v1.7 (C) 1988 by RML | |
43 | |
44 ifp1 | |
45 use defsfile | |
46 endc | |
47 | |
48 tylg set Prgrm+Objct | |
49 atrv set ReEnt+rev | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
924
diff
changeset
|
50 rev set $00 |
265
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
51 edition set 12 |
0 | 52 |
53 mod eom,name,tylg,atrv,start,size | |
54 | |
924 | 55 org 0 |
0 | 56 u0000 rmb 450 |
57 size equ . | |
58 | |
59 name fcs /Setime/ | |
60 fcb 10 | |
61 | |
62 L0014 fcb C$LF | |
63 fcb C$LF | |
64 fcb C$BELL | |
65 fcc " >> No Clock module found <<" | |
66 fcb C$LF | |
67 fcb C$LF | |
68 L0036 fcb C$LF | |
69 fcb C$LF | |
70 fcb C$BELL | |
71 fcc " >> Clock Initialization Errors <<" | |
72 fcb C$LF | |
73 fcb C$LF | |
74 L005E fcb C$LF | |
75 fcc " yyyy/mm/dd hh:mm:ss" | |
76 fcb C$LF | |
77 fcc "Time ? " | |
78 L005EL equ *-L005E | |
79 | |
80 start cmpd #2 | |
81 bcc L00A3 | |
82 leas <-20,s | |
83 leax >L005E,pcr | |
84 ldy #L005EL | |
85 lda #1 | |
86 os9 I$WritLn | |
87 leax ,s | |
88 lda #C$CR | |
89 sta ,x | |
90 ldy #21 | |
91 clra | |
92 os9 I$ReadLn | |
93 | |
265
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
94 L00A3 |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
95 * BGP: following lines added in case CR is pressed at prompt. No need to set time |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
96 * if there is nothing to process |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
97 GetNext lda ,x+ +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
98 cmpa #C$CR +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
99 beq L00DF +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
100 cmpa #C$SPAC +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
101 beq GetNext +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
102 cmpa #C$COMA +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
103 beq GetNext +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
104 leax -1,x +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
105 |
0 | 106 * Make room for time packet on stack |
265
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
107 leas -7,s |
0 | 108 bsr L00E3 |
109 stb ,s | |
110 bsr L00E3 | |
111 stb $01,s | |
112 bsr L00E3 | |
113 stb $02,s | |
114 bsr L00E3 | |
115 stb $03,s | |
116 bsr L00E3 | |
117 stb $04,s | |
118 bsr L00E3 | |
119 stb $05,s | |
120 bsr L00E3 | |
121 stb $06,s now we have a 7 byte pkt | |
122 ldb ,s get 1st 2 digits (century) | |
123 subb #19 subtract 19 from century +BGP+ | |
124 lda #100 now we will +BGP+ | |
125 mul multiply difference * 100, now B holds 0, 100 or 200 +BGP+ | |
126 addb 1,s add os9's year to century byte +BGP+ | |
127 stb 1,s save back in year | |
128 leax 1,s | |
129 os9 F$STime | |
130 bcc L00DF | |
131 cmpb #$EA | |
132 bne L00D2 | |
133 leax >L0014,pcr | |
134 ldy #$0022 | |
135 bra L00DA | |
136 L00D2 leax >L0036,pcr | |
137 ldy #40 | |
138 L00DA lda #1 | |
139 os9 I$WritLn | |
140 L00DF clrb | |
141 os9 F$Exit | |
142 | |
143 L00E3 clrb | |
144 bsr L0101 | |
145 bsr L0101 | |
146 lda ,x+ | |
147 cmpa #C$SPAC | |
148 beq L0100 | |
149 cmpa #'/ | |
150 beq L0100 | |
151 cmpa #': | |
152 beq L0100 | |
11 | 153 cmpa #C$COMA |
0 | 154 beq L0100 |
11 | 155 cmpa #C$PERD |
0 | 156 beq L0100 |
157 leax -1,x | |
158 L0100 rts | |
159 | |
160 L0101 lda ,x get a digit | |
161 suba #$30 make it binary | |
162 bcs L0114 not a number, go | |
163 cmpa #$09 | |
164 bhi L0114 not a number, go | |
165 leax $01,x inc to next num | |
166 pshs a save a | |
167 lda #$0A do a 10x | |
168 mul | |
169 addb ,s+ save result | |
170 L0114 rts all done | |
171 | |
172 emod | |
173 eom equ * | |
174 end |