[cc65] Printer Problem

Date view Thread view Subject view

From: udo klasmeier (uklasmeier_at_t-online.de)
Date: 2001-08-27 22:13:19


Sorry friends,
but i have the next little Problem.

I am running my program with the VICE emulator
i have set the Printer emulation to the first entry in the selection list
( i can't yust have a look on it, because i do the mailing under
MS-W*nd*ws)(shame)

The Program runs with no complains, it generates the file "printer.dump"
but the file is empty.

Any idea what an be wrong.

greetings Udo

Here the relevant part of my proggy:
-----------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include <fcntl.h>
#include <dbg.h>
#include <cbm.h>

#define F_PRT 4   // logical FileNr Printer
#define P_DVN 4   // Device Nr Printer


typedef unsigned char BYTE;
extern BYTE _oserror;

void waitKey(void){
 cprintf("\r\n... weiter mit Taste ...\r\n\n");
 cgetc();
}

void DispError(int rc,char *s){
 cprintf("\r\n%d:%s\r\n",rc,s);
 cprintf("OS-error code %d\r\n",_oserror);
 waitKey();
}

int OpenPrinter(void){
BYTE rc;
 rc=cbm_open((BYTE)F_PRT,(BYTE)P_DVN,(BYTE)1,NULL);
 if(rc){
  DispError(rc,"Open-Fehler Printer");
  return 1;
 }
 return 0;
}


void Print(char *s){
BYTE rc;
 rc=cbm_write((BYTE)F_PRT,s,strlen(s));
 if(rc!=strlen(s)) DispError(rc,"Fehler beim Drucken");
}

void PrintNl(char *s){
 Print(s);
 Print("\r\n");
}

void PrintAdresses  (void){
int i;
 if(OpenPrinter())return;
 for(i=0;i<anzAdr;i++) {
  PrintNl(adr[i].anrede );
  PrintNl(adr[i].name   );
  PrintNl(adr[i].strasse);
  PrintNl(adr[i].plzort );
  PrintNl(adr[i].tel    );
  Print("\r\n");
 }
 cbm_close(F_PRT);
}


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:42 CET