Skip to content

Commit

Permalink
Fixing cast operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Sblendorio authored and Francesco Sblendorio committed Aug 25, 2021
1 parent 3180ecc commit 3de64ac
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 79 deletions.
32 changes: 10 additions & 22 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
@echo off
cls
del /S/Q target
rd target
md target

cd src\samples

rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-sample.c -o ..\..\target\u-sample.prg
rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-menu.c -o ..\..\target\u-menu.prg
rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-shell.c -o ..\..\target\u-shell.prg
rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat64.prg
rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-echoserver.c -o ..\..\target\u-echoserver.prg
cl65 -O -t c64 ..\lib\ultimate_lib.c u-sample.c -o ..\..\target\u-sample.prg
cl65 -O -t c64 ..\lib\ultimate_lib.c u-menu.c -o ..\..\target\u-menu.prg
cl65 -O -t c64 ..\lib\ultimate_lib.c u-shell.c -o ..\..\target\u-shell.prg
cl65 -O -t c64 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat64.prg
cl65 -O -t c64 ..\lib\ultimate_lib.c u-echoserver.c -o ..\..\target\u-echoserver.prg
cl65 -O -t c64 ..\lib\ultimate_lib.c screen_utility.c ultimateterm.c -o ..\..\target\u-term64.prg
rem cl65 -O -t c128 ..\lib\ultimate_lib.c screen_utility.c ultimateterm.c -o ..\..\target\u-term128.prg
rem cl65 -O -t c128 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat128.prg
rem cl65 -t geos-cbm -O -o ..\..\target\geouterm.cvt geouterm-res.grc ..\lib\ultimate_lib.c geouterm.c
cl65 -O -t c128 ..\lib\ultimate_lib.c screen_utility.c ultimateterm.c -o ..\..\target\u-term128.prg
cl65 -O -t c128 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat128.prg
cl65 -t geos-cbm -O -o ..\..\target\geouterm.cvt geouterm-res.grc ..\lib\ultimate_lib.c geouterm.c

cd ..\..

choice /c yn /n /m "Run on Ultimate64 Yes, No?"
if %ERRORLEVEL% == 2 exit /b

u64remote 192.168.7.64 reset
u64remote 192.168.7.64 run target\u-term64.prg


exit /b
petcat -w2 -o ..\..\target\loader.prg loader.bas

del *.o
del ..\lib\*.o

petcat -w2 -o ..\..\target\loader.prg loader.bas

cd ..\..\target

c1541 -format "ultimatedemos,sh" d64 UltimateTerm-and-demos.d64
Expand All @@ -53,4 +41,4 @@ c1541 -attach UltimateTerm-and-demos.d64 -write ..\src\samples\u-term.seq u-term
del /Q geouterm.cvt
del /Q loader.prg


cd ..
6 changes: 3 additions & 3 deletions src/lib/ultimate_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ static unsigned char *statusreg = (unsigned char *)STATUS_REG;
static unsigned char *respdatareg = (unsigned char *)RESP_DATA_REG;
static unsigned char *statusdatareg = (unsigned char *)STATUS_DATA_REG;

unsigned char uii_status[STATUS_QUEUE_SZ];
unsigned char uii_data[DATA_QUEUE_SZ*2];
unsigned char temp_string_onechar[2];
char uii_status[STATUS_QUEUE_SZ];
char uii_data[DATA_QUEUE_SZ*2];
char temp_string_onechar[2];
int uii_data_index;
int uii_data_len;

Expand Down
4 changes: 2 additions & 2 deletions src/lib/ultimate_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Patches and pull requests are welcome

#define uii_success() (uii_status[0] == '0' && uii_status[1] == '0')

extern unsigned char uii_status[STATUS_QUEUE_SZ];
extern unsigned char uii_data[DATA_QUEUE_SZ*2];
extern char uii_status[STATUS_QUEUE_SZ];
extern char uii_data[DATA_QUEUE_SZ*2];

struct DirectoryEntry {
unsigned char attributes;
Expand Down
18 changes: 9 additions & 9 deletions src/samples/geouterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ unsigned char cx,cy;
unsigned char socketnr = 0;
int datacount = 0;
char buff[2] = {0,0};
unsigned char fontbuff40[1000];
unsigned char fontbuff80[600];
char fontbuff40[1000];
char fontbuff80[600];
char host[80];
char portbuf[9];
unsigned short port;
Expand Down Expand Up @@ -78,7 +78,7 @@ void loadFonts()

void clearTerminal(unsigned char fontsize)
{
unsigned char *s = " GeoUTerm ";
char *s = " GeoUTerm ";
unsigned short hdrY = 0;

if ((osType & GEOS64) == GEOS64) // c64
Expand Down Expand Up @@ -218,8 +218,8 @@ void handle_io(void)
unsigned char ch = 0;
unsigned char x = 0;
unsigned char t = 0;
unsigned char *dat;
unsigned char buf[3];
char *dat;
char buf[3];

#ifdef TESTING
return;
Expand Down Expand Up @@ -400,7 +400,7 @@ void switch4080(void)
SetNewMode();

set40col();
DoMenu(&mainMenu);
DoMenu((struct menu *)&mainMenu);
}

void main(void)
Expand All @@ -418,20 +418,20 @@ void main(void)
{
DlgBoxOk ("GeoUTerm v1.0", "Commodore 128 40 column mode");
set40col();
DoMenu(&mainMenu);
DoMenu((struct menu *)&mainMenu);
}
else
{
DlgBoxOk ("GeoUTerm v1.0", "Commodore 128 80 column mode");
set40col();
DoMenu(&mainMenu);
DoMenu((struct menu *)&mainMenu);
}
}
else
{
DlgBoxOk ("GeoUTerm v1.0", "For the Commodore 64");
set40col();
DoMenu(&mainMenu);
DoMenu((struct menu *)&mainMenu);
}

#ifndef TESTING
Expand Down
24 changes: 12 additions & 12 deletions src/samples/u-chat.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void irc_updateheader(char *chan);
void irc_login(void);
void irc_refreshscreen(void);
void irc_print(char *buf, int newlineflg);
void irc_pong(unsigned char *buf);
void irc_pong(char *buf);
void irc_help(void);
void irc_handleinput(char *buf);
void getconfig(void);
Expand Down Expand Up @@ -193,7 +193,7 @@ void irc_login(void) // Handle IRC login procedures
char USER_STRING[128];
char *chan;

chan = (unsigned char*) malloc(50 * sizeof(unsigned char));
chan = (char*) malloc(50 * sizeof(unsigned char));

sprintf(NICK_STRING, "nick %s\r\n", nick); // NICK user
sprintf(USER_STRING, "user %s * 0 :%s\r\n", nick, strlen(realname) == 0 ? nick : realname); // USER user * 0 :Real name
Expand Down Expand Up @@ -347,7 +347,7 @@ void irc_print(char *buf, int newlineflg)

}

void irc_pong(unsigned char *buf)
void irc_pong(char *buf)
{
buf[0] = 'p';
buf[1] = 'o';
Expand Down Expand Up @@ -537,8 +537,8 @@ void main(void)
unsigned char newline = 0;
unsigned char connected = 0;
char *msgptr;
unsigned char* sender;
unsigned char* tmpPtr;
char* sender;
char* tmpPtr;
//unsigned char* tmpPtr2;

POKEW(0xD020,0);
Expand Down Expand Up @@ -593,7 +593,7 @@ void main(void)
{
if (strstr(inbuf, " privmsg ") != 0)
{
sender = (unsigned char*) malloc(40 * sizeof(unsigned char));
sender = (char*) malloc(40 * sizeof(char));

i = 1;
while(inbuf[i] != '!')
Expand All @@ -606,7 +606,7 @@ void main(void)

if (strstr(inbuf, "action ") != 0)
{
tmpPtr = (unsigned char*) malloc(80 * sizeof(unsigned char));
tmpPtr = (char*) malloc(80 * sizeof(char));
strcpy(tmpPtr," * ");
strcat(tmpPtr,sender);
strcat(tmpPtr," ");
Expand Down Expand Up @@ -648,7 +648,7 @@ void main(void)
}
else if (strstr(inbuf, " join ") != 0)
{
sender = (unsigned char*) malloc(80 * sizeof(unsigned char));
sender = (char*) malloc(80 * sizeof(char));
i = 1;
while(inbuf[i] != '!')
{
Expand All @@ -669,7 +669,7 @@ void main(void)
}
else if (strstr(inbuf, " part ") != 0)
{
sender = (unsigned char*) malloc(80 * sizeof(unsigned char));
sender = (char*) malloc(80 * sizeof(char));
i = 1;
while(inbuf[i] != '!')
{
Expand All @@ -690,7 +690,7 @@ void main(void)
}
else if (strstr(inbuf, " quit ") != 0)
{
sender = (unsigned char*) malloc(80 * sizeof(unsigned char));
sender = (char*) malloc(80 * sizeof(char));
i = 1;
while(inbuf[i] != '!')
{
Expand All @@ -711,7 +711,7 @@ void main(void)
}
else if (strstr(inbuf, " nick ") != 0)
{
sender = (unsigned char*) malloc(80 * sizeof(unsigned char));
sender = (char*) malloc(80 * sizeof(char));
i = 1;
while(inbuf[i] != '!')
{
Expand All @@ -737,7 +737,7 @@ void main(void)
}
else if (strstr(inbuf, " quit ") != 0)
{
sender = (unsigned char*) malloc(80 * sizeof(unsigned char));
sender = (char*) malloc(80 * sizeof(char));
i = 1;
while(inbuf[i] != '!')
{
Expand Down
2 changes: 1 addition & 1 deletion src/samples/u-sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void main(void)
printf("\n\nIdentify: %s\nStatus: %s", uii_data, uii_status);

uii_getinterfacecount();
printf("\n\nInterface count: %d\nStatus: %s", atoi(uii_data), uii_status);
printf("\n\nInterface count: %d\nStatus: %us", atoi(uii_data), uii_status);

uii_getipaddress();
printf("\n\nIP Address: %d.%d.%d.%d", uii_data[0], uii_data[1], uii_data[2], uii_data[3]);
Expand Down
4 changes: 2 additions & 2 deletions src/samples/u-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#define MAXINPUT 160
#define MAXPARAM_SZ 20

unsigned char buf[MAXINPUT];
char buf[MAXINPUT];

unsigned char params[4][MAXPARAM_SZ];
char params[4][MAXPARAM_SZ];
unsigned char paramcount = 0;
unsigned char running = 1;

Expand Down
Loading

0 comments on commit 3de64ac

Please sign in to comment.