flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Help to start my own OS Goto page Previous 1, 2, 3, 4, 5, 6, 7 Next |
Author |
|
Teehee 31 May 2010, 20:47
indeed, if there is no ORG, labels will assume start at position 0. And in the case of a .com file, there is nothing at position 0 bc it start at 100h. So that will give error when the code try to access address 0. I GOT IT!!! woohoo!
Thanks for the patience guys |
|||
31 May 2010, 20:47 |
|
Teehee 31 May 2010, 23:27
This is my boot:
Code: org 7C00h ; bc boot start from 0000:7C00h mov ah, 02h ; read mov al, 1 ; sectors count to read mov ch, 0 ; track/cylinder mov cl, 2 ; sector mov dh, 0 ; head mov dl, 0 ; drive ( 0=A:, 1=2nd floppy, 80h=drive 0, 81h=drive 1 ) mov bx, 0800h ; ES:BX point to where data will be write mov es, bx mov bx, 0000h ; 0800:0000h ( ES = 0800h, BX = 0000h ) int 13h ; disk interrupt jmp kernel rb 510-($-$$) ; fill boot sector dw 0xAA55 ; BIOS signature end boot I chose to change to PM in the kernel (i'll show it later). A question: Code: mov bx, 0800h ; ES:BX point to where data will be write mov es, bx mov bx, 0000h ; 0800:0000h ( ES = 0800h, BX = 0000h ) In this samle it puts data at 0800:0000, why? To which locations can i write the loaded data? _________________ Sorry if bad english. |
|||
31 May 2010, 23:27 |
|
baldr 01 Jun 2010, 05:37
Teehee wrote: This is my boot: Seriously, RBIL comes with MEMORY.TXT that contains thorough break-down of conventional/upper memory. |
|||
01 Jun 2010, 05:37 |
|
Teehee 01 Jun 2010, 13:45
my boot file... but i take this sample from the internet.
|
|||
01 Jun 2010, 13:45 |
|
baldr 01 Jun 2010, 16:07
Teehee,
So, this is how you define "yours"? Jokes aside, how do you think yourself? There are valuable locations, like 0:34h/0:100h, that you might want to keep intact (unless FDC/ATA/whatever controller programming is done). You can use any byte available (despite some of them are 0FFh forever) for any purpose you want. |
|||
01 Jun 2010, 16:07 |
|
ManOfSteel 01 Jun 2010, 16:31
Baldr, don't we all ape our predecessors, one way or another, to varying degrees? What's genuinely new under the sun?
Teehee, there are BIOS interrupts available on all modern machines that provide memory maps. They allow the OS to know how much physical memory is present and which parts are used by what. Some memory addresses are reserved for hardware and ACPI and should never be used. In general you place the kernel relatively low, e.g. around 1MB or below. |
|||
01 Jun 2010, 16:31 |
|
cod3b453 01 Jun 2010, 21:54
Although BIOS E820 memmap is useful it won't tell you about the IVT, BDA, ROM or screen buffer.
Basically, 0x00600 to 0x07C00 is free (about 30kB), so is 0x07E00 to 0x9FC00 (over 0.5MB). The kernel/loader stage need to be on a 4kB boundary if you're using paging or booting multiprocessors and so either 0x1000 or 0x8000 are a 'good' place but the last one allows plenty of space to grow into However, you can choose anywhere in memory you please according to these constraints. |
|||
01 Jun 2010, 21:54 |
|
Teehee 19 Feb 2011, 13:28
Im so frustrated
I took about 6 months without touch an asm code and i forgot almost everything. now i need to read about boot sector, a20, GDT, etc. again *ahem* _________________ Sorry if bad english. |
|||
19 Feb 2011, 13:28 |
|
Teehee 19 Feb 2011, 15:12
there is a way to boot without use INT's instructions?
|
|||
19 Feb 2011, 15:12 |
|
Tyler 19 Feb 2011, 19:57
Of course, if you want to write your own drivers for everything you want to use.
|
|||
19 Feb 2011, 19:57 |
|
Teehee 19 Feb 2011, 20:02
how can i learn that, Tyler?
|
|||
19 Feb 2011, 20:02 |
|
cod3b453 19 Feb 2011, 22:00
For each device you want to support, you'll want a specification/reference manual (you might also be able to find some examples) e.g. if you want to boot a floppy disk, you'll need a floppy disk controller driver or for CD an ATA/ATAPI driver and so on.
In all cases, you're replacing INT calls with device-defined memory region read/writes (MMIO) using MOV and/or device-defined IO port IN/OUT's. |
|||
19 Feb 2011, 22:00 |
|
Teehee 20 Feb 2011, 16:59
i don't know how to do that (using IN/OUT's)
--------- here says: Quote:
1. where they are overlaps? its bc both start (.base) at 0 and have the same limit? 2. how do i know the types availabled? 3. how is the asm version of that? _________________ Sorry if bad english. |
|||
20 Feb 2011, 16:59 |
|
dosin 20 Feb 2011, 17:57
Check here has an asm example:
http://board.flatassembler.net/topic.php?t=11025 aslo this may help also: http://www.jamesmolloy.co.uk/tutorial_html/4.-The%20GDT%20and%20IDT.html |
|||
20 Feb 2011, 17:57 |
|
Teehee 20 Feb 2011, 19:32
I'm reading, thanks.
Look at this img: 1. I use the same value in the field [Base 31:24] and [Base 23:16]? _________________ Sorry if bad english. |
|||
20 Feb 2011, 19:32 |
|
edfed 20 Feb 2011, 20:27
base 31:24 means: bits 24 to 31 of base.
base 23:16 means: bits 23 to 16 of base. to concatenate with base 0:15 to obtain the full 32 bits value base. base 31:24 23:16 15,0 => base 31:0 |
|||
20 Feb 2011, 20:27 |
|
Teehee 20 Feb 2011, 20:33
wow.. they like to complicate...
|
|||
20 Feb 2011, 20:33 |
|
Teehee 20 Feb 2011, 20:37
so the same for Segment Limit 15:00 and Seg.Limit 19:16 ?
edit: ok i saw the answer is yes. Last edited by Teehee on 20 Feb 2011, 21:01; edited 1 time in total |
|||
20 Feb 2011, 20:37 |
|
Teehee 20 Feb 2011, 20:53
After read that all, this is how my GDT looks like for awhile:
Code: gdt: dd base_first_entry dw limit_gdt_size - 1 base_first_entry: dq 0 ; 0x00 null descriptor ; ( limit ) ( base ) (P,DPL,DT,Type)(G,DB,0,AVL,limit)(base) db 0xFF, 0xFF, 0x00, 0x00, 0x00, 1001'1111b, 1100'1111b, 0x00 ; 0x08 CS db 0xFF, 0xFF, 0x00, 0x00, 0x00, 1001'0111b, 1100'1111b, 0x00 ; 0x10 DS limit_gdt_size = $ - gdt Is everything right? _________________ Sorry if bad english. |
|||
20 Feb 2011, 20:53 |
|
Goto page Previous 1, 2, 3, 4, 5, 6, 7 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.