This repository has been archived by the owner on Apr 27, 2018. It is now read-only.
/
avrianjump.html
304 lines (277 loc) · 8.23 KB
/
avrianjump.html
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<html manifest="avrianjump.manifest">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="avrianjump.png" />
<!-- <link rel="apple-touch-startup-image" href="/startup.png"> -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<script type="text/javascript" language="JavaScript" src="jquery-1.7.1.js"></script>
<script type="text/javascript" language="JavaScript" src="avrianjump.js"></script>
<script type="text/javascript" language="JavaScript" src="assemble/avrasm.js"></script>
<script type="text/javascript" language="JavaScript" src="assemble/asmToAudio.js"></script>
<script type="text/javascript" language="JavaScript" src="assemble/asmToBlinkit.js"></script>
<style>
.ladder, .tools {
}
.tools table {
padding-top: 1em;
width: 100%;
}
.tools table tr td:nth-child(even) {
text-align: right;
}
.rung {
border: solid thin black;
padding: 2px;
}
.rung a:nth-child(2) {
float: right;
}
.button {
}
.button2 {
padding: 2px;
border: solid thin black;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.test {
text-align: left;
display: inline-block;
}
.action {
text-align: right;
}
.action a {
margin-left: 0.75em;
}
textarea#rawViewPort {
width: 100%;
height: 10em;
margin-bottom: 0.5em;
}
#rungtemplate {
visibility: hidden;
display: none;
}
#ASMHeader {
visibility: hidden;
display: none;
}
</style>
<title>Avrian Jump</title>
</head>
<body>
<div class="ladder">
</div>
<div class="tools">
<table><tr><td>
<a class="button" onclick="javascript:addRung()">⊕</a>
</td><td>
<a class="button button2" onclick="javascript:rawViewOpen()">ASCII</a>
<a class="button button2" onclick="javascript:toASM()">ASM</a>
<a class="button button2" onclick="javascript:toSrecord()">S19</a>
<a class="button button2" onclick="javascript:toBlinkit()">BLINK</a>
<a class="button button2" onclick="javascript:toAudioino()">➜</a>
</td></tr></table>
</div>
<div class="rawView">
<textarea id="rawViewPort"></textarea><br />
<a class="button button2" onclick="javascript:rawViewClose()">close</a>
<a class="button button2" onclick="javascript:rawViewLoad()">load</a>
</div>
<div id="rungtemplate">
<div class="rung">
<a class="button">⊗</a>
<a class="button">⊕</a>
</div>
<div class="test">
if <select name="inputs">
<!-- True; always do this rung. -->
<option show="none">T</option>
<!-- digital pins -->
<option show="digital">D0</option>
<option show="digital">D1</option>
<option show="digital">D3</option>
<option show="digital">D4</option>
<option show="digital">D5</option>
<option show="digital">D6</option>
<option show="digital">D7</option>
<option show="digital">D8</option>
<option show="digital">D9</option>
<option show="digital">D10</option>
<option show="digital">D11</option>
<option show="digital">D12</option>
<option show="digital">D13</option>
<!-- analog pins -->
<option show="analog">A0</option>
<option show="analog">A1</option>
<option show="analog">A2</option>
<option show="analog">A3</option>
<option show="analog">A4</option>
<option show="analog">A5</option>
<option show="analog">A6</option>
<option show="analog">A7</option>
<!-- Variables -->
<option show="analog">A</option>
<option show="analog">B</option>
<option show="analog">C</option>
<option show="analog">D</option>
<option show="analog">E</option>
</select>
<select name="test">
<option is="digital">=1</option>
<option is="digital">=0</option>
<option is="analog">=</option>
<option is="analog"><</option>
<option is="analog">></option>
<option is="analog">!</option>
</select>
<input type="text" size=6 />
</div>
<div class="action">
<select name="outputs">
<!-- digital pins -->
<option show="digital">D0</option>
<option show="digital">D1</option>
<option show="digital">D3</option>
<option show="digital">D4</option>
<option show="digital">D5</option>
<option show="digital">D6</option>
<option show="digital">D7</option>
<option show="digital">D8</option>
<option show="digital">D9</option>
<option show="digital">D10</option>
<option show="digital">D11</option>
<option show="digital">D12</option>
<option show="digital">D13</option>
<!-- PWM pins -->
<option show="analog">P3</option>
<option show="analog">P5</option>
<option show="analog">P6</option>
<option show="analog">P9</option>
<option show="analog">P10</option>
<option show="analog">P11</option>
<!-- Variables -->
<option show="analog">A</option>
<option show="analog">B</option>
<option show="analog">C</option>
<option show="analog">D</option>
<option show="analog">E</option>
</select>
<select name="act">
<option is="digital">=1</option>
<option is="digital">=0</option>
<option is="analog">=</option>
<option is="analog">+=</option>
<option is="analog">-=</option>
</select>
<input type="text" size=6 />
<a class="button">⊗</a>
</div>
</div>
<div id="blinkittest" style="width: 20px; height: 20px"></div>
<!-- The default assmebly that every program needs. -->
<pre id="ASMHeader">
; Replace common IO register names with numbers for a ATmega168
_replace PINB, 0x03
_replace DDRB, 0x04
_replace PORTB, 0x05
_replace PINC, 0x06
_replace DDRC, 0x07
_replace PORTC, 0x08
_replace PIND, 0x09
_replace DDRD, 0x0a
_replace PORTD, 0x0b
_replace ADCL, 0x78
_replace ADCH, 0x79
_replace ADCSRA, 0x7a
_replace ADCSRB, 0x7b
_replace ADMUX, 0x7c
_replace DIDR0, 0x7e
_replace SPH, 0x3e
_replace SPL, 0x3d
_replace RAMEND_HI, 0x04
_replace RAMEND_LO, 0xff
; Rest and Interrupt table for ATmega168
_loc 0
jmp RESET ; Reset Handler
jmp IgnoreINT ; IRQ0 Handler
jmp IgnoreINT ; IRQ1 Handler
jmp IgnoreINT ; PCINT0 Handler
jmp IgnoreINT ; PCINT1 Handler
jmp IgnoreINT ; PCINT2 Handler
jmp IgnoreINT ; Watchdog Timer
jmp IgnoreINT ; Timer2 Compare
jmp IgnoreINT ; Timer2 Compare
jmp IgnoreINT ; Timer2 Overflow Handler
jmp IgnoreINT ; Timer1 Capture Handler
jmp IgnoreINT ; Timer1 Compare A Handler
jmp IgnoreINT ; Timer1 Compare B Handler
jmp IgnoreINT ; Timer1 Overflow Handler
jmp IgnoreINT ; Timer0 Compare A Handler
jmp IgnoreINT ; Timer0 Compare B Handler
jmp IgnoreINT ; Timer0 Overflow Handler
jmp IgnoreINT ; SPI Transfer Complete Handler
jmp IgnoreINT ; USART, RX Complete Handler
jmp IgnoreINT ; USART, UDR Empty Handler
jmp IgnoreINT ; USART, TX Complete Handler
jmp IgnoreINT ; ADC Conversion Complete Handler
jmp IgnoreINT ; EEPROM Ready Handler
jmp IgnoreINT ; Analog Comparator Handler
jmp IgnoreINT ; 2-wire Serial Interface Handler
jmp IgnoreINT ; Store Program Memory Ready Handler
IgnoreINT: reti
RESET: ldi r16, RAMEND_HI ; Main program start
out SPH, r16 ;Set Stack Pointer to top of RAM
ldi r16, RAMEND_LO
out SPL, r16
cli ; No interrupts
ldi r16, 0x7e ; Turn off digital inputs on analog pins.
sts DIDR0, r16
clr r0 ; 'A' All vars initialize to 0
clr r1
clr r2 ; 'B'
clr r3
clr r4 ; 'C'
clr r5
clr r6 ; 'D'
clr r7
clr r8 ; 'E'
clr r9
jmp LADDER ; Start climbing the ladder.
; Read the ADC for a pin.
; Desired source is in R16
getAnalog:
; Setup ADC
andi r16, 7 ; Which input to sample
; Use Internal reference, right aligned
ori r16, 0xc0
sts ADMUX, r16
ldi r16, 0xc7 ; ADC Enable, ADC Start, No interrupt, /128
sts ADCSRA, r16
; wait...
getAnalog_waitforit:
lds r16, ADCSRA
sbrs r16, 4 ; If complete, stop waiting.
rjmp getAnalog_waitforit
; Put result into r16:17
lds r16, ADCL
lds r17, ADCH
ret
; Set the PWM output on a pin.
; R16:R17 is the value
; R18 is which output
setPWM:
; TODO how to do this?
ret
</pre>
</body>
</html>
<!--
#Blink LED on D0
:T;A+=1
:A=45;D0=1
:A=90;D0=0,A=0
-->