summaryrefslogtreecommitdiffstats
path: root/src/disassembly
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-02-27 10:38:17 +0100
committerNao Pross <naopross@thearcway.org>2018-02-27 10:38:17 +0100
commit0a9c19f83f6a08f18871c9728c8cc474a615a3be (patch)
tree1d04689355f9106f3082d060b0d4d7bc9cf87df4 /src/disassembly
parentFinalize measurement code and implement midi output (diff)
downloadXilofono-0a9c19f83f6a08f18871c9728c8cc474a615a3be.tar.gz
Xilofono-0a9c19f83f6a08f18871c9728c8cc474a615a3be.zip
MPLab X garbage
Diffstat (limited to '')
-rw-r--r--src/disassembly/listing.disasm1598
1 files changed, 913 insertions, 685 deletions
diff --git a/src/disassembly/listing.disasm b/src/disassembly/listing.disasm
index e830f54..282aa13 100644
--- a/src/disassembly/listing.disasm
+++ b/src/disassembly/listing.disasm
@@ -1,7 +1,7 @@
Disassembly Listing for Xilofono
Generated From:
Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
-23-feb-2018 16:30:03
+27-feb-2018 09:19:21
--- Z:/SAMB_4/projects/xilofono/src/rs232.c -----------------------------------------------------------
1: #include "rs232.h"
@@ -11,35 +11,35 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
5: {
6: // set Async and 8 bits frame
7: TXSTA1bits.SYNC = 0;
-03FC 98AC BCF TXSTA1, 4, ACCESS
+0598 98AC BCF TXSTA1, 4, ACCESS
8: TXSTA1bits.TX9 = 0;
-03FE 9CAC BCF TXSTA1, 6, ACCESS
+059A 9CAC BCF TXSTA1, 6, ACCESS
9:
10: // baud prescaler
11: RCSTA1bits.SPEN = 1;
-0400 8EAB BSF RCSTA1, 7, ACCESS
+059C 8EAB BSF RCSTA1, 7, ACCESS
12: SPBRG1 = 31;
-0402 0E1F MOVLW 0x1F
-0404 6EAF MOVWF SPBRG1, ACCESS
+059E 0E1F MOVLW 0x1F
+05A0 6EAF MOVWF SPBRG1, ACCESS
13: SPBRGH1 = 0;
-0406 0E00 MOVLW 0x0
-0408 6EB0 MOVWF SPBRGH1, ACCESS
+05A2 0E00 MOVLW 0x0
+05A4 6EB0 MOVWF SPBRGH1, ACCESS
14: TXSTA1bits.BRGH = 0;
-040A 94AC BCF TXSTA1, 2, ACCESS
+05A6 94AC BCF TXSTA1, 2, ACCESS
15: BAUDCON1bits.BRG16 = 0;
-040C 96B8 BCF BAUDCON1, 3, ACCESS
+05A8 96B8 BCF BAUDCON1, 3, ACCESS
16:
17: // set up TX / RX pins
18: TRISCbits.TRISC7 = 1;
-040E 8E94 BSF TRISC, 7, ACCESS
+05AA 8E94 BSF TRISC, 7, ACCESS
19: TRISCbits.TRISC6 = 1;
-0410 8C94 BSF TRISC, 6, ACCESS
+05AC 8C94 BSF TRISC, 6, ACCESS
20: RCSTA1bits.CREN = 1; // enable continuous reception
-0412 88AB BSF RCSTA1, 4, ACCESS
+05AE 88AB BSF RCSTA1, 4, ACCESS
21: TXSTA1bits.TXEN = 1;
-0414 8AAC BSF TXSTA1, 5, ACCESS
+05B0 8AAC BSF TXSTA1, 5, ACCESS
22: }
-0416 0012 RETURN 0
+05B2 0012 RETURN 0
23:
24: void eusart2_init(void)
25: {
@@ -47,53 +47,54 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
27: }
28:
29: void putch(char c)
-0418 6E1A MOVWF p1, ACCESS
+05B4 0100 MOVLB 0x0
+05B6 6F60 MOVWF __pcstackBANK0, BANKED
30: {
31: while (!TX1IF);
-041A A89E BTFSS PIR1, 4, ACCESS
-041C D7FE BRA 0x41A
+05B8 A89E BTFSS PIR1, 4, ACCESS
+05BA D7FE BRA 0x5B8
32: TX1REG = c;
-041E C01A MOVFF p1, TXREG1
-0420 FFAD NOP
+05BC C060 MOVFF __pcstackBANK0, TXREG1
+05BE FFAD NOP
33: }
0008 8245 BSF btemp, 1, ACCESS
-000A CFFA MOVFF PCLATH, 0x5
-000C F005 NOP
-000E CFFB MOVFF PCLATU, 0x6
-0010 F006 NOP
-0012 CFE9 MOVFF FSR0, 0x7
-0014 F007 NOP
-0016 CFEA MOVFF FSR0H, 0x8
-0018 F008 NOP
-001A CFE1 MOVFF FSR1, 0x9
-001C F009 NOP
-001E CFE2 MOVFF FSR1H, 0xA
-0020 F00A NOP
-0022 CFD9 MOVFF FSR2, 0xB
-0024 F00B NOP
-0026 CFDA MOVFF FSR2H, 0xC
-0028 F00C NOP
-002A CFF3 MOVFF PROD, 0xD
-002C F00D NOP
-002E CFF4 MOVFF PRODH, 0xE
-0030 F00E NOP
-0032 CFF6 MOVFF TBLPTR, 0xF
-0034 F00F NOP
-0036 CFF7 MOVFF TBLPTRH, 0x10
-0038 F010 NOP
-003A CFF8 MOVFF TBLPTRU, 0x11
-003C F011 NOP
-003E CFF5 MOVFF TABLAT, 0x12
-0040 F012 NOP
-0042 C045 MOVFF btemp, 0x13
-0044 F013 NOP
-0046 C046 MOVFF 0x46, 0x14
-0048 F014 NOP
-004A C047 MOVFF 0x47, 0x15
-004C F015 NOP
-004E C048 MOVFF 0x48, 0x16
-0050 F016 NOP
-0422 0012 RETURN 0
+000A CFFA MOVFF PCLATH, 0x2B
+000C F02B NOP
+000E CFFB MOVFF PCLATU, 0x2C
+0010 F02C NOP
+0012 CFE9 MOVFF FSR0, 0x2D
+0014 F02D NOP
+0016 CFEA MOVFF FSR0H, 0x2E
+0018 F02E NOP
+001A CFE1 MOVFF FSR1, 0x2F
+001C F02F NOP
+001E CFE2 MOVFF FSR1H, 0x30
+0020 F030 NOP
+0022 CFD9 MOVFF FSR2, 0x31
+0024 F031 NOP
+0026 CFDA MOVFF FSR2H, 0x32
+0028 F032 NOP
+002A CFF3 MOVFF PROD, 0x33
+002C F033 NOP
+002E CFF4 MOVFF PRODH, 0x34
+0030 F034 NOP
+0032 CFF6 MOVFF TBLPTR, 0x35
+0034 F035 NOP
+0036 CFF7 MOVFF TBLPTRH, 0x36
+0038 F036 NOP
+003A CFF8 MOVFF TBLPTRU, 0x37
+003C F037 NOP
+003E CFF5 MOVFF TABLAT, 0x38
+0040 F038 NOP
+0042 C045 MOVFF btemp, 0x39
+0044 F039 NOP
+0046 C046 MOVFF 0x46, 0x3A
+0048 F03A NOP
+004A C047 MOVFF 0x47, 0x3B
+004C F03B NOP
+004E C048 MOVFF 0x48, 0x3C
+0050 F03C NOP
+05C0 0012 RETURN 0
34:
35: char getch(void)
36: {
@@ -151,28 +152,29 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
40: int midi_set_status(midi_message_t *pkt, midi_status_t status)
41: {
42: if (pkt == NULL) {
-03D8 501A MOVF p1, W, ACCESS
-03DA 101B IORWF pkt, W, ACCESS
-03DC B4D8 BTFSC STATUS, 2, ACCESS
-03DE 0012 RETURN 0
+0572 0100 MOVLB 0x0
+0574 5160 MOVF __pcstackBANK0, W, BANKED
+0576 1161 IORWF pkt, W, BANKED
+0578 B4D8 BTFSC STATUS, 2, ACCESS
+057A 0012 RETURN 0
43: return -1;
44: }
45:
46: pkt->status = status & 0x0F;
-03E0 C01C MOVFF c, 0x1D
-03E2 F01D NOP
-03E4 0E0F MOVLW 0xF
-03E6 161D ANDWF 0x1D, F, ACCESS
-03E8 C01A MOVFF p1, FSR2
-03EA FFD9 NOP
-03EC C01B MOVFF pkt, FSR2H
-03EE FFDA NOP
-03F0 50DF MOVF INDF2, W, ACCESS
-03F2 181D XORWF 0x1D, W, ACCESS
-03F4 0BF0 ANDLW 0xF0
-03F6 181D XORWF 0x1D, W, ACCESS
-03F8 6EDF MOVWF INDF2, ACCESS
-03FA 0012 RETURN 0
+057C C062 MOVFF c, 0x63
+057E F063 NOP
+0580 0E0F MOVLW 0xF
+0582 1763 ANDWF 0x63, F, BANKED
+0584 C060 MOVFF __pcstackBANK0, FSR2
+0586 FFD9 NOP
+0588 C061 MOVFF pkt, FSR2H
+058A FFDA NOP
+058C 50DF MOVF INDF2, W, ACCESS
+058E 1963 XORWF 0x63, W, BANKED
+0590 0BF0 ANDLW 0xF0
+0592 1963 XORWF 0x63, W, BANKED
+0594 6EDF MOVWF INDF2, ACCESS
+0596 0012 RETURN 0
47:
48: return 0;
49: }
@@ -180,29 +182,30 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
51: int midi_set_channel(midi_message_t *pkt, unsigned channel)
52: {
53: if (pkt == NULL) {
-03B2 501A MOVF p1, W, ACCESS
-03B4 101B IORWF pkt, W, ACCESS
-03B6 B4D8 BTFSC STATUS, 2, ACCESS
-03B8 0012 RETURN 0
+054A 0100 MOVLB 0x0
+054C 5160 MOVF __pcstackBANK0, W, BANKED
+054E 1161 IORWF pkt, W, BANKED
+0550 B4D8 BTFSC STATUS, 2, ACCESS
+0552 0012 RETURN 0
54: return -1;
55: }
56:
57: pkt->channel = channel & 0x0F;
-03BA C01C MOVFF c, n
-03BC F01E NOP
-03BE 0E0F MOVLW 0xF
-03C0 161E ANDWF n, F, ACCESS
-03C2 C01A MOVFF p1, FSR2
-03C4 FFD9 NOP
-03C6 C01B MOVFF pkt, FSR2H
-03C8 FFDA NOP
-03CA 3A1E SWAPF n, F, ACCESS
-03CC 50DF MOVF INDF2, W, ACCESS
-03CE 181E XORWF n, W, ACCESS
-03D0 0B0F ANDLW 0xF
-03D2 181E XORWF n, W, ACCESS
-03D4 6EDF MOVWF INDF2, ACCESS
-03D6 0012 RETURN 0
+0554 C062 MOVFF c, n
+0556 F064 NOP
+0558 0E0F MOVLW 0xF
+055A 1764 ANDWF n, F, BANKED
+055C C060 MOVFF __pcstackBANK0, FSR2
+055E FFD9 NOP
+0560 C061 MOVFF pkt, FSR2H
+0562 FFDA NOP
+0564 3B64 SWAPF n, F, BANKED
+0566 50DF MOVF INDF2, W, ACCESS
+0568 1964 XORWF n, W, BANKED
+056A 0B0F ANDLW 0xF
+056C 1964 XORWF n, W, BANKED
+056E 6EDF MOVWF INDF2, ACCESS
+0570 0012 RETURN 0
58:
59: return 0;
60: }
@@ -210,108 +213,103 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
62: int midi_note_on(midi_message_t *pkt, unsigned channel, midi_note_t note, uint8_t velocity)
63: {
64: if (pkt == NULL) {
-01BC 501F MOVF pkt, W, ACCESS
-01BE 1020 IORWF p, W, ACCESS
-01C0 B4D8 BTFSC STATUS, 2, ACCESS
-01C2 0012 RETURN 0
+0424 0100 MOVLB 0x0
+0426 5165 MOVF pkt, W, BANKED
+0428 1166 IORWF p, W, BANKED
+042A B4D8 BTFSC STATUS, 2, ACCESS
+042C 0012 RETURN 0
65: return -1;
66: }
-67:
-68: if (pkt->data == NULL) {
-01C4 0E03 MOVLW 0x3
-01C6 241F ADDWF pkt, W, ACCESS
-01C8 0100 MOVLB 0x0
-01CA 6F60 MOVWF __pcstackBANK0, BANKED
-01CC 0E00 MOVLW 0x0
-01CE 2020 ADDWFC p, W, ACCESS
-01D0 6F61 MOVWF 0x61, BANKED
-01D2 5160 MOVF __pcstackBANK0, W, BANKED
-01D4 1161 IORWF 0x61, W, BANKED
-01D6 B4D8 BTFSC STATUS, 2, ACCESS
-01D8 0012 RETURN 0
-69: return -2;
-70: }
-71:
-72: midi_set_status(pkt, NOTE_ON);
-01DA C01F MOVFF pkt, p1
-01DC F01A NOP
-01DE C020 MOVFF p, pkt
-01E0 F01B NOP
-01E2 0E08 MOVLW 0x8
-01E4 6E1C MOVWF c, ACCESS
-01E6 ECEC CALL 0x3D8, 0
-01E8 F001 NOP
-73: midi_set_channel(pkt, channel);
-01EA C01F MOVFF pkt, p1
-01EC F01A NOP
-01EE C020 MOVFF p, pkt
-01F0 F01B NOP
-01F2 C021 MOVFF channel, c
-01F4 F01C NOP
-01F6 C022 MOVFF 0x22, 0x1D
-01F8 F01D NOP
-01FA ECD9 CALL 0x3B2, 0
-01FC F001 NOP
-74:
-75: pkt->data[0] = note;
-01FE EE20 LFSR 2, 0x3
-0200 F003 NOP
-0202 501F MOVF pkt, W, ACCESS
-0204 26D9 ADDWF FSR2, F, ACCESS
-0206 5020 MOVF p, W, ACCESS
-0208 22DA ADDWFC FSR2H, F, ACCESS
-020A C023 MOVFF note, INDF2
-020C FFDF NOP
-76: pkt->data[1] = velocity;
-020E EE20 LFSR 2, 0x4
-0210 F004 NOP
-0212 501F MOVF pkt, W, ACCESS
-0214 26D9 ADDWF FSR2, F, ACCESS
-0216 5020 MOVF p, W, ACCESS
-0218 22DA ADDWFC FSR2H, F, ACCESS
-021A C024 MOVFF velocity, INDF2
-021C FFDF NOP
-77:
-78: #ifndef MIDI_DYNAMIC_MEMORY_ALLOC
-79: pkt->data_size = 2;
-021E EE20 LFSR 2, 0x1
-0220 F001 NOP
-0222 501F MOVF pkt, W, ACCESS
-0224 26D9 ADDWF FSR2, F, ACCESS
-0226 5020 MOVF p, W, ACCESS
-0228 22DA ADDWFC FSR2H, F, ACCESS
-022A 0E02 MOVLW 0x2
-022C 6EDE MOVWF POSTINC2, ACCESS
-022E 0E00 MOVLW 0x0
-0230 6EDD MOVWF POSTDEC2, ACCESS
-0232 0012 RETURN 0
-80: #endif
-81:
-82: return 0;
-83: }
-84:
-85: int midi_note_off(midi_message_t *pkt, unsigned channel, midi_note_t note, uint8_t velocity)
-86: {
-87: if (pkt == NULL) {
-88: return -1;
-89: }
-90:
-91: if (pkt->data == NULL) {
-92: return -2;
-93: }
-94:
-95: midi_set_status(pkt, NOTE_OFF);
-96: midi_set_channel(pkt, channel);
-97:
-98: pkt->data[0] = note;
-99: pkt->data[1] = velocity;
-100:
-101: #ifndef MIDI_DYNAMIC_MEMORY_ALLOC
-102: pkt->data_size = 2;
-103: #endif
+67:
+68: #ifdef MIDI_DYNAMIC_MEMORY_ALLOC
+69: if (pkt->data == NULL) {
+70: return -2;
+71: }
+72: #endif
+73:
+74: midi_set_status(pkt, NOTE_ON);
+042E C065 MOVFF pkt, __pcstackBANK0
+0430 F060 NOP
+0432 C066 MOVFF p, pkt
+0434 F061 NOP
+0436 0E08 MOVLW 0x8
+0438 6F62 MOVWF c, BANKED
+043A ECB9 CALL 0x572, 0
+043C F002 NOP
+75: midi_set_channel(pkt, channel);
+043E C065 MOVFF pkt, __pcstackBANK0
+0440 F060 NOP
+0442 C066 MOVFF p, pkt
+0444 F061 NOP
+0446 C067 MOVFF channel, c
+0448 F062 NOP
+044A C068 MOVFF 0x68, 0x63
+044C F063 NOP
+044E ECA5 CALL 0x54A, 0
+0450 F002 NOP
+76:
+77: pkt->data[0] = note;
+0452 0100 MOVLB 0x0
+0454 EE20 LFSR 2, 0x3
+0456 F003 NOP
+0458 5165 MOVF pkt, W, BANKED
+045A 26D9 ADDWF FSR2, F, ACCESS
+045C 5166 MOVF p, W, BANKED
+045E 22DA ADDWFC FSR2H, F, ACCESS
+0460 C069 MOVFF note, INDF2
+0462 FFDF NOP
+78: pkt->data[1] = velocity;
+0464 EE20 LFSR 2, 0x4
+0466 F004 NOP
+0468 5165 MOVF pkt, W, BANKED
+046A 26D9 ADDWF FSR2, F, ACCESS
+046C 5166 MOVF p, W, BANKED
+046E 22DA ADDWFC FSR2H, F, ACCESS
+0470 C06A MOVFF velocity, INDF2
+0472 FFDF NOP
+79:
+80: #ifndef MIDI_DYNAMIC_MEMORY_ALLOC
+81: pkt->data_size = 2;
+0474 EE20 LFSR 2, 0x1
+0476 F001 NOP
+0478 5165 MOVF pkt, W, BANKED
+047A 26D9 ADDWF FSR2, F, ACCESS
+047C 5166 MOVF p, W, BANKED
+047E 22DA ADDWFC FSR2H, F, ACCESS
+0480 0E02 MOVLW 0x2
+0482 6EDE MOVWF POSTINC2, ACCESS
+0484 0E00 MOVLW 0x0
+0486 6EDD MOVWF POSTDEC2, ACCESS
+0488 0012 RETURN 0
+82: #endif
+83:
+84: return 0;
+85: }
+86:
+87: int midi_note_off(midi_message_t *pkt, unsigned channel, midi_note_t note, uint8_t velocity)
+88: {
+89: if (pkt == NULL) {
+90: return -1;
+91: }
+92:
+93: #ifdef MIDI_DYNAMIC_MEMORY_ALLOC
+94: if (pkt->data == NULL) {
+95: return -2;
+96: }
+97: #endif
+98:
+99: midi_set_status(pkt, NOTE_OFF);
+100: midi_set_channel(pkt, channel);
+101:
+102: pkt->data[0] = note;
+103: pkt->data[1] = velocity;
104:
-105: return 0;
-106: }
+105: #ifndef MIDI_DYNAMIC_MEMORY_ALLOC
+106: pkt->data_size = 2;
+107: #endif
+108:
+109: return 0;
+110: }
--- Z:/SAMB_4/projects/xilofono/src/main.c ------------------------------------------------------------
1: /*
2: * File: main.c
@@ -402,487 +400,715 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
87: #include <stdint.h>
88: #include <string.h>
89:
-90: #define NOTES 15
+90: #define NOTES 16
91: #define NOTE_MASK 0xFF00
92:
-93:
-94: /* global variables */
-95: volatile uint16_t keypresses[NOTES];
-96:
-97: /* function prototypes */
-98: int eusart_write_midi(const midi_message_t *pkt);
+93: #define MIDI_CHANNEL 0x0
+94: #define MIDI_SCALE_START 0x3C
+95:
+96: /* global variables */
+97: volatile uint16_t keys_data[NOTES];
+98: volatile uint16_t keypresses = 0; // flags to notify the main program
99:
-100: /* interrupt service routine */
-101: interrupt void isr(void)
+100: /* function prototypes */
+101: int eusart_write_midi(const midi_message_t *pkt);
+102:
+103: /* interrupt service routine */
+104: interrupt void isr(void)
0008 8245 BSF btemp, 1, ACCESS
-102: {
-103: unsigned char i, data;
-104:
-105: PORTDbits.RD3 = 0;
+105: {
+106: unsigned char i, data_a, data_b;
+107:
+108: PORTDbits.RD3 = 0;
0052 9683 BCF PORTD, 3, ACCESS
-106:
-107: if (PIR1bits.TMR2IF) {
+109:
+110: if (PIR1bits.TMR2IF) {
0054 A29E BTFSS PIR1, 1, ACCESS
-0056 D089 BRA 0x16A
-108: // PORTA
-109: data = PORTA;
-0058 CF80 MOVFF PORTA, data
-005A F018 NOP
-110: i = 7;
-005C 0E07 MOVLW 0x7
-005E 6E19 MOVWF i, ACCESS
-111: do {
-112: keypresses[i] = (keypresses[i] << 1) | ((data >> i) & 0x01);
-0060 5019 MOVF i, W, ACCESS
-0062 0D02 MULLW 0x2
-0064 0E25 MOVLW 0x25
-0066 24F3 ADDWF PROD, W, ACCESS
-0068 6ED9 MOVWF FSR2, ACCESS
-006A 0E00 MOVLW 0x0
-006C 20F4 ADDWFC PRODH, W, ACCESS
-006E 6EDA MOVWF FSR2H, ACCESS
-0070 CFDE MOVFF POSTINC2, __pcstackCOMRAM
-0072 F001 NOP
-0074 CFDD MOVFF POSTDEC2, 0x2
-0076 F002 NOP
-0078 90D8 BCF STATUS, 0, ACCESS
-007A 3601 RLCF __pcstackCOMRAM, F, ACCESS
-007C 3602 RLCF 0x2, F, ACCESS
-007E C019 MOVFF i, 0x3
-0080 F003 NOP
-0082 C018 MOVFF data, 0x4
-0084 F004 NOP
-0086 2A03 INCF 0x3, F, ACCESS
-0088 D002 BRA 0x8E
-008A 90D8 BCF STATUS, 0, ACCESS
-008C 3204 RRCF 0x4, F, ACCESS
-008E 2E03 DECFSZ 0x3, F, ACCESS
-0090 D7FC BRA 0x8A
-0092 0E01 MOVLW 0x1
-0094 1604 ANDWF 0x4, F, ACCESS
-0096 5004 MOVF 0x4, W, ACCESS
-0098 1201 IORWF __pcstackCOMRAM, F, ACCESS
-009A 0E00 MOVLW 0x0
-009C 1202 IORWF 0x2, F, ACCESS
-009E 5019 MOVF i, W, ACCESS
-00A0 0D02 MULLW 0x2
-00A2 0E25 MOVLW 0x25
-00A4 24F3 ADDWF PROD, W, ACCESS
-00A6 6ED9 MOVWF FSR2, ACCESS
-00A8 0E00 MOVLW 0x0
-00AA 20F4 ADDWFC PRODH, W, ACCESS
-00AC 6EDA MOVWF FSR2H, ACCESS
-00AE C001 MOVFF __pcstackCOMRAM, POSTINC2
-00B0 FFDE NOP
-00B2 C002 MOVFF 0x2, POSTDEC2
-00B4 FFDD NOP
-113: } while (i--);
-00B6 0619 DECF i, F, ACCESS
-00B8 2819 INCF i, W, ACCESS
-00BA A4D8 BTFSS STATUS, 2, ACCESS
-00BC D7D1 BRA 0x60
-114:
-115: data = PORTB;
-00BE CF81 MOVFF PORTB, data
-00C0 F018 NOP
-116: i = 7;
-00C2 0E07 MOVLW 0x7
-00C4 6E19 MOVWF i, ACCESS
-117: do {
-118: keypresses[i] = (keypresses[i] << 1) | ((data >> i) & 0x01);
-00C6 5019 MOVF i, W, ACCESS
-00C8 0D02 MULLW 0x2
-00CA 0E25 MOVLW 0x25
-00CC 24F3 ADDWF PROD, W, ACCESS
-00CE 6ED9 MOVWF FSR2, ACCESS
-00D0 0E00 MOVLW 0x0
-00D2 20F4 ADDWFC PRODH, W, ACCESS
-00D4 6EDA MOVWF FSR2H, ACCESS
-00D6 CFDE MOVFF POSTINC2, __pcstackCOMRAM
-00D8 F001 NOP
-00DA CFDD MOVFF POSTDEC2, 0x2
-00DC F002 NOP
-00DE 90D8 BCF STATUS, 0, ACCESS
-00E0 3601 RLCF __pcstackCOMRAM, F, ACCESS
-00E2 3602 RLCF 0x2, F, ACCESS
-00E4 C019 MOVFF i, 0x3
-00E6 F003 NOP
-00E8 C018 MOVFF data, 0x4
-00EA F004 NOP
-00EC 2A03 INCF 0x3, F, ACCESS
-00EE D002 BRA 0xF4
-00F0 90D8 BCF STATUS, 0, ACCESS
-00F2 3204 RRCF 0x4, F, ACCESS
-00F4 2E03 DECFSZ 0x3, F, ACCESS
-00F6 D7FC BRA 0xF0
-00F8 0E01 MOVLW 0x1
-00FA 1604 ANDWF 0x4, F, ACCESS
-00FC 5004 MOVF 0x4, W, ACCESS
-00FE 1201 IORWF __pcstackCOMRAM, F, ACCESS
-0100 0E00 MOVLW 0x0
-0102 1202 IORWF 0x2, F, ACCESS
-0104 5019 MOVF i, W, ACCESS
-0106 0D02 MULLW 0x2
-0108 0E25 MOVLW 0x25
-010A 24F3 ADDWF PROD, W, ACCESS
-010C 6ED9 MOVWF FSR2, ACCESS
-010E 0E00 MOVLW 0x0
-0110 20F4 ADDWFC PRODH, W, ACCESS
-0112 6EDA MOVWF FSR2H, ACCESS
-0114 C001 MOVFF __pcstackCOMRAM, POSTINC2
-0116 FFDE NOP
-0118 C002 MOVFF 0x2, POSTDEC2
-011A FFDD NOP
-119: } while (i-- - 8);
-011C 0EF8 MOVLW 0xF8
-011E 6E01 MOVWF __pcstackCOMRAM, ACCESS
-0120 0EFF MOVLW 0xFF
-0122 6E02 MOVWF 0x2, ACCESS
-0124 0619 DECF i, F, ACCESS
-0126 2819 INCF i, W, ACCESS
-0128 6E03 MOVWF 0x3, ACCESS
-012A 6A04 CLRF 0x4, ACCESS
-012C 5001 MOVF __pcstackCOMRAM, W, ACCESS
-012E 2603 ADDWF 0x3, F, ACCESS
-0130 5002 MOVF 0x2, W, ACCESS
-0132 2204 ADDWFC 0x4, F, ACCESS
-0134 5003 MOVF 0x3, W, ACCESS
-0136 1004 IORWF 0x4, W, ACCESS
-0138 A4D8 BTFSS STATUS, 2, ACCESS
-013A D7C5 BRA 0xC6
-120:
-121: // PORTB
-122: // for (i = 8; i < NOTES; i++) {
-123: // keypresses[i] = (keypresses[i] << 1) | ((PORTB & (1 << i)) >> i);
-124: // }
-125:
-126: // TODO same for PORTD when the steps board is printed
-127:
-128: // debug stuff
-129: PORTDbits.RD4 = PORTAbits.RA0;
-013C A080 BTFSS PORTA, 0, ACCESS
-013E D002 BRA 0x144
-0140 8883 BSF PORTD, 4, ACCESS
-0142 D001 BRA 0x146
-0144 9883 BCF PORTD, 4, ACCESS
-130: PORTDbits.RD2 = (keypresses[0] && !(keypresses[0] & NOTE_MASK));
-0146 0E00 MOVLW 0x0
-0148 6E17 MOVWF 0x17, ACCESS
-014A 5025 MOVF keypresses, W, ACCESS
-014C 1026 IORWF 0x26, W, ACCESS
-014E B4D8 BTFSC STATUS, 2, ACCESS
-0150 D006 BRA 0x15E
-0152 0EFF MOVLW 0xFF
-0154 1426 ANDWF 0x26, W, ACCESS
+0056 D11F BRA 0x296
+111: data_a = PORTA;
+0058 CF80 MOVFF PORTA, data_a
+005A F03D NOP
+112: data_b = PORTB;
+005C CF81 MOVFF PORTB, data_b
+005E F03E NOP
+113: i = 7;
+0060 0E07 MOVLW 0x7
+0062 6E42 MOVWF i, ACCESS
+114: do {
+115: // read the data and append it at the end of keys_data[i]
+116: keys_data[i] = (keys_data[i] << 1) | ((data_a >> i) & 0x01);
+0064 5042 MOVF i, W, ACCESS
+0066 0D02 MULLW 0x2
+0068 0E03 MOVLW 0x3
+006A 24F3 ADDWF PROD, W, ACCESS
+006C 6ED9 MOVWF FSR2, ACCESS
+006E 0E00 MOVLW 0x0
+0070 20F4 ADDWFC PRODH, W, ACCESS
+0072 6EDA MOVWF FSR2H, ACCESS
+0074 CFDE MOVFF POSTINC2, __pcstackCOMRAM
+0076 F023 NOP
+0078 CFDD MOVFF POSTDEC2, 0x24
+007A F024 NOP
+007C 90D8 BCF STATUS, 0, ACCESS
+007E 3623 RLCF __pcstackCOMRAM, F, ACCESS
+0080 3624 RLCF 0x24, F, ACCESS
+0082 C042 MOVFF i, 0x25
+0084 F025 NOP
+0086 C03D MOVFF data_a, 0x26
+0088 F026 NOP
+008A 2A25 INCF 0x25, F, ACCESS
+008C D002 BRA 0x92
+008E 90D8 BCF STATUS, 0, ACCESS
+0090 3226 RRCF 0x26, F, ACCESS
+0092 2E25 DECFSZ 0x25, F, ACCESS
+0094 D7FC BRA 0x8E
+0096 0E01 MOVLW 0x1
+0098 1626 ANDWF 0x26, F, ACCESS
+009A 5026 MOVF 0x26, W, ACCESS
+009C 1223 IORWF __pcstackCOMRAM, F, ACCESS
+009E 0E00 MOVLW 0x0
+00A0 1224 IORWF 0x24, F, ACCESS
+00A2 5042 MOVF i, W, ACCESS
+00A4 0D02 MULLW 0x2
+00A6 0E03 MOVLW 0x3
+00A8 24F3 ADDWF PROD, W, ACCESS
+00AA 6ED9 MOVWF FSR2, ACCESS
+00AC 0E00 MOVLW 0x0
+00AE 20F4 ADDWFC PRODH, W, ACCESS
+00B0 6EDA MOVWF FSR2H, ACCESS
+00B2 C023 MOVFF __pcstackCOMRAM, POSTINC2
+00B4 FFDE NOP
+00B6 C024 MOVFF 0x24, POSTDEC2
+00B8 FFDD NOP
+117: keys_data[i + 8] = (keys_data[i + 8] << 1) | ((data_b >> i) & 0x01);
+00BA 5042 MOVF i, W, ACCESS
+00BC 6E23 MOVWF __pcstackCOMRAM, ACCESS
+00BE 6A24 CLRF 0x24, ACCESS
+00C0 90D8 BCF STATUS, 0, ACCESS
+00C2 3623 RLCF __pcstackCOMRAM, F, ACCESS
+00C4 3624 RLCF 0x24, F, ACCESS
+00C6 0E10 MOVLW 0x10
+00C8 2623 ADDWF __pcstackCOMRAM, F, ACCESS
+00CA 0E00 MOVLW 0x0
+00CC 2224 ADDWFC 0x24, F, ACCESS
+00CE 0E03 MOVLW 0x3
+00D0 2423 ADDWF __pcstackCOMRAM, W, ACCESS
+00D2 6ED9 MOVWF FSR2, ACCESS
+00D4 0E00 MOVLW 0x0
+00D6 2024 ADDWFC 0x24, W, ACCESS
+00D8 6EDA MOVWF FSR2H, ACCESS
+00DA CFDE MOVFF POSTINC2, 0x25
+00DC F025 NOP
+00DE CFDD MOVFF POSTDEC2, 0x26
+00E0 F026 NOP
+00E2 90D8 BCF STATUS, 0, ACCESS
+00E4 3625 RLCF 0x25, F, ACCESS
+00E6 3626 RLCF 0x26, F, ACCESS
+00E8 C042 MOVFF i, 0x27
+00EA F027 NOP
+00EC C03E MOVFF data_b, 0x28
+00EE F028 NOP
+00F0 2A27 INCF 0x27, F, ACCESS
+00F2 D002 BRA 0xF8
+00F4 90D8 BCF STATUS, 0, ACCESS
+00F6 3228 RRCF 0x28, F, ACCESS
+00F8 2E27 DECFSZ 0x27, F, ACCESS
+00FA D7FC BRA 0xF4
+00FC 0E01 MOVLW 0x1
+00FE 1628 ANDWF 0x28, F, ACCESS
+0100 5028 MOVF 0x28, W, ACCESS
+0102 1225 IORWF 0x25, F, ACCESS
+0104 0E00 MOVLW 0x0
+0106 1226 IORWF 0x26, F, ACCESS
+0108 5042 MOVF i, W, ACCESS
+010A 6E29 MOVWF 0x29, ACCESS
+010C 6A2A CLRF 0x2A, ACCESS
+010E 90D8 BCF STATUS, 0, ACCESS
+0110 3629 RLCF 0x29, F, ACCESS
+0112 362A RLCF 0x2A, F, ACCESS
+0114 0E10 MOVLW 0x10
+0116 2629 ADDWF 0x29, F, ACCESS
+0118 0E00 MOVLW 0x0
+011A 222A ADDWFC 0x2A, F, ACCESS
+011C 0E03 MOVLW 0x3
+011E 2429 ADDWF 0x29, W, ACCESS
+0120 6ED9 MOVWF FSR2, ACCESS
+0122 0E00 MOVLW 0x0
+0124 202A ADDWFC 0x2A, W, ACCESS
+0126 6EDA MOVWF FSR2H, ACCESS
+0128 C025 MOVFF 0x25, POSTINC2
+012A FFDE NOP
+012C C026 MOVFF 0x26, POSTDEC2
+012E FFDD NOP
+118:
+119: // TODO same for PORTD when the steps board is printed
+120:
+121: // if the keypress flag is set, the main hasn't sent the packet (yet)
+122: if (!(keypresses & (1<<i))) {
+0130 C042 MOVFF i, __pcstackCOMRAM
+0132 F023 NOP
+0134 0E01 MOVLW 0x1
+0136 6E24 MOVWF 0x24, ACCESS
+0138 0E00 MOVLW 0x0
+013A 6E25 MOVWF 0x25, ACCESS
+013C 2A23 INCF __pcstackCOMRAM, F, ACCESS
+013E D003 BRA 0x146
+0140 90D8 BCF STATUS, 0, ACCESS
+0142 3624 RLCF 0x24, F, ACCESS
+0144 3625 RLCF 0x25, F, ACCESS
+0146 2E23 DECFSZ __pcstackCOMRAM, F, ACCESS
+0148 D7FB BRA 0x140
+014A 5001 MOVF keypresses, W, ACCESS
+014C 1624 ANDWF 0x24, F, ACCESS
+014E 5002 MOVF 0x2, W, ACCESS
+0150 1625 ANDWF 0x25, F, ACCESS
+0152 5024 MOVF 0x24, W, ACCESS
+0154 1025 IORWF 0x25, W, ACCESS
0156 A4D8 BTFSS STATUS, 2, ACCESS
-0158 D002 BRA 0x15E
-015A 0E01 MOVLW 0x1
-015C 6E17 MOVWF 0x17, ACCESS
-015E B017 BTFSC 0x17, 0, ACCESS
-0160 D002 BRA 0x166
-0162 9483 BCF PORTD, 2, ACCESS
-0164 D001 BRA 0x168
-0166 8483 BSF PORTD, 2, ACCESS
-131:
-132: // reset interrupt flag
-133: PIR1bits.TMR2IF = 0;
-0168 929E BCF PIR1, 1, ACCESS
-134: }
-135:
-136: PORTDbits.RD3 = 1;
-016A 8683 BSF PORTD, 3, ACCESS
-137: }
-016C C016 MOVFF 0x16, 0x48
-016E F048 NOP
-0170 C015 MOVFF 0x15, 0x47
-0172 F047 NOP
-0174 C014 MOVFF 0x14, 0x46
-0176 F046 NOP
-0178 C013 MOVFF 0x13, btemp
-017A F045 NOP
-017C C012 MOVFF 0x12, TABLAT
-017E FFF5 NOP
-0180 C011 MOVFF 0x11, TBLPTRU
-0182 FFF8 NOP
-0184 C010 MOVFF 0x10, TBLPTRH
-0186 FFF7 NOP
-0188 C00F MOVFF 0xF, TBLPTR
-018A FFF6 NOP
-018C C00E MOVFF 0xE, PRODH
-018E FFF4 NOP
-0190 C00D MOVFF 0xD, PROD
-0192 FFF3 NOP
-0194 C00C MOVFF 0xC, FSR2H
-0196 FFDA NOP
-0198 C00B MOVFF 0xB, FSR2
-019A FFD9 NOP
-019C C00A MOVFF 0xA, FSR1H
-019E FFE2 NOP
-01A0 C009 MOVFF 0x9, FSR1
-01A2 FFE1 NOP
-01A4 C008 MOVFF 0x8, FSR0H
-01A6 FFEA NOP
-01A8 C007 MOVFF 0x7, FSR0
-01AA FFE9 NOP
-01AC C006 MOVFF 0x6, PCLATU
-01AE FFFB NOP
-01B0 C005 MOVFF 0x5, PCLATH
-01B2 FFFA NOP
-01B4 9245 BCF btemp, 1, ACCESS
-01B6 0011 RETFIE 1
-138:
-139: /* hardware configuration (inlined) */
-140: inline void init_hw(void)
-141: {
-142: di();
-02A8 9EF2 BCF INTCON, 7, ACCESS
-143:
-144: /* PLL / FOSC configuration */
-145: // enable PLL
-146: OSCTUNEbits.PLLEN = 1;
-02AA 8C9B BSF OSCTUNE, 6, ACCESS
-147: // set FOSC to HFINTOSC (max frequency)
-148: OSCTUNEbits.TUN = 0b011111;
-02AC 809B BSF OSCTUNE, 0, ACCESS
-02AE 829B BSF OSCTUNE, 1, ACCESS
-02B0 849B BSF OSCTUNE, 2, ACCESS
-02B2 869B BSF OSCTUNE, 3, ACCESS
-02B4 889B BSF OSCTUNE, 4, ACCESS
-02B6 9A9B BCF OSCTUNE, 5, ACCESS
-149: // set 16 MHz oscillator, datasheet p.30
-150: OSCCONbits.IRCF = 0b111;
-02B8 88D3 BSF OSCCON, 4, ACCESS
-02BA 8AD3 BSF OSCCON, 5, ACCESS
-02BC 8CD3 BSF OSCCON, 6, ACCESS
-151: // select primary clock (with PLL)
-152: OSCCONbits.SCS = 0b00;
-02BE 0EFC MOVLW 0xFC
-02C0 16D3 ANDWF OSCCON, F, ACCESS
-153:
-154: /* i/o initializazion */
-155: // disable all ADCs
-156: ANSELA = 0x00;
-02C2 0E00 MOVLW 0x0
-02C4 010F MOVLB 0xF
-02C6 6F38 MOVWF 0x38, BANKED
-157: ANSELB = 0x00;
-02C8 0E00 MOVLW 0x0
-02CA 6F39 MOVWF 0x39, BANKED
-158: ANSELC = 0x00;
-02CC 0E00 MOVLW 0x0
-02CE 6F3A MOVWF 0x3A, BANKED
-159: ANSELD = 0x00;
-02D0 0E00 MOVLW 0x0
-02D2 6F3B MOVWF 0x3B, BANKED
-160:
-161: // TODO: remove demo
-162: TRISA = 0xFF;
-02D4 6892 SETF TRISA, ACCESS
-163: TRISB = 0xFF;
-02D6 6893 SETF TRISB, ACCESS
-164:
-165: TRISDbits.TRISD1 = 0;
-02D8 9295 BCF TRISD, 1, ACCESS
-166: TRISDbits.TRISD2 = 0;
-02DA 9495 BCF TRISD, 2, ACCESS
-167: TRISDbits.TRISD3 = 0;
-02DC 9695 BCF TRISD, 3, ACCESS
-168: TRISDbits.TRISD4 = 0;
-02DE 9895 BCF TRISD, 4, ACCESS
+0158 D02D BRA 0x1B4
+123: // if the flag is not set, check if it should be
+124: keypresses |= (keys_data[i] && !(keys_data[i] & NOTE_MASK))<<i;
+015A 0E00 MOVLW 0x0
+015C 6E3F MOVWF 0x3F, ACCESS
+015E 5042 MOVF i, W, ACCESS
+0160 0D02 MULLW 0x2
+0162 0E03 MOVLW 0x3
+0164 24F3 ADDWF PROD, W, ACCESS
+0166 6ED9 MOVWF FSR2, ACCESS
+0168 0E00 MOVLW 0x0
+016A 20F4 ADDWFC PRODH, W, ACCESS
+016C 6EDA MOVWF FSR2H, ACCESS
+016E 50DE MOVF POSTINC2, W, ACCESS
+0170 10DE IORWF POSTINC2, W, ACCESS
+0172 B4D8 BTFSC STATUS, 2, ACCESS
+0174 D00F BRA 0x194
+0176 5042 MOVF i, W, ACCESS
+0178 0D02 MULLW 0x2
+017A 0E03 MOVLW 0x3
+017C 24F3 ADDWF PROD, W, ACCESS
+017E 6ED9 MOVWF FSR2, ACCESS
+0180 0E00 MOVLW 0x0
+0182 20F4 ADDWFC PRODH, W, ACCESS
+0184 6EDA MOVWF FSR2H, ACCESS
+0186 52DE MOVF POSTINC2, F, ACCESS
+0188 0EFF MOVLW 0xFF
+018A 14DD ANDWF POSTDEC2, W, ACCESS
+018C A4D8 BTFSS STATUS, 2, ACCESS
+018E D002 BRA 0x194
+0190 0E01 MOVLW 0x1
+0192 6E3F MOVWF 0x3F, ACCESS
+0194 C042 MOVFF i, __pcstackCOMRAM
+0196 F023 NOP
+0198 503F MOVF 0x3F, W, ACCESS
+019A 6E24 MOVWF 0x24, ACCESS
+019C 6A25 CLRF 0x25, ACCESS
+019E 2A23 INCF __pcstackCOMRAM, F, ACCESS
+01A0 D003 BRA 0x1A8
+01A2 90D8 BCF STATUS, 0, ACCESS
+01A4 3624 RLCF 0x24, F, ACCESS
+01A6 3625 RLCF 0x25, F, ACCESS
+01A8 2E23 DECFSZ __pcstackCOMRAM, F, ACCESS
+01AA D7FB BRA 0x1A2
+01AC 5024 MOVF 0x24, W, ACCESS
+01AE 1201 IORWF keypresses, F, ACCESS
+01B0 5025 MOVF 0x25, W, ACCESS
+01B2 1202 IORWF 0x2, F, ACCESS
+125: }
+126:
+127: if (!(keypresses & (1<<(i + 8)))) {
+01B4 C042 MOVFF i, __pcstackCOMRAM
+01B6 F023 NOP
+01B8 0E08 MOVLW 0x8
+01BA 2623 ADDWF __pcstackCOMRAM, F, ACCESS
+01BC 0E01 MOVLW 0x1
+01BE 6E24 MOVWF 0x24, ACCESS
+01C0 0E00 MOVLW 0x0
+01C2 6E25 MOVWF 0x25, ACCESS
+01C4 2A23 INCF __pcstackCOMRAM, F, ACCESS
+01C6 D003 BRA 0x1CE
+01C8 90D8 BCF STATUS, 0, ACCESS
+01CA 3624 RLCF 0x24, F, ACCESS
+01CC 3625 RLCF 0x25, F, ACCESS
+01CE 2E23 DECFSZ __pcstackCOMRAM, F, ACCESS
+01D0 D7FB BRA 0x1C8
+01D2 5001 MOVF keypresses, W, ACCESS
+01D4 1624 ANDWF 0x24, F, ACCESS
+01D6 5002 MOVF 0x2, W, ACCESS
+01D8 1625 ANDWF 0x25, F, ACCESS
+01DA 5024 MOVF 0x24, W, ACCESS
+01DC 1025 IORWF 0x25, W, ACCESS
+01DE A4D8 BTFSS STATUS, 2, ACCESS
+01E0 D03F BRA 0x260
+128: keypresses |= (keys_data[i + 8] && !(keys_data[i + 8] & NOTE_MASK))<<(i + 8);
+01E2 0E00 MOVLW 0x0
+01E4 6E40 MOVWF 0x40, ACCESS
+01E6 5042 MOVF i, W, ACCESS
+01E8 6E23 MOVWF __pcstackCOMRAM, ACCESS
+01EA 6A24 CLRF 0x24, ACCESS
+01EC 90D8 BCF STATUS, 0, ACCESS
+01EE 3623 RLCF __pcstackCOMRAM, F, ACCESS
+01F0 3624 RLCF 0x24, F, ACCESS
+01F2 0E10 MOVLW 0x10
+01F4 2623 ADDWF __pcstackCOMRAM, F, ACCESS
+01F6 0E00 MOVLW 0x0
+01F8 2224 ADDWFC 0x24, F, ACCESS
+01FA 0E03 MOVLW 0x3
+01FC 2423 ADDWF __pcstackCOMRAM, W, ACCESS
+01FE 6ED9 MOVWF FSR2, ACCESS
+0200 0E00 MOVLW 0x0
+0202 2024 ADDWFC 0x24, W, ACCESS
+0204 6EDA MOVWF FSR2H, ACCESS
+0206 50DE MOVF POSTINC2, W, ACCESS
+0208 10DE IORWF POSTINC2, W, ACCESS
+020A B4D8 BTFSC STATUS, 2, ACCESS
+020C D017 BRA 0x23C
+020E 5042 MOVF i, W, ACCESS
+0210 6E23 MOVWF __pcstackCOMRAM, ACCESS
+0212 6A24 CLRF 0x24, ACCESS
+0214 90D8 BCF STATUS, 0, ACCESS
+0216 3623 RLCF __pcstackCOMRAM, F, ACCESS
+0218 3624 RLCF 0x24, F, ACCESS
+021A 0E10 MOVLW 0x10
+021C 2623 ADDWF __pcstackCOMRAM, F, ACCESS
+021E 0E00 MOVLW 0x0
+0220 2224 ADDWFC 0x24, F, ACCESS
+0222 0E03 MOVLW 0x3
+0224 2423 ADDWF __pcstackCOMRAM, W, ACCESS
+0226 6ED9 MOVWF FSR2, ACCESS
+0228 0E00 MOVLW 0x0
+022A 2024 ADDWFC 0x24, W, ACCESS
+022C 6EDA MOVWF FSR2H, ACCESS
+022E 52DE MOVF POSTINC2, F, ACCESS
+0230 0EFF MOVLW 0xFF
+0232 14DD ANDWF POSTDEC2, W, ACCESS
+0234 A4D8 BTFSS STATUS, 2, ACCESS
+0236 D002 BRA 0x23C
+0238 0E01 MOVLW 0x1
+023A 6E40 MOVWF 0x40, ACCESS
+023C C042 MOVFF i, __pcstackCOMRAM
+023E F023 NOP
+0240 0E08 MOVLW 0x8
+0242 2623 ADDWF __pcstackCOMRAM, F, ACCESS
+0244 5040 MOVF 0x40, W, ACCESS
+0246 6E24 MOVWF 0x24, ACCESS
+0248 6A25 CLRF 0x25, ACCESS
+024A 2A23 INCF __pcstackCOMRAM, F, ACCESS
+024C D003 BRA 0x254
+024E 90D8 BCF STATUS, 0, ACCESS
+0250 3624 RLCF 0x24, F, ACCESS
+0252 3625 RLCF 0x25, F, ACCESS
+0254 2E23 DECFSZ __pcstackCOMRAM, F, ACCESS
+0256 D7FB BRA 0x24E
+0258 5024 MOVF 0x24, W, ACCESS
+025A 1201 IORWF keypresses, F, ACCESS
+025C 5025 MOVF 0x25, W, ACCESS
+025E 1202 IORWF 0x2, F, ACCESS
+129: }
+130: } while (i--);
+0260 0642 DECF i, F, ACCESS
+0262 2842 INCF i, W, ACCESS
+0264 A4D8 BTFSS STATUS, 2, ACCESS
+0266 D6FE BRA 0x64
+131:
+132:
+133: // debug stuff
+134: PORTDbits.RD4 = PORTAbits.RA0;
+0268 A080 BTFSS PORTA, 0, ACCESS
+026A D002 BRA 0x270
+026C 8883 BSF PORTD, 4, ACCESS
+026E D001 BRA 0x272
+0270 9883 BCF PORTD, 4, ACCESS
+135: PORTDbits.RD2 = (keys_data[0] && !(keys_data[0] & NOTE_MASK));
+0272 0E00 MOVLW 0x0
+0274 6E41 MOVWF 0x41, ACCESS
+0276 5003 MOVF keys_data, W, ACCESS
+0278 1004 IORWF 0x4, W, ACCESS
+027A B4D8 BTFSC STATUS, 2, ACCESS
+027C D006 BRA 0x28A
+027E 0EFF MOVLW 0xFF
+0280 1404 ANDWF 0x4, W, ACCESS
+0282 A4D8 BTFSS STATUS, 2, ACCESS
+0284 D002 BRA 0x28A
+0286 0E01 MOVLW 0x1
+0288 6E41 MOVWF 0x41, ACCESS
+028A B041 BTFSC 0x41, 0, ACCESS
+028C D002 BRA 0x292
+028E 9483 BCF PORTD, 2, ACCESS
+0290 D001 BRA 0x294
+0292 8483 BSF PORTD, 2, ACCESS
+136:
+137: // reset interrupt flag
+138: PIR1bits.TMR2IF = 0;
+0294 929E BCF PIR1, 1, ACCESS
+139: }
+140:
+141: PORTDbits.RD3 = 1;
+0296 8683 BSF PORTD, 3, ACCESS
+142: }
+0298 C03C MOVFF 0x3C, 0x48
+029A F048 NOP
+029C C03B MOVFF 0x3B, 0x47
+029E F047 NOP
+02A0 C03A MOVFF 0x3A, 0x46
+02A2 F046 NOP
+02A4 C039 MOVFF 0x39, btemp
+02A6 F045 NOP
+02A8 C038 MOVFF 0x38, TABLAT
+02AA FFF5 NOP
+02AC C037 MOVFF 0x37, TBLPTRU
+02AE FFF8 NOP
+02B0 C036 MOVFF 0x36, TBLPTRH
+02B2 FFF7 NOP
+02B4 C035 MOVFF 0x35, TBLPTR
+02B6 FFF6 NOP
+02B8 C034 MOVFF 0x34, PRODH
+02BA FFF4 NOP
+02BC C033 MOVFF 0x33, PROD
+02BE FFF3 NOP
+02C0 C032 MOVFF 0x32, FSR2H
+02C2 FFDA NOP
+02C4 C031 MOVFF 0x31, FSR2
+02C6 FFD9 NOP
+02C8 C030 MOVFF 0x30, FSR1H
+02CA FFE2 NOP
+02CC C02F MOVFF 0x2F, FSR1
+02CE FFE1 NOP
+02D0 C02E MOVFF 0x2E, FSR0H
+02D2 FFEA NOP
+02D4 C02D MOVFF 0x2D, FSR0
+02D6 FFE9 NOP
+02D8 C02C MOVFF 0x2C, PCLATU
+02DA FFFB NOP
+02DC C02B MOVFF 0x2B, PCLATH
+02DE FFFA NOP
+02E0 9245 BCF btemp, 1, ACCESS
+02E2 0011 RETFIE 1
+143:
+144: /* hardware configuration (inlined) */
+145: inline void init_hw(void)
+146: {
+147: di();
+048A 9EF2 BCF INTCON, 7, ACCESS
+148:
+149: /* PLL / FOSC configuration */
+150: // enable PLL
+151: OSCTUNEbits.PLLEN = 1;
+048C 8C9B BSF OSCTUNE, 6, ACCESS
+152: // set FOSC to HFINTOSC (max frequency)
+153: OSCTUNEbits.TUN = 0b011111;
+048E 809B BSF OSCTUNE, 0, ACCESS
+0490 829B BSF OSCTUNE, 1, ACCESS
+0492 849B BSF OSCTUNE, 2, ACCESS
+0494 869B BSF OSCTUNE, 3, ACCESS
+0496 889B BSF OSCTUNE, 4, ACCESS
+0498 9A9B BCF OSCTUNE, 5, ACCESS
+154: // set 16 MHz oscillator, datasheet p.30
+155: OSCCONbits.IRCF = 0b111;
+049A 88D3 BSF OSCCON, 4, ACCESS
+049C 8AD3 BSF OSCCON, 5, ACCESS
+049E 8CD3 BSF OSCCON, 6, ACCESS
+156: // select primary clock (with PLL)
+157: OSCCONbits.SCS = 0b00;
+04A0 0EFC MOVLW 0xFC
+04A2 16D3 ANDWF OSCCON, F, ACCESS
+158:
+159: /* i/o initializazion */
+160: // disable all ADCs
+161: ANSELA = 0x00;
+04A4 0E00 MOVLW 0x0
+04A6 010F MOVLB 0xF
+04A8 6F38 MOVWF 0x38, BANKED
+162: ANSELB = 0x00;
+04AA 0E00 MOVLW 0x0
+04AC 6F39 MOVWF 0x39, BANKED
+163: ANSELC = 0x00;
+04AE 0E00 MOVLW 0x0
+04B0 6F3A MOVWF 0x3A, BANKED
+164: ANSELD = 0x00;
+04B2 0E00 MOVLW 0x0
+04B4 6F3B MOVWF 0x3B, BANKED
+165:
+166: // TODO: remove demo
+167: TRISA = 0xFF;
+04B6 6892 SETF TRISA, ACCESS
+168: TRISB = 0xFF;
+04B8 6893 SETF TRISB, ACCESS
169:
-170: // LED
-171: PORTDbits.RD1 = 1;
-02E0 8283 BSF PORTD, 1, ACCESS
-172: // TEST OUTPUT 1
-173: PORTDbits.RD2 = 0;
-02E2 9483 BCF PORTD, 2, ACCESS
-174: // TEST OUTPUT 2
-175: PORTDbits.RD3 = 1;
-02E4 8683 BSF PORTD, 3, ACCESS
-176: // TEST OUTPUT 3
-177: PORTDbits.RD4 = 0;
-02E6 9883 BCF PORTD, 4, ACCESS
-178:
-179: /* timer configuration */
-180: // timer 2 comp value
-181: PR2 = 128;
-02E8 0E80 MOVLW 0x80
-02EA 6EBB MOVWF PR2, ACCESS
-182: // postscaler 1:4
-183: T2CONbits.T2OUTPS = 0b0011;
-02EC 50BA MOVF T2CON, W, ACCESS
-02EE 0B87 ANDLW 0x87
-02F0 0918 IORLW 0x18
-02F2 6EBA MOVWF T2CON, ACCESS
-184: // prescaler 1:16
-185: T2CONbits.T2CKPS = 0b11;
-02F4 0E03 MOVLW 0x3
-02F6 12BA IORWF T2CON, F, ACCESS
-186: // start timer
-187: T2CONbits.TMR2ON = 1;
-02F8 84BA BSF T2CON, 2, ACCESS
-188:
-189: // timer 2 interrupts
-190: PIE1bits.TMR2IE = 1;
-02FA 829D BSF PIE1, 1, ACCESS
-191: PIR1bits.TMR2IF = 0;
-02FC 929E BCF PIR1, 1, ACCESS
-192:
-193: // enable peripheral interrupts
-194: INTCONbits.PEIE = 1;
-02FE 8CF2 BSF INTCON, 6, ACCESS
-195:
-196: /* serial configuration */
-197: eusart1_init();
-0300 ECFE CALL 0x3FC, 0
-0302 F001 NOP
-198:
-199: ei();
-0304 8EF2 BSF INTCON, 7, ACCESS
-200: }
-0306 0012 RETURN 0
-201:
-202:
-203: /* main program */
-204: void main(void)
-205: {
-206: unsigned char i, data;
-207: midi_message_t sample_message;
-208:
-209: /* setup hardware */
-210: init_hw();
-0308 EC54 CALL 0x2A8, 0
-030A F001 NOP
-211:
-212: /* setup software */
-213: memset(keypresses, 0, sizeof(keypresses));
-030C 0E25 MOVLW 0x25
-030E 6E1A MOVWF p1, ACCESS
-0310 0E00 MOVLW 0x0
-0312 6E1B MOVWF pkt, ACCESS
+170: TRISDbits.TRISD1 = 0;
+04BA 9295 BCF TRISD, 1, ACCESS
+171: TRISDbits.TRISD2 = 0;
+04BC 9495 BCF TRISD, 2, ACCESS
+172: TRISDbits.TRISD3 = 0;
+04BE 9695 BCF TRISD, 3, ACCESS
+173: TRISDbits.TRISD4 = 0;
+04C0 9895 BCF TRISD, 4, ACCESS
+174:
+175: // LED
+176: PORTDbits.RD1 = 1;
+04C2 8283 BSF PORTD, 1, ACCESS
+177: // TEST OUTPUT 1
+178: PORTDbits.RD2 = 0;
+04C4 9483 BCF PORTD, 2, ACCESS
+179: // TEST OUTPUT 2
+180: PORTDbits.RD3 = 1;
+04C6 8683 BSF PORTD, 3, ACCESS
+181: // TEST OUTPUT 3
+182: PORTDbits.RD4 = 0;
+04C8 9883 BCF PORTD, 4, ACCESS
+183:
+184: /* timer configuration */
+185: // timer 2 comp value
+186: PR2 = 128;
+04CA 0E80 MOVLW 0x80
+04CC 6EBB MOVWF PR2, ACCESS
+187: // postscaler 1:4
+188: T2CONbits.T2OUTPS = 0b0011;
+04CE 50BA MOVF T2CON, W, ACCESS
+04D0 0B87 ANDLW 0x87
+04D2 0918 IORLW 0x18
+04D4 6EBA MOVWF T2CON, ACCESS
+189: // prescaler 1:16
+190: T2CONbits.T2CKPS = 0b11;
+04D6 0E03 MOVLW 0x3
+04D8 12BA IORWF T2CON, F, ACCESS
+191: // start timer
+192: T2CONbits.TMR2ON = 1;
+04DA 84BA BSF T2CON, 2, ACCESS
+193:
+194: // timer 2 interrupts
+195: PIE1bits.TMR2IE = 1;
+04DC 829D BSF PIE1, 1, ACCESS
+196: PIR1bits.TMR2IF = 0;
+04DE 929E BCF PIR1, 1, ACCESS
+197:
+198: // enable peripheral interrupts
+199: INTCONbits.PEIE = 1;
+04E0 8CF2 BSF INTCON, 6, ACCESS
+200:
+201: /* serial configuration */
+202: eusart1_init();
+04E2 ECCC CALL 0x598, 0
+04E4 F002 NOP
+203: }
+04E6 0012 RETURN 0
+204:
+205:
+206: /* main program */
+207: void main(void)
+208: {
+209: uint8_t i;
+210: midi_message_t message;
+211:
+212: /* setup hardware */
+213: init_hw();
+02E8 EC45 CALL 0x48A, 0
+02EA F002 NOP
+214:
+215: /* setup software */
+216: memset(keys_data, 0, sizeof(keys_data));
+02EC 0E03 MOVLW 0x3
+02EE 0100 MOVLB 0x0
+02F0 6F60 MOVWF __pcstackBANK0, BANKED
+02F2 0E00 MOVLW 0x0
+02F4 6F61 MOVWF pkt, BANKED
+02F6 0E00 MOVLW 0x0
+02F8 6F63 MOVWF 0x63, BANKED
+02FA 0E00 MOVLW 0x0
+02FC 6F62 MOVWF c, BANKED
+02FE 0E00 MOVLW 0x0
+0300 6F65 MOVWF pkt, BANKED
+0302 0E20 MOVLW 0x20
+0304 6F64 MOVWF n, BANKED
+0306 EC8D CALL 0x51A, 0
+0308 F002 NOP
+217:
+218: ei();
+030A 8EF2 BSF INTCON, 7, ACCESS
+219:
+220: /* TODO remove demo code */
+221: PORTDbits.RD1 = 0;
+030C 9283 BCF PORTD, 1, ACCESS
+222:
+223: midi_note_on(&message, MIDI_CHANNEL, MIDI_SCALE_START, 0x7F);
+030E 0E71 MOVLW 0x71
+0310 0100 MOVLB 0x0
+0312 6F65 MOVWF pkt, BANKED
0314 0E00 MOVLW 0x0
-0316 6E1D MOVWF 0x1D, ACCESS
+0316 6F66 MOVWF p, BANKED
0318 0E00 MOVLW 0x0
-031A 6E1C MOVWF c, ACCESS
+031A 6F68 MOVWF 0x68, BANKED
031C 0E00 MOVLW 0x0
-031E 6E1F MOVWF pkt, ACCESS
-0320 0E1E MOVLW 0x1E
-0322 6E1E MOVWF n, ACCESS
-0324 ECC3 CALL 0x386, 0
-0326 F001 NOP
-214:
-215: /* TODO remove demo code */
-216: midi_note_on(&sample_message, 0x0, 0x3C, 0x7F);
-0328 0E62 MOVLW 0x62
-032A 6E1F MOVWF pkt, ACCESS
+031E 6F67 MOVWF channel, BANKED
+0320 0E3C MOVLW 0x3C
+0322 6F69 MOVWF note, BANKED
+0324 0E7F MOVLW 0x7F
+0326 6F6A MOVWF velocity, BANKED
+0328 EC12 CALL 0x424, 0
+032A F002 NOP
+224:
+225: /* main loop */
+226: while (1) {
+227: // check flags
+228: for (i = 0; i < NOTES; i++) {
032C 0E00 MOVLW 0x0
-032E 6E20 MOVWF p, ACCESS
-0330 0E00 MOVLW 0x0
-0332 6E22 MOVWF 0x22, ACCESS
-0334 0E00 MOVLW 0x0
-0336 6E21 MOVWF channel, ACCESS
-0338 0E3C MOVLW 0x3C
-033A 6E23 MOVWF note, ACCESS
-033C 0E7F MOVLW 0x7F
-033E 6E24 MOVWF velocity, ACCESS
-0340 ECDE CALL 0x1BC, 0
-0342 F000 NOP
-217: PORTDbits.RD1 = 0;
-0344 9283 BCF PORTD, 1, ACCESS
-218:
-219: /* main loop */
-220: while (1) {
-0352 D7F9 BRA 0x346
-221: eusart_write_midi(&sample_message);
-0346 0E62 MOVLW 0x62
-0348 6E1B MOVWF pkt, ACCESS
-034A 0E00 MOVLW 0x0
-034C 6E1C MOVWF c, ACCESS
-034E EC1A CALL 0x234, 0
-0350 F001 NOP
-0352 D7F9 BRA 0x346
-222: }
-223: }
-224:
-225:
-226: int eusart_write_midi(const midi_message_t *pkt)
-227: {
-228: size_t length;
-229: uint8_t *data;
-230:
-231: if (pkt == NULL) {
-0234 501B MOVF pkt, W, ACCESS
-0236 101C IORWF c, W, ACCESS
-0238 B4D8 BTFSC STATUS, 2, ACCESS
-023A 0012 RETURN 0
-232: return -1;
-233: }
-234:
-235: length = pkt->data_size;
-023C EE20 LFSR 2, 0x1
-023E F001 NOP
-0240 501B MOVF pkt, W, ACCESS
-0242 26D9 ADDWF FSR2, F, ACCESS
-0244 501C MOVF c, W, ACCESS
-0246 22DA ADDWFC FSR2H, F, ACCESS
-0248 CFDE MOVFF POSTINC2, pkt
-024A F01F NOP
-024C CFDD MOVFF POSTDEC2, p
-024E F020 NOP
-236: data = (uint8_t *) pkt->data;
-0250 0E03 MOVLW 0x3
-0252 241B ADDWF pkt, W, ACCESS
-0254 6E21 MOVWF channel, ACCESS
-0256 0E00 MOVLW 0x0
-0258 201C ADDWFC c, W, ACCESS
-025A 6E22 MOVWF 0x22, ACCESS
-237:
-238: putch((char)((pkt->status << 4) | pkt->channel));
-025C C01B MOVFF pkt, FSR2
-025E FFD9 NOP
-0260 C01C MOVFF c, FSR2H
-0262 FFDA NOP
-0264 38DF SWAPF INDF2, W, ACCESS
-0266 0B0F ANDLW 0xF
-0268 6E1D MOVWF 0x1D, ACCESS
-026A C01B MOVFF pkt, FSR2
-026C FFD9 NOP
-026E C01C MOVFF c, FSR2H
-0270 FFDA NOP
-0272 50DF MOVF INDF2, W, ACCESS
-0274 0B0F ANDLW 0xF
-0276 6E1E MOVWF n, ACCESS
-0278 381E SWAPF n, W, ACCESS
-027A 0BF0 ANDLW 0xF0
-027C 101D IORWF 0x1D, W, ACCESS
-027E EC0C CALL 0x418, 0
-0280 F002 NOP
-239:
-240: while (length--) {
-0282 D009 BRA 0x296
-241: putch((char) *(data++));
-0284 C021 MOVFF channel, FSR2
-0286 FFD9 NOP
-0288 C022 MOVFF 0x22, FSR2H
-028A FFDA NOP
-028C 50DF MOVF INDF2, W, ACCESS
-028E EC0C CALL 0x418, 0
-0290 F002 NOP
-0292 4A21 INFSNZ channel, F, ACCESS
-0294 2A22 INCF 0x22, F, ACCESS
-242: }
-0296 061F DECF pkt, F, ACCESS
-0298 A0D8 BTFSS STATUS, 0, ACCESS
-029A 0620 DECF p, F, ACCESS
-029C 281F INCF pkt, W, ACCESS
-029E E1F2 BNZ 0x284
-02A0 2820 INCF p, W, ACCESS
-02A2 B4D8 BTFSC STATUS, 2, ACCESS
-02A4 0012 RETURN 0
-02A6 D7EE BRA 0x284
-243:
-244: return 0;
-245: }
+032E 0100 MOVLB 0x0
+0330 6F70 MOVWF i, BANKED
+0332 0E0F MOVLW 0xF
+0334 6570 CPFSGT i, BANKED
+0336 D001 BRA 0x33A
+0338 D7F9 BRA 0x32C
+229: if (keypresses & (1<<i)) {
+033A C070 MOVFF i, 0x6B
+033C F06B NOP
+033E 0E01 MOVLW 0x1
+0340 6F6C MOVWF 0x6C, BANKED
+0342 0E00 MOVLW 0x0
+0344 6F6D MOVWF 0x6D, BANKED
+0346 2B6B INCF 0x6B, F, BANKED
+0348 D003 BRA 0x350
+034A 90D8 BCF STATUS, 0, ACCESS
+034C 376C RLCF 0x6C, F, BANKED
+034E 376D RLCF 0x6D, F, BANKED
+0350 2F6B DECFSZ 0x6B, F, BANKED
+0352 D7FB BRA 0x34A
+0354 5001 MOVF keypresses, W, ACCESS
+0356 0100 MOVLB 0x0
+0358 176C ANDWF 0x6C, F, BANKED
+035A 5002 MOVF 0x2, W, ACCESS
+035C 176D ANDWF 0x6D, F, BANKED
+035E 516C MOVF 0x6C, W, BANKED
+0360 116D IORWF 0x6D, W, BANKED
+0362 B4D8 BTFSC STATUS, 2, ACCESS
+0364 D020 BRA 0x3A6
+230:
+231: message.data[0] = MIDI_SCALE_START + i;
+0366 5170 MOVF i, W, BANKED
+0368 0F3C ADDLW 0x3C
+036A 6F74 MOVWF 0x74, BANKED
+232: // midi_note_on(&message, MIDI_CHANNEL, MIDI_SCALE_START + i, 0x7F);
+233:
+234: eusart_write_midi(&message);
+036C 0E71 MOVLW 0x71
+036E 6F61 MOVWF pkt, BANKED
+0370 0E00 MOVLW 0x0
+0372 6F62 MOVWF c, BANKED
+0374 ECD5 CALL 0x3AA, 0
+0376 F001 NOP
+235:
+236: // unset flag
+237: keypresses &= ~(1<<i);
+0378 C070 MOVFF i, 0x6B
+037A F06B NOP
+037C 0E01 MOVLW 0x1
+037E 0100 MOVLB 0x0
+0380 6F6C MOVWF 0x6C, BANKED
+0382 0E00 MOVLW 0x0
+0384 6F6D MOVWF 0x6D, BANKED
+0386 2B6B INCF 0x6B, F, BANKED
+0388 D003 BRA 0x390
+038A 90D8 BCF STATUS, 0, ACCESS
+038C 376C RLCF 0x6C, F, BANKED
+038E 376D RLCF 0x6D, F, BANKED
+0390 2F6B DECFSZ 0x6B, F, BANKED
+0392 D7FB BRA 0x38A
+0394 0100 MOVLB 0x0
+0396 1D6C COMF 0x6C, W, BANKED
+0398 6F6E MOVWF 0x6E, BANKED
+039A 1D6D COMF 0x6D, W, BANKED
+039C 6F6F MOVWF 0x6F, BANKED
+039E 516E MOVF 0x6E, W, BANKED
+03A0 1601 ANDWF keypresses, F, ACCESS
+03A2 516F MOVF 0x6F, W, BANKED
+03A4 1602 ANDWF 0x2, F, ACCESS
+238: }
+03A6 2B70 INCF i, F, BANKED
+03A8 D7C4 BRA 0x332
+239: }
+240: }
+241: }
+242:
+243:
+244: int eusart_write_midi(const midi_message_t *pkt)
+245: {
+246: size_t length;
+247: uint8_t *data;
+248:
+249: if (pkt == NULL) {
+03AA 0100 MOVLB 0x0
+03AC 5161 MOVF pkt, W, BANKED
+03AE 1162 IORWF c, W, BANKED
+03B0 B4D8 BTFSC STATUS, 2, ACCESS
+03B2 0012 RETURN 0
+250: return -1;
+251: }
+252:
+253: length = pkt->data_size;
+03B4 EE20 LFSR 2, 0x1
+03B6 F001 NOP
+03B8 5161 MOVF pkt, W, BANKED
+03BA 26D9 ADDWF FSR2, F, ACCESS
+03BC 5162 MOVF c, W, BANKED
+03BE 22DA ADDWFC FSR2H, F, ACCESS
+03C0 CFDE MOVFF POSTINC2, pkt
+03C2 F065 NOP
+03C4 CFDD MOVFF POSTDEC2, p
+03C6 F066 NOP
+254: data = (uint8_t *) pkt->data;
+03C8 0E03 MOVLW 0x3
+03CA 2561 ADDWF pkt, W, BANKED
+03CC 6F67 MOVWF channel, BANKED
+03CE 0E00 MOVLW 0x0
+03D0 2162 ADDWFC c, W, BANKED
+03D2 6F68 MOVWF 0x68, BANKED
+255:
+256: putch((char)((pkt->status << 4) | pkt->channel));
+03D4 C061 MOVFF pkt, FSR2
+03D6 FFD9 NOP
+03D8 C062 MOVFF c, FSR2H
+03DA FFDA NOP
+03DC 38DF SWAPF INDF2, W, ACCESS
+03DE 0B0F ANDLW 0xF
+03E0 6F63 MOVWF 0x63, BANKED
+03E2 C061 MOVFF pkt, FSR2
+03E4 FFD9 NOP
+03E6 C062 MOVFF c, FSR2H
+03E8 FFDA NOP
+03EA 50DF MOVF INDF2, W, ACCESS
+03EC 0B0F ANDLW 0xF
+03EE 6F64 MOVWF n, BANKED
+03F0 3964 SWAPF n, W, BANKED
+03F2 0BF0 ANDLW 0xF0
+03F4 1163 IORWF 0x63, W, BANKED
+03F6 ECDA CALL 0x5B4, 0
+03F8 F002 NOP
+257:
+258: while (length--) {
+03FA D00A BRA 0x410
+259: putch((char) *(data++));
+03FC C067 MOVFF channel, FSR2
+03FE FFD9 NOP
+0400 C068 MOVFF 0x68, FSR2H
+0402 FFDA NOP
+0404 50DF MOVF INDF2, W, ACCESS
+0406 ECDA CALL 0x5B4, 0
+0408 F002 NOP
+040A 0100 MOVLB 0x0
+040C 4B67 INFSNZ channel, F, BANKED
+040E 2B68 INCF 0x68, F, BANKED
+260: }
+0410 0100 MOVLB 0x0
+0412 0765 DECF pkt, F, BANKED
+0414 A0D8 BTFSS STATUS, 0, ACCESS
+0416 0766 DECF p, F, BANKED
+0418 2965 INCF pkt, W, BANKED
+041A E1F0 BNZ 0x3FC
+041C 2966 INCF p, W, BANKED
+041E B4D8 BTFSC STATUS, 2, ACCESS
+0420 0012 RETURN 0
+0422 D7EC BRA 0x3FC
+261:
+262: return 0;
+263: }
--- C:/Program Files/Microchip/xc8/v1.44/sources/common/memset.c --------------------------------------
1: #include <string.h>
2:
@@ -902,30 +1128,32 @@ Z:/SAMB_4/projects/xilofono/src/dist/default/production/src.production.elf
16: #endif /* _PIC16 */
17:
18: p = p1;
-0386 C01A MOVFF p1, p
-0388 F020 NOP
-038A C01B MOVFF pkt, channel
-038C F021 NOP
+051A C060 MOVFF __pcstackBANK0, p
+051C F066 NOP
+051E C061 MOVFF pkt, channel
+0520 F067 NOP
19: while(n--)
-038E D008 BRA 0x3A0
-03A0 061E DECF n, F, ACCESS
+0522 D009 BRA 0x536
+0536 0100 MOVLB 0x0
20: *p++ = c;
-0390 C020 MOVFF p, FSR2
-0392 FFD9 NOP
-0394 C021 MOVFF channel, FSR2H
-0396 FFDA NOP
-0398 C01C MOVFF c, INDF2
-039A FFDF NOP
-039C 4A20 INFSNZ p, F, ACCESS
-039E 2A21 INCF channel, F, ACCESS
-03A0 061E DECF n, F, ACCESS
-03A2 A0D8 BTFSS STATUS, 0, ACCESS
-03A4 061F DECF pkt, F, ACCESS
-03A6 281E INCF n, W, ACCESS
-03A8 E1F3 BNZ 0x390
-03AA 281F INCF pkt, W, ACCESS
-03AC B4D8 BTFSC STATUS, 2, ACCESS
-03AE 0012 RETURN 0
-03B0 D7EF BRA 0x390
+0524 C066 MOVFF p, FSR2
+0526 FFD9 NOP
+0528 C067 MOVFF channel, FSR2H
+052A FFDA NOP
+052C C062 MOVFF c, INDF2
+052E FFDF NOP
+0530 0100 MOVLB 0x0
+0532 4B66 INFSNZ p, F, BANKED
+0534 2B67 INCF channel, F, BANKED
+0536 0100 MOVLB 0x0
+0538 0764 DECF n, F, BANKED
+053A A0D8 BTFSS STATUS, 0, ACCESS
+053C 0765 DECF pkt, F, BANKED
+053E 2964 INCF n, W, BANKED
+0540 E1F1 BNZ 0x524
+0542 2965 INCF pkt, W, BANKED
+0544 B4D8 BTFSC STATUS, 2, ACCESS
+0546 0012 RETURN 0
+0548 D7ED BRA 0x524
21: return p1;
22: }