-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcomms_unit.asm
177 lines (162 loc) · 2.47 KB
/
comms_unit.asm
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
.comment
This file is part of PadSwitcher64.
PadSwitcher64 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PadSwitcher64 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PadSwitcher64. If not, see <https://www.gnu.org/licenses/>.
Communications portion of the PadSwitcher64 interface application
To be assemebled without load address header and converted to BASIC DATA statements
...
Because the PadSwitcher64 software is written in compiled BASIC and I'm too lazy to
re-write the entire thing in assembly...
Written for 64tass.
.endc
OP=56320
IP=56321
* = $c000
input .fill 1
result .fill 1
jmp communicate
handshake
sei
lda #239
sta 56322
lda #0
sta 56323
lda #240
sta OP
handshakeloop
lda OP
and #16
bne notfire
sta result
cli
rts
notfire
lda IP
and #31
bne handshakeloop
jsr nopalicious
lda #255
sta 56322
lda #1
sta OP
ldx #255
ldy #255
hs1
lda IP
and #31
bne ontohs2
dex
bne hs1
dex
dey
bne hs1
lda #128
sta result
cli
lda #1
sta 53280
rts
ontohs2
jsr nopalicious
lda #4
sta op
ldx #255
ldy #255
hs2
lda IP
and #31
beq hs3
dex
bne hs2
dex
dey
bne hs2
lda #128
sta result
cli
lda #2
sta 53280
rts
hs3
lda #0
sta 53280
jsr nopalicious
sta op
lda #1
sta result
cli
rts
communicate
sei
jsr nopalicious
lda input
sta op
ldx #255
ldy #255
commloop
lda IP
;and #31
sta result
and #16
beq commdone
dex
bne commloop
dex
dey
bne commloop
lda #128
sta result
cli
lda #3
sta 53280
rts
commdone
lda result
eor #255
and #15
sta result
;jsr nopalicious
ldx #255
mininop
dex
bne mininop
lda #0
sta op
ldx #255
ldy #255
ackloop
lda IP
and #16
bne ackdone
dex
bne ackloop
dex
dey
bne ackloop
lda #128
sta result
lda #4
sta 53280
cli
rts
ackdone
cli
rts
nopalicious
ldx #255
ldy #5
noploop
dex
bne noploop
dex
dey
bne noploop
rts