flat assembler
Message board for the users of flat assembler.

Index > Main > Error: Invalid Value

Author
Thread Post new topic Reply to topic
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
This code gets an error on the TIMES line: Error: Invalid Value.:

Code:
SmiddyOS:

file 'SMIDDYOS.SYS'

.End:

        TIMES 2048 -( $ - SmiddyOS )         DB 0    ; Aligns SmiddyOS (a file is aligned after its actual size)    


However, this code works:

Code:
BootRecordVolumeDescriptor:

    db 0                                           ; Volume descriptor type
    db "CD001"                                     ; Standard identifier
    db 1                                           ; Volume descriptor version
    db "EL TORITO SPECIFICATION",0,0,0,0,0,0,0,0,0 ; Boot system identifier ("a-characters", sort of)
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0       ; Boot identifier ("a-characters")
    dd (BOOTCatalog - CDROMImageStart) / 2048      ; Absolute pointer to first sector of boot catalog (this is a sector number)
;    times 1973 db 0                                ; Unused

    TIMES 2048-($-BootRecordVolumeDescriptor)    DB 0                       ; Aligns Boot Record Volume Descriptor

.End:    


I assume because I'm using the file and FASM isn't keeping track of the location when a binary file is brought it. Can someone confirm this? I can hard code this, but would prefer to do it at compile time.
Post 01 Nov 2011, 01:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17472
Location: In your JS exploiting you and your system
revolution
What is the size of SMIDDYOS.SYS? Is it greater than 2048 bytes?

You can use and here also:
Code:
times (2048-($-label)) and 0x7ff db 0    
Post 01 Nov 2011, 01:45
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Yep, 61 KiB-ish.

So a similar thing to the last one, keeping the boundaries straight then, thanks I'll keep that in my mind from this point forward. Smile
Post 01 Nov 2011, 02:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17472
Location: In your JS exploiting you and your system
revolution
smiddy wrote:
Yep, 61 KiB-ish.

... keeping the boundaries straight then ...
Well you were trying to do times with a negative count: 2048-(61000) = -58952
fasm sees -58952 as 0xFFFFFFFFFFFF19B8
Post 01 Nov 2011, 05:03
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
@smiddy: You are trying to "Aligns Boot Record Volume Descriptor"
You just need to use align 2048
Code:
SmiddyOS:

file 'SMIDDYOS.SYS'

align 2048
.End: ; depending where you want this .End to point
    
Post 01 Nov 2011, 06:21
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17472
Location: In your JS exploiting you and your system
revolution
align generates byte values of 0x90. Not quite the same as db 0.
Post 01 Nov 2011, 06:31
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Madis731 wrote:
@smiddy: You are trying to "Aligns Boot Record Volume Descriptor"
You just need to use align 2048
Code:
SmiddyOS:

file 'SMIDDYOS.SYS'

align 2048
.End: ; depending where you want this .End to point
    

For the file itself, to generate the right length of the file itself, the
Code:
.End:    
needs to come before the alignment.
Code:
(SmiddyOS.End - SmiddyOS) ; Generate the file length    
Which is in the directory entries in the directory above... Smile

revolution: thanks, the slow learning curve is upon me. Very Happy
Post 01 Nov 2011, 11:52
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7752
Location: Kraków, Poland
Tomasz Grysztar
revolution wrote:
align generates byte values of 0x90. Not quite the same as db 0.
OS developers seem to like .balign. Proudly presented as macro solution.
Post 01 Nov 2011, 12:13
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Thanks Mr. Grysztar! I'll leverage that for sure. Smile
Post 01 Nov 2011, 21:13
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.