In article
<b6e689bd-0614-4109-8326-ddca4a4f6240@b15g2000yqd.googlegroups.com>,
datajerk <datajerk@gmail.com> wrote:
[...]
Yep, that works for me too. If I remove:
__asm__ ("jsr %w", 0xc300);
From pi.c, then it works there too. Is there another or safer way to
set 80 columns with cc65?
IIUC, cc65 tries to make as few assumptions as possible about the
destination environment. If you know you're headed for Apple II, ProDOS
and Basic, this works by synchronizing the I/O hooks:
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main (void) {
time_t starttime = time(NULL);
time_t endtime = time(NULL);
/* Assume 80-column card, ProDOS, Basic */
__asm__ ("jsr %w", 0xc300);
__asm__ ("lda %b", 0x36);
__asm__ ("sta %w", 0xbe30);
__asm__ ("lda %b", 0x37);
__asm__ ("sta %w", 0xbe31);
__asm__ ("lda %b", 0x38);
__asm__ ("sta %w", 0xbe32);
__asm__ ("lda %b", 0x39);
__asm__ ("sta %w", 0xbe33);
/* Clear the screen, put cursor in upper left corner */
clrscr ();
printf("Start time: %s\n",asctime(localtime(&starttime)));
printf(" End time: %s\n",asctime(localtime(&endtime)));
return EXIT_SUCCESS;
}
Printing control-D PR#3 doesn't appear to work.