Yeah, there's nothing like OS coding... Just me, hardware, and an empty memory waiting to get filled with stuff...
A true definition of freedom :grin:

2nd me on that :alright:
Posted on 2003-03-02 03:30:10 by scientica
A true FreeDom


Im agreed.:alright:
Posted on 2003-03-02 03:54:36 by realvampire
oh man! i just got multitasking running! *freedom* :)
i'll now go about the gui and the windowing system

greets, hartyl
Posted on 2003-03-02 10:51:59 by hartyl
I try to use 32-Bit Operand at real mode, Xor eax,eax, its crashes. Then I try to use Mov eax,CR0 but...., I dont know its hexvalue.
Tell me or teach me:
1. Can I move CR0 to 16-Bit reg?
2. So 32-Bit reg only able to use only at Pmode, if Im not setting it it always crashes?
3. How to read immed BitField?
4. You need help? if so teach me first, teaching me or give me information or tutorial will be great investment for you.
Posted on 2003-03-02 20:25:32 by realvampire
When you are in real mode you are using the 8086 core of the processor. You cannot use 32bit instructions until you switch to protected mode.
Posted on 2003-03-03 00:10:23 by mrgone
:confused: The only clues I have is Use MSW AX. It mean Machine Status word (MASM doesn't support it), and then use SETE AX after I adjust it.



MSW AX ; Get the status
xor al,1 ; Set to PMode
SETE AX ; Change it




It wont work.... any Advice ? :confused:
Posted on 2003-03-03 03:03:28 by realvampire
why don't you try


mov eax,cr0
or al,1
mov cr0,eax

i could look up the equivalent bytes, but fasm does assemble this

btw, can i rename this thread? "ints in pm" doesnt match anymore, what about "protected mode"?

greets, hartyl
Posted on 2003-03-03 03:47:57 by hartyl
Rename this Thread. Mov eax,cr0 are unable at Real-mode. I boot my OS from diskette, If I able to switch to Pmode I can draw using VESA without bank Switching anymore. Yes Find the equivalent... Please.
Posted on 2003-03-03 09:10:08 by realvampire

When you are in real mode you are using the 8086 core of the processor. You cannot use 32bit instructions until you switch to protected mode.

Well, actually you can use 32-bit operands in 16-bit PM, or realmode, using the operand-size prefix (66h).

I try to use 32-Bit Operand at real mode, Xor eax,eax, its crashes.

Are you sure you are doing it right?
NASM assembles xor eax,eax as 6631C0.

-Stealth
Posted on 2003-03-03 09:10:33 by Stealth
NASM assembles xor eax,eax as 6631C0.


Mine is 36C0 not 31C0. Could you tell me the Bitfield?.
can I write it 6636C0? ot I have to do it 6631C0 ?
:alright: Thanks anyway I now know what is Prefix, do you have another prefix value ?

Prefix: My Understanding.

Prefix is 32-Bit Code substract with 0x500 and add it with 0x6600000?

Am I right ?
:confused:
Posted on 2003-03-03 09:17:20 by realvampire
36C0?
I dunno... NDisasm doesn't recognize it as a valid instruction, and I can't find it from the Intel's reference, either.

There's also the Address-size prefix (67h). You can use it for example, to code instructions that use 32-bit memory references in 16-bit modes (but in order for it to work, you must have big limits loaded in the descriptors), like mov word[0B8000h+eax],720h (assembled 67C78000800B0020).

Other prefixes include: segment overrides (cs=2Eh,ds=3Eh,es=26h), rep (F3), etc.

I haven't done so much manual coding lately, as NASM can assemble all instructions quite well, but as far as I remember, you just need to output the prefix(es) before the instruction, no need to substract anything.

-Stealth
Posted on 2003-03-03 09:53:58 by Stealth
:eek: Not recognized ? I dont know I dont have any 32-Bit Dis-Assembler.

34C0:00110-100-11-000000
31C0:00110-001-11-000000



Format of Bitfield = 5:3:2:6
Size Bit is at Bit 8-10:
mine is 100=4 2^4=16 16*2 =32-Bit
NASM is 001 = 1 2^1 =2 2*2=4-Bit.



seems you are right but Where is my mistakes? :confused:
Posted on 2003-03-03 10:24:36 by realvampire
i am now able to create threads on the fly - but just create. so i went over to the gui. haha, vesa! i but i got farer than in the last try: i created a selector for the LFB, and it worked - partially. i played around with it for an hour and i wondered about some things:
- now i get more of the screen: the 3rd part of the screen from the top and from the bottom. i can't access the middle.
- when i draw a gradient (by increasing the color from one pixel to another) i can do it with blue and green. if i set red to 0x80 i can't put a pixel.
- if i use a mode with 24 bpp i still have to increase 4 bytes from one pixel to the other to have the correct result. but i'm bot sure about that, see #2 :)

some code right here (i hope some1 reads this):


video_sel:
; video segment descriptor
dw 0xffff ;limit
dw 0x0000 ;base
db 0x00 ;base
db 0x92 ;type
db 0xcf ;attribs and 4 bits of limit
db 0x00 ;base (msb)

..[snip!]..

;set up the vesa-gfx right here
mov ax,0x4f00
int 0x10 ;vesa present?
cmp ax,0x004f
jnz $ ;hang if failed

mov ax,0x4f01 ;get mode info
mov cx,0x4115 ;800x600x16m
push 0x0000
pop es
mov di,0xa000
int 0x10 ;get mode info to es:di
cmp ax,0x004f
jnz $

mov eax,[es:di+0x28] ;physical address of linear video buffer
mov [video_sel+2],ax ;fill the gdt.base for video selector
shr eax,16
mov [video_sel+4],al
mov [video_sel+7],ah

mov ax,0x4f02
mov bx,0x4115
int 0x10 ;set mode
cmp ax,0x004f
jnz $

..[snip!]..

;this is how i access the lfb
mov ax,VIDEO_SEL
mov gs,ax
mov dword [gs:0],0x00ff00 ;put a green pixel on the top left of screen

everything just partially works...
the pm.com-file by Stealth worked perfectly...

greets, hartyl
Posted on 2003-03-07 14:33:32 by hartyl
Hartyl what assembler you use?
Posted on 2003-03-07 18:36:24 by realvampire
fasm, why do you ask?

ha! i noticed something new:
if i want to put a pixel into the black bar in the middle of the screen it appears exactly 256 pixel higher... as if the color-information for the middle is displayed on the top of the screen...
but the rest works fine: i can put a pixel where i want - and it lands there :)
Posted on 2003-03-08 07:02:13 by hartyl
Im courious, FASM able to use 32-Bit register at DOS program.
1. Is FASM have function like FarCAlloc?
2. Can it allocate memory above 1MB?
3. Is FASM have an IDE to compile a DOS program? (RAD Asm doesnot support DOS ).
Posted on 2003-03-08 23:21:52 by realvampire
@realvampire:
1. fasm is just a flat assembler - you can write functions like FarCAlloc, but the assembler itself doesn't have it afaik.
2. see #1
3. damnit, fasm is just an assembler :). i currently use the dos-editor and the fasm.exe for assembling. i start win98 in dos-mode and edit&assemble with:


edit file.asm
fasm file.asm file.exe

btw, i already told you on February 23rd, 2003 @ 05:18 PM what assembler i use :)

@all:
any answer to my weired screen-black-bar-problem?
Posted on 2003-03-09 13:43:24 by hartyl
Use a Buffer. And then Bitblt, it's more easy than calculate it one-by one. Hartyl, do you have a code for allocate mem above 1MB ?:cool:
Posted on 2003-03-09 19:19:23 by realvampire
@realvampire:
i think you understood something wrong... i put a pixel in the middle of the screen, but it appears 256px above the calculated destination - but that's only in the middle of the screen. above and below it works correctly.
and: what the hell are you doing?! are you programming a program in windows? write an OS?
in the first case: use the windows-api: LocalAlloc / GlobalAlloc
in the other case: hey! you're writing an os, nothing is in the memory except your code, take what you need.
Posted on 2003-03-10 13:07:57 by hartyl


in the other case: hey! you're writing an os, nothing is in the memory except your code, take what you need.


yep. Im studying Allocate Mem via Port (0c0~0x1F) but Im found difficulties. I dont have any example. Do you have one?. By accessing DMA even we're at real mode we can do anything (as I understand).
Posted on 2003-03-10 21:02:03 by realvampire