Use screensize for screen dimensions

git-svn-id: svn://svn.cc65.org/cc65/trunk@1790 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-12-19 23:15:28 +00:00
parent 181748bf03
commit 8b42db95cb

View File

@@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <time.h> #include <time.h>
#include <conio.h> #include <conio.h>
#include <cbm.h> #include <cbm.h>
@@ -857,15 +858,6 @@ static unsigned Voice3 [] = {
/* Screen sizes */
#ifdef __CBM610__
# define MAX_X 80
#else
# define MAX_X 40
#endif
#if defined(__C64__) || defined(__CBM510__) #if defined(__C64__) || defined(__CBM510__)
static unsigned long FreqTab [12] = { static unsigned long FreqTab [12] = {
#ifndef NTSC #ifndef NTSC
@@ -917,6 +909,9 @@ static VoiceCtrl* V [3] = {
&V1, &V2, &V3 &V1, &V2, &V3
}; };
/* Screen dimensions */
static unsigned char XSize, YSize;
/* Variable that contains the time of the next clock tick to play a note */ /* Variable that contains the time of the next clock tick to play a note */
static unsigned char NextClock; static unsigned char NextClock;
@@ -943,7 +938,7 @@ static void MakeTeeLine (unsigned char Y)
/* Make a divider line */ /* Make a divider line */
{ {
cputcxy (0, Y, CH_LTEE); cputcxy (0, Y, CH_LTEE);
chline (MAX_X - 2); chline (XSize - 2);
cputc (CH_RTEE); cputc (CH_RTEE);
} }
@@ -953,27 +948,27 @@ static void MakeNiceScreen (void)
/* Make a nice screen */ /* Make a nice screen */
{ {
typedef struct { typedef struct {
unsigned char X;
unsigned char Y; unsigned char Y;
char* Msg; char* Msg;
} TextDesc; } TextDesc;
static TextDesc Text [] = { static TextDesc Text [] = {
{ (MAX_X / 2) - 11, 2, "Wolfgang Amadeus Mozart" }, { 2, "Wolfgang Amadeus Mozart" },
{ (MAX_X / 2) - 12, 4, "\"Eine kleine Nachtmusik\"" }, { 4, "\"Eine kleine Nachtmusik\"" },
{ (MAX_X / 2) - 4, 5, "(KV 525)" }, { 5, "(KV 525)" },
{ (MAX_X / 2) - 14, 9, "Ported to the SID in 1987 by" }, { 9, "Ported to the SID in 1987 by" },
{ (MAX_X / 2) - 10, 11, "Joachim von Bassewitz" }, { 11, "Joachim von Bassewitz" },
{ (MAX_X / 2) - 13, 12, "(joachim@von-bassewitz.de)" }, { 12, "(joachim@von-bassewitz.de)" },
{ (MAX_X / 2) - 1, 13, "and" }, { 13, "and" },
{ (MAX_X / 2) - 10, 14, "Ullrich von Bassewitz" }, { 14, "Ullrich von Bassewitz" },
{ (MAX_X / 2) - 13, 15, "(ullrich@von-bassewitz.de)" }, { 15, "(ullrich@von-bassewitz.de)" },
{ (MAX_X / 2) - 9, 18, "C Implementation by" }, { 18, "C Implementation by" },
{ (MAX_X / 2) - 10, 19, "Ullrich von Bassewitz" }, { 19, "Ullrich von Bassewitz" },
{ (MAX_X / 2) - 11, 23, "Press any key to quit..." }, { 23, "Press any key to quit..." },
}; };
TextDesc* T; register const TextDesc* T;
unsigned char I; unsigned char I;
unsigned char X;
/* Clear the screen hide the cursor, set colors */ /* Clear the screen hide the cursor, set colors */
#ifdef __CBM610__ #ifdef __CBM610__
@@ -988,27 +983,33 @@ static void MakeNiceScreen (void)
/* Top line */ /* Top line */
cputcxy (0, 0, CH_ULCORNER); cputcxy (0, 0, CH_ULCORNER);
chline (MAX_X - 2); chline (XSize - 2);
cputc (CH_URCORNER); cputc (CH_URCORNER);
cgetc ();
/* Left line */ /* Left line */
cvlinexy (0, 1, 23); cvlinexy (0, 1, 23);
cgetc ();
/* Bottom line */ /* Bottom line */
cputc (CH_LLCORNER); cputc (CH_LLCORNER);
chline (MAX_X - 2); chline (XSize - 2);
cputc (CH_LRCORNER); cputc (CH_LRCORNER);
cgetc ();
/* Right line */ /* Right line */
cvlinexy (MAX_X - 1, 1, 23); cvlinexy (XSize - 1, 1, 23);
cgetc ();
/* Several divider lines */ /* Several divider lines */
MakeTeeLine (7); MakeTeeLine (7);
MakeTeeLine (22); MakeTeeLine (22);
cgetc ();
/* Write something into the frame */ /* Write something into the frame */
for (I = 0, T = Text; I < sizeof (Text) / sizeof (Text [0]); ++I) { for (I = 0, T = Text; I < sizeof (Text) / sizeof (Text [0]); ++I) {
cputsxy (T->X, T->Y, T->Msg); X = (XSize - strlen (T->Msg)) / 2;
cputsxy (X, T->Y, T->Msg);
++T; ++T;
} }
} }
@@ -1066,6 +1067,9 @@ int main (void)
/* Initialize the debugger */ /* Initialize the debugger */
DbgInit (0); DbgInit (0);
/* Get the screen dimensions */
screensize (&XSize, &YSize);
/* Make a nice screen */ /* Make a nice screen */
MakeNiceScreen (); MakeNiceScreen ();