Home » CEEFAX disks » telesoftware6.adl » 04-04-88/B\PATCH

04-04-88/B\PATCH

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware6.adl
Filename: 04-04-88/B\PATCH
Read OK:
File size: 30CA bytes
Load address: 0800
Exec address: B89F
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
   10REM > B/Patch   Patch routine to correct ATS *DATE
   20REM Version 1.0 - No Soft-Break survival,  & wrong from 1st March 2100!
   30REM This programme not suitable for BASIC 1 (Offset assembly used)
   40REM (c) Peter Vince  BBC tv  26/03/1988  (MJD = 47246)
   50 
   60CLS
   70PRINT TAB(3,3);"*DATE Patch, Assembly source code"
   80PRINT "   ================================="''
   90 
  100INPUT"Enter RUN address (eg &900) &"address$
  110IF address$ = "" THEN address$ = "900" : PRINT TAB(29,VPOS-1);address$
  120run_add%=EVAL("&" + RIGHT$("0000"+address$,4))
  130IF run_add%<&400 THEN PRINT"Address &";~run_add%;" too low - re-enter";CHR$7':GOTO100
  140 
  150PRINT"and now a filename for the machine code (eg DatPat) ";
  160H% = POS : V% = VPOS
  170INPUT""filename$
  180IF filename$ = "" THEN filename$ = "DatPat" : PRINT TAB(H%,V%);filename$
  190 
  200DIM memory 511
  210wordv  = &20C
  220osword = &FFF1
  230osbyte = &FFF4
  240 
  250FOR pass = 4 TO 6 STEP 2
  260O% = memory : P%=run_add%
  270[ OPT pass
  280.code
  290     LDA wordv                      \ save current OSWORD vector
  300     STA old_osword_vector
  310     LDA wordv + 1
  320     STA old_osword_vector+1
  330     SEI
  340     LDA #osword_filter MOD 256     \ and replace with pointer to
  350     STA wordv                      \ our routine
  360     LDA #osword_filter DIV 256
  370     STA wordv + 1
  380     CLI
  390 
  400 \   LDA #247                       \ set Break vector to break_reset
  410 \   LDX #&4C                       \ routine below
  420 \   LDY #0                         \ (REM'd out to save space)
  430 \   JSR osbyte
  440 
  450 \   LDA #248
  460 \   LDX #break_reset MOD 256
  470 \   LDY #0
  480 \   JSR osbyte
  490 
  500 \   LDA #249
  510 \   LDX #break_reset DIV 256
  520 \   LDY #0
  530 \   JSR osbyte
  540 
  550     RTS                            \ end of setup routine
  560 
  570.break_reset                        \ routine to restore OSWORD vector
  580 \   BCC break_rts                  \ after a soft break (only)
  590 \   LDA #253                       \ (REM'd out to save space)
  600 \   LDX #0
  610 \   LDY #&FF
  620 \   JSR osbyte                     \ find reset type
  630 
  640 \   CPX #0                         \ 0 = Soft
  650 \   BNE hard_reset                 \ 1 = Power-Up
  660 \   JMP code                       \ 2 = Hard
  670.hard_reset
  680 \   LDA #247
  690 \   LDX #0
  700 \   LDY #0
  710 \   JSR osbyte                     \ clear break vector if not soft reset
  720 
  730.break_rts
  740 \   RTS
  750 
  760.osword_filter                      \ on entry, Acc has OSWORD number
  770     CMP #&7A
  780     BEQ compare_routine
  790     JMP (old_osword_vector)        \ exit if not for us
  800 
  810.compare_routine
  820     PHA                            \ else save registers
  830     TXA : PHA
  840     TYA : PHA
  850     STX &F0                        \ store X and Y in zero page
  860     STY &F1
  870     LDY #0
  880     LDA (&F0),Y                    \ and check if first byte of
  890     CMP #22                        \ parameter block indicates the
  900     BEQ status_osword              \ Date OSWORD has been called
  910     PLA : TAY                      \ else restore registers,
  920     PLA : TAX
  930     PLA
  940     JMP (old_osword_vector)        \ and exit
  950 
  960.status_osword                      \ yes, it's us!
  970     LDA #17                        \ so check Adapter status
  980     JSR do_osword
  990     LDA osword_block+1
 1000     BEQ time_osword                \ continue only if result = 0
 1010     LDA #&FF                       \ else set 'bad flag' and exit
 1020     STA time_flag
 1030     JMP finish
 1040 
 1050.time_osword
 1060     LDA #21                        \ call TIME routine to get day offset/
 1070     JSR do_osword                  \ tsdp validity flag
 1080     LDA osword_block+10
 1090     STA time_flag                  \ save day offset flag
 1100     BPL tsdp_osword
 1110     JMP finish                     \ exit if result bad
 1120 
 1130.tsdp_osword
 1140     LDA #15                        \ get tsdp
 1150     JSR do_osword
 1160 
 1170     LDX #&98                       \ result flag from TIME osword:
 1180     LDA time_flag                  \ = 0 if OK, and no offset
 1190     BEQ save_x                     \ = 1 if OK, and ADD 1 day
 1200     CMP #1                         \ = 2 if OK, and SUBTRACT 1 day
 1210     BNE check_2                    \ = &FF if bad
 1220     DEX
 1230.check_2                            \ hence modify reference point
 1240     CMP #2                         \ (lo-byte) accordingly
 1250     BNE save_x
 1260     INX
 1270.save_x
 1280     STX offset_units
 1290 
 1300     SEI : SED                      \ Subtract reference point -
 1310     SEC                            \ 44298  (29th February 1980)
 1320     LDA day_units                  \ +-1 according to result from TIME
 1330     SBC offset_units
 1340     STA day_units
 1350     LDA day_hundreds
 1360     SBC #&42
 1370     STA day_hundreds
 1380     LDA day_ten_thousands
 1390     SBC #&04
 1400     STA day_ten_thousands
 1410     CLD : CLI
 1420 
 1430     LDA #&19                       \ set BCD years to reference
 1440     STA year_hundreds
 1450     LDA #&80
 1460     STA year_units
 1470 
 1480     LDA #&61 : STA units_to_subtract
 1490     LDA #&14 : STA hundreds_to_subtract
 1500     LDA #&4  : STA years_to_add
 1510.four_year_loop
 1520     JSR sub_years                  \ subtract 4 years worth of days
 1530     BCC four_year_loop             \ until less than 4 years left
 1540 
 1550     LDA #&65 : STA units_to_subtract
 1560     LDA #&3  : STA hundreds_to_subtract
 1570     LDA #&1  : STA years_to_add
 1580     JSR sub_years \ BCS do_months  \ subtract up to 3 years
 1590     JSR sub_years \ BCS do_months  \ of 365 days each
 1600     JSR sub_years
 1610 
 1620.do_months                          \ now less than 365 days so find month
 1630     LDX #0
 1640.month_loop
 1650     LDA days_per_month,X           \ get days in month from table
 1660     STA days_in_current_month      \ starting with March
 1670 
 1680     LDA day_hundreds               \ check if days left is
 1690     BNE sub_months                 \ greater than in month
 1700     LDA days_in_current_month
 1710     CMP day_units
 1720     BCS save_months
 1730 
 1740.sub_months                         \ and if so, subtract (in BCD)
 1750     SEI : SED
 1760     SEC
 1770     LDA day_units
 1780     SBC days_in_current_month
 1790     STA day_units
 1800     LDA day_hundreds
 1810     SBC #0
 1820     STA day_hundreds
 1830     CLD : CLI
 1840     INX                            \ X = month index, 0 = March, ...
 1850     BNE month_loop                 \ (always!)       11 = February
 1860 
 1870.save_months
 1880     TXA
 1890     SEI : SED                      \ use BCD
 1900     CLC
 1910     ADC #3                         \ add offset to months
 1920     STA months                     \ and save
 1930 
 1940     LDY #0                         \ do-nothing bug fix! (0 at &A00)
 1950     CPX #10                        \ if X = 10 or 11, month = Jan or Feb
 1960     BCC finish
 1970     SEC
 1980     SBC #&12                       \ so subtract 12
 1990     STA months
 2000     CLC
 2010     LDA year_units
 2020     ADC #1                         \ and increment year
 2030     STA year_units
 2040     LDA year_hundreds
 2050     ADC #0
 2060     STA year_hundreds
 2070 
 2080.finish
 2090     CLD : CLI
 2100 
 2110     LDA time_flag                  \ get good/bad flag
 2120     BPL valid_result               \ continue (branch) if OK
 2130     LDA #0                         \ else set result to all zeroes
 2140     STA day_units
 2150     STA months
 2160     STA year_hundreds
 2170     STA year_units
 2180 
 2190.valid_result
 2200     PLA : STA &F1                  \ pull registers off stack
 2210     PLA : STA &F0
 2220     PLA : STA &EF
 2230 
 2240     LDY #1
 2250     LDA day_units                  \ and store result as a string at
 2260     JSR store_ascii                \ address specified by X and Y on call
 2270     LDA #ASC"/"
 2280     STA (&F0),Y : INY
 2290     LDA months
 2300     JSR store_ascii
 2310     LDA #ASC"/"
 2320     STA (&F0),Y : INY
 2330     LDA year_hundreds
 2340     JSR store_ascii
 2350     LDA year_units
 2360     JSR store_ascii
 2370     LDA #13                        \ append Carriage Return to string
 2380     STA (&F0),Y : INY
 2390     LDA time_flag : BMI duff
 2400     LDA #0
 2410.duff
 2420     STA (&F0),Y                    \ store good/bad flag after string
 2430     RTS                            \ 0 = good, &FF = bad
 2440 
 2450 \ ----------------------------------------------------------------------
 2460 
 2470.sub_years
 2480     LDA day_ten_thousands          \ if days >= 10,000, then subtract
 2490     BNE do_subtract
 2500     LDA day_hundreds
 2510     CMP hundreds_to_subtract       \ check that days left is greater
 2520     BEQ check_units                \ than days to subtract
 2530     BCS do_subtract
 2540     SEC
 2550.exit                               \ else exit (with CARRY set)
 2560     RTS
 2570 
 2580.check_units
 2590     LDA units_to_subtract
 2600     CMP day_units
 2610     BCS exit
 2620 
 2630.do_subtract
 2640     SEI : SED                      \ use BCD arithmetic, so set
 2650     SEC                            \ interrupt flag to prevent OS being
 2660     LDA day_units                  \ confused during any interrupts
 2670     SBC units_to_subtract
 2680     STA day_units
 2690     LDA day_hundreds
 2700     SBC hundreds_to_subtract
 2710     STA day_hundreds
 2720     LDA day_ten_thousands
 2730     SBC #0
 2740     STA day_ten_thousands
 2750 
 2760     CLC
 2770     LDA year_units                 \ increment year counters for
 2780     ADC years_to_add               \ number of years of days that
 2790     STA year_units                 \ have been subtracted
 2800     LDA year_hundreds
 2810     ADC #0
 2820     STA year_hundreds
 2830 
 2840     CLD : CLI                      \ clear Decimal and Interrupt flags
 2850     RTS                            \ asap to prevent clock losing time
 2860 
 2870 \ ----------------------------------------------------------------------
 2880 
 2890.store_ascii                        \ save two ASCII characters for
 2900     PHA                            \ each BCD byte
 2910     LSRA : LSRA : LSRA : LSRA
 2920     ORA #&30
 2930     STA (&F0),Y : INY              \ incrementing pointer as it goes
 2940     PLA
 2950     AND #&0F
 2960     ORA #&30
 2970     STA (&F0),Y : INY
 2980     RTS
 2990 
 3000 \ ----------------------------------------------------------------------
 3010 
 3020.do_osword                          \ Call Teletext OSWORD routine for the
 3030     STA osword_block               \ service number in the Accumulator
 3040     LDA #&7A
 3050     LDX #osword_block MOD 256
 3060     LDY #osword_block DIV 256
 3070     JMP osword                     \ Call OSWORD, and return
 3080 
 3090 \ ----------------------------------------------------------------------
 3100 
 3110 \ osword parameter block is re-used for the routine variables:
 3120 \ variable name                  Offset  OSWORD &7A/15
 3130 \                                         (get tsdp)
 3140.osword_block           EQUB 0   \  0 - command no.
 3150.years_to_add           EQUB 0   \  1 - Initial Page Magazine
 3160.days_in_current_month  EQUB 0   \  2 - Initial Page Number
 3170.hundreds_to_subtract   EQUB 0   \  3 - Page Sub-code - hi
 3180.units_to_subtract      EQUB 0   \  4 - Page Sub-code - lo
 3190.year_units             EQUB 0   \  5 - NIG - hi
 3200.year_hundreds          EQUB 0   \  6 - NIG - lo
 3210.months                 EQUB 0   \  7 - Time offset (&81/&85)
 3220.day_ten_thousands      EQUB 0   \  8 - MJD 10,000's
 3230.day_hundreds           EQUB 0   \  9 - MJD 1,000's & 100's
 3240.day_units              EQUB 0   \ 10 - MJD 10's and 1's
 3250.offset_units           EQUB 0   \ 11 - Hours
 3260                        EQUB 0   \ 12 - Minutes
 3270                        EQUB 0   \ 13 - Seconds
 3280.days_per_month
 3290     EQUB &31 : EQUB &30 : EQUB &31 : EQUB &30  \ March  to June
 3300     EQUB &31 : EQUB &31 : EQUB &30 : EQUB &31  \ July to October
 3310     EQUB &30 : EQUB &31 : EQUB &31 : EQUB &29  \ November to February
 3320.old_osword_vector      EQUW 0
 3330.time_flag              EQUB 0
 3340.various
 3350     EQUB &20 : EQUB &50 : EQUB &43 : EQUB &56
 3360     EQUB &20 : EQUB &32 : EQUB &36 : EQUB &2F
 3370     EQUB &33 : EQUB &2F : EQUB &38 : EQUB &38
 3380]
 3390 
 3400NEXT
 3410 
 3420PRINT'"Code size is ";P%-code;" bytes (decimal)"
 3430exec$ = " " + STR$~(&FFFF0000 + run_add%)
 3440OSCLI("SAVE " + filename$ + " " + STR$~memory + " " + STR$~O% + exec$ + exec$)
 3450PRINT"Code saved as '";filename$;"',"'"  to run from &";RIGHT$(exec$,8)
 3460 
 3470*TTXON
 3480T%=TIME:REPEAT UNTIL (TIME-T%)>150
 3490 
 3500OSCLI filename$
 3510 
 3520DIM block 16
 3530A%=&7A
 3540X%=block MOD 256
 3550Y%=block DIV 256
 3560?block=22
 3570CALL osword
 3580 
 3590IF block?12 THEN result$=" but it is bad!" ELSE result$=" and it is OK!"
 3600PRINT'"Date = ";$(block+1);result$'

4� > B/Patch   Patch routine to correct ATS *DATE
I� Version 1.0 - No Soft-Break survival,  & wrong from 1st March 2100!
D� This programme not suitable for BASIC 1 (Offset assembly used)
(8� (c) Peter Vince  BBC tv  26/03/1988  (MJD = 47246)
2 
<�
F/� �3,3);"*DATE Patch, Assembly source code"
P.� "   ================================="''
Z 
d,�"Enter RUN address (eg &900) &"address$
n<� address$ = "" � address$ = "900" : � �29,�-1);address$
x)run_add%=�("&" + �"0000"+address$,4))
�L� run_add%<&400 � �"Address &";~run_add%;" too low - re-enter";�7':�Dd@
� 
�<�"and now a filename for the machine code (eg DatPat) ";
�H% = � : V% = �
��""filename$
�A� filename$ = "" � filename$ = "DatPat" : � �H%,V%);filename$
� 
�� memory 511
�wordv  = &20C
�osword = &FFF1
�osbyte = &FFF4
� 
�� pass = 4 � 6 � 2
O% = memory : P%=run_add%
[ OPT pass
	.code
"D     LDA wordv                      \ save current OSWORD vector
,     STA old_osword_vector
6     LDA wordv + 1
@      STA old_osword_vector+1
J     SEI
TC     LDA #osword_filter � 256     \ and replace with pointer to
^5     STA wordv                      \ our routine
h!     LDA #osword_filter � 256
r     STA wordv + 1
|     CLI
� 
�I \   LDA #247                       \ set Break vector to break_reset
�7 \   LDX #&4C                       \ routine below
�A \   LDY #0                         \ (�'d out to save space)
� \   JSR osbyte
� 
� \   LDA #248
� \   LDX #break_reset � 256
� \   LDY #0
� \   JSR osbyte
� 
� \   LDA #249
� \   LDX #break_reset � 256
 \   LDY #0
 \   JSR osbyte
 
&>     RTS                            \ end of setup routine
0 
:J.break_reset                        \ routine to restore OSWORD vector
DC \   BCC break_rts                  \ after a soft break (only)
NA \   LDA #253                       \ (�'d out to save space)
X \   LDX #0
b \   LDY #&FF
l9 \   JSR osbyte                     \ find reset type
v 
�2 \   CPX #0                         \ 0 = Soft
�6 \   BNE hard_reset                 \ 1 = Power-Up
�2 \   JMP code                       \ 2 = Hard
�.hard_reset
� \   LDA #247
� \   LDX #0
� \   LDY #0
�N \   JSR osbyte                     \ clear break vector if not soft reset
� 
�.break_rts
� \   RTS
� 
�I.osword_filter                      \ on entry, Acc has OSWORD number
     CMP #&7A
     BEQ compare_routine
<     JMP (old_osword_vector)        \ exit if not for us
  
*.compare_routine
4=     PHA                            \ else save registers
>     TXA : PHA
H     TYA : PHA
RD     STX &F0                        \ store X and Y in zero page
\     STY &F1
f     LDY #0
pD     LDA (&F0),Y                    \ and check if first byte of
zG     CMP #22                        \ parameter block indicates the
�E     BEQ status_osword              \ Date OSWORD has been called
�A     PLA : TAY                      \ else restore registers,
�     PLA : TAX
�     PLA
�2     JMP (old_osword_vector)        \ and exit
� 
�7.status_osword                      \ yes, it's us!
�A     LDA #17                        \ so check Adapter status
�     JSR do_osword
�     LDA osword_block+1
�E     BEQ time_osword                \ continue only if result = 0
�F     LDA #&FF                       \ else set 'bad flag' and exit
�     STA time_flag
     JMP finish
 
.time_osword
$K     LDA #21                        \ call � routine to get day offset/
.<     JSR do_osword                  \ tsdp validity flag
8     LDA osword_block+10
B>     STA time_flag                  \ save day offset flag
L     BPL tsdp_osword
V<     JMP finish                     \ exit if result bad
` 
j.tsdp_osword
t2     LDA #15                        \ get tsdp
~     JSR do_osword
� 
�D     LDX #&98                       \ result flag from � osword:
�B     LDA time_flag                  \ = 0 if OK, and no offset
�B     BEQ save_x                     \ = 1 if OK, and ADD 1 day
�G     CMP #1                         \ = 2 if OK, and SUBTRACT 1 day
�6     BNE check_2                    \ = &FF if bad
�     DEX
�F.check_2                            \ hence modify reference point
�?     CMP #2                         \ (lo-byte) accordingly
�     BNE save_x
�     INX
�.save_x
     STX offset_units

 
D     SEI : SED                      \ Subtract reference point -
E     SEC                            \ 44298  (29th February 1980)
(H     LDA day_units                  \ +-1 according to result from �
2     SBC offset_units
<     STA day_units
F     LDA day_hundreds
P     SBC #&42
Z     STA day_hundreds
d     LDA day_ten_thousands
n     SBC #&04
x     STA day_ten_thousands
�     CLD : CLI
� 
�D     LDA #&19                       \ set BCD years to reference
�     STA year_hundreds
�     LDA #&80
�     STA year_units
� 
�)     LDA #&61 : STA units_to_subtract
�,     LDA #&14 : STA hundreds_to_subtract
�$     LDA #&4  : STA years_to_add
�.four_year_loop
�H     JSR sub_years                  \ subtract 4 years worth of days
�F     BCC four_year_loop             \ until less than 4 years left
 
)     LDA #&65 : STA units_to_subtract
,     LDA #&3  : STA hundreds_to_subtract
"$     LDA #&1  : STA years_to_add
,@     JSR sub_years \ BCS do_months  \ subtract up to 3 years
6:     JSR sub_years \ BCS do_months  \ of 365 days each
@     JSR sub_years
J 
TN.do_months                          \ now less than 365 days so find month
^     LDX #0
h.month_loop
rF     LDA days_per_month,X           \ get days in month from table
|=     STA days_in_current_month      \ starting with March
� 
�?     LDA day_hundreds               \ check if days left is
�?     BNE sub_months                 \ greater than in month
�"     LDA days_in_current_month
�     CMP day_units
�     BCS save_months
� 
�F.sub_months                         \ and if so, subtract (in BCD)
�     SEI : SED
�     SEC
�     LDA day_units
�"     SBC days_in_current_month
�     STA day_units
     LDA day_hundreds
     SBC #0
     STA day_hundreds
&     CLD : CLI
0I     INX                            \ X = month index, 0 = March, ...
:G     BNE month_loop                 \ (always!)       11 = February
D 
N.save_months
X     TXA
b1     SEI : SED                      \ use BCD
l     CLC
v>     ADC #3                         \ add offset to months
�2     STA months                     \ and save
� 
�I     LDY #0                         \ do-nothing bug fix! (0 at &A00)
�M     CPX #10                        \ if X = 10 or 11, month = Jan or Feb
�     BCC finish
�     SEC
�8     SBC #&12                       \ so subtract 12
�     STA months
�     CLC
�     LDA year_units
�<     ADC #1                         \ and increment year
�     STA year_units
�     LDA year_hundreds
     ADC #0
     STA year_hundreds
 
 .finish
*     CLD : CLI
4 
>;     LDA time_flag                  \ get good/bad flag
HA     BPL valid_result               \ continue (branch) if OK
RG     LDA #0                         \ else set result to all zeroes
\     STA day_units
f     STA months
p     STA year_hundreds
z     STA year_units
� 
�.valid_result
�B     PLA : STA &F1                  \ pull registers off stack
�     PLA : STA &F0
�     PLA : STA &EF
� 
�     LDY #1
�I     LDA day_units                  \ and store result as a string at
�N     JSR store_ascii                \ address specified by X and Y on call
�     LDA #�"/"
�     STA (&F0),Y : INY
�     LDA months
�     JSR store_ascii
	     LDA #�"/"
	     STA (&F0),Y : INY
	     LDA year_hundreds
	$     JSR store_ascii
	.     LDA year_units
	8     JSR store_ascii
	BJ     LDA #13                        \ append Carriage Return to string
	L     STA (&F0),Y : INY
	V!     LDA time_flag : BMI duff
	`     LDA #0
	j	.duff
	tJ     STA (&F0),Y                    \ store good/bad flag after string
	~=     RTS                            \ 0 = good, &FF = bad
	� 
	�M \ ----------------------------------------------------------------------
	� 
	�.sub_years
	�J     LDA day_ten_thousands          \ if days >= 10,000, then subtract
	�     BNE do_subtract
	�     LDA day_hundreds
	�I     CMP hundreds_to_subtract       \ check that days left is greater
	�?     BEQ check_units                \ than days to subtract
	�     BCS do_subtract
	�     SEC
	�D.exit                               \ else exit (with CARRY set)
     RTS

 
.check_units
     LDA units_to_subtract
(     CMP day_units
2     BCS exit
< 
F.do_subtract
PD     SEI : SED                      \ use BCD arithmetic, so set
ZL     SEC                            \ interrupt flag to prevent OS being
dH     LDA day_units                  \ confused during any interrupts
n     SBC units_to_subtract
x     STA day_units
�     LDA day_hundreds
�!     SBC hundreds_to_subtract
�     STA day_hundreds
�     LDA day_ten_thousands
�     SBC #0
�     STA day_ten_thousands
� 
�     CLC
�E     LDA year_units                 \ increment year counters for
�F     ADC years_to_add               \ number of years of days that
�>     STA year_units                 \ have been subtracted
�     LDA year_hundreds
�     ADC #0
     STA year_hundreds
 
K     CLD : CLI                      \ clear Decimal and Interrupt flags
"K     RTS                            \ asap to prevent clock losing time
, 
6M \ ----------------------------------------------------------------------
@ 
JE.store_ascii                        \ save two �II characters for
T7     PHA                            \ each BCD byte
^"     LSRA : LSRA : LSRA : LSRA
h     �A #&30
rI     STA (&F0),Y : INY              \ incrementing pointer as it goes
|     PLA
�     � #&0F
�     �A #&30
�     STA (&F0),Y : INY
�     RTS
� 
�M \ ----------------------------------------------------------------------
� 
�N.do_osword                          \ Call Teletext OSWORD routine for the
�K     STA osword_block               \ service number in the Accumulator
�     LDA #&7A
�      LDX #osword_block � 256
�      LDY #osword_block � 256
�A     JMP osword                     \ Call OSWORD, and return
 
M \ ----------------------------------------------------------------------
 
&C \ osword parameter block is re-used for the routine variables:
0; \ variable name                  Offset  OSWORD &7A/15
:9 \                                         (get tsdp)
D7.osword_block           EQUB 0   \  0 - command no.
NA.years_to_add           EQUB 0   \  1 - Initial Page Magazine
X?.days_in_current_month  EQUB 0   \  2 - Initial Page Number
b>.hundreds_to_subtract   EQUB 0   \  3 - Page Sub-code - hi
l>.units_to_subtract      EQUB 0   \  4 - Page Sub-code - lo
v4.year_units             EQUB 0   \  5 - NIG - hi
�4.year_hundreds          EQUB 0   \  6 - NIG - lo
�A.months                 EQUB 0   \  7 - Time offset (&81/&85)
�8.day_ten_thousands      EQUB 0   \  8 - MJD 10,000's
�?.day_hundreds           EQUB 0   \  9 - MJD 1,000's & 100's
�<.day_units              EQUB 0   \ 10 - MJD 10's and 1's
�1.offset_units           EQUB 0   \ 11 - Hours
�3                        EQUB 0   \ 12 - Minutes
�3                        EQUB 0   \ 13 - Seconds
�.days_per_month
�D     EQUB &31 : EQUB &30 : EQUB &31 : EQUB &30  \ March  to June
�E     EQUB &31 : EQUB &31 : EQUB &30 : EQUB &31  \ July to October
�J     EQUB &30 : EQUB &31 : EQUB &31 : EQUB &29  \ November to February
�".old_osword_vector      EQUW 0

".time_flag              EQUB 0

.various

2     EQUB &20 : EQUB &50 : EQUB &43 : EQUB &56

 2     EQUB &20 : EQUB &32 : EQUB &36 : EQUB &2F

*2     EQUB &33 : EQUB &2F : EQUB &38 : EQUB &38

4]

> 

H�

R 

\0�'"Code size is ";P%-code;" bytes (decimal)"

f*exec$ = " " + �~(&FFFF0000 + run_add%)

pH�("SAVE " + filename$ + " " + �~memory + " " + �~O% + exec$ + exec$)

zA�"Code saved as '";filename$;"',"'"  to run from &";�exec$,8)

� 

�
*TTXON

�T%=�:� � (�-T%)>150

� 

�� filename$

� 

�� block 16

�
A%=&7A

�X%=block � 256

�Y%=block � 256

�
?block=22

�� osword

� 
E� block?12 � result$=" but it is bad!" � result$=" and it is OK!"
#�'"Date = ";$(block+1);result$'
�
00000000  0d 00 0a 34 f4 20 3e 20  42 2f 50 61 74 63 68 20  |...4. > B/Patch |
00000010  20 20 50 61 74 63 68 20  72 6f 75 74 69 6e 65 20  |  Patch routine |
00000020  74 6f 20 63 6f 72 72 65  63 74 20 41 54 53 20 2a  |to correct ATS *|
00000030  44 41 54 45 0d 00 14 49  f4 20 56 65 72 73 69 6f  |DATE...I. Versio|
00000040  6e 20 31 2e 30 20 2d 20  4e 6f 20 53 6f 66 74 2d  |n 1.0 - No Soft-|
00000050  42 72 65 61 6b 20 73 75  72 76 69 76 61 6c 2c 20  |Break survival, |
00000060  20 26 20 77 72 6f 6e 67  20 66 72 6f 6d 20 31 73  | & wrong from 1s|
00000070  74 20 4d 61 72 63 68 20  32 31 30 30 21 0d 00 1e  |t March 2100!...|
00000080  44 f4 20 54 68 69 73 20  70 72 6f 67 72 61 6d 6d  |D. This programm|
00000090  65 20 6e 6f 74 20 73 75  69 74 61 62 6c 65 20 66  |e not suitable f|
000000a0  6f 72 20 42 41 53 49 43  20 31 20 28 4f 66 66 73  |or BASIC 1 (Offs|
000000b0  65 74 20 61 73 73 65 6d  62 6c 79 20 75 73 65 64  |et assembly used|
000000c0  29 0d 00 28 38 f4 20 28  63 29 20 50 65 74 65 72  |)..(8. (c) Peter|
000000d0  20 56 69 6e 63 65 20 20  42 42 43 20 74 76 20 20  | Vince  BBC tv  |
000000e0  32 36 2f 30 33 2f 31 39  38 38 20 20 28 4d 4a 44  |26/03/1988  (MJD|
000000f0  20 3d 20 34 37 32 34 36  29 0d 00 32 05 20 0d 00  | = 47246)..2. ..|
00000100  3c 05 db 0d 00 46 2f f1  20 8a 33 2c 33 29 3b 22  |<....F/. .3,3);"|
00000110  2a 44 41 54 45 20 50 61  74 63 68 2c 20 41 73 73  |*DATE Patch, Ass|
00000120  65 6d 62 6c 79 20 73 6f  75 72 63 65 20 63 6f 64  |embly source cod|
00000130  65 22 0d 00 50 2e f1 20  22 20 20 20 3d 3d 3d 3d  |e"..P.. "   ====|
00000140  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00000150  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 22 27 27  |============="''|
00000160  0d 00 5a 05 20 0d 00 64  2c e8 22 45 6e 74 65 72  |..Z. ..d,."Enter|
00000170  20 52 55 4e 20 61 64 64  72 65 73 73 20 28 65 67  | RUN address (eg|
00000180  20 26 39 30 30 29 20 26  22 61 64 64 72 65 73 73  | &900) &"address|
00000190  24 0d 00 6e 3c e7 20 61  64 64 72 65 73 73 24 20  |$..n<. address$ |
000001a0  3d 20 22 22 20 8c 20 61  64 64 72 65 73 73 24 20  |= "" . address$ |
000001b0  3d 20 22 39 30 30 22 20  3a 20 f1 20 8a 32 39 2c  |= "900" : . .29,|
000001c0  bc 2d 31 29 3b 61 64 64  72 65 73 73 24 0d 00 78  |.-1);address$..x|
000001d0  29 72 75 6e 5f 61 64 64  25 3d a0 28 22 26 22 20  |)run_add%=.("&" |
000001e0  2b 20 c2 22 30 30 30 30  22 2b 61 64 64 72 65 73  |+ ."0000"+addres|
000001f0  73 24 2c 34 29 29 0d 00  82 4c e7 20 72 75 6e 5f  |s$,4))...L. run_|
00000200  61 64 64 25 3c 26 34 30  30 20 8c 20 f1 22 41 64  |add%<&400 . ."Ad|
00000210  64 72 65 73 73 20 26 22  3b 7e 72 75 6e 5f 61 64  |dress &";~run_ad|
00000220  64 25 3b 22 20 74 6f 6f  20 6c 6f 77 20 2d 20 72  |d%;" too low - r|
00000230  65 2d 65 6e 74 65 72 22  3b bd 37 27 3a e5 8d 44  |e-enter";.7':..D|
00000240  64 40 0d 00 8c 05 20 0d  00 96 3c f1 22 61 6e 64  |d@.... ...<."and|
00000250  20 6e 6f 77 20 61 20 66  69 6c 65 6e 61 6d 65 20  | now a filename |
00000260  66 6f 72 20 74 68 65 20  6d 61 63 68 69 6e 65 20  |for the machine |
00000270  63 6f 64 65 20 28 65 67  20 44 61 74 50 61 74 29  |code (eg DatPat)|
00000280  20 22 3b 0d 00 a0 13 48  25 20 3d 20 b1 20 3a 20  | ";....H% = . : |
00000290  56 25 20 3d 20 bc 0d 00  aa 10 e8 22 22 66 69 6c  |V% = ......""fil|
000002a0  65 6e 61 6d 65 24 0d 00  b4 41 e7 20 66 69 6c 65  |ename$...A. file|
000002b0  6e 61 6d 65 24 20 3d 20  22 22 20 8c 20 66 69 6c  |name$ = "" . fil|
000002c0  65 6e 61 6d 65 24 20 3d  20 22 44 61 74 50 61 74  |ename$ = "DatPat|
000002d0  22 20 3a 20 f1 20 8a 48  25 2c 56 25 29 3b 66 69  |" : . .H%,V%);fi|
000002e0  6c 65 6e 61 6d 65 24 0d  00 be 05 20 0d 00 c8 10  |lename$.... ....|
000002f0  de 20 6d 65 6d 6f 72 79  20 35 31 31 0d 00 d2 11  |. memory 511....|
00000300  77 6f 72 64 76 20 20 3d  20 26 32 30 43 0d 00 dc  |wordv  = &20C...|
00000310  12 6f 73 77 6f 72 64 20  3d 20 26 46 46 46 31 0d  |.osword = &FFF1.|
00000320  00 e6 12 6f 73 62 79 74  65 20 3d 20 26 46 46 46  |...osbyte = &FFF|
00000330  34 0d 00 f0 05 20 0d 00  fa 16 e3 20 70 61 73 73  |4.... ..... pass|
00000340  20 3d 20 34 20 b8 20 36  20 88 20 32 0d 01 04 1d  | = 4 . 6 . 2....|
00000350  4f 25 20 3d 20 6d 65 6d  6f 72 79 20 3a 20 50 25  |O% = memory : P%|
00000360  3d 72 75 6e 5f 61 64 64  25 0d 01 0e 0e 5b 20 4f  |=run_add%....[ O|
00000370  50 54 20 70 61 73 73 0d  01 18 09 2e 63 6f 64 65  |PT pass.....code|
00000380  0d 01 22 44 20 20 20 20  20 4c 44 41 20 77 6f 72  |.."D     LDA wor|
00000390  64 76 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |dv              |
000003a0  20 20 20 20 20 20 20 20  5c 20 73 61 76 65 20 63  |        \ save c|
000003b0  75 72 72 65 6e 74 20 4f  53 57 4f 52 44 20 76 65  |urrent OSWORD ve|
000003c0  63 74 6f 72 0d 01 2c 1e  20 20 20 20 20 53 54 41  |ctor..,.     STA|
000003d0  20 6f 6c 64 5f 6f 73 77  6f 72 64 5f 76 65 63 74  | old_osword_vect|
000003e0  6f 72 0d 01 36 16 20 20  20 20 20 4c 44 41 20 77  |or..6.     LDA w|
000003f0  6f 72 64 76 20 2b 20 31  0d 01 40 20 20 20 20 20  |ordv + 1..@     |
00000400  20 53 54 41 20 6f 6c 64  5f 6f 73 77 6f 72 64 5f  | STA old_osword_|
00000410  76 65 63 74 6f 72 2b 31  0d 01 4a 0c 20 20 20 20  |vector+1..J.    |
00000420  20 53 45 49 0d 01 54 43  20 20 20 20 20 4c 44 41  | SEI..TC     LDA|
00000430  20 23 6f 73 77 6f 72 64  5f 66 69 6c 74 65 72 20  | #osword_filter |
00000440  83 20 32 35 36 20 20 20  20 20 5c 20 61 6e 64 20  |. 256     \ and |
00000450  72 65 70 6c 61 63 65 20  77 69 74 68 20 70 6f 69  |replace with poi|
00000460  6e 74 65 72 20 74 6f 0d  01 5e 35 20 20 20 20 20  |nter to..^5     |
00000470  53 54 41 20 77 6f 72 64  76 20 20 20 20 20 20 20  |STA wordv       |
00000480  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00000490  20 6f 75 72 20 72 6f 75  74 69 6e 65 0d 01 68 21  | our routine..h!|
000004a0  20 20 20 20 20 4c 44 41  20 23 6f 73 77 6f 72 64  |     LDA #osword|
000004b0  5f 66 69 6c 74 65 72 20  81 20 32 35 36 0d 01 72  |_filter . 256..r|
000004c0  16 20 20 20 20 20 53 54  41 20 77 6f 72 64 76 20  |.     STA wordv |
000004d0  2b 20 31 0d 01 7c 0c 20  20 20 20 20 43 4c 49 0d  |+ 1..|.     CLI.|
000004e0  01 86 05 20 0d 01 90 49  20 5c 20 20 20 4c 44 41  |... ...I \   LDA|
000004f0  20 23 32 34 37 20 20 20  20 20 20 20 20 20 20 20  | #247           |
00000500  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 73 65  |            \ se|
00000510  74 20 42 72 65 61 6b 20  76 65 63 74 6f 72 20 74  |t Break vector t|
00000520  6f 20 62 72 65 61 6b 5f  72 65 73 65 74 0d 01 9a  |o break_reset...|
00000530  37 20 5c 20 20 20 4c 44  58 20 23 26 34 43 20 20  |7 \   LDX #&4C  |
00000540  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000550  20 20 20 20 20 5c 20 72  6f 75 74 69 6e 65 20 62  |     \ routine b|
00000560  65 6c 6f 77 0d 01 a4 41  20 5c 20 20 20 4c 44 59  |elow...A \   LDY|
00000570  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00000580  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 28 f4  |            \ (.|
00000590  27 64 20 6f 75 74 20 74  6f 20 73 61 76 65 20 73  |'d out to save s|
000005a0  70 61 63 65 29 0d 01 ae  13 20 5c 20 20 20 4a 53  |pace).... \   JS|
000005b0  52 20 6f 73 62 79 74 65  0d 01 b8 05 20 0d 01 c2  |R osbyte.... ...|
000005c0  11 20 5c 20 20 20 4c 44  41 20 23 32 34 38 0d 01  |. \   LDA #248..|
000005d0  cc 1f 20 5c 20 20 20 4c  44 58 20 23 62 72 65 61  |.. \   LDX #brea|
000005e0  6b 5f 72 65 73 65 74 20  83 20 32 35 36 0d 01 d6  |k_reset . 256...|
000005f0  0f 20 5c 20 20 20 4c 44  59 20 23 30 0d 01 e0 13  |. \   LDY #0....|
00000600  20 5c 20 20 20 4a 53 52  20 6f 73 62 79 74 65 0d  | \   JSR osbyte.|
00000610  01 ea 05 20 0d 01 f4 11  20 5c 20 20 20 4c 44 41  |... .... \   LDA|
00000620  20 23 32 34 39 0d 01 fe  1f 20 5c 20 20 20 4c 44  | #249.... \   LD|
00000630  58 20 23 62 72 65 61 6b  5f 72 65 73 65 74 20 81  |X #break_reset .|
00000640  20 32 35 36 0d 02 08 0f  20 5c 20 20 20 4c 44 59  | 256.... \   LDY|
00000650  20 23 30 0d 02 12 13 20  5c 20 20 20 4a 53 52 20  | #0.... \   JSR |
00000660  6f 73 62 79 74 65 0d 02  1c 05 20 0d 02 26 3e 20  |osbyte.... ..&> |
00000670  20 20 20 20 52 54 53 20  20 20 20 20 20 20 20 20  |    RTS         |
00000680  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000690  20 20 20 5c 20 65 6e 64  20 6f 66 20 73 65 74 75  |   \ end of setu|
000006a0  70 20 72 6f 75 74 69 6e  65 0d 02 30 05 20 0d 02  |p routine..0. ..|
000006b0  3a 4a 2e 62 72 65 61 6b  5f 72 65 73 65 74 20 20  |:J.break_reset  |
000006c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000006d0  20 20 20 20 20 20 5c 20  72 6f 75 74 69 6e 65 20  |      \ routine |
000006e0  74 6f 20 72 65 73 74 6f  72 65 20 4f 53 57 4f 52  |to restore OSWOR|
000006f0  44 20 76 65 63 74 6f 72  0d 02 44 43 20 5c 20 20  |D vector..DC \  |
00000700  20 42 43 43 20 62 72 65  61 6b 5f 72 74 73 20 20  | BCC break_rts  |
00000710  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000720  5c 20 61 66 74 65 72 20  61 20 73 6f 66 74 20 62  |\ after a soft b|
00000730  72 65 61 6b 20 28 6f 6e  6c 79 29 0d 02 4e 41 20  |reak (only)..NA |
00000740  5c 20 20 20 4c 44 41 20  23 32 35 33 20 20 20 20  |\   LDA #253    |
00000750  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000760  20 20 20 5c 20 28 f4 27  64 20 6f 75 74 20 74 6f  |   \ (.'d out to|
00000770  20 73 61 76 65 20 73 70  61 63 65 29 0d 02 58 0f  | save space)..X.|
00000780  20 5c 20 20 20 4c 44 58  20 23 30 0d 02 62 11 20  | \   LDX #0..b. |
00000790  5c 20 20 20 4c 44 59 20  23 26 46 46 0d 02 6c 39  |\   LDY #&FF..l9|
000007a0  20 5c 20 20 20 4a 53 52  20 6f 73 62 79 74 65 20  | \   JSR osbyte |
000007b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007c0  20 20 20 20 5c 20 66 69  6e 64 20 72 65 73 65 74  |    \ find reset|
000007d0  20 74 79 70 65 0d 02 76  05 20 0d 02 80 32 20 5c  | type..v. ...2 \|
000007e0  20 20 20 43 50 58 20 23  30 20 20 20 20 20 20 20  |   CPX #0       |
000007f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000800  20 20 5c 20 30 20 3d 20  53 6f 66 74 0d 02 8a 36  |  \ 0 = Soft...6|
00000810  20 5c 20 20 20 42 4e 45  20 68 61 72 64 5f 72 65  | \   BNE hard_re|
00000820  73 65 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |set             |
00000830  20 20 20 20 5c 20 31 20  3d 20 50 6f 77 65 72 2d  |    \ 1 = Power-|
00000840  55 70 0d 02 94 32 20 5c  20 20 20 4a 4d 50 20 63  |Up...2 \   JMP c|
00000850  6f 64 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ode             |
00000860  20 20 20 20 20 20 20 20  20 20 5c 20 32 20 3d 20  |          \ 2 = |
00000870  48 61 72 64 0d 02 9e 0f  2e 68 61 72 64 5f 72 65  |Hard.....hard_re|
00000880  73 65 74 0d 02 a8 11 20  5c 20 20 20 4c 44 41 20  |set.... \   LDA |
00000890  23 32 34 37 0d 02 b2 0f  20 5c 20 20 20 4c 44 58  |#247.... \   LDX|
000008a0  20 23 30 0d 02 bc 0f 20  5c 20 20 20 4c 44 59 20  | #0.... \   LDY |
000008b0  23 30 0d 02 c6 4e 20 5c  20 20 20 4a 53 52 20 6f  |#0...N \   JSR o|
000008c0  73 62 79 74 65 20 20 20  20 20 20 20 20 20 20 20  |sbyte           |
000008d0  20 20 20 20 20 20 20 20  20 20 5c 20 63 6c 65 61  |          \ clea|
000008e0  72 20 62 72 65 61 6b 20  76 65 63 74 6f 72 20 69  |r break vector i|
000008f0  66 20 6e 6f 74 20 73 6f  66 74 20 72 65 73 65 74  |f not soft reset|
00000900  0d 02 d0 05 20 0d 02 da  0e 2e 62 72 65 61 6b 5f  |.... .....break_|
00000910  72 74 73 0d 02 e4 0c 20  5c 20 20 20 52 54 53 0d  |rts.... \   RTS.|
00000920  02 ee 05 20 0d 02 f8 49  2e 6f 73 77 6f 72 64 5f  |... ...I.osword_|
00000930  66 69 6c 74 65 72 20 20  20 20 20 20 20 20 20 20  |filter          |
00000940  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 6f 6e  |            \ on|
00000950  20 65 6e 74 72 79 2c 20  41 63 63 20 68 61 73 20  | entry, Acc has |
00000960  4f 53 57 4f 52 44 20 6e  75 6d 62 65 72 0d 03 02  |OSWORD number...|
00000970  11 20 20 20 20 20 43 4d  50 20 23 26 37 41 0d 03  |.     CMP #&7A..|
00000980  0c 1c 20 20 20 20 20 42  45 51 20 63 6f 6d 70 61  |..     BEQ compa|
00000990  72 65 5f 72 6f 75 74 69  6e 65 0d 03 16 3c 20 20  |re_routine...<  |
000009a0  20 20 20 4a 4d 50 20 28  6f 6c 64 5f 6f 73 77 6f  |   JMP (old_oswo|
000009b0  72 64 5f 76 65 63 74 6f  72 29 20 20 20 20 20 20  |rd_vector)      |
000009c0  20 20 5c 20 65 78 69 74  20 69 66 20 6e 6f 74 20  |  \ exit if not |
000009d0  66 6f 72 20 75 73 0d 03  20 05 20 0d 03 2a 14 2e  |for us.. . ..*..|
000009e0  63 6f 6d 70 61 72 65 5f  72 6f 75 74 69 6e 65 0d  |compare_routine.|
000009f0  03 34 3d 20 20 20 20 20  50 48 41 20 20 20 20 20  |.4=     PHA     |
00000a00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a10  20 20 20 20 20 20 20 5c  20 65 6c 73 65 20 73 61  |       \ else sa|
00000a20  76 65 20 72 65 67 69 73  74 65 72 73 0d 03 3e 12  |ve registers..>.|
00000a30  20 20 20 20 20 54 58 41  20 3a 20 50 48 41 0d 03  |     TXA : PHA..|
00000a40  48 12 20 20 20 20 20 54  59 41 20 3a 20 50 48 41  |H.     TYA : PHA|
00000a50  0d 03 52 44 20 20 20 20  20 53 54 58 20 26 46 30  |..RD     STX &F0|
00000a60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a70  20 20 20 20 20 20 20 20  5c 20 73 74 6f 72 65 20  |        \ store |
00000a80  58 20 61 6e 64 20 59 20  69 6e 20 7a 65 72 6f 20  |X and Y in zero |
00000a90  70 61 67 65 0d 03 5c 10  20 20 20 20 20 53 54 59  |page..\.     STY|
00000aa0  20 26 46 31 0d 03 66 0f  20 20 20 20 20 4c 44 59  | &F1..f.     LDY|
00000ab0  20 23 30 0d 03 70 44 20  20 20 20 20 4c 44 41 20  | #0..pD     LDA |
00000ac0  28 26 46 30 29 2c 59 20  20 20 20 20 20 20 20 20  |(&F0),Y         |
00000ad0  20 20 20 20 20 20 20 20  20 20 20 5c 20 61 6e 64  |           \ and|
00000ae0  20 63 68 65 63 6b 20 69  66 20 66 69 72 73 74 20  | check if first |
00000af0  62 79 74 65 20 6f 66 0d  03 7a 47 20 20 20 20 20  |byte of..zG     |
00000b00  43 4d 50 20 23 32 32 20  20 20 20 20 20 20 20 20  |CMP #22         |
00000b10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00000b20  20 70 61 72 61 6d 65 74  65 72 20 62 6c 6f 63 6b  | parameter block|
00000b30  20 69 6e 64 69 63 61 74  65 73 20 74 68 65 0d 03  | indicates the..|
00000b40  84 45 20 20 20 20 20 42  45 51 20 73 74 61 74 75  |.E     BEQ statu|
00000b50  73 5f 6f 73 77 6f 72 64  20 20 20 20 20 20 20 20  |s_osword        |
00000b60  20 20 20 20 20 20 5c 20  44 61 74 65 20 4f 53 57  |      \ Date OSW|
00000b70  4f 52 44 20 68 61 73 20  62 65 65 6e 20 63 61 6c  |ORD has been cal|
00000b80  6c 65 64 0d 03 8e 41 20  20 20 20 20 50 4c 41 20  |led...A     PLA |
00000b90  3a 20 54 41 59 20 20 20  20 20 20 20 20 20 20 20  |: TAY           |
00000ba0  20 20 20 20 20 20 20 20  20 20 20 5c 20 65 6c 73  |           \ els|
00000bb0  65 20 72 65 73 74 6f 72  65 20 72 65 67 69 73 74  |e restore regist|
00000bc0  65 72 73 2c 0d 03 98 12  20 20 20 20 20 50 4c 41  |ers,....     PLA|
00000bd0  20 3a 20 54 41 58 0d 03  a2 0c 20 20 20 20 20 50  | : TAX....     P|
00000be0  4c 41 0d 03 ac 32 20 20  20 20 20 4a 4d 50 20 28  |LA...2     JMP (|
00000bf0  6f 6c 64 5f 6f 73 77 6f  72 64 5f 76 65 63 74 6f  |old_osword_vecto|
00000c00  72 29 20 20 20 20 20 20  20 20 5c 20 61 6e 64 20  |r)        \ and |
00000c10  65 78 69 74 0d 03 b6 05  20 0d 03 c0 37 2e 73 74  |exit.... ...7.st|
00000c20  61 74 75 73 5f 6f 73 77  6f 72 64 20 20 20 20 20  |atus_osword     |
00000c30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c40  20 5c 20 79 65 73 2c 20  69 74 27 73 20 75 73 21  | \ yes, it's us!|
00000c50  0d 03 ca 41 20 20 20 20  20 4c 44 41 20 23 31 37  |...A     LDA #17|
00000c60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c70  20 20 20 20 20 20 20 20  5c 20 73 6f 20 63 68 65  |        \ so che|
00000c80  63 6b 20 41 64 61 70 74  65 72 20 73 74 61 74 75  |ck Adapter statu|
00000c90  73 0d 03 d4 16 20 20 20  20 20 4a 53 52 20 64 6f  |s....     JSR do|
00000ca0  5f 6f 73 77 6f 72 64 0d  03 de 1b 20 20 20 20 20  |_osword....     |
00000cb0  4c 44 41 20 6f 73 77 6f  72 64 5f 62 6c 6f 63 6b  |LDA osword_block|
00000cc0  2b 31 0d 03 e8 45 20 20  20 20 20 42 45 51 20 74  |+1...E     BEQ t|
00000cd0  69 6d 65 5f 6f 73 77 6f  72 64 20 20 20 20 20 20  |ime_osword      |
00000ce0  20 20 20 20 20 20 20 20  20 20 5c 20 63 6f 6e 74  |          \ cont|
00000cf0  69 6e 75 65 20 6f 6e 6c  79 20 69 66 20 72 65 73  |inue only if res|
00000d00  75 6c 74 20 3d 20 30 0d  03 f2 46 20 20 20 20 20  |ult = 0...F     |
00000d10  4c 44 41 20 23 26 46 46  20 20 20 20 20 20 20 20  |LDA #&FF        |
00000d20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00000d30  20 65 6c 73 65 20 73 65  74 20 27 62 61 64 20 66  | else set 'bad f|
00000d40  6c 61 67 27 20 61 6e 64  20 65 78 69 74 0d 03 fc  |lag' and exit...|
00000d50  16 20 20 20 20 20 53 54  41 20 74 69 6d 65 5f 66  |.     STA time_f|
00000d60  6c 61 67 0d 04 06 13 20  20 20 20 20 4a 4d 50 20  |lag....     JMP |
00000d70  66 69 6e 69 73 68 0d 04  10 05 20 0d 04 1a 10 2e  |finish.... .....|
00000d80  74 69 6d 65 5f 6f 73 77  6f 72 64 0d 04 24 4b 20  |time_osword..$K |
00000d90  20 20 20 20 4c 44 41 20  23 32 31 20 20 20 20 20  |    LDA #21     |
00000da0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000db0  20 20 20 5c 20 63 61 6c  6c 20 91 20 72 6f 75 74  |   \ call . rout|
00000dc0  69 6e 65 20 74 6f 20 67  65 74 20 64 61 79 20 6f  |ine to get day o|
00000dd0  66 66 73 65 74 2f 0d 04  2e 3c 20 20 20 20 20 4a  |ffset/...<     J|
00000de0  53 52 20 64 6f 5f 6f 73  77 6f 72 64 20 20 20 20  |SR do_osword    |
00000df0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00000e00  74 73 64 70 20 76 61 6c  69 64 69 74 79 20 66 6c  |tsdp validity fl|
00000e10  61 67 0d 04 38 1c 20 20  20 20 20 4c 44 41 20 6f  |ag..8.     LDA o|
00000e20  73 77 6f 72 64 5f 62 6c  6f 63 6b 2b 31 30 0d 04  |sword_block+10..|
00000e30  42 3e 20 20 20 20 20 53  54 41 20 74 69 6d 65 5f  |B>     STA time_|
00000e40  66 6c 61 67 20 20 20 20  20 20 20 20 20 20 20 20  |flag            |
00000e50  20 20 20 20 20 20 5c 20  73 61 76 65 20 64 61 79  |      \ save day|
00000e60  20 6f 66 66 73 65 74 20  66 6c 61 67 0d 04 4c 18  | offset flag..L.|
00000e70  20 20 20 20 20 42 50 4c  20 74 73 64 70 5f 6f 73  |     BPL tsdp_os|
00000e80  77 6f 72 64 0d 04 56 3c  20 20 20 20 20 4a 4d 50  |word..V<     JMP|
00000e90  20 66 69 6e 69 73 68 20  20 20 20 20 20 20 20 20  | finish         |
00000ea0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 65 78  |            \ ex|
00000eb0  69 74 20 69 66 20 72 65  73 75 6c 74 20 62 61 64  |it if result bad|
00000ec0  0d 04 60 05 20 0d 04 6a  10 2e 74 73 64 70 5f 6f  |..`. ..j..tsdp_o|
00000ed0  73 77 6f 72 64 0d 04 74  32 20 20 20 20 20 4c 44  |sword..t2     LD|
00000ee0  41 20 23 31 35 20 20 20  20 20 20 20 20 20 20 20  |A #15           |
00000ef0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 67  |             \ g|
00000f00  65 74 20 74 73 64 70 0d  04 7e 16 20 20 20 20 20  |et tsdp..~.     |
00000f10  4a 53 52 20 64 6f 5f 6f  73 77 6f 72 64 0d 04 88  |JSR do_osword...|
00000f20  05 20 0d 04 92 44 20 20  20 20 20 4c 44 58 20 23  |. ...D     LDX #|
00000f30  26 39 38 20 20 20 20 20  20 20 20 20 20 20 20 20  |&98             |
00000f40  20 20 20 20 20 20 20 20  20 20 5c 20 72 65 73 75  |          \ resu|
00000f50  6c 74 20 66 6c 61 67 20  66 72 6f 6d 20 91 20 6f  |lt flag from . o|
00000f60  73 77 6f 72 64 3a 0d 04  9c 42 20 20 20 20 20 4c  |sword:...B     L|
00000f70  44 41 20 74 69 6d 65 5f  66 6c 61 67 20 20 20 20  |DA time_flag    |
00000f80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00000f90  3d 20 30 20 69 66 20 4f  4b 2c 20 61 6e 64 20 6e  |= 0 if OK, and n|
00000fa0  6f 20 6f 66 66 73 65 74  0d 04 a6 42 20 20 20 20  |o offset...B    |
00000fb0  20 42 45 51 20 73 61 76  65 5f 78 20 20 20 20 20  | BEQ save_x     |
00000fc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000fd0  5c 20 3d 20 31 20 69 66  20 4f 4b 2c 20 61 6e 64  |\ = 1 if OK, and|
00000fe0  20 41 44 44 20 31 20 64  61 79 0d 04 b0 47 20 20  | ADD 1 day...G  |
00000ff0  20 20 20 43 4d 50 20 23  31 20 20 20 20 20 20 20  |   CMP #1       |
00001000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001010  20 20 5c 20 3d 20 32 20  69 66 20 4f 4b 2c 20 61  |  \ = 2 if OK, a|
00001020  6e 64 20 53 55 42 54 52  41 43 54 20 31 20 64 61  |nd SUBTRACT 1 da|
00001030  79 0d 04 ba 36 20 20 20  20 20 42 4e 45 20 63 68  |y...6     BNE ch|
00001040  65 63 6b 5f 32 20 20 20  20 20 20 20 20 20 20 20  |eck_2           |
00001050  20 20 20 20 20 20 20 20  20 5c 20 3d 20 26 46 46  |         \ = &FF|
00001060  20 69 66 20 62 61 64 0d  04 c4 0c 20 20 20 20 20  | if bad....     |
00001070  44 45 58 0d 04 ce 46 2e  63 68 65 63 6b 5f 32 20  |DEX...F.check_2 |
00001080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001090  20 20 20 20 20 20 20 20  20 20 20 5c 20 68 65 6e  |           \ hen|
000010a0  63 65 20 6d 6f 64 69 66  79 20 72 65 66 65 72 65  |ce modify refere|
000010b0  6e 63 65 20 70 6f 69 6e  74 0d 04 d8 3f 20 20 20  |nce point...?   |
000010c0  20 20 43 4d 50 20 23 32  20 20 20 20 20 20 20 20  |  CMP #2        |
000010d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000010e0  20 5c 20 28 6c 6f 2d 62  79 74 65 29 20 61 63 63  | \ (lo-byte) acc|
000010f0  6f 72 64 69 6e 67 6c 79  0d 04 e2 13 20 20 20 20  |ordingly....    |
00001100  20 42 4e 45 20 73 61 76  65 5f 78 0d 04 ec 0c 20  | BNE save_x.... |
00001110  20 20 20 20 49 4e 58 0d  04 f6 0b 2e 73 61 76 65  |    INX.....save|
00001120  5f 78 0d 05 00 19 20 20  20 20 20 53 54 58 20 6f  |_x....     STX o|
00001130  66 66 73 65 74 5f 75 6e  69 74 73 0d 05 0a 05 20  |ffset_units.... |
00001140  0d 05 14 44 20 20 20 20  20 53 45 49 20 3a 20 53  |...D     SEI : S|
00001150  45 44 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ED              |
00001160  20 20 20 20 20 20 20 20  5c 20 53 75 62 74 72 61  |        \ Subtra|
00001170  63 74 20 72 65 66 65 72  65 6e 63 65 20 70 6f 69  |ct reference poi|
00001180  6e 74 20 2d 0d 05 1e 45  20 20 20 20 20 53 45 43  |nt -...E     SEC|
00001190  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000011a0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 34 34  |            \ 44|
000011b0  32 39 38 20 20 28 32 39  74 68 20 46 65 62 72 75  |298  (29th Febru|
000011c0  61 72 79 20 31 39 38 30  29 0d 05 28 48 20 20 20  |ary 1980)..(H   |
000011d0  20 20 4c 44 41 20 64 61  79 5f 75 6e 69 74 73 20  |  LDA day_units |
000011e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000011f0  20 5c 20 2b 2d 31 20 61  63 63 6f 72 64 69 6e 67  | \ +-1 according|
00001200  20 74 6f 20 72 65 73 75  6c 74 20 66 72 6f 6d 20  | to result from |
00001210  91 0d 05 32 19 20 20 20  20 20 53 42 43 20 6f 66  |...2.     SBC of|
00001220  66 73 65 74 5f 75 6e 69  74 73 0d 05 3c 16 20 20  |fset_units..<.  |
00001230  20 20 20 53 54 41 20 64  61 79 5f 75 6e 69 74 73  |   STA day_units|
00001240  0d 05 46 19 20 20 20 20  20 4c 44 41 20 64 61 79  |..F.     LDA day|
00001250  5f 68 75 6e 64 72 65 64  73 0d 05 50 11 20 20 20  |_hundreds..P.   |
00001260  20 20 53 42 43 20 23 26  34 32 0d 05 5a 19 20 20  |  SBC #&42..Z.  |
00001270  20 20 20 53 54 41 20 64  61 79 5f 68 75 6e 64 72  |   STA day_hundr|
00001280  65 64 73 0d 05 64 1e 20  20 20 20 20 4c 44 41 20  |eds..d.     LDA |
00001290  64 61 79 5f 74 65 6e 5f  74 68 6f 75 73 61 6e 64  |day_ten_thousand|
000012a0  73 0d 05 6e 11 20 20 20  20 20 53 42 43 20 23 26  |s..n.     SBC #&|
000012b0  30 34 0d 05 78 1e 20 20  20 20 20 53 54 41 20 64  |04..x.     STA d|
000012c0  61 79 5f 74 65 6e 5f 74  68 6f 75 73 61 6e 64 73  |ay_ten_thousands|
000012d0  0d 05 82 12 20 20 20 20  20 43 4c 44 20 3a 20 43  |....     CLD : C|
000012e0  4c 49 0d 05 8c 05 20 0d  05 96 44 20 20 20 20 20  |LI.... ...D     |
000012f0  4c 44 41 20 23 26 31 39  20 20 20 20 20 20 20 20  |LDA #&19        |
00001300  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00001310  20 73 65 74 20 42 43 44  20 79 65 61 72 73 20 74  | set BCD years t|
00001320  6f 20 72 65 66 65 72 65  6e 63 65 0d 05 a0 1a 20  |o reference.... |
00001330  20 20 20 20 53 54 41 20  79 65 61 72 5f 68 75 6e  |    STA year_hun|
00001340  64 72 65 64 73 0d 05 aa  11 20 20 20 20 20 4c 44  |dreds....     LD|
00001350  41 20 23 26 38 30 0d 05  b4 17 20 20 20 20 20 53  |A #&80....     S|
00001360  54 41 20 79 65 61 72 5f  75 6e 69 74 73 0d 05 be  |TA year_units...|
00001370  05 20 0d 05 c8 29 20 20  20 20 20 4c 44 41 20 23  |. ...)     LDA #|
00001380  26 36 31 20 3a 20 53 54  41 20 75 6e 69 74 73 5f  |&61 : STA units_|
00001390  74 6f 5f 73 75 62 74 72  61 63 74 0d 05 d2 2c 20  |to_subtract..., |
000013a0  20 20 20 20 4c 44 41 20  23 26 31 34 20 3a 20 53  |    LDA #&14 : S|
000013b0  54 41 20 68 75 6e 64 72  65 64 73 5f 74 6f 5f 73  |TA hundreds_to_s|
000013c0  75 62 74 72 61 63 74 0d  05 dc 24 20 20 20 20 20  |ubtract...$     |
000013d0  4c 44 41 20 23 26 34 20  20 3a 20 53 54 41 20 79  |LDA #&4  : STA y|
000013e0  65 61 72 73 5f 74 6f 5f  61 64 64 0d 05 e6 13 2e  |ears_to_add.....|
000013f0  66 6f 75 72 5f 79 65 61  72 5f 6c 6f 6f 70 0d 05  |four_year_loop..|
00001400  f0 48 20 20 20 20 20 4a  53 52 20 73 75 62 5f 79  |.H     JSR sub_y|
00001410  65 61 72 73 20 20 20 20  20 20 20 20 20 20 20 20  |ears            |
00001420  20 20 20 20 20 20 5c 20  73 75 62 74 72 61 63 74  |      \ subtract|
00001430  20 34 20 79 65 61 72 73  20 77 6f 72 74 68 20 6f  | 4 years worth o|
00001440  66 20 64 61 79 73 0d 05  fa 46 20 20 20 20 20 42  |f days...F     B|
00001450  43 43 20 66 6f 75 72 5f  79 65 61 72 5f 6c 6f 6f  |CC four_year_loo|
00001460  70 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |p             \ |
00001470  75 6e 74 69 6c 20 6c 65  73 73 20 74 68 61 6e 20  |until less than |
00001480  34 20 79 65 61 72 73 20  6c 65 66 74 0d 06 04 05  |4 years left....|
00001490  20 0d 06 0e 29 20 20 20  20 20 4c 44 41 20 23 26  | ...)     LDA #&|
000014a0  36 35 20 3a 20 53 54 41  20 75 6e 69 74 73 5f 74  |65 : STA units_t|
000014b0  6f 5f 73 75 62 74 72 61  63 74 0d 06 18 2c 20 20  |o_subtract...,  |
000014c0  20 20 20 4c 44 41 20 23  26 33 20 20 3a 20 53 54  |   LDA #&3  : ST|
000014d0  41 20 68 75 6e 64 72 65  64 73 5f 74 6f 5f 73 75  |A hundreds_to_su|
000014e0  62 74 72 61 63 74 0d 06  22 24 20 20 20 20 20 4c  |btract.."$     L|
000014f0  44 41 20 23 26 31 20 20  3a 20 53 54 41 20 79 65  |DA #&1  : STA ye|
00001500  61 72 73 5f 74 6f 5f 61  64 64 0d 06 2c 40 20 20  |ars_to_add..,@  |
00001510  20 20 20 4a 53 52 20 73  75 62 5f 79 65 61 72 73  |   JSR sub_years|
00001520  20 5c 20 42 43 53 20 64  6f 5f 6d 6f 6e 74 68 73  | \ BCS do_months|
00001530  20 20 5c 20 73 75 62 74  72 61 63 74 20 75 70 20  |  \ subtract up |
00001540  74 6f 20 33 20 79 65 61  72 73 0d 06 36 3a 20 20  |to 3 years..6:  |
00001550  20 20 20 4a 53 52 20 73  75 62 5f 79 65 61 72 73  |   JSR sub_years|
00001560  20 5c 20 42 43 53 20 64  6f 5f 6d 6f 6e 74 68 73  | \ BCS do_months|
00001570  20 20 5c 20 6f 66 20 33  36 35 20 64 61 79 73 20  |  \ of 365 days |
00001580  65 61 63 68 0d 06 40 16  20 20 20 20 20 4a 53 52  |each..@.     JSR|
00001590  20 73 75 62 5f 79 65 61  72 73 0d 06 4a 05 20 0d  | sub_years..J. .|
000015a0  06 54 4e 2e 64 6f 5f 6d  6f 6e 74 68 73 20 20 20  |.TN.do_months   |
000015b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015c0  20 20 20 20 20 20 20 5c  20 6e 6f 77 20 6c 65 73  |       \ now les|
000015d0  73 20 74 68 61 6e 20 33  36 35 20 64 61 79 73 20  |s than 365 days |
000015e0  73 6f 20 66 69 6e 64 20  6d 6f 6e 74 68 0d 06 5e  |so find month..^|
000015f0  0f 20 20 20 20 20 4c 44  58 20 23 30 0d 06 68 0f  |.     LDX #0..h.|
00001600  2e 6d 6f 6e 74 68 5f 6c  6f 6f 70 0d 06 72 46 20  |.month_loop..rF |
00001610  20 20 20 20 4c 44 41 20  64 61 79 73 5f 70 65 72  |    LDA days_per|
00001620  5f 6d 6f 6e 74 68 2c 58  20 20 20 20 20 20 20 20  |_month,X        |
00001630  20 20 20 5c 20 67 65 74  20 64 61 79 73 20 69 6e  |   \ get days in|
00001640  20 6d 6f 6e 74 68 20 66  72 6f 6d 20 74 61 62 6c  | month from tabl|
00001650  65 0d 06 7c 3d 20 20 20  20 20 53 54 41 20 64 61  |e..|=     STA da|
00001660  79 73 5f 69 6e 5f 63 75  72 72 65 6e 74 5f 6d 6f  |ys_in_current_mo|
00001670  6e 74 68 20 20 20 20 20  20 5c 20 73 74 61 72 74  |nth      \ start|
00001680  69 6e 67 20 77 69 74 68  20 4d 61 72 63 68 0d 06  |ing with March..|
00001690  86 05 20 0d 06 90 3f 20  20 20 20 20 4c 44 41 20  |.. ...?     LDA |
000016a0  64 61 79 5f 68 75 6e 64  72 65 64 73 20 20 20 20  |day_hundreds    |
000016b0  20 20 20 20 20 20 20 20  20 20 20 5c 20 63 68 65  |           \ che|
000016c0  63 6b 20 69 66 20 64 61  79 73 20 6c 65 66 74 20  |ck if days left |
000016d0  69 73 0d 06 9a 3f 20 20  20 20 20 42 4e 45 20 73  |is...?     BNE s|
000016e0  75 62 5f 6d 6f 6e 74 68  73 20 20 20 20 20 20 20  |ub_months       |
000016f0  20 20 20 20 20 20 20 20  20 20 5c 20 67 72 65 61  |          \ grea|
00001700  74 65 72 20 74 68 61 6e  20 69 6e 20 6d 6f 6e 74  |ter than in mont|
00001710  68 0d 06 a4 22 20 20 20  20 20 4c 44 41 20 64 61  |h..."     LDA da|
00001720  79 73 5f 69 6e 5f 63 75  72 72 65 6e 74 5f 6d 6f  |ys_in_current_mo|
00001730  6e 74 68 0d 06 ae 16 20  20 20 20 20 43 4d 50 20  |nth....     CMP |
00001740  64 61 79 5f 75 6e 69 74  73 0d 06 b8 18 20 20 20  |day_units....   |
00001750  20 20 42 43 53 20 73 61  76 65 5f 6d 6f 6e 74 68  |  BCS save_month|
00001760  73 0d 06 c2 05 20 0d 06  cc 46 2e 73 75 62 5f 6d  |s.... ...F.sub_m|
00001770  6f 6e 74 68 73 20 20 20  20 20 20 20 20 20 20 20  |onths           |
00001780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001790  61 6e 64 20 69 66 20 73  6f 2c 20 73 75 62 74 72  |and if so, subtr|
000017a0  61 63 74 20 28 69 6e 20  42 43 44 29 0d 06 d6 12  |act (in BCD)....|
000017b0  20 20 20 20 20 53 45 49  20 3a 20 53 45 44 0d 06  |     SEI : SED..|
000017c0  e0 0c 20 20 20 20 20 53  45 43 0d 06 ea 16 20 20  |..     SEC....  |
000017d0  20 20 20 4c 44 41 20 64  61 79 5f 75 6e 69 74 73  |   LDA day_units|
000017e0  0d 06 f4 22 20 20 20 20  20 53 42 43 20 64 61 79  |..."     SBC day|
000017f0  73 5f 69 6e 5f 63 75 72  72 65 6e 74 5f 6d 6f 6e  |s_in_current_mon|
00001800  74 68 0d 06 fe 16 20 20  20 20 20 53 54 41 20 64  |th....     STA d|
00001810  61 79 5f 75 6e 69 74 73  0d 07 08 19 20 20 20 20  |ay_units....    |
00001820  20 4c 44 41 20 64 61 79  5f 68 75 6e 64 72 65 64  | LDA day_hundred|
00001830  73 0d 07 12 0f 20 20 20  20 20 53 42 43 20 23 30  |s....     SBC #0|
00001840  0d 07 1c 19 20 20 20 20  20 53 54 41 20 64 61 79  |....     STA day|
00001850  5f 68 75 6e 64 72 65 64  73 0d 07 26 12 20 20 20  |_hundreds..&.   |
00001860  20 20 43 4c 44 20 3a 20  43 4c 49 0d 07 30 49 20  |  CLD : CLI..0I |
00001870  20 20 20 20 49 4e 58 20  20 20 20 20 20 20 20 20  |    INX         |
00001880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001890  20 20 20 5c 20 58 20 3d  20 6d 6f 6e 74 68 20 69  |   \ X = month i|
000018a0  6e 64 65 78 2c 20 30 20  3d 20 4d 61 72 63 68 2c  |ndex, 0 = March,|
000018b0  20 2e 2e 2e 0d 07 3a 47  20 20 20 20 20 42 4e 45  | .....:G     BNE|
000018c0  20 6d 6f 6e 74 68 5f 6c  6f 6f 70 20 20 20 20 20  | month_loop     |
000018d0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 28 61  |            \ (a|
000018e0  6c 77 61 79 73 21 29 20  20 20 20 20 20 20 31 31  |lways!)       11|
000018f0  20 3d 20 46 65 62 72 75  61 72 79 0d 07 44 05 20  | = February..D. |
00001900  0d 07 4e 10 2e 73 61 76  65 5f 6d 6f 6e 74 68 73  |..N..save_months|
00001910  0d 07 58 0c 20 20 20 20  20 54 58 41 0d 07 62 31  |..X.     TXA..b1|
00001920  20 20 20 20 20 53 45 49  20 3a 20 53 45 44 20 20  |     SEI : SED  |
00001930  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001940  20 20 20 20 5c 20 75 73  65 20 42 43 44 0d 07 6c  |    \ use BCD..l|
00001950  0c 20 20 20 20 20 43 4c  43 0d 07 76 3e 20 20 20  |.     CLC..v>   |
00001960  20 20 41 44 43 20 23 33  20 20 20 20 20 20 20 20  |  ADC #3        |
00001970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001980  20 5c 20 61 64 64 20 6f  66 66 73 65 74 20 74 6f  | \ add offset to|
00001990  20 6d 6f 6e 74 68 73 0d  07 80 32 20 20 20 20 20  | months...2     |
000019a0  53 54 41 20 6d 6f 6e 74  68 73 20 20 20 20 20 20  |STA months      |
000019b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000019c0  20 61 6e 64 20 73 61 76  65 0d 07 8a 05 20 0d 07  | and save.... ..|
000019d0  94 49 20 20 20 20 20 4c  44 59 20 23 30 20 20 20  |.I     LDY #0   |
000019e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000019f0  20 20 20 20 20 20 5c 20  64 6f 2d 6e 6f 74 68 69  |      \ do-nothi|
00001a00  6e 67 20 62 75 67 20 66  69 78 21 20 28 30 20 61  |ng bug fix! (0 a|
00001a10  74 20 26 41 30 30 29 0d  07 9e 4d 20 20 20 20 20  |t &A00)...M     |
00001a20  43 50 58 20 23 31 30 20  20 20 20 20 20 20 20 20  |CPX #10         |
00001a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00001a40  20 69 66 20 58 20 3d 20  31 30 20 6f 72 20 31 31  | if X = 10 or 11|
00001a50  2c 20 6d 6f 6e 74 68 20  3d 20 4a 61 6e 20 6f 72  |, month = Jan or|
00001a60  20 46 65 62 0d 07 a8 13  20 20 20 20 20 42 43 43  | Feb....     BCC|
00001a70  20 66 69 6e 69 73 68 0d  07 b2 0c 20 20 20 20 20  | finish....     |
00001a80  53 45 43 0d 07 bc 38 20  20 20 20 20 53 42 43 20  |SEC...8     SBC |
00001a90  23 26 31 32 20 20 20 20  20 20 20 20 20 20 20 20  |#&12            |
00001aa0  20 20 20 20 20 20 20 20  20 20 20 5c 20 73 6f 20  |           \ so |
00001ab0  73 75 62 74 72 61 63 74  20 31 32 0d 07 c6 13 20  |subtract 12.... |
00001ac0  20 20 20 20 53 54 41 20  6d 6f 6e 74 68 73 0d 07  |    STA months..|
00001ad0  d0 0c 20 20 20 20 20 43  4c 43 0d 07 da 17 20 20  |..     CLC....  |
00001ae0  20 20 20 4c 44 41 20 79  65 61 72 5f 75 6e 69 74  |   LDA year_unit|
00001af0  73 0d 07 e4 3c 20 20 20  20 20 41 44 43 20 23 31  |s...<     ADC #1|
00001b00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001b10  20 20 20 20 20 20 20 20  20 5c 20 61 6e 64 20 69  |         \ and i|
00001b20  6e 63 72 65 6d 65 6e 74  20 79 65 61 72 0d 07 ee  |ncrement year...|
00001b30  17 20 20 20 20 20 53 54  41 20 79 65 61 72 5f 75  |.     STA year_u|
00001b40  6e 69 74 73 0d 07 f8 1a  20 20 20 20 20 4c 44 41  |nits....     LDA|
00001b50  20 79 65 61 72 5f 68 75  6e 64 72 65 64 73 0d 08  | year_hundreds..|
00001b60  02 0f 20 20 20 20 20 41  44 43 20 23 30 0d 08 0c  |..     ADC #0...|
00001b70  1a 20 20 20 20 20 53 54  41 20 79 65 61 72 5f 68  |.     STA year_h|
00001b80  75 6e 64 72 65 64 73 0d  08 16 05 20 0d 08 20 0b  |undreds.... .. .|
00001b90  2e 66 69 6e 69 73 68 0d  08 2a 12 20 20 20 20 20  |.finish..*.     |
00001ba0  43 4c 44 20 3a 20 43 4c  49 0d 08 34 05 20 0d 08  |CLD : CLI..4. ..|
00001bb0  3e 3b 20 20 20 20 20 4c  44 41 20 74 69 6d 65 5f  |>;     LDA time_|
00001bc0  66 6c 61 67 20 20 20 20  20 20 20 20 20 20 20 20  |flag            |
00001bd0  20 20 20 20 20 20 5c 20  67 65 74 20 67 6f 6f 64  |      \ get good|
00001be0  2f 62 61 64 20 66 6c 61  67 0d 08 48 41 20 20 20  |/bad flag..HA   |
00001bf0  20 20 42 50 4c 20 76 61  6c 69 64 5f 72 65 73 75  |  BPL valid_resu|
00001c00  6c 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |lt              |
00001c10  20 5c 20 63 6f 6e 74 69  6e 75 65 20 28 62 72 61  | \ continue (bra|
00001c20  6e 63 68 29 20 69 66 20  4f 4b 0d 08 52 47 20 20  |nch) if OK..RG  |
00001c30  20 20 20 4c 44 41 20 23  30 20 20 20 20 20 20 20  |   LDA #0       |
00001c40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001c50  20 20 5c 20 65 6c 73 65  20 73 65 74 20 72 65 73  |  \ else set res|
00001c60  75 6c 74 20 74 6f 20 61  6c 6c 20 7a 65 72 6f 65  |ult to all zeroe|
00001c70  73 0d 08 5c 16 20 20 20  20 20 53 54 41 20 64 61  |s..\.     STA da|
00001c80  79 5f 75 6e 69 74 73 0d  08 66 13 20 20 20 20 20  |y_units..f.     |
00001c90  53 54 41 20 6d 6f 6e 74  68 73 0d 08 70 1a 20 20  |STA months..p.  |
00001ca0  20 20 20 53 54 41 20 79  65 61 72 5f 68 75 6e 64  |   STA year_hund|
00001cb0  72 65 64 73 0d 08 7a 17  20 20 20 20 20 53 54 41  |reds..z.     STA|
00001cc0  20 79 65 61 72 5f 75 6e  69 74 73 0d 08 84 05 20  | year_units.... |
00001cd0  0d 08 8e 11 2e 76 61 6c  69 64 5f 72 65 73 75 6c  |.....valid_resul|
00001ce0  74 0d 08 98 42 20 20 20  20 20 50 4c 41 20 3a 20  |t...B     PLA : |
00001cf0  53 54 41 20 26 46 31 20  20 20 20 20 20 20 20 20  |STA &F1         |
00001d00  20 20 20 20 20 20 20 20  20 5c 20 70 75 6c 6c 20  |         \ pull |
00001d10  72 65 67 69 73 74 65 72  73 20 6f 66 66 20 73 74  |registers off st|
00001d20  61 63 6b 0d 08 a2 16 20  20 20 20 20 50 4c 41 20  |ack....     PLA |
00001d30  3a 20 53 54 41 20 26 46  30 0d 08 ac 16 20 20 20  |: STA &F0....   |
00001d40  20 20 50 4c 41 20 3a 20  53 54 41 20 26 45 46 0d  |  PLA : STA &EF.|
00001d50  08 b6 05 20 0d 08 c0 0f  20 20 20 20 20 4c 44 59  |... ....     LDY|
00001d60  20 23 31 0d 08 ca 49 20  20 20 20 20 4c 44 41 20  | #1...I     LDA |
00001d70  64 61 79 5f 75 6e 69 74  73 20 20 20 20 20 20 20  |day_units       |
00001d80  20 20 20 20 20 20 20 20  20 20 20 5c 20 61 6e 64  |           \ and|
00001d90  20 73 74 6f 72 65 20 72  65 73 75 6c 74 20 61 73  | store result as|
00001da0  20 61 20 73 74 72 69 6e  67 20 61 74 0d 08 d4 4e  | a string at...N|
00001db0  20 20 20 20 20 4a 53 52  20 73 74 6f 72 65 5f 61  |     JSR store_a|
00001dc0  73 63 69 69 20 20 20 20  20 20 20 20 20 20 20 20  |scii            |
00001dd0  20 20 20 20 5c 20 61 64  64 72 65 73 73 20 73 70  |    \ address sp|
00001de0  65 63 69 66 69 65 64 20  62 79 20 58 20 61 6e 64  |ecified by X and|
00001df0  20 59 20 6f 6e 20 63 61  6c 6c 0d 08 de 12 20 20  | Y on call....  |
00001e00  20 20 20 4c 44 41 20 23  97 22 2f 22 0d 08 e8 1a  |   LDA #."/"....|
00001e10  20 20 20 20 20 53 54 41  20 28 26 46 30 29 2c 59  |     STA (&F0),Y|
00001e20  20 3a 20 49 4e 59 0d 08  f2 13 20 20 20 20 20 4c  | : INY....     L|
00001e30  44 41 20 6d 6f 6e 74 68  73 0d 08 fc 18 20 20 20  |DA months....   |
00001e40  20 20 4a 53 52 20 73 74  6f 72 65 5f 61 73 63 69  |  JSR store_asci|
00001e50  69 0d 09 06 12 20 20 20  20 20 4c 44 41 20 23 97  |i....     LDA #.|
00001e60  22 2f 22 0d 09 10 1a 20  20 20 20 20 53 54 41 20  |"/"....     STA |
00001e70  28 26 46 30 29 2c 59 20  3a 20 49 4e 59 0d 09 1a  |(&F0),Y : INY...|
00001e80  1a 20 20 20 20 20 4c 44  41 20 79 65 61 72 5f 68  |.     LDA year_h|
00001e90  75 6e 64 72 65 64 73 0d  09 24 18 20 20 20 20 20  |undreds..$.     |
00001ea0  4a 53 52 20 73 74 6f 72  65 5f 61 73 63 69 69 0d  |JSR store_ascii.|
00001eb0  09 2e 17 20 20 20 20 20  4c 44 41 20 79 65 61 72  |...     LDA year|
00001ec0  5f 75 6e 69 74 73 0d 09  38 18 20 20 20 20 20 4a  |_units..8.     J|
00001ed0  53 52 20 73 74 6f 72 65  5f 61 73 63 69 69 0d 09  |SR store_ascii..|
00001ee0  42 4a 20 20 20 20 20 4c  44 41 20 23 31 33 20 20  |BJ     LDA #13  |
00001ef0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001f00  20 20 20 20 20 20 5c 20  61 70 70 65 6e 64 20 43  |      \ append C|
00001f10  61 72 72 69 61 67 65 20  52 65 74 75 72 6e 20 74  |arriage Return t|
00001f20  6f 20 73 74 72 69 6e 67  0d 09 4c 1a 20 20 20 20  |o string..L.    |
00001f30  20 53 54 41 20 28 26 46  30 29 2c 59 20 3a 20 49  | STA (&F0),Y : I|
00001f40  4e 59 0d 09 56 21 20 20  20 20 20 4c 44 41 20 74  |NY..V!     LDA t|
00001f50  69 6d 65 5f 66 6c 61 67  20 3a 20 42 4d 49 20 64  |ime_flag : BMI d|
00001f60  75 66 66 0d 09 60 0f 20  20 20 20 20 4c 44 41 20  |uff..`.     LDA |
00001f70  23 30 0d 09 6a 09 2e 64  75 66 66 0d 09 74 4a 20  |#0..j..duff..tJ |
00001f80  20 20 20 20 53 54 41 20  28 26 46 30 29 2c 59 20  |    STA (&F0),Y |
00001f90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001fa0  20 20 20 5c 20 73 74 6f  72 65 20 67 6f 6f 64 2f  |   \ store good/|
00001fb0  62 61 64 20 66 6c 61 67  20 61 66 74 65 72 20 73  |bad flag after s|
00001fc0  74 72 69 6e 67 0d 09 7e  3d 20 20 20 20 20 52 54  |tring..~=     RT|
00001fd0  53 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |S               |
00001fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 30  |             \ 0|
00001ff0  20 3d 20 67 6f 6f 64 2c  20 26 46 46 20 3d 20 62  | = good, &FF = b|
00002000  61 64 0d 09 88 05 20 0d  09 92 4d 20 5c 20 2d 2d  |ad.... ...M \ --|
00002010  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002050  2d 2d 2d 2d 0d 09 9c 05  20 0d 09 a6 0e 2e 73 75  |----.... .....su|
00002060  62 5f 79 65 61 72 73 0d  09 b0 4a 20 20 20 20 20  |b_years...J     |
00002070  4c 44 41 20 64 61 79 5f  74 65 6e 5f 74 68 6f 75  |LDA day_ten_thou|
00002080  73 61 6e 64 73 20 20 20  20 20 20 20 20 20 20 5c  |sands          \|
00002090  20 69 66 20 64 61 79 73  20 3e 3d 20 31 30 2c 30  | if days >= 10,0|
000020a0  30 30 2c 20 74 68 65 6e  20 73 75 62 74 72 61 63  |00, then subtrac|
000020b0  74 0d 09 ba 18 20 20 20  20 20 42 4e 45 20 64 6f  |t....     BNE do|
000020c0  5f 73 75 62 74 72 61 63  74 0d 09 c4 19 20 20 20  |_subtract....   |
000020d0  20 20 4c 44 41 20 64 61  79 5f 68 75 6e 64 72 65  |  LDA day_hundre|
000020e0  64 73 0d 09 ce 49 20 20  20 20 20 43 4d 50 20 68  |ds...I     CMP h|
000020f0  75 6e 64 72 65 64 73 5f  74 6f 5f 73 75 62 74 72  |undreds_to_subtr|
00002100  61 63 74 20 20 20 20 20  20 20 5c 20 63 68 65 63  |act       \ chec|
00002110  6b 20 74 68 61 74 20 64  61 79 73 20 6c 65 66 74  |k that days left|
00002120  20 69 73 20 67 72 65 61  74 65 72 0d 09 d8 3f 20  | is greater...? |
00002130  20 20 20 20 42 45 51 20  63 68 65 63 6b 5f 75 6e  |    BEQ check_un|
00002140  69 74 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |its             |
00002150  20 20 20 5c 20 74 68 61  6e 20 64 61 79 73 20 74  |   \ than days t|
00002160  6f 20 73 75 62 74 72 61  63 74 0d 09 e2 18 20 20  |o subtract....  |
00002170  20 20 20 42 43 53 20 64  6f 5f 73 75 62 74 72 61  |   BCS do_subtra|
00002180  63 74 0d 09 ec 0c 20 20  20 20 20 53 45 43 0d 09  |ct....     SEC..|
00002190  f6 44 2e 65 78 69 74 20  20 20 20 20 20 20 20 20  |.D.exit         |
000021a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000021b0  20 20 20 20 20 20 5c 20  65 6c 73 65 20 65 78 69  |      \ else exi|
000021c0  74 20 28 77 69 74 68 20  43 41 52 52 59 20 73 65  |t (with CARRY se|
000021d0  74 29 0d 0a 00 0c 20 20  20 20 20 52 54 53 0d 0a  |t)....     RTS..|
000021e0  0a 05 20 0d 0a 14 10 2e  63 68 65 63 6b 5f 75 6e  |.. .....check_un|
000021f0  69 74 73 0d 0a 1e 1e 20  20 20 20 20 4c 44 41 20  |its....     LDA |
00002200  75 6e 69 74 73 5f 74 6f  5f 73 75 62 74 72 61 63  |units_to_subtrac|
00002210  74 0d 0a 28 16 20 20 20  20 20 43 4d 50 20 64 61  |t..(.     CMP da|
00002220  79 5f 75 6e 69 74 73 0d  0a 32 11 20 20 20 20 20  |y_units..2.     |
00002230  42 43 53 20 65 78 69 74  0d 0a 3c 05 20 0d 0a 46  |BCS exit..<. ..F|
00002240  10 2e 64 6f 5f 73 75 62  74 72 61 63 74 0d 0a 50  |..do_subtract..P|
00002250  44 20 20 20 20 20 53 45  49 20 3a 20 53 45 44 20  |D     SEI : SED |
00002260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002270  20 20 20 20 20 5c 20 75  73 65 20 42 43 44 20 61  |     \ use BCD a|
00002280  72 69 74 68 6d 65 74 69  63 2c 20 73 6f 20 73 65  |rithmetic, so se|
00002290  74 0d 0a 5a 4c 20 20 20  20 20 53 45 43 20 20 20  |t..ZL     SEC   |
000022a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000022b0  20 20 20 20 20 20 20 20  20 5c 20 69 6e 74 65 72  |         \ inter|
000022c0  72 75 70 74 20 66 6c 61  67 20 74 6f 20 70 72 65  |rupt flag to pre|
000022d0  76 65 6e 74 20 4f 53 20  62 65 69 6e 67 0d 0a 64  |vent OS being..d|
000022e0  48 20 20 20 20 20 4c 44  41 20 64 61 79 5f 75 6e  |H     LDA day_un|
000022f0  69 74 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |its             |
00002300  20 20 20 20 20 5c 20 63  6f 6e 66 75 73 65 64 20  |     \ confused |
00002310  64 75 72 69 6e 67 20 61  6e 79 20 69 6e 74 65 72  |during any inter|
00002320  72 75 70 74 73 0d 0a 6e  1e 20 20 20 20 20 53 42  |rupts..n.     SB|
00002330  43 20 75 6e 69 74 73 5f  74 6f 5f 73 75 62 74 72  |C units_to_subtr|
00002340  61 63 74 0d 0a 78 16 20  20 20 20 20 53 54 41 20  |act..x.     STA |
00002350  64 61 79 5f 75 6e 69 74  73 0d 0a 82 19 20 20 20  |day_units....   |
00002360  20 20 4c 44 41 20 64 61  79 5f 68 75 6e 64 72 65  |  LDA day_hundre|
00002370  64 73 0d 0a 8c 21 20 20  20 20 20 53 42 43 20 68  |ds...!     SBC h|
00002380  75 6e 64 72 65 64 73 5f  74 6f 5f 73 75 62 74 72  |undreds_to_subtr|
00002390  61 63 74 0d 0a 96 19 20  20 20 20 20 53 54 41 20  |act....     STA |
000023a0  64 61 79 5f 68 75 6e 64  72 65 64 73 0d 0a a0 1e  |day_hundreds....|
000023b0  20 20 20 20 20 4c 44 41  20 64 61 79 5f 74 65 6e  |     LDA day_ten|
000023c0  5f 74 68 6f 75 73 61 6e  64 73 0d 0a aa 0f 20 20  |_thousands....  |
000023d0  20 20 20 53 42 43 20 23  30 0d 0a b4 1e 20 20 20  |   SBC #0....   |
000023e0  20 20 53 54 41 20 64 61  79 5f 74 65 6e 5f 74 68  |  STA day_ten_th|
000023f0  6f 75 73 61 6e 64 73 0d  0a be 05 20 0d 0a c8 0c  |ousands.... ....|
00002400  20 20 20 20 20 43 4c 43  0d 0a d2 45 20 20 20 20  |     CLC...E    |
00002410  20 4c 44 41 20 79 65 61  72 5f 75 6e 69 74 73 20  | LDA year_units |
00002420  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002430  5c 20 69 6e 63 72 65 6d  65 6e 74 20 79 65 61 72  |\ increment year|
00002440  20 63 6f 75 6e 74 65 72  73 20 66 6f 72 0d 0a dc  | counters for...|
00002450  46 20 20 20 20 20 41 44  43 20 79 65 61 72 73 5f  |F     ADC years_|
00002460  74 6f 5f 61 64 64 20 20  20 20 20 20 20 20 20 20  |to_add          |
00002470  20 20 20 20 20 5c 20 6e  75 6d 62 65 72 20 6f 66  |     \ number of|
00002480  20 79 65 61 72 73 20 6f  66 20 64 61 79 73 20 74  | years of days t|
00002490  68 61 74 0d 0a e6 3e 20  20 20 20 20 53 54 41 20  |hat...>     STA |
000024a0  79 65 61 72 5f 75 6e 69  74 73 20 20 20 20 20 20  |year_units      |
000024b0  20 20 20 20 20 20 20 20  20 20 20 5c 20 68 61 76  |           \ hav|
000024c0  65 20 62 65 65 6e 20 73  75 62 74 72 61 63 74 65  |e been subtracte|
000024d0  64 0d 0a f0 1a 20 20 20  20 20 4c 44 41 20 79 65  |d....     LDA ye|
000024e0  61 72 5f 68 75 6e 64 72  65 64 73 0d 0a fa 0f 20  |ar_hundreds.... |
000024f0  20 20 20 20 41 44 43 20  23 30 0d 0b 04 1a 20 20  |    ADC #0....  |
00002500  20 20 20 53 54 41 20 79  65 61 72 5f 68 75 6e 64  |   STA year_hund|
00002510  72 65 64 73 0d 0b 0e 05  20 0d 0b 18 4b 20 20 20  |reds.... ...K   |
00002520  20 20 43 4c 44 20 3a 20  43 4c 49 20 20 20 20 20  |  CLD : CLI     |
00002530  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002540  20 5c 20 63 6c 65 61 72  20 44 65 63 69 6d 61 6c  | \ clear Decimal|
00002550  20 61 6e 64 20 49 6e 74  65 72 72 75 70 74 20 66  | and Interrupt f|
00002560  6c 61 67 73 0d 0b 22 4b  20 20 20 20 20 52 54 53  |lags.."K     RTS|
00002570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002580  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 61 73  |            \ as|
00002590  61 70 20 74 6f 20 70 72  65 76 65 6e 74 20 63 6c  |ap to prevent cl|
000025a0  6f 63 6b 20 6c 6f 73 69  6e 67 20 74 69 6d 65 0d  |ock losing time.|
000025b0  0b 2c 05 20 0d 0b 36 4d  20 5c 20 2d 2d 2d 2d 2d  |.,. ..6M \ -----|
000025c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002600  2d 0d 0b 40 05 20 0d 0b  4a 45 2e 73 74 6f 72 65  |-..@. ..JE.store|
00002610  5f 61 73 63 69 69 20 20  20 20 20 20 20 20 20 20  |_ascii          |
00002620  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00002630  73 61 76 65 20 74 77 6f  20 97 49 49 20 63 68 61  |save two .II cha|
00002640  72 61 63 74 65 72 73 20  66 6f 72 0d 0b 54 37 20  |racters for..T7 |
00002650  20 20 20 20 50 48 41 20  20 20 20 20 20 20 20 20  |    PHA         |
00002660  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002670  20 20 20 5c 20 65 61 63  68 20 42 43 44 20 62 79  |   \ each BCD by|
00002680  74 65 0d 0b 5e 22 20 20  20 20 20 4c 53 52 41 20  |te..^"     LSRA |
00002690  3a 20 4c 53 52 41 20 3a  20 4c 53 52 41 20 3a 20  |: LSRA : LSRA : |
000026a0  4c 53 52 41 0d 0b 68 10  20 20 20 20 20 84 41 20  |LSRA..h.     .A |
000026b0  23 26 33 30 0d 0b 72 49  20 20 20 20 20 53 54 41  |#&30..rI     STA|
000026c0  20 28 26 46 30 29 2c 59  20 3a 20 49 4e 59 20 20  | (&F0),Y : INY  |
000026d0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 69 6e  |            \ in|
000026e0  63 72 65 6d 65 6e 74 69  6e 67 20 70 6f 69 6e 74  |crementing point|
000026f0  65 72 20 61 73 20 69 74  20 67 6f 65 73 0d 0b 7c  |er as it goes..||
00002700  0c 20 20 20 20 20 50 4c  41 0d 0b 86 0f 20 20 20  |.     PLA....   |
00002710  20 20 80 20 23 26 30 46  0d 0b 90 10 20 20 20 20  |  . #&0F....    |
00002720  20 84 41 20 23 26 33 30  0d 0b 9a 1a 20 20 20 20  | .A #&30....    |
00002730  20 53 54 41 20 28 26 46  30 29 2c 59 20 3a 20 49  | STA (&F0),Y : I|
00002740  4e 59 0d 0b a4 0c 20 20  20 20 20 52 54 53 0d 0b  |NY....     RTS..|
00002750  ae 05 20 0d 0b b8 4d 20  5c 20 2d 2d 2d 2d 2d 2d  |.. ...M \ ------|
00002760  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000027a0  0d 0b c2 05 20 0d 0b cc  4e 2e 64 6f 5f 6f 73 77  |.... ...N.do_osw|
000027b0  6f 72 64 20 20 20 20 20  20 20 20 20 20 20 20 20  |ord             |
000027c0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 43  |             \ C|
000027d0  61 6c 6c 20 54 65 6c 65  74 65 78 74 20 4f 53 57  |all Teletext OSW|
000027e0  4f 52 44 20 72 6f 75 74  69 6e 65 20 66 6f 72 20  |ORD routine for |
000027f0  74 68 65 0d 0b d6 4b 20  20 20 20 20 53 54 41 20  |the...K     STA |
00002800  6f 73 77 6f 72 64 5f 62  6c 6f 63 6b 20 20 20 20  |osword_block    |
00002810  20 20 20 20 20 20 20 20  20 20 20 5c 20 73 65 72  |           \ ser|
00002820  76 69 63 65 20 6e 75 6d  62 65 72 20 69 6e 20 74  |vice number in t|
00002830  68 65 20 41 63 63 75 6d  75 6c 61 74 6f 72 0d 0b  |he Accumulator..|
00002840  e0 11 20 20 20 20 20 4c  44 41 20 23 26 37 41 0d  |..     LDA #&7A.|
00002850  0b ea 20 20 20 20 20 20  4c 44 58 20 23 6f 73 77  |..      LDX #osw|
00002860  6f 72 64 5f 62 6c 6f 63  6b 20 83 20 32 35 36 0d  |ord_block . 256.|
00002870  0b f4 20 20 20 20 20 20  4c 44 59 20 23 6f 73 77  |..      LDY #osw|
00002880  6f 72 64 5f 62 6c 6f 63  6b 20 81 20 32 35 36 0d  |ord_block . 256.|
00002890  0b fe 41 20 20 20 20 20  4a 4d 50 20 6f 73 77 6f  |..A     JMP oswo|
000028a0  72 64 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |rd              |
000028b0  20 20 20 20 20 20 20 5c  20 43 61 6c 6c 20 4f 53  |       \ Call OS|
000028c0  57 4f 52 44 2c 20 61 6e  64 20 72 65 74 75 72 6e  |WORD, and return|
000028d0  0d 0c 08 05 20 0d 0c 12  4d 20 5c 20 2d 2d 2d 2d  |.... ...M \ ----|
000028e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002920  2d 2d 0d 0c 1c 05 20 0d  0c 26 43 20 5c 20 6f 73  |--.... ..&C \ os|
00002930  77 6f 72 64 20 70 61 72  61 6d 65 74 65 72 20 62  |word parameter b|
00002940  6c 6f 63 6b 20 69 73 20  72 65 2d 75 73 65 64 20  |lock is re-used |
00002950  66 6f 72 20 74 68 65 20  72 6f 75 74 69 6e 65 20  |for the routine |
00002960  76 61 72 69 61 62 6c 65  73 3a 0d 0c 30 3b 20 5c  |variables:..0; \|
00002970  20 76 61 72 69 61 62 6c  65 20 6e 61 6d 65 20 20  | variable name  |
00002980  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002990  4f 66 66 73 65 74 20 20  4f 53 57 4f 52 44 20 26  |Offset  OSWORD &|
000029a0  37 41 2f 31 35 0d 0c 3a  39 20 5c 20 20 20 20 20  |7A/15..:9 \     |
000029b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000029d0  20 20 20 20 28 67 65 74  20 74 73 64 70 29 0d 0c  |    (get tsdp)..|
000029e0  44 37 2e 6f 73 77 6f 72  64 5f 62 6c 6f 63 6b 20  |D7.osword_block |
000029f0  20 20 20 20 20 20 20 20  20 20 45 51 55 42 20 30  |          EQUB 0|
00002a00  20 20 20 5c 20 20 30 20  2d 20 63 6f 6d 6d 61 6e  |   \  0 - comman|
00002a10  64 20 6e 6f 2e 0d 0c 4e  41 2e 79 65 61 72 73 5f  |d no...NA.years_|
00002a20  74 6f 5f 61 64 64 20 20  20 20 20 20 20 20 20 20  |to_add          |
00002a30  20 45 51 55 42 20 30 20  20 20 5c 20 20 31 20 2d  | EQUB 0   \  1 -|
00002a40  20 49 6e 69 74 69 61 6c  20 50 61 67 65 20 4d 61  | Initial Page Ma|
00002a50  67 61 7a 69 6e 65 0d 0c  58 3f 2e 64 61 79 73 5f  |gazine..X?.days_|
00002a60  69 6e 5f 63 75 72 72 65  6e 74 5f 6d 6f 6e 74 68  |in_current_month|
00002a70  20 20 45 51 55 42 20 30  20 20 20 5c 20 20 32 20  |  EQUB 0   \  2 |
00002a80  2d 20 49 6e 69 74 69 61  6c 20 50 61 67 65 20 4e  |- Initial Page N|
00002a90  75 6d 62 65 72 0d 0c 62  3e 2e 68 75 6e 64 72 65  |umber..b>.hundre|
00002aa0  64 73 5f 74 6f 5f 73 75  62 74 72 61 63 74 20 20  |ds_to_subtract  |
00002ab0  20 45 51 55 42 20 30 20  20 20 5c 20 20 33 20 2d  | EQUB 0   \  3 -|
00002ac0  20 50 61 67 65 20 53 75  62 2d 63 6f 64 65 20 2d  | Page Sub-code -|
00002ad0  20 68 69 0d 0c 6c 3e 2e  75 6e 69 74 73 5f 74 6f  | hi..l>.units_to|
00002ae0  5f 73 75 62 74 72 61 63  74 20 20 20 20 20 20 45  |_subtract      E|
00002af0  51 55 42 20 30 20 20 20  5c 20 20 34 20 2d 20 50  |QUB 0   \  4 - P|
00002b00  61 67 65 20 53 75 62 2d  63 6f 64 65 20 2d 20 6c  |age Sub-code - l|
00002b10  6f 0d 0c 76 34 2e 79 65  61 72 5f 75 6e 69 74 73  |o..v4.year_units|
00002b20  20 20 20 20 20 20 20 20  20 20 20 20 20 45 51 55  |             EQU|
00002b30  42 20 30 20 20 20 5c 20  20 35 20 2d 20 4e 49 47  |B 0   \  5 - NIG|
00002b40  20 2d 20 68 69 0d 0c 80  34 2e 79 65 61 72 5f 68  | - hi...4.year_h|
00002b50  75 6e 64 72 65 64 73 20  20 20 20 20 20 20 20 20  |undreds         |
00002b60  20 45 51 55 42 20 30 20  20 20 5c 20 20 36 20 2d  | EQUB 0   \  6 -|
00002b70  20 4e 49 47 20 2d 20 6c  6f 0d 0c 8a 41 2e 6d 6f  | NIG - lo...A.mo|
00002b80  6e 74 68 73 20 20 20 20  20 20 20 20 20 20 20 20  |nths            |
00002b90  20 20 20 20 20 45 51 55  42 20 30 20 20 20 5c 20  |     EQUB 0   \ |
00002ba0  20 37 20 2d 20 54 69 6d  65 20 6f 66 66 73 65 74  | 7 - Time offset|
00002bb0  20 28 26 38 31 2f 26 38  35 29 0d 0c 94 38 2e 64  | (&81/&85)...8.d|
00002bc0  61 79 5f 74 65 6e 5f 74  68 6f 75 73 61 6e 64 73  |ay_ten_thousands|
00002bd0  20 20 20 20 20 20 45 51  55 42 20 30 20 20 20 5c  |      EQUB 0   \|
00002be0  20 20 38 20 2d 20 4d 4a  44 20 31 30 2c 30 30 30  |  8 - MJD 10,000|
00002bf0  27 73 0d 0c 9e 3f 2e 64  61 79 5f 68 75 6e 64 72  |'s...?.day_hundr|
00002c00  65 64 73 20 20 20 20 20  20 20 20 20 20 20 45 51  |eds           EQ|
00002c10  55 42 20 30 20 20 20 5c  20 20 39 20 2d 20 4d 4a  |UB 0   \  9 - MJ|
00002c20  44 20 31 2c 30 30 30 27  73 20 26 20 31 30 30 27  |D 1,000's & 100'|
00002c30  73 0d 0c a8 3c 2e 64 61  79 5f 75 6e 69 74 73 20  |s...<.day_units |
00002c40  20 20 20 20 20 20 20 20  20 20 20 20 20 45 51 55  |             EQU|
00002c50  42 20 30 20 20 20 5c 20  31 30 20 2d 20 4d 4a 44  |B 0   \ 10 - MJD|
00002c60  20 31 30 27 73 20 61 6e  64 20 31 27 73 0d 0c b2  | 10's and 1's...|
00002c70  31 2e 6f 66 66 73 65 74  5f 75 6e 69 74 73 20 20  |1.offset_units  |
00002c80  20 20 20 20 20 20 20 20  20 45 51 55 42 20 30 20  |         EQUB 0 |
00002c90  20 20 5c 20 31 31 20 2d  20 48 6f 75 72 73 0d 0c  |  \ 11 - Hours..|
00002ca0  bc 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.3              |
00002cb0  20 20 20 20 20 20 20 20  20 20 45 51 55 42 20 30  |          EQUB 0|
00002cc0  20 20 20 5c 20 31 32 20  2d 20 4d 69 6e 75 74 65  |   \ 12 - Minute|
00002cd0  73 0d 0c c6 33 20 20 20  20 20 20 20 20 20 20 20  |s...3           |
00002ce0  20 20 20 20 20 20 20 20  20 20 20 20 20 45 51 55  |             EQU|
00002cf0  42 20 30 20 20 20 5c 20  31 33 20 2d 20 53 65 63  |B 0   \ 13 - Sec|
00002d00  6f 6e 64 73 0d 0c d0 13  2e 64 61 79 73 5f 70 65  |onds.....days_pe|
00002d10  72 5f 6d 6f 6e 74 68 0d  0c da 44 20 20 20 20 20  |r_month...D     |
00002d20  45 51 55 42 20 26 33 31  20 3a 20 45 51 55 42 20  |EQUB &31 : EQUB |
00002d30  26 33 30 20 3a 20 45 51  55 42 20 26 33 31 20 3a  |&30 : EQUB &31 :|
00002d40  20 45 51 55 42 20 26 33  30 20 20 5c 20 4d 61 72  | EQUB &30  \ Mar|
00002d50  63 68 20 20 74 6f 20 4a  75 6e 65 0d 0c e4 45 20  |ch  to June...E |
00002d60  20 20 20 20 45 51 55 42  20 26 33 31 20 3a 20 45  |    EQUB &31 : E|
00002d70  51 55 42 20 26 33 31 20  3a 20 45 51 55 42 20 26  |QUB &31 : EQUB &|
00002d80  33 30 20 3a 20 45 51 55  42 20 26 33 31 20 20 5c  |30 : EQUB &31  \|
00002d90  20 4a 75 6c 79 20 74 6f  20 4f 63 74 6f 62 65 72  | July to October|
00002da0  0d 0c ee 4a 20 20 20 20  20 45 51 55 42 20 26 33  |...J     EQUB &3|
00002db0  30 20 3a 20 45 51 55 42  20 26 33 31 20 3a 20 45  |0 : EQUB &31 : E|
00002dc0  51 55 42 20 26 33 31 20  3a 20 45 51 55 42 20 26  |QUB &31 : EQUB &|
00002dd0  32 39 20 20 5c 20 4e 6f  76 65 6d 62 65 72 20 74  |29  \ November t|
00002de0  6f 20 46 65 62 72 75 61  72 79 0d 0c f8 22 2e 6f  |o February...".o|
00002df0  6c 64 5f 6f 73 77 6f 72  64 5f 76 65 63 74 6f 72  |ld_osword_vector|
00002e00  20 20 20 20 20 20 45 51  55 57 20 30 0d 0d 02 22  |      EQUW 0..."|
00002e10  2e 74 69 6d 65 5f 66 6c  61 67 20 20 20 20 20 20  |.time_flag      |
00002e20  20 20 20 20 20 20 20 20  45 51 55 42 20 30 0d 0d  |        EQUB 0..|
00002e30  0c 0c 2e 76 61 72 69 6f  75 73 0d 0d 16 32 20 20  |...various...2  |
00002e40  20 20 20 45 51 55 42 20  26 32 30 20 3a 20 45 51  |   EQUB &20 : EQ|
00002e50  55 42 20 26 35 30 20 3a  20 45 51 55 42 20 26 34  |UB &50 : EQUB &4|
00002e60  33 20 3a 20 45 51 55 42  20 26 35 36 0d 0d 20 32  |3 : EQUB &56.. 2|
00002e70  20 20 20 20 20 45 51 55  42 20 26 32 30 20 3a 20  |     EQUB &20 : |
00002e80  45 51 55 42 20 26 33 32  20 3a 20 45 51 55 42 20  |EQUB &32 : EQUB |
00002e90  26 33 36 20 3a 20 45 51  55 42 20 26 32 46 0d 0d  |&36 : EQUB &2F..|
00002ea0  2a 32 20 20 20 20 20 45  51 55 42 20 26 33 33 20  |*2     EQUB &33 |
00002eb0  3a 20 45 51 55 42 20 26  32 46 20 3a 20 45 51 55  |: EQUB &2F : EQU|
00002ec0  42 20 26 33 38 20 3a 20  45 51 55 42 20 26 33 38  |B &38 : EQUB &38|
00002ed0  0d 0d 34 05 5d 0d 0d 3e  05 20 0d 0d 48 05 ed 0d  |..4.]..>. ..H...|
00002ee0  0d 52 05 20 0d 0d 5c 30  f1 27 22 43 6f 64 65 20  |.R. ..\0.'"Code |
00002ef0  73 69 7a 65 20 69 73 20  22 3b 50 25 2d 63 6f 64  |size is ";P%-cod|
00002f00  65 3b 22 20 62 79 74 65  73 20 28 64 65 63 69 6d  |e;" bytes (decim|
00002f10  61 6c 29 22 0d 0d 66 2a  65 78 65 63 24 20 3d 20  |al)"..f*exec$ = |
00002f20  22 20 22 20 2b 20 c3 7e  28 26 46 46 46 46 30 30  |" " + .~(&FFFF00|
00002f30  30 30 20 2b 20 72 75 6e  5f 61 64 64 25 29 0d 0d  |00 + run_add%)..|
00002f40  70 48 ff 28 22 53 41 56  45 20 22 20 2b 20 66 69  |pH.("SAVE " + fi|
00002f50  6c 65 6e 61 6d 65 24 20  2b 20 22 20 22 20 2b 20  |lename$ + " " + |
00002f60  c3 7e 6d 65 6d 6f 72 79  20 2b 20 22 20 22 20 2b  |.~memory + " " +|
00002f70  20 c3 7e 4f 25 20 2b 20  65 78 65 63 24 20 2b 20  | .~O% + exec$ + |
00002f80  65 78 65 63 24 29 0d 0d  7a 41 f1 22 43 6f 64 65  |exec$)..zA."Code|
00002f90  20 73 61 76 65 64 20 61  73 20 27 22 3b 66 69 6c  | saved as '";fil|
00002fa0  65 6e 61 6d 65 24 3b 22  27 2c 22 27 22 20 20 74  |ename$;"',"'"  t|
00002fb0  6f 20 72 75 6e 20 66 72  6f 6d 20 26 22 3b c2 65  |o run from &";.e|
00002fc0  78 65 63 24 2c 38 29 0d  0d 84 05 20 0d 0d 8e 0a  |xec$,8).... ....|
00002fd0  2a 54 54 58 4f 4e 0d 0d  98 17 54 25 3d 91 3a f5  |*TTXON....T%=.:.|
00002fe0  20 fd 20 28 91 2d 54 25  29 3e 31 35 30 0d 0d a2  | . (.-T%)>150...|
00002ff0  05 20 0d 0d ac 0f ff 20  66 69 6c 65 6e 61 6d 65  |. ..... filename|
00003000  24 0d 0d b6 05 20 0d 0d  c0 0e de 20 62 6c 6f 63  |$.... ..... bloc|
00003010  6b 20 31 36 0d 0d ca 0a  41 25 3d 26 37 41 0d 0d  |k 16....A%=&7A..|
00003020  d4 12 58 25 3d 62 6c 6f  63 6b 20 83 20 32 35 36  |..X%=block . 256|
00003030  0d 0d de 12 59 25 3d 62  6c 6f 63 6b 20 81 20 32  |....Y%=block . 2|
00003040  35 36 0d 0d e8 0d 3f 62  6c 6f 63 6b 3d 32 32 0d  |56....?block=22.|
00003050  0d f2 0c d6 20 6f 73 77  6f 72 64 0d 0d fc 05 20  |.... osword.... |
00003060  0d 0e 06 45 e7 20 62 6c  6f 63 6b 3f 31 32 20 8c  |...E. block?12 .|
00003070  20 72 65 73 75 6c 74 24  3d 22 20 62 75 74 20 69  | result$=" but i|
00003080  74 20 69 73 20 62 61 64  21 22 20 8b 20 72 65 73  |t is bad!" . res|
00003090  75 6c 74 24 3d 22 20 61  6e 64 20 69 74 20 69 73  |ult$=" and it is|
000030a0  20 4f 4b 21 22 0d 0e 10  23 f1 27 22 44 61 74 65  | OK!"...#.'"Date|
000030b0  20 3d 20 22 3b 24 28 62  6c 6f 63 6b 2b 31 29 3b  | = ";$(block+1);|
000030c0  72 65 73 75 6c 74 24 27  0d ff                    |result$'..|
000030ca
04-04-88/B\PATCH.m0
04-04-88/B\PATCH.m1
04-04-88/B\PATCH.m2
04-04-88/B\PATCH.m4
04-04-88/B\PATCH.m5