Home » CEEFAX disks » telesoftware8.adl » 22-07-88/CLKSET » Compare

Compare 22-07-88/CLKSET with 25-12-87/CLKSET

File: CEEFAX disks » telesoftware8.adl » 22-07-88/CLKSET
Compared with: CEEFAX disks » telesoftware4.adl » 25-12-87/CLKSET
Similarity: 100% of bytes duplicated

697 of 701 lines (99.6%) are identical in the two listings. Duplicated Different

Line numbers are ignored when comparing lines, so that renumbered programs still match.

22-07-88/CLKSET 25-12-87/CLKSET
10REM SETCLOCK PROGRAM FOR MASTER 128 10REM SETCLOCK PROGRAM FOR MASTER 128
20REM (C) Ian Stubbs 1986 20REM (C) Ian Stubbs 1986
30REM REQUIRES BBC ATS ROM 30REM REQUIRES BBC ATS ROM
40: 40:
50MODE 7 50MODE 7
60HIMEM=&7000 60HIMEM=&7000
70DIM code% 280 70DIM code% 280
80DIM hexaddr 5 80DIM hexaddr 5
90osasci=&FFE3 90osasci=&FFE3
100osrdch=&FFE0 100osrdch=&FFE0
110oswrch=&FFEE 110oswrch=&FFEE
120osbyte=&FFF4 120osbyte=&FFF4
130osword=&FFF1 130osword=&FFF1
140oscli=&FFF7 140oscli=&FFF7
150PROCassemble_tools 150PROCassemble_tools
160PROCassemble(&7000) 160PROCassemble(&7000)
170PROCinstructions 170PROCinstructions
180PROCdemo 180PROCdemo
190PROCcollect_data 190PROCcollect_data
200PROCassemble(address) 200PROCassemble(address)
210PROCsave 210PROCsave
220PROCend 220PROCend
230: 230:
240REM PROCEDURES 240REM PROCEDURES
250: 250:
260DEF PROCassemble(origin) 260DEF PROCassemble(origin)
270: 270:
280para%=origin+&1E0 280para%=origin+&1E0
290FOR pass%=4 TO 6 STEP 2 290FOR pass%=4 TO 6 STEP 2
300P%=origin 300P%=origin
310O%=&7000 310O%=&7000
320[OPT pass% 320[OPT pass%
330.begin 330.begin
340LDA #&D 340LDA #&D
350STA para% 350STA para%
360JSR ttx_command \Switch on Telextext interrupts 360JSR ttx_command \Switch on Telextext interrupts
370LDA #1 370LDA #1
380STA para% 380STA para%
390LDA #0 390LDA #0
400STA para%+1 400STA para%+1
410JSR ttx_command \Set channel to BBC-1 410JSR ttx_command \Set channel to BBC-1
420JSR delay 420JSR delay
430JSR delay 430JSR delay
440LDA #1 440LDA #1
450STA para%-4 \Set magazine number to 1 for BBC-1 target page (100) 450STA para%-4 \Set magazine number to 1 for BBC-1 target page (100)
460LDA #17 460LDA #17
470STA para% 470STA para%
480JSR ttx_command \Read Teletext Adaptor Status 480JSR ttx_command \Read Teletext Adaptor Status
490LDA para%+1 490LDA para%+1
500CMP #&FF 500CMP #&FF
510BEQ no_adaptor 510BEQ no_adaptor
520CMP #2 520CMP #2
530BEQ adaptor_off 530BEQ adaptor_off
540CMP #1 540CMP #1
550BEQ no_signal 550BEQ no_signal
560JMP start 560JMP start
570.no_adaptor 570.no_adaptor
580JSR exit 580JSR exit
590BRK 590BRK
600EQUB &FF 600EQUB &FF
610EQUS "No Adaptor" 610EQUS "No Adaptor"
620BRK 620BRK
630.adaptor_off 630.adaptor_off
640JSR exit 640JSR exit
650BRK 650BRK
660EQUB 50 660EQUB 50
670EQUS "Adaptor off" 670EQUS "Adaptor off"
680BRK 680BRK
690.no_signal 690.no_signal
700LDA #1 700LDA #1
710STA para% 710STA para%
720STA para%+1 720STA para%+1
730JSR ttx_command \Change channel to BBC-2 730JSR ttx_command \Change channel to BBC-2
740LDA #2 740LDA #2
750STA para%-4 \Change magazine number of target page to 2 (200), BBC-2 750STA para%-4 \Change magazine number of target page to 2 (200), BBC-2
760JSR delay 760JSR delay
770JSR delay 770JSR delay
780JSR delay 780JSR delay
790JSR delay 790JSR delay
800LDA #17 800LDA #17
810STA para% 810STA para%
820JSR ttx_command \Read Adaptor Status again 820JSR ttx_command \Read Adaptor Status again
830LDA para%+1 830LDA para%+1
840BEQ start \If signal found then start program proper 840BEQ start \If signal found then start program proper
850JSR exit 850JSR exit
860BRK \else flag error. 860BRK \else flag error.
870EQUB 51 870EQUB 51
880EQUS "No CEEFAX" 880EQUS "No CEEFAX"
890BRK 890BRK
900.start 900.start
910LDA #7 910LDA #7
920STA para% 920STA para%
930LDA #1 930LDA #1
940STA para%+1 940STA para%+1
950JSR ttx_command \Set page capture routine to get HEADER LINE ONLY 950JSR ttx_command \Set page capture routine to get HEADER LINE ONLY
960LDA #0 960LDA #0
970STA para%+16 \Set header detect byte 970STA para%+16 \Set header detect byte
980LDA #5 980LDA #5
990STA para% 990STA para%
1000LDA #18 1000LDA #18
1010STA para%+1 1010STA para%+1
1020LDA para%-4 1020LDA para%-4
1030STA para%+2 1030STA para%+2
1040LDA #0 1040LDA #0
1050STA para%+3 1050STA para%+3
1060LDA #&3F 1060LDA #&3F
1070STA para%+4 1070STA para%+4
1080LDA #&7F 1080LDA #&7F
1090STA para%+5 1090STA para%+5
1100LDA #(para% MOD 256) 1100LDA #(para% MOD 256)
1110STA para%+6 1110STA para%+6
1120LDA #(para% DIV 256) 1120LDA #(para% DIV 256)
1130STA para%+7 1130STA para%+7
1140JSR ttx_command \Get page 100 from CEEFAX (BBC-1) or 200 (BBC-2) 1140JSR ttx_command \Get page 100 from CEEFAX (BBC-1) or 200 (BBC-2)
1150LDA #&FF \Set "give up looking for header" threshold byte 1 1150LDA #&FF \Set "give up looking for header" threshold byte 1
1160STA para%-1 1160STA para%-1
1170LDA #&3F \Set byte 2 1170LDA #&3F \Set byte 2
1180STA para%-2 1180STA para%-2
1190.test_for_header 1190.test_for_header
1200LDA para%+16 1200LDA para%+16
1210BNE get_time \Check if header arrived 1210BNE get_time \Check if header arrived
1220LDY #0 \If not, wait a bit then test again 1220LDY #0 \If not, wait a bit then test again
1230.wait 1230.wait
1240NOP 1240NOP
1250DEY 1250DEY
1260BNE wait 1260BNE wait
1270DEC para%-1 1270DEC para%-1
1280BNE test_for_header 1280BNE test_for_header
1290DEC para%-2 1290DEC para%-2
1300BNE test_for_header 1300BNE test_for_header
1310JSR exit 1310JSR exit
1320BRK 1320BRK
1330EQUB 52 1330EQUB 52
1340EQUS "Can't find time/date" 1340EQUS "Can't find time/date"
1350BRK 1350BRK
1360.get_time 1360.get_time
1370\LDA #14 1370\LDA #14
1380\STA para% 1380\STA para%
1390\JSR ttx_command \Clear page grabber so it doesn't over-write data 1390\JSR ttx_command \Clear page grabber so it doesn't over-write data
1400.try_again 1400.try_again
1410LDA #21 1410LDA #21
1420STA para% 1420STA para%
1430JSR ttx_command \Get time from TSDP 1430JSR ttx_command \Get time from TSDP
1440LDA para%+10 1440LDA para%+10
1450CMP #&FF \Test to see if time found 1450CMP #&FF \Test to see if time found
1460BEQ try_again \Retry if not 1460BEQ try_again \Retry if not
1470JSR delay \1 second delay to bodge CMOS set routine to give 1470JSR delay \1 second delay to bodge CMOS set routine to give
1480JSR delay \correct result 1480JSR delay \correct result
1490JSR delay 1490JSR delay
1500LDA #8 1500LDA #8
1510STA para% 1510STA para%
1520LDA #&F 1520LDA #&F
1530LDX #para% MOD 256 1530LDX #para% MOD 256
1540LDY #para% DIV 256 1540LDY #para% DIV 256
1550JSR osword \Set time in CMOS clock 1550JSR osword \Set time in CMOS clock
1560.get_date 1560.get_date
1570LDA #22 1570LDA #22
1580STA para% 1580STA para%
1590JSR ttx_command \Get date from TSDP (Only year will be used) 1590JSR ttx_command \Get date from TSDP (Only year will be used)
1600LDA para%+12 1600LDA para%+12
1610CMP #&FF \Check to see if date found 1610CMP #&FF \Check to see if date found
1620BEQ get_date \Retry if not. 1620BEQ get_date \Retry if not.
1630LDY #&7 \Move year to correct pos. in parameter block 1630LDY #&7 \Move year to correct pos. in parameter block
1640LDX #&21 1640LDX #&21 \to be used to set CMOS calender
1650.nextchar 1650.nextchar
1660LDA para%,Y 1660LDA para%,Y
1670STA para%,X 1670STA para%,X
1680INY 1680INY
1690INX 1690INX
1700CPX #&25 1700CPX #&25
1710BNE nextchar 1710BNE nextchar
1720LDA #ASC(",") 1720LDA #ASC(",")
1730STA para%+&19 \Insert comma after day 1730STA para%+&19 \Insert comma after day
1732LDA #ASC(" ")
1734STA para%+&20 \Insert space between month and year
1740LDY #&16 \Then ensure the rest of the date is STANDARD ASCII 1740LDY #&16 \Then ensure the rest of the date is STANDARD ASCII
1750.next 1750.next
1760LDA para%,Y 1760LDA para%,Y
1770AND #&7F 1770AND #&7F
1780STA para%,Y 1780STA para%,Y
1790INY 1790INY
1800CPY #&26 1800CPY #&20
1810BNE next 1810BNE next
1820LDA #&F 1820LDA #&F
1830STA para%+&15 1830STA para%+&15
1840LDA #&F 1840LDA #&F
1850LDX #(para%+&15) MOD 256 1850LDX #(para%+&15) MOD 256
1860LDY #(para%+&15) DIV 256 1860LDY #(para%+&15) DIV 256
1870JSR osword \Set CMOS calender 1870JSR osword \Set CMOS calender
1880LDX #(time MOD 256) 1880LDX #(time MOD 256)
1890LDY #(time DIV 256) 1890LDY #(time DIV 256)
1900JSR oscli \Perform *TIME 1900JSR oscli \Perform *TIME
1910.exit \Reset previous values, switch off ttx and exit 1910.exit \Reset previous values, switch off ttx and exit
1920LDA #7 1920LDA #7
1930STA para% 1930STA para%
1940LDA #30 1940LDA #30
1950STA para%+1 1950STA para%+1
1960JSR ttx_command \Reset no. of rows captured to 30 1960JSR ttx_command \Reset no. of rows captured to 30
1970\LDA #14 1970\LDA #14
1980\STA para% 1980\STA para%
1990\JSR ttx_command \Clear page grabber 1990\JSR ttx_command \Clear page grabber
2000LDA #12 2000LDA #12
2010STA para% 2010STA para%
2020JSR ttx_command \Switch off Teletext interrupts 2020JSR ttx_command \Switch off Teletext interrupts
2030RTS 2030RTS
2040.ttx_command \Ttx OSWORD subroutine 2040.ttx_command \Ttx OSWORD subroutine
2050LDA #&7A 2050LDA #&7A
2060LDX #para% MOD 256 2060LDX #para% MOD 256
2070LDY #para% DIV 256 2070LDY #para% DIV 256
2080JSR osword 2080JSR osword
2090RTS 2090RTS
2100.delay \Does nothing for about a third of a second 2100.delay \Does nothing for about a third of a second
2110LDX #&FF 2110LDX #&FF
2120LDY #&FF 2120LDY #&FF
2130.delay_loop 2130.delay_loop
2140DEY 2140DEY
2150NOP:NOP 2150NOP:NOP
2160BNE delay_loop 2160BNE delay_loop
2170DEX 2170DEX
2180BNE delay_loop 2180BNE delay_loop
2190RTS 2190RTS
2200.time 2200.time
2210EQUS "TI." 2210EQUS "TI."
2220EQUB &D 2220EQUB &D
2230.tel 2230.tel
2240EQUS "B." 2240EQUS "B."
2250EQUB &D 2250EQUB &D
2260] 2260]
2270NEXT pass% 2270NEXT pass%
2280ENDPROC 2280ENDPROC
2290: 2290:
2300DEF PROCinstructions 2300DEF PROCinstructions
2310: 2310:
2320CLS 2320CLS
2330PRINT CHR$141CHR$130" Setclock Instructions" 2330PRINT CHR$141CHR$130" Setclock Instructions"
2340PRINT CHR$141CHR$130" Setclock Instructions" 2340PRINT CHR$141CHR$130" Setclock Instructions"
2350VDU28,0,23,39,3 2350VDU28,0,23,39,3
2360PRINT "SETCLOCK gets the date and time from " 2360PRINT "SETCLOCK gets the date and time from "
2370PRINT "CEEFAX and sets the Master's internal " 2370PRINT "CEEFAX and sets the Master's internal "
2380PRINT "CMOS calender/clock. It uses BBC-1 by " 2380PRINT "CMOS calender/clock. It uses BBC-1 by "
2390PRINT "default but, if it cannot find any " 2390PRINT "default but, if it cannot find any "
2400PRINT "Teletext on BBC-1, it will try BBC-2. " 2400PRINT "Teletext on BBC-1, it will try BBC-2. "
2410PRINT "It is, of course, only of value to " 2410PRINT "It is, of course, only of value to "
2420PRINT "users of the Master and so use has" 2420PRINT "users of the Master and so use has"
2430PRINT "been made of facilities provided only " 2430PRINT "been made of facilities provided only "
2440PRINT "on that machine. The program uses " 2440PRINT "on that machine. The program uses "
2450PRINT "OSWORD routines provided by the new BBC" 2450PRINT "OSWORD routines provided by the new BBC"
2460PRINT "ATS ROM. It is not compatible with TFS." 2460PRINT "ATS ROM. It is not compatible with TFS."
2470PRINT " This Basic program will generate the" 2470PRINT " This Basic program will generate the"
2480PRINT "machine code routine SETCLOCK. You will" 2480PRINT "machine code routine SETCLOCK. You will"
2490PRINT "be able to choose where it will run in " 2490PRINT "be able to choose where it will run in "
2500PRINT "memory. The filename given to the code " 2500PRINT "memory. The filename given to the code "
2510PRINT "will depend on the filing system you " 2510PRINT "will depend on the filing system you "
2520PRINT "are using at the moment, as will the" 2520PRINT "are using at the moment, as will the"
2530PRINT "choice of assembly addresses offered." 2530PRINT "choice of assembly addresses offered."
2540PROCspace 2540PROCspace
2550PRINT "The best address for most users will be" 2550PRINT "The best address for most users will be"
2560PRINT "&B00. This is Econet workspace and will" 2560PRINT "&B00. This is Econet workspace and will"
2570PRINT "be unused in the majority of cases. If " 2570PRINT "be unused in the majority of cases. If "
2580PRINT "you are using the network facility then" 2580PRINT "you are using the network facility then"
2590PRINT "&900 is probably the best place to put " 2590PRINT "&900 is probably the best place to put "
2600PRINT "the routine. This is the cassette/RS423" 2600PRINT "the routine. This is the cassette/RS423"
2610PRINT "input/output area. It's also used by " 2610PRINT "input/output area. It's also used by "
2620PRINT "sound envelopes 5-16 and any speech " 2620PRINT "sound envelopes 5-16 and any speech "
2630PRINT "upgrade which may be present. If these " 2630PRINT "upgrade which may be present. If these "
2640PRINT "two alternatives don't suit you may " 2640PRINT "two alternatives don't suit you may "
2650PRINT "assemble the routine to run anywhere " 2650PRINT "assemble the routine to run anywhere "
2660PRINT "but don't expect sensible results if " 2660PRINT "but don't expect sensible results if "
2670PRINT "you put it somewhere daft. " 2670PRINT "you put it somewhere daft. "
2680PROCspace 2680PROCspace
2690PRINT "Disc users should keep the program in " 2690PRINT "Disc users should keep the program in "
2700PRINT "the current directory or library and " 2700PRINT "the current directory or library and "
2710PRINT "call it with *<filename>. Tape users " 2710PRINT "call it with *<filename>. Tape users "
2720PRINT "should use *RUN SETCLOCK." 2720PRINT "should use *RUN SETCLOCK."
2730PRINT '" Error messages will be given if the" 2730PRINT '" Error messages will be given if the"
2740PRINT "clock cannot be reset. The routine can " 2740PRINT "clock cannot be reset. The routine can "
2750PRINT "be re-run using CALL &<address> if you " 2750PRINT "be re-run using CALL &<address> if you "
2760PRINT "wish. This may be useful if you are " 2760PRINT "wish. This may be useful if you are "
2770PRINT "using tape." 2770PRINT "using tape."
2780PRINT '" If the clock has been correctly " 2780PRINT '" If the clock has been correctly "
2790PRINT "reset a *TIME command is issued " 2790PRINT "reset a *TIME command is issued "
2800PRINT "resulting in the contents of the CMOS " 2800PRINT "resulting in the contents of the CMOS "
2810PRINT "clock being printed out as usual. " 2810PRINT "clock being printed out as usual. "
2820PROCspace 2820PROCspace
2830PRINT "The next part of this program is a " 2830PRINT "The next part of this program is a "
2840PRINT "demonstration of SETCLOCK. The CMOS " 2840PRINT "demonstration of SETCLOCK. The CMOS "
2850PRINT "clock can be scrambled and then reset " 2850PRINT "clock can be scrambled and then reset "
2860PRINT "from CEEFAX. (Follow on-screen " 2860PRINT "from CEEFAX. (Follow on-screen "
2870PRINT "instructions.)" 2870PRINT "instructions.)"
2880PRINT '" The CEEFAX header is displayed for " 2880PRINT '" The CEEFAX header is displayed for "
2890PRINT "reference throughout the demonstration." 2890PRINT "reference throughout the demonstration."
2900PRINT "Do not be put off by the way the CMOS " 2900PRINT "Do not be put off by the way the CMOS "
2910PRINT "clock appears to lead CEEFAX. SETCLOCK " 2910PRINT "clock appears to lead CEEFAX. SETCLOCK "
2920PRINT "uses the Television Service Data Packet" 2920PRINT "uses the Television Service Data Packet"
2930PRINT "to set the clock and is more accurate " 2930PRINT "to set the clock and is more accurate "
2940PRINT "than the header. " 2940PRINT "than the header. "
2950PROCspace 2950PROCspace
2960PRINT '" To leave the demonstration press f2." 2960PRINT '" To leave the demonstration press f2."
2970PRINT "Then follow the directions to generate " 2970PRINT "Then follow the directions to generate "
2980PRINT "SETCLOCK itself and save it to your " 2980PRINT "SETCLOCK itself and save it to your "
2990PRINT "current filing system. If you are using" 2990PRINT "current filing system. If you are using"
3000PRINT "the ROM filing system or TFS the " 3000PRINT "the ROM filing system or TFS the "
3010PRINT "program will not be saved. " 3010PRINT "program will not be saved. "
3020PRINT '" The program contains many notes so " 3020PRINT '" The program contains many notes so "
3030PRINT "you should be able to adapt it. Any " 3030PRINT "you should be able to adapt it. Any "
3040PRINT "comments would be welcome via PRESTEL " 3040PRINT "comments would be welcome via PRESTEL "
3050PRINT "mailbox 012373797." 3050PRINT "mailbox 012373797."
3060PROCspace 3060PROCspace
3070ENDPROC 3070ENDPROC
3080: 3080:
3090DEF PROCspace 3090DEF PROCspace
3100: 3100:
3110PRINT TAB(5,19)CHR$131"Press SPACE BAR to continue" 3110PRINT TAB(5,19)CHR$131"Press SPACE BAR to continue"
3120REPEAT UNTIL INKEY(-99) 3120REPEAT UNTIL INKEY(-99)
3130*FX15 3130*FX15
3140CLS 3140CLS
3150ENDPROC 3150ENDPROC
3160: 3160:
3170DEF PROCdemo 3170DEF PROCdemo
3180: 3180:
3190ON ERROR PROCerror:END 3190ON ERROR PROCerror:END
3200VDU26 3200VDU26
3210CLS 3210CLS
3220PRINT TAB(0,0)CHR$134"SCLOCK";CHR$135; 3220PRINT TAB(0,0)CHR$134"SCLOCK";CHR$135;
3230*TTXON 3230*TTXON
3240*HON 3240*HON
3250*FX225,240 3250*FX225,240
3260PROCc_off 3260PROCc_off
3270PRINT TAB(6,2)CHR$141CHR$131"Setclock demonstration" 3270PRINT TAB(6,2)CHR$141CHR$131"Setclock demonstration"
3280PRINT TAB(6)CHR$141CHR$131"Setclock demonstration" 3280PRINT TAB(6)CHR$141CHR$131"Setclock demonstration"
3290PRINT TAB(9,7)CHR$141CHR$133"CMOS Clock reads:" 3290PRINT TAB(9,7)CHR$141CHR$133"CMOS Clock reads:"
3300PRINT TAB(9)CHR$141CHR$133"CMOS Clock reads:" 3300PRINT TAB(9)CHR$141CHR$133"CMOS Clock reads:"
3310red$=CHR$129+CHR$157+CHR$135 3310red$=CHR$129+CHR$157+CHR$135
3320black$=CHR$156 3320black$=CHR$156
3330PRINT TAB(1,20)red$;"f0 ";black$;" "; 3330PRINT TAB(1,20)red$;"f0 ";black$;" ";
3340PRINT red$;"f1 ";black$;" "; 3340PRINT red$;"f1 ";black$;" ";
3350PRINT red$;"f2 ";black$ 3350PRINT red$;"f2 ";black$
3360PRINT 'TAB(2)"Reset";TAB(15)"Scramble";TAB(29)"Exit demo" 3360PRINT 'TAB(2)"Reset";TAB(15)"Scramble";TAB(29)"Exit demo"
3370REPEAT 3370REPEAT
3380*FX15 3380*FX15
3390PROCupdate_time 3390PROCupdate_time
3400IF A=240 THEN PROCsetclock 3400IF A=240 THEN PROCsetclock
3410IF A=241 THEN PROCunset 3410IF A=241 THEN PROCunset
3420UNTIL A=242 3420UNTIL A=242
3430*HOFF 3430*HOFF
3440*TTXOFF 3440*TTXOFF
3450*FX225,1 3450*FX225,1
3460VDU26 3460VDU26
3470ON ERROR OFF 3470ON ERROR OFF
3480ENDPROC 3480ENDPROC
3490: 3490:
3500DEF PROCunset 3500DEF PROCunset
3510: 3510:
3520TIME$="Sat,14 Mar 1982.10:10:10" 3520TIME$="Sat,14 Mar 1982.10:10:10"
3530ENDPROC 3530ENDPROC
3540: 3540:
3550DEF PROCc_off 3550DEF PROCc_off
3560: 3560:
3570VDU23,1,0;0;0;0;0; 3570VDU23,1,0;0;0;0;0;
3580ENDPROC 3580ENDPROC
3590: 3590:
3600DEF PROCc_on 3600DEF PROCc_on
3610: 3610:
3620VDU23,1,1;0;0;0;0; 3620VDU23,1,1;0;0;0;0;
3630ENDPROC 3630ENDPROC
3640: 3640:
3650DEF PROCupdate_time 3650DEF PROCupdate_time
3660: 3660:
3670REPEAT 3670REPEAT
3680PRINT TAB(5,9)CHR$141CHR$134;TIME$ 3680PRINT TAB(5,9)CHR$141CHR$134;TIME$
3690PRINT TAB(5)CHR$141CHR$134;TIME$ 3690PRINT TAB(5)CHR$141CHR$134;TIME$
3700UNTIL ADVAL(-1)>0 3700UNTIL ADVAL(-1)>0
3710A=GET 3710A=GET
3720ENDPROC 3720ENDPROC
3730: 3730:
3740DEF PROCsetclock 3740DEF PROCsetclock
3750: 3750:
3760PRINT TAB(7,5)red$;"SETTING CMOS CLOCK ";black$ 3760PRINT TAB(7,5)red$;"SETTING CMOS CLOCK ";black$
3770PRINT TAB(5,13)CHR$141CHR$130"CMOS Clock last reset at:" 3770PRINT TAB(5,13)CHR$141CHR$130"CMOS Clock last reset at:"
3780PRINT TAB(5)CHR$141CHR$130"CMOS Clock last reset at:"' 3780PRINT TAB(5)CHR$141CHR$130"CMOS Clock last reset at:"'
3790PRINT CHR$131" "; 3790PRINT CHR$131" ";
3800CALL &7000 3800CALL &7000
3810*TTXON 3810*TTXON
3820PRINT TAB(6,5);SPC(30); 3820PRINT TAB(6,5);SPC(30);
3830ENDPROC 3830ENDPROC
3840: 3840:
3850DEF PROCerror 3850DEF PROCerror
3860: 3860:
3870*TTXOFF 3870*TTXOFF
3880IF ERR=17 REPORT:END 3880IF ERR=17 REPORT:END
3890IF ERR=&FF error$="Sorry, no Teletext adaptor" 3890IF ERR=&FF error$="Sorry, no Teletext adaptor"
3900IF ERR=50 error$="Sorry, adaptor switched off" 3900IF ERR=50 error$="Sorry, adaptor switched off"
3910IF ERR=51 error$="Sorry, not receiving CEEFAX" 3910IF ERR=51 error$="Sorry, not receiving CEEFAX"
3920IF ERR=52 error$="Sorry, can't find date/time" 3920IF ERR=52 error$="Sorry, can't find date/time"
3930error$=error$+" " 3930error$=error$+" "
3940PRINT TAB(18-(LEN(error$)/2),16)red$;error$;black$ 3940PRINT TAB(18-(LEN(error$)/2),16)red$;error$;black$
3950VDU28,0,22,39,19 3950VDU28,0,22,39,19
3960CLS 3960CLS
3970VDU26 3970VDU26
3980PROCspace 3980PROCspace
3990PROCcollect_data 3990PROCcollect_data
4000PROCsave 4000PROCsave
4010PROCend 4010PROCend
4020ENDPROC 4020ENDPROC
4030: 4030:
4040DEF PROCcollect_data 4040DEF PROCcollect_data
4050: 4050:
4060CLS 4060CLS
4070PRINT CHR$141CHR$134TAB(12)"Save SETCLOCK" 4070PRINT CHR$141CHR$134TAB(12)"Save SETCLOCK"
4080PRINT CHR$141CHR$134TAB(12)"Save SETCLOCK" 4080PRINT CHR$141CHR$134TAB(12)"Save SETCLOCK"
4090VDU28,0,22,39,3 4090VDU28,0,22,39,3
4100file%=FNfile_sys 4100file%=FNfile_sys
4110IF file%=0 PROCnofile:ENDPROC 4110IF file%=0 PROCnofile:ENDPROC
4120IF file%=1 OR file%=2 PROCtape:ENDPROC 4120IF file%=1 OR file%=2 PROCtape:ENDPROC
4130IF file%=3 OR file%=6 PROCnosave:ENDPROC 4130IF file%=3 OR file%=6 PROCnosave:ENDPROC
4140IF file%=4 PROCdfs:ENDPROC 4140IF file%=4 PROCdfs:ENDPROC
4150IF file%=5 OR file%=8 PROCnet_adfs:ENDPROC 4150IF file%=5 OR file%=8 PROCnet_adfs:ENDPROC
4160IF file%=6 PROCtfs:ENDPROC 4160IF file%=6 PROCtfs:ENDPROC
4170ENDPROC 4170ENDPROC
4180: 4180:
4190DEF PROCnofile 4190DEF PROCnofile
4200: 4200:
4210PRINT "There is no filing system selected. Please" 4210PRINT "There is no filing system selected. Please"
4220PRINT "select one and re-run the program." 4220PRINT "select one and re-run the program."
4230PROCend 4230PROCend
4240ENDPROC 4240ENDPROC
4250: 4250:
4260DEF PROCtape 4260DEF PROCtape
4270: 4270:
4280IF file%=1 fs$="TAPE (1200 Baud)" ELSE fs$="TAPE (300 Baud)" 4280IF file%=1 fs$="TAPE (1200 Baud)" ELSE fs$="TAPE (300 Baud)"
4290filename$="SETCLOCK" 4290filename$="SETCLOCK"
4300PROCprint_fs 4300PROCprint_fs
4310PROCget_address 4310PROCget_address
4320CLS 4320CLS
4330PRINTTAB(0,5);CHR$136CHR$129; 4330PRINTTAB(0,5);CHR$136CHR$129;
4340VDU28,10,22,27,13 4340VDU28,10,22,27,13
4350ENDPROC 4350ENDPROC
4360: 4360:
4370DEF PROCnosave 4370DEF PROCnosave
4380IF file%=3 fs$="ROM" ELSE fs$="Telesoftware" 4380IF file%=3 fs$="ROM" ELSE fs$="Telesoftware"
4390PRINT "Sorry, you cannot save to the ";fs$ 4390PRINT "Sorry, you cannot save to the ";fs$
4400PRINT '"filing system. Please select another" 4400PRINT '"filing system. Please select another"
4410PRINT '"(e.g. disc or tape) and re-run the" 4410PRINT '"(e.g. disc or tape) and re-run the"
4420PRINT '"program." 4420PRINT '"program."
4430PROCc_on 4430PROCc_on
4440VDU26 4440VDU26
4450PRINT TAB(0,15); 4450PRINT TAB(0,15);
4460END 4460END
4470ENDPROC 4470ENDPROC
4480: 4480:
4490DEF PROCdfs 4490DEF PROCdfs
4500: 4500:
4510fs$="DISC (DFS)" 4510fs$="DISC (DFS)"
4520filename$="SETCLK" 4520filename$="SETCLK"
4530PROCprint_fs 4530PROCprint_fs
4540PRINT CHR$131"Please enter any prefix to filename" 4540PRINT CHR$131"Please enter any prefix to filename"
4550PRINT CHR$131"(i.e. :1.W. to save file to drive 1," 4550PRINT CHR$131"(i.e. :1.W. to save file to drive 1,"
4560PRINT CHR$131"directory W.) Press <RETURN> to" 4560PRINT CHR$131"directory W.) Press <RETURN> to"
4570PRINT CHR$131"finish entry." 4570PRINT CHR$131"finish entry."
4580PROCc_on 4580PROCc_on
4590PRINT ''TAB(12)CHR$134;:INPUT "PREFIX: "prefix$ 4590PRINT ''TAB(12)CHR$134;:INPUT "PREFIX: "prefix$
4600PROCc_off 4600PROCc_off
4610IF LEN(prefix$)<>0 IF RIGHT$(prefix$,1)<>"." prefix$=prefix$+"." 4610IF LEN(prefix$)<>0 IF RIGHT$(prefix$,1)<>"." prefix$=prefix$+"."
4620filename$=prefix$+filename$ 4620filename$=prefix$+filename$
4630PROCget_address 4630PROCget_address
4640ENDPROC 4640ENDPROC
4650: 4650:
4660DEF PROCnet_adfs 4660DEF PROCnet_adfs
4670: 4670:
4680IF file%=5 fs$="NETWORK" ELSE fs$="DISC (ADFS)" 4680IF file%=5 fs$="NETWORK" ELSE fs$="DISC (ADFS)"
4690filename$="SETCLOCK" 4690filename$="SETCLOCK"
4700PROCprint_fs 4700PROCprint_fs
4710PRINT CHR$131"Please enter any pathname that you" 4710PRINT CHR$131"Please enter any pathname that you"
4720PRINT CHR$131"require added to the beginning of" 4720PRINT CHR$131"require added to the beginning of"
4730PRINT CHR$131"the filename. Press <RETURN> to" 4730PRINT CHR$131"the filename. Press <RETURN> to"
4740PRINT CHR$131"finish entry." 4740PRINT CHR$131"finish entry."
4750PROCc_on 4750PROCc_on
4760PRINT ''CHR$134;:INPUT "PATHNAME: "prefix$ 4760PRINT ''CHR$134;:INPUT "PATHNAME: "prefix$
4770PROCc_off 4770PROCc_off
4780IF LEN(prefix$)<>0 IF RIGHT$(prefix$,1)<>"." prefix$=prefix$+"." 4780IF LEN(prefix$)<>0 IF RIGHT$(prefix$,1)<>"." prefix$=prefix$+"."
4790filename$=prefix$+filename$ 4790filename$=prefix$+filename$
4800PROCget_address 4800PROCget_address
4810ENDPROC 4810ENDPROC
4820: 4820:
4830DEF PROCprint_fs 4830DEF PROCprint_fs
4840: 4840:
4850PRINT CHR$131"Current filing system:"CHR$135;fs$ 4850PRINT CHR$131"Current filing system:"CHR$135;fs$
4860PRINT 'CHR$131"The program will be saved as"CHR$135;filename$ 4860PRINT 'CHR$131"The program will be saved as"CHR$135;filename$
4870VDU28,0,22,39,8 4870VDU28,0,22,39,8
4880ENDPROC 4880ENDPROC
4890: 4890:
4900DEF PROCget_address 4900DEF PROCget_address
4910: 4910:
4920PRINT ''CHR$130" Where would you like the routine?"'' 4920PRINT ''CHR$130" Where would you like the routine?"''
4930IF file%>2 PRINT CHR$131"1. Serial/cassette port buffers (&900)"' 4930IF file%>2 PRINT CHR$131"1. Serial/cassette port buffers (&900)"'
4940PRINT 'CHR$131"2. Econet workspace (&B00)"' 4940PRINT 'CHR$131"2. Econet workspace (&B00)"'
4950PRINT 'CHR$131"3. At another address"' 4950PRINT 'CHR$131"3. At another address"'
4960REPEAT 4960REPEAT
4970A=GET 4970A=GET
4980UNTIL (file%>2 AND (A>48 AND A<52)) OR (A>49 AND A<52) 4980UNTIL (file%>2 AND (A>48 AND A<52)) OR (A>49 AND A<52)
4990IF A=49 address=&900:ENDPROC 4990IF A=49 address=&900:ENDPROC
5000IF A=50 address=&B00:ENDPROC 5000IF A=50 address=&B00:ENDPROC
5010IF A=51 PROCuser_address:ENDPROC 5010IF A=51 PROCuser_address:ENDPROC
5020ENDPROC 5020ENDPROC
5030: 5030:
5040DEF PROCuser_address 5040DEF PROCuser_address
5050CLS 5050CLS
5060PROCc_on 5060PROCc_on
5070PRINT 'CHR$131"Please enter the address you require:" 5070PRINT 'CHR$131"Please enter the address you require:"
5080PRINT 'TAB(14)CHR$134;"&"; 5080PRINT 'TAB(14)CHR$134;"&";
5090address=FNhex_input 5090address=FNhex_input
5100PROCc_off 5100PROCc_off
5110ENDPROC 5110ENDPROC
5120: 5120:
5130DEF FNhex_input 5130DEF FNhex_input
5140: 5140:
5150=USR(hex_input) AND &FFFF 5150=USR(hex_input) AND &FFFF
5160: 5160:
5170DEF FNhex_string(integer) 5170DEF FNhex_string(integer)
5180: 5180:
5190A%=integer MOD 256 5190A%=integer MOD 256
5200X%=integer DIV 256 5200X%=integer DIV 256
5210CALL hex_string 5210CALL hex_string
5220=$hexaddr 5220=$hexaddr
5230: 5230:
5240DEF FNfile_sys 5240DEF FNfile_sys
5250: 5250:
5260A%=0 5260A%=0
5270Y%=0 5270Y%=0
5280=USR(&FFDA) AND &FF 5280=USR(&FFDA) AND &FF
5290: 5290:
5300DEF PROCsave 5300DEF PROCsave
5310: 5310:
5320address$=FNhex_string(address) 5320address$=FNhex_string(address)
5330OSCLI ("SAVE "+filename$+" 7000 +200 FFFF"+address$+" FFFF"+address$) 5330OSCLI ("SAVE "+filename$+" 7000 +200 FFFF"+address$+" FFFF"+address$)
5340ENDPROC 5340ENDPROC
5350: 5350:
5360DEF PROCend 5360DEF PROCend
5370VDU26 5370VDU26
5380CLS 5380CLS
5390PRINT '''CHR$131" The program has been saved as:" 5390PRINT '''CHR$131" The program has been saved as:"
5400PRINT 'TAB(19-(LEN(filename$)/2))CHR$134;filename$ 5400PRINT 'TAB(19-(LEN(filename$)/2))CHR$134;filename$
5410PRINT ''CHR$131"Don't forget to save THIS Basic program" 5410PRINT ''CHR$131"Don't forget to save THIS Basic program"
5420PRINT CHR$131" too, it contains the source code!" 5420PRINT CHR$131" too, it contains the source code!"
5430PRINT '' 5430PRINT ''
5440PROCc_on 5440PROCc_on
5450END 5450END
5460ENDPROC 5460ENDPROC
5470: 5470:
5480DEF PROCassemble_tools 5480DEF PROCassemble_tools
5490: 5490:
5500FOR pass%=0 TO 2 STEP 2 5500FOR pass%=0 TO 2 STEP 2
5510P%=code% 5510P%=code%
5520[OPT pass% 5520[OPT pass%
5530.hex_string 5530.hex_string
5540STA &70 \Save bytes for future use 5540STA &70 \Save bytes for future use
5550STX &71 5550STX &71
5560LDA #0 5560LDA #0
5570STA hexaddr \Clear hex string to nothing 5570STA hexaddr \Clear hex string to nothing
5580STA hexaddr+1 5580STA hexaddr+1
5590STA hexaddr+2 5590STA hexaddr+2
5600STA hexaddr+3 5600STA hexaddr+3
5610LDA #&D \Set <CR> at end of hex string 5610LDA #&D \Set <CR> at end of hex string
5620STA hexaddr+4 5620STA hexaddr+4
5630LDA &70 5630LDA &70
5640AND #&F \Find lower nybble of low byte 5640AND #&F \Find lower nybble of low byte
5650JSR convert \Find ASCII value of nybble 5650JSR convert \Find ASCII value of nybble
5660STA hexaddr+3 \Store in string 5660STA hexaddr+3 \Store in string
5670TXA 5670TXA
5680AND #&F \Find lower nybble of high byte 5680AND #&F \Find lower nybble of high byte
5690JSR convert \as above 5690JSR convert \as above
5700STA hexaddr+1 5700STA hexaddr+1
5710LDA &70 \Find higher nybble of low byte 5710LDA &70 \Find higher nybble of low byte
5720LSR A:LSR A:LSR A:LSR A 5720LSR A:LSR A:LSR A:LSR A
5730JSR convert \as above 5730JSR convert \as above
5740STA hexaddr+2 5740STA hexaddr+2
5750LDA &71 \Find higher nybble of high byte 5750LDA &71 \Find higher nybble of high byte
5760LSR A:LSR A:LSR A:LSR A 5760LSR A:LSR A:LSR A:LSR A
5770JSR convert \as above 5770JSR convert \as above
5780STA hexaddr 5780STA hexaddr
5790RTS 5790RTS
5800.convert \SUBROUTINE returns ASCII value of nybble in A 5800.convert \SUBROUTINE returns ASCII value of nybble in A
5810CMP #10 \Is nybble alpha? (i.e. >9) 5810CMP #10 \Is nybble alpha? (i.e. >9)
5820BPL alpha \If so, jump to alpha routine 5820BPL alpha \If so, jump to alpha routine
5830CLC \Otherwise add 48 to it and return 5830CLC \Otherwise add 48 to it and return
5840ADC #48 5840ADC #48
5850RTS 5850RTS
5860.alpha \It's alpha so add 55 to it and return 5860.alpha \It's alpha so add 55 to it and return
5870CLC 5870CLC
5880ADC #55 5880ADC #55
5890RTS 5890RTS
5900.hex_input 5900.hex_input
5910LDX #0 \Set character counter/pointer 5910LDX #0 \Set character counter/pointer
5920.get_char \get a character from input stream 5920.get_char \get a character from input stream
5930JSR osrdch 5930JSR osrdch
5940BCS error \Trap invalid character 5940BCS error \Trap invalid character
5950CMP #13 5950CMP #13
5960BEQ end_entry \Detect and act upon <RETURN> 5960BEQ end_entry \Detect and act upon <RETURN>
5970CMP #127 5970CMP #127
5980BEQ delete \Detect and act upon <DELETE> 5980BEQ delete \Detect and act upon <DELETE>
5990CMP #48 \Range check. Pass only 0-9 and A-E (no lower case) 5990CMP #48 \Range check. Pass only 0-9 and A-E (no lower case)
6000BMI beep 6000BMI beep
6010CMP #71 6010CMP #71
6020BPL beep 6020BPL beep
6030CMP #58 6030CMP #58
6040BMI ok 6040BMI ok
6050CMP #65 6050CMP #65
6060BMI beep 6060BMI beep
6070.ok 6070.ok
6080CPX #4 \Detect sneaky try at entering a 5th digit 6080CPX #4 \Detect sneaky try at entering a 5th digit
6090BEQ beep 6090BEQ beep
6100STA hexaddr,X \Add chracter to string 6100STA hexaddr,X \Add chracter to string
6110INX \Update counter/pointer 6110INX \Update counter/pointer
6120JSR oswrch \Put character on screen 6120JSR oswrch \Put character on screen
6130JMP get_char 6130JMP get_char
6140.beep \Make a beep and go back to get_char 6140.beep \Make a beep and go back to get_char
6150LDA #7 6150LDA #7
6160JSR oswrch 6160JSR oswrch
6170JMP get_char 6170JMP get_char
6180.error \Jump out on error 6180.error \Jump out on error
6190RTS 6190RTS
6200.delete \Action <DELETE> key 6200.delete \Action <DELETE> key
6210CPX #0 6210CPX #0
6220BEQ beep \If nothing to delete, beep and go to get_char 6220BEQ beep \If nothing to delete, beep and go to get_char
6230LDA #8 6230LDA #8
6240JSR oswrch 6240JSR oswrch
6250LDA #32 6250LDA #32
6260JSR oswrch 6260JSR oswrch
6270LDA #8 6270LDA #8
6280JSR oswrch 6280JSR oswrch
6290DEX 6290DEX
6300JMP get_char 6300JMP get_char
6310.end_entry \Exit collection routine 6310.end_entry \Exit collection routine
6320CPX #4 \All 4 characters used? 6320CPX #4 \All 4 characters used?
6330BEQ evaluate 6330BEQ evaluate
6340CPX #0 \No characters entered? 6340CPX #0 \No characters entered?
6350BEQ quick_exit 6350BEQ quick_exit
6360STX &70 \If not, pad with leading zeros 6360STX &70 \If not, pad with leading zeros
6370LDA #4 6370LDA #4
6380SEC 6380SEC
6390SBC &70 \Find how many spaces to pad 6390SBC &70 \Find how many spaces to pad
6400STA &70 6400STA &70
6410DEX \Change X from counter to pointer 6410DEX \Change X from counter to pointer
6420TXA 6420TXA
6430CLC 6430CLC
6440ADC &70 6440ADC &70
6450TAY \Set Y to point at target byte 6450TAY \Set Y to point at target byte
6460.shift \Shift valid chars to end of string 6460.shift \Shift valid chars to end of string
6470LDA hexaddr,X 6470LDA hexaddr,X
6480STA hexaddr,Y 6480STA hexaddr,Y
6490DEY 6490DEY
6500DEX 6500DEX
6510BMI continue 6510BMI continue
6520JMP shift 6520JMP shift
6530.continue 6530.continue
6540LDY #0 \Add leading zeros 6540LDY #0 \Add leading zeros
6550LDA #48 \(ASCII "0") 6550LDA #48 \(ASCII "0")
6560.pad 6560.pad
6570STA hexaddr,Y 6570STA hexaddr,Y
6580INY 6580INY
6590CPY &70 6590CPY &70
6600BNE pad 6600BNE pad
6610.evaluate \Decode hex string to 2 byte integer 6610.evaluate \Decode hex string to 2 byte integer
6620LDA hexaddr+3 6620LDA hexaddr+3
6630JSR decode \Low nybble, low byte 6630JSR decode \Low nybble, low byte
6640STA &70 6640STA &70
6650LDA hexaddr+2 \high nybble, low byte 6650LDA hexaddr+2 \high nybble, low byte
6660JSR decode 6660JSR decode
6670ASL A:ASL A:ASL A:ASL A 6670ASL A:ASL A:ASL A:ASL A
6680CLC 6680CLC
6690ADC &70 \Add two nybbles together and store in Y 6690ADC &70 \Add two nybbles together and store in Y
6700TAY 6700TAY
6710LDA hexaddr+1 \Low nybble, high byte 6710LDA hexaddr+1 \Low nybble, high byte
6720JSR decode 6720JSR decode
6730STA &70 6730STA &70
6740LDA hexaddr \High nybble, high byte 6740LDA hexaddr \High nybble, high byte
6750JSR decode 6750JSR decode
6760ASL A:ASL A:ASL A:ASL A 6760ASL A:ASL A:ASL A:ASL A
6770CLC 6770CLC
6780ADC &70 \Add two nybbles together and store in X 6780ADC &70 \Add two nybbles together and store in X
6790TAX 6790TAX
6800TYA \Move low byte back into A & exit 6800TYA \Move low byte back into A & exit
6810RTS 6810RTS
6820.decode \Nybble decode subroutine 6820.decode \Nybble decode subroutine
6830CMP #58 \Is it > 9? 6830CMP #58 \Is it > 9?
6840BPL dec_alpha 6840BPL dec_alpha
6850SEC \If not, subtract 48 6850SEC \If not, subtract 48
6860SBC #48 6860SBC #48
6870RTS 6870RTS
6880.dec_alpha 6880.dec_alpha
6890SEC \If it is, subtract 55 (ALPHA) 6890SEC \If it is, subtract 55 (ALPHA)
6900SBC #55 6900SBC #55
6910RTS 6910RTS
6920.quick_exit \Used only if no characters entered (essential) 6920.quick_exit \Used only if no characters entered (essential)
6930LDA #0 6930LDA #0
6940TAX 6940TAX
6950RTS 6950RTS
6960] 6960]
6970NEXT pass% 6970NEXT pass%
6980ENDPROC 6980ENDPROC
6990: 6990: