flat assembler
Message board for the users of flat assembler.

Index > OS Construction > bootloader information

Author
Thread Post new topic Reply to topic
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 05:28
im reading files off floppies with my os and need to know the file system of each floppy i use or any user puts into the system, i need to know if this will read the bootloader into memory so i can read it
(assuming the floppy controller has been reset)
org 100h
mov ah, 02h
mov al, 1 ;just the bootloader
mov ch, 1
mov cl, 1
mov dh, 1
mov dl, 00h
mov bx,databuf
mov es,bx
ret
databuf: times 512 db 0

_________________
Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me.
Post 31 Dec 2009, 05:28
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 05:38
i am at a friends house who doesnt have a virtual machine and i need someone to tell me if this works
Post 31 Dec 2009, 05:38
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 31 Dec 2009, 05:49
If your bootloader is at track 1, sector 1, head 1 on drive A then...no it still won't work.
Code:
push cs
pop es
mov bx,databuf    

Sectors are numbered starting from 1 but tracks/heads start from 0
Post 31 Dec 2009, 05:49
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 05:55
org 100h
mov ah, 02h
mov al, 1 ;just the bootloader
mov ch, 0
mov cl, 0
mov dh, 0
mov dl, 00h
push cs
pop es
mov bx, databuf
;;;;;;;do i add a pop cs here?
ret
databuf: times 512 db 0
Post 31 Dec 2009, 05:55
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 31 Dec 2009, 05:57
>do i add a pop cs here
No, maybe an int 13h

Sectors are numbered starting from 1
Post 31 Dec 2009, 05:57
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 06:00
org 100h
mov ah, 02h
mov al, 1 ;just the bootloader
mov ch, 0
mov cl, 1
mov dh, 0
mov dl, 00h
push cs
pop es
mov bx, databuf
int 13h
ret
databuf: times 512 db 0
Post 31 Dec 2009, 06:00
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 31 Dec 2009, 06:16
Code:
mov cl,1 ;to read the first sector (bootsector)    

You are running this from DOS? With a .com file?
Post 31 Dec 2009, 06:16
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 06:31
yea i need a way to get information about the disk my user puts into the drive and tell whether is fat12 or not, and this example with help me know how to, but my os isnt in working condition right now, so i use this example to use in my os, but for now it is a stand alone file that will load the boot sector and print its contents on the screen, for ow i just need to load the first 512 bytes or the disk. i do plan on running this on dos, im not using the dos disk handlers because when this works, ill just copy the function into my os, without having to change the ints used because they are bios, or standalone
Post 31 Dec 2009, 06:31
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 31 Dec 2009, 06:56
Look for info about the BPB (BIOS Parameter Block), which is in the boot sector of a DOS-formatted floppy.
Post 31 Dec 2009, 06:56
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 07:15
i have that already, but thank u, it wont be a dos formatted floppy tho, i just need to load the bootloader into the buffer, and il have the info i need and manipulate it from wat i need
Post 31 Dec 2009, 07:15
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 07:20
so a side question, if i want to put information in say es:ax
all i have to do is
push cs
pop es
mov ax, buffer?
and from there i can put more code to execute or after putting data into es:ax i have to pop cs in order to continue?
Post 31 Dec 2009, 07:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 31 Dec 2009, 07:21
You can't pop cs.
Post 31 Dec 2009, 07:21
View user's profile Send private message Visit poster's website Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 07:26
oh ok thanks, i dont use push or pop alot

_________________
Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me.
Post 31 Dec 2009, 07:26
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 31 Dec 2009, 07:30
>You can't pop cs.
heh, unless it's an 8088/8086

Forget the 'pop cs' since the push cs/pop es balance.
You load your second stage wherever you want and jump to there...easy.
Usually after you read it you push es and bx then do a far return, since es:bx is used by int 13h.
Post 31 Dec 2009, 07:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 31 Dec 2009, 07:34
Anyway, who uses floppies anymore? Confused If the machine is old enough to actually have a floppy drive then perhaps is really is an 8088/8086 Razz
Post 31 Dec 2009, 07:34
View user's profile Send private message Visit poster's website Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 31 Dec 2009, 07:39
lol its my file system in my real mode os
Post 31 Dec 2009, 07:39
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 31 Dec 2009, 07:44
>Anyway, who uses floppies anymore?
VMs, XP with SATA, us 'os construction' people.

An FDC/FDD is one learning point for a PM OS - learning all of the ins and outs of I/O.
Post 31 Dec 2009, 07:44
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 31 Dec 2009, 17:35
Yeah, hehe, i take the FD out of my old PC's and put in new PC'sSmile
Post 31 Dec 2009, 17:35
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.