[cc65] Fwd: Reading / writing userport on C128?

From: Scott Hutter <scott.hutter1gmail.com>
Date: 2009-08-02 17:27:46
Hey guys, Im having trouble reading/writing to the userport on a C128.  Im
writing a simple terminal using the cbm functions since I didnt see a
userport rs232 driver.  I can write to the userport/modem just fine, but
reading seems to hang.  Any help would be appreciated. (Or alternate
approaches)

Here's the code I have:

#include <c128.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>


int main(void)
{
    unsigned char* inbuffer;
    unsigned char* outbuffer;
    unsigned char name[6];
    unsigned char c;

    name[0]=6;
    name[1]=0;
    name[2]=0;

    inbuffer = (unsigned char *) malloc (1);
    outbuffer = (unsigned char *) malloc (1);

    fast();

   if(!cbm_open(2,2,0,name))
        puts("Unable to open modem.");

    do
    {
        if(cbm_read(2, inbuffer, 1) > 0)    /* this function seems to hang
*/
             putchar(*inbuffer);

        c = getchar();

        if (c)
        {
            putchar(c);
            *outbuffer = c;
            cbm_write(2, outbuffer,1);
        }

    } while(c != '.');

    cbm_close(2);

}

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Aug 2 17:27:54 2009

This archive was generated by hypermail 2.1.8 : 2009-08-02 17:27:57 CEST