A2osX/ProDOS.203/ProDOS.S.TCLK.txt

108 lines
2.9 KiB
Plaintext
Raw Normal View History

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