I've already managed to build the "framework" for a protected mode OS loaded from the Expansion ROM of a LAN card. Currently, I've managed to load the OS code into RAM and executed there, the "kernel" itself already able to switch to P-MODE smoothly, so rignt now I'm coding the OS in C language, I haven't built any LDT or complete IDT yet. I need some suggestion from you all :). I only have 64 Kbyte space or to be exact 63 KB space for the OS code itself. I have no Idea what this space for right now, I could have upgrade the chip into 128 Kbyte but for now I just want to play with this small code space. Thanks for any suggestion :)
Posted on 2003-08-01 08:59:26 by Pinczakko
just compare to the features and size of my "os".
it's about 7400 bytes small and does not much yet: idt (dynamically created), gdt, keyboard, mouse, grafics mode (simple drawing functions: putpixel, textout, rectangle, fillrect), multitasking (just start a code being already in memory), some different syscalls and the beginning of a gui.
Posted on 2003-08-03 14:11:21 by hartyl
63K is pretty big size for OS program code itself. So you can put there many many functionality. The problem is not with code, but with data, and especially with strings and graphics. You must think carefully about size of data.
Posted on 2003-08-03 14:45:22 by JohnFound
Hartyl: Fortunately, I need your TextOut Function. Im a bit frutated Building it.

BTW: I'd like to share you this code.



button proc

pop [ebp+#24] ; EIP

pop [ebp+#20] ; color Fill
pop [ebp+#16] ; color line
pop [ebp+#12] ; height
pop [ebp+#8] ; width
pop [ebp+#4] ; y
pop [ebp] ; x

push [ebp+#24] ; Push EIP back

mov eax,[ebp] ; x2=x+width
add eax,[ebp+#8] ;
mov [ebp+#24],eax ;

mov eax,[ebp+#4] ; y2=y+heigth
add eax,[ebp+#12] ;
mov [ebp+#28],eax ;

finit
mov ecx,[ebp+#12]


@@f
push ecx
fild fd.[esp] ; push ecx
fidiv fd.[ebp+#12] ;
fst st(1) ;

xor eax,eax ;
mov al,[ebp+#20] ;
push eax
fimul fd.[esp]
fistp fd.[esp]
pop eax
mov [ebp+#32],al

mov al,[ebp+#21]
push eax
fild fd.[esp]
fmul st,st(1)
fistp fd.[esp]
pop eax
mov [ebp+#33],al

mov al,[ebp+#22]
push eax
fild fd.[esp]
fmul st,st(1)
fistp fd.[esp]
pop eax
mov [ebp+#34],al

mov eax,[ebp+#4]
add eax,ecx


push ebp ;
push [ebp] ; x
push eax ; y+count
push [ebp+#24] ; x2
push eax ; y+count
push [ebp+#32] ; Color
add ebp,#36 ;
call Line ;
pop ebp
pop ecx

dec ecx
jnz @@f

push ebp ; A(x,y)-(x2,y)
push [ebp] ; x
push [ebp+#4] ; y
push [ebp+#24] ; x2
push [ebp+#4] ; y
push [ebp+#16] ;
add ebp,#36
call Line
pop ebp

push ebp ; B(x2,y)-(x2,y2)
push [ebp+#24] ; x2
push [ebp+#4] ; y
push [ebp+#24] ; x2
push [ebp+#28] ; y2
push [ebp+#16] ;
add ebp,#36
call line
pop ebp

push ebp ; C(x,y)-(x,y2)
push [ebp] ; x
push [ebp+#4] ; y
push [ebp] ; x2
push [ebp+#28] ; y2
push [ebp+#16] ; color
add ebp,#36
call line
pop ebp

push ebp ; D(x,y2)-(x2,y2)
push [ebp] ; x
push [ebp+#28] ; y2
push [ebp+#24] ; x2
push [ebp+#28] ; y2
push [ebp+#16] ; Color
add ebp,#36
call line
pop ebp


ret
button endp


Posted on 2003-08-11 22:24:04 by realvampire
actually i don't like interrupting the other's thread but ok:



mov esi,string
textout_new.nextchar:
xor eax,eax
lodsb ;get a byte from string
test al,al ;check for zero
jz textout_new.break
mov ebx,[charset+eax*4] ;get char from charset
mov cx,30 ;30 pixels to put
textout_new.nextpx:
shr ebx,1 ;shift lowest bit out
push ebx ;save bit-information
jnc @f ; '0' was shifted out, no px to draw
xor dx,dx
mov ax,cx
mov bx,5
div bx ;y in ax, x in dx
shl eax,16
mov ax,dx ;calculate the relative position of the pixel
add eax,position ;get the absolute
ccall putpixel,eax,color
@@:
pop ebx ;restore bitinfo
dec cx
jge textout_new.nextpx ;when cx negative
add word position,6 ;x+=6
jmp textout_new.nextchar


note that the position is in that format:
position is a dword; low word=x-position, high word=y-position

the putpixel has this position-format in the first parameter and the color in the second.

i'll attatch the charset.inc. one char is one dword (actually just 30 bits). these bits indicate wheather on a specific position a pixel is drawn or not.


0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29


i've encoded the first 128 chars of the ascii. btw, i don't need your code...
have fun!
Posted on 2003-08-12 15:03:28 by hartyl