Message board for the users of flat assembler.
> OS Construction > Starting with some complex stuff, Memory Segmentation in RM?
sid123 22 Oct 2013, 12:33
Been playing around with MikeOS,
MikeOS has a 64K segment to do stuff. But the thing is I
I know sounds noobish (is that a word?)
Alright some details :
I discovered mikeos loads at 2000H in RAM.
And it sets up ss (stack segment) to 0, and sp to fffh,
Then it makes all the other seg regs to line up with the kernel
And the memory structure is like
Small mikeos 64K segment.
Disk buffer 8K
Free space in that segment : 32K
Now just after this segment I want to have another 64K segment,
So that equals 128K of RAM.
How would I start about? Would that be tough? Or its simple?
Help would be appreciated...[/list]
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
|22 Oct 2013, 12:33||
cod3b453 22 Oct 2013, 18:03
In 16bit your are always limited to a 64K segment in cs/ds/es/ss:xx and so cannot cross a 64k boundary. However, you can split accesses across multiple segments and address up to 1MB by changing the segment register e.g. from my boot sector disk driver:
The only thing I don't know, is whether this is a valid assumption for MikeOS that there is nothing important in the next segments (my guess is there isn't).
... mov dx,es ; save the segment to a temporary add bx,DISK_SIZE_SECTOR ; increase the offset jnc @f ; if it didn't wrap to 0, don't increment the segment... add dx,0x1000 ; ...otherwise increment the segment @@: mov es,dx ; restore the temporary ...
|22 Oct 2013, 18:03||
Mike Gonta 22 Oct 2013, 20:28
MikeOS32 has 4 Gb segments.
one man's journey of discovery in the-ideom
|22 Oct 2013, 20:28||
sid123 23 Oct 2013, 08:40
@cod3b453 I see you allocated a 64K segment through ES and DX.
Now is this segment ready to use? MikeOS programs load at 32K, Since a segment has been created, is it possible to load stuff at 64K, and this segment would last till 128K. Right?
@mikegonta Lol, but the thing is I want to learn OSDeving step by step, like assembly, first learn dos programming 16 bit, then Win32, and then Win64.
I want to get the most out of real mode before shifting to protected mode, so I think messing with segment registers may help in the learning part....
|23 Oct 2013, 08:40||
cod3b453 23 Oct 2013, 17:55
In my example the segment at es:0 is preallocated and so big enough for the disk data. I have no idea how MikeOS works or how it allocates memory so I can't help you but you can always address 64k. If MikeOS provides a memory allocation function you should probably use that to find a safe location to use for the size you've asked for.
To be honest there's very little in 16bit you should focus on: VGA/VESA for basic screen stuff, basic read-only disk driver(s), BIOS E820, A20 and switching to protected mode.
|23 Oct 2013, 17:55||
c.j.gowett 16 Jan 2014, 20:31
Like cod3b453 said, I'm sure you can split access between segments, but I haven't tested it myself. If you want more space, try 32-bit protected mode. you'll have 0xFFFFFFFF amount of space, or 4294967296 bytes (4 GB) of space. Some of the space is used for stuff like video memory, BIOS Data Area, and other device memory. Also, in 32-bit protected mode, you won't have interrupts, so you'll have to use i/o ports to write back to the hard disk or use other interrupts.
|16 Jan 2014, 20:31||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.