Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/setime.asm @ 265:4b547814b192
Added code to prevent setting of time if carriage return was pressed
at time prompt.
author | boisy |
---|---|
date | Sun, 21 Jul 2002 03:01:36 +0000 |
parents | e9ce43cc215e |
children | c155aac72190 |
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 * | |
27 * Ed. Comments Who YY/MM/DD | |
28 * ------------------------------------------------------------------ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
11
diff
changeset
|
29 * 10 Made Y2K compliant GH |
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
11
diff
changeset
|
30 * 11 Made totally compliant for 1900-2155 BGP 99/05/07 |
265
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
31 * 12 Typing a CR at the prompt no longer sets the BGP 02/07/20 |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
32 * time to a bogus value. |
0 | 33 |
34 nam Setime | |
35 ttl Set Date/Time | |
36 | |
37 * Disassembled 96/09/26 00:34:54 by Dsm v1.7 (C) 1988 by RML | |
38 | |
39 ifp1 | |
40 use defsfile | |
41 endc | |
42 | |
43 tylg set Prgrm+Objct | |
44 atrv set ReEnt+rev | |
45 rev set $01 | |
265
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
46 edition set 12 |
0 | 47 |
48 mod eom,name,tylg,atrv,start,size | |
49 | |
50 u0000 rmb 450 | |
51 size equ . | |
52 | |
53 name fcs /Setime/ | |
54 fcb 10 | |
55 | |
56 L0014 fcb C$LF | |
57 fcb C$LF | |
58 fcb C$BELL | |
59 fcc " >> No Clock module found <<" | |
60 fcb C$LF | |
61 fcb C$LF | |
62 L0036 fcb C$LF | |
63 fcb C$LF | |
64 fcb C$BELL | |
65 fcc " >> Clock Initialization Errors <<" | |
66 fcb C$LF | |
67 fcb C$LF | |
68 L005E fcb C$LF | |
69 fcc " yyyy/mm/dd hh:mm:ss" | |
70 fcb C$LF | |
71 fcc "Time ? " | |
72 L005EL equ *-L005E | |
73 | |
74 start cmpd #2 | |
75 bcc L00A3 | |
76 leas <-20,s | |
77 leax >L005E,pcr | |
78 ldy #L005EL | |
79 lda #1 | |
80 os9 I$WritLn | |
81 leax ,s | |
82 lda #C$CR | |
83 sta ,x | |
84 ldy #21 | |
85 clra | |
86 os9 I$ReadLn | |
87 | |
265
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
88 L00A3 |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
89 * 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
|
90 * if there is nothing to process |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
91 GetNext lda ,x+ +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
92 cmpa #C$CR +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
93 beq L00DF +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
94 cmpa #C$SPAC +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
95 beq GetNext +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
96 cmpa #C$COMA +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
97 beq GetNext +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
98 leax -1,x +BGP+ |
4b547814b192
Added code to prevent setting of time if carriage return was pressed
boisy
parents:
200
diff
changeset
|
99 |
0 | 100 * 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
|
101 leas -7,s |
0 | 102 bsr L00E3 |
103 stb ,s | |
104 bsr L00E3 | |
105 stb $01,s | |
106 bsr L00E3 | |
107 stb $02,s | |
108 bsr L00E3 | |
109 stb $03,s | |
110 bsr L00E3 | |
111 stb $04,s | |
112 bsr L00E3 | |
113 stb $05,s | |
114 bsr L00E3 | |
115 stb $06,s now we have a 7 byte pkt | |
116 ldb ,s get 1st 2 digits (century) | |
117 subb #19 subtract 19 from century +BGP+ | |
118 lda #100 now we will +BGP+ | |
119 mul multiply difference * 100, now B holds 0, 100 or 200 +BGP+ | |
120 addb 1,s add os9's year to century byte +BGP+ | |
121 stb 1,s save back in year | |
122 leax 1,s | |
123 os9 F$STime | |
124 bcc L00DF | |
125 cmpb #$EA | |
126 bne L00D2 | |
127 leax >L0014,pcr | |
128 ldy #$0022 | |
129 bra L00DA | |
130 L00D2 leax >L0036,pcr | |
131 ldy #40 | |
132 L00DA lda #1 | |
133 os9 I$WritLn | |
134 L00DF clrb | |
135 os9 F$Exit | |
136 | |
137 L00E3 clrb | |
138 bsr L0101 | |
139 bsr L0101 | |
140 lda ,x+ | |
141 cmpa #C$SPAC | |
142 beq L0100 | |
143 cmpa #'/ | |
144 beq L0100 | |
145 cmpa #': | |
146 beq L0100 | |
11 | 147 cmpa #C$COMA |
0 | 148 beq L0100 |
11 | 149 cmpa #C$PERD |
0 | 150 beq L0100 |
151 leax -1,x | |
152 L0100 rts | |
153 | |
154 L0101 lda ,x get a digit | |
155 suba #$30 make it binary | |
156 bcs L0114 not a number, go | |
157 cmpa #$09 | |
158 bhi L0114 not a number, go | |
159 leax $01,x inc to next num | |
160 pshs a save a | |
161 lda #$0A do a 10x | |
162 mul | |
163 addb ,s+ save result | |
164 L0114 rts all done | |
165 | |
166 emod | |
167 eom equ * | |
168 end |