qbinux, need help on this feature

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Guest

qbinux, need help on this feature

Post by Guest » Fri Apr 29, 2005 2:27 am

Hello everybody out there using QuickBasic.

For already a long time (about 2 years) I've been trying to build an OS of my own with QuickBasic. I've changed the OS-idea to a platform OS (a.k.a. shell) so it runs on MS-DOS 6.2 and higher (haven't tested it yet on older or newer).

There are some things which I can't figure out yet:

* getting CPU-info through OUT/INP, Interrupt or something else
* getting the amount of used memory
* getting hd's info through CMOS
* getting info from the Real Time Clock

BASH is in development, currently I want my CORE to be fully functional.
So if someone wants to help me on this, I'd be very pleased!

grtz

Here's some code which I have now:

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

User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle » Fri Apr 29, 2005 10:05 am

For drive, memory and CMOS battery information:
You can use it, just give me (Kyle McInnes) credit.

Code: Select all

DEFINT A-Z
 
DECLARE FUNCTION CMOSBattery% ()
DECLARE FUNCTION BitOn% (Which%, IntVal%)
DECLARE FUNCTION DriveType% (Drv%)
DECLARE FUNCTION Hex2Bin$ (Hcs$)
DECLARE FUNCTION TotalMem% ()
CLS
IF CMOSBattery% THEN PRINT "CMOS Battery OK" ELSE PRINT "CMOS Battery Dead"
PRINT
k% = DriveType%(1)
PRINT "Drive A: ";
IF k% = 0 THEN PRINT "None"
IF k% = 1 THEN PRINT "5"; CHR$(172); " 360K"
IF k% = 2 THEN PRINT "5"; CHR$(172); " 1.2M"
IF k% = 3 THEN PRINT "3"; CHR$(171); " 720K"
IF k% = 4 THEN PRINT "3"; CHR$(171); " 1.44M"

OUT &H70, &H19
b% = INP(&H71)
IF b% = 0 THEN PRINT "Drive C not detected" ELSE PRINT "Drive C: Type"; b%




OUT &H70, &H15
b% = INP(&H71)
OUT &H70, &H16
b1% = INP(&H71)
PRINT "Base Memory:"; RTRIM$(STR$(CVI(CHR$(b) + CHR$(b1%)))); "K"



FUNCTION BitOn (Which, IntVal)
   BitOn = 0
   SELECT CASE Which
      CASE 1: IF (IntVal AND 128) THEN BitOn = (-1)
      CASE 2: IF (IntVal AND 64) THEN BitOn = (-1)

      CASE 3: IF (IntVal AND 32) THEN BitOn = (-1)
      CASE 4: IF (IntVal AND 16) THEN BitOn = (-1)
      CASE 5: IF (IntVal AND 8) THEN BitOn = (-1)
      CASE 6: IF (IntVal AND 4) THEN BitOn = (-1)
      CASE 7: IF (IntVal AND 2) THEN BitOn = (-1)
      CASE 8: IF (IntVal AND 1) THEN BitOn = (-1)
      CASE 9: IF (IntVal AND (-32768)) THEN BitOn = (-1)
      CASE 10: IF (IntVal AND 16384) THEN BitOn = (-1)
      CASE 11: IF (IntVal AND 8192) THEN BitOn = (-1)
      CASE 12: IF (IntVal AND 4096) THEN BitOn = (-1)
      CASE 13: IF (IntVal AND 2048) THEN BitOn = (-1)
      CASE 14: IF (IntVal AND 1024) THEN BitOn = (-1)
      CASE 15: IF (IntVal AND 512) THEN BitOn = (-1)
      CASE 16: IF (IntVal AND 256) THEN BitOn = (-1)
   END SELECT
END FUNCTION

FUNCTION CMOSBattery%
	OUT &H70, &HD
	b% = INP(&H71)
	c = BitOn%(1, b%)
	CMOSBattery% = c
END FUNCTION

FUNCTION DriveType% (Drv%)
	OUT &H70, &H10
	b% = INP(&H71)
	IF Drv% = 1 THEN
		t$ = LEFT$(Hex2Bin$(LTRIM$(RTRIM$(HEX$(b%)))), 4)
	ELSE
		t$ = MID$(Hex2Bin$(LTRIM$(RTRIM$(HEX$(b%)))), 5, 4)
	END IF
	IF t$ = "0001" THEN DriveType% = 1
	IF t$ = "0010" THEN DriveType% = 2
	IF t$ = "0011" THEN DriveType% = 3
	IF t$ = "0100" THEN DriveType% = 4
END FUNCTION

FUNCTION Hex2Bin$ (Hcs$)
   Hcs$ = UCASE$(Hcs$)
   lc = LEN(Hcs$)
   FOR x = 1 TO lc
      SELECT CASE MID$(Hcs$, x, 1)
	 CASE "0"
	    Out$ = Out$ + "0000"
	 CASE "1"
	    Out$ = Out$ + "0001"
	 CASE "2"
	    Out$ = Out$ + "0010"
	 CASE "3"
	    Out$ = Out$ + "0011"
	 CASE "4"
	    Out$ = Out$ + "0100"
	 CASE "5"
	    Out$ = Out$ + "0101"
	 CASE "6"
	    Out$ = Out$ + "0110"
	 CASE "7"
	    Out$ = Out$ + "0111"
	 CASE "8"
	    Out$ = Out$ + "1000"
	 CASE "9"
	    Out$ = Out$ + "1001"
	 CASE "A"
	    Out$ = Out$ + "1010"
	 CASE "B"
	    Out$ = Out$ + "1011"
	 CASE "C"
	    Out$ = Out$ + "1100"
	 CASE "D"
	    Out$ = Out$ + "1101"
	 CASE "E"
	    Out$ = Out$ + "1110"
	 CASE "F"
	    Out$ = Out$ + "1111"
      END SELECT
   NEXT
   Hex2Bin$ = Out$
END FUNCTION

FUNCTION TotalMem%
	OUT &H70, &H15
	b% = INP(&H71)
	OUT &H70, &H16
	b1% = INP(&H71)
	a1% = CVI(CHR$(b) + CHR$(b1%))
	OUT &H70, &H17

	b% = INP(&H71)
	OUT &H70, &H18
	b1% = INP(&H71)
	a2% = CVI(CHR$(b) + CHR$(b1%))
	TotalMem% = a1% + a2%
END FUNCTION

User avatar
SebMcClouth
Veteran
Posts: 240
Joined: Fri Apr 29, 2005 2:20 am
Location: Inside the Matrix

Post by SebMcClouth » Sat Apr 30, 2005 1:59 pm

I believe this code was written by John Woodgates, or did you write the tutorial? But still need help on getting info from the CMOS, such as the Real Time Clock, HD's, etc.

grtz

User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle » Sun May 01, 2005 11:57 am

Yes, somebody wrote the CMOS battery stuff, but I didn't know their name. I did the rest. What other information do you need from the CMOS? Why do you need to access the real-time clock? If you need the time or date, that can be done through QB or DOS.

User avatar
SebMcClouth
Veteran
Posts: 240
Joined: Fri Apr 29, 2005 2:20 am
Location: Inside the Matrix

Post by SebMcClouth » Sun May 01, 2005 12:21 pm

I need to access the Real Time Clock for some thingies, I need to get all sorts of info about the hd's and also the CPU.

grtz

User avatar
SebMcClouth
Veteran
Posts: 240
Joined: Fri Apr 29, 2005 2:20 am
Location: Inside the Matrix

Post by SebMcClouth » Fri May 06, 2005 2:52 pm

After getting my hands on some new thingies, I've changed the core a bit. When I have a stable version, I'll post it here.

In the mean time, if you want to help... post your code of which you think might be usefull...

grtz

User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle » Fri May 06, 2005 3:34 pm

Some better code for your PAUSE routine. This runs at the same speed on all computers. 1 time% is 1/18th of a second (time%=18 is roughly 1 second).

Code: Select all

    DEF SEG = 0
    POKE (1132), 0
   CountDown:
    IF PEEK(1132) < time% THEN GOTO CountDown
    DEF SEG 
edit: I've just noticed that you're treating the variable Console as a string a lot. I think you have missed off the $ on every instance of it.

User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle » Sat May 07, 2005 3:46 am

You could make a sub like that, but then you only have a resolution of 1 second if you use integers.

It's not my code, I just had it lying around. I'm not sure how it works, but it does.

Guest

As promised. the new version of the core

Post by Guest » Sat May 07, 2005 3:51 am

Well here it is. And same as before: if you have code lying around which you think can be used in the core, add them and post the code here.

I'll add the Pause code later when I tested it.

grtz

Code: Select all

DEFINT A-Z

'$INCLUDE: 'QB.BI'

CONST False = 0: True = NOT False

TYPE CPUINFOx86
    x86             AS INTEGER          'CPU family
    x86Vendor       AS INTEGER          'CPU vendor
    x86Model        AS INTEGER          'CPU model
    x86Stepping     AS INTEGER          'CPU stepping
    x86Type         AS INTEGER          'CPU type
    x86Capabilities AS LONG             'CPU features
    x86cpuid        AS INTEGER          'CPU IDFlag
    x86CxDirFlag    AS INTEGER
    x86Fpu          AS INTEGER          'FPU
END TYPE

TYPE FloppyDrive
    OnBoard         AS INTEGER
    DevName         AS STRING * 3
    size            AS STRING * 5
END TYPE

TYPE HardDrive
    OnBoard         AS INTEGER
    DevName         AS STRING * 3
END TYPE

TYPE qbinuxInfo
    By              AS STRING * 24
    Host            AS STRING * 80
    Time            AS STRING * 30
END TYPE

TYPE UserInfo
    uid             AS INTEGER
    euid            AS INTEGER
    gid             AS INTEGER
    egid            AS INTEGER
    UserName        AS STRING * 24
    UShell          AS STRING * 10
    HomeDir         AS STRING * 80
END TYPE

TYPE UTSName
    SysName         AS STRING * 80
    NodeName        AS STRING * 80
    Release         AS STRING * 80
    UVersion        AS STRING * 80
    Machine         AS STRING * 80
    DomainName      AS STRING * 80
END TYPE

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 Console        AS STRING
DIM SHARED CPUInfo        AS CPUINFOx86
DIM SHARED CurrentUser    AS UserInfo
DIM SHARED Dummy          AS STRING
DIM SHARED fd             AS INTEGER
DIM SHARED fd0            AS FloppyDrive
DIM SHARED fd1            AS FloppyDrive
DIM SHARED hd0            AS HardDrive
DIM SHARED PatchLevel     AS INTEGER
DIM SHARED QBinuxBanner   AS STRING
DIM SHARED qbinuxCompile  AS qbinuxInfo
DIM SHARED Qilo           AS INTEGER
DIM SHARED RegsX          AS RegTypeX
DIM SHARED ScrCols        AS INTEGER
DIM SHARED ScrRows        AS INTEGER
DIM SHARED SubLevel       AS INTEGER
DIM SHARED TTYS0          AS INTEGER
DIM SHARED UTS            AS UTSName
DIM SHARED Version        AS INTEGER
DIM SHARED VGAInfo        AS VGAInfoType

StartKernel

'-----------------------------------------------------------------------
' The machine code of the assembler procedure for CPUINFOx68
'-----------------------------------------------------------------------
GetProcInfoASM:
' Number of bytes
DATA 1237
' Hexadecimal representation of machine code
DATA 55,8B,EC,9C,1E,06,56,57,8B,5E,06,8B,3F,81,EF,0A
DATA 00,8C,C8,8E,D8,8E,C0,80,BD,C7,00,FF,75,72,C6,85
DATA C9,00,00,E8,FA,00,72,11,C6,85,C7,00,00,E8,FD,00
DATA 72,5B,C6,85,C9,00,06,EB,54,E8,F8,00,72,07,C6,85
DATA C7,00,01,EB,48,E8,02,01,72,07,C6,85,C7,00,02,EB
DATA 3C,E8,06,01,72,0E,C6,85,C7,00,03,E8,24,01,88,85
DATA CB,00,EB,29,C6,85,C7,00,04,E8,9A,02,72,12,C6,85
DATA C9,00,03,E8,A3,02,80,BD,D7,00,01,75,10,E8,42,03
DATA E8,90,01,80,BD,C9,00,03,75,03,E8,5C,03,E8,91,03
DATA 8B,46,FC,8E,C0,BE,C7,00,03,F7,8B,7E,08,B9,14,00
DATA F3,A4,5F,5E,07,1F,9D,5D,CA,04,00,48,61,6E,73,20
DATA 4C,75,6E,73,69,6E,67,2C,20,31,39,39,37,FF,00,FF
DATA 00,FF,00,FF,00,FF,00,00,00,00,00,00,00,00,00,FF
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,24,00,00
DATA 00,00,00,00,47,65,6E,75,69,6E,65,49,6E,74,65,6C
DATA 41,75,74,68,65,6E,74,69,63,41,4D,44,41,4D,44,20
DATA 49,53,42,45,54,54,45,52,43,79,72,69,78,49,6E,73
DATA 74,65,61,64,55,4D,43,20,55,4D,43,20,55,4D,43,20
DATA B0,FF,B1,20,D2,E0,0A,C0,F9,75,01,F8,C3,F9,60,F8
DATA 72,01,61,C3,9C,58,8B,C8,25,FF,0F,50,9D,9C,58,25
DATA 00,F0,3D,00,F0,F9,75,01,F8,C3,81,C9,00,F0,51,9D
DATA 9C,58,25,00,F0,F9,75,01,F8,C3,8B,DC,83,E4,FC,66
DATA 9C,66,58,66,8B,C8,66,35,00,00,04,00,66,50,66,9D
DATA 66,9C,66,58,66,51,66,9D,66,33,C1,8B,E3,F9,75,01
DATA F8,C3,57,FC,B9,00,04,33,F6,F3,66,AD,B9,00,04,33
DATA F6,8B,FE,FA,B0,B0,E6,43,EB,00,32,C0,E6,42,EB,00
DATA E6,42,EB,00,E4,61,0C,01,E6,61,F3,A5,B0,80,E6,43
DATA EB,00,FB,E4,42,EB,00,8A,D0,E4,42,EB,00,8A,F0,F7
DATA DA,E4,61,24,FE,E6,61,52,B9,00,04,33,F6,8B,FE,FA
DATA B0,B0,E6,43,EB,00,32,C0,E6,42,EB,00,E6,42,EB,00
DATA E4,61,0C,01,E6,61,F3,66,A5,B0,80,E6,43,EB,00,FB
DATA E4,42,EB,00,8A,D0,E4,42,EB,00,8A,F0,F7,DA,E4,61
DATA 24,FE,E6,61,58,8B,D8,D1,EB,03,C3,3B,C2,B0,00,14
DATA 00,5F,C3,C6,85,D5,00,00,66,8B,C1,66,35,00,00,20
DATA 00,66,50,66,9D,66,9C,66,58,66,33,C1,0F,84,D5,00
DATA FE,85,D5,00,66,33,C0,0F,A2,66,89,9D,DB,00,66,89
DATA 95,DF,00,66,89,8D,E3,00,BE,DB,00,03,F7,56,57,81
DATA C7,EE,00,B9,0C,00,F3,A6,5F,5E,0B,C9,75,07,C6,85
DATA C9,00,01,EB,65,56,57,81,C7,FA,00,B9,0C,00,F3,A6
DATA 5F,5E,0B,C9,75,07,C6,85,C9,00,02,EB,4D,56,57,81
DATA C7,06,01,B9,0C,00,F3,A6,5F,5E,0B,C9,75,07,C6,85
DATA C9,00,02,EB,35,56,57,81,C7,12,01,B9,0C,00,F3,A6
DATA 5F,5E,0B,C9,75,07,C6,85,C9,00,03,EB,1D,56,57,81
DATA C7,1E,01,B9,0C,00,F3,A6,5F,5E,0B,C9,75,07,C6,85
DATA C9,00,04,EB,05,C6,85,C9,00,09,66,83,F8,01,7C,35
DATA FE,85,D5,00,66,33,C0,66,40,0F,A2,66,89,95,D1,00
DATA 8A,D0,80,E2,0F,88,95,CD,00,24,F0,C0,E8,04,88,85
DATA CB,00,8A,F4,80,E6,0F,88,B5,C7,00,80,E4,30,C0,EC
DATA 04,88,A5,CF,00,C3,33,C0,9E,B8,05,00,B3,02,F6,F3
DATA 9F,80,FC,02,F9,75,01,F8,C3,C6,85,E8,00,FF,C6,85
DATA E9,00,FF,B4,C3,E8,E3,00,8A,D0,34,80,E8,E6,00,B4
DATA C0,E8,D7,00,B4,C3,E8,D2,00,32,ED,3A,C2,74,02,FE
DATA C5,8A,C2,E8,CF,00,C6,85,D7,00,00,80,FE,01,75,18
DATA FE,85,D7,00,B4,FE,E8,B2,00,88,85,E8,00,B4,FF,E8
DATA A9,00,88,85,E9,00,EB,34,B4,C2,E8,9E,00,8A,D0,34
DATA 04,E8,A1,00,B4,C0,E8,92,00,B4,C2,E8,8D,00,32,C9
DATA 3A,C2,74,02,FE,C1,8A,C2,E8,8A,00,80,FA,01,75,07
DATA C6,85,E8,00,FE,EB,05,C6,85,E8,00,FD,8A,85,E8,00
DATA 8A,E0,24,0F,C0,EC,04,C6,85,C7,00,04,88,A5,CB,00
DATA 88,85,CD,00,3C,03,72,09,3C,0F,74,05,C6,85,C7,00
DATA 05,C3,B4,C3,E8,44,00,88,85,EA,00,24,0F,0C,10,E8
DATA 43,00,B4,E8,E8,34,00,88,85,EB,00,0C,80,E8,35,00
DATA B4,C3,8A,85,EA,00,E8,2C,00,B4,C3,E8,1D,00,88,85
DATA EA,00,24,0F,0C,10,E8,1C,00,B4,E8,8A,85,EB,00,E8
DATA 13,00,B4,C3,8A,85,EA,00,E8,0A,00,9C,FA,8A,C4,E6
DATA 22,E4,23,9D,C3,9C,FA,86,C4,E6,22,86,C4,E6,23,9D
DATA C3,9C,B2,00,80,BD,D5,00,02,75,0C,8B,85,D1,00,A8
DATA 01,74,04,B2,05,EB,7F,DB,E3,C7,85,EC,00,5A,5A,DD
DATA BD,EC,00,8B,85,EC,00,3C,00,75,6B,D9,BD,EC,00,8B
DATA 85,EC,00,25,3F,10,83,F8,3F,75,5B,B2,01,80,BD,C7
DATA 00,02,72,52,B2,02,74,4E,80,BD,C7,00,03,75,24,9B
DATA D9,E8,9B,D9,EE,9B,DE,F9,9B,D9,C0,9B,D9,E0,9B,DE
DATA D9,9B,DD,BD,EC,00,8B,85,EC,00,9E,B2,02,74,27,B2
DATA 03,EB,23,B2,05,80,BD,C7,00,04,75,1A,80,BD,D5,00
DATA 01,75,0C,F7,85,D1,00,01,00,75,0B,B2,03,EB,07,E8
DATA 0A,00,73,02,B2,03,88,95,D9,00,9D,C3,0F,20,C0,8A
DATA D8,34,10,0F,22,C0,0F,20,C0,86,C3,0F,22,C0,3A,C3
DATA F9,75,01,F8,C3

' Vendor codes

CONST UNKNOWN = 0, INTEL = 1, AMD = 2, CYRIX = 3
CONST UMC = 4, NEC = 6, OTHER = 9

' CPU family codes

CONST I8086 = 0, I80186 = 1, I80286 = 2, I80386 = 3, I80486 = 4
CONST FAMILY5 = 5, FAMILY6 = 6

' FPU identifications:

CONST NONE = 0, I8087 = 1, I80287 = 2, I80387 = 3
CONST BUILT.IN.OR.387 = 4, BUILT.IN = 5

FUNCTION Current$

RegsX.AX = &H1900
InterruptX &H21, RegsX, RegsX
CurrentDrv% = RegsX.AX MOD 256
CurrentDrv$ = CHR$(65 + CurrentDrv%)
IF CurrentDrv$ = "C" THEN
  Current$ = "dev\hda"
END IF
END FUNCTION

FUNCTION Dec2Char$ (Dummy)
Dec2Char$ = LTRIM$(RTRIM$(STR$(Dummy)))
END FUNCTION

FUNCTION DriveType% (drv%)
   OUT &H70, &H10
   b% = INP(&H71)
   IF drv% = 1 THEN
     t$ = LEFT$(Hex2Bin$(LTRIM$(RTRIM$(HEX$(b%)))), 4)
   ELSE
     t$ = MID$(Hex2Bin$(LTRIM$(RTRIM$(HEX$(b%)))), 5, 4)
   END IF
   IF t$ = "0001" THEN DriveType% = 1
   IF t$ = "0010" THEN DriveType% = 2
   IF t$ = "0011" THEN DriveType% = 3
   IF t$ = "0100" THEN DriveType% = 4
END FUNCTION

SUB Floppy
fd0.OnBoard = False
fd1.OnBoard = False
FOR drv% = 1 TO 2
   k% = DriveType%(drv%)
   IF k% = 0 THEN
     fd = False
     EXIT SUB
   ELSE
     fd = True
     IF k% = 1 THEN
       IF drv% = 1 THEN
	 fd0.OnBoard = True
	 fd0.DevName = "fd0"
	 fd0.size = "360k"
       ELSEIF drv% = 2 THEN
	 fd1.OnBoard = True
	 fd1.DevName = "fd1"
	 fd1.size = "360k"
       END IF
     ELSEIF k% = 2 THEN
       IF drv% = 1 THEN
	 fd0.OnBoard = True
	 fd0.DevName = "fd0"
	 fd0.size = "1.2M"
       ELSEIF drv% = 2 THEN
	 fd1.OnBoard = True
	 fd1.DevName = "fd1"
	 fd1.size = "1.2M"
       END IF
     ELSEIF k% = 3 THEN
       IF drv% = 1 THEN
	 fd0.OnBoard = True
	 fd0.DevName = "fd0"
	 fd0.size = "720k"
       ELSEIF drv% = 2 THEN
	 fd1.OnBoard = True
	 fd1.DevName = "fd1"
	 fd1.size = "720k"
       END IF
     ELSEIF k% = 4 THEN
       IF drv% = 1 THEN
	 fd0.OnBoard = True
	 fd0.DevName = "fd0"
	 fd0.size = "1.44M"
       ELSEIF drv% = 2 THEN
	 fd1.OnBoard = True
	 fd1.DevName = "fd1"
	 fd1.size = "1.44M"
       END IF
     END IF
   END IF
NEXT
IF fd1.DevName = "" OR fd1.size = "" THEN
  fd1.OnBoard = False
END IF
END SUB

FUNCTION GetCPUName$ (ProcInfo AS CPUINFOx86)
DIM CPU AS STRING
IF ProcInfo.x86cpuid = 2 OR ProcInfo.x86CxDirFlag = 1 THEN
  'CPU supports CPUID instruction fully, or is a Cyrix processor
  'and supports the DIR registers
  SELECT CASE ProcInfo.x86Vendor
  CASE INTEL
    SELECT CASE ProcInfo.x86
    CASE I80486
      SELECT CASE ProcInfo.x86Model
      CASE 3: CPU = "Intel486 DX2 or DX2 Overdrive"
      CASE 5: CPU = "Intel486 SX2"
      CASE 7: CPU = "Intel486 DX2 (write back enhanced)"
      CASE 8:
	IF ProcInfo.x86Type = 0 THEN
	  CPU = "Intel486 DX4 or DX4 Overdrive"
	ELSE
	  CPU = "Intel486 DX4 Overdrive"
	END IF
      CASE ELSE
	CPU = "Intel486"
      END SELECT
    CASE FAMILY5
      SELECT CASE ProcInfo.x86Model
      CASE 1: CPU = "Pentium (510\60, 567\66)"
      CASE 2:
	IF ProcInfo.x86Type = 0 THEN
	  CPU = "Pentium (680\75, 735\90, 815\100, 1000\120, 1110\133)"
	ELSE
	  CPU = "Pentium Overdrive for Pentium CPU"
	END IF
      CASE 3: CPU = "Pentium Overdrive for Intel486 CPU"
      CASE 4: CPU = "Overdrive for Pentium (680\75, 735\90, 815\100, 1000\120, 1110\133)"
      CASE 5: CPU = "Pentium Overdrive for Intel486 DX4 CPU"
      CASE ELSE
	CPU = "Intel Pentium"
      END SELECT
    CASE FAMILY6
      SELECT CASE ProcInfo.x86Model
      CASE 1: CPU = "Pentium Pro"
      CASE 3: CPU = "Overdrive for Pentium Pro"
      CASE ELSE
	CPU = "Intel Pentium Pro"
      END SELECT
    CASE ELSE
      CPU = "Intel Pentium Pro Plus"
    END SELECT
  CASE AMD
    SELECT CASE ProcInfo.x86
    CASE I80486
      SELECT CASE ProcInfo.x86Model
      CASE 3:  CPU = "Am486DX2 (Write Trough)"
      CASE 7:  CPU = "Am486DX2 (Write Back)"
      CASE 8:  CPU = "Am486DX4 or Am5x86-150Mhz (Write Trough)"
      CASE 9:  CPU = "Am486DX4 or Am5x86-150Mhz (Write Back)"
      CASE 14: CPU = "Am5x86 133 or 160Mhz (Write Trough)"
      CASE 15: CPU = "Am5x86 133 or 160Mhz (Write Back)"
      CASE ELSE
	CPU = "AMD Am486 or Am5x86"
      END SELECT
    CASE FAMILY5
      SELECT CASE ProcInfo.x86Model
      CASE 0:  CPU = "AMD-K5 (model 0)"
      CASE 1:  CPU = "AMD-K5 (model 1)"
      CASE 6:  CPU = "AMD-K6"
      CASE ELSE
	CPU = "AMD-K5 or AMD-K6"
      END SELECT
    CASE ELSE
      CPU = "AMD-K6 Plus"
    CASE ELSE
    END SELECT

  CASE CYRIX
    SELECT CASE ProcInfo.x86Model
    CASE 0
      SELECT CASE ProcInfo.x86Stepping
      CASE 0: CPU = "Cx486 SLC"
      CASE 1: CPU = "Cx486 DLC"
      CASE 2: CPU = "Cx486 SLC2"
      CASE 3: CPU = "Cx486 DLC2"
      CASE 4: CPU = "Cx486 SRx, Retail Upgrade Cx486SLC"
      CASE 5: CPU = "Cx486 DRx, Retail Upgrade Cx486DLC"
      CASE 6: CPU = "Cx486 SRx2, Retail Upgrade 2x Cx486SLC"
      CASE 7: CPU = "Cx486 DRx2, Retail Upgrade 2x Cx486DLC"
      CASE ELSE: CPU = "Cx486 model 0 stepping" + STR$(ProcInfo.x86Stepping)
      END SELECT
    CASE 1
      SELECT CASE ProcInfo.x86Stepping
      CASE 0: CPU = "Cx486S B step"
      CASE 1: CPU = "Cx486S2 B step"
      CASE 2: CPU = "Cx486Se B step"
      CASE 3: CPU = "Cx486S2e B step"
      CASE 10: CPU = "Cx486DX"
      CASE 11: CPU = "Cx486DX2"
      CASE 15: CPU = "Cx486DX4"
      CASE ELSE: CPU = "Cx486 model 1 stepping" + STR$(ProcInfo.x86Stepping)
      END SELECT
    CASE 2
      SELECT CASE ProcInfo.x86Stepping
      CASE 8, 10: CPU = "Cyrix 5x86 1x Core/Bus Clock"
      CASE 9, 11: CPU = "Cyrix 5x86 2x Core/Bus Clock"
      CASE 13, 15: CPU = "Cyrix 5x86 3x Core/Bus Clock"
      CASE 12, 14: CPU = "Cyrix 5x86 4x Core/Bus Clock"
      CASE ELSE:   CPU = "Cyrix 5x86 stepping" + STR$(ProcInfo.x86Stepping)
      END SELECT
    CASE 3
      SELECT CASE ProcInfo.x86Stepping
      CASE 0, 2: CPU = "Cyrix 6x86 1x Core/Bus Clock"
      CASE 1, 3: CPU = "Cyrix 6x86 2x Core/Bus Clock"
      CASE 5, 7: CPU = "Cyrix 6x86 3x Core/Bus Clock"
      CASE 4, 6: CPU = "Cyrix 6x86 4x Core/Bus Clock"
      CASE ELSE:   CPU = "Cyrix 6x86 stepping" + STR$(ProcInfo.x86Stepping)
      END SELECT
    CASE 15
      SELECT CASE ProcInfo.x86Stepping
      CASE 13:   CPU = "Cx486SLC or DLC, old model"
      CASE 14:   CPU = "Cx486Sa Step=1"
      CASE ELSE: CPU = "Cyrix unknown model"
      END SELECT
    CASE ELSE
      CPU = "Cyrix unknown model"
    END SELECT
  CASE UMC
    SELECT CASE ProcInfo.x86
    CASE I80486:  CPU = "UMC 80486-like"
    CASE FAMILY5: CPU = "UMC Pentium-like"
    CASE FAMILY6: CPU = "UMC Pentium-Pro-like"
    CASE ELSE: CPU = "UMC Pentium-Pro-like Plus"
    END SELECT
  CASE ELSE
    SELECT CASE ProcInfo.x86
    CASE I80486:  CPU = "80486-like"
    CASE FAMILY5: CPU = "Pentium-like"
    CASE FAMILY6: CPU = "Pentium-Pro-like"
    CASE ELSE: CPU = "Pentium-Pro-like Plus"
    END SELECT
  END SELECT
ELSE
  'CPU doesn't support CPUID instruction or supports it for vendor id only
  SELECT CASE ProcInfo.x86
  CASE I8086
    IF ProcInfo.x86Vendor = NEC THEN
      CPU = "NEC V20/V30"
    ELSE
      CPU = "8086/8088"
    END IF
  CASE I80186
    CPU = "80186/80188"
  CASE I80286
    CPU = "80286"
  CASE I80386
    SELECT CASE ProcInfo.x86Model
    CASE 0: CPU = "80386 DX"
    CASE 1: CPU = "80386 SX"
    CASE ELSE: CPU = "80386"
    END SELECT
  CASE I80486
    IF ProcInfo.x86Vendor = CYRIX THEN
      CPU = "Cx486 SLC/DLC"
    ELSEIF ProcInfo.x86Fpu = BUILT.IN THEN
      CPU = "80486 DX (or newer)"
    ELSE
      CPU = "80486 SX"
    END IF
  END SELECT
END IF
GetCPUName$ = CPU
END FUNCTION

FUNCTION GetFPUName$ (ProcInfo AS CPUINFOx86)
DIM Fpu AS STRING
SELECT CASE ProcInfo.x86Fpu
CASE BUILT.IN: Fpu = "built-in"
CASE I80387:   Fpu = "80387"
CASE I80287:   Fpu = "80287"
CASE I8087:    Fpu = "8087"
CASE ELSE:     Fpu = "not present"
END SELECT
GetFPUName$ = Fpu
END FUNCTION

SUB GetProcInfo (ProcInfo AS CPUINFOx86) STATIC
'-----------------------------------------------------------------------
' Procedure to get info about the CPU and the FPU.
' Uses the ProcInfoType structure to return the info in.
'-----------------------------------------------------------------------

IF NOT MachineCode% THEN
  ' First time dimension string array to hold machine code
  RESTORE GetProcInfoASM
  READ nASMBYTES%
  REDIM ASMBuffer(0 TO nASMBYTES% - 1) AS STRING * 1
END IF

' Get address of machine code
DEF SEG = VARSEG(ASMBuffer(0))
Offset% = VARPTR(ASMBuffer(0))

IF NOT MachineCode% THEN
  ' First time load string array with machine code
  FOR I% = 0 TO nASMBYTES% - 1
    READ Code$
    POKE Offset% + I%, VAL("&H" + Code$)
  NEXT I%
  ' Indicate availability of machine code
  MachineCode% = True
END IF

' Get info.
' The second offset% is necessary!!!
CALL ABSOLUTE(ProcInfo, Offset%, Offset%)

DEF SEG
END SUB

FUNCTION GetVendorName$ (Vendor AS INTEGER)
DIM Ven AS STRING
SELECT CASE Vendor
CASE INTEL: Ven = "Intel"
CASE AMD: Ven = "AMD"
CASE CYRIX: Ven = "Cyrix"
CASE UMC: Ven = "UMC"
CASE NEC: Ven = "NEC"
CASE ELSE: Ven = "not specified"
END SELECT
GetVendorName$ = Ven
END FUNCTION

FUNCTION Hex2Bin$ (Hcs$)
   Hcs$ = UCASE$(Hcs$)
   lc = LEN(Hcs$)
   FOR x = 1 TO lc
      SELECT CASE MID$(Hcs$, x, 1)
	  CASE "0"
	     Out$ = Out$ + "0000"
	  CASE "1"
	     Out$ = Out$ + "0001"
	  CASE "2"
	     Out$ = Out$ + "0010"
	  CASE "3"
	     Out$ = Out$ + "0011"
	  CASE "4"
	     Out$ = Out$ + "0100"
	  CASE "5"
	     Out$ = Out$ + "0101"
	  CASE "6"
	     Out$ = Out$ + "0110"
	  CASE "7"
	     Out$ = Out$ + "0111"
	  CASE "8"
	     Out$ = Out$ + "1000"
	  CASE "9"
	     Out$ = Out$ + "1001"
	  CASE "A"
	     Out$ = Out$ + "1010"
	  CASE "B"
	     Out$ = Out$ + "1011"
	  CASE "C"
	     Out$ = Out$ + "1100"
	  CASE "D"
	     Out$ = Out$ + "1101"
	  CASE "E"
	     Out$ = Out$ + "1110"
	  CASE "F"
	     Out$ = Out$ + "1111"
	  END SELECT
      NEXT
      Hex2Bin$ = Out$
END FUNCTION

SUB Init
SHARED dRunLevel      AS STRING
SHARED Dummy          AS STRING
SHARED InitVersion    AS INTEGER
SHARED InitPatchLevel AS INTEGER
SHARED InitSubLevel   AS INTEGER
SHARED InitLabel      AS STRING

InitVersion = 0
InitPatchLevel = 0
InitSubLevel = 1

InitLabel = Dec2Char$(InitVersion) + "." + Dec2Char$(InitPatchLevel) + Dec2Char$(InitSubLevel)

PRINT
PRINT "INIT: version " + InitLabel + " booting"
Pause 3
OPEN "etc\inittab.cfg" FOR INPUT AS #1
DO
   INPUT #1, Dummy
   IF INSTR(Dummy, "#") > 1 THEN
     'Do nothing
  ELSEIF INSTR(Dummy, "id") > 1 THEN
     IF INSTR(Dummy, "initdefault") > 1 THEN
       dRunLevel = MID$(Dummy, 4, 1)
     END IF
  END IF
LOOP UNTIL EOF(1)
CLOSE

PRINT "Telling the kernel that the machine time is GMT."
END SUB

FUNCTION Month$ (value%)
IF value% = 1 THEN Month$ = "Jan"
IF value% = 2 THEN Month$ = "Feb"
IF value% = 3 THEN Month$ = "Mar"
IF value% = 4 THEN Month$ = "Apr"
IF value% = 5 THEN Month$ = "May"
IF value% = 6 THEN Month$ = "Jun"
IF value% = 7 THEN Month$ = "Jul"
IF value% = 8 THEN Month$ = "Aug"
IF value% = 9 THEN Month$ = "Sep"
IF value% = 10 THEN Month$ = "Oct"
IF value% = 11 THEN Month$ = "Nov"
IF value% = 12 THEN Month$ = "Dec"
END FUNCTION

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

SUB Panic (s AS STRING)
PRINT "Kernel panic: "; s
END SUB

SUB Pause (Times%)
Times% = Times% * 30
   FOR I = 1 TO Times%
      WAIT &H3DA, 8
      WAIT &H3DA, 8, 8
   NEXT I
END SUB

'Based upon setup.S by Linus Torvalds
SUB StartKernel
'Version settings:
Version = 0
PatchLevel = 0
SubLevel = 1

'===================
'Part (1) - the Core
'===================
      
'----------------------------------------------------------
'Get memory size (extended mem, kB) - Author: John Woodgate
'----------------------------------------------------------
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 - Author: xxx
'-------------------------------
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 = "monchrome MDA"
	CASE 2
	    Console = "colour CGA"
	CASE 4 TO 5
	    Console = "colour EGA"
	CASE 6
	    Console = "colour PGA"
	CASE 7 TO 8
	    Console = "colour 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
'------------
OUT &H70, &H19
b% = INP(&H71)
IF b% <> 0 THEN
     hd0.OnBoard = True
     hd0.DevName = "hda"
ELSE
     hd0.OnBoard = False
END IF

'-------------------------
'Check for pointing device
'-------------------------
TTYS0 = False
RegsX.AX = 0: Mouse
IF RegsX.AX = -1 THEN
  TTYS0 = True
END IF

'-------------------------------
'Check for SVGA-board if present
'-------------------------------
RegsX.AX = &H4F00
RegsX.ES = VARSEG(VGAInfo)
RegsX.DI = VARPTR(VGAInfo)
InterruptX &H10, RegsX, RegsX
IF RegsX.AX = &H4F THEN
  VESA = True
  Console = Console + "+"
ELSE
  VESA = False
END IF

'============================
'Part (2) - The boot sequence
'============================

Qilo = False

'---------------------------------
'Version settings - part 1 of boot
'---------------------------------
UTS.Release = Dec2Char$(Version) + "." + Dec2Char$(PatchLevel) + "." + Dec2Char$(SubLevel)
UTS.UVersion = "MS-QB 4.5"
qbinuxCompile.By = "seb"
qbinuxCompile.Host = "MainFrame"
qbinuxCompile.Time = TDate$("t")
QBinuxBanner = "QBinux version " + RTRIM$(UTS.Release) + " (" + RTRIM$(qbinuxCompile.By) + "@" + RTRIM$(qbinuxCompile.Host) + ") #1 " + qbinuxCompile.Time

OPEN "qilo.cfg" FOR OUTPUT AS #1
 PRINT #1, "label=" + "qbinux-" + UTS.Release
CLOSE #1

'---------------------
'Qilo - part 2 of boot
'---------------------
SHARED qilolabel AS STRING

'IF Qilo = True THEN
  'for future release

  CLS
  PRINT "Loading ";
  CLOSE #1                                   'Just incase file is still open.
  OPEN "qilo.cfg" FOR INPUT AS #1
  DO
    INPUT #1, Dummy
    IF INSTR(Dummy, "label=") > 0 THEN
      qilolabel = RIGHT$(Dummy, (LEN(Dummy) - 6))
      EXIT DO
    END IF
  LOOP UNTIL EOF(1)
  CLOSE #1

'-----------------------------
'Boot (Finally) part 3 of boot
'-----------------------------
Pause 2
PRINT qilolabel;
FOR a = 1 TO 7: Pause 1: PRINT "."; : NEXT: Pause 1: PRINT "."
PRINT "Booting the kernel."
Pause 2
PRINT QBinuxBanner

'-------
'Console
'-------
PRINT "Console: ";
Pause 2
     PRINT Console + " " + LTRIM$(STR$(ScrCols)) + "x" + LTRIM$(STR$(ScrRows))
Pause 2

'------
'Memory
'------
PRINT "Memory: ";
Pause 2
     IF ExtMem THEN
       PRINT LTRIM$(STR$(FreeMem)) + "k/" + LTRIM$(STR$(TotalMem)) + "k"
     ELSE
       PRINT
       Panic "qbinux requires atleast 1MB of RAM."
       SYSTEM
     END IF
Pause 2

'---
'CPU
'---
PRINT "CPU: ";
Pause 2
     GetProcInfo CPUInfo
     PRINT GetVendorName$(CPUInfo.x86Vendor) + " " + RIGHT$(GetCPUName$(CPUInfo), LEN(GetCPUName$(CPUInfo)) - 5);
     IF CPUInfo.x86Model THEN
       PRINT " stepping " + LTRIM$(STR$(CPUInfo.x86Stepping))
     ELSE
       PRINT
     END IF
Pause 2

'---------------
'Floppy drive(s)
'---------------
PRINT "Floppy drive(s): ";
     Floppy
     IF fd = True THEN
       PRINT fd0.DevName + " is " + fd0.size
     ELSE
       PRINT "(none)"
     END IF

'-----------------------
'HD - for future release
'-----------------------

'===============================
'Hand control over to SUB Init()
'===============================
Init

END SUB

FUNCTION TDate$ (cmd$)
IF cmd$ = "t" THEN
  GetMonth = VAL(LEFT$(DATE$, 2))
  GetDay$ = MID$(DATE$, 4, 2)
  GetYear$ = MID$(DATE$, 7, 4)
  TDate$ = Month$(GetMonth) + " " + RIGHT$(GetDay$, 1) + " " + TIME$ + " GMT " + GetYear$
END IF
END FUNCTION

Guest

Post by Guest » Sun May 08, 2005 7:36 am

Kylemc wrote:edit: I've just noticed that you're treating the variable Console as a string a lot. I think you have missed off the $ on every instance of it.
Is a possiblity, but in the last post it should be corrected because it ran on my pc (well 486 laptop with 20mb, 800mb harddrive, no cdrom). But if it doesn't run on yours let me know.

grtz
SebMcClouth

User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle » Sun May 08, 2005 8:47 am

Sorry, didn't see the DIM * AS STRING at the top. I copied + pasted some of it to see if it worked but missed off the declarations.

Guest

Post by Guest » Fri May 20, 2005 11:03 am

Can't login as Seb McClouth...
but anywayz...
I've been working on the program some more. The Core is now
located in qbinux.bi, so it's a library (sort of). This way, you can use the core in your programs without having to rewrite the whole *bleep* erm, code. The only problem I have is that I can't add subs/functions to the .bi. Is there a way to get around this?

grtz
SebMcClouth

anarky
Coder
Posts: 37
Joined: Mon Apr 18, 2005 11:57 am
Location: Australia
Contact:

Post by anarky » Sun May 22, 2005 1:13 pm

*.bas files don't need to have the *.bas extension. They can be practically anything you want, providing it's within DOS naming limits. A *.bi file can be treated as a *.bas providing the code is working.

To update a *.bi file, assuming you have the actual core in a *.qlb library, make the updated library, then copy the sub, type and dim sections from your code into a *.bi file.

Hope this is what you were looking for. By the way, do you have a GUI for your core yet? Or a basic scripting language? I'd love to help.

>anarky

Guest

Post by Guest » Fri May 27, 2005 12:48 pm

SebMcClouth:
So how can I build a .qlb file with the main core in it, so it can be used in my programs (shell/os or whatever you want to call it).

A gui will be added later. For now just the core needs to be completed and everynow and then updated.
In the future it could include a gui. I'm currently building a BASH which is similair to BASH of linux.

grtz
Seb

anarky
Coder
Posts: 37
Joined: Mon Apr 18, 2005 11:57 am
Location: Australia
Contact:

Post by anarky » Sat May 28, 2005 8:51 am

If you are using QB4.5 or PDS/7.1, it has the features vuilt in. QB1.1 isn't capable of such things.

To make a library, get all your subroutine code working fine. In the main module, have all your declare statements, type declarations, etc. You don't want any executable code in the main module, since your program will call everything as it's needed from the qlb.

Once you have the program ready to make into a library, select compile library from the menu (I haven't used QB for ages, so I dont't remember the menu. It's the same menu that RUN is in. After compilation, you will have three files. 1 a QLB, 2 a LIB file, and 3, an OBJ file. You probably wont need the obj file. Safe to delete, unless you plan to use it at a later date, but I've never had to.

Move your QLB and LIB files to your project main folder, rather, copy them. You'll then need to make a *.bi include file. All your declare statements and stuff from the main module of your QLB program will need to be in it. DON'T put in the subroutines. Only the declare statements etc.

I am assuming you know how to call a library when QB starts?

>anarky

Guest

Post by Guest » Thu Jun 02, 2005 7:11 am

It's QB 4.5, and yes, I do know how to load it. But thx for asking!

grtz

anarky
Coder
Posts: 37
Joined: Mon Apr 18, 2005 11:57 am
Location: Australia
Contact:

Post by anarky » Thu Jun 02, 2005 9:25 am

Righty-oh.

A few suggestions I will make regarding your internal scripting language, assuming you will have one that runs it's own programs:
- build the script interpreter versitile enough to be able to handle other GUI languages better than they originally could.
- should for some reason your gui fail, but the kernal executes intact, have the kernal still able to run the gui scripts, but ignore some aspects of them. This will depend on how complex you make it in the first place. By the looks of things, what you have is very basic. But it shows promise.

Another word of advice: give the whole program a better name, and remove all those SLEEP 2 commands. Who wants to wait? I have a better name already and could design the GUI for you, if you can make all the background routines. The GUI I build will be QB code on its own. But be an addon module, or include file which can be modified and henced "skinned" to suit a user's needs.

>anarky

Guest

Post by Guest » Fri Jun 03, 2005 6:18 am

Let's just say qbinux is a temporarily name. The code on here, is some old code. I can't post yet, cause I'm still working on the core.
The sleep 2 command has been removed and replace with a Sub PAUSE() quite similiar to the linux code.
About the gui: I first want to build a stable core, and then a UI (UserInterface). The first version(s) will just be a command-prompt interface. If it shows to work as it should, a GUI could be added later.
About the scriptlanguage: not really sure about this one. I'm currently using scriptlanguage code to read configuration files which should be created after seting up the whole bunch.
I think it's a good idea to keep in touch about this feature. You can e-mail me at balai_goyan@yahoo.com.
I'm open for any suggestions.

Let's hope this program might be the future OS for QB programmers.

grtz
Seb

anarky
Coder
Posts: 37
Joined: Mon Apr 18, 2005 11:57 am
Location: Australia
Contact:

Post by anarky » Sat Jun 04, 2005 8:48 am

What's ironic, is that QB has been replaced with it's successor, FreeBasic. Most people who used Qb now use Fb.

>anarky

Guest

Post by Guest » Sat Jun 04, 2005 12:40 pm

No sweat... We'll just add the command of freebasic into the compiler, which will be build with quickbasic, included with qbinux (in future release). Something for everyone. So if everyone helps with it, we can make the biggest thing ever!!

Free source ofcourse!

Grtz
Seb

Post Reply