Shawn Jefferson, on Wed Dec 2, 2009 12:18 AM, said:
Wookie, on Mon Nov 30, 2009 5:47 PM, said:
I'm trying to compile and link Karri's lynx-cart-demo from the contrib folder on the cc65 site. I keep getting the following error:
Unresolved external `__INTERRUPTOR_COUNT__' referenced in:
callirq.s(33)
crt0.s(27)
Unresolved external `__INTERRUPTOR_TABLE__' referenced in:
callirq.s(33)
ld65: Error: 2 unresolved external(s) found - cannot create output file
If I grep around for __INTERRUPTOR_COUNT__ I see that the lynx.lib file has that string in it. Any ideas?
--Wookie
Those should be defined in the linker config file... sounds like they aren't for some reason.
What's your command line for linking?
You need to have the end of the cfg file like this:
FEATURES {
CONDES: segment = RODATA,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
CONDES: segment = RODATA,
type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__;
CONDES: segment = DATA,
type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__;
}
The new cc65 toolset initializes the IRQ handler automatically at startup.
This means that the new way of dealing with the screen is like this:
#include <lynx.h>
#include <tgi.h>
#include <joystick.h>
#include <serial.h>
#include <stdlib.h>
#include <conio.h>
#include <6502.h>
#include <string.h>
// The Lynx does not have a filesystem yet for downloading drivers
// So we simply include them statically
extern char lynxtgi[];
extern char lynxjoy[];
extern char comlynx[];
static void
initialize()
{
struct ser_params params = {
SER_BAUD_9600,
SER_BITS_8, // only 8 data bits is supported
SER_STOP_1, // only 1 stop bit is supported
SER_PAR_MARK, // mark, space, even, odd is supported
SER_HS_NONE // only "none" is supported
};
tgi_install(&lynxtgi); // This will activate the Lynx screen
joy_install(&lynxjoy); // This will activate the Lynx joypad
ser_install(&comlynx); // This will activate the ComLynx
tgi_init();
CLI();
ser_open(¶ms);
}
void main(void)
{
unsigned char joy;
unsigned char WaitForRelease;
unsigned char UpdateNeeded = 1;
int x = 10;
int y = 40;
char ReceiveBuffer[80];
char recptr = 0;
char ch;
initialize();
strcpy(ReceiveBuffer, "Receive Buffer");
while (1) {
joy = joy_read(JOY_1);
if (!joy)
WaitForRelease = 0;
if (WaitForRelease == 0) {
if (JOY_BTN_UP(joy)) {
--y;
UpdateNeeded = 1;
WaitForRelease = 1;
}
if (JOY_BTN_DOWN(joy)) {
++y;
UpdateNeeded = 1;
WaitForRelease = 1;
}
if (JOY_BTN_LEFT(joy)) {
--x;
UpdateNeeded = 1;
WaitForRelease = 1;
}
if (JOY_BTN_RIGHT(joy)) {
++x;
UpdateNeeded = 1;
WaitForRelease = 1;
}
if (JOY_BTN_FIRE(joy)) {
char ch;
ser_put('H');
ser_put('e');
ser_put('l');
ser_put('l');
ser_put('o');
ser_put(' ');
ser_put('W');
ser_put('o');
ser_put('r');
ser_put('l');
ser_put('d');
ser_put(0x0d);
ser_put(0x0a);
// The reception will not work during transmission.
// This is the feature of this driver only.
// After the transmission is complete the last sent
// character will be received. The next line will wait
// for that and receive the last byte.
while (ser_get(&ch) != SER_ERR_OK)
;
WaitForRelease = 1;
}
}
if (ser_get(&ch) == SER_ERR_OK) {
ReceiveBuffer[recptr++] = ch;
UpdateNeeded = 1;
}
if (UpdateNeeded && !tgi_busy()) {
tgi_clear();
tgi_setcolor(COLOR_RED);
tgi_outtextxy(x, y, "Hello World");
tgi_setcolor(COLOR_GREEN);
tgi_outtextxy(0, 101-10, ReceiveBuffer);
tgi_updatedisplay();
UpdateNeeded = 0;
}
}
}
Please note tgi_busy() and tgi_updatedisplay().
All the stuff in the background is interrupt-driven.
--
Karri
Edited by karri, Wed Dec 2, 2009 2:19 AM.