+
+
+
+/
+
+- The function is specific to the C128.
+
- This function is replaces
[.
+]- The function is only available as fastcall function, so it may only be
+used in presence of a prototype.
+
+
,
+[,
+][
+]
+
+
+
wherex
diff --git a/include/c128.h b/include/c128.h
index 59cd8f2e5..d4df9919b 100644
--- a/include/c128.h
+++ b/include/c128.h
@@ -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
@@ -75,6 +73,10 @@
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F
+/* Video mode defines */
+#define VIDEOMODE_40COL 0x00
+#define VIDEOMODE_80COL 0x80
+
/* Define hardware */
@@ -98,8 +100,15 @@
+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! */
diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile
index 95b739ecd..80af7fcc0 100644
--- a/libsrc/c128/Makefile
+++ b/libsrc/c128/Makefile
@@ -66,7 +66,8 @@ OBJS = _scrsize.o \
systime.o \
sysuname.o \
tgi_mode_table.o \
- toggle_videomode.o
+ toggle_videomode.o \
+ videomode.o
#--------------------------------------------------------------------------
# Drivers
diff --git a/libsrc/c128/toggle_videomode.s b/libsrc/c128/toggle_videomode.s
index 15931d60b..0cfdd6644 100644
--- a/libsrc/c128/toggle_videomode.s
+++ b/libsrc/c128/toggle_videomode.s
@@ -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
index 000000000..3e34a65d2
--- /dev/null
+++ b/libsrc/c128/videomode.s
@@ -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
+