flat assembler
Message board for the users of flat assembler.

Index > OS Construction > int13h floppy and drive emulation.

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4335
Location: Now
edfed 18 Nov 2010, 16:57
last night, i coded an emulation of floppy and hard disk using DOS files.

it works for floppy at c:/fd0.bin, i have tested it on 2 of my old applications that used the floppy, it works fine, pretty usefull to replace the old dead floppy drives i have.

basical useage:
Code:
     org 100h ; and maybe any dos compatible header
     call int13h.new
;
; ...your code here
;
     call int13h.old
;
; ... exit program
;
include '/floppyemul/int13h.inc'   
    



it is in order to debug int13h useage without accessing to real hardware.
my floppy drives are dead, then, it can be interesting to play with an image file, and that will be faster than a real floppy, of course.

there can be other bugs but i didn't detect any fo the moment.


all that this "virtual driver" can do is bring a dos file as a drive image in place of a bios disk image, by installing over the original int13h, it will test for a drive number, then, if it is not the virtual drive number (drive 0 in this code) it will call the normal int13h handler.
if it is the virtual drive, it will read, write and get drive parameters from a file.

the file is fd0.inc, and should be located in c:/

the ideal would be first to be able to create this file from the driver if it don't exist.

about hdd emulation, i don't have positive results, it simply ignore the drive id step...
then for hd drives it don't works.


Description: the readme, in a separate file for the moment
Download
Filename: readme.txt
Filesize: 644 Bytes
Downloaded: 307 Time(s)

Description: the software here is given as is, use it at your own risk, etc etc...
Download
Filename: floppyemul.zip
Filesize: 3.03 KB
Downloaded: 290 Time(s)

Post 18 Nov 2010, 16:57
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4335
Location: Now
edfed 19 Nov 2010, 23:13
lba32 adress test opus1

this is the ram representation of a folder
a succesion of dwords and bytes.
Code:
;supposed to be at LBA= no matter, we are in a fptr,
;in local ram, LBA32 bit offsets maxi.
;and on ram, supposed to be at fptr[seg:0]
;all adresses will be for file link in the 32 bit limit.
;then, it will lead to problems.
macro list [element] {
 common
  local .a
        dd .a-$-4
 forward
        dd element
 common
  .a:
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro string [arg]  {
 common
  forward
        db arg
 common
        align 4
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
f:
.folder='dir'
.file='fil'

org 0

rootdir:
        .size=.end-$
        dd f.folder,.size,.content,.name
.name:  string 'root',0

.content:
        list .fil00,.fil01,.fil02,.fil03,.fil04,.fil05,.fil06,.fil07,.fil08,.fil09

.fil00: dd f.folder,asmdir.size,asmdir/256,@f
@@:     string 'asm',0     ;name

.fil01: dd f.folder,0,0,@f
@@:     string 'images',0

.fil02: dd f.folder,0,0,@f
@@:     string 'sons',0

.fil03: dd f.folder,0,0,@f
@@:     string 'musiques',0

.fil04: dd f.folder,0,0,@f
@@:     string 'films',0

.fil05: dd f.file,0,0,@f
@@:     string 'internet',0

.fil06: dd f.folder,0,0,@f
@@:     string 'datas',0

.fil07: dd f.folder,0,0,@f
@@:     string 'system',0

.fil08: dd f.file,80*2*18*512,floppydrive/256,@f
@@:     string 'fd0.bin',0

.fil09: dd f.file,0,0,@f
@@:     string 'hd0.bin',0

.end:
        align 256

asmdir:
        .size=.end-$
        dd f.folder,.size,.content,.name
.name:  string 'asm',0

.content:
        list .fil00,.fil01,.fil02

.fil00: dd f.folder,0,0,@f
@@:     string 'codes',0

.fil01: dd f.folder,0,0,@f
@@:     string 'fasm',0

.fil02: dd f.folder,0,0,@f
@@:     string 'livres',0

.end:

        align 256
floppydrive:
file 'boot/boot.bin'
file 'shell.com'
    


something like this as a first test of file system management.

the problem will be the file meta datas.
size, location, etc...

where to put them?
in the folder?
in the fileas a gap to a hard disk zone?
Post 19 Nov 2010, 23:13
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.