[cc65] Performance of Swiftlink routines

From: Tom Watt <tom719co1gmail.com>
Date: 2009-12-31 04:41:25
Hello,

I've been working on a test terminal program to see if cc65 will work
for me.  I think the terminal I wrote has "acceptable" speed, but I
chose C because I honestly believed that C would be a faster
alternative then a BASIC/ML combination approach.

To modem buffs out there, the terminal feels "2400 baud" where as if I
fire up Novaterm I'm seeing much faster results.  (BTW my test
environment is VICE with TCPSER to give a virtual modem so I can
telnet.)

I got to thinking the hang up has got to be that everything is done in
single bytes.  We should be able to send/receive strings to the serial
routines.  The logic should be something like:

amountofcharswaiting=checkamountofcharswaiting();
if (amountofcharswaiting=>1) string=getcharsfromserial(amountofcharswaiting);

Sending would be nice too (this way), but this would be a start.

Or am I just doing something wrong?  (See code)

Thanks,

Tom
---
/*

Simple Terminal Program
Version 1.00
Copyright 2009-2010 by Tom Watt

*/

#include <c64.h>
#include <cbm.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <serial.h>
#include <peekpoke.h>

/* create vars/structs */
char key;
int status;
char string[100];
struct ser_params p = {
        SER_BAUD_38400,
        SER_BITS_8,
        SER_STOP_1,
        SER_PAR_NONE,
        SER_HS_HW
};
int err;

int term(void) {

	/* see if there's a key on keyboard, get it and print it to SL if so,
also check for exit */
	if (kbhit ()) {
		key=cgetc();
		if (key==CH_F1) printf("%c%c",147,5);
		if (key==CH_F3) printf("\n\nFree memory: %u\n\n",_heapmemavail());
                                if (key==CH_F5) {
			ser_status(string);
			printf("\n\nStatus: %s\n\n",string);
		}
		if (key==CH_F7) return 0;
		ser_put(key);
		key=0;
	}

	/* print a key from port, if waiting */
	status=ser_get(&key);
	if (status==SER_ERR_OK) printf("%c",key);
	key=0;

	/* return to main function */
	return 1;

}

void main(void) {

	/* clear screen, set colors */
	printf("%c%c",147,5);
	POKE(53280,0);
	POKE(53281,0);

                /* Load SL driver */
	err=ser_load_driver("c64-swlink.ser");
	if (err!=SER_ERR_OK) printf("Error loading driver!\n");


	/* open port */
                err=ser_open(&p);
	if (err!=SER_ERR_OK) printf("Error opening port!\n");
	printf("Terminal Ready!\n\n");

	/* call term function repeatedly until exit */
	while (term()) {};

	/* close SL and exit */
	ser_close();
	exit(0);

}
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Dec 31 04:41:31 2009

This archive was generated by hypermail 2.1.8 : 2009-12-31 04:41:35 CET