flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Generic Boot and then 2nd file execute with FLOPPY or CD. Goto page 1, 2, 3 Next |
Author |
|
janequorzar 23 Sep 2010, 19:37
This is an example of boot and second file that you can use with FASM and PARTCOPY. You can also take the FLOPPY IMAGE and use PowerISO to make your own Boot CD with this code. Its the most basics of basics without any attachment to ANY other Operating System. So with this you can write your own OS from scratch.
I even included info so you can copy both files to a floppy image : partcopy BootUp.bin 0 200 -f0 0 partcopy mycode.bin 0 FFFF -f0 200 Make sure to read the text file. Enjoy.
|
|||||||||||
23 Sep 2010, 19:37 |
|
baldr 24 Sep 2010, 07:19
janequorzar,
Your method for calculating boot code size is somewhat unusual. size = stophere + bootstart would give rather unexpected result. This boot sector will load only first 1024 bytes of mycode.bin. It can be misleading, since you've made mycode.bin 65535 bytes in size. Even if someone manage to load entire file in memory, there are two problems (at least ):
Code: ; This is CHS 0/0/1 org 0x7C00 mov ax, 0x0201 mov cx, 0x0002 ; CHS: 0/0/2 mov dh, 0 ; dl is from BIOS Boot Specification/BAID mov bx, $$ push cs pop es int 0x13 int13ret: ; control will return here, or it seems so rb $$+510-$ dw 0xAA55 ; This is CHS 0/0/2 org 0x7C00 message db "Hello world!", 13, 10, 0; Overlays boot up to int 0x13 rb int13ret-$ ; need this for shorter messages ; This is entry point, believe it or not mov si, message push cs pop ds mov ah, 0x0E xor bh, bh next: lodsb test al, al je done int 0x10 jmp next done: xor ah, ah int 0x16 int 0x19 |
|||
24 Sep 2010, 07:19 |
|
egos 24 Sep 2010, 09:05
Code: ; This is CHS 0/0/1 org 0x7C00 mov ax, 0x0201 mov cx, 0x0002 ; CHS: 0/0/2 mov dh, 0 ; dl is from BIOS Boot Specification/BAID mov bx, $$ push cs pop es int 0x13 int13ret: ; control will return here, or it seems so rb $$+510-$ dw 0xAA55 ; This is CHS 0/0/2 org 0x7C00 message db "Hello world!", 13, 10, 0; Overlays boot up to int 0x13 rb int13ret-$ ; need this for shorter messages ; This is entry point, believe it or not |
|||
24 Sep 2010, 09:05 |
|
janequorzar 24 Sep 2010, 12:54
baldr wrote: janequorzar, Actually, I been doing it this way for 10 years and never had a problem of any kind. Remember, this is transferring to the next file, it does not need the BootUp.bin file once it gets past it. And as far as memory, this is for presetting up before you get to the Kernel anyhow, at least this way you have more room to play in. The 65535 was there to show that it could transfer the file with partcopy for those who didn't know it could do it. Your focusing on an area that probably never get used and not on what the code is actually doing. Remember, if you put into the 2nd file a reset of the memory you will have the full 64 K at your disposal.. This is just basic startup transfer FROM the boot code example. The point is not the limits, but what you gain from this. You do not need a Pre-Loading message or anything in the bootup.bin file when you can do all that with freedom in the 2nd file. And on top of that, the reason for the 0x1000 is so that you do not overwrite the bootup.bin file while its trying to access the 2nd file position on the current drive. Remember, you have to FIND the drive and sometimes people put thier code on a floppy disk, which in turn means you have to wait for the motor to give you access, so it is written this way to keep searching until it finds it in the bootup file. Once it finds it, boom, 1000 here I come.. lol THEN you can clear your previous space and setup to utilize the full 64K like you wish you could with the original boot code. But thats all up to you now how you do it, which is why you now have more freedom. Last edited by janequorzar on 24 Sep 2010, 13:19; edited 3 times in total |
|||
24 Sep 2010, 12:54 |
|
baldr 24 Sep 2010, 20:26
egos,
Overwriting return address for int 0x13 in BIOS stack — that's what I would call crazy method. As for one sector — most BIOSes support multitrack operations (some of them handle 64 KiB DMA boundaries too), thus one-byte modification of mov ax, 0x0201 allows loading many sectors at once. That was simple demonstration of trick. ----8<---- janequorzar, That wasn't critique, just some things to be noted. |
|||
24 Sep 2010, 20:26 |
|
janequorzar 25 Sep 2010, 03:33
hey total agreement of the 201. minus one number would be 200.. remember 0 counts as a number from the beginning.
|
|||
25 Sep 2010, 03:33 |
|
luke77 25 Sep 2010, 04:43
What would be neat would be a floppy program that could access and write to NTFS disks.
I have a lot of older code that I would still like to use. My BIOS is ten years old, so I don't think I can use a bootable USB drive with it. I have a second disk that I only use for backup. I would be willing to convert it back to Fat32 if I knew I could access and write to it from a boot floppy. Take care, Andy |
|||
25 Sep 2010, 04:43 |
|
baldr 25 Sep 2010, 05:28
janequorzar wrote: hey total agreement of the 201. minus one number would be 200.. remember 0 counts as a number from the beginning. ----8<---- luke77, FAT32 can be accessed using MS-DOS 7.1+ (Win95 OSR2+) boot disk, LFNs can be supported too (DOSLFN). |
|||
25 Sep 2010, 05:28 |
|
egos 25 Sep 2010, 10:42
Quote: Overwriting return address for int 0x13 in BIOS stack — that's what I would call crazy method. |
|||
25 Sep 2010, 10:42 |
|
janequorzar 25 Sep 2010, 13:53
egos wrote:
Exactly why this demo is here. This works, it has for all my students too, thats the beauty of it. The key thing here is that it doesn't require you to have to have anything from Microsoft or Linux to make it call another file. Thats the whole point of this demo. It goes to show you CAN do it. As I tell everyone, an OS is not limited to just the BIG WIGS out there. You can make your own from scratch. I am currently doing that. I writing my own routines that doesn't require the Interrupts and does not require any support from other OSs. This is a complete project from scratch that I am working on, and it works. Once this is to a point that I can show the public, you'll get your free copy.. And FASM is the compiler I chose to make this. |
|||
25 Sep 2010, 13:53 |
|
baldr 25 Sep 2010, 14:35
egos wrote: What is necessity to overwrite boot code? What if error occurred during function execution. Loading of whole module at one disk operation is bad practice. If read error occurs, in most cases it's permanent (I'm talking about FDD/HDD). Loadind part of module is pointless (if it's module). ----8<---- janequorzar, Your code works, unquestionably. I was simply pointing to some flaws that are inherent to its design (due to simplicity). There are boot sectors (with source) that can load real file from FAT12/16 FS, though (partcopy will be needed only once). |
|||
25 Sep 2010, 14:35 |
|
janequorzar 25 Sep 2010, 15:18
baldr wrote:
Ok but thats my exact point. Using the FATx system means your using Microsoft's stuff. If you ever were to sell your OS you couldn't unless you pay Microsoft to do it. Or just don't use their FAT x system. To read from another file is up to HOW you do it.. The reason for the Partcopy to copy two files is because for you to transfer a file in windows to another disk / hard drive means you have to have that OS file table on the target drive. To get around that you use partcopy to work your way up. That way, you are not using MS stuff. Read the Terms of Service by MS and it says you are NOT allowed by any means to use their software to make an OS unless its for educational purposes. Their FAT system is patented. Scroll down. http://en.wikipedia.org/wiki/File_Allocation_Table So my demo I made as a way to show HOW it can be done. Of course there are flaws.. not the point. That can be fixed. But we WANT people to consider how to do it and I am showing they can. Hope that clarifies the intention here. Its all good.. If anything, your making my code work even better in the explanation as to why its there in the first place. So keep it up.. |
|||
25 Sep 2010, 15:18 |
|
baldr 25 Sep 2010, 15:58
janequorzar,
Those patents seem to be related to LFNs. To stay on topic: do you think boot sector can contain layout of kernel (let it be the placement of binary to load, sector-wise) as a part of it? I mean, on different disks (with different kernel placement) boot sector can be different too? |
|||
25 Sep 2010, 15:58 |
|
janequorzar 25 Sep 2010, 16:55
baldr wrote: janequorzar, Ok, try this experiment. Make a Boot.bin ( or use mine ) without Microsoft's FAT table or code.. Take it completely out. Then partcopy the boot to that floppy disk. THEN in windows, copy a file to the disk. You wont be able too. The way Windows works is it looks for the boot sector table. If it is within Microsoft parameters, it will allow you to transfer a file to it. Without that table, Windows has no clue what to do. Partcopy, doesn't need to worry about that. Hence the reason to copy both files with it and create a TABLE of your own with it. Its tricky, but it does work. This is where you can write another piece of software in windows that formats and puts a bootsector on the floppy. And keep in mind, the OS determines what sector you have the TABLE on.. Not the computer. So you are free to put your own "fat" type of table in the 2nd sector. This is what I call, thinking outside the box. Out of "big brothers" reach. |
|||
25 Sep 2010, 16:55 |
|
janequorzar 25 Sep 2010, 17:04
On another note, I am actually writing an Operating System from scratch. The first time I made an OS, I learned all these lessons the hard way. Needless to say, my original OS from back in 2000 didn't go anywhere. But now, since I have some education on this that is way advanced compared to where I was, now I can do it right this time. And it is paying off. People are seeing my OS already and they didn't know you could do it this way. What I shown you here, is only a small demo of not having to conform to any one pattern of thinking. Being creative is what I do this for.
I actually am writing TWO OSs. The reason is because one of them is from the famous TV show Star Trek. I am making an OS based off their LCARS interface just like I did back in 2000. LCARS is one of my favorite Graphical designs. My other OS is one with an original design and can be sold commercially if I so choose. Both with original code and not taken from anywhere else. So far, its working. No problems. Its why I mentioned earlier, that you will all have a copy of my OS when I get it ready for the public. |
|||
25 Sep 2010, 17:04 |
|
baldr 25 Sep 2010, 18:21
janequorzar wrote: THEN in windows, copy a file to the disk. You wont be able too. Direct media access is somewhat straightforward (though I like the way FORTH keeps external storage access simple). Named (and probably non-contiguous) entities we know as files require some housekeeping to exist. Moreso, some sort of hierarchical/tagged approach can simplify proper classification of such entities. Looks like I've been driven off-topic again. |
|||
25 Sep 2010, 18:21 |
|
janequorzar 25 Sep 2010, 22:04
baldr wrote:
I'm in total agreement here. And yes Direct Media access can be setup anyway you want it for your own OS, the way you see fit. Gotta love creativity. |
|||
25 Sep 2010, 22:04 |
|
edfed 25 Sep 2010, 22:09
direct drive acess is the low level layer of the file system.
even under windows, you can make it. it is up to the programmer to do what he wants to do. |
|||
25 Sep 2010, 22:09 |
|
janequorzar 25 Sep 2010, 22:11
edfed wrote: direct drive acess is the low level layer of the file system. Exactly |
|||
25 Sep 2010, 22:11 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.