flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Booting from floppydisk. Goto page 1, 2 Next |
Author |
|
Rohan 26 Feb 2006, 19:57
use WinImage to writing on floppy boot sector
|
|||
26 Feb 2006, 19:57 |
|
RedGhost 27 Feb 2006, 00:22
_________________ redghost.ca |
|||
27 Feb 2006, 00:22 |
|
Dex4u 27 Feb 2006, 01:01
RedGhost, is right, for a simple bin file, rewrite is easy to use.
Basic Usage (Rawrite): MS-DOS prompt> RAWRITE [-f <file>] [-d <drive>] [-n(owait)] [-h(elp)] where: -f <file> - name of disk image file -d <drive> - diskette drive to use, must be A or B -n - don't prompt for user to insert diskette -h - print usage information to stdout The diskette must be formatted or rawrite will not work. The contents of the disk do not matter and will be overwritten. Once you get started, it is easier to use a boot loader like "bootprog" that can load a bin, com, exe (mz) from a floppy put on like any other file from windows or linux etc. http://alexfru.chat.ru/epm.html#bootprog |
|||
27 Feb 2006, 01:01 |
|
LocoDelAssembly 27 Feb 2006, 01:17
http://board.flatassembler.net/topic.php?p=27902#27902
With that method you will produce a COM file instead but that COM file is in fact a floppy boot code installer. |
|||
27 Feb 2006, 01:17 |
|
Borsuc 28 Feb 2006, 17:08
I vote for rawwrite
May I suggest a fast emulator like Qemu? it's a good idea to emulate your OS, and you can 'debug' it as well while it crashes (and doesn't burn somethin'), and you won't need so much 'reboots' which reduce your CPU's life span, would you? |
|||
28 Feb 2006, 17:08 |
|
bogdanontanu 28 Feb 2006, 17:45
There is a rawwrite with GUI for Windows here:
http://uranus.it.swin.edu.au/~jn/linux/ Reboots (activating the RESET line) will NOT reduce your PC life ... Only a power down / power up cycle will reduce your PC life span but not much. Emulators are good but all of the free ones have nasty bugs. They will be usefull but never forget to test on real hardware (to get a " funny surprise") IMHO the best non free emulator for OS devel is Virtual PC. For emulators you can just create a plain binary file with the contet of the floppy. Take care because some emulators expect this file to be exactly 1.44M. |
|||
28 Feb 2006, 17:45 |
|
Borsuc 28 Feb 2006, 17:51
bogdanontanu wrote: Reboots (activating the RESET line) will NOT reduce your PC life ... sorry, I didn't know this bogdanontanu wrote: Emulators are good but all of the free ones have nasty bugs. I know, but at least test it after it's stable on the emulator, so you don't test it on the hardware (and it crashes for some reason), and you then blame the hardware for the 'bug' |
|||
28 Feb 2006, 17:51 |
|
kake_zinger 01 Mar 2006, 06:27
If you're on Windows it's easiest to use Debug.
debug yourfile.com -w 100 0 0 1 That's it. Use ? for help inside Debug you will learn what those number values are. The shown example writes your bootcode to sector 0 of floppy disk A. Address 100 is where Debug likes to load a program by default. Note: Debug expects the floppy to be formatted! At least on XP it will refuse to write to a blank floppy. So always do a quick format to the floppy first. It took me a while to figure this out. Also John Fine's Partcopy.exe is a good utility for disk read/write stuff like this, search for it. However Debug is more forgiving as it writes direct from memory as opposed to Partcopy writing file data (if file data size mismatch Partcopy will give an error, debug will happily write any amount of data from memory). |
|||
01 Mar 2006, 06:27 |
|
Nyrre 02 Mar 2006, 16:47
Thank you for your advice.
I wrote this bootloader (It's Dex4u's) to floppy: Code: org 0x7C00 use16 start: xor ax, ax mov ds, ax mov es, ax mov ss, ax mov sp, 0x7C00 cli lgdt [gdtr] mov eax, cr0 or al, 0x1 mov cr0, eax jmp 0x10: protected use32 protected: mov ax, 0x8 mov ds, ax mov es, ax mov ss, ax mov esp, 0x7C00 mov dx, 3F2h mov al, 0 out dx, al mov byte [es:0xB8000], 'P' jmp $ gdt: dw 0x0000, 0x0000, 0x0000, 0x0000 sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF sys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CF gdt_end: gdtr: dw gdt_end - gdt - 1 dd gdt times 510- ($-start) db 0 dw 0xaa55 But when I booted, my computer just halted and "_"-character blinked in the lower left corner. What went wrong? |
|||
02 Mar 2006, 16:47 |
|
dasyar 02 Mar 2006, 18:00
Rawrite starts at the beggining of the disk, 0,0, which is where the bootsector is. To use just type in rawrite and your file name.
As for your program, run it and see what happens. |
|||
02 Mar 2006, 18:00 |
|
Dex4u 02 Mar 2006, 18:47
I have tested the code on 4 pc and it works fine, but if the background was a differant color, then it sounds like your one byte out, as one bytes is for forground and background color and the next is for char.
1. Make shore you were puting [es:0xB8000] not [es:0xB800] 2. If that does not work, Try put this Code: mov byte [es:0xB8001], 'P' And let us know what it does. |
|||
02 Mar 2006, 18:47 |
|
Nyrre 03 Mar 2006, 18:51
I replaced line:
Code: mov byte [es:0xB8000], 'P' with line: Code: mov byte [es:0xB8001], 'P' Then I used command: fasm bootloader.asm bootloader.bin and then I wrote bootloader.bin to floppy with RawWrite. Then I booted and...The same thing happened, but now three vertical (purple) lines appeared to the upper left corner of my screen. |
|||
03 Mar 2006, 18:51 |
|
Dex4u 03 Mar 2006, 19:21
I do not understand why it does not work on your PC, as it work on all my test PC's.
If i do the "mov [es:0xB8001]" on my pc, i get the "_" flashing and a solid pruple background. Does the above code print a "P" on any one elses PC ???. |
|||
03 Mar 2006, 19:21 |
|
Nyrre 03 Mar 2006, 20:48
Well I try it tomorrow on one of my friend's PC.
|
|||
03 Mar 2006, 20:48 |
|
Nyrre 04 Mar 2006, 14:33
And the same thing happened on my friend's PC.
Computer halted, and three purple lines appeared to the upper left corner, and "_"-character just blinked in the lower left corner. |
|||
04 Mar 2006, 14:33 |
|
kake_zinger 04 Mar 2006, 14:57
My code segment is type 9a00 not 9800, sorry too lazy to go dig up what that actually means, I even used to understand all that stuff. But all code I've done it's been 9a00 and I did calculate it back then bit by bit.
You're entering pmode without setting tss? On my code the first priority after jumping to protected mode is to set up the tss with mov ax,tssseg ltr ax ;Load task state segment only after this comes the segment register init and after this comes lidt [idtr] ;Load idt I have no idea if that code should work without setting up the tss. When writing to video mem the upper byte of a word is the color attribute, mov ah,2 ;Green on black bg mov al,'A' mov word [0B8000h],ax Also some letters can be used as color attribute like 'A@' or 'A ' a space in there. I don't think you need to specify the segment, you're in protected mode now? It's different if you're using string ops STOSB/W/D and writing to ES:EDI then you got to know where ES is pointing at. |
|||
04 Mar 2006, 14:57 |
|
Dex4u 04 Mar 2006, 18:46
You did try the
mov [es:0xb8000],'P' on your friends PC ?. |
|||
04 Mar 2006, 18:46 |
|
TDCNL 16 Apr 2006, 10:52
When making a bootable floppy image using WinImage, and then typing "boot image.ima" in DOSBOX, nothing happens at all, unfortunately.
But if I in the same way try to boot dex4u.ima (from dex4u.com) it does work. Dex4u, are you sure those boot loaders are the same? _________________ :: The Dutch Cracker :: |
|||
16 Apr 2006, 10:52 |
|
Dex4u 16 Apr 2006, 11:47
@TDCNL, You say you made a bootably floppy image using winimage, but what boot code did you use ?, as DOSBox is only a Dos emulator and so expects a dos layout, as in int 13h for floppy access, also as Dex4u can be run from dos.
The only thing differant in the Dex4u dos box image is the floppy driver users int 13h and not the normal pmode floppy driver. Also if i remember right, you may need to change the image file ext ??. |
|||
16 Apr 2006, 11:47 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.