wip
This commit is contained in:
parent
d69b2245b8
commit
9418eb843c
@ -45,6 +45,7 @@ namespace cursor {
|
|||||||
float dy = static_cast<float>(data.analog_coordinate_axis[3] - 0x80) * 0.015;
|
float dy = static_cast<float>(data.analog_coordinate_axis[3] - 0x80) * 0.015;
|
||||||
state[port_ix].x += dx;
|
state[port_ix].x += dx;
|
||||||
state[port_ix].y += dy;
|
state[port_ix].y += dy;
|
||||||
|
|
||||||
state[port_ix].a = ft0::data_transfer::digital_button::a(data.digital_button) == 0;
|
state[port_ix].a = ft0::data_transfer::digital_button::a(data.digital_button) == 0;
|
||||||
state[port_ix].b = ft0::data_transfer::digital_button::b(data.digital_button) == 0;
|
state[port_ix].b = ft0::data_transfer::digital_button::b(data.digital_button) == 0;
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,10 @@ void graphics_cursor(ta_multiwriter& multi)
|
|||||||
para_control::list_type::opaque,
|
para_control::list_type::opaque,
|
||||||
tsp_instruction_word::dst_alpha_instr::zero);
|
tsp_instruction_word::dst_alpha_instr::zero);
|
||||||
|
|
||||||
const cursor::cursor& c = cursor::state[0];
|
for (int i = 0; i < 4; i++) {
|
||||||
|
const cursor::cursor& c = cursor::state[i];
|
||||||
|
if (!c.active)
|
||||||
|
continue;
|
||||||
|
|
||||||
quad_type_0(multi.op,
|
quad_type_0(multi.op,
|
||||||
{c.x - 1, c.y - 1, 10},
|
{c.x - 1, c.y - 1, 10},
|
||||||
@ -134,6 +137,7 @@ void graphics_cursor(ta_multiwriter& multi)
|
|||||||
{c.x + 1, c.y + 1, 10},
|
{c.x + 1, c.y + 1, 10},
|
||||||
{c.x - 1, c.y + 1, 10},
|
{c.x - 1, c.y + 1, 10},
|
||||||
0xffffff);
|
0xffffff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_event(ta_multiwriter& multi)
|
void graphics_event(ta_multiwriter& multi)
|
||||||
|
|||||||
@ -208,6 +208,9 @@ void execute_line(int line_index)
|
|||||||
|
|
||||||
void interrupt()
|
void interrupt()
|
||||||
{
|
{
|
||||||
|
if (state.paused)
|
||||||
|
return;
|
||||||
|
|
||||||
state.interrupt_clock += 1;
|
state.interrupt_clock += 1;
|
||||||
// execute keyons
|
// execute keyons
|
||||||
for (int ch = 0; ch < 64; ch++) {
|
for (int ch = 0; ch < 64; ch++) {
|
||||||
@ -298,4 +301,20 @@ void init(float clock_multiplier)
|
|||||||
printf("tick_rate %d\n", state.tick_rate);
|
printf("tick_rate %d\n", state.tick_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pause()
|
||||||
|
{
|
||||||
|
state.tmp_paused = state.paused;
|
||||||
|
state.paused = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void unpause()
|
||||||
|
{
|
||||||
|
state.paused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void resume()
|
||||||
|
{
|
||||||
|
state.paused = state.tmp_paused;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,8 @@ struct interpreter_state {
|
|||||||
int pattern_index;
|
int pattern_index;
|
||||||
int line_index;
|
int line_index;
|
||||||
int next_line_index; // within the current pattern
|
int next_line_index; // within the current pattern
|
||||||
|
bool paused;
|
||||||
|
bool tmp_paused;
|
||||||
|
|
||||||
struct xm_state xm;
|
struct xm_state xm;
|
||||||
|
|
||||||
@ -30,5 +32,7 @@ struct interpreter_state {
|
|||||||
extern struct interpreter_state state;
|
extern struct interpreter_state state;
|
||||||
void interrupt();
|
void interrupt();
|
||||||
void init(float clock_multiplier);
|
void init(float clock_multiplier);
|
||||||
|
void pause();
|
||||||
|
void unpause();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/main.cpp
24
src/main.cpp
@ -9,9 +9,6 @@
|
|||||||
#include "cursor.hpp"
|
#include "cursor.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
|
|
||||||
#include "xm/milkypack01.xm.h"
|
|
||||||
#include "xm.h"
|
|
||||||
|
|
||||||
void vbr100()
|
void vbr100()
|
||||||
{
|
{
|
||||||
serial::string("vbr100\n");
|
serial::string("vbr100\n");
|
||||||
@ -59,24 +56,6 @@ void vbr600()
|
|||||||
asm volatile ("ldc %0,sr" : : "r" (sr));
|
asm volatile ("ldc %0,sr" : : "r" (sr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_xm(float clock_multiplier)
|
|
||||||
{
|
|
||||||
using namespace interpreter;
|
|
||||||
|
|
||||||
int buf = (int)&_binary_xm_milkypack01_xm_start;
|
|
||||||
|
|
||||||
static uint8_t __attribute__((aligned(32))) sample_data[1024 * 1024 * 2];
|
|
||||||
const int sample_data_length = (sizeof (sample_data));
|
|
||||||
|
|
||||||
int sample_data_ix = xm_init(&state.xm,
|
|
||||||
buf,
|
|
||||||
sample_data,
|
|
||||||
sample_data_length);
|
|
||||||
interpreter::init(clock_multiplier);
|
|
||||||
sound::transfer(sample_data, sample_data_ix);
|
|
||||||
printf("tick_rate %d\n", state.tick_rate);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "memorymap.hpp"
|
#include "memorymap.hpp"
|
||||||
#include "holly/texture_memory_alloc9.hpp"
|
#include "holly/texture_memory_alloc9.hpp"
|
||||||
#include "holly/holly.hpp"
|
#include "holly/holly.hpp"
|
||||||
@ -119,9 +98,6 @@ void main()
|
|||||||
input::state_init();
|
input::state_init();
|
||||||
cursor::init();
|
cursor::init();
|
||||||
|
|
||||||
const float aica_clock_multiplier = 44.1;
|
|
||||||
load_xm(aica_clock_multiplier);
|
|
||||||
|
|
||||||
//test_pattern();
|
//test_pattern();
|
||||||
|
|
||||||
interrupt_init();
|
interrupt_init();
|
||||||
|
|||||||
34
src/playlist.cpp
Normal file
34
src/playlist.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "xm.h"
|
||||||
|
#include "xm/milkypack01.xm.h"
|
||||||
|
|
||||||
|
const float aica_clock_multiplier = 44.1;
|
||||||
|
|
||||||
|
namespace playlist {
|
||||||
|
|
||||||
|
static playlist_item playlist[] = {
|
||||||
|
{
|
||||||
|
"milkypack01"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void load_xm(float clock_multiplier, int buf)
|
||||||
|
{
|
||||||
|
using namespace interpreter;
|
||||||
|
|
||||||
|
static uint8_t __attribute__((aligned(32))) sample_data[1024 * 1024 * 2];
|
||||||
|
const int sample_data_length = (sizeof (sample_data));
|
||||||
|
|
||||||
|
interpreter::pause();
|
||||||
|
|
||||||
|
int sample_data_ix = xm_init(&state.xm,
|
||||||
|
buf,
|
||||||
|
sample_data,
|
||||||
|
sample_data_length);
|
||||||
|
interpreter::init(clock_multiplier);
|
||||||
|
sound::transfer(sample_data, sample_data_ix);
|
||||||
|
//printf("tick_rate %d\n", state.tick_rate);
|
||||||
|
|
||||||
|
interpreter::resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/playlist.hpp
Normal file
6
src/playlist.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace playlist {
|
||||||
|
struct playlist_item {
|
||||||
|
const char * const name;
|
||||||
|
const int start;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user