flat assembler
Message board for the users of flat assembler.

Index > Main > Automatically setting the date of your copyright

Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 17 Nov 2004, 08:37
Code:
__currenttime         =%t
__quadyearvalue          =(__currenttime+31536000)/126230400
__quadyearremainder      =(__currenttime+31536000)-(126230400*__quadyearvalue)
__quadyearsection      =__quadyearremainder/31536000
__year                 =1969+(__quadyearvalue*4)+__quadyearsection-\
                       (__quadyearsection shr 2)
__leapyear                =__quadyearsection/3
__yearseconds           =__quadyearremainder-31536000*\
                    (__quadyearsection-__quadyearsection/4)
__yearday            =__yearseconds/86400
__yeardaytemp           =__yearday
if (__yeardaytemp>=(59+__leapyear))
  __yeardaytemp         =__yeardaytemp+3-__leapyear
end if
if (__yeardaytemp>=123)
  __yeardaytemp          =__yeardaytemp+1
end if
if (__yeardaytemp>=185)
  __yeardaytemp             =__yeardaytemp+1
end if
if (__yeardaytemp>=278)
  __yeardaytemp             =__yeardaytemp+1
end if
if (__yeardaytemp>=340)
  __yeardaytemp             =__yeardaytemp+1
end if
__month           =__yeardaytemp/31+1
__day            =__yeardaytemp-__month*31+32
__dayseconds    =__yearseconds-__yearday*86400
__hour                =__dayseconds/3600
__hourseconds     =__dayseconds-__hour*3600
__minute   =__hourseconds/60
__second   =__hourseconds-__minute*60

__stringyear  equ (__year/1000+'0'),((__year mod 1000)/100+'0'),\
                ((__year mod 100)/10+'0'),((__year mod 10)+'0')
__stringmonth        equ (__month/10+'0'),((__month mod 10)+'0')
__stringday  equ (__day/10+'0'),((__day mod 10)+'0')
__stringhour     equ (__hour/10+'0'),((__hour mod 10)+'0')
__stringminute equ (__minute/10+'0'),((__minute mod 10)+'0')
__stringsecond     equ (__second/10+'0'),((__second mod 10)+'0')

copyright:
     db      'Copyright (C) Revolution 1990-',__stringyear
     db      ', all rights reserved.',0ah
      db      'Last build: '
        db      __stringyear,'/',__stringmonth,'/',__stringday,' '
    db      __stringhour,':',__stringminute,':',__stringsecond,' GMT'
    
Post 17 Nov 2004, 08:37
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 17 Nov 2004, 10:14
There are just some strings, but what if I want to put them in some exe's properties (in the version tab I mean). I think they'd have to be separated.

Another suggestion - shouldn't the name and the beginning of copyright be configurable
like:
Code:
__author equ 'TheBiggestAndTheGreatest'
__beginyear equ '2001'
;...
;...
copyright:
        db      'Copyright © ',__author,' ',__beginyear,'-',__stringyear
    

Now you can put it in an include and let the author and beginyear be easily changable.

EDIT:
Fixed db to equ
Thanks to vid for noticing


Last edited by Madis731 on 17 Nov 2004, 15:06; edited 1 time in total
Post 17 Nov 2004, 10:14
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 17 Nov 2004, 10:53
that won't work, because "db 'Copyright',__author"will insert address of 'TheBiggestAndTheGreatest' string behind 'Copyright' bytes, not the string. You should use something like:
Code:
__author equ 'TheBiggestAndTheGreatest'
copyright:
  db 'Copyright ',__author
    
Post 17 Nov 2004, 10:53
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 17 Nov 2004, 13:14
Useful indeed Wink

Thanks revolution.
Post 17 Nov 2004, 13:14
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 17 Nov 2004, 23:42
But copyright is not forever, and uses system clock right? Smile
Post 17 Nov 2004, 23:42
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 18 Nov 2004, 02:28
Copyrights in most countries last until 50 after the authors death. But check with your local office before taking my word for it.

If your system clock is wrong then of course the dates and times above will also be wrong.

Don't forget about the wrap around at 31 bits and/or 32 bits. Respectively 2038/01/19 03:14:08 and 2106/02/07 06:28:16.

However the calculation will be wrong after 2100-02-28 because 2100 is not a leap year.
Post 18 Nov 2004, 02:28
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 18 Nov 2004, 02:37
Madis731:
You can use the strings in your exe properties also.

For example see the FASMW.ASM
Code:
  version version_info,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\
          'FileDescription','flat assembler',\
   'LegalCopyright',<'Copyright ',0A9h,' 1999-2004 Tomasz Grysztar.'>,\
   'FileVersion',IDE_VERSION_STRING,\
       'ProductVersion',VERSION_STRING,\
        'OriginalFilename','FASMW.EXE'
    


you can replace 2004 with ',__stringyear,'
Post 18 Nov 2004, 02:37
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 18 Nov 2004, 05:44
i'd recommend this :

Copyright 1994-

or
Copyright from 1994
Smile
Post 18 Nov 2004, 05:44
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.