]> git.sur5r.net Git - cc65/commitdiff
New function videomode() for the C128. Marked toggle_videomode as deprecated.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 7 Sep 2009 13:21:04 +0000 (13:21 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 7 Sep 2009 13:21:04 +0000 (13:21 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4126 b7a2c559-68d2-44c3-8de9-860c34a00d81

doc/funcref.sgml
include/c128.h
libsrc/c128/Makefile
libsrc/c128/toggle_videomode.s
libsrc/c128/videomode.s [new file with mode: 0644]

index 1c307b0d0e38137dc3f2c2625a887ec578440f0f..73d14432a133abbf0b5e13c57e0dcbfe9b4c72fe 100644 (file)
@@ -106,8 +106,9 @@ function.
 <itemize>
 <item><ref id="c64mode" name="c64mode">
 <item><ref id="fast" name="fast">
-<item><ref id="toggle_videomode" name="toggle_videomode">
 <item><ref id="slow" name="slow">
+<item><ref id="toggle_videomode" name="toggle_videomode">
+<item><ref id="videomode" name="videomode">
 </itemize>
 
 
@@ -2008,7 +2009,8 @@ will nearly double the speed compared to slow mode.
 <tag/Availability/C128
 <tag/See also/
 <ref id="slow" name="slow">,
-<ref id="toggle_videomode" name="toggle_videomode">
+<ref id="toggle_videomode" name="toggle_videomode">,
+<ref id="videomode" name="videomode">
 <tag/Example/None.
 </descrip>
 </quote>
@@ -4172,7 +4174,8 @@ will halve the speed compared to fast mode.
 <tag/Availability/C128
 <tag/See also/
 <ref id="fast" name="fast">,
-<ref id="toggle_videomode" name="toggle_videomode">
+<ref id="toggle_videomode" name="toggle_videomode">,
+<ref id="videomode" name="videomode">
 <tag/Example/None.
 </descrip>
 </quote>
@@ -4837,11 +4840,14 @@ old mode (cursor position, color and so on) are saved and restored together
 with the mode.
 <tag/Limits/<itemize>
 <item>The function is specific to the C128.
+<item>This function is deprecated. Please use <ref id="videomode"
+name="videomode"> instead!
 </itemize>
 <tag/Availability/C128
 <tag/See also/
 <ref id="fast" name="fast">,
-<ref id="slow" name="slow">
+<ref id="slow" name="slow">,
+<ref id="videomode" name="videomode">
 <tag/Example/None.
 </descrip>
 </quote>
@@ -4957,7 +4963,7 @@ if (unlink (FILENAME) == 0) {
     printf ("We deleted %s successfully\n", FILENAME);
 } else {
     printf ("There was a problem deleting %s\n", FILENAME);
-}     
+}
 </verb>
 </descrip>
 </quote>
@@ -5020,6 +5026,33 @@ used in presence of a prototype.
 </quote>
 
 
+<sect1>videomode<label id="videomode"><p>
+
+<quote>
+<descrip>
+<tag/Function/Switch to either 40 or 80 column mode.
+<tag/Header/<tt/<ref id="c128.h" name="c128.h">/
+<tag/Declaration/<tt/unsigned char __fastcall__ videomode (unsigned char Mode);/
+<tag/Description/Switch to 40 or 80 column mode depending on the argument. If
+the requested mode is already active, nothing happens. The old mode is returned
+from the call.
+<tag/Limits/<itemize>
+<item>The function is specific to the C128.
+<item>This function is replaces <ref id="toggle_videomode"
+name="toggle_videomode">.
+<item>The function is only available as fastcall function, so it may only be
+used in presence of a prototype.
+</itemize>
+<tag/Availability/C128
+<tag/See also/
+<ref id="fast" name="fast">,
+<ref id="slow" name="slow">,
+<ref id="toggle_videomode" name="toggle_videomode">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>wherex<label id="wherex"><p>
 
 <quote>
index 59cd8f2e5c4f4ef992e8eef2c81d8697a935339f..d4df9919bb34c3bec23007c16f2cf153bba0a3ad 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
-/*               Römerstraße 52                                              */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -55,8 +55,6 @@
 #define CH_F7                  136
 #define CH_F8                  140
 
-
-
 /* Color defines */
 #define COLOR_BLACK            0x00
 #define COLOR_WHITE            0x01
@@ -64,7 +62,7 @@
 #define COLOR_CYAN             0x03
 #define COLOR_VIOLET           0x04
 #define COLOR_GREEN            0x05
-#define COLOR_BLUE             0x06
+#define COLOR_BLUE             0x06       
 #define COLOR_YELLOW           0x07
 #define COLOR_ORANGE           0x08
 #define COLOR_BROWN            0x09
 #define COLOR_LIGHTBLUE        0x0E
 #define COLOR_GRAY3            0x0F
 
+/* Video mode defines */
+#define VIDEOMODE_40COL         0x00
+#define VIDEOMODE_80COL         0x80
+
 
 
 /* Define hardware */
 
 
 
+unsigned char __fastcall__ videomode (unsigned char Mode);
+/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
+ * constants.
+ */
+
 void toggle_videomode (void);
-/* Toggle the video mode between 40 and 80 chars (calls SWAPPER) */
+/* Toggle the video mode between 40 and 80 chars (calls SWAPPER).
+ * THIS FUNCTION IS DEPRECATED, please use videomode instead!
+ */
 
 void c64mode (void);
 /* Switch the C128 into C64 mode. Note: This function will not return! */
index 95b739ecd84c9bbf2a4a1168b50c5d62229c78a4..80af7fcc051a097746af7bd71ba6a77483e66235 100644 (file)
@@ -66,7 +66,8 @@ OBJS =        _scrsize.o              \
         systime.o               \
         sysuname.o              \
        tgi_mode_table.o        \
-       toggle_videomode.o
+       toggle_videomode.o      \
+        videomode.o
 
 #--------------------------------------------------------------------------
 # Drivers
index 15931d60b1706f0a4bea10037b52035af24a9a90..0cfdd6644b3e4458ad4f829aff56ffde75ec1d23 100644 (file)
@@ -8,6 +8,11 @@
        .export         _toggle_videomode
         .import         SWAPPER, BSOUT
 
+; This function is deprecated
+.assert         0, warning, "toggle_videomode() is deprecated, please use videomode() instead!"
+
+
+
 .proc   _toggle_videomode
 
         jsr     SWAPPER                 ; Toggle the mode
diff --git a/libsrc/c128/videomode.s b/libsrc/c128/videomode.s
new file mode 100644 (file)
index 0000000..3e34a65
--- /dev/null
@@ -0,0 +1,33 @@
+;
+; Ullrich von Bassewitz, 2009-09-07
+;
+; unsigned char __fastcall__ videomode (unsigned char Mode);
+; /* Set the video mode, return the old mode */
+;
+
+       .export         _videomode
+        .import         SWAPPER, BSOUT  
+
+        .include        "c128.inc"
+
+
+.proc   _videomode
+
+        cmp     MODE                    ; Do we have this mode already?
+        beq     @L9
+
+        lda     MODE                    ; Get current mode ...
+        pha                             ; ... and save it
+
+        jsr     SWAPPER                 ; Toggle the mode
+       lda     #14
+               jsr     BSOUT                   ; Switch to lower case chars
+        pla                             ; Get old mode into A
+
+; Done, old mode is in A
+
+@L9:    ldx     #$00                    ; Clear high byte
+        rts
+
+.endproc
+