mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 00:02:16 +00:00
atari8: tweaks to common lib, added duty-cycling music player from vcslib
This commit is contained in:
1 parent
5f75ee481d
commit
8aa2ac3ad6
5 files changed
+65
-133
No files matched your search
+33
-79
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <6502.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
/* Target-specific display-list / NMI vector locations. The 5200 BIOS
|
||||
@@ -46,9 +47,15 @@
|
||||
/* Display list builder */
|
||||
/*==========================================================================*/
|
||||
|
||||
/* Extra room lets us page-align the list at runtime (cc65 has no
|
||||
aligned attribute). ANTIC lists are happiest on a page boundary. */
|
||||
static byte a8_dlist_store[A8_DLIST_MAX + 0x100 + 4];
|
||||
/* Make sure this array doesn't cross a 1K boundary */
|
||||
/* we really should use a custom .cfg file with the align attribute */
|
||||
/* but let's just put it here and maybe no one will notice */
|
||||
#if defined(__ATARI5200__)
|
||||
static byte* a8_dlist_store = (byte*)0x1700;
|
||||
#else
|
||||
static byte* a8_dlist_store = (byte*)0x9700;
|
||||
#endif
|
||||
|
||||
byte* a8_dlist;
|
||||
byte a8_dlist_len;
|
||||
byte a8_dli_count;
|
||||
@@ -62,7 +69,7 @@ static void a8_set_dmactl(byte v) {
|
||||
}
|
||||
|
||||
void a8_dlist_reset(void) {
|
||||
a8_dlist = (byte*)(((word)a8_dlist_store + 0xff) & 0xff00);
|
||||
a8_dlist = a8_dlist_store;
|
||||
a8_dlist_len = 0;
|
||||
a8_dli_count = 0;
|
||||
a8_dli_lines = 1;
|
||||
@@ -70,8 +77,7 @@ void a8_dlist_reset(void) {
|
||||
}
|
||||
|
||||
void a8_dlist_byte(byte b) {
|
||||
if (a8_dlist_len < A8_DLIST_MAX)
|
||||
a8_dlist[a8_dlist_len++] = b;
|
||||
a8_dlist[a8_dlist_len++] = b;
|
||||
}
|
||||
|
||||
void a8_dlist_blank(byte n) {
|
||||
@@ -156,20 +162,18 @@ static volatile byte* const a8_dli_regs[A8_REG_COUNT] = {
|
||||
};
|
||||
|
||||
void a8_dli_clear(void) {
|
||||
byte i, j;
|
||||
for (i = 0; i < A8_DLI_LINES; i++)
|
||||
for (j = 0; j < A8_DLI_WRITES; j++)
|
||||
a8_dli_tab[i][j * 2] = 0xff;
|
||||
memset(a8_dli_tab, 0xff, sizeof(a8_dli_tab));
|
||||
a8_dli_line = 0;
|
||||
}
|
||||
|
||||
void a8_dli_set(byte line, byte reg, byte val) {
|
||||
byte j;
|
||||
byte* dli_line = a8_dli_tab[line];
|
||||
if (line >= A8_DLI_LINES || reg >= A8_REG_COUNT) return;
|
||||
for (j = 0; j < A8_DLI_WRITES; j++) {
|
||||
if (a8_dli_tab[line][j * 2] == 0xff) {
|
||||
a8_dli_tab[line][j * 2] = reg;
|
||||
a8_dli_tab[line][j * 2 + 1] = val;
|
||||
if (dli_line[j * 2] == 0xff) {
|
||||
dli_line[j * 2] = reg;
|
||||
dli_line[j * 2 + 1] = val;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -192,6 +196,8 @@ void a8_dli_dispatch(void) {
|
||||
w += 2;
|
||||
}
|
||||
if (++a8_dli_line >= a8_dli_lines) a8_dli_line = 0;
|
||||
// the more often we call this, the more accurate the notes
|
||||
music_duty();
|
||||
}
|
||||
|
||||
void a8_dli_install(void) {
|
||||
@@ -210,7 +216,11 @@ void a8_dli_remove(void) {
|
||||
/*==========================================================================*/
|
||||
|
||||
/* Need 2K for a single-line P/M area, plus up to 2K of alignment slack. */
|
||||
static byte a8_pmg_store[0x800 + 0x7ff];
|
||||
#if defined(__ATARI5200__)
|
||||
static byte* a8_pmg_store = (byte*)0x1800;
|
||||
#else
|
||||
static byte* a8_pmg_store = (byte*)0x9800;
|
||||
#endif
|
||||
static byte* a8_pmg_base;
|
||||
static byte a8_pmg_mode;
|
||||
|
||||
@@ -234,13 +244,14 @@ void a8_pmg_clear(void) {
|
||||
void a8_pmg_init(byte mode) {
|
||||
word i;
|
||||
a8_pmg_mode = mode;
|
||||
a8_pmg_base = (byte*)(((word)a8_pmg_store + 0x7ff) & 0xf800);
|
||||
a8_pmg_base = a8_pmg_store;
|
||||
a8_pmg_clear();
|
||||
GTIA_WRITE.gractl = 0; /* disable while we set up */
|
||||
ANTIC.pmbase = (byte)((word)a8_pmg_base >> 8);
|
||||
a8_dmactl_val = (a8_dmactl_val & ~0x1c) | 0x0c | (mode & 0x10);
|
||||
a8_set_dmactl(a8_dmactl_val);
|
||||
GTIA_WRITE.gractl = GRACTL_PLAYERS | GRACTL_MISSLES;
|
||||
GTIA_WRITE.prior = PRIOR_P03_PF03;
|
||||
for (i = 0; i < 4; i++)
|
||||
a8_pmg_set_color(i, (byte)(0x10 + i * 0x20));
|
||||
}
|
||||
@@ -297,23 +308,6 @@ void a8_pmg_clear_collisions(void) {
|
||||
/* POKEY */
|
||||
/*==========================================================================*/
|
||||
|
||||
/* AUDF values for the 15 kHz clock, notes C1 (0) .. C6 (60+) .. up.
|
||||
MIDI 24 + index; index 45 = A4. */
|
||||
const byte a8_pokey_notes[64] = {
|
||||
239, 226, 213, 201, 190, 179, 169, 159,
|
||||
150, 142, 134, 126, 119, 112, 106, 100,
|
||||
94, 89, 84, 79, 75, 70, 66, 63,
|
||||
59, 56, 52, 49, 47, 44, 41, 39,
|
||||
37, 35, 33, 31, 29, 27, 26, 24,
|
||||
23, 21, 20, 19, 18, 17, 16, 15,
|
||||
14, 13, 12, 12, 11, 10, 10, 9,
|
||||
8, 8, 7, 7, 7, 6, 6, 5
|
||||
};
|
||||
|
||||
static const A8_Note* a8_seq_song[4];
|
||||
static byte a8_seq_ticks[4];
|
||||
static byte a8_seq_ctrl[4];
|
||||
static byte a8_seq_vol[4];
|
||||
static byte a8_irq_stack[128];
|
||||
|
||||
void a8_pokey_init(void) {
|
||||
@@ -328,10 +322,6 @@ void a8_pokey_sound(byte chan, byte freq, byte ctrl, byte vol) {
|
||||
p[1] = (byte)(ctrl | (vol & 0x0f));
|
||||
}
|
||||
|
||||
void a8_pokey_note(byte chan, byte note, byte ctrl, byte vol) {
|
||||
a8_pokey_sound(chan, a8_pokey_notes[note & 0x3f], ctrl, vol);
|
||||
}
|
||||
|
||||
void a8_pokey_stop(byte chan) {
|
||||
((byte*)&POKEY_WRITE.audc1)[chan << 1] = 0;
|
||||
}
|
||||
@@ -341,57 +331,21 @@ void a8_pokey_stop_all(void) {
|
||||
for (i = 0; i < 4; i++) a8_pokey_stop(i);
|
||||
}
|
||||
|
||||
void a8_pokey_play(byte chan, const A8_Note* song, byte ctrl, byte vol) {
|
||||
a8_seq_song[chan] = song;
|
||||
a8_seq_ticks[chan] = 1;
|
||||
a8_seq_ctrl[chan] = ctrl;
|
||||
a8_seq_vol[chan] = vol;
|
||||
}
|
||||
|
||||
void a8_pokey_tick(void) {
|
||||
byte i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
const A8_Note* s = a8_seq_song[i];
|
||||
if (!s) continue;
|
||||
if (a8_seq_ticks[i] == 0) {
|
||||
byte note = s->note;
|
||||
if (note == 0xff) {
|
||||
a8_seq_song[i] = 0;
|
||||
a8_pokey_stop(i);
|
||||
continue;
|
||||
}
|
||||
a8_pokey_note(i, note, a8_seq_ctrl[i], a8_seq_vol[i]);
|
||||
a8_seq_ticks[i] = s->ticks;
|
||||
a8_seq_song[i] = s + 1;
|
||||
}
|
||||
a8_seq_ticks[i]--;
|
||||
}
|
||||
}
|
||||
|
||||
/* POKEY timer 1 IRQ handler. Timer 1 shares channel 1, so leave that
|
||||
channel silent (and unused) when the IRQ tick is running. */
|
||||
static byte a8_pokey_irq(void) {
|
||||
if (!(POKEY_READ.irqst & IRQEN_TIMER_1)) {
|
||||
a8_pokey_tick();
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
/* called from set_irq() */
|
||||
unsigned char a8_pokey_music_update() {
|
||||
music_tick();
|
||||
music_duty();
|
||||
return IRQ_NOT_HANDLED;
|
||||
}
|
||||
|
||||
void a8_pokey_start_irq(byte rate) {
|
||||
set_irq(a8_pokey_irq, a8_irq_stack, sizeof(a8_irq_stack));
|
||||
POKEY_WRITE.audf1 = rate;
|
||||
POKEY_WRITE.audc1 = 0;
|
||||
POKEY_WRITE.irqen = IRQEN_TIMER_1;
|
||||
POKEY_WRITE.stimer = 0x01;
|
||||
void a8_pokey_music_init(void) {
|
||||
set_irq(a8_pokey_music_update, a8_irq_stack, sizeof(a8_irq_stack));
|
||||
}
|
||||
|
||||
void a8_pokey_stop_irq(void) {
|
||||
POKEY_WRITE.irqen = 0;
|
||||
void a8_pokey_music_done(void) {
|
||||
reset_irq();
|
||||
}
|
||||
|
||||
|
||||
/*==========================================================================*/
|
||||
/* Colors */
|
||||
/*==========================================================================*/
|
||||
|
||||
+10
-21
@@ -52,7 +52,6 @@ typedef unsigned int word;
|
||||
/*==========================================================================*/
|
||||
|
||||
/* Buffer is a runtime-aligned array; use a8_dlist_reset() before building. */
|
||||
#define A8_DLIST_MAX 100
|
||||
extern byte* a8_dlist; /* pointer to the aligned display list */
|
||||
extern byte a8_dlist_len; /* current length in bytes */
|
||||
extern byte a8_dli_count; /* number of DLI bits emitted so far */
|
||||
@@ -167,34 +166,24 @@ void a8_pmg_clear_collisions(void);
|
||||
/* POKEY sound */
|
||||
/*==========================================================================*/
|
||||
|
||||
/* Notes are indexes into a 64-entry table, 0 = C1 ... 45 = A4 ... 63. */
|
||||
#define A8_NOTE_A4 45
|
||||
extern const byte a8_pokey_notes[64];
|
||||
|
||||
void a8_pokey_init(void);
|
||||
/* chan 0..3; freq 0..255 (AUDF); ctrl A8_AUDC_xxx; vol 0..15 */
|
||||
void a8_pokey_sound(byte chan, byte freq, byte ctrl, byte vol);
|
||||
void a8_pokey_note(byte chan, byte note, byte ctrl, byte vol);
|
||||
void a8_pokey_stop(byte chan);
|
||||
void a8_pokey_stop_all(void);
|
||||
|
||||
/* A tiny frame-tick sequencer. A song is a list of {note,ticks}
|
||||
pairs; note 0xFF ends it. Call a8_pokey_tick() once per frame
|
||||
(from your main loop or an IRQ). Tick speed is up to you. */
|
||||
typedef struct {
|
||||
byte note;
|
||||
byte ticks;
|
||||
} A8_Note;
|
||||
|
||||
void a8_pokey_play(byte chan, const A8_Note* song, byte ctrl, byte vol);
|
||||
void a8_pokey_tick(void);
|
||||
|
||||
/* Start POKEY timer 1 and call a8_pokey_tick() from an IRQ.
|
||||
rate ~= 1 + (clock / (2 * ticks_per_second)); 0 uses a default.
|
||||
Requires <6502.h> and the cc65 set_irq() runtime. */
|
||||
void a8_pokey_start_irq(byte rate);
|
||||
void a8_pokey_stop_irq(void);
|
||||
/* Music routines */
|
||||
/* requires //#link pokeymusic.ca65 */
|
||||
void a8_pokey_music_init(void);
|
||||
void a8_pokey_music_done(void);
|
||||
|
||||
void music_tick(void);
|
||||
void music_duty(void);
|
||||
void music_start(const char*);
|
||||
char* music_get_ptr(void);
|
||||
char music_is_done(void);
|
||||
unsigned char music_update(void);
|
||||
|
||||
/*==========================================================================*/
|
||||
/* Colors */
|
||||
|
||||
@@ -4,16 +4,14 @@
|
||||
* Shows off:
|
||||
* - a display list built in RAM with four DLI color bands
|
||||
* - a player/missile sprite that bounces across the screen
|
||||
* - a POKEY melody driven from the main loop
|
||||
*
|
||||
* Build steps (the IDE adds these when you open this file):
|
||||
* //#link "common.c"
|
||||
* //#link "common_irq.s"
|
||||
* - a POKEY melody driven from the vblank interrupt
|
||||
*/
|
||||
|
||||
//#link "common.c"
|
||||
//#link "common_irq.s"
|
||||
//#link "pokeymusic.ca65"
|
||||
|
||||
#include <6502.h>
|
||||
#include "common.h"
|
||||
|
||||
/* 24 rows x 40 columns of text screen codes. */
|
||||
@@ -24,11 +22,9 @@ static const byte ball[8] = {
|
||||
0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x3c, 0x18
|
||||
};
|
||||
|
||||
/* Simple four-note loop; note 0xff ends the song. */
|
||||
static const A8_Note melody[] = {
|
||||
{ A8_NOTE_A4, 6 }, { A8_NOTE_A4 + 4, 6 }, { A8_NOTE_A4 + 7, 6 },
|
||||
{ A8_NOTE_A4 + 4, 6 }, { A8_NOTE_A4 + 2, 6 }, { A8_NOTE_A4 + 5, 12 },
|
||||
{ 0xff, 0 }
|
||||
// MUSIC DATA -- "The Easy Winners" by Scott Joplin
|
||||
static const byte music1[] = {
|
||||
0x2a,0x1e,0x95,0x33,0x27,0x9f,0x31,0x25,0x8a,0x2f,0x23,0x8b,0x2e,0x22,0x89,0x2c,0x20,0x8b,0x2a,0x1e,0x95,0x28,0x1c,0x8a,0x27,0x1b,0x95,0x25,0x19,0x8b,0x23,0x17,0x89,0x22,0x12,0x8b,0x23,0x8a,0x25,0x8b,0x27,0x89,0x28,0x1e,0x8c,0x2a,0x1c,0x89,0x2c,0x1b,0x8c,0x2e,0x19,0x89,0x2f,0x17,0x95,0x27,0x23,0x1e,0x95,0x12,0x95,0x23,0x1e,0x27,0x95,0x2f,0x33,0x17,0x95,0x2f,0x33,0x27,0x94,0x12,0x95,0x33,0x36,0x23,0x95,0x38,0x32,0x17,0x8b,0x33,0x36,0x89,0x1e,0x27,0x23,0x8b,0x38,0x32,0x8a,0x33,0x36,0x12,0x8b,0x32,0x38,0x89,0x36,0x33,0x27,0x95,0x3d,0x37,0x10,0x8b,0x3b,0x38,0x8a,0x20,0x23,0x28,0x8b,0x37,0x3d,0x89,0x38,0x3b,0x10,0x8b,0x37,0x3d,0x8a,0x3b,0x38,0x28,0x8b,0x36,0x33,0x8a,0x17,0x95,0x2a,0x1e,0x23,0x8b,0x2c,0x89,0x2e,0x12,0x8b,0x2f,0x8a,0x31,0x27,0x23,0x8b,0x32,0x89,0x2f,0x33,0x17,0x95,0x33,0x2f,0x1e,0x95,0x12,0x94,0x36,0x33,0x1e,0x95,0x32,0x38,0x17,0x8b,0x36,0x33,0x89,0x23,0x1e,0x27,0x8b,0x38,0x32,0x8a,0x33,0x36,0x18,0x8b,0x33,0x36,0x8a,0x33,0x36,0x2a,0x95,0x36,0x19,0x8b,0x31,0x2e,0x89,0x25,0x22,0x2a,0x8b,0x36,0x8a,0x2f,0x35,0x19,0x8b,0x36,0x89,0x38,0x2f,0x29,0x95,0x2e,0x36,0x1e,0x95,0x1c,0x28,0x95,0x27,0x1b,0x8b,0x2a,0x8a,0x2e,0x25,0x19,0x8b,0x34,0x89,0x33,0x2f,0x23,0x95,0x33,0x2f,0x1e,0x95,0x12,0x94,0x33,0x36,0x23,0x95,0x32,0x38,0x17,0x8b,0x33,0x36,0x8a,0x23,0x27,0x1e,0x8b,0x38,0x32,0x89,0x36,0x33,0x12,0x8b,0x32,0x38,0x8a,0x33,0x36,0x1e,0x94,0x37,0x3d,0x10,0x8b,0x3b,0x38,0x8a,0x23,0x28,0x20,0x8b,0x3d,0x37,0x89,0x3b,0x38,0x1c,0x8b,0x38,0x3b,0x8a,0x3a,0x3d,0x38,0x8b,0x3f,0x37,0x3a,0x89,0x27,0x1b,0x8b,0x33,0x8a,0x37,0x22,0x16,0x8b,0x3a,0x8a,0x3f,0x0f,0x1b,0x95,0x3a,0x8b,0x3b,0x8a,0x3d,0x37,0x1c,0x8b,0x3b,0x38,0x89,0x23,0x28,0x20,0x8b,0x3d,0x37,0x8a,0x38,0x3b,0x10,0x8b,0x3d,0x37,0x89,0x38,0x3b,0x20,0x8b,0x36,0x33,0x8a,0x17,0x23,0x8b,0x38,0x34,0x8a,0x33,0x36,0x1e,0x8b,0x31,0x34,0x8a,0x2f,0x33,0x17,0x8b,0x36,0x33,0x8a,0x23,0x27,0x1e,0x8b,0x33,0x36,0x8a,0x36,0x30,0x12,0x8a,0x34,0x31,0x8a,0x1e,0x28,0x22,0x8b,0x30,0x36,0x89,0x34,0x31,0x12,0x8b,0x2e,0x28,0x33,0x8a,0x31,0x28,0x2e,0x95,0x27,0x2f,0x1e,0x95,0x12,0x95,0x14,0x94,0x16,0x95,0x2f,0x33,0x17,0x95,0x2f,0x33,0x27,0x94,0x12,0x95,0x36,0x33,0x23,0x95,0x32,0x38,0x17,0x8a,0x33,0x36,0x8a,0x23,0x27,0x1e,0x8b,0x32,0x38,0x8a,0x33,0x36,0x12,0x8b,0x38,0x32,0x8a,0x36,0x33,0x27,0x95,0x3d,0x37,0x10,0x8a,0x3b,0x38,0x8a,0x23,0x28,0x20,0x8b,0x37,0x3d,0x89,0x3b,0x38,0x10,0x8b,0x37,0x3d,0x8a,0x38,0x3b,0x23,0x8b,0x36,0x33,0x8a,0x17,0x95,0x2a,0x1e,0x23,0x8b,0x2c,0x8a,0x2e,0x12,0x8b,0x2f,0x89,0x31,0x23,0x1e,0x8b,0x32,0x8a,0x33,0x2f,0x17,0x95,0x2f,0x33,0x1e,0x94,0x12,0x95,0x36,0x33,0x27,0x95,0x38,0x32,0x17,0x8a,0x36,0x33,0x8a,0x23,0x1e,0x27,0x8b,0x38,0x32,0x89,0x33,0x36,0x18,0x8c,0x36,0x33,0x89,0x33,0x36,0x21,0x95,0x36,0x19,0x8b,0x2e,0x31,0x8a,0x25,0x2a,0x22,0x8b,0x36,0x89,0x35,0x2f,0x19,0x8b,0x36,0x8a,0x2f,0x38,0x25,0x94,0x36,0x2e,0x2a,0x95,0x1c,0x28,0x95,0x27,0x1b,0x8c,0x2a,0x89,0x2e,0x25,0x19,0x8b,0x34,0x8a,0x33,0x2f,0x23,0x95,0x2f,0x33,0x1e,0x94,0x12,0x95,0x33,0x36,0x23,0x95,0x32,0x38,0x17,0x8a,0x33,0x36,0x8a,0x23,0x1e,0x27,0x8b,0x32,0x38,0x89,0x36,0x33,0x12,0x8c,0x32,0x38,0x89,0x33,0x36,0x1e,0x95,0x37,0x3d,0x10,0x8b,0x3b,0x38,0x8a,0x23,0x20,0x28,0x8a,0x3d,0x37,0x8a,0x38,0x3b,0x1c,0x8b,0x3b,0x38,0x8a,0x3d,0x38,0x3a,0x8b,0x3a,0x3f,0x37,0x89,0x27,0x1b,0x8b,0x33,0x8a,0x37,0x22,0x16,0x8b,0x3a,0x8a,0x3f,0x0f,0x1b,0x95,0x3a,0x8b,0x3b,0x8a,0x3d,0x37,0x1c,0x8b,0x3b,0x38,0x8a,0x20,0x28,0x23,0x8b,0x3d,0x37,0x89,0x38,0x3b,0x10,0x8b,0x3d,0x37,0x8a,0x38,0x3b,0x20,0x8b,0x33,0x36,0x89,0x17,0x23,0x8b,0x38,0x34,0x8a,0x36,0x33,0x23,0x8b,0x34,0x31,0x89,0x2f,0x33,0x17,0x8c,0x36,0x33,0x89,0x1e,0x27,0x23,0x8c,0x33,0x36,0x89,0x36,0x30,0x12,0x8b,0x34,0x31,0x8a,0x1e,0x28,0x22,0x8a,0x30,0x36,0x8a,0x34,0x31,0x1e,0x8b,0x28,0x2e,0x33,0x89,0x28,0x31,0x2e,0x95,0x27,0x2f,0x17,0x95,0x12,0x1e,0x95,0x3b,0x36,0x33,0x96,0x2a,0x8b,0x2b,0x8a,0x2c,0x1e,0x12,0x8b,0x2d,0x89,0x2e,0x28,0x1e,0x8b,0x2e,0x31,0x8a,0x16,0x22,0x8b,0x36,0x89,0x34,0x1e,0x22,0x8b,0x31,0x8a,0x2c,0x25,0x19,0x8b,0x2d,0x89,0x2e,0x28,0x25,0x8b,0x33,0x2e,0x8a,0x25,0x19,0x8c,0x31,0x89,0x2c,0x1a,0x26,0x8b,0x2e,0x8a,0x2f,0x1b,0x27,0x8b,0x2a,0x89,0x2c,0x23,0x1e,0x8b,0x2e,0x8a,0x2f,0x12,0x1e,0x8b,0x30,0x89,0x31,0x27,0x23,0x8b,0x32,0x8a,0x33,0x17,0x23,0x8b,0x32,0x8a,0x33,0x1e,0x23,0x8b,0x38,0x33,0x8a,0x1e,0x12,0x8b,0x36,0x8a,0x31,0x1e,0x23,0x8b,0x33,0x89,0x34,0x25,0x19,0x8b,0x3d,0x89,0x1e,0x28,0x22,0x8b,0x33,0x89,0x34,0x12,0x1e,0x8b,0x3d,0x8a,0x1e,0x22,0x28,0x8a,0x33,0x8a,0x34,0x19,0x25,0x8b,0x3d,0x89,0x28,0x1e,0x22,0x8b,0x3b,0x89,0x3a,0x1e,0x12,0x8b,0x38,0x8a,0x36,0x22,0x16,0x8b,0x34,0x8a,0x33,0x23,0x17,0x8b,0x3b,0x8a,0x1e,0x23,0x27,0x8a,0x32,0x8a,0x33,0x12,0x1e,0x8b,0x3b,0x89,0x27,0x23,0x1e,0x8b,0x32,0x89,0x33,0x23,0x17,0x8b,0x3b,0x89,0x1e,0x23,0x27,0x8b,0x38,0x8a,0x36,0x12,0x1e,0x8b,0x33,0x89,0x31,0x1e,0x27,0x8b,0x2f,0x8a,0x2e,0x20,0x14,0x8b,0x2f,0x8a,0x30,0x2a,0x24,0x8b,0x30,0x38,0x8a,0x24,0x18,0x8b,0x36,0x89,0x33,0x24,0x20,0x8b,0x30,0x8a,0x2e,0x27,0x1b,0x8b,0x2f,0x89,0x30,0x24,0x2a,0x8b,0x30,0x38,0x8a,0x20,0x14,0x8b,0x33,0x36,0x8a,0x38,0x30,0x24,0x8b,0x33,0x36,0xLine truncated
|
||||
};
|
||||
|
||||
static void fill_screen(void) {
|
||||
@@ -46,7 +42,7 @@ static void build_display(void) {
|
||||
d = a8_dlist_line(DL_CHR40x8x1, screen, 1);
|
||||
a8_dli_set(d, A8_REG_COLBK, A8_COLOR(HUE_GREY, 0));
|
||||
a8_dli_set(d, A8_REG_COLPF2, A8_COLOR(HUE_GREY, 6));
|
||||
for (i = 1; i < 24; i++) {
|
||||
for (i = 1; i < 23; i++) {
|
||||
byte on = (byte)(i == 6 || i == 12 || i == 18);
|
||||
d = a8_dlist_line(DL_CHR40x8x1, 0, on);
|
||||
if (on) {
|
||||
@@ -55,6 +51,7 @@ static void build_display(void) {
|
||||
a8_dli_set(d, A8_REG_COLPF2, (byte)(A8_COLOR(band * 4 + 2, 6)));
|
||||
}
|
||||
}
|
||||
a8_dlist_line(DL_CHR20x16x2, 0, 1); // make last line bigger
|
||||
a8_dlist_finish();
|
||||
}
|
||||
|
||||
@@ -79,23 +76,26 @@ void main(void) {
|
||||
a8_pmg_set_x(0, x);
|
||||
a8_pmg_set_color(0, A8_COLOR(HUE_GREY, 0x0f));
|
||||
a8_pmg_set_size(0, A8_PMG_NORMAL);
|
||||
a8_pmg_set_shape(0, ball, sizeof(ball), 0x30);
|
||||
a8_pmg_set_shape(0, ball, sizeof(ball), 0x38);
|
||||
|
||||
a8_pokey_init();
|
||||
a8_pokey_play(0, melody, A8_AUDC_POLYS_5_4, 10);
|
||||
|
||||
// start music and set interrupt
|
||||
a8_pokey_music_init();
|
||||
music_start(music1);
|
||||
|
||||
while (1) {
|
||||
a8_waitvsync();
|
||||
a8_pokey_tick();
|
||||
|
||||
x += dx;
|
||||
if (x < 48) { x = 48; dx = 2; }
|
||||
if (x > 208) { x = 208; dx = (byte)-2; }
|
||||
a8_pmg_set_x(0, x);
|
||||
|
||||
/* Fire button flips the priority; console keys re-trigger the song. */
|
||||
if (a8_trigger(0)) a8_pmg_set_color(0, A8_COLOR(HUE_YELLOW, 0x0f));
|
||||
else a8_pmg_set_color(0, A8_COLOR(HUE_GREY, 0x0f));
|
||||
if (a8_console() & 0x08) a8_pokey_play(0, melody, A8_AUDC_POLYS_5_4, 10);
|
||||
if (a8_trigger(0)) {
|
||||
a8_pmg_set_size(0, A8_PMG_QUADW);
|
||||
} else {
|
||||
a8_pmg_set_size(0, A8_PMG_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,24 +6,15 @@
|
||||
#include <peekpoke.h>
|
||||
#include <6502.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
//#link "pokeymusic.ca65"
|
||||
//#link "common.c"
|
||||
|
||||
const char music1[] = {
|
||||
0x35,0x8a,0x37,0x8a,0x33,0x3f,0x8a,0x30,0x3c,0x94,0x3e,0x32,0x8a,0x3a,0x2e,0x94,0x35,0x29,0x8a,0x37,0x2b,0x8a,0x33,0x27,0x8a,0x30,0x24,0x94,0x32,0x26,0x8a,0x2e,0x22,0x94,0x29,0x1d,0x8a,0x2b,0x1f,0x8a,0x27,0x1b,0x8a,0x24,0x18,0x94,0x1a,0x26,0x8a,0x18,0x24,0x8a,0x17,0x23,0x8a,0x16,0x22,0xa8,0x3a,0x35,0x32,0x94,0x29,0x26,0x22,0x8a,0x2a,0x8a,0x2b,0x1b,0x8a,0x33,0x8a,0x22,0x1f,0x27,0x8a,0x2b,0x8a,0x33,0x22,0x16,0x94,0x2b,0x27,0x25,0x8a,0x33,0x8a,0x20,0x14,0x94,0x27,0x24,0x94,0x1f,0x13,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x27,0x8a,0x39,0x36,0x8a,0x3a,0x37,0x16,0x8a,0x3f,0x37,0x33,0x8a,0x35,0x38,0x22,0x8a,0x3a,0x37,0x8a,0x16,0x8a,0x3e,0x35,0x32,0x8a,0x38,0x35,0x26,0x94,0x3f,0x33,0x37,0x94,0x1f,0x22,0x27,0x94,0x27,0x22,0x1f,0x94,0x29,0x26,0x22,0x8a,0x2a,0x8a,0x2b,0x1b,0x8a,0x33,0x8a,0x1f,0x22,0x27,0x8a,0x2b,0x8a,0x33,0x22,0x16,0x94,0x2b,0x27,0x25,0x8a,0x33,0x8a,0x20,0x14,0x94,0x24,0x27,0x94,0x1f,0x13,0x94,0x3c,0x33,0x30,0x8a,0x3a,0x33,0x2e,0x8a,0x39,0x33,0x2d,0x8a,0x3c,0x30,0x8a,0x3f,0x33,0x1d,0x8a,0x37,0x8a,0x1d,0x8a,0x35,0x8a,0x3f,0x33,0x27,0x8a,0x3c,0x30,0x8a,0x35,0x38,0x26,0x94,0x22,0x16,0x94,0x24,0x18,0x94,0x29,0x26,0x1a,0x8a,0x2a,0x8a,0x2b,0x1b,0x8a,0x33,0x8a,0x27,0x22,0x1f,0x8a,0x2b,0x8a,0x33,0x16,0x22,0x94,0x2b,0x27,0x25,0x8a,0x33,0x8a,0x20,0x14,0x94,0x27,0x24,0x94,0x13,0x1f,0x8a,0x3f,0x33,0x37,0x8a,0x38,0x35,0x27,0x8a,0x39,0x36,0x8a,0x37,0x3a,0x16,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x27,0x8a,0x3a,0x37,0x8a,0x16,0x8a,0x3e,0x35,0x32,0x8a,0x38,0x35,0x20,0x94,0x3f,0x37,0x33,0x94,0x27,0x22,0x1f,0x94,0x2b,0x27,0x22,0x94,0x3f,0x33,0x8a,0x35,0x8a,0x37,0x27,0x1b,0x8a,0x3f,0x33,0x8a,0x35,0x2b,0x22,0x8a,0x37,0x8a,0x25,0x19,0x8a,0x3f,0x33,0x8a,0x35,0x2b,0x27,0x8a,0x3f,0x33,0x8a,0x37,0x24,0x18,0x8a,0x3f,0x33,0x8a,0x35,0x2c,0x27,0x8a,0x37,0x8a,0x23,0x17,0x8a,0x3f,0x33,0x8a,0x35,0x2c,0x27,0x8a,0x3f,0x33,0x8a,0x3a,0x37,0x22,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x2b,0x8a,0x3a,0x37,0x8a,0x16,0x8a,0x3e,0x32,0x35,0x8a,0x35,0x38,0x26,0x94,0x3f,0x33,0x37,0x94,0x22,0x16,0x94,0x24,0x18,0x94,0x29,0x26,0x1a,0x8a,0x2a,0x8a,0x2b,0x1b,0x8a,0x33,0x8a,0x27,0x22,0x1f,0x8a,0x2b,0x8a,0x33,0x22,0x16,0x94,0x2b,0x25,0x22,0x8a,0x33,0x8a,0x20,0x14,0x94,0x27,0x24,0x94,0x1f,0x13,0x8a,0x3f,0x37,0x33,0x8a,0x35,0x38,0x27,0x8a,0x39,0x36,0x8a,0x3a,0x37,0x16,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x27,0x8a,0x3a,0x37,0x8a,0x16,0x8a,0x3e,0x35,0x32,0x8a,0x35,0x38,0x20,0x94,0x37,0x33,0x3f,0x94,0x27,0x22,0x1f,0x94,0x27,0x22,0x1f,0x94,0x29,0x26,0x22,0x8a,0x2a,0x8a,0x2b,0x1b,0x8a,0x33,0x8a,0x22,0x1f,0x27,0x8a,0x2b,0x8a,0x33,0x22,0x16,0x94,0x2b,0x27,0x25,0x8a,0x33,0x8a,0x20,0x14,0x94,0x27,0x24,0x94,0x1f,0x13,0x94,0x3c,0x33,0x30,0x8a,0x3a,0x33,0x2e,0x8a,0x2d,0x33,0x39,0x8a,0x3c,0x30,0x8a,0x3f,0x33,0x27,0x8a,0x37,0x8a,0x1d,0x8a,0x35,0x8a,0x33,0x3f,0x27,0x8a,0x3c,0x30,0x8a,0x38,0x35,0x26,0x94,0x22,0x16,0x94,0x24,0x18,0x94,0x29,0x26,0x1a,0x8a,0x2a,0x8a,0x2b,0x1b,0x8a,0x33,0x8a,0x22,0x27,0x1f,0x8a,0x2b,0x8a,0x33,0x22,0x16,0x94,0x2b,0x27,0x25,0x8a,0x33,0x8a,0x20,0x14,0x94,0x24,0x27,0x94,0x1f,0x13,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x27,0x8a,0x36,0x39,0x8a,0x3a,0x37,0x16,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x27,0x8a,0x37,0x3a,0x8a,0x16,0x8a,0x3e,0x35,0x32,0x8a,0x38,0x35,0x22,0x94,0x33,0x37,0x3f,0x94,0x27,0x22,0x1f,0x94,0x22,0x27,0x2b,0x94,0x3f,0x33,0x8a,0x35,0x8a,0x37,0x27,0x1b,0x8a,0x3f,0x33,0x8a,0x35,0x2b,0x27,0x8a,0x37,0x8a,0x25,0x19,0x8a,0x3f,0x33,0x8a,0x35,0x2b,0x22,0x8a,0x3f,0x33,0x8a,0x37,0x24,0x18,0x8a,0x33,0x3f,0x8a,0x35,0x2c,0x27,0x8a,0x37,0x8a,0x23,0x17,0x8a,0x3f,0x33,0x8a,0x35,0x2c,0x27,0x8a,0x3f,0x33,0x8a,0x3a,0x37,0x22,0x8a,0x3f,0x37,0x33,0x8a,0x38,0x35,0x2b,0x8a,0x37,0x3a,0x8a,0x16,0x8a,0x3e,0x35,0x32,0x8a,0x38,0x35,0x22,0x94,0x33,0x37,0x3f,0x94,0x22,0x16,0x94,0x1b,0x0f,0x8a,0x37,0x2b,0x33,0x8a,0x38,0x2c,0x35,0x8a,0x39,0x36,0x2d,0x8a,0x3a,0x37,0x2e,0x94,0x3c,0x37,0x30,0x8a,0x3a,0x2e,0x37,0x8a,0x16,0x8a,0x37,0x33,0x2b,0x8a,0x2c,0x38,0x35,0x8a,0x39,0x36,0x2d,0x8a,0x3a,0x37,0x2e,0x94,0x3c,0x37,0x30,0x8a,0x2e,0x37,0x3a,0x8a,0x16,0x8a,0x37,0x8a,0x33,0x27,0x2b,0x8a,0x2e,0x8a,0x30,0x14,0x8a,0x32,0x8a,0x33,0x2c,0x27,0x8a,0x35,0x8a,0x37,0x20,0x8a,0x35,0x8a,0x33,0x2c,0x27,0x8a,0x35,0x8a,0x2e,0x1f,0x8a,0x37,0x8a,0x38,0x2b,0x27,0x8a,0x3a,0x8a,0x3c,0x16,0x8a,0x3a,0x8a,0x37,0x22,0x2b,0x8a,0x38,0x8a,0x3a,0x37,0x2e,0x94,0x3c,0x30,0x37,0x8a,0x3a,0x37,0x2e,0x8a,0x16,0x8a,0x37,0x33,0x2b,0x8a,0x38,0x2c,0x35,0x8a,0x39,0x36,0x2d,0x8a,0x3a,0x37,0x2e,0x94,0x3c,0x37,0x30,0x8a,0x2e,0x37,0x3a,0x8a,0x1f,0x8a,0x3a,0x8a,0x3c,0x1e,0x8a,0x3d,0x8a,0x3e,0x3a,0x35,0x8a,0x3e,0x35,0x3a,0x8a,0x22,0x29,0x26,0x8a,0x3e,0x33,0x39,0x8a,0x1d,0x8a,0x3c,0x8a,0x39,0x33,0x29,0x8a,0x35,0x8a,0x3a,0x32,0x29,0x94,0x20,0x14,0x94,0x1f,0x13,0x8a,0x37,0x2b,0x33,0x8a,0x38,0x35,0x2c,0x8a,0x39,0x36,0x2d,0x8a,0x2e,0x3a,0x37,0x94,0x3c,0x37,0x30,0x8a,0x3a,0x37,0x2e,0x8a,0x16,0x8a,0x33,0x2b,0x37,0x8a,0x38,0x35,0x2c,0x8a,0x39,0x36,0x2d,0x8a,0x3a,0x37,0x2e,0x94,0x30,0x37,0x3c,0x8a,0x3a,0x2e,0x37,0x8a,0x16,0x8a,0x37,0x8a,0x33,0x2b,0x27,0x8a,0x2e,0x8a,0x30,0x14,0x8a,0x32,0x8a,0x33,0x2c,0x27,0x8a,0x35,0x8a,0x37,0x20,0x8a,0x35Line truncated
|
||||
};
|
||||
|
||||
extern void music_tick(void);
|
||||
extern void music_duty(void);
|
||||
extern void music_start(const char*);
|
||||
extern char* music_get_ptr(void);
|
||||
extern char music_is_done(void);
|
||||
|
||||
unsigned char music_update() {
|
||||
music_tick();
|
||||
music_duty();
|
||||
return IRQ_NOT_HANDLED;
|
||||
}
|
||||
|
||||
void main() {
|
||||
// clear the screen
|
||||
clrscr();
|
||||
|
||||
@@ -4,8 +4,6 @@ import { PLATFORMS } from "../common/emu";
|
||||
import { BaseMAME6502Platform } from "../common/mameplatform";
|
||||
import { Atari5200, Atari800 } from "../machine/atari8";
|
||||
|
||||
declare var jt; // for 6502
|
||||
|
||||
var Atari8_PRESETS : Preset[] = [
|
||||
{id:'hello.dasm', name:'Hello World', category:'Assembly'},
|
||||
{id:'hellopm.dasm', name:'Hello Sprites'},
|
||||
@@ -16,7 +14,7 @@ var Atari8_PRESETS : Preset[] = [
|
||||
];
|
||||
|
||||
var Atari800_PRESETS = Atari8_PRESETS.concat([
|
||||
{id:'testmusic.c', name:'POKEY Music'},
|
||||
//{id:'testmusic.c', name:'POKEY Music'},
|
||||
{id:'sieve.bas', name:'Benchmark', category:'FastBasic'},
|
||||
{id:'pmtest.bas', name:'Sprites Test'},
|
||||
{id:'dli.bas', name:'DLI Test'},
|
||||
|
||||
Reference in new issue
Block a user