This commit is contained in:
Zack Buhman 2025-06-29 12:11:59 -05:00
parent d69b2245b8
commit 9418eb843c
7 changed files with 75 additions and 31 deletions

View File

@ -45,6 +45,7 @@ namespace cursor {
float dy = static_cast<float>(data.analog_coordinate_axis[3] - 0x80) * 0.015;
state[port_ix].x += dx;
state[port_ix].y += dy;
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;

View File

@ -126,14 +126,18 @@ void graphics_cursor(ta_multiwriter& multi)
para_control::list_type::opaque,
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,
{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);
quad_type_0(multi.op,
{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);
}
}
void graphics_event(ta_multiwriter& multi)

View File

@ -208,6 +208,9 @@ void execute_line(int line_index)
void interrupt()
{
if (state.paused)
return;
state.interrupt_clock += 1;
// execute keyons
for (int ch = 0; ch < 64; ch++) {
@ -298,4 +301,20 @@ void init(float clock_multiplier)
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;
}
}

View File

@ -21,6 +21,8 @@ struct interpreter_state {
int pattern_index;
int line_index;
int next_line_index; // within the current pattern
bool paused;
bool tmp_paused;
struct xm_state xm;
@ -30,5 +32,7 @@ struct interpreter_state {
extern struct interpreter_state state;
void interrupt();
void init(float clock_multiplier);
void pause();
void unpause();
}

View File

@ -9,9 +9,6 @@
#include "cursor.hpp"
#include "input.hpp"
#include "xm/milkypack01.xm.h"
#include "xm.h"
void vbr100()
{
serial::string("vbr100\n");
@ -59,24 +56,6 @@ void vbr600()
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 "holly/texture_memory_alloc9.hpp"
#include "holly/holly.hpp"
@ -119,9 +98,6 @@ void main()
input::state_init();
cursor::init();
const float aica_clock_multiplier = 44.1;
load_xm(aica_clock_multiplier);
//test_pattern();
interrupt_init();

34
src/playlist.cpp Normal file
View 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
View File

@ -0,0 +1,6 @@
namespace playlist {
struct playlist_item {
const char * const name;
const int start;
};
}