[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 80 Columns under cc65?



[...]
> > John B. Matthews wrote:
> > > In article <g4cog9$q9e$1@online.de>, ol.sc@web.de (Oliver Schmidt) 
> > > wrote:
> > > 
> > >>>>How do I get an 80-column text mode on an Apple 2 under cc65?
> > >>
> > >>>It looks like the cc65 conio library goes to some lengths to avoid 
> > >>>changing whatever your program loader sets.
> > >>
> > >>That's very true. And in fact it goes beyond that: In contrast to at
> > >>least some other cc65 targets the Apple2 conio implementation allows
> > >>you to mix stdio and conio. Additionally you can use the well-known
> > >>Apple2 zero-page variables to restrict the output to a certain window
> > >>both for stdio and conio.
> > > 
> > > Oliver: thanks for expanding on this. I'm still new to cc65:-)
> > > 
> > >>>         LDA MACHID
> > >>>         AND #2
> > >>>         BEQ NO80COL
> > >>>         JSR $C300
> > >>
> > >>I've tried recently to do that from within a cc65 program via inline
> > >>assembler but that mixed up something with ProDOS so file I/O didn't
> > >>work anymore. I'll have to investigate but my current work life
> > >>situation doesn't allow for that. So the current workaround is to set
> > >>80-column mode before starting the cc65 program.
> > > 
> > > Oliver: the code above was from a ProDOS system program. A non-system 
> > > cc65 program launched from the Basic prompt under ProDOS is running 
> > > alongside BASIC.SYSTEM. It might be necessary to update the BASIC Global 
> > > Page Default I/O vectors after initializing the card:
> > > 
> > > BE30:  VECTOUT   DW  COUT1       ;Current character output routine
> > > BE32:  VECTIN    DW  CHIN1       ;Current character input routine
> > > 
> > > I'll have to learn enough inline assembler to try it myself, but 
> > > experimenting from the Basic prompt seems to confirm this. I'm 
> > > tempted to just try printing control-DPR#3.

Recent experimental findings: This does _not_ work.

Of course, now I'm wondering if DOS might buy it :-)

> I'm thinking I can just jsr $c300 and copy the updated page zero vectors 
> (36.39) to the Basic system page (be30.be33). To exit, I issue a 
> control-U and restore the system page.

This works, for the given assumptions:

    /* 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);

> Alternatively, if the loader enables 80 columns, printing control-Q and 
> control-R switch to 40- and 80-columns, respectively.

And this works, too.

-- 
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews