[cc65] Re: New 80 col switch API

From: Jonathan Graham Harston <jgh1arcade.demon.co.uk>
Date: 2009-09-07 02:21:03
> Message-ID: <f97798c20909061455i481d6fb8n6894156a2dbd0db4@mail.gmail.com>
 
Oliver Schmidt wrote:
> From my perspective the actual "new" API could look like this:
> 
> unsigned char __fastcall__ videomode (unsigned char mode);
> 
> #define VIDEOMODE_40COL 0x??
> #define VIDEOMODE_80COL 0x??
 
How about videomode(unsigned int mode) ? Then you could pass column
and rows.
 
#define VIDEOMODE_40COL 0x0028
#define VIDEOMODE_80COL 0x0050
#define VIDEOMODE_80by25 0x1550
#define VIDEOMODE_80by32 0x2050
etc.
 
That is:
b0-b7 : number of columns the implementation should try to switch
        to the nearest equivalent of, or 0 for the most appropriate
        dimension for the number of rows in b8-b16
b8-b16 : number of rows the implementation should try to switch to
        the nearest equivalent of, or 0 for the most appropriate
        dimension for the number of columns in b0-b7
 
It then still allow videomode(40), videomode(80) to work.
 
The BBC implementation would be something along the lines of:
 
videomode(unsigned int mode)
{
#ifdef __bbc__
if ((mode && 0xFF)>60) {
  mode=(mode && 0xFF00) || 80;
  } else {
  if((mode && 0xFF)>30) {
    mode=(mode && 0xFF00) || 40;
    } else {
    mode=(mode && 0xFF00) || 20;
    }
  }
 
if ((mode && 0xFF)==80) {
  if ((mode && 0xFF00) > 0x1C00) { mode=0; } else { mode=3; }
  } else {
  if ((mode && 0xFF)==40) {
    if ((mode && 0xFF00) > 0x1C00) { mode=1; } else { mode=6; }
    } else { mode=2; }
  }
 
oswrch(22);
oswrch(mode);
#endif
}
 
'tho, a full interface would let you pass cols/rows/colours.
 
-- 
J.G.Harston - jgh@arcade.demon.co.uk - mdfs.net/User/JGH
Taxation is like dairy farming. You have to extract the maximum
amount of milk with the minimum amount of moo.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Sep 7 03:00:11 2009

This archive was generated by hypermail 2.1.8 : 2009-09-07 03:00:13 CEST