flat assembler
Message board for the users of flat assembler.

flat assembler > OS Construction > Compile time, included file's information?

Author
Thread Post new topic Reply to topic
smiddy



Joined: 31 Oct 2004
Posts: 559
Hi,

I have tried without success to find on here if I include file into making say an *.ISO, I'd like to include the files date and time information on the fly, instead of hard writing it into my ISO creator (I'm at work, so I can not post it from here, I don't have it). Has anyone done any work with that? Sorry, I have tried searching to no avail on here and am stumped other than writing another program to write the ISO generator and then compile the ISO from that generated code.
Post 19 Mar 2012, 19:21
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
The %t parameter can be deconstructed into it's time and date components from its seconds value.

EDIT: This is the time but I don't don't know how to get date
Code:
x = %t

time_s =  x         mod 60
time_m = (x /   60) mod 60
time_h = (x / 3600) mod 24    
Post 19 Mar 2012, 19:48
View user's profile Send private message Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 218
cod3b453 wrote:
The %t parameter can be deconstructed into it's time and date components from its seconds value.

EDIT: This is the time but I don't don't know how to get date

http://board.flatassembler.net/topic.php?t=1139

_________________
Mike Gonta
look and see - many look but few see

http://mikegonta.com
Post 19 Mar 2012, 21:42
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
Thanks for that info Mike Gonta

In particular, this post http://board.flatassembler.net/topic.php?p=8586#8586 shows how to extract the date information correctly.
Post 19 Mar 2012, 22:31
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
Isn't that just the current time/date?

For instance if I do:

Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SmiddyOS File Inclussion
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SmiddyOS:

file 'SMIDDYOS.EXE'

.End:

    times 2047 - ($+2047) mod 2048 db 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VENDOR.TXT File Inclussion
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

VendorTextFile:

file 'VENDORS.TXT'

.End:

;        TIMES 2048-($-VendorTextFile)     ; Aligns VENDORS.TXT (a file is aligned after its actual size)
    times 2047 - ($+2047) mod 2048 db 0
    


I'd like to include the files information in here:

Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Root Directory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

RootDirectory:

   db .RootDirectoryEnd - RootDirectory         ; (0) Length of this directory entry
   db 0                                         ; (1) Extended Attribute Record Length (0 ?)
   dd (RootDirectory - CDROMImageStart) / 2048  ; (2) Location of root directory in Little Endian
   BED (RootDirectory - CDROMImageStart) / 2048 ; (6) Location of root directory in Big Endian
   dd .RootDirectoryEnd - RootDirectory         ; (10) The size in sectors (Big or Little Endian)
   BED .RootDirectoryEnd - RootDirectory        ; (14) The size in sectors (Big or Little Endian)
   db 111                                       ;;; (1Cool Number of years since 1900
   db 12                                        ;;; (19) Month of the year 1 to 12
   db 4                                         ;;; (20) Day of the month 1 to 31
   db 8                                         ;;; (21) Hour of the day 0 to 23
   db 53                                        ;;; (22) Minute of the hour 0 to 59
   db 0                                         ;;; (23) Second of the minute 0 to 59
   db -20                                       ;;; (24) Offset from GMT in number of 15 minute intervals (CST = -20)
   db 00000010b                                 ; (25) File Attributes 0b = Existence; 1b = Directory; 2b = Associated File; 3b = Record?; 4b = Protection; 5b - 6b = Reserved; 7b = Multi-Extent
   db 0                                         ; (26) File unit size, 0 = not used
   db 0                                         ; (27) Interleave Gap 0 = not used
   dw 1                                         ; (2Cool Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   BEW 1                                        ; (30) Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   db 1                                         ; (32) Length of file name (next field)
   db 0                                         ; (33) file name (next field)

.RootDirectoryEnd:

RootDirectory2:

   db .RootDirectoryEnd2 - RootDirectory2   ; Length of this directory entry
   db 0                                    ; Extended Attribute Record Length (0 ?)
   dd (RootDirectory - CDROMImageStart) / 2048 ; Location of root directory in Big or Little Endian
   BED (RootDirectory - CDROMImageStart) / 2048
   dd RootDirectory.RootDirectoryEnd - RootDirectory    ; The size in sectors (Big or Little Endian)
   BED RootDirectory.RootDirectoryEnd - RootDirectory   ; The size in sectors (Big or Little Endian)
   db 111                                  ;;; Number of years since 1900
   db 12                                   ;;; Month of the year 1 to 12
   db 4                                    ;;; Day of the month 1 to 31
   db 8                                    ;;; Hour of the day 0 to 23
   db 53                                   ;;; Minute of the hour 0 to 59
   db 0                                    ;;; Second of the minute 0 to 59
   db -20                                  ;;; Offset from GMT in number of 15 minute intervals (CST = -20)
   db 00000010b                            ; File Attributes 0b = Existence; 1b = Directory; 2b = Associated File; 3b = Record?; 4b = Protection; 5b - 6b = Reserved; 7b = Multi-Extent
   db 0                                    ; File unit size, 0 = not used
   db 0                                    ; Interleave Gap 0 = not used
   dw 1                                    ; Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   BEW 1                                   ; Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   db 1                                    ; Length of file name (next field)
   db 1                                    ; file name (next field) Identifies Parent Directory

.RootDirectoryEnd2:

SmiddyOSFile:

   db .SmiddyOSFileEnd - SmiddyOSFile       ; Length of this directory entry
   db 0                                    ; Extended Attribute Record Length (0 ?)
   dd (SmiddyOS - CDROMImageStart) / 2048  ; Location of SmiddyOS in Big or Little Endian
   BED (SmiddyOS - CDROMImageStart) / 2048
   dd SmiddyOS.End - SmiddyOS              ; The size in bytes (Big or Little Endian)
   BED SmiddyOS.End - SmiddyOS             ; The size in bytes (Big or Little Endian)
   db 111                                  ;;; Number of years since 1900 \
   db 10                                   ;;; Month of the year 1 to 12   \
   db 28                                   ;;; Day of the month 1 to 31     \_ I will need to setup a way to extract the time from the files on the fly
   db 14                                   ;;; Hour of the day 0 to 23      /
   db 54                                   ;;; Minute of the hour 0 to 59  /
   db 59                                   ;;; Second of the minute 0 to 59
   db -20                                  ;;; Offset from GMT in number of 15 minute intervals (CST = -20)
   db 00000000b                            ; File Attributes 0b = Existence; 1b = Directory; 2b = Associated File; 3b = Record?; 4b = Protection; 5b - 6b = Reserved; 7b = Multi-Extent
   db 0                                    ; File unit size, 0 = not used
   db 0                                    ; Interleave Gap 0 = not used
   dw 1                                    ; Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   BEW 1                                   ; Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   db (.NameEnd - .NameStart)              ; Length of file name (next field)
.NameStart:
   db "SMIDDYOS.EXE"                                        ; file name (next field)
.NameEnd:
   times ((.NameEnd - .NameStart) and 0) db 0    ; A Zero pads teh end of the entry it seems

.SmiddyOSFileEnd:

VendorText:

   db .VendorTextEnd - VendorText                ; Length of this directory entry
   db 0                                          ; Extended Attribute Record Length (0 ?)
   dd (VendorTextFile - CDROMImageStart) / 2048  ; Location of VENDOR.TXT in Big or Little Endian
   BED (VendorTextFile - CDROMImageStart) / 2048
   dd VendorTextFile.End - VendorTextFile        ; The size in bytes (Big or Little Endian)
   BED VendorTextFile.End - VendorTextFile       ; The size in bytes (Big or Little Endian)
   db 111                                        ;;; Number of years since 1900 \
   db 10                                         ;;; Month of the year 1 to 12   \
   db 29                                   ;;; Day of the month 1 to 31     \_ I will need to setup a way to extract the time from the files on the fly
   db 14                                   ;;; Hour of the day 0 to 23      /
   db 55                                   ;;; Minute of the hour 0 to 59  /
   db 59                                   ;;; Second of the minute 0 to 59
   db -20                                  ;;; Offset from GMT in number of 15 minute intervals (CST = -20)
   db 00000000b                            ; File Attributes 0b = Existence; 1b = Directory; 2b = Associated File; 3b = Record?; 4b = Protection; 5b - 6b = Reserved; 7b = Multi-Extent
   db 0                                    ; File unit size, 0 = not used
   db 0                                    ; Interleave Gap 0 = not used
   dw 1                                    ; Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   BEW 1                                    ; Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
   db (.NameEnd - .NameStart)                     ; Length of file name (next field)
.NameStart:
   db "VENDORS.TXT"                                        ; file name (next field)
.NameEnd:
   times ((.NameEnd - .NameStart) and 0) db 0    ; A Zero pads teh end of the entry it seems

.VendorTextEnd:

;ZenithDirectory:
;
;   db .ZenithDirectoryEnd - ZenithDirectory         ; (0) Length of this directory entry
;   db 0                                         ; (1) Extended Attribute Record Length (0 ?)
;   dd (ZenithDirectory1 - CDROMImageStart) / 2048  ; (2) Location of Zenith directory in Little Endian
;   BED (ZenithDirectory1 - CDROMImageStart) / 2048 ; (6) Location of Zenith directory in Big Endian
;   dd .ZenithDirectoryEnd - ZenithDirectory         ; (10) The size in sectors (Big or Little Endian)
;   BED .ZenithDirectoryEnd - ZenithDirectory        ; (14) The size in sectors (Big or Little Endian)
;   db 111                                       ;;; (1Cool Number of years since 1900
;   db 10                                        ;;; (19) Month of the year 1 to 12
;   db 26                                        ;;; (20) Day of the month 1 to 31
;   db 14                                        ;;; (21) Hour of the day 0 to 23
;   db 53                                        ;;; (22) Minute of the hour 0 to 59
;   db 59                                        ;;; (23) Second of the minute 0 to 59
;   db -20                                       ;;; (24) Offset from GMT in number of 15 minute intervals (CST = -20)
;   db 00000010b                                 ; (25) File Attributes 0b = Existence; 1b = Directory; 2b = Associated File; 3b = Record?; 4b = Protection; 5b - 6b = Reserved; 7b = Multi-Extent
;   db 0                                         ; (26) File unit size, 0 = not used
;   db 0                                         ; (27) Interleave Gap 0 = not used
;   dw 1                                         ; (2Cool Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
;   BEW 1                                        ; (30) Volume Sequence Number (Big or Little Endian) not used for us so 0 = not used
;   db (.NameEnd - .NameStart)                     ; Length of file name (next field)
;.NameStart:
;   db 'ZENITH'                                  ; (33) file name (next field)
;.NameEnd:
;   times ((.NameEnd - .NameStart) and 0) db 0    ; A Zero pads teh end of the entry it seems
;
;.ZenithDirectoryEnd:

        
        TIMES 2048-($-RootDirectory)    DB 0                       ; Aligns RootDirectory
        
.End:
    


...where all the file information is, instead of hard coding it.

Does this make sense? Does the %t pull the information on the included files? How specifically do I get it?

ie. SMIDDYOSEXEDate = %T.SMIDDYOS.EXE or something?
Post 19 Mar 2012, 23:59
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
Apologies I total misunderstood Embarassed

External file time stamp information is OS specific, so I don't think there is a direct way to do this. [This might be a possible addition to FASM, as it has OS wrapper code for files anyway] However, this kind of task cna be handled by an external script. Sorry I can't be of more help.
Post 20 Mar 2012, 18:00
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
Nope, that's kewl! The way I've done it in the past was write a C program to get the information fo packaging up a "build" so I may do that very same thing but instead write the CDROM.ASM file out, that creates the *.ISO, which will have that information within it. I was hoping there was a direct what at compile to to gather that information. Smile
Post 20 Mar 2012, 18:18
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.