From be7c24177c7eb0b3b86bc76b6f603368f6981ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Pati=C3=B1o?= Date: Sat, 3 Aug 2013 15:42:16 +0200 Subject: [PATCH 1/3] Promoted _auxtype to a struct to gain access to additional fields While creating files there was no possibility to explicitly set the time or date. This is necessary for example while copying files since the original time and date should be kept. --- include/apple2.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/apple2.h b/include/apple2.h index 190248b0d..396ddfde5 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -139,7 +139,12 @@ extern unsigned char _dos_type; * following variables to determine the file type and the aux type to use. */ extern unsigned char _filetype; /* Default 6 */ -extern unsigned int _auxtype; /* Default 0 */ +extern struct { + unsigned int aux; + unsigned char storage; + unsigned int date; + unsigned int time; +} _auxtype; /* Default 0 */ /* The addresses of the static drivers */ #if !defined(__APPLE2ENH__) From 9b157a5b1e7c2be37a6bb2a030290d89a556d7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Pati=C3=B1o?= Date: Sat, 3 Aug 2013 19:08:36 +0200 Subject: [PATCH 2/3] Defined a struct to contain the date and time data To keep backward compatibility auxtype and the date/time are kept separated. A struct similar to the one used in dirent.h is used to access the create_date and create_time fields. --- include/apple2.h | 16 +++++++++++----- libsrc/apple2/open.s | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/apple2.h b/include/apple2.h index 396ddfde5..89a01d857 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -139,12 +139,18 @@ extern unsigned char _dos_type; * following variables to determine the file type and the aux type to use. */ extern unsigned char _filetype; /* Default 6 */ +extern unsigned int _auxtype; /* Default 0 */ extern struct { - unsigned int aux; - unsigned char storage; - unsigned int date; - unsigned int time; -} _auxtype; /* Default 0 */ + struct { + unsigned day :5; + unsigned mon :4; + unsigned year :7; + } createdate; + struct { + unsigned char min; + unsigned char hour; + } createtime; +} _datetime; /* The addresses of the static drivers */ #if !defined(__APPLE2ENH__) diff --git a/libsrc/apple2/open.s b/libsrc/apple2/open.s index db40c3c74..b1686df70 100644 --- a/libsrc/apple2/open.s +++ b/libsrc/apple2/open.s @@ -5,7 +5,7 @@ ; .export _open, closedirect, freebuffer - .export __filetype, __auxtype + .export __filetype, __auxtype, __datetime .constructor raisefilelevel .destructor closeallfiles, 5 @@ -246,5 +246,6 @@ __filetype: __auxtype: .word $0000 ; AUX_TYPE: Load address N/A .byte $01 ; STORAGE_TYPE: Standard seedling file +__datetime: .word $0000 ; CREATE_DATE: Current date .word $0000 ; CREATE_TIME: Current time From 7d9bba213bf7f4dca221899c59571baa36293d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Pati=C3=B1o?= Date: Thu, 8 Aug 2013 18:23:48 +0200 Subject: [PATCH 3/3] Comments added --- include/apple2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/apple2.h b/include/apple2.h index 89a01d857..51475e234 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -138,18 +138,18 @@ extern unsigned char _dos_type; /* The file stream implementation and the POSIX I/O functions will use the * following variables to determine the file type and the aux type to use. */ -extern unsigned char _filetype; /* Default 6 */ -extern unsigned int _auxtype; /* Default 0 */ +extern unsigned char _filetype; /* Default: 6 */ +extern unsigned int _auxtype; /* Default: 0 */ extern struct { struct { unsigned day :5; unsigned mon :4; unsigned year :7; - } createdate; + } createdate; /* Current date: 0 */ struct { unsigned char min; unsigned char hour; - } createtime; + } createtime; /* Current time: 0 */ } _datetime; /* The addresses of the static drivers */