home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
UpTime Volume 1 #8
/
utv1n8s2.d64
/
timepiece
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-28
|
2KB
|
88 lines
100 rem ******time*piece******
110 rem * *
120 rem * copyright (c) 1987 *
130 rem * by *
140 rem * john m. campbell *
150 rem * *
155 rem * all rights reserved*
160 rem **********************
170 ad=49152 : rem load address
180 p0=158 : rem zero page address ptr
190 aa=ad+22
200 print "loading time*piece"
210 rem load display routine
220 read d
230 if d<0 then 270
240 poke aa,d
250 aa=aa+1
260 goto 220
270 rem load zero page address pointer
280 a1=int((ad+9)/256):poke p0+1,a1
290 a0=(ad+9)-a1*256:poke p0,a0
300 poke ad+26,p0 : poke ad+46,p0
310 poke ad+57,p0 : poke ad+69,p0
320 rem read irq interrupt vector
330 poke ad+84,peek(788)
340 poke ad+85,peek(789)
350 rem load vector to ml program
360 for i=0 to 12
370 read d : poke ad+i,d
380 next i
390 v1=int((ad+23)/256):poke ad+7,v1
400 v0=(ad+23)-a1*256:poke ad+2,v0
410 sys ad : rem activate vector change
420 rem load toggle routine
430 aa=ad
440 read d
450 if d<0 then 490
460 poke aa,d
470 aa=aa+1
480 goto 440
490 poke ad+3,p0 : poke ad+7,p0
500 print "time*piece loaded"
510 rem prompt for time
520 hr=0:mn=0:sc=0:h=0:m=0:s=0
530 input "enter hour (1-12)";hr
540 if (hr<0) or (hr>12) then gosub 750:goto 530
550 if hr>=10 then h=16:hr=hr-10
560 h=h+hr
570 poke 56331,h
580 input "enter minute (0-59)";mn
590 if (mn<0) or (mn>59) then gosub 750:goto 580
600 mn$=str$(mn)
610 if mn>=10 then m=16*val(right$(left$(mn$,2),1))
620 m=m+val(right$(mn$,1))
630 poke 56330,m
640 input "enter second (0-59)";sc
650 if (sc<0) or (sc>59) then gosub 750:goto 640
660 sc$=str$(sc)
670 if sc>=10 then s=16*val(right$(left$(sc$,2),1))
680 s=s+val(right$(sc$,1))
690 poke 56329,s
700 poke 56328,0
710 print "activating time*piece"
720 print chr$(18)"type 'sys"ad;chr$(20)"' to enable/disable clock"
730 sys ad
740 end
750 rem error message
760 print "incorrect input - redo from start"
770 return
780 data 0,160, 13,177,158,240
790 data 54,160, 5,162, 2,189, 9
800 data 220, 74, 74, 74, 74, 41, 7
810 data 24,105, 48,145,158,200,189
820 data 9,220, 41, 15, 24,105, 48
830 data 145,158,200,200,202, 16,226
840 data 173, 8,220,160, 12,177,158
850 data 9,128,153, 27, 4,169, 1
860 data 153, 27,216,136, 16,241
870 data 76, 0, 0, -1
880 rem vector routine
890 data 120,169, 0,141, 20, 3
900 data 169, 0,141, 21, 3, 88, 96
910 rem toggle routine
920 data 160, 13,177,158, 73, 1,145
930 data 158, 96, 20, 9, 13, 5, 32
940 data 48, 48, 58, 48, 48, 58, 48
950 data 48, -1