66#include "files.h"
77#include "consts.h"
88#include "types.h"
9+ #include "utility.h"
910
1011#include <atari.h>
1112#include <conio.h>
@@ -32,8 +33,8 @@ char CONSOLE_BUFF[GFX_0_MEM_LINE * CONSOLE_LINES];
3233#else
3334#define CONSOLE_BUFF ((byte*)((ushort*)ORG_SDLIST)[2])
3435#endif
35- char * tokens [] = { 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 }; // Maximum of 8 tokens
36- char server [80 ] = { "N:TCP://192.168.1.205:9999 /\"\0" };
36+ char * tokens [8 ]; // = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; // Maximum of 8 tokens
37+ char server [80 ] = { "N:TCP://192.168.1.126:5556 /\"\0" };
3738
3839void reset_console (void )
3940{
@@ -70,7 +71,7 @@ byte get_tokens(byte* buff, byte endx)
7071 }
7172 }
7273
73- // Fix last token. For some strange reason, the last token is ending with 0x80
74+ // Fix last token. For some strange reason, the last token is ending with 0x80 (ENTER key?)
7475 i = strlen (tokens [count - 1 ]);
7576 tokens [count - 1 ][i - 1 ] = 0x0 ;
7677
@@ -86,17 +87,6 @@ byte get_tokens(byte* buff, byte endx)
8687 return count ;
8788}
8889
89- void fix_chars (char * buff )
90- {
91- byte i ;
92- for (i = 0 ;i < MAX_LINE_LEN ;++ i )
93- {
94- if (buff [i ]) // leave the null terminator
95- if (buff [i ] <= 63 )
96- buff [i ] += 32 ;
97- }
98- }
99-
10090void process_command (byte ntokens )
10191{
10292 if (!ntokens )
@@ -128,21 +118,21 @@ void process_command(byte ntokens)
128118 {
129119 switch (tokens [1 ][0 ])
130120 {
131- case 16 :
121+ case '0' :
132122 setGraphicsMode (GRAPHICS_0 );
133123 break ;
134- case 24 :
124+ case '8' :
135125 setGraphicsMode (GRAPHICS_8 );
136126 break ;
137- case 25 :
127+ case '9' :
138128 setGraphicsMode (GRAPHICS_9 );
139129 break ;
140- case 17 :
130+ case '1' :
141131 switch (tokens [1 ][1 ])
142- { case 16 :
132+ { case '0' :
143133 setGraphicsMode (GRAPHICS_10 );
144134 break ;
145- case 17 :
135+ case '1' :
146136 setGraphicsMode (GRAPHICS_11 );
147137 break ;
148138 }
@@ -160,7 +150,7 @@ void process_command(byte ntokens)
160150 {
161151 if (ntokens > 1 )
162152 {
163- fix_chars (tokens [1 ]);
153+ //internal_to_atascii (tokens[1], 40 );
164154 load_image_file (tokens [1 ]);
165155 }
166156 else
@@ -196,9 +186,7 @@ void process_command(byte ntokens)
196186 else
197187 {
198188 if (strncmp (tokens [1 ], "server" , 3 ) == 0 )
199- {
200189 strncpy (server , tokens [2 ], 79 );
201- }
202190 }
203191 }
204192
@@ -264,10 +252,11 @@ void start_console(char first_char)
264252 {
265253 // process the tokens
266254 #define WORKING_BUFF_SIZE 80
267- byte buff [80 ]; // two lines of data
255+ byte buff [WORKING_BUFF_SIZE ]; // two lines of data
268256 byte ntokens = 0 ;
269257
270258 memcpy (buff , CONSOLE_BUFF , WORKING_BUFF_SIZE );
259+ internal_to_atascii (buff , WORKING_BUFF_SIZE );
271260
272261 #ifdef DEBUG_CONSOLE
273262 gotoxy (0 ,1 );
@@ -312,8 +301,13 @@ void start_console(char first_char)
312301
313302 if (ntokens > 0 )
314303 {
304+ byte i ;
315305 reset_console ();
316306 process_command (ntokens );
307+
308+ // Clear the tokens for the next command
309+ for (i = 0 ; i < 7 ; ++ i )
310+ tokens [i ] = 0x0 ;
317311 }
318312
319313 reset_console ();
0 commit comments