Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help on platform OS, everybody is welcome to help!!

Status
Not open for further replies.

SebMcClouth

Programmer
Apr 23, 2005
3
0
0
NL
Hey there

I joined this group a while ago. I'm writing a platform OS (running DOS 6.2 or higher) based upon Linux. If you care to take a look, make adjusments if ya like.

Grtz
Balai

DECLARE SUB Main ()
DECLARE SUB Boot ()
DECLARE SUB Pause (PLength%)
DECLARE SUB Init ()
DECLARE SUB Setup ()
DECLARE SUB MOUSE ()
'--------------------------------------------------------------------
'QBinux Core B0.03
'--------------------------------------------------------------------
'Just to let you all know that I haven't yet included all the
'credits, I'll get to that later. To be honest, this is only the
'the real Core, like the Linux Kernel. BASH (the QB version that is),
'will be added later. I have it on paper, most of the QB-version.
'
'Okay here goes:

'$INCLUDE: 'qb.bi' 'For whatever reason... Interrupt calling
'ofcourse... hehehe

DIM SHARED BaseMem AS INTEGER
DIM SHARED Console AS STRING
DIM SHARED ExtMem AS INTEGER
DIM SHARED FD0 AS INTEGER
DIM SHARED HD0 AS INTEGER
DIM SHARED MouseonBoard AS INTEGER 'Just like in those good old days of the Commadore XT...
DIM SHARED PatchLevel AS INTEGER
DIM SHARED RegsX AS RegTypeX
DIM SHARED ROOTDEV AS STRING
DIM SHARED ScrCols AS INTEGER
DIM SHARED ScrRows AS INTEGER
DIM SHARED SubLevel AS INTEGER
DIM SHARED SVGAMODE
DIM SHARED TotalMem AS INTEGER
DIM SHARED Version AS INTEGER
DIM SHARED VESA AS INTEGER

TYPE VGAInfoType
VESASignature AS STRING * 4
VESAVersion AS INTEGER
OEMStringPTR AS LONG
Capabilities AS STRING * 4
VideoModePTR AS LONG
TotalMemory AS INTEGER
Reserved AS STRING * 236
END TYPE

DIM SHARED VGAInfo AS VGAInfoType

Version = 0 'I know this is dangerous, but hey it's
PatchLevel = 0 'still a Beta-version.
SubLevel = 3

'ROOTDEV specifies the default-root-device.
'This can either be FLOPPY, CURRENT.
'Other options are for future release.

ROOTDDEV = CURRENT

'If you want to preset the SVGA mode, uncomment the next line and
'set SVGA_MODE to whatever number you want. { This is for future release.
'Set it to NORMALVGA if you just want the EGA/VGA mode.

SVGAMODE = NORMALVGA


Main 'C-ish... only that Main is the Main SUB.


SUB Boot
CLS
PRINT "Loading qbinux-" + RIGHT$(STR$(Version), 1) + "." + RIGHT$(STR$(PatchLevel), 1) + "." + RIGHT$(STR$(SubLevel), 1); : FOR A = 1 TO 7: Pause 2: PRINT "."; : NEXT: Pause 2: PRINT "."
Pause 2
PRINT : PRINT "QBCore version " + RIGHT$(STR$(Version), 1) + "." + RIGHT$(STR$(PatchLevel), 1) + "." + RIGHT$(STR$(SubLevel), 1) + " #1 " + DATE$ + " " + TIME$
Pause 2
PRINT "Console: ";
Pause 2
IF Console = "CG" OR Console = "VGA" THEN
Console = "Colour " + Console
END IF
IF VESA = 1 THEN
Console = Console + "+"
END IF
PRINT Console + " "; RIGHT$(STR$(ScrRows), 2); "x"; RIGHT$(STR$(ScrCols), 2)
Pause 2
PRINT "Memory: "; FreeMem; "/"; TotalMem; "kB"
'Does anyone know how to get the FreeMem?
Pause 2
'Does anyone know how to get the CPUinfo through INTERRUPT?
'Or OUT/INP?
'FloppyDrive(s) are for a future release. I have code for this.
'Does anyone know how to get IDEinfo through INTERRUPT?
'Or OUT/INP?
END SUB

SUB Init

Setup 'Calls the SUB Setup (through which the core setup will happen)
PRINT Done; ":pause 2"
Boot

END SUB

'Based upon the main.c by Linus Torvalds of Kernel version 1.0.9
'Slightly adjusted since all the setup-stuff happens in SUB Setup,
'and is not handled through here. Maybe in a future release
SUB Main
PRINT "Going to Init": Pause 2
Init 'Calls the SUB Init

END SUB

'By Alex Warren
SUB MOUSE
InterruptX &H33, RegsX, RegsX
END SUB

'If someone has a better routine, put it in here plz!!
SUB Pause (PLength%)
FOR P1% = 1 TO PLength%
FOR P2% = 1 TO 32000
FOR P3% = 1 TO 4
NEXT P3%
NEXT P2%
NEXT P1%
END SUB

'Based upon the setup.S file by Linus Torvalds of Kernel version 1.0.9
'This SUB is responsible for getting system info from the BIOS.
'Videocard detection by Peter Norton.
SUB Setup

IF SVGAMODE = ASKVGA THEN
'For future release
ELSEIF SVGAMODE = EXTENDEDVGA THEN
WIDTH 80, 50
ELSEIF SVGAMODE = NORMALVGA THEN
WIDTH 80, 25
END IF

'----------------------------------
'Get memory size (extended mem, kB)
'----------------------------------
OUT &H70, &H15
b% = INP(&H71)
OUT &H70, &H16
b1% = INP(&H71)
BaseMem = CVI(CHR$(b%) + CHR$(b1%))
OUT &H70, &H17
b% = INP(&H71)
OUT &H70, &H18
b1% = INP(&H71)
ExtMem = CVI(CHR$(b%) + CHR$(b1%))
TotalMem = BaseMem + ExtMem

'-----------------
'Check for EGA/VGA
'-----------------
RegsX.AX = &H1A00
InterruptX &H10, RegsX, RegsX
IF (RegsX.AX AND &HFF) = &H1A THEN
Code = RegsX.BX AND &HFF
SELECT CASE Code
CASE 1
Console = "MDA"
CASE 2
Console = "CGA"
CASE 4 TO 5
Console = "EGA"
CASE 6
Console = "PGA"
CASE 7 TO 8
Console = "VGA"
END SELECT
END IF

RegsX.AX = &H1130
RegsX.BX = &H0
InterruptX &H10, RegsX, RegsX
ScrRows = (RegsX.DX AND 255) + 1

RegsX.AX = &HF00
InterruptX &H10, RegsX, RegsX
ScrCols = (RegsX.AX AND 65280) / 256

'------------
'Get hd0 data
'------------
'For future release.
'Maybe someone can help me on this one.

'---------------------------
'Check for a pointing device
'---------------------------
RegsX.AX = 0: MOUSE
IF RegsX.AX = -1 THEN
MouseonBoard = 1
ELSE
MouseonBoard = 0
END IF

'-------------------------
'Flush the keyboard buffer
'-------------------------
'Thanks to Nico Baaijens
'Written by Glenn Stuart Dardick
POKE 106, 0
POKE 106, 0

'Routine trying to recognize type of SVGA-board present (if any)
'and if it recognize onve gives the choice of resolution it offers.
'if one is found the resolution chosen is given by al,ah (rows,cols).
'{for now it can only detect if there would be any SVGA-board present.
RegsX.AX = &H4F00
RegsX.ES = VARSEG(VGAInfo)
RegsX.DI = VARPTR(VGAInfo)
InterruptX &H10, RegsX, RegsX
IF RegsX.AX = &H4F THEN
VESA = 1 'SVGA-board present
ELSE
VESA = 0 'SVGA-board not present
END IF
END SUB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top