flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > How to read sectors in Protected mode? |
Author |
|
revolution 30 Dec 2007, 03:30
More info needed. Are you using your own OS or existing OS? What device are you reading? FDD, HDD, USB?
Basically you will need to have I/O routines written for PM. The standard BIOS code only supports RM access to devices. Also don't forget to check out my web site to find info regarding PM sector access. |
|||
30 Dec 2007, 03:30 |
|
LocoDelAssembly 30 Dec 2007, 03:47
Or switching back to RM to call the INT and getting back to PM. Some DOS extenders do that AFAIK.
|
|||
30 Dec 2007, 03:47 |
|
edfed 30 Dec 2007, 04:28
IO ports are the same for RM and PM
So, if you can read/write sectors PIO or DMA in RM, you can in PM with the same program. Modifications in theses functions are only for X86 PM addressing mode support Differences between PM and RM is the addressing mode... of the x86 µP. IO ports works exactlly the same in all modes as it is not X86 engines, but some other standard µP and µC It's, i think, the first serious and usefull function that you can ever code.. it decides on how will work all the parts of the OS... Probably, reversing int 13h can be a good start... |
|||
30 Dec 2007, 04:28 |
|
blueone 30 Dec 2007, 06:03
I think i figured out my true problem. Im really confused regarding what mode i will use in my own OS. Ive read that real mode uses 16 bit only and protected mode uses 32 bit and can access 4GB of memory. So i use protected mode for the reason of memory access but after i read about flat real mode... Im dropping my plan to make my OS in protected mode hehehe.
My second problem is after i entered Flat Real Mode, do i need the code using "use32" or "use16"? BTW im writting a bootsector and kernel in 1 assembly code. Thanks for the reply |
|||
30 Dec 2007, 06:03 |
|
revolution 30 Dec 2007, 06:05
FRM is a 32 bit mode. You will still need custom I/O code for your peripherals unless you do the RM switching trick, but then your peripherals can only use data in the first 1meg.
|
|||
30 Dec 2007, 06:05 |
|
blueone 30 Dec 2007, 07:26
I still need help figuring things out. I didnt got he step by step to enter in UNREAL mode + A20 + VESA + INTERUPTS ENABLED. Ive read lots of codes in this forum but they pointed me in different ways. Can anyone help me out elaborate things how they are arranged? Which comes first second and so on?
*Bootsector* [use16] clear segments a20 unreal [use32] load kernel from sector 2 jump kernel (600h) *endof bootsector* *kernel* [use32] org 600h setvesa ....codes.... *end of kernel* any help is apreciated |
|||
30 Dec 2007, 07:26 |
|
revolution 30 Dec 2007, 07:40
blueone wrote: unreal |
|||
30 Dec 2007, 07:40 |
|
blueone 30 Dec 2007, 07:44
Thanks for the reply. I was wondering on how will i manage the I/O when in unreal mode. I heard about interrupt masks or something, will it make my I/O possible?
|
|||
30 Dec 2007, 07:44 |
|
revolution 30 Dec 2007, 07:54
"interrupt masks" won't help, this is going back to your original question. You need 32bit I/O code if you want to stay in unreal mode. There is no way around it except to leave unreal mode then do the I/O.
Have a look at MinuetOS. I'm not sure, but I would expect there is 32bit disk access code in there somewhere, perhaps you can extract that and try it. |
|||
30 Dec 2007, 07:54 |
|
LocoDelAssembly 30 Dec 2007, 14:12
Check fasm DOS sources, it uses the unreal 32-bit mode by doing some tricks with the IDT.
|
|||
30 Dec 2007, 14:12 |
|
revolution 30 Dec 2007, 14:21
The DOS fasm does not use 32bit disk accesses, it jumps to 16bit DOS to do the transfers. That's not what the OP is asking for.
|
|||
30 Dec 2007, 14:21 |
|
blueone 30 Dec 2007, 15:41
I already figured out entering into unreal mode. Now the problem is... when i try to load a 900kb bitmap using EXTENDED int 13h ax=42h. It wont let me read the whole bitmap, this is what i use
thank you very much in replies! my DAP is this: video_mode = 0x4112 count dw 0 dap db 10h,0 .len db 12,0 .mem dd 1000000 ; load it to offset 1MB .sec dq 3 drive db 0 my code is this: mov ecx,15 ;read fifteen 120 sectors = 15*120*512 nearly 900kb read: mov ah,42h mov esi,dap mov dl,[drive] int 13h add dword[dap.sec],120 add [dap.mem],120*512 loop read |
|||
30 Dec 2007, 15:41 |
|
Dex4u 30 Dec 2007, 20:12
First forget about unrealmode, use pmode, I have written a demo that may help you .
Its sets up vesa and goes to pmode and loads a high res bmp img. http://www.dex4u.com/Vesa/BmpView.zip I also have done a demo of a bootable Pmode Floppy Driver, let me know if you need it. Ps: Any code you may use in your own OS, you should acknowledge the names in the demos. PPs: I have not seen the latest ver of menuetOS, but it use to use unreal-mode, to load the whole image from floppy into ram. ScreenShot
|
||||||||||
30 Dec 2007, 20:12 |
|
DOS386 31 Dec 2007, 00:51
LocoDelAssembly wrote:
> Or switching back to RM to call the INT and getting back to PM. Some DOS extenders do that AFAIK. All DOS extenders (or 99% at least) do the same way: switch to RM if no EMM386 present, let EMM386 switch to "V86" if it is present revolution (= DOS386 ??? ) wrote: > The DOS fasm does not use 32bit disk accesses, it jumps to 16bit DOS to do the transfers. That's not what the OP is asking for. FASM DOS version uses file accesses only using INT $21 , no low level sector access with INT$13 or DMA/ATA ports blueone wrote: > .mem dd 1000000 ; load it to offset 1MB Strange PS: use code tags next time |
|||
31 Dec 2007, 00:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.