mirror of
https://github.com/sampopeltonen/Vicious.git
synced 2025-01-14 22:29:44 +00:00
CFFA1 integration changed to be a loadable module outside of the ROM
This commit is contained in:
parent
47a7635412
commit
53f87e0ee0
@ -9,18 +9,17 @@
|
|||||||
|
|
||||||
#define CFFA1_OPENDIR 0x10
|
#define CFFA1_OPENDIR 0x10
|
||||||
#define CFFA1_READDIR 0x12
|
#define CFFA1_READDIR 0x12
|
||||||
#define CFFA1_READFILE 0x22
|
|
||||||
|
|
||||||
#define CFFA1_DESTINATION 0x0
|
|
||||||
#define CFFA1_FILENAME 0x2
|
|
||||||
#define CFFA1_FILESIZE 0x9
|
#define CFFA1_FILESIZE 0x9
|
||||||
#define CFFA1_ENTRYPTR 0xB
|
#define CFFA1_ENTRYPTR 0xB
|
||||||
|
|
||||||
#define CFFA1_E_FILENOTFOUND 0x46
|
#define CFFA1_E_FILENOTFOUND 0x46
|
||||||
|
|
||||||
byte fileNames[FILE_LIST_LEN][1+16+2];
|
#pragma codeseg ("CODERAM")
|
||||||
|
|
||||||
|
byte fileNames[FILE_LIST_LEN][1+16+2]; // filename length + filename + file length
|
||||||
|
|
||||||
|
/* returns file length, 0 if nothing loaded */
|
||||||
word loadFile(word destination) {
|
word loadFile(word destination) {
|
||||||
byte i;
|
byte i;
|
||||||
byte l;
|
byte l;
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
#ifndef CFFA1_H_
|
#ifndef CFFA1_H_
|
||||||
#define CFFA1_H_
|
#define CFFA1_H_
|
||||||
|
|
||||||
|
#define CFFA1_DESTINATION 0x0
|
||||||
|
#define CFFA1_FILENAME 0x2
|
||||||
|
|
||||||
|
#define CFFA1_READFILE 0x22
|
||||||
|
|
||||||
#include "vicilib.h"
|
#include "vicilib.h"
|
||||||
|
|
||||||
extern void gotoCFFA1();
|
extern void gotoCFFA1();
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: start = $0020, size = $00C0, define = yes;
|
ZP: start = $0020, size = $00C0, define = yes;
|
||||||
HEADER: start = $0000, size = $0004, file = "";
|
HEADER: start = $0000, size = $0004, file = "";
|
||||||
RAM: start = $7000, size = $1000, type = rw, define = yes;
|
RAM: start = $6000, size = $1000, type = rw, define = yes;
|
||||||
|
RAMC: start = $7000, size = $1000, type = rw, define = yes, file = "VICIOUSCFFA1";
|
||||||
ROM: start = $B000, size = $F00, type = ro, define = yes, file = %O, fill = yes;
|
ROM: start = $B000, size = $F00, type = ro, define = yes, file = %O, fill = yes;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
@ -11,6 +12,7 @@ SEGMENTS {
|
|||||||
LOWCODE: load = ROM, type = ro, optional = yes;
|
LOWCODE: load = ROM, type = ro, optional = yes;
|
||||||
INIT: load = ROM, type = ro, define = yes, optional = yes;
|
INIT: load = ROM, type = ro, define = yes, optional = yes;
|
||||||
CODE: load = ROM, type = ro;
|
CODE: load = ROM, type = ro;
|
||||||
|
CODERAM: load = RAMC, type = ro;
|
||||||
RODATA: load = ROM, type = ro;
|
RODATA: load = ROM, type = ro;
|
||||||
DATA: load = ROM, run = RAM, type = rw, define = yes;
|
DATA: load = ROM, run = RAM, type = rw, define = yes;
|
||||||
BSS: load = RAM, type = bss, define = yes;
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
|
@ -5,16 +5,31 @@
|
|||||||
|
|
||||||
//extern word Destination;
|
//extern word Destination;
|
||||||
|
|
||||||
|
byte const CFFA_MODULE_FILENAME[] = { 12, 'V', 'I', 'C', 'I', 'O', 'U', 'S', 'C', 'F', 'F', 'A', '1' };
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
byte keybInput = 0;
|
byte keybInput = 0;
|
||||||
|
word fileLength;
|
||||||
initVicilib();
|
initVicilib();
|
||||||
|
|
||||||
|
// is CFFA module loaded?
|
||||||
|
|
||||||
|
// if not, is CFFA card present?
|
||||||
|
|
||||||
|
// if it is, try to load VICIOUSCFFA1
|
||||||
|
POKEW(CFFA1_DESTINATION, 0x7000);
|
||||||
|
POKEW(CFFA1_FILENAME, (word)&CFFA_MODULE_FILENAME[0]);
|
||||||
|
if(callCFFA1API(CFFA1_READFILE)!=0) {
|
||||||
|
prints("\rERROR LOADING CFFA1 MODULE\r");
|
||||||
|
}
|
||||||
|
|
||||||
while(keybInput!='Q') {
|
while(keybInput!='Q') {
|
||||||
prints("\rVICIOUS> ");
|
prints("\rVICIOUS> ");
|
||||||
keybInput = readkey() - 0x80;
|
keybInput = readkey() - 0x80;
|
||||||
switch (keybInput) {
|
switch (keybInput) {
|
||||||
case 'P':
|
case 'P':
|
||||||
playSidFile(0x1000, 0x2000);
|
playSidFile(0x1000, 0x2000); // file length is just a guess, it's not known
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
prints("\rSTOP PLAYING\r");
|
prints("\rSTOP PLAYING\r");
|
||||||
@ -26,18 +41,16 @@ int main (void)
|
|||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
stopPlaying();
|
stopPlaying();
|
||||||
playSidFile(0x1000, loadFile(0x1000));
|
if((fileLength = loadFile(0x1000))!=0) {
|
||||||
|
playSidFile(0x1000, fileLength);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
prints("\rQUIT\r");
|
prints("\rQUIT\r");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
prints("\r\r VICIOUS MENU (0.9)\r ------------------");
|
prints("\r\r VICIOUS MENU (0.9)\r ------------------\r P - PLAY SID TUNE AT $1000");
|
||||||
prints("\r P - PLAY SID TUNE");
|
prints("\r S - STOP PLAYING\r C - CFFA1\r L - LOAD & PLAY SID TUNE\r Q - QUIT\r");
|
||||||
prints("\r S - STOP PLAYING");
|
|
||||||
prints("\r C - CFFA1");
|
|
||||||
prints("\r L - LOAD & PLAY SID TUNE");
|
|
||||||
prints("\r Q - QUIT\r");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user