flat assembler
Message board for the users of flat assembler.

Index > OS Construction > [HELP] Reading FAT12/16 file size and allocating far memory

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Im working on new boot code to load files > 64kib
The FAT directory structure stores file size at [28,30] as dword
I need to allocate memory for the file
Note: must be 16bit code
Code:
;es:di -> root directory entity

 mov ax,[es:di+28]      ;file size loword
 mov dx,[es:di+30]      ;file size hiword

;HELP: what to do here?

;ax = size in paragraphs
 call FarAlloc
;out: es = segment base
    

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 07 Dec 2014, 22:40
View user's profile Send private message Reply with quote
SeproMan



Joined: 11 Oct 2009
Posts: 60
Location: Belgium
SeproMan
To convert double word into paragraphs first add 15 and then divide by 16.

Code:
add ax,15
adc dx,0
mov cx,16
div cx    

_________________
Real Address Mode.
Post 14 Dec 2014, 18:58
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 GitHub, YouTube, Twitter.

Website powered by rwasa.