flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Assembly OS that will boot after burned into CD.

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
thank you again guys for your kindest reply and your time. i know this is too much but anyone who can revise my code so i can boot it up into an IDE controller for CD.

_________________
I'm a Completely Newbie : Need help much Sad
Post 03 Aug 2014, 08:14
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
i'm really lost here thank you.
Post 03 Aug 2014, 08:15
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
sinsi wrote:
If you are using no emulation, the boot sector (2048 bytes, not 512) is usually loaded at 1000:0000, not 7c0:0000.


2048 is correct, but the loading is always 07C0:0000h unless specified in the Initial/Default Entry at offset 2 (word)[Of the Boot Catalog].

El Torrito Specification wrote:
Load Segment. This is the load segment for the initial boot image. If this
value is 0 the system will use the traditional segment of 7C0. If this value
is non-zero the system will use the specified segment. This applies to x86
architectures only. For “flat” model architectures (such as Motorola) this
is the address divided by 10.


Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Boot Catalog
;;
;; Sector 19
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

BOOTCatalog:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; Validation entry
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    db 1                                                       ; Header ID
    db 0                                                       ; Platform ID (80x86)
    dw 0                                                       ; Reserved/unused
    db "Smiddy OS ",0,0,0,0,0,0,0,0,0,0,0,0,0,0                ; ID string
    dw ("Sm" + "id" + "dy" + " O" + "S " + 0AA55h) and 0FFFFh  ; Checksum
    dw 0AA55h                                                  ; Key bytes (FASM Intel does Little Endian, apparently)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; Initial/Default Entry
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    db 88h                                                     ; Boot indicator
    db 0                                                       ; Media type (0 = "no emulation")
    dw 0060h                                                   ; Load segment (0 = default or 7C0)
    db 0                                                       ; Partition type (assumed to be unused for "no emulation")
    db 0                                                       ; Unused, must be 0
    dw (BootLoader.End - BootLoader + 511) / 512               ; Sector count (virtual 512-byte sectors)
    dd (BootLoader - CDROMImageStart) / 2048                   ; First sector number for boot loader
    times 20 db 0                                              ; Unused, must be zero

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; Padding
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    times 62*32 db 0                                           ; 62 unused entries


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Boot Loader
;;
;; Sector 20 to Sector ?
;;
;; This is where I write the CD-ROM boot loader for SmiddyOS. It is assumed
;; that the CDBOOT.BIN will be on a 512 byte boundary. It can however span
;; multiple 2048 sectors on a CD-ROM.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

BootLoader:

   file 'CDBOOT.BIN'

.End:

   TIMES (2048-($-BootLoader)) and 07FFh  DB 0              ; aligns this block to an even 2048 bytes (per sector on CD-ROM)

    


Smiddy
Post 03 Aug 2014, 13:05
View user's profile Send private message Reply with quote
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
Thank you so much again for your kindest reply. I know my question below is like spoon feeding but I'm desperate.

With the code you provided. Should I create a different file for it? Or Should I insert it in my code for my OS?

I'm ready to be scolded or get shamed. I really need my first to get it run using a CDROM.

_________________
I'm a Completely Newbie : Need help much Sad
Post 03 Aug 2014, 14:20
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Read the El Torrito Specification: http://en.wikipedia.org/wiki/El_Torito_(CD-ROM_standard)

The code above it part of a CD-ROM image I create. It is separate from OS code, in that it is its own entity as a part of the CD-ROM image.

You'll have to learn CD-ROM images, how they are laid out and work, then you can perhaps, load your code, from the boot image you're creating above.
Post 03 Aug 2014, 14:44
View user's profile Send private message Reply with quote
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
I know I'm so dumbed guys but I tried to compile smiddy's code. However it giving me an error on lines below.

dd (BootLoader - CDROMImageStart) / 2048 ; FASM 1.71.21 for windows recognize this line as error "CDROMImageStart) / 2048"
BootLoader:

file 'CDBOOT.BIN' - also this part.
Post 03 Aug 2014, 14:47
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
You will need to create a CD iso from that code, it is a snippet only, not everything. CDBOOT.BIN is your file, put the compiled version of your code there (the name of it).
Post 03 Aug 2014, 18:38
View user's profile Send private message Reply with quote
BAiC



Joined: 22 Mar 2011
Posts: 272
Location: California
BAiC
smiddy: I think den010 is referring to the fact that you don't include the first 18 (decimal) sectors within your post. it's missing the Volume Descriptors portion.

-Stefan
Post 03 Aug 2014, 21:12
View user's profile Send private message Visit poster's website Reply with quote
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
Sounds hard to incorporate.

If you're saying it is separate file. Are saying that I will burn my floopy img file and CDROM file that I will be creating?

Can you give a hint on that too?

_________________
I'm a Completely Newbie : Need help much Sad
Post 03 Aug 2014, 23:09
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
BAiC wrote:
smiddy: I think den010 is referring to the fact that you don't include the first 18 (decimal) sectors within your post. it's missing the Volume Descriptors portion.

-Stefan

I was thinking that he needs to understand the entire item, CDROM booting, and the associated ISO. Which is why I gave him the El Torrito Spec link, so he would at least "try" to build it him (her?) self. Do you think I'm being too egregious in my amount of help?

Smiddy
Post 04 Aug 2014, 00:15
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
den010 wrote:
Sounds hard to incorporate.

If you're saying it is separate file. Are saying that I will burn my floopy img file and CDROM file that I will be creating?

Can you give a hint on that too?
Yes, it is the file you build above. You obviously need to learn FASM.

I could but you have to read/learn/understand the entire process. It is hard, not very easy, and took many of us years to learn. I'm not being a dick, I trying to get you to take some time to understand and learn. It doesn't happen over night and you have to allow time for it to absorb. Does that make sense?

You have a project, you want to complete for school, yes? Take it seriously, find the time to learn, then apply what you've learned. It is anything but easy! It takes time, a lot of going back and forth before "you get it" for it to make sense. If I did everything for you, are you learning? That's an obvious answer YES?

I've given you tons of hints, and ways to approach it, take a couple of days to review the items I've provided you. Do further research, your answers are out there, and then, put something together.

If you have specific questions, I'll be happy to answer, what I do know, and I caveat that, I do not know everything! And...I will have sporadic access this next couple of weeks, if at all. So, that means, you are likely on your own, so start learning!
Post 04 Aug 2014, 00:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17639
Location: In your JS exploiting you and your system
revolution
Indeed. Understanding is the key to it all. Give a person a fish ...
Post 04 Aug 2014, 00:31
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
revolution wrote:
Indeed. Understanding is the key to it all. Give a person a fish ...

Teach her to fish...
Post 04 Aug 2014, 00:33
View user's profile Send private message Reply with quote
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
Thanks Smiddy and everyone. Yes I've been staying all day and all night researching and also watching over on this thread for hints. I'm trying to put all things together with you guys hints and guidance.

I really appreciate spending your time solving / helping someone else headache. I hope I can make this in time.

I really appreciate and thankful for all your help!

There are really good people out there like you guys. I hope you will continue helping others.

_________________
I'm a Completely Newbie : Need help much Sad
Post 04 Aug 2014, 00:53
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
BAiC



Joined: 22 Mar 2011
Posts: 272
Location: California
BAiC
smiddy wrote:
Do you think I'm being too egregious in my amount of help?

nope. I was just pointing out your code was incomplete.

btw, your Checksum snippet is wrong. you need to:

1) consider the HeaderID (add 1 to the sum).
2) subtract the sum from 65536.

-Stefan

_________________
byte me.
Post 04 Aug 2014, 03:16
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
BAiC wrote:
smiddy wrote:
Do you think I'm being too egregious in my amount of help?

nope. I was just pointing out your code was incomplete.

btw, your Checksum snippet is wrong. you need to:

1) consider the HeaderID (add 1 to the sum).
2) subtract the sum from 65536.

-Stefan

Thanks, I don't recall why/where I decided to use that. It does pass the sniff test with MagicISO, but perhaps they are also incorrect.

I did find this:
Code:
Calculation of checksum
The last byte of a message contains a checksum. This checksum consist of the 8-bit two's complement of the sum of the MID and all data bytes in the message.  A simple way to decide if a message has been correctly transmitted is to add the checksum to the 8-bit sum of all data bytes plus the MID of a received message. The 8-bit sum should be zero (0) if the message was transmitted correctly.

As an example (using the sample message in the figure above),
44+23+61+114+62+208 = 512
(512 AND 0xFF) = 0, so the message is correct.    


This is what I think I implemented, add each up, then and it with 0FFFFh for 16 bits.

Then from El Torrito:
El Torrito Spec pg 9 wrote:
Checksum Word. This sum of all the words in this record should be 0.


I will re-look at it tomorrow sometime. The Header ID and Platform ID are not words, but bytes.
Post 04 Aug 2014, 03:37
View user's profile Send private message Reply with quote
BAiC



Joined: 22 Mar 2011
Posts: 272
Location: California
BAiC
I do wonder what kind of fucked up instructor would expect knowledge of the CD-ROM structure (for boot purposes) before covering images in general. I've avoided CD-ROM usage simply because I test with a real system and can't expend CDs just to for that. that said; it didn't help that CD booting has such a significantly higher complexity. from the way it's written it looks like a File System is forced on users of CD booting: atleast with VMware it doesn't require a File System.

- Stefan

_________________
byte me.
Post 04 Aug 2014, 06:59
View user's profile Send private message Visit poster's website Reply with quote
den010



Joined: 28 Jul 2014
Posts: 18
Location: Metro Manila - Muntinlupa City
den010
(I do wonder what kind of fucked up instructor would expect knowledge of the CD-ROM structure (for boot purposes) before covering images in general. I've avoided CD-ROM usage simply because I test with a real system and can't expend CDs just to for that. that said; it didn't help that CD booting has such a significantly higher complexity. from the way it's written it looks like a File System is forced on users of CD booting: atleast with VMware it doesn't require a File System. )

My sister told me "I think your instructor is having his masteral or doctorate degree on his profession. He is required to create a project the same as what he has given to you. He is getting ideas on his students". My sister seems true about it.

_________________
I'm a Completely Newbie : Need help much Sad
Post 04 Aug 2014, 09:57
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
BAiC



Joined: 22 Mar 2011
Posts: 272
Location: California
BAiC
well.. a CD-ROM boot loader would be valuable to prove yourself in undergraduate work but a graduate or even a Masters degree is really pushing it. it only takes about 40 lines of assembly data declarations to build a CD-ROM image.

-Stefan

_________________
byte me.
Post 04 Aug 2014, 10:41
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
BAiC wrote:
I do wonder what kind of fucked up instructor would expect knowledge of the CD-ROM structure (for boot purposes) before covering images in general. I've avoided CD-ROM usage simply because I test with a real system and can't expend CDs just to for that. that said; it didn't help that CD booting has such a significantly higher complexity. from the way it's written it looks like a File System is forced on users of CD booting: atleast with VMware it doesn't require a File System.

- Stefan
This is interesting, why not use an HDD boot load with a virtual machine? Or a floppy?

I think if you search hard enough on here, someone has left a CDROM iso image that can be used for what he wants. Smile
Post 04 Aug 2014, 11:43
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  Next

< 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.