annotate level1/cmds/mc09rtc.asm @ 3189:e9685c909630

mc09: Correct the description of the RTC part-number And add a reference to the instructions for wiring it up.
author Neal Crook <foofoobedoo@gmail.com>
date Sat, 20 May 2017 23:33:48 +0100
parents ef66bdab9b45
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3118
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
1 ********************************************************************
3189
e9685c909630 mc09: Correct the description of the RTC part-number
Neal Crook <foofoobedoo@gmail.com>
parents: 3118
diff changeset
2 * mc09rtc - read/write DS1302 RTC attached to multicomp09 GPIO
e9685c909630 mc09: Correct the description of the RTC part-number
Neal Crook <foofoobedoo@gmail.com>
parents: 3118
diff changeset
3 * Details of the hook-up can be inferred from the code or see the
e9685c909630 mc09: Correct the description of the RTC part-number
Neal Crook <foofoobedoo@gmail.com>
parents: 3118
diff changeset
4 * description here:
e9685c909630 mc09: Correct the description of the RTC part-number
Neal Crook <foofoobedoo@gmail.com>
parents: 3118
diff changeset
5 * https://github.com/nealcrook/multicomp6809/wiki/Adding-a-RTC
3118
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
6 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
7 * Rather than bloat the timer module (which is memory-resident)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
8 * this is a stand-alone utility that can either read the RTC and
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
9 * update the system time, or read the system time and update the
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
10 * RTC. It can be run from the startup file to set the time at boot.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
11 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
12 * usage:
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
13 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
14 * mc09rtc -r
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
15 * read RTC and update system time
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
16 * mc09rtc -w
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
17 * write RTC with current system time
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
18 * mc09rtc -d
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
19 * dump RTC clock and RAM contents
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
20 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
21 * This is for the 6809: it contains no 6309-specific code.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
22 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
23 * +-----------------+ <-- Y (highest address)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
24 * ! !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
25 * ! Parameter !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
26 * ! Area !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
27 * ! !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
28 * +-----------------+ <-- X, SP
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
29 * ! !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
30 * ! Data Area !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
31 * ! !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
32 * +- - - - - - - - -+
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
33 * ! Direct Page !
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
34 * +-----------------+ <-- U, DP (lowest address)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
35 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
36 * D = parameter area size
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
37 * PC = module entry point abs. address
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
38 * CC = F=0, I=0, others undefined
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
39 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
40 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
41 * Edt/Rev YYYY/MM/DD Modified by
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
42 * Comment
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
43 * ------------------------------------------------------------------
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
44 * 1 2015/11/07 Neal Crook
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
45 * Created.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
46 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
47 nam mc09rtc
3189
e9685c909630 mc09: Correct the description of the RTC part-number
Neal Crook <foofoobedoo@gmail.com>
parents: 3118
diff changeset
48 ttl Read/write DS1302 RTC, copy to/from system time
3118
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
49
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
50 use defsfile
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
51
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
52 tylg set Prgrm+Objct
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
53 atrv set ReEnt+rev
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
54 rev set $00
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
55 edition set 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
56
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
57 mod eom,name,tylg,atrv,start,size
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
58
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
59 * Bit-masks for GPIO bits connected to RTC
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
60 RTCCE EQU 4 bit 2
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
61 RTCCLK EQU 2 bit 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
62 RTCDAT EQU 1 bit 0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
63
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
64 org 0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
65 * buffer for NITROS9-format 6-byte "time packet"
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
66 sysbuf rmb 0 same as sysyear. [NAC HACK 2015Nov17] without "rmb 0" this becomes an offset in *code* space..
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
67 sysyear rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
68 sysmonth rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
69 sysdate rmb 1 documentation refers to this as "day"
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
70 syshour rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
71 sysmin rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
72 syssec rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
73
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
74 * buffer for RTC time registers (and, in -D, for RTC RAM)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
75 rtcbuf rmb 0 same as rtcsec. [NAC HACK 2015Nov17] without "rmb 0" this becomes an offset in *code* space..
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
76 rtcsec rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
77 rtcmin rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
78 rtchour rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
79 rtcdate rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
80 rtcmonth rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
81 rtcday rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
82 rtcyear rmb 1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
83 rtcprot rmb 1 have to read this as part of the burst
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
84 rtcxxx rmb 23 31 bytes total, to hold RTC RAM
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
85
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
86 txtbuf rmb 80 text output buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
87 rmb 200 stack
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
88 size equ .
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
89
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
90 name fcs /mc09rtc/
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
91 fcb edition
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
92
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
93 WrMsg fcc 'RTC updated from system time'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
94 WrMsgE
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
95 RdMsg fcc 'System time updated from RTC'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
96 RdMsgE
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
97
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
98 DMsg1 fcc 'Yr Mo Dt Hr Mi Se'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
99 fcb C$CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
100 DMsg2 fcc ' NitrOS9 binary "time packet"'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
101 fcb C$CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
102 DMsg3 fcc 'Se Mi Hr Dt Mo Dy Yr Pr'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
103 fcb C$CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
104 DMsg4 fcc ' DS1302 RTC BCD Date/protection'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
105 fcb C$CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
106 DMsg5 fcc ' trickle'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
107 fcb C$CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
108 DMsg6 fcc ' RAM'
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
109 DMsg7 fcb C$CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
110
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
111
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
112 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
113 * Start of program/Entry point
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
114 start pshs x preserve pointer to cmd line args
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
115
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
116 * Load time from RTC - for use by -R and -D options.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
117 lbsr initio
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
118 lda #$BF cmd for clock read burst
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
119 ldx #8 read 8 bytes
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
120 leay rtcbuf,u where to put it: the RTC buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
121 lbsr rd_n
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
122
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
123 * Load system time - for use by -W and -D options.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
124 leax sysbuf,u buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
125 os9 F$Time read system time into buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
126 bcs badexit something bad happened
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
127
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
128 * Now, what are we expected to do?
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
129 puls x
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
130 lda ,x+ first char of cmd-line arguments
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
131 * leading spaces stripped by shell
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
132 cmpa #$2D require "-" for -R -W -D
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
133 bne badexit not found so set carry and exit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
134 lda ,x+ character after "-"
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
135 anda #$df force to upper case
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
136 cmpa #'R
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
137 beq read
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
138 cmpa #'W
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
139 lbeq write
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
140 cmpa #'D
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
141 lbeq dump
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
142 badexit clrb exit code=0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
143 orcc #1 set C to indicate error
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
144 os9 F$Exit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
145
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
146 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
147 * "-R" - read from RTC and update system time.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
148 read
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
149 * Time from RTC has already been loaded in.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
150 * Convert it and move it from RTC buffer to system time buffer.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
151 lda <rtcsec 0-59
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
152 anda #$7f omit CH flag
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
153 bsr bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
154 sta <syssec
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
155
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
156 lda <rtcmin 0-59
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
157 bsr bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
158 sta <sysmin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
159
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
160 lda <rtchour 0-23
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
161 anda #$3f omit 12/24 flag
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
162 bsr bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
163 sta <syshour
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
164
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
165 lda <rtcdate 1-31
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
166 bsr bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
167 sta <sysdate
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
168
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
169 lda <rtcmonth 1-12
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
170 bsr bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
171 sta <sysmonth
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
172
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
173 lda <rtcyear 0-99
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
174 bsr bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
175 adda #100 nitros stores year as offset from 1900
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
176 sta <sysyear
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
177
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
178 leax sysbuf,u buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
179 os9 F$STime set system time from buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
180
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
181 * Report our action and exit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
182 leax >RdMsg,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
183 ldy #RdMsgE-RdMsg length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
184 lbra prexit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
185
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
186
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
187 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
188 bcd2bin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
189 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
190 * in A= value in BCD
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
191 * out A= value in binary
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
192 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
193 * eg: $10 in, $0A out
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
194 * CC modified, all other registers preserved.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
195 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
196 * algorithm: take tens digit, multiply by 8 and then by 2 and add
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
197 * those two values to the units.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
198 pshs b
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
199 tfr a,b
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
200 anda #$0f units in A
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
201 andb #$f0 tens in B
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
202 asrb tens move from *16 position to *8 position
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
203 pshs b }
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
204 adda ,s+ } add b (8/10ths of tens) to a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
205 asrb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
206 asrb tens * 2
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
207 pshs b }
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
208 adda ,s+ } units + 8/10ths + 2/10ths of tens
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
209 puls b,pc
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
210
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
211
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
212 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
213 bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
214 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
215 * in A= value in binary
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
216 * out A= value in BCD
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
217 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
218 * eg: $16 in, $24 out
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
219 * CC modified, all other registers preserved.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
220 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
221 * algorithm: do successive subtract of $0a and increment counter by
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
222 * $10 each time. When result is less than $0a, add in count value.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
223 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
224 pshs b
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
225 clrb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
226 bcdnxt cmpa #$0a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
227 blo bcddone branch if lower ie 0-9 remaining
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
228 addb #$10 bump up by bcd 10
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
229 suba #$0a as we subtract by binary 10
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
230 bra bcdnxt and go round again
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
231
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
232 bcddone pshs b } add b to a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
233 adda ,s+ }
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
234 puls b,pc
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
235
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
236
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
237 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
238 * "-W" - write system time to RTC.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
239 write
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
240 * System time has already been loaded in.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
241 * Convert it and move it from system time buffer to RTC buffer.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
242 lda <syssec 0-59 (I hope)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
243 bsr bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
244 sta <rtcsec CH bit is 0 so clock runs
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
245
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
246 lda <sysmin 0-59 (I hope)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
247 bsr bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
248 sta <rtcmin
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
249
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
250 lda <syshour 0-23 (I hope)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
251 anda #$3f select 24-hour clock
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
252 bsr bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
253 sta <rtchour
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
254
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
255 lda <sysdate 1-31 (I hope)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
256 bsr bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
257 sta <rtcdate
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
258
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
259 lda <sysmonth 1-12 (I hope)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
260 bsr bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
261 sta <rtcmonth
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
262
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
263 lda #1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
264 sta <rtcday 1-7. Not used but want it legal
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
265
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
266 lda <sysyear 100-199 (I hope)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
267 suba #100 [NAC HACK 2015Nov18] check first!! Error if last century.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
268 bsr bin2bcd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
269 sta <rtcyear
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
270
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
271 * Write buffer to RTC
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
272 lbsr initio
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
273 lda #$BE cmd for clock write burst
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
274 ldx #8 read 8 bytes
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
275 leay rtcbuf,u get it from the RTC buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
276 lbsr wr_n
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
277
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
278 * Report our action and exit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
279 leax >WrMsg,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
280 ldy #WrMsgE-WrMsg length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
281 lbra prexit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
282
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
283 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
284 * "-D" - dump RTC contents.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
285 dump
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
286 * system and RTC buffer are already loaded. Print them out then
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
287 * load and report in addition
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
288 * 1 byte from trickle-charge register, 31 bytes from RAM
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
289 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
290 * Yr Mo Dt Hr Mi Se
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
291 * xx xx xx xx xx xx NitrOS9 binary "time packet"
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
292 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
293 * Se Mi Hr Dt Mo Dy Yr Pr
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
294 * xx xx xx xx xx xx xx xx DS1302 RTC BCD Date/protection
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
295 * xx trickle
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
296 * xx xx xx xx xx xx xx xx RAM
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
297 * xx xx xx xx xx xx xx xx
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
298 * xx xx xx xx xx xx xx xx
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
299 * xx xx xx xx xx xx xx
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
300 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
301
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
302 leax >DMsg1,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
303 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
304 lbsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
305
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
306 * display content of system time packet buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
307 leay sysbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
308 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
309 lda #6 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
310 lbsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
311 ldy #18 2 digits + 1 space per
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
312 lbsr prbufa print txtbuf or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
313
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
314 leax >DMsg2,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
315 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
316 lbsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
317
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
318 leax >DMsg7,pcr point to message - extra CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
319 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
320 lbsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
321
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
322 leax >DMsg3,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
323 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
324 lbsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
325
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
326 * display content of RTC time buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
327 leay rtcbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
328 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
329 lda #8 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
330 lbsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
331 ldy #24 2 digits + 1 space per
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
332 lbsr prbufa print txtbuf or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
333
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
334 leax >DMsg4,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
335 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
336 lbsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
337
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
338 * read the 1-byte trickle register
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
339 leay rtcbuf,u where to store it
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
340 lda #$91
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
341 lbsr putcmd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
342 lbsr getbyte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
343 sta ,y+
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
344 lbsr endtrans
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
345
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
346 * display 1 byte from RTC time buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
347 leay rtcbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
348 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
349 lda #1 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
350 lbsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
351 ldy #3 2 digits + 1 space per
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
352 lbsr prbufa print txtbuf or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
353
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
354 leax >DMsg5,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
355 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
356 bsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
357
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
358 * read RAM
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
359 leay rtcbuf,u where to store it
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
360 lda #$FF RAM read burst
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
361 ldx #31 read 31 bytes
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
362 leay rtcbuf,u where to put it: the RTC buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
363 lbsr rd_n
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
364
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
365 * display 1st 8 bytes of RTC RAM from RTC time buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
366 leay rtcbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
367 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
368 lda #8 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
369 bsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
370 ldy #24 2 digits + 1 space per
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
371 bsr prbufa print txtbuf or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
372
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
373 leax >DMsg6,pcr point to message
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
374 ldy #80 max length
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
375 bsr prbufb print from x or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
376
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
377 * display 2nd 8 bytes of RTC RAM from RTC time buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
378 leay 8+rtcbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
379 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
380 lda #8 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
381 bsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
382 lda #C$CR add CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
383 sta ,x+
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
384 ldy #25 2 digits + 1 space per + CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
385 bsr prbufa print txtbuf or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
386
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
387 * display 3rd 8 bytes of RTC RAM from RTC time buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
388 leay 16+rtcbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
389 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
390 lda #8 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
391 bsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
392 lda #C$CR add CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
393 sta ,x+
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
394 ldy #25 2 digits + 1 space per + CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
395 bsr prbufa print txtbuf or die in the attempt
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
396
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
397 * display 4th 7 bytes of RTC RAM from RTC time buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
398 leay 24+rtcbuf,u data to display
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
399 leax >txtbuf,pcr buffer to store ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
400 lda #7 bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
401 bsr hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
402 lda #C$CR add CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
403 sta ,x+
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
404 ldy #22 2 digits + 1 space per + CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
405 leax >txtbuf,pcr where to display from
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
406 prexit bsr prbufb go display it
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
407 clrb success
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
408 os9 F$Exit and exit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
409
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
410
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
411 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
412 prbufa leax >txtbuf,pcr where to display from
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
413 prbufb lda #1 standard out
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
414 os9 I$Writln print it up to CR
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
415 bcs prbad
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
416 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
417 prbad os9 F$Exit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
418
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
419
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
420 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
421 hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
422 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
423 * in: Y binary data to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
424 * X buffer to build ASCII version
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
425 * A number of bytes to convert
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
426 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
427 * out: Y, X updated
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
428 * A,B,CC modified
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
429 ldb ,y+ get byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
430 bsr Byte2Hex store ASCII version in buffer
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
431 ldb #C$SPAC
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
432 stb ,x+ add trailing space
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
433 deca
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
434 bne hex2buf
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
435 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
436
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
437 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
438 * Convert byte in B to Hex string at X (from debug.asm)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
439 * B,X,CC altered.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
440 Byte2Hex pshs b save copy of B on stack
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
441 andb #$F0 mask upper nibble
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
442 lsrb and bring to lower nibble
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
443 lsrb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
444 lsrb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
445 lsrb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
446 bsr Nibl2Hex convert byte in B to ASCII
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
447 puls b get saved B
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
448 andb #$0F do lower nibble
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
449 * Convert lower nibble in B to Hex character at X
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
450 Nibl2Hex cmpb #$09 9?
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
451 bls n@ branch if lower/same
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
452 addb #$07 else add 7
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
453 n@ addb #'0 and ASCII 0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
454 stb ,x+ save B
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
455 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
456
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
457
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
458 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
459 rd_n
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
460 * Read from a sequence of RTC locations
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
461 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
462 * X = number of bytes to read
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
463 * Y = where to store the read data
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
464 * A = command byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
465 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
466 * Assumes IO has been initialised.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
467 pshs x modified value is held on stack
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
468
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
469 lbsr putcmd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
470
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
471 rd_nxt lbsr getbyte read byte into A
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
472 sta ,y+ store data byte read
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
473 puls x recover count value
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
474 leax -1,x update count
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
475 pshs x stash count value
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
476 bne rd_nxt go do next byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
477 bsr endtrans tidy up at end
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
478
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
479 puls x,pc tidy up the stack and return
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
480
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
481
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
482 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
483 wr_n
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
484 * Write to a sequence of RTC locations
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
485 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
486 * X = number of bytes to write
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
487 * Y = where to get the write data from
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
488 * A = command byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
489 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
490 * Assumes IO has been initialised.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
491 * Clears write protect first, sets it at end.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
492 pshs x modified value is held on stack
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
493 pshs a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
494
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
495 * clear the write-protect bit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
496 lda #$8e
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
497 lbsr putcmd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
498 clra
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
499 lbsr putbyte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
500 bsr endtrans
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
501
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
502 puls a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
503 lbsr putcmd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
504
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
505 wr_nxt lda ,y+ get byte to write
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
506 lbsr putbyte write it
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
507 puls x recover count value
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
508 leax -1,x update count
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
509 pshs x stash count value
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
510 bne wr_nxt go do next byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
511 bsr endtrans tidy up at end
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
512
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
513 * set the write-protect bit
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
514 lda #$8e
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
515 bsr putcmd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
516 lda #$80
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
517 bsr putbyte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
518 bsr endtrans
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
519
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
520 puls x,pc tidy up the stack and return
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
521
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
522
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
523 ********************************************************************
3189
e9685c909630 mc09: Correct the description of the RTC part-number
Neal Crook <foofoobedoo@gmail.com>
parents: 3118
diff changeset
524 * Low-level DS1302 read/write. Broken into the following parts:
3118
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
525 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
526 * initio - GPIO init
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
527 * putcmd - write 1st (cmd) byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
528 * putbyte - write 1 data byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
529 * getbyte - read 1 data byte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
530 * endtrans - end read or write transaction
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
531 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
532 * Leave CE and CLK permanently outputs.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
533 * Leave DAT as input by default, make it an output when it needs
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
534 * to be but always end a routine with it set to an input. It is OK
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
535 * to float DAT because the DS1302 provides an internal pulldown.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
536 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
537 * designed to be used thus:
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
538 * initio (one-time)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
539 * putcmd putbyte [putbyte..] endtrans
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
540 * putcmd getbyte [getbyte..] endtrans
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
541 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
542 * Reads from and writes to clock registers *must* be done as
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
543 * bursts to take advantage of the internal buffering. Without this,
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
544 * it would be necessary to check for carries that occurred between
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
545 * accessing one location and the next.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
546
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
547
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
548 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
549 initio
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
550 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
551 * only need to call this once.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
552 * in: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
553 * out: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
554 * modifies: A B CC, gpio state.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
555 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
556 clrb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
557 lda #GPDAT0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
558 sta GPIOADR select dat0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
559 stb GPIODAT set values to 0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
560 lda #GPDDR1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
561 sta GPIOADR select ddr1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
562 incb
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
563 stb GPIODAT CE out, CLK out, DAT in.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
564 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
565
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
566
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
567 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
568 endtrans
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
569 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
570 * take CE back low and wait recovery time.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
571 * in: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
572 * out: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
573 * modifies: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
574 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
575 * v-------------- send pattern ---------------------V
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
576 * CE H LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL L
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
577 * CLK L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL L
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
578 * DAT z zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz z
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
579 * ^-assumed on entry xsition(if any) on exit-^
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
580 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
581 * -------------------------------------------------->
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
582 * wait 4us in this state to meet recovery time
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
583 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
584 pshs a,cc
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
585 lda #GPDAT0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
586 sta GPIOADR select dat0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
587 clr GPIODAT falling edge on CE, keep CLK=0.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
588
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
589 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
590 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
591 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
592 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
593 puls a,cc,pc
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
594
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
595
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
596 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
597 putcmd
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
598 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
599 * in: A=command byte to send
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
600 * out: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
601 * modifies: A B CC X
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
602 * enter with CE=0 CLK=0 DAT=0.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
603 * exit with CE=1 and TODO timing met
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
604 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
605 * v-------------- send pattern ---------------------V
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
606 * CE L HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH H
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
607 * CLK L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL L
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
608 * DAT z zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz z
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
609 * ^-assumed on entry xsition(if any) on exit-^
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
610 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
611 * -------------------------------------------------->
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
612 * 3us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
613 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
614 * v-------------- send pattern ---------------------V
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
615 * CE H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH H
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
616 * CLK L LLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHHHH L
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
617 * DAT z 000000111111222222333333444444555555666666777777zzz z
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
618 * ^-assumed on entry xsition(if any) on exit-^
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
619 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
620 * <-> 1us high and low time on CLK
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
621 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
622 pshs a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
623 lda #GPDAT0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
624 sta GPIOADR select dat0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
625 lda #RTCCE assert CE
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
626 sta GPIODAT
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
627
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
628 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
629 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
630 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
631
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
632 puls a
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
633 bra putbyte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
634
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
635
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
636 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
637 putbyte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
638 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
639 * in: A=data byte to send
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
640 * out: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
641 * modifies: A B CC X
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
642 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
643 * v-------------- send pattern ---------------------V
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
644 * CE H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH H
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
645 * CLK L LLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHHHH L
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
646 * DAT z 000000111111222222333333444444555555666666777777zzz z
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
647 * ^-assumed on entry xsition(if any) on exit-^
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
648 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
649 * <-> 1us high and low time on CLK
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
650 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
651 ldb #GPDDR1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
652 stb GPIOADR select ddr1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
653 clr GPIODAT CE out, CLK out, DAT out.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
654
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
655 ldb #GPDAT0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
656 stb GPIOADR select dat0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
657
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
658 ldx #8 number of bits to send
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
659 pblop
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
660 tfr a,b
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
661 andb #$1 keep LSB
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
662 orb #RTCCE LSB with CLK=0, CE=1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
663 stb GPIODAT send out data bit with CLK=0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
664 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
665 eorb #RTCCLK set CLK=1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
666 stb GPIODAT send out data bit with CLK=1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
667 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
668 rora put next bit in LSB position
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
669 leax -1,x
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
670 bne pblop more bits?
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
671
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
672 ldb #GPDDR1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
673 stb GPIOADR select ddr1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
674 ldb #1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
675 stb GPIODAT DAT to input ie z.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
676 bsr wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
677
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
678 lda #GPDAT0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
679 sta GPIOADR select dat0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
680 lda #RTCCE
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
681 sta GPIODAT falling edge on CLK, keep CE=1.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
682
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
683 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
684
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
685
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
686 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
687 getbyte
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
688 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
689 * in: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
690 * out: A=data byte read
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
691 * modifies: A B CC X
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
692 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
693 * v-------------- send pattern ------------------V
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
694 * CE H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH H
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
695 * CLK L LLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHHLLLHHH L
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
696 * DAT z 000000111111222222333333444444555555666666777777 0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
697 * ^-assumed on entry xsition(if any) on exit-^
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
698 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
699 * at entry falling edge has already occurred that will yield
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
700 * the first data bit.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
701 * at exit falling edge has already occurred that will yield
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
702 * the first data bit of the next byte. It's no problem if
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
703 * no "next byte" is needed; taking CE high will stop everything
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
704 * politely.
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
705 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
706 ldb #GPDAT0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
707 stb GPIOADR select dat0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
708
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
709 ldx #8 number of bits to receive
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
710 gblop
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
711 bsr wait1us wait with clock low
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
712 ldb #RTCCE|RTCCLK
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
713 stb GPIODAT set CLK=1
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
714 ldb GPIODAT get DAT in LSB
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
715 * first incoming bit is bit 0 and will rotate
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
716 * all the way down to LSB of A
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
717 rorb rotate bit from B into C
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
718 rora rotate bit from C into A
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
719 bsr wait1us wait with clock high
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
720 ldb #RTCCE
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
721 stb GPIODAT set CLK=0
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
722
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
723 leax -1,x
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
724 bne gblop more bits?
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
725 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
726
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
727
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
728 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
729 wait1us
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
730 *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
731 * wait for 1us (includes call/return time)
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
732 * in: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
733 * out: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
734 * modifies: none
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
735 nop [NAC HACK 2015Nov13] tune..
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
736 nop
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
737 nop
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
738 nop
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
739 nop
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
740 rts
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
741
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
742
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
743 ********************************************************************
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
744 * all done here folks
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
745 emod
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
746 eom equ *
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
747 end
ef66bdab9b45 mc09: Add mc09rtc command and GPIO registers defs in mc09.d
Neal Crook <foofoobedoo@gmail.com>
parents:
diff changeset
748