-
Notifications
You must be signed in to change notification settings - Fork 0
/
scc.s
142 lines (107 loc) · 1.16 KB
/
scc.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
lst off
exp off
*
* read slot 7 ssc card.
*
*
cmdb equ $c038
cmda equ $c039
datab equ $c03a
dataa equ $c03b
cout equ $fded
read mac
ldx #]1
if 3=]1
stx cmda
lda cmda
else
stx cmdb
lda cmdb
fin
sta buffer,x
<<<
lst on
org $0800
mx %11
db $01 ; prodos boot id
boot
* clc
* xce
* cli
sei
ldx #24
lda #$80+$0d
:cs jsr cout
dex
bpl :cs
SSC equ $c088+$70
init
* command register - DTR+, IRQ-, TX IRQ-, ECHO-, PARITY-
lda #%0000_1011
sta SSC+2
*control - 9600, BRG, /1
lda #%0_00_1_1110
sta SSC+3
* read 4 registers
loop
; status first
lda SSC+1
sta buffer+1
lda SSC+0
sta buffer+0
lda SSC+2
sta buffer+2
lda SSC+3
sta buffer+3
ldx #3
:cmp lda buffer,x
cmp prev,x
bne :delta
dex
bpl :cmp
bra wailoop
:delta
ldx #0
:print
lda buffer,x
phx
pha
lsr
lsr
lsr
lsr
tax
lda hex,x
jsr cout
pla
and #$0f
tax
lda hex,x
jsr cout
lda #" "
jsr cout
plx
inx
cpx #4
bcc :print
lda #$80+$0d
jsr cout
* store prev. values.
ldx #3
:copy lda buffer,x
sta prev,x
dex
bpl :copy
wailoop
* wai
brl loop
nop
nop
stp
hex asc "0123456789abcdef"
buffer ds 16
prev ds 16
lst off
* ds \
ds 1024+$0800-*
sav scc.bin