flat assembler
Message board for the users of flat assembler.

Index > OS Construction > EMS

Author
Thread Post new topic Reply to topic
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 27 Nov 2004, 23:55
hello,

the subject says very much, now the rest: i would like to write an OS only in RM. therefore i'd like to use EMS for the multitasking, for every task to get a bank. i searched the i-net, but there were only bad informations. almost with int 0x67, which seems to be from DOS. so now i'm searching tuts and information about EMS without DOS-INTS. i hope you can help me,

mfg

JN!
Post 27 Nov 2004, 23:55
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 28 Nov 2004, 04:55
Try here: http://www.rdos.net/
a dos clone with asm code.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 28 Nov 2004, 04:55
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 28 Nov 2004, 11:48
joachim_neu wrote:
hello,

the subject says very much, now the rest: i would like to write an OS only in RM. therefore i'd like to use EMS for the multitasking, for every task to get a bank. i searched the i-net, but there were only bad informations. almost with int 0x67, which seems to be from DOS. so now i'm searching tuts and information about EMS without DOS-INTS. i hope you can help me,

mfg

JN!

EMS is not a bios service , you have to implement it in your OS
I recommend that you use unreal mode (like fasm for dos)
put your code and stack in conventional memory and data anywhere.
i think that EMS uses virtual mode and paging that is more dificult to implement.
Post 28 Nov 2004, 11:48
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 28 Nov 2004, 12:15
well, i had a look at the code, but i didn't understand it right. i don't understand what "unreal mode" is. the int 0x67 isn't from bios. the main problem is, that i don't know, how to access the rest of the memory. the switches are not so bad, but to access the memory. i hope anyone can tell me how to do it. i found only tuts telling me how to use EMS with DOS, but now tuts telling how to implement it. i hope you can help!

thanks!
Post 28 Nov 2004, 12:15
View user's profile Send private message Visit poster's website Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu 28 Nov 2004, 13:47
There is no way to do that using BIOS.
On older computers that used 8086 and 80286 CPU the EMS was a hardware device : an additional board for Lotus123 Application or some hardware for the 80286 motherboard. Thus such information is old and specific to old hardware, i doubt you will have an 8086 or 80286 mother board to test it.

Once the 80386 CPU come along the EMS and XMS was simulated by the himem.sys and emm386.exe drivers. basically thos drivers whent into protected mode and by doing such had access to the whole memory range and copied the needed "page frame" from that memory to a location below 1M or at 1M+64k (the so caled HMA) so that Real Mode applications where afterwards capable to use the memory chunk.

SO you see the EMX and XMS are of NO use IF you do not want to go into protected mode (at least briefly)... make a memory copy ... and then return to Real Mode.

A "real" real mode OS has to use only 1M or RAM or actually 640K of RAM since the 640+ area is reserved for additional boards/hardware.

There could be some use IF you have an old 8086 + EMS additional board or an 80286 motherboard that has EMS hardware on it... but the chances are very small...

"Unreal Mode" is a mtehod of using the whole memory in real mode after a brief switch into protected mode and a return... with changed selectors limits...

Is using an bug in 80386 and upwards CPUs that will retain the wrong limits when returning from protected mode...and by doing so you are "somehow" allowed access to a wider range of RAM from real mode...

but it is not a "real" real mode --> so the name is "UNReal Mode"
Post 28 Nov 2004, 13:47
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 28 Nov 2004, 14:21
thank you for all the information! that's a good idea to go into PM and do it there. but how many time needs it to switch to PM and back? does anyone know? thank you. i always thougt, that the ram gets deleted by switching.
Post 28 Nov 2004, 14:21
View user's profile Send private message Visit poster's website Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 28 Nov 2004, 16:24
You will only need to do the switch once, to set up selectors. After that you switch back to (un)real-mode and have access to all memory and still be able to use BIOS...

You can problably find info on google or osdever.net on how to do the switch.
Post 28 Nov 2004, 16:24
View user's profile Send private message Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 28 Nov 2004, 16:34
@bubach: why have i access to all memory? in RM the registers are still 16 bit large, so why have i access to the rest without shiftig all the time? i don't understand! i've already some tuts for PM.
Post 28 Nov 2004, 16:34
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 28 Nov 2004, 18:02
well, ok. i've the code to setup the PM. i would load the deskriptor behind the RM-Memory-Area at 0x10000 linear. but because of the A20 Gate i'll have to load it to 0x10FFEF. ok, but now there is the second problem: how to switch into RM again. have you got any code or tuts? thank you.
Post 28 Nov 2004, 18:02
View user's profile Send private message Visit poster's website Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea 28 Nov 2004, 18:11
Post 28 Nov 2004, 18:11
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 28 Nov 2004, 18:33
This site as code http://www.karig.net/0004.html

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 28 Nov 2004, 18:33
View user's profile Send private message Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 28 Nov 2004, 19:40
thank you all.
@ashley4: i tried to include the code, but it didn't work! there was always a reboot.

i took out some code to return into RM:

mov eax, cr0
and al, 0xFE
mov cr0, eax

but i don't know, if it works. if i combine both code the kernel doesn't work.
i've already some code to go into PM.
Post 28 Nov 2004, 19:40
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 29 Nov 2004, 01:37
joachim_neu, i have not tested the code my self, so do not no Y it reboots,
but did you click on the "Test code here" link to get the asm code, as the code on the web page is not the full code?.
also remenmber to enable the A20.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 29 Nov 2004, 01:37
View user's profile Send private message Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 29 Nov 2004, 13:25
well, i did the misstake, not to put the code into the bootloader! there it works. THANK YOU VERY MUCH! it helped me sooooo much. it's perfect. i may use BIOS-Ints and all of the memory! but i don't find the bad side of the code. what is it? why doesn't everybody use the code? thank you for the answers.

Thank you all very much! Is there a method to test, if i'm realy in PM? my RM-code still works, but i don't know, if i may access all the memory. how may i test it? thank you.
Post 29 Nov 2004, 13:25
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 29 Nov 2004, 14:39
i though again and have an idea. is it, because only the data-register are 32 bit, and not the code-register? so i can use the memory, but i can't execute code in the HMA (High Memory Area)? Thank you.!
Post 29 Nov 2004, 14:39
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 29 Nov 2004, 16:47
Yes thats right.
You can test by writing to a memory loction above 1 MB and reading it back.
The first time i new i was in pmode was when the floppy light stayed on Wink .

NOTE: I do not think BOCHS emulat this mode,so you can not test code with BOCHs, not that i do.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 29 Nov 2004, 16:47
View user's profile Send private message Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 29 Nov 2004, 17:48
well, if i run my os in bochs, it runs, but i didn't test the writing in the part above 1 MB. i'll test it and write again.
Post 29 Nov 2004, 17:48
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 30 Nov 2004, 16:17
it runs as it should. thank you all!
Post 30 Nov 2004, 16:17
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 01 Dec 2004, 19:49
Hello everybody! here i'm again! with a new problem...

Code:
;INT 0x67-0x06 
_int0x67_ser0x06: 
pusha 
push ds 
push es 
mov eax,0x00 
mov ax,cx 
shl ax,3 
add ax,0x12 
shl eax,0x20 
mov esi,eax 
mov eax,0x10000 
mov edi,eax 
xor ax,ax 
mov es,ax 
mov ds,ax 
mov ecx,0x40000 
rep movsw 
pop es 
pop ds 
popa 
jmp _int0x67_end 
;INT 0x67-0x07 
_int0x67_ser0x07: 
pusha 
push ds 
push es 
mov eax,0x00 
mov ax,cx 
shl ax,3 
add ax,0x12 
shl eax,0x20 
mov edi,eax 
mov eax,0x10000 
mov esi,eax 
xor ax,ax 
mov es,ax 
mov ds,ax 
mov ecx,0x40000 
rep movsw 
pop es 
pop ds 
popa 
jmp _int0x67_end  
    

the first part till ;INT 0x67-0x07 should transfair a page into the memory to 0x10000 offset. the second part should transfair the page from 0x10000 offset into the memory again. every page is 0x80000 bytes long, so the parts should copy the page into the CXth page. thatfore i first multiplicate cx with 8 by shl ax,3. if i shl then with 20 i multiply it with 0x10000. then i should have the offset. then i add 0x120000 because at 0x1A0000 starts the first page. therefore i add 0x12 to the number before multiplying it with 0x10000. therefore is the following code:
Code:
mov eax,0x00 
mov ax,cx 
shl ax,3 
add ax,0x12 
shl eax,0x20 
mov edi,eax 
    

after that i load the esi- and edi-register with the offsets and set the segments up to 0x00. following i copy 0x40000 words = 0x80000 bytes and then should the page be copied... now about my problem: all that doesn't work. i hope you can help me!

thank you!
Post 01 Dec 2004, 19:49
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.