flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
macgub 20 Nov 2023, 20:16
Just curious - what hardware you have???
If you are cd/dvd owner - you can burn cd in floppy emulation mode.. Many software tools have this option (for sure ex. CD burner XP WIndows tool). |
|||
![]() |
|
SeproMan 20 Nov 2023, 21:15
You found this code online, but I doubt it's a good example!
Code: cld ; Clear direction flag to ensure instructions like ; lodsb use forward movement. xor ax, ax ; AX=0 (use for segment) mov ss, ax mov sp, 0x7c00 ; Set up stack to grow down from 0x0000:0x07c00 ; in region below the bootloader mov es, ax The above instructions really belong to directly below the 'ORG 0x7C00' directive. Also the 'mov ds, ax' instruction is still missing, and the print_string procedure relies on it being set up properly! Do notice that the first comment in KERNEL.ASM Code: use16 org 0x0000 ; Since CS will be 0x07e0 we need an origin of 0x0000 does not match the far jump in the BOOTLOADER.ASM Code: jmp 0x0000:0x7e00 ; Jump to physical address 0x07e00 by setting CS ; to 0 and IP to 0x7e00 Quote: Bootloader and "Kernel" or Stage 2 don't really know if I must use a second boot file really, The bootloader code must fit in only 512 bytes. If your kernel is to be any serious, then it won't be possible to stay within those 512 bytes. So yes, you need 2 files. _________________ Real Address Mode. |
|||
![]() |
|
Kitsune 20 Nov 2023, 21:50
macgub wrote: Just curious - what hardware you have??? @macgub I have a laptop computer with Debian Linux installed on it for compile the asm code and create floppy from command line, and PCem as a virtual machine software. SeproMan wrote:
@SeproMan Have you ressources I can learn about 16bits OS creation in assembly? This source code works despite what you said about the jump to adress command I have tested it. In the meantime, I found a Youtube "tutorial" on creating an OS, maybe that's a better way to learn it. But if you have good books about this kind of knowlege (16bits OS in assembly in DOS era) it's welcome! _________________ Kitsune |
|||
![]() |
|
SeproMan 20 Nov 2023, 22:21
Good online resources include:
A more theoretical approach: https://wiki.osdev.org/Bootloader A more hands-on approach: https://stackoverflow.com/questions/tagged/assembly Then use the search function filling in [Bootloader][x86-16] You'll see that many of the best answers there were contributed by users Michael Petch and Sep Roland, (amongst others of course). On the stackoverflow site you can also ask for help with your programming troubles. Quote: This source code works despite what you said about the jump to adress command I did not say that anything was wrong with the far jump itself. It's the comments that go along with it that are contradicting each other. ![]() _________________ Real Address Mode. |
|||
![]() |
|
Kitsune 20 Nov 2023, 23:03
The above code is from this page:
https://forum.osdev.org/viewtopic.php?f=1&t=32452 It's on the same website you mentionned. I will look at these links. Thanks you for the ressources and help. Good night. |
|||
![]() |
|
bzt 15 Jan 2024, 23:28
Kitsune wrote: And I want a way to put this kind of Kernel on a disk and make it bootable but I don't know how to do it and I need a tool first for format hard disk before copying it I think if the disk is not formated... You invoke it as easyboot folder imagefile. It will then create a bootable disk image, where - the master boot record comes from boot_x86.asm (512 bytes). Written with fasm, it is capable to load a 64-bit PE/COFF executable with a long mode entry point. - then GPT partitioning table is created, with an EFI System Boot Partition (ESP) formatted as FAT32 - all files from folder are copied to that ESP boot partition (among other things, the kernel file) - then the actual loader (Stage 2, named \EFI\BOOT\BOOTx86.EFI) is placed on the ESP, which is very small, 64K only (the mbr sector also loads this file). This is the one that is capable to load the actual kernel (which could be several megabytes in size, might need higher-half mapping etc. etc. etc.) - the tool has NO dependencies (no libraries, no loopback devices, no fdisk, no mtools, nothing needed), it is totally self-containted and does not require root privileges. Compiles under Linux and Windows as well. Few notes: - my boot sector could load your kernel as-is, if it's not bigger than 64k - you don't have to use my loader at all with this disk creator tool, it is GPL licensed and you can fork it and rewrite it as you please - the file data.h contains the blobs (boot_x86_bin is he boot sector, loader_x86_efi is the actual loader), just replace these byte arrays with whatever binary you'd like, and you can still use the disk creator part to produce your imagefile. - the path and filename where the Stage 2 is placed on the FAT32 boot partition can be changed here (not configurable, you'll have to modify it in the source). - as a last step, you should write the generated imagefile to your hard disk using dd (or USBImager) or boot it in a virtual machine Hope this helps, bzt |
|||
![]() |
|
macomics 16 Jan 2024, 00:00
deleted
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.