NEW
  AUTO 3,1
* object code = cclock_0
* Cortland clock driver
* $2F80-$2FFC moved to $D742

ofsC	.EQ	cclock_0-tclk_in	offset to Cortland clock org

cclock_0 SHORT I,M			8 bit mode.
         lda   statereg                 state register.
         sta   savestate		save for restore after tool call.
         and   #$CF                     clear the read/write aux memory bits.
         sta   statereg                 make it real
         clc                            set e = 0 to set native mode
         xce		
         LONG  I,M                      16 bit mode.
         lda   #$0000                   zero out result space.
         pha                            push 4 words for hex time result
         pha
         pha
         pha
         _ReadTimeHex
         SHORT M			back to 8 bit to get results from stack
         lda   savestate		restore state register
         sta   statereg
         pla				pull off seconds and ignore
         pla
         sta   p8time                   minutes
         pla
         sta   p8time+1                 hours
         pla                            year
H2FB1    cmp   #100			out of range?
         bcc   H2FB9                    no, go ahead and store
         sbc   #$64                     else put back in range.
         bra   H2FB1                    try again
H2FB9    sta   p8date+1                 year
         pla
         inc   a                        increment day for Prodos 8 format.
         sta   p8date                   day
         pla                            month
         inc   a                        increment month for Prodos 8 format.
         asl   a                        shift month as it sits in between
         asl   a                        the year and day values.
         asl   a
         asl   a
         asl   a
         ora   p8date			put all but the top bit of month
         sta   p8date                   value in the day byte.
         rol   p8date+1                 put hi bit of month in low bit of year
         pla                            pull of unused byte
         pla                            pull off day of week. stack now clean.
         sec                            go back to emulation mode
         xce                            to continue with Prodos 8
         rts
savestate .EQ	*-ofsC
                .DA #00'			state of the state register
         dc    c'JIMJAYKERRY'
	dc	h'26'			ampersand (Orca assembler doesn't like)
	dc	c'MIKE'
                .DA #0000000000000000'	pad 0's until length
                .DA #0000000000000000'      of driver = 125 bytes.
                .DA #000000000000'
cclk_end .EQ	*			end of obj cclock_0.
	dc	h'000000'		pad to page boundary
	LONGI	OFF
*--------------------------------------
MAN
LOAD USR/SRC/PRODOS.203/PRODOS.S.CCLK
SAVE USR/SRC/PRODOS.203/PRODOS.S
ASM

