[cc65] Re: New 80 col switch API

From: Jonathan Graham Harston <jgh1arcade.demon.co.uk>
Date: 2009-09-08 00:43:25
> Message-ID: <f97798c20909070031t214e42e3k470da093a972b265@mail.gmail.com>
 
Oliver Schmidt wrote:
> From my understanding non of the cc65 targets can produce arbitrary
> numbers of lines and columns. Having the users provide numbers
> directly enforces the impression that many numbers works.
 
The BBC can have 20, 40 or 80 columns and 25 or 32 rows.
 
> to come up with here. A replacement for toggle_videomode should still
 
What does toggle_videomode do?
 
> #define VIDEOMODE_40COL 0x??
> #define VIDEOMODE_80COL 0x??
> 
> These two defines should be available for all targets supporting this
> type of switching to allow for target independent programming.
 
Exactly, viz:
 
#define VIDEOMODE_40COL 0x28   /* ie, 40 */
#define VIDEOMODE_80COL 0x50   /* ie, 80 */
 
so 
  videomode(VIDEOMODE_40COL);
is expanded by the preprocessor to
  videomode(0x28);
which is the same as
  videomode(40);
 
which by Oliver's scheme is: select a 40-column screen mode, let
the system decide how many rows it has, any by my scheme is: select
a 40-column screen mode, I don't care how many rows it has, let the
system decide how many rows it has.
 
Targetting the BBC, that becomes:
 
; videomode(int size)
; -------------------
; x=lsb size  [1]
;
__videomode
lda #22
jsw osrwch
lda #128
cpx #60
bcs ~videomode1
lda #131
~videomode1
jmp oswrch
 
[1] Small-C passes b0-b7 of the top parameters in X, I haven't
checked how cc65 does it. Adjust to fit.
 
> #define VIDEOMODE_40x25 0x??
> #define VIDEOMODE_80x25 0x??
> #define VIDEOMODE_??x?? 0x??
 
You #define whatever you normally need for the implementation.
Having the API pass a parameter that has some relationship to what
it represents gives the code more sense, consistancy and future
proofness.
 
> least two of them with values identical to VIDEOMODE_40COL and
> VIDEOMODE_80COL.
 
The default standard implementation would just need
#define VIDEOMODE_40COL 40 and #define VIDEOMODE_80COL 80.
 
-- 
J.G.Harston - jgh@arcade.demon.co.uk - mdfs.net/User/JGH
A Review of Sheffield City Council's Members' Allowances Scheme
                                  See http://mdfs.net/payreform
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Sep 8 01:01:21 2009

This archive was generated by hypermail 2.1.8 : 2009-09-08 01:01:24 CEST