Skip to content

Commit 71cafa1

Browse files
RichStephensfujinet
andauthored
Fixed file name/datetime/filesize in Atari config. (#124)
* Finally fixed file size * Tweak to match firmware file size fix. --------- Co-authored-by: fujinet <[email protected]>
1 parent 17ffdc2 commit 71cafa1

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/atari/screen.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*
1010
**/
1111

12+
#include <stdio.h>
1213
#include <stdlib.h>
1314
#include <string.h>
1415
#include <conio.h>
@@ -26,6 +27,12 @@ char _visibleEntries;
2627
extern bool copy_mode;
2728
char text_empty[] = "Empty";
2829
char fn[256];
30+
char d[256];
31+
unsigned char byte0;
32+
unsigned char byte1;
33+
unsigned char byte2;
34+
unsigned char byte3;
35+
uint32_t s;
2936

3037
// The currently active screen (basically each time a different displaylist is used that will be considered a screen)
3138
// Used by 'set_cursor' so it knows the layout of the screen and can properly figure out the memory offset needed whengiven an (x, y) coordinate pair.
@@ -129,7 +136,7 @@ void font_init()
129136
memcpy((unsigned char *)FONT_MEMORY, (unsigned char *)0xE000, 1024);
130137

131138
// And patch it.
132-
memcpy(FONT_MEMORY + 520, &fontPatch, sizeof(fontPatch));
139+
memcpy((unsigned char *) FONT_MEMORY + 520, &fontPatch, sizeof(fontPatch));
133140

134141
OS.chbas = FONT_MEMORY >> 8; // use the charset
135142
}
@@ -249,6 +256,7 @@ void screen_show_info(int printerEnabled, AdapterConfigExtended *ac)
249256

250257
void screen_select_slot(char *e)
251258
{
259+
unsigned long *s;
252260
screen_dlist_select_slot();
253261
set_active_screen(SCREEN_SELECT_SLOT);
254262

@@ -262,27 +270,24 @@ void screen_select_slot(char *e)
262270
// Show file details if it's an existing file only.
263271
if ( create == false )
264272
{
265-
// Modified time
266-
// sprintf(d, "%8s %04u-%02u-%02u %02u:%02u:%02u", "MTIME:", (*e++) + 1970, *e++, *e++, *e++, *e++, *e++);
273+
memset(d, 0, sizeof(d));
267274

268-
// Remove for now (wasn't in original config, not really all that important and removng sprintf usage), so skip over the 6 bytes for the file date/time info.
269-
e += 6;
275+
// Modified time
276+
sprintf(d, "%8s %04u-%02u-%02u %02u:%02u:%02u", "MTIME:", (*e++) + 1970, *e++, *e++, *e++, *e++, *e++);
277+
screen_puts(0, DEVICES_END_MOUNT_Y + 3, d);
270278

279+
271280
// File size
272-
// only 2 bytes, so max size is 65535.. don't show for now until SIO method is changed to return more.
273-
// Result is unreliable since if the file was < 65535 bytes it will be ok, but if it was more we don't
274-
// know how to interpret the 2 bytes we have available to us.
275-
//s = (unsigned int *)e;
276-
//sprintf(d, "%8s %u bytes", "SIZE:", *s);
277-
//sprintf(d, "%8s %u K", "SIZE:", *s >> 10);
278-
//screen_puts(0, DEVICES_END_MOUNT_Y + 4, d);
281+
s=(unsigned long *)e; // Cast the next four bytes as a long integer.
279282

280-
// Skip next 4 bytes to get to the filename (2 for the size, 2 for flags we don't care about)
281-
e += 4;
283+
sprintf(d, "%8s %lu K", "SIZE:", *s >> 10);
284+
screen_puts(0, DEVICES_END_MOUNT_Y + 4, d);
282285

286+
e += sizeof(unsigned long) + 3; // Skip isdir, trunc, type
287+
283288
// Filename
284-
screen_puts(1, DEVICES_END_MOUNT_Y + 2, "FILE:");
285-
screen_puts(7, DEVICES_END_MOUNT_Y + 2, e);
289+
screen_puts(3, DEVICES_END_MOUNT_Y + 2, "FILE:");
290+
screen_puts(9, DEVICES_END_MOUNT_Y + 2, e);
286291
}
287292

288293
screen_hosts_and_devices_device_slots(DEVICES_START_MOUNT_Y, &deviceSlots, &deviceEnabled);

0 commit comments

Comments
 (0)