source: thomson/code/C/meatracker/main.c@ 90b6d4b

main
Last change on this file since 90b6d4b was 90b6d4b, checked in by Adrien Destugues <pulkomandy@…>, 11 years ago

Work on MEATrakcer continues with some input and cursor handling.

git-svn-id: svn://localhost/thomson@44 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/* MEA Tracker
2 * Copyright 2013, Adrien Destugues <pulkomandy@pulkomandy.tk>
3 *
4 * This file is distributed under the terms of the MIT licence.
5 */
6
7#include "display.h"
8#include "input.h"
9
10volatile unsigned char* MEA_DATA = (unsigned char*)0xA7CE;
11extern unsigned char music[8][16];
12
13uint8_t isplaying = 1;
14
15int main(void)
16{
17 asm(" ORCC #$50"); // Disable interrupts (cursor blink)
18 refreshchannels();
19
20
21 for(int frame = 0;;frame++)
22 {
23 if((frame & 0x3) == 0)
24 input();
25
26 if(isplaying)
27 {
28 /*
29 *MEA_DATA = music[0][frame & 0xF];
30 *MEA_DATA = music[1][frame & 0xF];
31 *MEA_DATA = music[2][frame & 0xF];
32 *MEA_DATA = music[3][frame & 0xF];
33 */
34
35 *(MEA_DATA + 1) = 0x12;
36 *MEA_DATA = 110;
37
38 // BW
39 *MEA_DATA = (music[1][frame & 0xF] << 6) |
40 (music[3][frame & 0xF] << 4) |
41 (music[5][frame & 0xF] << 2) |
42 (music[7][frame & 0xF]);
43
44 // FREQ
45 *MEA_DATA = (music[2][frame & 0xF] << 5) |
46 (music[4][frame & 0xF]);
47
48 // FREQ / AMPL
49 *MEA_DATA = (music[0][frame & 0xF] << 3) | 0xF; // TODO AMPL
50
51 // AMPL / DUR / PERIODCHANGE
52 *MEA_DATA = 0xD1; // TODO AMPL / DUR / PERIODCHANGE
53 }
54
55 asm("\n"
56"z TST 0xA7E7 \n"
57" BMI z \n"
58"bb TST 0xA7E7 \n"
59" BPL bb \n"
60 );
61 }
62
63 return 0;
64}
Note: See TracBrowser for help on using the repository browser.