Hi,
jal wrote:The smallest computer I've got is a
eBox-2300SX and that does support VBE 3.0. It uses a "Vortex86" CPU, which is compatible with an 80486SX (there's no FPU). I can imagine a bunch of these things being used in an office or something (e.g. mounted on the backs of LCD screens), with a server humming away in the corner being used for any heavy processing and storage.
Ok, you got me convinced
. That is, I wouldn't want to support such hardware (go use an EeeBox!
), but in your case it's valid I guess.
I can't predict what hardware people might want to use my OS for in future, so for me it's best to assume nothing...
Note: An EeeBox is around 4 times the price of the eBox-2300SX. Not a big deal if you're only buying one, but if a company is making some sort of embedded device and they're planning on using 20 thousand of them...
jal wrote:That said, I bet there are plenty of simple SQRT routines to be found around, and if you know your math, it's easy to write one ('developing' would be an exageration) - I vaguely recall having to do just that in maths class 10 years ago (maths class at the polytechnics where I studied informatics, that is).
The SQRT was a lot easier than I was expecting - took me about 20 minutes:
Code: Select all
;'*T Integer Square Root Calculation
;;_______________________________________________________________________________
;Input
; eax Value
;
;Output
; eax Square root of value * 65536 (or "16.16" fixed point)
findSquareRoot:
pushes ebx,ecx,edx,ebp
mov ebx,eax ;ebx = target value
clr ebp ;ebp = initial test value (in "16.16" fixed point)
mov ecx,0x80000000 ;ecx = initial test bit (in "16.16" fixed point)
.l1: or ebp,ecx ;Set the test bit
mov eax,ebp ;eax = test value (in "16.16" fixed point)
mul ebp ;edx:eax = result (in "32.32" fixed point)
shl eax,1 ;carry = rounding bit
adc edx,0 ;edx = result, rounded to nearest integer
cmp edx,ebx ;Is the test value too high?
je .found ; no, the test value is perfect
jb .l2 ; no, the test value is closer to perfect
xor ebp,ecx ; yes, clear the test bit
.l2:
shr ecx,1 ;ecx = next test bit
test ecx,ecx ;Have all bits been tested?
jne .l1 ; no, keep going
.found:
mov eax,ebp
pops ebx,ecx,edx,ebp
ret
It's probably not the best possible method, but it's good enough for now.
My trouble now is the GTF formulas, and trying to make sure my 32-bit integer calculations are accurate enough. Yesterday I wrote code to find the refresh rate from the pixel clock, but it needs some improvement, and there's a few other calculations needed, and I still need to figure out a few things (like the horizontal and vertical sync start and end in VBE's CRTC information block).
I'm guessing it'll take me a week or 2, but by the time I'm done my boot code will have have the best video support possible.
Cheers,
Brendan