mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
108 lines
4.1 KiB
Plaintext
108 lines
4.1 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
* object code = tclock_0
|
||
* Thunderclock driver
|
||
* hard coded for slot 1
|
||
|
||
* $2F00-2F7C moved to $D742
|
||
|
||
ofsT .EQ tclock_0-tclk_in offset to Thunderclock org
|
||
|
||
tclock_0 ldx clkslt clock slot = $C1.
|
||
lda clkmode,x save current mode
|
||
pha
|
||
lda #$A3 send numeric mode byte to Thunderclock
|
||
jsr wttcp
|
||
clkslt .EQ *-ofsT+2 points to $C1.
|
||
jsr rdtcp read month, day of week, day of month
|
||
clc and time into input buffer.
|
||
ldx #$04 index for 5 values.
|
||
ldy #$0C read minutes 1st, month last.
|
||
H2F14 lda inbuf,y convert values to binary.
|
||
and #$07 no value > 5 decimal.
|
||
sta pcl 'tens' place value
|
||
asl a multiply by 10
|
||
asl a
|
||
adc pcl
|
||
asl a
|
||
adc inbuf+1,y add to ascii 'ones' place
|
||
sec and subtract out the ascii
|
||
sbc #$B0
|
||
sta pcl,x save converted value.
|
||
dey index to next lowest value
|
||
dey
|
||
dey
|
||
dex are there more values?
|
||
bpl H2F14 if yes.
|
||
tay contains month
|
||
lsr a
|
||
ror a
|
||
ror a
|
||
ror a high bit of month held in carry
|
||
ora A1L
|
||
sta p8date save low value of date.
|
||
php save high bit of month.
|
||
and #$1F isolate day.
|
||
adc tdays-1,y (y = month)
|
||
bcc H2F42 branch if not Sept 13 thru 30th
|
||
adc #$03 adj for mod 7 when day > 256
|
||
H2F42 sec
|
||
H2F43 sbc #$07
|
||
bcs H2F43 loop until < 0.
|
||
adc #$07 make it in the range of 0-6.
|
||
sbc pch the delta provides years offset.
|
||
bcs H2F4F branch if positive
|
||
adc #$07 else make it positive again.
|
||
H2F4F tay
|
||
lda yradj,y look up year
|
||
plp and combine it with hi bit of month
|
||
rol a
|
||
sta p8date+1 P8 date
|
||
lda A1L+1 hour
|
||
sta p8time+1 P8 time
|
||
lda A2L minute
|
||
sta p8time
|
||
pla restore previous mode.
|
||
ldx clkslt clock slot = $C1
|
||
sta clkmode,x
|
||
H2F69 rts
|
||
|
||
* this table contains entries for the cumulative # of days in a year,
|
||
* one entry for each month. the values are modulo 256.
|
||
|
||
tdays .EQ *-ofsT
|
||
dc h'00' January
|
||
dc h'1F' February
|
||
dc h'3B' March
|
||
dc h'5A' April
|
||
dc h'78' May
|
||
dc h'97' June
|
||
dc h'B5' July
|
||
dc h'D3' August
|
||
dc h'F2' September
|
||
dc h'14' October (MOD 256)
|
||
dc h'33' November
|
||
dc h'51' December
|
||
|
||
* the following table is used to look up the current year, based on
|
||
* the current month, day and day of week. The 1st entry corresponds
|
||
* to the year in which January 1st falls on a Monday. The 2nd entry
|
||
* is the year which January 1st is Sunday, and so on backwards thru
|
||
* the days of the week.
|
||
|
||
yradj .EQ *-ofsT
|
||
dc h'60' Monday
|
||
dc h'5F' Sunday
|
||
dc h'5E' Saturday
|
||
dc h'5D' Friday
|
||
dc h'62' Thursday
|
||
dc h'61' Wednesday
|
||
dc h'60' Tuesday
|
||
tclk_end .EQ * end of obj tclock_0.
|
||
dc h'000000' pad
|
||
*--------------------------------------
|
||
MAN
|
||
LOAD USR/SRC/PRODOS/PRODOS.S.TCLK
|
||
SAVE USR/SRC/PRODOS/PRODOS.S
|
||
ASM
|