forked from antonizoon/arakulas-soarers-converter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoarer_at2usb_v1.12_atmega32u4.asm
7547 lines (7242 loc) · 195 KB
/
Soarer_at2usb_v1.12_atmega32u4.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
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.NOLIST
.INCLUDE "m32U4def.inc" ;Definitions for ATmega32U4
.LIST
.org 0x0000
.def __zero_reg__ = R1
;=================================================
; .data segment (length 0x20)
;=================================================
.equ keyboard_codeset = 0x0100 ;static uint8_t keyboard_codeset = 4;
.equ kbd_pauseseq = 0x0101 ;static uint8_t kbd_pauseseq[8] = { 0xe1, 0x14, 0x77, 0xe1, 0xf0, 0x14, 0xf0, 0x77 };
.equ aux_key_timercounter = 0x0109 ;uint8_t aux_key_timercounter = 10;
.equ read_pcxt_nextstate = 0x010a ;static int8_t read_pcxt_nextstate = -2;
.equ read_pcxt_state = 0x010b ;static int8_t read_pcxt_state = 1;
.equ atps2_write_parity = 0x010c ;static uint8_t atps2_write_parity = 1;
.equ atps2_write_t1state = 0x010d ;static int8_t atps2_write_t1state = -1;
.equ atps2_write_state = 0x010e ;static int8_t atps2_write_state = -1;
.equ read_atps2_parity = 0x010f ;static int8_t read_atps2_parity = 1;
.equ read_atps2_state = 0x0110 ;static int8_t read_atps2_state = -1;
.equ __malloc_heap_end = 0x0115 ;static uint16_t __malloc_heap_end = &__heap_end;
.equ __brkval = 0x0117 ;static uint16_t __brkval = &__heap_start;
.equ keyboard_protocol = 0x0119 ;static uint8_t keyboard_protocol = 1;
.equ keyboard_idle_config = 0x011a ;static uint8_t keyboard_idle_config[3] = { 125, 125, 125 };
;.equ keyboard_idle_config+1 = 0x011b
;.equ keyboard_idle_config+2 = 0x011c
.equ boot_idle_config = 0x011d ;static uint8_t boot_idle_config=125;
.equ cur_select_set = 0x011e ;uint8_t cur_select_set = 1; // current select set
.equ req_select_set = 0x011f ;uint8_t req_select_set = 1; // requested select set
;=================================================
; BSS Data:
;=================================================
.equ keyboard_id = 0x0120 ;uint16_t keyboard_id = 0;
;.equ keyboard_id+1 = 0x0121
.equ kbd_breakcode = 0x0122 ;uint8_t kbd_breakcode = 0;
.equ kbd_extended_scancode = 0x0123 ; uint8_t kbd_extended_scancode = 0;
.equ kbd_extended2_scancode = 0x0124 ; uint8_t kbd_extended2_scancode = 0;
.equ prot_led_state = 0x0125 ;uint8_t prot_led_state = 0;
.equ old_aux_key_bits = 0x0126 ;uint8_t old_aux_key_bits = 0;
.equ aux_key_bits = 0x0127 ;uint8_t aux_key_bits = 0;
.equ tmr_aux_key_bits = 0x0128 ;uint8_t tmr_aux_key_bits = 0;
.equ keyboard_mode = 0x0129 ;uint8_t keyboard_mode = 0;
.equ kbd_rcvd_byte = 0x012a ;uint8_t volatile kbd_rcvd_byte = 0;
.equ kbd_rcvd_state = 0x012b ;uint8_t volatile kbd_rcvd_state = 0;
.equ read_pcxt_shiftin = 0x012c ;uint8_t read_pcxt_shiftin = 0;
.equ read_pcxt_bits = 0x012d ;uint8_t read_pcxt_bits = 0;
.equ kbdcmd_to_send = 0x012e ;uint8_t kbdcmd_to_send = 0;
.equ atps2_write_shiftout = 0x012f ;uint8_t atps2_write_shiftout = 0;
.equ atps2_write_bits = 0x0130 ;uint8_t atps2_write_bits = 0;
.equ read_atps2_shiftin = 0x0131 ;uint8_t read_atps2_shiftin = 0;
.equ read_atps2_bits = 0x0132 ;uint8_t read_atps2_bits = 0;
.equ timer0_counter = 0x0136 ;uint32_t volatile timer0_counter = 0;
.equ onboard_led_counter = 0x013a ;uint16_t onboard_led_counter = 0;
.equ in_macro_tick = 0x013c ;uint8_t volatile in_macro_tick = 0;
.equ usb_suspended = 0x013d ;uint8_t usb_suspended = 0;
.equ usb_resuming = 0x013e ;uint8_t usb_resuming = 0;
.equ usb_status = 0x013f ;uint8_t volatile usb_status = 0;
.equ keyboard_modifier_keys = 0x0140 ;uint8_t keyboard_modifier_keys=0;
.equ keyboard_leds = 0x0141 ;uint8_t keyboard_leds = 0;
.equ usb_configuration = 0x0142 ;uint8_t volatile usb_configuration=0;
.equ tx_timeout_count = 0x0143 ;uint8_t volatile tx_timeout_count = 0;
.equ rx_timeout_count = 0x0144 ;uint8_t volatile rx_timeout_count = 0;
.equ keyboard_idle_count = 0x0145 ;uint8_t keyboard_idle_count[3] = { 0 };
.equ boot_idle_count = 0x0148 ;uint8_t boot_idle_count=0;
.equ boot_keys = 0x0149 ;uint8_t boot_keys[6]={0};
.equ debug_flush_timer = 0x014f ;uint8_t volatile debug_flush_timer=0;
.equ USB_GEN_vect__div4 = 0x0150 ;uint8_t div4=0; // in USB_GEN_vect
.equ previous_timeout = 0x0151 ;uint8_t previous_timeout=0;
;struct {
.equ kbd_data_data1 = 0x0152 ;uint8_t keys[21]={0};
.equ kbd_data_data2 = 0x0167 ;uint8_t data2 = 0; // might also be an array of size 1, or part of kbd_data_data1
.equ kbd_data_data3 = 0x0168 ;uint8_t kbd_data_data3[3]={0}; // might also be a part of kbd_data_data1
.equ kbd_data_data4 = 0x016b ;uint8_t kbd_data_data4[2]={0}; // unused?
; } kbd_data = {0};
.equ layerdata = 0x016d ;uint8_t *layerdata = 0; // big layer memory array
.equ allocated_layers = 0x016f ;uint8_t allocated_layers = 0;
.equ layer_cnt = 0x0170 ;uint8_t layer_cnt = 0;
.equ layer_map = 0x0171 ;uint8_t **layer_map = 0; // layer map (pointers into EEPROM)?
.equ max_used_layer = 0x0173 ;uint8_t max_used_layer = 0;
.equ fn_curset = 0x0174 ;uint8_t fn_curset = 0;
.equ fn_keyset = 0x0175 ;uint8_t *fn_keyset = 0;
.equ modif_curset = 0x0177 ;uint8_t modif_curset = 0; // bitmask of currently pressed modifier keys
.equ macro_data = 0x0178 ;uint8_t *macro_data = 0;
.equ allocated_macros = 0x017a ;uint8_t allocated_macros = 0;
.equ macro_cnt = 0x017b ;uint8_t macro_cnt = 0;
.equ setup_done = 0x017c ;uint8_t setup_done = 0;
.equ writing_eeprom_buffer = 0x017d ;uint8_t volatile writing_eeprom_buffer = 0;
.equ layerdefs = 0x017e ;uint8_t layerdefs = 0;
.equ max_layer = 0x017f ;uint8_t max_layer = 0;
.equ total_macros = 0x0180 ;uint8_t total_macros = 0;
.equ macro_onbreaks = 0x0181 ;uint8_t macro_onbreaks = 0; // presumably
.equ proc_keyboard_codeset = 0x0182 ; uint8_t proc_keyboard_codeset = 0;
.equ proc_keyboard_id = 0x0183 ;uint16_t proc_keyboard_id = 0;
.equ tcnow_start = 0x0185 ;uint32_t tcnow_start = 0;
.equ rawhid_commstate = 0x0189 ;uint8_t rawhid_commstate = 0;
.equ xfer_len = 0x018a ;uint16_t xfer_len = 0;
.equ xfer_eeaddr = 0x018c ;uint16_t xfer_eeaddr = 0;
.equ weep_word = 0x018e ;uint16_t weep_word = 0; // data word to write into EEPROM
.equ rhidc_start = 0x0190 ;uint32_t rhidc_start = 0;
.equ xfer_buf_len = 0x0194 ;uint8_t xfer_buf_len = 0;
.equ key_queue_widx = 0x0195 ;uint8_t key_queue_widx = 0;
.equ key_queue_ridx = 0x0196 ;uint8_t key_queue_ridx = 0;
.equ modifier_keys_stack_idx = 0x0197 ; uint8_t modifier_keys_stack_idx = 0;
.equ wakeup_timeout = 0x0198 ;uint8_t wakeup_timeout = 0;
.equ flagset = 0x0199 ;uint8_t flagset = 0;
.equ hidx_trans = 0x019a ;uint8_t hidx_trans[256];
.equ modif_keyset = 0x029a ;uint8_t *modif_keyset = 0; // bitmask of modifiers for each translated key
.equ eeprom_write_eeaddr = 0x029c ;volatile uint16_t eeprom_write_eeaddr = 0;
.equ eeprom_write_cnt = 0x029e ;volatile uint8_t eeprom_write_cnt = 0;
.equ eeprom_write_flag = 0x029f ;volatile uint8_t eeprom_write_flag = 0;
.equ eeprom_write_buffer = 0x02a0 ;volatile uint8_t *eeprom_write_buffer = 0;
; the next two form an unseparable unit
.equ rhcomm_sendcmd = 0x02a2 ;uint8_t rhcomm_sendcmd = 0;
.equ rhcomm_rcvbuf = 0x02a3 ;uint8_t rhcomm_rcvbuf[64] = 0;
.equ pressed_hidxs = 0x02e3 ;uint8_t pressed_hidxs[32] = {0};
.equ modifier_keys_stack = 0x0303 ; uint8_t modifier_keys_stack[8] = {0};
.equ key_queue = 0x030b ;uint16_t key_queue[80] = {0};
; BSS data area ends at 0x03ab
;=================================================
; Interrupt table
;=================================================
__vectors:
; Vector 1: Reset
rjmp __ctors_end ; 0x626
nop
; Vector 2: External Interrupt Request 0
rjmp __bad_interrupt ; 0x65e
nop
; Vector 3: External Interrupt Request 1
jmp INT1_vect ; 0x1244
; Vector 4: External Interrupt Request 2
rjmp __bad_interrupt ; 0x65e
nop
; Vector 5: External Interrupt Request 3
rjmp __bad_interrupt ; 0x65e
nop
; Vector 6: reserved
rjmp __bad_interrupt ; 0x65e
nop
; Vector 7: reserved
rjmp __bad_interrupt ; 0x65e
nop
; Vector 8: External Interrupt Request 6
rjmp __bad_interrupt ; 0x65e
nop
; Vector 9: Reserved
rjmp __bad_interrupt ; 0x65e
nop
; Vector 10: Pin Change Interrupt Request 0
rjmp __bad_interrupt ; 0x65e
nop
; Vector 11: USB General Interrupt request
jmp USB_GEN_vect ; 0x1b0c
; Vector 12: USB Endpoint Interrupt request
jmp USB_COM_vect ; 0x1d60
; Vector 13: Watchdog Time-out Interrupt
rjmp __bad_interrupt ; 0x65e
nop
; Vector 14: Reserved
rjmp __bad_interrupt ; 0x65e
nop
; Vector 15: Reserved
rjmp __bad_interrupt ; 0x65e
nop
; Vector 16: Reserved
rjmp __bad_interrupt ; 0x65e
nop
; Vector 17: Timer/Counter1 Capture Event
rjmp __bad_interrupt ; 0x65e
nop
; Vector 18: Timer/Counter1 Compare Match A
jmp TIMER1_COMPA_vect ; 0x12c4
; Vector 19: Timer/Counter1 Compare Match B
rjmp __bad_interrupt ; 0x65e
nop
; Vector 20: Timer/Counter1 Compare Match C
rjmp __bad_interrupt ; 0x65e
nop
; Vector 21: Timer/Counter1 Overflow
rjmp __bad_interrupt ; 0x65e
nop
; Vector 22: Timer/Counter0 Compare Match A
jmp TIMER0_COMPA_vect ; 0x15ae
; Vector 23: Timer/Counter0 Compare match B
rjmp __bad_interrupt ; 0x65e
nop
; Vector 24: Timer/Counter0 Overflow
rjmp __bad_interrupt ; 0x65e
nop
; Vector 25: SPI Serial Transfer Complete
rjmp __bad_interrupt ; 0x65e
nop
; Vector 26: USART1 Rx Complete
rjmp __bad_interrupt ; 0x65e
nop
; Vector 27: USART1 Data Register Empty
rjmp __bad_interrupt ; 0x65e
nop
; Vector 28: USART1 Tx Complete
rjmp __bad_interrupt ; 0x65e
nop
; Vector 29: Analog Comparator
rjmp __bad_interrupt ; 0x65e
nop
; Vector 30: ADC Conversion Complete
rjmp __bad_interrupt ; 0x65e
nop
; Vector 31: EEPROM Ready
jmp EE_READY_vect ; 0x298c
; Vector 32: Timer/Counter3 Capture Event
rjmp __bad_interrupt ; 0x65e
nop
; Vector 33: Timer/Counter3 Compare Match A
rjmp TIMER3_COMPA_vect ; 0xc10
nop
; Vector 34: Timer/Counter3 Compare Match B
rjmp __bad_interrupt ; 0x65e
nop
; Vector 35: Timer/Counter3 Compare Match C
rjmp __bad_interrupt ; 0x65e
nop
; Vector 36: Timer/Counter3 Overflow
rjmp __bad_interrupt ; 0x65e
nop
; Vector 37: 2-wire Serial Interface
rjmp __bad_interrupt ; 0x65e
nop
; Vector 38: Store Program Memory Ready
rjmp __bad_interrupt ; 0x65e
nop
; Vector 39: Timer/Counter4 Compare Match A
rjmp __bad_interrupt ; 0x65e
nop
; Vector 40: Timer/Counter4 Compare Match B
rjmp __bad_interrupt ; 0x65e
nop
; Vector 41: Timer/Counter4 Compare Match D
rjmp __bad_interrupt ; 0x65e
nop
; Vector 42: Timer/Counter4 Overflow
rjmp __bad_interrupt ; 0x65e
nop
; Vector 43: Timer/Counter4 Fault Protection Interrupt
rjmp __bad_interrupt ; 0x65e
nop
; keyboard codeset 1 translation table
kbd_ttbl_set1:
A_00ac:
.db 0x00,0x29,0x1e,0x1f,0x20,0x21,0x22,0x23
.db 0x24,0x25,0x26,0x27,0x2d,0x2e,0x2a,0x2b
.db 0x14,0x1a,0x08,0x15,0x17,0x1c,0x18,0x0c
.db 0x12,0x13,0x2f,0x30,0x28,0xe0,0x04,0x16
.db 0x07,0x09,0x0a,0x0b,0x0d,0x0e,0x0f,0x33
.db 0x34,0x35,0xe1,0x31,0x1d,0x1b,0x06,0x19
.db 0x05,0x11,0x10,0x36,0x37,0x38,0xe5,0x55
.db 0xe2,0x2c,0x39,0x3a,0x3b,0x3c,0x3d,0x3e
.db 0x3f,0x40,0x41,0x42,0x43,0x53,0x47,0x5f
.db 0x60,0x61,0x56,0x5c,0x5d,0x5e,0x57,0x59
.db 0x5a,0x5b,0x62,0x63,0xc2,0xbe,0x64,0x44
.db 0x45,0x67,0xb0,0xb2,0x8c,0xb7,0xb8,0xb9
.db 0xba,0xbb,0xbc,0xbd,0x68,0x69,0x6a,0x6b
.db 0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0xc1
.db 0x88,0xb1,0xb3,0x87,0xb4,0xb5,0x73,0x93
.db 0x92,0x8a,0xbf,0x8b,0xb6,0x89,0x85,0xc0
; keyboard codeset 2 translation table
kbd_ttbl_set2:
A_012c:
.db 0x01,0x42,0x00,0x3e,0x3c,0x3a,0x3b,0x45
.db 0x68,0x43,0x41,0x3f,0x3d,0x2b,0x35,0x67
.db 0x69,0xe2,0xe1,0x88,0xe0,0x14,0x1e,0xb0
.db 0x6a,0xb1,0x1d,0x16,0x04,0x1a,0x1f,0xb2
.db 0x6b,0x06,0x1b,0x07,0x08,0x21,0x20,0x8c
.db 0x6c,0x2c,0x19,0x09,0x17,0x15,0x22,0xb7
.db 0x6d,0x11,0x05,0x0b,0x0a,0x1c,0x23,0xb8
.db 0x6e,0xb3,0x10,0x0d,0x18,0x24,0x25,0xb9
.db 0x6f,0x36,0x0e,0x0c,0x12,0x27,0x26,0xba
.db 0x70,0x37,0x38,0x0f,0x33,0x13,0x2d,0xbb
.db 0x71,0x87,0x34,0xb4,0x2f,0x2e,0xbc,0x72
.db 0x39,0xe5,0x28,0x30,0xb5,0x31,0xbd,0x73
.db 0xbe,0x64,0x93,0x92,0x8a,0xbf,0x2a,0x8b
.db 0xb6,0x59,0x89,0x5c,0x5f,0x85,0xc0,0xc1
.db 0x62,0x63,0x5a,0x5d,0x5e,0x60,0x29,0x53
.db 0x44,0x57,0x5b,0x56,0x55,0x61,0x47,0x00
.db 0x00,0x00,0x00,0x40,0xc2
; keyboard codeset 4 translation table
kbd_ttbl_set2ex:
A_01b1:
.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.db 0xf9,0xe6,0x00,0x00,0xe4,0xe9,0x00,0x00
.db 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xe3
.db 0xfe,0xf0,0x00,0xec,0x00,0x00,0x00,0xe7
.db 0xfd,0x00,0x00,0xf7,0x00,0x00,0x00,0x65
.db 0xfc,0x00,0xef,0x00,0xeb,0x00,0x00,0x66
.db 0xfb,0x00,0xfa,0xea,0x00,0x00,0x00,0xa9
.db 0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.db 0xf6,0x00,0x54,0x00,0x00,0xe8,0x00,0x00
.db 0xf5,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.db 0x00,0x00,0x58,0x00,0x00,0x00,0xaa,0x00
.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.db 0x00,0x4d,0x00,0x50,0x4a,0x00,0x00,0x00
.db 0x49,0x4c,0x51,0x00,0x4f,0x52,0x00,0x00
.db 0x00,0x00,0x4e,0x00,0x46,0x4b,0x48
;keyboard codeset 3 translation table
kbd_ttbl_set3:
A_0230:
.db 0x01,0xbf,0x00,0xbb,0xb9,0xb7,0xb8,0x3a
.db 0x68,0xc0,0xbe,0xbc,0xba,0x2b,0x35,0x3b
.db 0x69,0xe0,0xe1,0x64,0x39,0x14,0x1e,0x3c
.db 0x6a,0xe2,0x1d,0x16,0x04,0x1a,0x1f,0x3d
.db 0x6b,0x06,0x1b,0x07,0x08,0x21,0x20,0x3e
.db 0x6c,0x2c,0x19,0x09,0x17,0x15,0x22,0x3f
.db 0x6d,0x11,0x05,0x0b,0x0a,0x1c,0x23,0x40
.db 0x6e,0xe6,0x10,0x0d,0x18,0x24,0x25,0x41
.db 0x6f,0x36,0x0e,0x0c,0x12,0x27,0x26,0x42
.db 0x70,0x37,0x38,0x0f,0x33,0x13,0x2d,0x43
.db 0x71,0x87,0x34,0x32,0x2f,0x2e,0x44,0x72
.db 0xe4,0xe5,0x28,0x30,0x31,0x89,0x45,0x73
.db 0x51,0x50,0x93,0x52,0x4c,0x4d,0x2a,0x49
.db 0xb6,0x59,0x4f,0x5c,0x5f,0x4e,0x4a,0x4b
.db 0x62,0x63,0x5a,0x5d,0x5e,0x60,0x29,0x53
.db 0xb2,0x57,0x5b,0x56,0x55,0x61,0x47,0x00
.db 0x00,0x00,0x00,0xbd,0xc2
A_02b5:
.db "\nMode: AT/PS2\n\n",$0
A_02c5:
.db "\nMode: PC/XT\n\n",$0
A_02d4:
.db "unknown",$0
A_02dc:
.db "2 (extended)",$0
A_02e9:
.db "Code Set: ",$0
A_02f4:
.db "Keyboard ID: ",$0
; descriptor_list[]
A_0302: ;entry 0
.dw 0x100 ;wValue
.dw 0 ;wIndex
.dw 0x036c ;address of device_descriptor (A_036c)
.db 18 ;sizeof(device_descriptor)
A_0309: ;entry 1
.dw 0x0200 ;wValue
.dw 0 ;wIndex
.dw 0x037e ;address of config1_descriptor (A_037e)
.db 0x74 ;sizeof(config1_descriptor)
A_0310: ;entry 2
.dw 0x02200 ;wValue
.dw 0 ;interface index
.dw 0x03f2 ;address of boot_hid_report_desc (A_03f2)
.db 18 ;sizeof(boot_hid_report_desc)
A_0317: ;entry 3
.dw 0x2100 ;wValue
.dw 0 ;interface index
.dw 0x390 ;address of config1_descriptor + offset of this interface therein
.db 9 ;sizeof(USBDESCR_HID)
A_031e: ;entry 4
.dw 0x2200 ;wValue
.dw 1 ;interface index
.dw 0x0404 ;address of debug_hid_report_desc (A_0404)
.db 21 ;sizeof(debug_hid_report_desc)
A_0325: ;entry 5
.dw 0x2100 ;wValue
.dw 1 ;interface index
.dw 0x03a9 ;address of config1_descriptor + offset of this interface therein
.db 9 ;sizeof(USBDESCR_HID)
A_032c: ;entry 6
.dw 0x2200 ;wValue
.dw 2 ;interface index
.dw 0x0419 ;address of keyboard_hid_report_desc (A_0419)
.db 220 ;sizeof(keyboard_hid_report_desc)
A_0333: ;entry 7
.dw 0x2100 ;wValue
.dw 2 ;interface index
.dw 0x03c2 ;address of config1_descriptor + offset of this interface therein
.db 9 ;sizeof(USBDESCR_HID)
A_033a: ;entry 8
.dw 0x2200 ;wValue
.dw 3 ;interface index
.dw 0x04f5 ;address of rawhid_hid_report_desc (A_04f5)
.db 28 ;sizeof(rawhid_hid_report_desc)
A_0341: ;entry 9
.dw 0x2100 ;wValue
.dw 3 ;interface index
.dw 0x03db ;address of config1_descriptor + offset of this interface therein
.db 9 ;sizeof(USBDESCR_HID)
A_0348: ;entry 10
.dw 0x0300 ;wValue
.dw 0 ;request for string 0
.dw 0x0511 ;address of string0
.db 4 ;sizeof(string0)
A_034f: ;entry 11
.dw 0x0301 ;wValue
.dw 0x0409 ;language?
.dw 0x0515 ;address of string1
.db 14 ;sizeof(string1)
A_0356: ;entry 12
.dw 0x0302 ;wValue
.dw 0x0409 ;language?
.dw 0x0525 ;address of string2
.db 56 ;sizeof(string2)
;endpoint configuration table
endpoint_config_table;
A_035d:
.db 1 ;this one's presumably the keyboard with KEYBOARD_SIZE=8
.db 0xc1 ;EP_TYPE_INTERRUPT_IN
.db 0x06 ;EP_SIZE(0..8) | EP_DOUBLE_BUFFER
A_0360:
.db 1 ;might be debug?
.db 0xc1 ;EP_TYPE_INTERRUPT_IN
.db 0x26 ;EP_SIZE(17..32) | EP_DOUBLE_BUFFER
A_0363:
.db 1 ;or this?
.db 0xc1 ;EP_TYPE_INTERRUPT_IN
.db 0x26 ;EP_SIZE(17..32) | EP_DOUBLE_BUFFER
A_0366:
.db 1 ;presumably rawhid with RAWHID_TX_SIZE=64
.db 0xc1 ;EP_TYPE_INTERRUPT_IN
.db 0x36 ;EP_SIZE(33..64) | EP_DOUBLE_BUFFER
A_0369:
.db 1 ;presumably rawhid with RAWHID_RX_SIZE=64
.db 0xc0 ;EP_TYPE_INTERRUPT_OUT
.db 0x36 ;EP_SIZE(33..64) | EP_DOUBLE_BUFFER
; device descriptor; for VID/PID see see https://usb-ids.gowdy.us/read/UD/16c0
device_descriptor:
A_036c:
.db 18 ;bLength
.db 1 ;bDescriptorType
.db 0x00,0x02 ;bcdUSB
.db 0 ;bDeviceClass
.db 0 ;bDeviceSubClass
.db 0 ;bDeviceProtocol
.db 32 ;ENDPOINT0_SIZE
.db 0xc0,0x16 ;Vendor ID (VOTI)
.db 0x7d,0x04 ;Product ID (USB_KEYBOARD_DEBUG)
.db 0x00,0x01 ;bcdDevice
.db 1 ;iManufacturer
.db 2 ;iProduct
.db 0 ;iSerialNumber
.db 1 ;bNumConfigurations
; USB configuration descriptor
config1_descriptor:
A_037e:
.db 9 ;sizeof(config1_descriptor): length of descriptor in bytes
.db 2 ;USBDESCR_CONFIG, /* descriptor type */
.db 0x74,0 ;/* total length of data returned (including inlined descriptors) */
.db 4 ;/* number of interfaces in this configuration */
.db 1 ;/* index of this configuration */
.db 0 ;/* configuration name string index */
.db 0xa0 ;USBATTR_BUSPOWER | USBATTR_SELFPOWER
.db 50 ;USB_CFG_MAX_BUS_POWER/2
/* boot device interface descriptor: */
.db 9 ;/* sizeof(usbDescrInterface): length of descriptor in bytes */
.db 4 ;USBDESCR_INTERFACE /* descriptor type */
.db 0 ;/* index of this interface */
.db 0 ;/* alternate setting for this interface */
.db 1 ;USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoints excl 0: number of endpoint descriptors to follow */
.db 3 ;USB_CFG_INTERFACE_CLASS
.db 1 ;USB_CFG_INTERFACE_SUBCLASS
.db 1 ;USB_CFG_INTERFACE_PROTOCOL
.db 0 ;/* string index for interface */
/* HID descriptor */
.db 9 ;/* sizeof(usbDescrHID): length of descriptor in bytes */
.db 0x21 ;USBDESCR_HID /* descriptor type: HID */
.db 0x11,0x01 ;/* BCD representation of HID version */
.db 0 ;/* target country code */
.db 1 ;/* number of HID Report (or other HID class) Descriptor infos to follow */
.db 0x22 ;/* descriptor type: report */
.db 0x12,0 ;USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* total length of report descriptor */
/* endpoint descriptor for endpoint 1 */
.db 7 ;/* sizeof(usbDescrEndpoint) */
.db 5 ;USBDESCR_ENDPOINT /* descriptor type = endpoint */
.db 0x81 ;0x81, /* IN endpoint number 1 */
.db 3 ;/* attrib: Interrupt endpoint */
.db 8,0 ;/* maximum packet size */
.db 1 ;USB_CFG_INTR_POLL_INTERVAL /* in ms */
/* 2nd interface descriptor: */
.db 9 ;/* sizeof(usbDescrInterface): length of descriptor in bytes */
.db 4 ;USBDESCR_INTERFACE /* descriptor type */
.db 1 ;/* index of this interface */
.db 0 ;/* alternate setting for this interface */
.db 1 ;/* number of endpoint descriptors to follow */
.db 3 ;USB_CFG_INTERFACE_CLASS
.db 0 ;subclass
.db 0 ;protocol
.db 0 ;/* string index for interface */
/* HID descriptor */
.db 9 ;/* sizeof(usbDescrHID): length of descriptor in bytes */
.db 0x21 ;USBDESCR_HID /* descriptor type: HID */
.db 0x11,0x01 ;/* BCD representation of HID version */
.db 0 ;/* target country code */
.db 1 ;/* number of HID Report (or other HID class) Descriptor infos to follow */
.db 0x22 ;/* descriptor type: report */
.db 0x15,0 ;USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* total length of report descriptor */
/* endpoint descriptor for endpoint 2 */
.db 7 ;/* sizeof(usbDescrEndpoint) */
.db 5 ;USBDESCR_ENDPOINT /* descriptor type = endpoint */
.db 0x83 ; /* endpoint number */
.db 3 ;/* attrib: Interrupt endpoint */
.db 32,0 ;/* maximum packet size */
.db 1 ;USB_CFG_INTR_POLL_INTERVAL /* in ms */
/* 3rd interface descriptor: */
.db 9 ;/* sizeof(usbDescrInterface): length of descriptor in bytes */
.db 4 ;USBDESCR_INTERFACE /* descriptor type */
.db 2 ;/* index of this interface */
.db 0 ;/* alternate setting for this interface */
.db 1 ;/* number of endpoint descriptors to follow */
.db 3 ;USB_CFG_INTERFACE_CLASS
.db 0 ;subclass
.db 0 ;protocol
.db 0 ;/* string index for interface */
/* HID descriptor */
.db 9 ;/* sizeof(usbDescrHID): length of descriptor in bytes */
.db 0x21 ;USBDESCR_HID /* descriptor type: HID */
.db 0x11,0x01 ;/* BCD representation of HID version */
.db 0 ;/* target country code */
.db 1 ;/* number of HID Report (or other HID class) Descriptor infos to follow */
.db 0x22 ;/* descriptor type: report */
.db 0xdc,0 ;USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* total length of report descriptor */
/* endpoint descriptor for endpoint 3 */
.db 7 ;/* sizeof(usbDescrEndpoint) */
.db 5 ;USBDESCR_ENDPOINT /* descriptor type = endpoint */
.db 0x82 ; /* endpoint number */
.db 3 ;/* attrib: Interrupt endpoint */
.db 23,0 ;/* maximum packet size */
.db 1 ;USB_CFG_INTR_POLL_INTERVAL /* in ms */
/* 4th interface descriptor: */
.db 9 ;/* sizeof(usbDescrInterface): length of descriptor in bytes */
.db 4 ;USBDESCR_INTERFACE /* descriptor type */
.db 3 ;/* index of this interface */
.db 0 ;/* alternate setting for this interface */
.db 2 ; /* number of endpoint descriptors to follow */
.db 3 ;USB_CFG_INTERFACE_CLASS
.db 0 ;subclass
.db 0 ;protocol
.db 0 ;/* string index for interface */
/* HID descriptor */
.db 9 ;/* sizeof(usbDescrHID): length of descriptor in bytes */
.db 0x21 ;USBDESCR_HID /* descriptor type: HID */
.db 0x11,0x01 ;/* BCD representation of HID version */
.db 0 ;/* target country code */
.db 1 ;/* number of HID Report (or other HID class) Descriptor infos to follow */
.db 0x22 ;/* descriptor type: report */
.db 0x1c,0 ;USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* total length of report descriptor */
/* 1st endpoint descriptor for interface 4 */
.db 7 ;/* sizeof(usbDescrEndpoint) */
.db 5 ;USBDESCR_ENDPOINT /* descriptor type = endpoint */
.db 0x84 ; /* endpoint number */
.db 3 ;/* attrib: Interrupt endpoint */
.db 64,0 ;/* maximum packet size */
.db 2 ;USB_CFG_INTR_POLL_INTERVAL /* in ms */
/* 2nd endpoint descriptor for interface 4 */
.db 7 ;/* sizeof(usbDescrEndpoint) */
.db 5 ;USBDESCR_ENDPOINT /* descriptor type = endpoint */
.db 0x05 ; /* endpoint number */
.db 3 ;/* attrib: Interrupt endpoint */
.db 64,0 ;/* maximum packet size */
.db 8 ;USB_CFG_INTR_POLL_INTERVAL /* in ms */
;===========================================================
; descriptions parsed by USB HID Descriptor Tool
;===========================================================
; assumption: boot-time device (?)
boot_hid_report_desc:
A_03f2:
.db 5h, 1h ; USAGE_PAGE (Generic Desktop)
.db 9h, 6h ; USAGE (Keyboard)
.db a1h, 1h ; COLLECTION (Application)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 26h, ffh, 0h ; LOGICAL_MAXIMUM (255)
.db 95h, 8h ; REPORT_COUNT (8)
.db 75h, 8h ; REPORT_SIZE (8)
.db 81h, 3h ; INPUT (Cnst,Var,Abs)
.db c0h ; END_COLLECTION
; description for the rawhid debug device
debug_hid_report_desc:
A_0404:
.db 6h, 31h, ffh ; USAGE_PAGE 0xFF31 (VendorDefined)
.db 9h, 74h ; USAGE 0x74
.db a1h, 53h ; COLLECTION (VendorDefined)
.db 75h, 8h ; REPORT_SIZE (8)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 26h, ffh, 0h ; LOGICAL_MAXIMUM (255)
.db 95h, 20h ; REPORT_COUNT (32)
.db 9h, 75h ; USAGE (Undefined)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db c0h ; END_COLLECTION
;description for the keyboard device
keyboard_hid_report_desc:
A_0419:
.db 5h, 1h ; USAGE_PAGE (Generic Desktop)
.db 9h, 6h ; USAGE (Keyboard)
.db a1h, 1h ; COLLECTION (Application)
.db 85h, 1h ; REPORT_ID (1)
.db 75h, 1h ; REPORT_SIZE (1)
.db 95h, 8h ; REPORT_COUNT (8)
.db 5h, 7h ; USAGE_PAGE (Keyboard)
.db 19h, e0h ; USAGE_MINIMUM (Keyboard LeftControl)
.db 29h, e7h ; USAGE_MAXIMUM (Keyboard Right GUI)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 25h, 1h ; LOGICAL_MAXIMUM (1)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db 95h, 5h ; REPORT_COUNT (5)
.db 75h, 1h ; REPORT_SIZE (1)
.db 5h, 8h ; USAGE_PAGE (LEDs)
.db 19h, 1h ; USAGE_MINIMUM (Num Lock)
.db 29h, 5h ; USAGE_MAXIMUM (Kana)
.db 91h, 2h ; OUTPUT (Data,Var,Abs)
.db 95h, 1h ; REPORT_COUNT (1)
.db 75h, 3h ; REPORT_SIZE (3)
.db 91h, 3h ; OUTPUT (Cnst,Var,Abs)
.db 75h, 1h ; REPORT_SIZE (1)
.db 95h, 31h ; REPORT_COUNT (49)
.db 5h, 7h ; USAGE_PAGE (Keyboard)
.db 19h, 1h ; USAGE_MINIMUM (Keyboard ErrorRollOver)
.db 29h, 31h ; USAGE_MAXIMUM (Keyboard \ and |)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 25h, 1h ; LOGICAL_MAXIMUM (1)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db 95h, 1h ; REPORT_COUNT (1)
.db 75h, 1h ; REPORT_SIZE (1)
.db 81h, 3h ; INPUT (Cnst,Var,Abs)
.db 75h, 1h ; REPORT_SIZE (1)
.db 95h, 69h ; REPORT_COUNT (105)
.db 5h, 7h ; USAGE_PAGE (Keyboard)
.db 19h, 33h ; USAGE_MINIMUM (Keyboard ; and :)
.db 29h, 9bh ; USAGE_MAXIMUM (Keyboard Cancel)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 25h, 1h ; LOGICAL_MAXIMUM (1)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db 95h, 1h ; REPORT_COUNT (1)
.db 75h, 1h ; REPORT_SIZE (1)
.db 81h, 3h ; INPUT (Cnst,Var,Abs)
.db 75h, 1h ; REPORT_SIZE (1)
.db 95h, 8h ; REPORT_COUNT (8)
.db 5h, 7h ; USAGE_PAGE (Keyboard)
.db 19h, 9dh ; USAGE_MINIMUM (Keyboard Prior)
.db 29h, a4h ; USAGE_MAXIMUM (Keyboard ExSel)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 25h, 1h ; LOGICAL_MAXIMUM (1)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db 95h, 4h ; REPORT_COUNT (4)
.db 75h, 1h ; REPORT_SIZE (1)
.db 81h, 3h ; INPUT (Cnst,Var,Abs)
.db c0h ; END_COLLECTION
.db 5h, 1h ; USAGE_PAGE (Generic Desktop)
.db 9h, 80h ; USAGE (System Control)
.db a1h, 1h ; COLLECTION (Application)
.db 85h, 2h ; REPORT_ID (2)
.db 75h, 1h ; REPORT_SIZE (1)
.db 95h, 3h ; REPORT_COUNT (3)
.db 19h, 81h ; USAGE_MINIMUM (System Power Down)
.db 29h, 83h ; USAGE_MAXIMUM (System Wake Up)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 25h, 1h ; LOGICAL_MAXIMUM (1)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db 95h, 5h ; REPORT_COUNT (5)
.db 75h, 1h ; REPORT_SIZE (1)
.db 81h, 3h ; INPUT (Cnst,Var,Abs)
.db c0h ; END_COLLECTION
.db 5h, ch ; USAGE_PAGE (Consumer Devices)
.db 9h, 1h ; USAGE (Consumer Control)
.db a1h, 1h ; COLLECTION (Application)
.db 85h, 3h ; REPORT_ID (3)
.db 75h, 1h ; REPORT_SIZE (1)
.db 95h, 18h ; REPORT_COUNT (24)
.db 9h, b5h ; USAGE (Scan Next Track)
.db 9h, b6h ; USAGE (Scan Previous Track)
.db 9h, b7h ; USAGE (Stop)
.db 9h, cdh ; USAGE (Unassigned)
.db 9h, e2h ; USAGE (Mute)
.db 9h, e5h ; USAGE (Bass Boost)
.db 9h, e7h ; USAGE (Loudness)
.db 9h, e9h ; USAGE (Volume Up)
.db 9h, eah ; USAGE (Volume Down)
.db ah, 52h, 1h ; USAGE (Bass Increment)
.db ah, 53h, 1h ; USAGE (Bass Decrement)
.db ah, 54h, 1h ; USAGE (Treble Increment)
.db ah, 55h, 1h ; USAGE (Treble Decrement)
.db ah, 83h, 1h ; USAGE (AL Consumer Control Configuration)
.db ah, 8ah, 1h ; USAGE (AL Email Reader)
.db ah, 92h, 1h ; USAGE (AL Calculator)
.db ah, 94h, 1h ; USAGE (AL Local Machine Browser)
.db ah, 21h, 2h ; USAGE (AC Search)
.db ah, 23h, 2h ; USAGE (AC Home)
.db ah, 24h, 2h ; USAGE (AC Back)
.db ah, 25h, 2h ; USAGE (AC Forward)
.db ah, 26h, 2h ; USAGE (AC Stop)
.db ah, 27h, 2h ; USAGE (AC Refresh)
.db ah, 2ah, 2h ; USAGE (AC Bookmarks)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 25h, 1h ; LOGICAL_MAXIMUM (1)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db c0h ; END_COLLECTION
; whatever THIS is, it's Vendor-defined
; follows the rawhid_hid_report_desc[] layout in usb_rawhid_debug.c,
; just with a slightly different usage page
;presumably the device that Soarer uses to pass the EEPROM data with
rawhid_hid_report_desc:
A_04f5:
.db 6h, 99h, ffh ; USAGE_PAGE (Not Defined)
.db ah, 68h, 24h ; USAGE (Undefined)
.db a1h, 1h ; COLLECTION (Application)
.db 75h, 8h ; REPORT_SIZE (8)
.db 15h, 0h ; LOGICAL_MINIMUM (0)
.db 26h, ffh, 0h ; LOGICAL_MAXIMUM (255)
.db 95h, 40h ; REPORT_COUNT (64)
.db 9h, 1h ; USAGE (Undefined)
.db 81h, 2h ; INPUT (Data,Var,Abs)
.db 95h, 40h ; REPORT_COUNT (64)
.db 9h, 2h ; USAGE (Undefined)
.db 91h, 2h ; OUTPUT (Data,Var,Abs)
.db c0h ; END_COLLECTION
string0:
A_0511:
.db $04,$03,$09,$04
;Manufacturer Name
string1:
A_0515:
db $0e,$03
db 'S',0
db 'o',0
db 'a',0
db 'r',0
db 'e',0
db 'r',0
dw 0
;Product Name
string2:
A_0525:
db $38,$03
db 'S',0
db 'o',0
db 'a',0
db 'r',0
db 'e',0
db 'r',0
db ''',0
db 's',0
db ' ',0
db 'K',0
db 'e',0
db 'y',0
db 'b',0
db 'o',0
db 'a',0
db 'r',0
db 'd',0
db ' ',0
db 'C',0
db 'o',0
db 'n',0
db 'v',0
db 'e',0
db 'r',0
db 't',0
db 'e',0
db 'r',0
dw 0
A_055f:
.db "alloc ok.\n",$0
A_056a:
.db "alloc failed.\n",$0
A_0579:
.db "alloc failed.\n",$0
A_0588:
.db "total_macros: ",$0
A_0597:
.db "max_layer: ",$0
A_05a3:
.db "layerdefs: ",$0
A_05af:
.db "!apply\n",$0
A_05b7:
.db "len<5\n",$0
A_05be:
.db "\n\nremaining: ",$0
A_05cc:
.db "error ",$0
A_05d3:
.db "error ",$0
A_05da:
.db "error ",$0
A_05e1:
.db "!id ",$0
A_05e6:
.db "!set ",$0
A_05ec:
.db "!select ",$0
A_05f5:
.db "macros ",$0
A_05fd:
.db "remaps ",$0
A_0605:
.db "layers ",0
info_templ:
A_060d: ;data package for scinfo
.db 0x03, 0x01, 0x00, 0x01, 0x01, 0x0c, 0x02, 0x01, 0x01,
.db 0x04, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x07, 0x00
.db 0x00, 0x06, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00
;==============================================================================
; Start of avr-gcc runtime initialization
;==============================================================================
;==============================================================
; __ctors_end: Reset Interrupt
;==============================================================
__ctors_end:
A_0626:
clr __zero_reg__
out SREG, __zero_reg__
ser R28
ldi R29, 0x0a
out SPH, R29 ; Stack pointer = 0x0aff
out SPL, R28
__do_copy_data:
ldi R17, 0x01
ldi R26, 0x00
ldi R27, 0x01
ldi R30, 0x2e
ldi R31, 0x38
rjmp .do_copy_data_start ; 0x642
.do_copy_data_loop:
lpm R0, Z+
st X+, R0
.do_copy_data_start:
cpi R26, 0x20
cpc R27, R17
brne .do_copy_data_loop ; 0x63e
__do_clear_bss:
ldi R17, 0x03
ldi R26, 0x20
ldi R27, 0x01
rjmp .do_clear_bss_start ; 0x652
.do_clear_bss_loop:
st X+, __zero_reg__
.do_clear_bss_start:
cpi R26, 0xab
cpc R27, R17
brne .do_clear_bss_loop ; 0x650
rcall main ; 0x7a6
jmp _exit ; 0x382a
;====================================================
; __bad_interrupt: Unused Interrupt - jump to reset vector
;====================================================
__bad_interrupt:
rjmp __vectors ; 0x0
;==============================================================================
; End of avr-gcc runtime initialization
;==============================================================================
;=======================================
; translate_scancode : translates incoming scancode based on keyboard codeset
;=======================================
translate_scancode:
A_0660: lds R25, keyboard_codeset ; 0x200
A_0664: cpi R25, 0x02
A_0666: breq A_06b0 ; 0x6b0
A_0668: cpi R25, 0x03
A_066a: brcc A_0672 ; 0x672
A_066c: cpi R25, 0x01
A_066e: brne A_06c0 ; 0x6c0
A_0670: rjmp A_067c ; 0x67c
A_0672: cpi R25, 0x03
A_0674: breq A_068c ; 0x68c
A_0676: cpi R25, 0x04
A_0678: brne A_06c0 ; 0x6c0
A_067a: rjmp A_069c ; 0x69c
A_067c: sbrc R24, 7
A_067e: rjmp A_06c0 ; 0x6c0
A_0680: mov R30, R24
A_0682: ldi R31, 0x00
A_0684: subi R30, 0x54
A_0686: sbci R31, 0xff
A_0688: lpm R24, Z
A_068a: ret
A_068c: cpi R24, 0x85
A_068e: brcc A_06c0 ; 0x6c0
A_0690: mov R30, R24
A_0692: ldi R31, 0x00
A_0694: subi R30, 0xd0
A_0696: sbci R31, 0xfd
A_0698: lpm R24, Z
A_069a: ret
A_069c: and R22, R22
A_069e: breq A_06b0 ; 0x6b0
A_06a0: cpi R24, 0x7f
A_06a2: brcc A_06c0 ; 0x6c0
A_06a4: mov R30, R24
A_06a6: ldi R31, 0x00
A_06a8: subi R30, 0x4f
A_06aa: sbci R31, 0xfe
A_06ac: lpm R24, Z
A_06ae: ret
A_06b0: cpi R24, 0x85
A_06b2: brcc A_06c0 ; 0x6c0
A_06b4: mov R30, R24
A_06b6: ldi R31, 0x00
A_06b8: subi R30, 0xd4
A_06ba: sbci R31, 0xfe
A_06bc: lpm R24, Z
A_06be: ret
A_06c0: ldi R24, 0x00
A_06c2: ret
;======================================================
; reset_kbdinstate :
;======================================================
reset_kbdinstate:
A_06c4: call reset_macroproc ; 0x3430
A_06c8: call queue_reset_usb_data ; 0x3444
A_06cc: sts kbd_breakcode, __zero_reg__ ; 0x244
A_06d0: sts kbd_extended_scancode, __zero_reg__ ; 0x246
A_06d4: sts kbd_extended2_scancode, __zero_reg__ ; 0x248
A_06d8: ret
;======================================================
; set_kbd_leds : sets the keyboard LEDs
;======================================================
set_kbd_leds:
A_06da: push R17
A_06dc: mov R17, R24
A_06de: call get_keyboard_protocol ; 0x3422
A_06e2: mov R18, R17
A_06e4: ldi R19, 0x00
A_06e6: and R24, R24
A_06e8: breq A_0702 ; 0x702
A_06ea: in R24, DDRF
A_06ec: ori R24, 0xe0 ;((1<<DDD7) | (1<<DDD6) | (1<<DDD5))
A_06ee: out DDRF, R24
A_06f0: in R24, PORTF
A_06f2: ldi R20, 0x05
A_06f4: add R18, R18
A_06f6: adc R19, R19
A_06f8: dec R20
A_06fa: brne A_06f4 ; 0x6f4
A_06fc: andi R24, 0x1f
A_06fe: or R24, R18
A_0700: rjmp A_0718 ; 0x718
A_0702: in R24, DDRF
A_0704: ldi R25, 0x05
A_0706: add R18, R18
A_0708: adc R19, R19
A_070a: dec R25
A_070c: brne A_0706 ; 0x706
A_070e: andi R24, 0x1f ;~((1<<DDD7) | (1<<DDD6) | (1<<DDD5))
A_0710: or R24, R18
A_0712: out DDRF, R24
A_0714: in R24, 0x11
A_0716: ori R24, 0xe0
A_0718: out PORTF, R24
A_071a: pop R17
A_071c: ret
;=======================================
; incoming_kbd_breakcode : process an incoming PS/2 break code
;=======================================
incoming_kbd_breakcode:
A_071e:
rcall translate_scancode
jmp incoming_keybreak
;=======================================
; incoming_kbd_makecode : process an incoming PS/2 make code
;=======================================
incoming_kbd_makecode:
A_0724: