You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(24) |
Sep
(5) |
Oct
|
Nov
|
Dec
|
|---|
|
From: <ze...@us...> - 2002-09-03 06:24:23
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv7076
Modified Files:
isxdigit.c m_isxdigit.c isalnum.c m_isalnum.c Makefile
Added Files:
iscntrl.c m_iscntrl.c isprint.c m_isprint.c isgraph.c
m_isgraph.c ispunct.c m_ispunct.c toascii.c m_toascii.c
Log Message:
update to somelibs and adding the rest of libs
--- NEW FILE: iscntrl.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: iscntrl.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* function takes 'c' and checks if its control
charector then retiurn 1 else it return 0
*/
int iscntrl (int c)
{
if ( c <' ' || c >='\del')
return 1;
else
return 0;
}
--- NEW FILE: m_iscntrl.c ---
#include <stdio.h>
int main()
{
int c='\del';
if (iscntrl(c))
printf ("%c is chtrl char\n ",c);
else
printf ("%c is not chtrl char \n",c);
return 0;
}
--- NEW FILE: isprint.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isprint.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* function taht takes 'c' and checks if it's not a control charecter
then its a printable charecter and return 1
*/
int isprint (int c)
{
if (! (c<' ' || c>= '\del'))
return 1;
else
return 0;
}
--- NEW FILE: m_isprint.c ---
#include <stdio.h>
int main ()
{
int c= '\n';
if (isprint (c))
printf ("%c is printable\n",c);
else
printf ("%c is not printable\n",c);
return 0;
}
--- NEW FILE: isgraph.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isgraph.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* function taht takes 'c' and checks if it's a printable charecter
then its a graph charecter and return 1
// note the the graph charecters like print charecter they're both not control charecters
*/
int isgraph (int c)
{
if ( c<=' ' || c>= '\del' )
return 0;
else
return 1;
}
--- NEW FILE: m_isgraph.c ---
#include <stdio.h>
int main ()
{
int c= ' ';
if (isgraph (c))
printf ("%c is graphical\n",c);
else
printf ("%c is not graphical\n",c);
return 0;
}
--- NEW FILE: ispunct.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: ispunct.c
* Date: 02:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* a function takes 'c' if its not printable charecter or an alphanumeric char it return 0
otherwise it return 1 and its a punctiuation */
int ispunct (int c)
{
if (c<= ' ' || c >='a' && c <='z' || c >='A' && c<= 'Z' || c >= '0' && c <= '9'|| c>= '\del')
return 0;
else
return 1;
}
--- NEW FILE: m_ispunct.c ---
#include <stdio.h>
int main ()
{
char c=',';
if (ispunct(c))
printf ("%c is punc\n",c);
else
printf ("%c is not punc\n",c);
return 0;
}
--- NEW FILE: toascii.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: toascii.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* a function that takes 'c' and return its equivalent ascii number by anding 127 or 0X7F*/
int toascii (int c)
{
int a= c & 0x7F ;
return a;
}
--- NEW FILE: m_toascii.c ---
#include <stdio.h>
int main()
{
int n,r;
n = 197; //511 return 127
r= toascii(n);
printf ("%d = %d\n",n,r);
return 0;
}
Index: isxdigit.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isxdigit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** isxdigit.c 2 Sep 2002 22:37:48 -0000 1.2
--- isxdigit.c 3 Sep 2002 06:24:19 -0000 1.3
***************
*** 21,25 ****
int isxdigit (int c)
{
! if (isdigit(c) || c>='A'&& c<='F' || c>='a' && c<='f')
return 1;
else
--- 21,25 ----
int isxdigit (int c)
{
! if ( c >= '0' && c <= '9' || c>='A'&& c<='F' || c>='a' && c<='f')
return 1;
else
***************
*** 28,37 ****
}
-
- int isdigit (int c)
- {
- if (c >= '0' && c <= '9')
- return 1;
- else
- return 0;
- }
\ No newline at end of file
--- 28,29 ----
Index: m_isxdigit.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_isxdigit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_isxdigit.c 2 Sep 2002 07:35:39 -0000 1.1
--- m_isxdigit.c 3 Sep 2002 06:24:19 -0000 1.2
***************
*** 1,14 ****
! /* TiTaN OS
! *
! * Please read license Agreement
! * (c)2002 SubTrick Group
! * Part Of the clib
! *
! * file: isupper.c
! * Date: 31:08:02
! * Type: ANSI
! * LIB: ctype.h
! * Written by: Emad Zakaria
! */
#include <stdio.h>
--- 1,3 ----
!
#include <stdio.h>
Index: isalnum.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isalnum.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** isalnum.c 2 Sep 2002 22:37:48 -0000 1.2
--- isalnum.c 3 Sep 2002 06:24:19 -0000 1.3
***************
*** 12,16 ****
*/
! /*
fucntion the takes 'c' and see if its either
alphabet or a digit and return 1 otherwise
--- 12,16 ----
*/
! /*
fucntion the takes 'c' and see if its either
alphabet or a digit and return 1 otherwise
***************
*** 19,25 ****
*/
! int alnum (int c)
{
! if (isalpha (c) || isdigit(c))
return 1;
else
--- 19,25 ----
*/
! int isalnum (int c)
{
! if ( (c>='a'&& c<='z'|| c>='A'&& c<='Z') || c>='0' && c<='9')
return 1;
else
***************
*** 29,47 ****
-
- int isalpha (int c)
- {
- if ( (c >= 'a' && c <='z') || (c >= 'A' && c <= 'Z') )
- return 1;
- else
- return 0;
- }
-
-
- int isdigit (int c)
- {
- if (c >= '0' && c <= '9')
- return 1;
- else
- return 0;
- }
\ No newline at end of file
--- 29,30 ----
Index: m_isalnum.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_isalnum.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_isalnum.c 2 Sep 2002 07:35:39 -0000 1.1
--- m_isalnum.c 3 Sep 2002 06:24:19 -0000 1.2
***************
*** 1,14 ****
! /* TiTaN OS
! *
! * Please read license Agreement
! * (c)2002 SubTrick Group
! * Part Of the clib
! *
! * file: isupper.c
! * Date: 31:08:02
! * Type: ANSI
! * LIB: ctype.h
! * Written by: Emad Zakaria
! */
#include <stdio.h>
--- 1,3 ----
!
#include <stdio.h>
***************
*** 17,25 ****
{
! char c=' ';
if (isalnum(c))
! printf ("%c is alpha num",c);
else
! printf ("%c is not alpha num",c);
return 0;
}
--- 6,14 ----
{
! char c='v';
if (isalnum(c))
! printf ("%c is alpha num\n",c);
else
! printf ("%c is not alpha num\n",c);
return 0;
}
Index: Makefile
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 2 Sep 2002 22:41:54 -0000 1.4
--- Makefile 3 Sep 2002 06:24:19 -0000 1.5
***************
*** 60,63 ****
--- 60,78 ----
$(CC) -c isalnum.c
$(CC) m_isalnum.c isalnum.o -o isalnum.out
+ iscntrl:
+ $(CC) -c iscntrl.c
+ $(CC) m_iscntrl.c iscntrl.o -o iscntrl.out
+ isprint:
+ $(CC) -c isprint.c
+ $(CC) m_isprint.c isprint.o -o isprint.out
+ isgraph:
+ $(CC) -c isgraph.c
+ $(CC) m_isgraph.c isgraph.o -o isgraph.out
+ ispunct:
+ $(CC) -c ispunct.c
+ $(CC) m_ispunct.c ispunct.o -o ispunct.out
+ toascii:
+ $(CC) -c toascii.c
+ $(CC) m_toascii.c toascii.o -o toascii.out
clean:
rm *.o
|
|
From: <ze...@us...> - 2002-09-02 22:41:57
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi In directory usw-pr-cvs1:/tmp/cvs-serv4055 Modified Files: Makefile Log Message: update to make file Index: Makefile =================================================================== RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 2 Sep 2002 07:35:39 -0000 1.3 --- Makefile 2 Sep 2002 22:41:54 -0000 1.4 *************** *** 55,63 **** $(CC) m_isascii.c isascii.o -o isascii.out isxdigit: ! $(CC) -c isdigit.c isxdigit.c ! $(CC) m_isxdigit.c isdigit.o isxdigit.o -o isxdigit.out isalnum: ! $(CC) -c isalpha.c isdigit.c isalnum.c ! $(CC) m_isalnum.c isdigit.o isalpha.c isalnum.o -o isalnum.out clean: rm *.o --- 55,63 ---- $(CC) m_isascii.c isascii.o -o isascii.out isxdigit: ! $(CC) -c isxdigit.c ! $(CC) m_isxdigit.c isxdigit.o -o isxdigit.out isalnum: ! $(CC) -c isalnum.c ! $(CC) m_isalnum.c isalnum.o -o isalnum.out clean: rm *.o |
|
From: <ze...@us...> - 2002-09-02 22:37:52
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv3136
Modified Files:
isxdigit.c isascii.c isalnum.c isalpha.c isdigit.c islower.c
isupper.c
Log Message:
some modification to libs
Index: isxdigit.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isxdigit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** isxdigit.c 2 Sep 2002 07:35:39 -0000 1.1
--- isxdigit.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 5,10 ****
* Part Of the clib
*
! * file: isupper.c
! * Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
--- 5,10 ----
* Part Of the clib
*
! * file: isxdigit.c
! * Date: 1:09:02
* Type: ANSI
* LIB: ctype.h
***************
*** 26,30 ****
return 0;
- return 0;
-
}
--- 26,37 ----
return 0;
}
+
+
+ int isdigit (int c)
+ {
+ if (c >= '0' && c <= '9')
+ return 1;
+ else
+ return 0;
+ }
\ No newline at end of file
Index: isascii.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isascii.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** isascii.c 2 Sep 2002 07:35:38 -0000 1.1
--- isascii.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 5,9 ****
* Part Of the clib
*
! * file: isupper.c
* Date: 31:08:02
* Type: ANSI
--- 5,9 ----
* Part Of the clib
*
! * file: isascii.c
* Date: 31:08:02
* Type: ANSI
***************
*** 19,29 ****
int isascii (int c)
{
! while (c >0)
! {
! if ( c <=127)
! return 1;
! else
! return 0;
! }
! return 0;
}
--- 19,25 ----
int isascii (int c)
{
! if ( c > 0 && c <=127)
! return 1;
! else
! return 0;
}
Index: isalnum.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isalnum.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** isalnum.c 2 Sep 2002 07:35:39 -0000 1.1
--- isalnum.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 5,9 ****
* Part Of the clib
*
! * file: isupper.c
* Date: 31:08:02
* Type: ANSI
--- 5,9 ----
* Part Of the clib
*
! * file: isalnum.c
* Date: 31:08:02
* Type: ANSI
***************
*** 12,15 ****
--- 12,21 ----
*/
+ /*
+ fucntion the takes 'c' and see if its either
+ alphabet or a digit and return 1 otherwise
+ it return 0
+
+ */
int alnum (int c)
***************
*** 20,22 ****
--- 26,47 ----
return 0;
return 0;
+ }
+
+
+
+ int isalpha (int c)
+ {
+ if ( (c >= 'a' && c <='z') || (c >= 'A' && c <= 'Z') )
+ return 1;
+ else
+ return 0;
+ }
+
+
+ int isdigit (int c)
+ {
+ if (c >= '0' && c <= '9')
+ return 1;
+ else
+ return 0;
}
Index: isalpha.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isalpha.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** isalpha.c 30 Aug 2002 19:42:25 -0000 1.1
--- isalpha.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 13,16 ****
--- 13,19 ----
*/
+ /* a function the take 'c' and check if its an alphabet it return 1
+ otherwise it return 0 */
+
int isalpha (int c)
{
Index: isdigit.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isdigit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** isdigit.c 30 Aug 2002 19:42:25 -0000 1.1
--- isdigit.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 13,17 ****
*/
!
int isdigit (int c)
{
--- 13,19 ----
*/
! /* function that takes 'c' an checks if its a digit it return 1
! otherwise it return 0 */
!
int isdigit (int c)
{
Index: islower.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/islower.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** islower.c 30 Aug 2002 19:42:25 -0000 1.1
--- islower.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 12,15 ****
--- 12,19 ----
*/
+
+ /* function that takes 'c' if its upper case return it else
+ it convert it to lower case */
+
int islower (int c)
{
Index: isupper.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isupper.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** isupper.c 30 Aug 2002 19:42:25 -0000 1.1
--- isupper.c 2 Sep 2002 22:37:48 -0000 1.2
***************
*** 13,16 ****
--- 13,20 ----
+ /* function that takes 'c' if its upper case return it else
+ it return 0 */
+
+
int isupper(int c)
{
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv12841
Modified Files:
Makefile
Added Files:
isascii.c m_isascii.c isxdigit.c m_isxdigit.c isalnum.c
m_isalnum.c
Log Message:
some changes in older ctype libs an some new libs
--- NEW FILE: isascii.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/*
it takes the 'c' checks whether its an ascii caracter then returns 1
otherwise it return 0
*/
int isascii (int c)
{
while (c >0)
{
if ( c <=127)
return 1;
else
return 0;
}
return 0;
}
--- NEW FILE: m_isascii.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
#include <stdio.h>
int main ()
{
char f='d';
if (isascii(f))
printf ("%c is an ascii\n",f);
else
printf ("%c is not ascii\n",f);
return 0;
}
--- NEW FILE: isxdigit.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/*
function thet take 'c' and cheks if its a digit or a char
between a and f then its an hexdcimal digit
*/
int isxdigit (int c)
{
if (isdigit(c) || c>='A'&& c<='F' || c>='a' && c<='f')
return 1;
else
return 0;
return 0;
}
--- NEW FILE: m_isxdigit.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
#include <stdio.h>
int main ()
{
char c='j';
if (isxdigit(c))
printf ("%c is an hex\n",c);
else
printf ("%c is not hex\n",c);
return 0;
}
--- NEW FILE: isalnum.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
int alnum (int c)
{
if (isalpha (c) || isdigit(c))
return 1;
else
return 0;
return 0;
}
--- NEW FILE: m_isalnum.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
#include <stdio.h>
int main(void)
{
char c=' ';
if (isalnum(c))
printf ("%c is alpha num",c);
else
printf ("%c is not alpha num",c);
return 0;
}
Index: Makefile
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile 30 Aug 2002 19:40:25 -0000 1.2
--- Makefile 2 Sep 2002 07:35:39 -0000 1.3
***************
*** 4,8 ****
all: memcpy memchr memcmp memset strcat strchr strlen strcpy \
! isalpha isdigit isspace islower isupper
memchr:
--- 4,8 ----
all: memcpy memchr memcmp memset strcat strchr strlen strcpy \
! isalpha isdigit isspace islower isupper toupper tolower isascii isxdigit isalnum
memchr:
***************
*** 45,49 ****
$(CC) -c isupper.c
$(CC) m_isupper.c isupper.o -o isupper.out
!
clean:
rm *.o
--- 45,63 ----
$(CC) -c isupper.c
$(CC) m_isupper.c isupper.o -o isupper.out
! toupper:
! $(CC) -c toupper.c
! $(CC) m_toupper.c toupper.o -o toupper.out
! tolower:
! $(CC) -c tolower.c
! $(CC) m_tolower.c tolower.o -o tolower.out
! isascii:
! $(CC) -c isascii.c
! $(CC) m_isascii.c isascii.o -o isascii.out
! isxdigit:
! $(CC) -c isdigit.c isxdigit.c
! $(CC) m_isxdigit.c isdigit.o isxdigit.o -o isxdigit.out
! isalnum:
! $(CC) -c isalpha.c isdigit.c isalnum.c
! $(CC) m_isalnum.c isdigit.o isalpha.c isalnum.o -o isalnum.out
clean:
rm *.o
|
|
From: <ze...@us...> - 2002-09-01 23:46:18
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv3105
Added Files:
m_tolower.c m_toupper.c tolower.c toupper.c
Log Message:
the new ctype libs
--- NEW FILE: m_tolower.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: tolower.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
#include <stdio.h>
#include <string.h>
int main()
{
char string[] = "WHAT EVER MAN";
char *ptr;
ptr = string;
for (;*ptr;){ *ptr++ = tolower(*ptr);}
printf ("%s\n",string);
return 0;
}
int tolower (int x)
{
//printf ("%c \n",x);
if (x >='A' && x <= 'Z')
x = x + 32;
// printf ("%c \n",x);
return x;
}
--- NEW FILE: m_toupper.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: toupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
#include <stdio.h>
#include <string.h>
int main()
{
char string[] = "what ever man";
char *ptr;
ptr = string;
for (;*ptr;){ *ptr++ = toupper(*ptr);}
printf ("%s\n",string);
return 0;
}
int toupper (int x)
{
//printf ("%c \n",x);
if (x >='a' && x <= 'z')
x = x - 32;
// printf ("%c \n",x);
return x;
}
--- NEW FILE: tolower.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: tolower.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/*
it takes an integer value 'x' if it in lower case
its returned or if its in uper case it change it
to lower case and return it
*/
int tolower (int x)
{
//printf ("%c \n",x);
if (x >='A' && x <= 'Z')
x = x + 32;
// printf ("%c \n",x);
return x;
}
--- NEW FILE: toupper.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: toupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/*
it takes an integer value 'x' if it in upper case
its returned or if its in lower case it change it
to upper case and return it
*/
int toupper (int x)
{
if (x >='a' && x <= 'z')
x = x - 32;
return x;
}
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv32047
Added Files:
isalpha.c isdigit.c islower.c isspace.c isupper.c m_isalpha.c
m_isdigit.c m_islower.c m_isspace.c m_isupper.c
Log Message:
Added Some ctype functions
--- NEW FILE: isalpha.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isalpha.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
int isalpha (int c)
{
if ( (c >= 'a' && c <='z') || (c >= 'A' && c <= 'Z') )
return 1;
else
return 0;
}
--- NEW FILE: isdigit.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isdigit.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
int isdigit (int c)
{
if (c >= '0' && c <= '9')
return 1;
else
return 0;
}
--- NEW FILE: islower.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: islower.c
* Date: 27:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
int islower (int c)
{
if (c >= 'a' && c <= 'z')
return 1;
else
return 0;
}
--- NEW FILE: isspace.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isspace.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
int isspace (int c)
{
if ( c == ' ' || c == '\t' || c =='\n'|| c == '\r' )
return 1;
else
return 0;
}
--- NEW FILE: isupper.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isupper.c
* Date: 31:08:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
int isupper(int c)
{
if (c >= 'A' && c <= 'Z')
return 1;
else
return 0;
}
--- NEW FILE: m_isalpha.c ---
#include <stdio.h>
int main (void)
{
char c ='Z'+1;
if (isalpha(c))
printf ("the char '%c' isalpha\n ", c);
else
printf ("'%c' aint alpha\n",c);
return 0;
}
--- NEW FILE: m_isdigit.c ---
#include <stdio.h>
int main (void)
{
char c ='0'-1;
if (isdigit(c))
printf ("the char '%c' isdigit\n ", c);
else
printf ("'%c' aint digit\n",c);
return 0;
}
--- NEW FILE: m_islower.c ---
#include <stdio.h>
int main (void)
{
char c ='g';
if (islower(c))
printf ("the char '%c' is lower\n ", c);
else
printf ("'%c' aint lower\n",c);
return 0;
}
--- NEW FILE: m_isspace.c ---
#include <stdio.h>
int main (void)
{
char c='\r';
if (isspace(c))
printf ("'%c' is space \n",c);
else
printf (" the '%c' ins ot space \n",c);
return 0;
}
--- NEW FILE: m_isupper.c ---
#include <stdio.h>
int main(void)
{
char c ='V';
if (isupper (c))
printf ("%c is upper \n",c);
else
printf (" %c not\n",c);
return 0;
}
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv31389
Modified Files:
Makefile m_memchr.c m_memcpy.c memchr.c memcmp.c memcpy.c
memset.c strcat.c strchr.c strlen.c
Log Message:
Improved some clibs. I hope :)
Index: Makefile
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile 28 Aug 2002 15:32:36 -0000 1.1
--- Makefile 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 3,7 ****
! all: memcpy memchr memcmp memset strcat strchr strlen strcpy
memchr:
--- 3,8 ----
! all: memcpy memchr memcmp memset strcat strchr strlen strcpy \
! isalpha isdigit isspace islower isupper
memchr:
***************
*** 29,35 ****
$(CC) -c strcpy.c
$(CC) m_strcpy.c strcpy.o -o strcpy.out
clean:
rm *.o
! rm *.out
--- 30,52 ----
$(CC) -c strcpy.c
$(CC) m_strcpy.c strcpy.o -o strcpy.out
+ isalpha:
+ $(CC) -c isalpha.c
+ $(CC) m_isalpha.c isalpha.o -o isalpha.out
+ isdigit:
+ $(CC) -c isdigit.c
+ $(CC) m_isdigit.c isdigit.o -o isdigit.out
+ isspace:
+ $(CC) -c isspace.c
+ $(CC) m_isspace.c isspace.o -o isspace.out
+ islower:
+ $(CC) -c islower.c
+ $(CC) m_islower.c islower.o -o islower.out
+ isupper:
+ $(CC) -c isupper.c
+ $(CC) m_isupper.c isupper.o -o isupper.out
+
clean:
rm *.o
! rm *.out
Index: m_memchr.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_memchr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_memchr.c 28 Aug 2002 15:32:36 -0000 1.1
--- m_memchr.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 5,13 ****
{
char x[] = "123456A7890";
! char s = 'A';
char *ret;
! ret = (char *) memchr(x, s, 7);
if( ret == NULL)
printf(" out of range\n");
--- 5,13 ----
{
char x[] = "123456A7890";
! char s = '7';
char *ret;
! ret = (char *) memchr(x, s, 9);
if( ret == NULL)
printf(" out of range\n");
Index: m_memcpy.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_memcpy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_memcpy.c 28 Aug 2002 15:32:36 -0000 1.1
--- m_memcpy.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 10,14 ****
ret = (char *) memcpy( x, y, 9);
! printf("x=%s,y=%s,ret=%d\n",x,y,ret);
}
--- 10,14 ----
ret = (char *) memcpy( x, y, 9);
! printf("dest=%s,source=%s,\n",x,y);
}
Index: memchr.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memchr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memchr.c 28 Aug 2002 15:32:36 -0000 1.1
--- memchr.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 27,31 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
if(*mem2search++ == (unsigned char) c)
return (void*) --mem2search;
--- 27,31 ----
if(n > 0) //Check the Restriction
! for(; n ; n--){
if(*mem2search++ == (unsigned char) c)
return (void*) --mem2search;
Index: memcmp.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memcmp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memcmp.c 28 Aug 2002 15:32:36 -0000 1.1
--- memcmp.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 32,36 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
if( *s1++ != *s2++)
return (*--s1 - *--s2);
--- 32,36 ----
if(n > 0) //Check the Restriction
! for(; n ; n--){
if( *s1++ != *s2++)
return (*--s1 - *--s2);
Index: memcpy.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memcpy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memcpy.c 28 Aug 2002 15:32:36 -0000 1.1
--- memcpy.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 29,35 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
*to++ = *from++;
- }
return dest; //Allways Returns dest
--- 29,34 ----
if(n > 0) //Check the Restriction
! for(; n ; n--)
*to++ = *from++;
return dest; //Allways Returns dest
Index: memset.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memset.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memset.c 28 Aug 2002 15:32:36 -0000 1.1
--- memset.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 29,35 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
*s++ = (unsigned char) c;
! }
return ptr;
}
--- 29,35 ----
if(n > 0) //Check the Restriction
! for(; n ; n--)
*s++ = (unsigned char) c;
!
return ptr;
}
Index: strcat.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/strcat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strcat.c 28 Aug 2002 15:32:36 -0000 1.1
--- strcat.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 28,34 ****
char *p = dest;
! while (*p++ != (char)NULL);
p--;
while ( *p++ = *src++);
return dest ;
}
--- 28,35 ----
char *p = dest;
! while (*p++);
p--;
while ( *p++ = *src++);
+
return dest ;
}
Index: strchr.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/strchr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strchr.c 28 Aug 2002 15:32:36 -0000 1.1
--- strchr.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 29,33 ****
while (c != *ptr)
{
! if (*ptr++ == (char)NULL)
return NULL;
}
--- 29,33 ----
while (c != *ptr)
{
! if (*ptr++)
return NULL;
}
Index: strlen.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/strlen.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strlen.c 28 Aug 2002 15:32:36 -0000 1.1
--- strlen.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 27,31 ****
size_t return_val = 0;
! for (; *ptr++ != (char) NULL ; return_val++);
return return_val;
}
--- 27,31 ----
size_t return_val = 0;
! for (; *ptr++ ; return_val++);
return return_val;
}
|
|
From: <ji...@us...> - 2002-08-28 20:03:28
|
Update of /cvsroot/subtrick/TiTan/src/boot/kernelinit In directory usw-pr-cvs1:/tmp/cvs-serv2515 Modified Files: kernelinit.asm Log Message: Video mode init now in sloader.asm Index: kernelinit.asm =================================================================== RCS file: /cvsroot/subtrick/TiTan/src/boot/kernelinit/kernelinit.asm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** kernelinit.asm 25 Aug 2002 11:47:49 -0000 1.1 --- kernelinit.asm 28 Aug 2002 20:03:25 -0000 1.2 *************** *** 29,33 **** N equ 0xD L equ 0xA ! welcome db " >> Welcome To TiTan OS<< ",N,L,'$' prog db " Starting Kernel Initialization ... ",N,L,'$' kmsg db " Checking Processor Type : ",'$' --- 29,33 ---- N equ 0xD L equ 0xA ! welcome db " >> Welcome To TiTan OS << ",N,L,'$' prog db " Starting Kernel Initialization ... ",N,L,'$' kmsg db " Checking Processor Type : ",'$' *************** *** 58,64 **** setgraph : - mov ah,00h - mov al,10h - int 0x10 mov si,welcome --- 58,61 ---- |
|
From: <ji...@us...> - 2002-08-28 20:02:21
|
Update of /cvsroot/subtrick/TiTan/src/boot
In directory usw-pr-cvs1:/tmp/cvs-serv2127
Modified Files:
sloader.asm
Log Message:
Fixed the 1 sec bug
Index: sloader.asm
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/boot/sloader.asm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sloader.asm 25 Aug 2002 15:44:57 -0000 1.3
--- sloader.asm 28 Aug 2002 20:02:18 -0000 1.4
***************
*** 17,30 ****
; Data used in boot up
;_______________________________________________________________________
! m_crlf db 10, 13, '$' ; Carrige Return Line Feed
! twodots db ":",'$'
msg db " Starting Second stage loader ",'$'
! loading db " Loading Kernel init. # of sector(s) = ", '$'
! loaded db " Kernel init loaded @ ",'$'
goto db " Jumping To Kernel Init.", '$'
fdrive db " Booting from Floppy Drive.",'$'
! hdrive db " Booting from Hard Drive.",'$'
m_reboot db " System is Going Down.",10,13, " Hit any Key...",'$'
! derror db " Disk Error # ",'$'
drive db 0 ; What drive did we boot from
--- 17,30 ----
; Data used in boot up
;_______________________________________________________________________
! m_crlf db 10, 13, '$' ; Carrige Return Line Feed
! twodots db ":",'$'
msg db " Starting Second stage loader ",'$'
! loading db " Loading Kernel init. # of sector(s) = ", '$'
! loaded db " Kernel init loaded @ ",'$'
goto db " Jumping To Kernel Init.", '$'
fdrive db " Booting from Floppy Drive.",'$'
! hdrive db " Booting from Hard Drive.",'$'
m_reboot db " System is Going Down.",10,13, " Hit any Key...",'$'
! derror db " Disk Error # ",'$'
drive db 0 ; What drive did we boot from
***************
*** 36,44 ****
mov ss, ax ; Setup stack segment
sti ; Restor Int
! mov sp, S_STACK_PTR ; Setup stack pointer
mov [drive], dl ; Save the drive we booted from
! mov si, msg ; Prints msg
call Print
call Crlf
--- 36,49 ----
mov ss, ax ; Setup stack segment
sti ; Restor Int
! mov sp, S_STACK_PTR ; Setup stack pointer
mov [drive], dl ; Save the drive we booted from
+
+ ; Set video mode
+ mov ah,00h
+ mov al,10h
+ int 0x10
! mov si, msg ; Prints msg
call Print
call Crlf
***************
*** 50,58 ****
cmp dl, 0
jne Hard_Drive
! mov si, fdrive ; Prints fdrive
jmp Printdisk
Hard_Drive:
! mov si, hdrive ; Prints hdrive
Printdisk:
--- 55,63 ----
cmp dl, 0
jne Hard_Drive
! mov si, fdrive ; Prints fdrive
jmp Printdisk
Hard_Drive:
! mov si, hdrive ; Prints hdrive
Printdisk:
***************
*** 68,76 ****
Disk_Err:
! mov si, derror ; Prints error
call Print
! mov al, ah ; Swap reg
xor ah, ah
! call Print_Num ; Print whatis in ax which is the err number
jmp Reboot
--- 73,81 ----
Disk_Err:
! mov si, derror ; Prints error
call Print
! mov al, ah ; Swap reg
xor ah, ah
! call Print_Num ; Print whatis in ax which is the err number
jmp Reboot
***************
*** 86,95 ****
mov bx, OFF_KINIT
! mov ah, 02h ; Read
! mov al, 1;SEC ; Number of sectors Sec to read
! mov dl, [drive] ; Drive to read from
mov ch, PAR_CYL
! mov cl, PAR_SEC
mov dh, PAR_HEAD
int 13h
--- 91,100 ----
mov bx, OFF_KINIT
! mov ah, 02h ; Read
! mov al, SEC ; Number of sectors Sec to read
! mov dl, [drive] ; Drive to read from
mov ch, PAR_CYL
! mov cl, PAR_SEC
mov dh, PAR_HEAD
int 13h
***************
*** 97,101 ****
jc Disk_Err
! mov si, loaded ; Prints info
call Print
mov ax, SEG_KINIT
--- 102,106 ----
jc Disk_Err
! mov si, loaded ; Prints info
call Print
mov ax, SEG_KINIT
***************
*** 111,115 ****
call Crlf
! jmp SEG_KINIT:OFF_KINIT ; Jump to loaded code
Reboot:
--- 116,120 ----
call Crlf
! jmp SEG_KINIT:OFF_KINIT ; Jump to loaded code
Reboot:
***************
*** 136,143 ****
mov ah, 0Eh
xor bh, bh
! mov bl, 14h
Print_rep:
! lodsb ; al = DS:[SI]
! cmp al,'$' ; if $ exit
je Print_ret
int 10h
--- 141,148 ----
mov ah, 0Eh
xor bh, bh
! mov bl, 7
Print_rep:
! lodsb ; al = DS:[SI]
! cmp al,'$' ; if $ exit
je Print_ret
int 10h
***************
*** 170,177 ****
Under_9:
push dx
! cmp ax, 0 ;revalate this statment
jnz Loop_Div
xor bx, bx
Print_Char:
pop ax
--- 175,183 ----
Under_9:
push dx
! cmp ax, 0 ;revalate this statment
jnz Loop_Div
xor bx, bx
+ mov bl, 02
Print_Char:
pop ax
***************
*** 188,192 ****
; Boot loader Requerments
;_______________________________________________________________________
! times 510-($-$$) db 0 ; padding
! dw 0xAA55 ; Sig for boot loader
--- 194,198 ----
; Boot loader Requerments
;_______________________________________________________________________
! times 510-($-$$) db 0 ; padding
! dw 0xAA55 ; Sig for boot loader
|
|
From: <ji...@us...> - 2002-08-28 16:48:01
|
Update of /cvsroot/subtrick/TiTan/ref In directory usw-pr-cvs1:/tmp/cvs-serv3563 Removed Files: mem-lay.txt Log Message: Moved to /doc/desgin --- mem-lay.txt DELETED --- |
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv30486
Added Files:
Makefile m_memchr.c m_memcmp.c m_memcpy.c m_memset.c
m_strcat.c m_strchr.c m_strcpy.c m_strlen.c memchr.c memcmp.c
memcpy.c memmove.c memset.c stddef.h strcat.c strchr.c
strcpy.c strlen.c
Log Message:
Added some clibs
--- NEW FILE: Makefile ---
CC = gcc
all: memcpy memchr memcmp memset strcat strchr strlen strcpy
memchr:
$(CC) -c memchr.c
$(CC) m_memchr.c memchr.o -o memchr.out
memcpy:
$(CC) -c memcpy.c
$(CC) m_memcpy.c memcpy.o -o memcpy.out
memcmp:
$(CC) -c memcmp.c
$(CC) m_memcmp.c memcmp.o -o memcmp.out
memset:
$(CC) -c memset.c
$(CC) m_memset.c memset.o -o memset.out
strcat:
$(CC) -c strcat.c
$(CC) m_strcat.c strcat.o -o strcat.out
strchr:
$(CC) -c strchr.c
$(CC) m_strchr.c strchr.o -o strchr.out
strlen:
$(CC) -c strlen.c
$(CC) m_strlen.c strlen.o -o strlen.out
strcpy:
$(CC) -c strcpy.c
$(CC) m_strcpy.c strcpy.o -o strcpy.out
clean:
rm *.o
rm *.out
--- NEW FILE: m_memchr.c ---
#include <stdio.h>
//#include <string.h>
int main()
{
char x[] = "123456A7890";
char s = 'A';
char *ret;
ret = (char *) memchr(x, s, 7);
if( ret == NULL)
printf(" out of range\n");
else
printf("ret=%c\n",*ret);
}
--- NEW FILE: m_memcmp.c ---
#include <stdio.h>
//#include <string.h>
int main()
{
const char x[] = "ABCDFFGHIK"; //1
const char y[] = "ABCDEFGHIK"; //-1
int ret;
ret = memcmp( x, y, 10);
printf("ret=%d\n",ret);
}
--- NEW FILE: m_memcpy.c ---
#include <stdio.h>
//#include <string.h>
int main()
{
char x[] = "1234567890";
const char y[] = "abcdefghij";
char *ret;
ret = (char *) memcpy( x, y, 9);
printf("x=%s,y=%s,ret=%d\n",x,y,ret);
}
--- NEW FILE: m_memset.c ---
#include <stdio.h>
//#include <string.h>
int main()
{
char x[] = "1234567890";
char y= 'A';
char *ret;
ret = (char *) memset(x, y, 2);
printf("x=%s,ret=%d\n",x,ret);
}
--- NEW FILE: m_strcat.c ---
#include <stdio.h>
int main (void)
{
char fg[25]="me";
char *a ="abc ",*c=" c++ ", *b="12344";
strcat (fg ,b);
printf ("cat 1 %s \n",fg); //debuging
strcat (fg ,c);
printf ("%s \n",fg);
strcat (fg ,a);
printf ("%s \n",fg);
return 0;
}
--- NEW FILE: m_strchr.c ---
#include <stdio.h>
int main (void)
{
char *string = "this is a string ";
char *ptr;
char c ='x';
ptr = strchr (string,c);
if(ptr)
printf ("the char %c is at %d \n",c, ptr - string);
else
printf ("not found\n ");
return 0;
}
--- NEW FILE: m_strcpy.c ---
#include <stdio.h>
int main (void)
{
char *s="H12345";
char d[10];
strcpy(d, s);
printf ("%s\n",d);
return 0;
}
--- NEW FILE: m_strlen.c ---
#include <stdio.h>
int main (void)
{
char *s="1234567890";
printf ("%d\n",strlen(s));
return 0;
}
--- NEW FILE: memchr.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: memchr.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Adham Helal
*/
/*
Scans the first n bytes of the mem pointed to by "ptr_mem" for the character c.
If succsful a pointer to the char is returned else NULL is returned.
*/
#include "stddef.h" // This should be string.h but later
// i think i should use register instead
void *memchr(const void *ptr_mem, int c, size_t n)
{
const unsigned char *mem2search = ptr_mem;
if(n > 0) //Check the Restriction
for(; n != 0; n--){
if(*mem2search++ == (unsigned char) c)
return (void*) --mem2search;
}
return NULL;
}
--- NEW FILE: memcmp.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: memcmp.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Adham Helal
*/
/*
Compare a block of mem of size n pointed by ptr1 with ptr2.
The function returns an integer less than,equal to or greater
than zero depanding on the block "ptr1" to be less than to
match or be greater than "ptr2".
See P. 671
*/
#include "stddef.h" // This should be string.h but later
// i think i should use register instead
int memcmp(const void *ptr1, const void *ptr2, size_t n)
{
const unsigned char *s1 = ptr1;
const unsigned char *s2 = ptr2;
if(n > 0) //Check the Restriction
for(; n != 0; n--){
if( *s1++ != *s2++)
return (*--s1 - *--s2);
}
return 0;
}
--- NEW FILE: memcpy.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: memcpy.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Adham Helal
*/
/*
Copy's a block of mem of size n from pointer "source" to pointer "dest"
Don't use with overlap mem it will give un wanted results
returns the @dest
*/
#include "stddef.h" // This should be string.h but later
// i think i should use register instead
void *memcpy(void *dest, const void *src, size_t n)
{
char *to = (char*) dest;
const char *from = (const char*) src;
if(n > 0) //Check the Restriction
for(; n != 0; n--){
*to++ = *from++;
}
return dest; //Allways Returns dest
}
--- NEW FILE: memmove.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: memmove.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Adham Helal
*/
/*
Copy's a block of mem of size n from pointer "source" to pointer "dest"
Supports overlap mem area.
returns the @dest
*/
#include "stddef.h" // This should be string.h but later
// i think i should use register instead
void *memmove(void *dest, const void *src, size_t n)
{
char *to = (char*) dest;
const char *from = (const char*) src;
if(n > 0){ //Check the Restriction
/* NEED TO IMPLMENT IT */
}
return dest; //Allways Returns dest
}
--- NEW FILE: memset.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: memset.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Adham Helal
*/
/*
Sets a block of mem of size n pointed by "ptr" to unsigned char c
and returns ptr
See P. 671
*/
#include "stddef.h" // This should be string.h but later
// i think i should use register instead
void *memset(void *ptr, int c, size_t n)
{
unsigned char *s = (unsigned char*)ptr;
if(n > 0) //Check the Restriction
for(; n != 0; n--){
*s++ = (unsigned char) c;
}
return ptr;
}
--- NEW FILE: stddef.h ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: stddef.h
* Date: 27:08:02
* Type: ANSI
* Written by: Adham Helal
*/
#define NULL ((void *) 0)
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif
--- NEW FILE: strcat.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: strcat.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Emad Zakaria
*/
/*
Concatenates the string "dest","src".That is to
copy "src" to "dest" but beware the size of "dest"
must be greater than or egual to "src".
*/
#include "stddef.h" //use string.h later
char *strcat (char *dest ,const char *src)
{
char *p = dest;
while (*p++ != (char)NULL);
p--;
while ( *p++ = *src++);
return dest ;
}
--- NEW FILE: strchr.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: strcat.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Emad Zakaria
*/
/*
Searches "string" for the first match of the char "c"
,if its found it returns a pointer to its location else
NULL is returned.
*/
#include "stddef.h" //use string.h later
char *strchr (const char *string , int c)
{
char *ptr = (char*)string;
c = (char) c;
while (c != *ptr)
{
if (*ptr++ == (char)NULL)
return NULL;
}
return ptr ;
//There is a problem in return we get a warrning
}
--- NEW FILE: strcpy.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: strcpy.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Emad Zakaria
*/
/*
Returns the length of "string". The length is the
number of characters in the "string" not counting
the NULL character.
*/
#include "stddef.h" //use string.h later
char *strcpy (char *dest ,const char *src)
{
char *ptr = dest;
while (*ptr++ = *src++);
return dest ;
}
--- NEW FILE: strlen.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: strlen.c
* Date: 27:08:02
* Type: ANSI
* LIB: string.h
* Ref: A book on C, Minix
* Written by: Emad Zakaria
*/
/*
Returns the length of "string". The length is the
number of characters in the "string" not counting
the NULL character.
*/
#include "stddef.h" //use string.h later
size_t strlen (const char *string)
{
char *ptr = (char *) string;
size_t return_val = 0;
for (; *ptr++ != (char) NULL ; return_val++);
return return_val;
}
|
|
From: <ji...@us...> - 2002-08-28 15:28:42
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi In directory usw-pr-cvs1:/tmp/cvs-serv28531/ansi Log Message: Directory /cvsroot/subtrick/TiTan/src/lib/ansi added to the repository |
|
From: <ji...@us...> - 2002-08-28 15:28:15
|
Update of /cvsroot/subtrick/TiTan/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv28275/lib Log Message: Directory /cvsroot/subtrick/TiTan/src/lib added to the repository |
|
From: <sl...@us...> - 2002-08-26 15:44:18
|
Update of /cvsroot/subtrick/TiTan/doc/design
In directory usw-pr-cvs1:/tmp/cvs-serv814
Added Files:
mem-lay.txt
Log Message:
Memory Layout/Kernel Loading
--- NEW FILE: mem-lay.txt ---
Subject : Memory layout / Kernel loading
Part Of The TiTan OS Development Project
Author : Ayman El Sayed
Operating System Sector : Boot
Programming Language : Assembly
Revision : 2
When the computer boots up This is how the memory looks like (in realmode)
you only have access to 1MB of memory
0x00000 - 0x003ff |Interrupt Vector Table|
| 1024 byte |
----------------------
0x00400 - 0x004ff | Bios Data Area |
| 256 byte |
0x00500 - 0x9ffff ----------------------
| FREE Our |
| |
| FREE Part |
| |
| FREE |
| 638 kb |
|(exactly 654079 bytes)|
0xA0000 - 0xAFFFF ----------------------
| Vga Graphic Buffer |
| 64 kb |
0xB0000 - 0xB7FFF ----------------------
| MDA text Buffer |
| 32 kb |
----------------------
0xB8000 - 0xBFFFF | Vga text Buffer |
| 32 kb |
----------------------
0xC0000 - 0xC7FFF | Vga Bios |
| 32 kb |
----------------------
0xC8000 - 0xDFFFF | Free (Reserved) |
| 96 kb |
----------------------
0xE0000 - 0xFFFFF | System/PCI BIOS |
| 127kb |
----------------------
The first thing that I would like to point out is that in protected mode
you don't have access to interrupts that's because you clear the
interrupt vector table (0x00000 -0x003ff) when entering protected mode
and even if you saved the interrupt vector table ,it will be useless
simply because you got to be in 16 bit mode to use the 16 bit IVT
(the 16 bit IVT is 16bit:16bit while in protected mode
we will be using 32 bit)
As you can see the free part (Before entering protected Mode) is
from 0x00500 to 0x9FFFF . so this is the part that we should load
the kernel.img , kernel data , kernel stack in . now you might ask
why not use memory 0x100000 to 0xFFFFFF(above 1 mb)as we're in protected
mode and we're not limited to 0xFFFFF ?.well that's true but the problem
is how would you use interrupt 0x13 to load the kernel image after
entering protected mode? you can't ofcourse ,cause interrupts are
disabled.so now what you can do is load the kernel.img in realmode
in somewhere from 0x00500 to 0x9FFFF and (after entering protected mode)
move the kernel in an address 0x100000 or above so you can have all
the free memory you want (You still can keep it in the 638 kb but why
limit yourself?)
I suggest to load the kernel in address 0x08000
(to be completly safe not to mess up anything)
like that
0x08000 | kernel.img |
-----------
| kernel data |
-----------
| Kernel Stack |
-----------
......
......
......
......
0x9FFFF ......
(Note: 0x08000 is 32 kb from beginning of memory (address 0x00000)
So it's ok for the kernel init to be in address 0x00700 ,as it is a lot less than 30 kb ((0x08000 - 0x00700)/1024) in our case so it won't get into kernel.img Area)
Now what about kernel parameters?
Kernel parameters are informations about the computer we're using
that we got by using interrupts in realmode ,like cpu type,amount
of memory ,the drive we're booting from also inputs from users
and other things that we might want to have access to after
entering protected mode.Now to keep access to those things we need
to save them in a specific place in memory so that after entering
protected mode we can retrieve them from that place again.
I suggest to place them at address 0x90000 ,that would give us
more than enough space to place all the kernel parameters we need
(from 0x90000 to 0x9FFFF) and won't take much from the kernel space
area .
now the memory should look like this
0x08000 | kernel.img |
| kernel data |
| Kernel Stack |
......
......
......
......
......
0x90000 | Kernel |
| Parameters |
0x9FFFF | |
Then (After entering protected mode and having access to memory
above 1 MB) mov the kernel from address 0x08000 to 0x100000
so it'll look like that
---------------------
0xE0000 - 0xFFFFF | System/PCI BIOS |
| 127kb |
0x100000 - 0ximg-end ---------------------
| Kernel Image |
| |
---------------------
| Kernel Data |
| |
---------------------
| Kernel Stack |
| |
---------------------
(Note that here the kernel data and stack can be as big
As we want to cause we're not limited to 638 kb )
Now you might also ask , why do it in that order
kernel.img - kernel data - kernel stack ? that's because if
we're gonna port Gcc we must also port ld (linker) , and ld
by default links the data section immediately after the
code section so that's why I suggested it to be in that order.
Now to run the kernel code we simply jmp 0x100000 and start
executing kernel instructions .
|
|
From: <ji...@us...> - 2002-08-25 15:45:00
|
Update of /cvsroot/subtrick/TiTan/src/boot In directory usw-pr-cvs1:/tmp/cvs-serv16036/src/boot Modified Files: sloader.asm Log Message: Supports the kerenl init Dir Index: sloader.asm =================================================================== RCS file: /cvsroot/subtrick/TiTan/src/boot/sloader.asm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sloader.asm 27 Jul 2002 20:08:18 -0000 1.2 --- sloader.asm 25 Aug 2002 15:44:57 -0000 1.3 *************** *** 8,12 **** ! %include "kernelinit.s" %define S_STACK_PTR 0xFFFF ; Sloader Stack info --- 8,12 ---- ! %include "kernelinit/kernelinit.s" %define S_STACK_PTR 0xFFFF ; Sloader Stack info |
|
From: <ji...@us...> - 2002-08-25 15:42:49
|
Update of /cvsroot/subtrick/TiTan/src/boot/kernelinit In directory usw-pr-cvs1:/tmp/cvs-serv15376 Added Files: Makefile Log Message: New Makefile for kernel init dir --- NEW FILE: Makefile --- # Kernel int Makefile # Please read license Agreement # Written by Adham Helal # (c)2002 SubTrick Group ASM = nasm OBJ = kernelinit.o all: welcome kernelinit bye welcome: @echo "************** Starting Compilation of Kernel init **************" kernelinit: kernelinit.s nasm -f bin kernelinit.asm -o kernelinit.o bye: @echo "************** Finshed Compiling Kernel int **************" clean: rm -f $(OBJ) |
|
From: <ji...@us...> - 2002-08-25 15:41:38
|
Update of /cvsroot/subtrick/TiTan/src/boot/kernelinit In directory usw-pr-cvs1:/tmp/cvs-serv15092 Modified Files: kernelinit.s Log Message: Defined Partition path for sloader Index: kernelinit.s =================================================================== RCS file: /cvsroot/subtrick/TiTan/src/boot/kernelinit/kernelinit.s,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** kernelinit.s 25 Aug 2002 11:49:28 -0000 1.1 --- kernelinit.s 25 Aug 2002 15:41:36 -0000 1.2 *************** *** 11,12 **** --- 11,24 ---- %define OFF_KINIT 0x0000 ; offset buffer to read the kernel init into %define SEG_KINIT 0x0700 ; Segment buffer to read the kernel init into + + ;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + ; Partion Information + ; For Now This Info will have to be written manual until i automate it + ; You need to write Head, Cylinder, Sector of the partion that sloader will Reside + ; You can get this info from the partion table + ; Good luck. + + %define PAR_CYL 0 + %define PAR_SEC 2 ; Sector Starts from 1 not 0 + %define PAR_HEAD 0 + ;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
|
From: <ji...@us...> - 2002-08-25 15:40:13
|
Update of /cvsroot/subtrick/TiTan/src/boot In directory usw-pr-cvs1:/tmp/cvs-serv14769 Modified Files: Makefile Log Message: Now supports layered make for kernel init dir Index: Makefile =================================================================== RCS file: /cvsroot/subtrick/TiTan/src/boot/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 28 Jul 2002 13:16:03 -0000 1.4 --- Makefile 25 Aug 2002 15:40:09 -0000 1.5 *************** *** 6,37 **** ! ASM = nasm ! BIN = ploader.o sloader.o kernelinit.o ! SSTAGE = sloader.o kernelinit.o ! PIMAGE = PartImage ! BIMAGE = BootImage ! CAT = cat ! all: ploader sloader kernelinit makeimages ploader: ploader.s nasm -f bin ploader.asm -o ploader.o ! sloader: kernelinit.s nasm -f bin sloader.asm -o sloader.o ! kernelinit: kernelinit.s ! nasm -f bin kernelinit.asm -o kernelinit.o ! makeimages: ! CAT $(SSTAGE) > $(PIMAGE) ! cp ploader.o $(BIMAGE) clean: ! rm -f $(BIN) remove: rm -f $(BIMAGE) rm -f $(PIMAGE) ! rm -f $(BIN) --- 6,53 ---- ! ASM = nasm ! OBJ = ploader.o sloader.o ! ROBJ = $(KINIT_DIR)/kernelinit.o ! # Kernel Init dir ! KINIT_DIR = kernelinit ! # Second stage + Kernel init Bin files ! SSTAGE = sloader.o $(ROBJ) ! # Partition Image Sloader + Kernel init ! PIMAGE = PartImage ! # Boot Image primary loader ! BIMAGE = BootImage ! MAKE = make ! CAT = cat ! ! all: welcome ploader sloader kinit makeimages bye ! ! welcome: ! @echo "************** Starting To Compile boot **************" ploader: ploader.s nasm -f bin ploader.asm -o ploader.o ! sloader: nasm -f bin sloader.asm -o sloader.o ! kinit: ! @cd $(KINIT_DIR); $(MAKE) ! makeimages: ! @$(CAT) $(SSTAGE) > $(PIMAGE) ! @cp ploader.o $(BIMAGE) ! ! bye: ! @echo "************** Finshed Compiling boot **************" clean: ! rm -f $(OBJ) ! @cd $(KINIT_DIR); $(MAKE) clean remove: rm -f $(BIMAGE) rm -f $(PIMAGE) ! rm -f $(OBJ) ! d $(KINIT_DIR); $(MAKE) clean |
|
From: <ji...@us...> - 2002-08-25 12:05:01
|
Update of /cvsroot/subtrick/TiTan/doc/prog_guide/boot In directory usw-pr-cvs1:/tmp/cvs-serv25983 Removed Files: kernelinit_s.html Log Message: Don't need that one --- kernelinit_s.html DELETED --- |
|
From: <ji...@us...> - 2002-08-25 12:02:36
|
Update of /cvsroot/subtrick/TiTan/src/boot In directory usw-pr-cvs1:/tmp/cvs-serv25247 Removed Files: kernelinit.asm kernelinit.s Log Message: Moved files under /src/boot/kernelinit/ --- kernelinit.asm DELETED --- --- kernelinit.s DELETED --- |
|
From: <wol...@us...> - 2002-08-25 11:57:15
|
Update of /cvsroot/subtrick/TiTan/doc/design In directory usw-pr-cvs1:/tmp/cvs-serv23764/doc/design Added Files: Work Policy.htm Log Message: TiTan OS Group Policy --- NEW FILE: Work Policy.htm --- <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="Work%20Policy_files/filelist.xml"> <title>Dear group , </title> <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="date"/> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Amgad Madkour</o:Author> <o:Template>Normal</o:Template> <o:LastAuthor>Amgad Madkour</o:LastAuthor> <o:Revision>2</o:Revision> <o:TotalTime>9</o:TotalTime> <o:Created>2002-08-25T11:40:00Z</o:Created> <o:LastSaved>2002-08-25T11:40:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>1259</o:Words> <o:Characters>7178</o:Characters> <o:Company>Madkour</o:Company> <o:Lines>59</o:Lines> <o:Paragraphs>16</o:Paragraphs> <o:CharactersWithSpaces>8421</o:CharactersWithSpaces> <o:Version>10.2625</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]><object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} span.SpellE {mso-style-name:""; mso-spl-e:yes;} span.GramE {mso-style-name:""; mso-gram-e:yes;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> </head> <body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'> <div class=Section1> <p class=MsoNormal>Dear <span class=GramE>group ,</span> </p> <p class=MsoNormal> </p> <p class=MsoNormal>* As we can all see we are having a serious problem in coordinating the work being <span class=GramE>done ,</span> and also we are facing a lack of team work in some parts , so here is a suggestion of a policy ..</p> <p class=MsoNormal> </p> <p class=MsoNormal>******************************************************</p> <p class=MsoNormal> </p> <p class=MsoNormal>Meetings:</p> <p class=MsoNormal>----------</p> <p class=MsoNormal> </p> <p class=MsoNormal>1. Group would meet 3 days a week , suggested (sat , mon , wed ) as if people wanna travel on Thursday its ok , one of the 3 specified days would be a day were we all meet together ALL DAY , most probably at the moment would be ( Univ , Adhams new place , my house ) . The other two days would be discussing what has been done and assigning tasks to the rest of the developers. FAILIUR TO COME WOULD BE RESPONSIBILITY OF THE PERSON.</p> <p class=MsoNormal> </p> <p class=MsoNormal>2. Meetings would discuss what progress has been <span class=GramE>done ,</span> each member would have a paper written on it a report of what he has done. The paper would be hand written or printed as wished .THIS IS EXTREAMLY IMPORTANT.</p> <p class=MsoNormal> </p> <p class=MsoNormal>3. Each member would be assigned the task of writing down in each meeting what has been said in general besides his personal notes and his <span class=GramE>tasks ,</span> that is beside a member who will log all our main points and put it on the web site as a reminder to all members.</p> <p class=MsoNormal> </p> <p class=MsoNormal>4. If a member fails to attend a meeting it is his responsibility to know what has been done either by entering the web site and reading the notes or contacting the team leader to know what to <span class=GramE>do .</span> FAILURE TO DO SO WOULD RESULT IN CUMMULATIVE WORK ON THAT MEMBER.</p> <p class=MsoNormal><span class=GramE>Leading team leader to take appropriate measures with that member.</span></p> <p class=MsoNormal> </p> <p class=MsoNormal>5. Meetings with Dr. <span class=SpellE>Ibrahim</span> would be made every Wednesday (if appropriate ) to discuss what has been done , and weekly report would be presented by the team leader , and parts done would be explained by members to the Dr. . Also meeting would be made even if small progress is <span class=GramE>done ,</span> just to keep updates as much as possible</p> <p class=MsoNormal> </p> <p class=MsoNormal>6. Concerning the topic that some members would like to meet and sit together more would be applied 1 day <span class=GramE>only ,</span> this is because each person can have better time with himself with his system , this will not prevent him from coordinating his work with the rest because he will be assigned a specific task which will NOT DEPEND ON THE REST . <span class=GramE>this</span> would be managed by the team leader , still we will meet once a week together ALL DAY LONG. <span class=GramE>if</span> a task would depend on the rest then this part would be done at that very day of meeting of all the group . If a member feels he will need more help then he can just lookup info on the net or post his <span class=GramE>questions .</span> </p> <p class=MsoNormal> </p> <p class=MsoNormal>7. It is the members responsibility to put himself on track of <span class=GramE>work .</span> He may ask for help from the team leader or any other member to DIRECT HIM ONLY to what he should be reading or do , this would REALY help the member on understanding everything more than a suffer to him . Members would give help but not <span class=GramE>teach .</span> Even after all of that a member feels he is still not happy he can gather his questions and ask us in the group <span class=GramE>meeting .</span></p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>Members Tasks <span class=GramE>And</span> Work Progress:</p> <p class=MsoNormal>----------------------------------------------</p> <p class=MsoNormal> </p> <p class=MsoNormal>1. Each developer is responsible to fully understand his work during the <span class=GramE>meeting ,</span> he must be assured that he understands his task very well , and if the tasks are shared among many members , he must know his part very well from the team leader of the task.</p> <p class=MsoNormal> </p> <p class=MsoNormal>2. Each task will be assigned a DEADLINE in which it has to be done <span class=GramE>in .</span> Each developer is responsible to deliver his work on <span class=GramE>time ,</span> excuses such as traveling and busy would be ONLY ACCEPTED AT EXTREM LEVELS in which the work would be cumulated on the developer . If the team leader feels that this developer is not working YET properly then he has the right to deal with <span class=GramE>him ,</span> and I mean by that suggest the removal of such member . <span class=GramE>with</span> all respects to all members , this project needs WORK and TIME.</p> <p class=MsoNormal> </p> <p class=MsoNormal>3. If a specified task would take more time than required then the developer can send an e-mail from the team leader requesting more time and specifying in points the <span class=GramE>reasons .</span> It would be only the team leader who would accept such an excuse.</p> <p class=MsoNormal> </p> <p class=MsoNormal>4. Any questions regarding code or syntax would be posted on the message board in order to share the answers among <span class=GramE>members ,</span> even if the question is silly , we are here to learn . </p> <p class=MsoNormal> </p> <p class=MsoNormal>5. Each developer is required to mail his progress EACH FRIDAY in order to discuss it on Saturday , The mail IS A MUST to send and is gathered by the team leader in order to give him a chance to make points about, and bought by each developer to be discussed next day .EVEN IF HE SENDS A BLANK MAIL . <span class=GramE>just</span> show you are doing something .</p> <p class=MsoNormal> </p> <p class=MsoNormal>6. As we know now we have a web <span class=GramE>site ,</span> <a href="http://www.titanos.net">www.titanos.net</a> thanks to <span class=SpellE>adham</span> who managed to get it for us , now there will be a member responsible of making sure to put all logs of the meetings with the date meeting and notes on the web site. <span class=GramE>also</span> it would be his responsibility to always update the documentation section of the web site with the documentation inside the CVS. THIS IS VERY IMPORTANT TO KEEP ALL ATTENDING AND NON ATTENDING MEMBERS UP TO DATE ABOUT MEETINGS AND <span class=GramE>WORK .</span></p> <p class=MsoNormal> </p> <p class=MsoNormal>7. Also a member would be having the time schedule of task each meeting saying what has to be done and what has been <span class=GramE>done .</span> it is advised that he would be the same member of the web site as he would also include the same schedule on the net , meaning a section in the web site would include the schedule we are doing and things to be done and by which members.</p> <p class=MsoNormal> </p> <p class=MsoNormal>8. Progress and tasks can be assigned by all members and the team leader is the one who should manage the timings and coordination of work among members.</p> <p class=MsoNormal> </p> <p class=MsoNormal>9. Any changing of the basic structure of the OS or design issue HAS TO BE DISCUSSED WITH THE REST before it is done in order to take agreements on that subject. </p> <p class=MsoNormal> </p> <p class=MsoNormal><span class=GramE>10 .</span> Concerning the Documentation of the <span class=GramE>work ,</span> <span class=SpellE>i</span> would like to suggest a policy of our work , that would help ALL of us to understand every little thing done in the project . The policy is <span class=GramE>simple ,</span> every developer would be responsible of documenting the topic he is writing about and the Code he is writing . This would really help all the members a lot to understand and learn and <span class=SpellE>i</span> think it is a CRITICAL thing to <span class=GramE>do .</span> <span class=GramE>iv</span> attached an example of what <span class=SpellE>i</span> mean .</p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>Team Leader <span class=GramE>Tasks :</span></p> <p class=MsoNormal>------------------------</p> <p class=MsoNormal> </p> <p class=MsoNormal>1. It is the team <span class=GramE>leader 's</span> task to assure that development is up to date , and to be up to date with the rest of the group either via e-mail or phone . </p> <p class=MsoNormal> </p> <p class=MsoNormal>2. Team leader is the one who confronts Dr. <span class=SpellE>Ibrahim</span> as the one responsible for the current progress and for the material presented to Dr. <span class=SpellE><span class=GramE>Ibrahim</span></span><span class=GramE> .</span> he is the one responsible for the members and the members work , and in case of lack of work of certain member , would inform the Dr. to clear his hand from that matter in the worst cases ( hopefully we dont want that to happen do we ! ) </p> <p class=MsoNormal> </p> <p class=MsoNormal>3. Team Leader has to write the Weekly report of the progress done by collecting all the work from the rest of the group and delivering it to Dr. <span class=SpellE><span class=GramE>Ibrahim</span></span><span class=GramE> .</span> <span class=GramE>and</span> it is the every developers responsibility to explain what he has done to the dr. on the day of the meeting . </p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>4. It is the team leader responsibility to manage the brain dumps done in the meeting of the <span class=GramE>members .</span> He should manage the meeting ideas and discuss them so that we may have many <span class=GramE>ideas .</span></p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>************************************************************</p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>In the end <span class=SpellE>i</span> tried to layout the important points that may be raised by <span class=GramE>members ,</span> and <span class=SpellE>i</span> hope <span class=SpellE>i</span> covered most .</p> <p class=MsoNormal> </p> <p class=MsoNormal>Now this policy is JUST A SUGGESTION that <span class=SpellE>i</span> <span class=GramE>proposed ,</span> please send from your account a REPY on this mail with your notes and points you would like to add . <span class=GramE>by</span> this <span class=SpellE>i</span> mean all members <span class=SpellE>Adham</span> , <span class=SpellE>Ayman</span> , Mohamed and <span class=SpellE>Emad</span> . This reply is not optional but it is a must from all <span class=GramE>members ,</span> saying you agree or not and what points you dont agree on and which points you want to add . <span class=SpellE><span class=GramE>im</span></span> expecting a reply soon ESA , <span class=SpellE>i</span> know that some points may be hard but its a must to boost development in summer so that we dont get stuck by the start of the year ... if the policy is agreed upon it would begin progress from <st1:date Month="11" Day="8" Year="2002">Monday 11/8/2002</st1:date> . </p> <p class=MsoNormal> </p> <p class=MsoNormal> Thank you for reading</p> <p class=MsoNormal> Awaiting Your Reply</p> <p class=MsoNormal> Amgad </p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal><o:p> </o:p></p> </div> </body> </html> |
|
From: <wol...@us...> - 2002-08-25 11:55:27
|
Update of /cvsroot/subtrick/TiTan/doc/prog_guide/boot/kernelinit In directory usw-pr-cvs1:/tmp/cvs-serv23318/doc/prog_guide/boot/kernelinit Added Files: Protected Mode Programming.htm Log Message: Document talks about what protected mode is and how we can change the system from real mode to protected mode , and also contains a full implemetation in NASM syntax written in Assembly --- NEW FILE: Protected Mode Programming.htm --- <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="Protected%20Mode%20Programming_files/filelist.xml"> <title>Protected Mode Programming </title> <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="date"/> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Amgad Madkour</o:Author> <o:Template>Normal</o:Template> <o:LastAuthor>Amgad Madkour</o:LastAuthor> [...1506 lines suppressed...] <p class=MsoNormal style='margin-left:.25in'><i><o:p> </o:p></i></p> <p class=MsoNormal style='margin-left:.25in'><i><span style='mso-spacerun:yes'> </span>Any questions and comments about what is written would be appreciated and I would receive them on my <span class=GramE>mail ,</span> amg...@ho...</i><span style='mso-spacerun:yes'> </span></p> <p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p> <p class=MsoNormal style='margin-left:.25in'><span style='mso-tab-count:7'> </span>Copyrights 2002 to the author </p> <p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p> </div> </body> </html> |
|
From: <wol...@us...> - 2002-08-25 11:51:53
|
Update of /cvsroot/subtrick/TiTan/doc/prog_guide/boot/kernelinit In directory usw-pr-cvs1:/tmp/cvs-serv22442/doc/prog_guide/boot/kernelinit Added Files: Detecting Processor Type.htm Log Message: Talks Basically About Detection Of 386+ Processor Types And A Little Bit Of History --- NEW FILE: Detecting Processor Type.htm --- <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="Detecting%20Processor%20Type_files/filelist.xml"> <title>Detecting Processor Type:</title> <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="date"/> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Amgad Madkour</o:Author> <o:Template>Normal</o:Template> <o:LastAuthor>Amgad Madkour</o:LastAuthor> <o:Revision>2</o:Revision> <o:TotalTime>1</o:TotalTime> <o:Created>2002-08-08T10:21:00Z</o:Created> <o:LastSaved>2002-08-08T10:21:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>437</o:Words> <o:Characters>2491</o:Characters> <o:Company>Madkour</o:Company> <o:Lines>20</o:Lines> <o:Paragraphs>5</o:Paragraphs> <o:CharactersWithSpaces>2923</o:CharactersWithSpaces> <o:Version>10.2625</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]><object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} span.SpellE {mso-style-name:""; mso-spl-e:yes;} span.GramE {mso-style-name:""; mso-gram-e:yes;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:586964878; mso-list-type:hybrid; mso-list-template-ids:1810376388 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l0:level1 {mso-level-start-at:15; mso-level-number-format:bullet; mso-level-text:\F0B7; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in; font-family:Symbol; mso-fareast-font-family:"Times New Roman"; mso-bidi-font-family:"Times New Roman";} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> </head> <body lang=EN-US style='tab-interval:.5in'> <div class=Section1> <p class=MsoNormal><o:p> </o:p></p> <div style='border:none;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt: solid windowtext .75pt;padding:0in 0in 1.0pt 0in'> <p class=MsoNormal style='border:none;mso-border-bottom-alt:solid windowtext .75pt; padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'><b>Detecting Processor Type:<o:p></o:p></b></p> <p class=MsoNormal style='border:none;mso-border-bottom-alt:solid windowtext .75pt; padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'><b><o:p> </o:p></b></p> </div> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE><i>Author :</i></span><i> Amgad Magdy Madkour<o:p></o:p></i></p> <p class=MsoNormal><i>Operating System <span class=GramE>Sector :</span> Boot<o:p></o:p></i></p> <p class=MsoNormal><span class=GramE><i>Programming <span style='mso-spacerun:yes'> </span>Language</i></span><i> : Assembly<o:p></o:p></i></p> <p class=MsoNormal><span class=GramE><i>Revision :</i></span><i> None<o:p></o:p></i></p> <p class=MsoNormal><i>Last <span class=GramE>Update :</span> </i><st1:date Month="7" Day="24" Year="2002"><i>24/7/2002</i></st1:date><i><o:p></o:p></i></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>The detecting of the type of the processor mainly depends on the flag register, in our version of the Operating system we are depending on having a processor of 386+ to work <span class=GramE>on ,</span> in this version we have an Extended Flag Register (EFLAGS) which is a 32 bit register , in our case we care about bits from 12 to 15 which are </p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>12 :</span> IOPL = I/O Privilege Level flag , permissions are from 0-3</p> <p class=MsoNormal><span class=GramE>13 :</span> NT = Nested Task Flag</p> <p class=MsoNormal><span class=GramE>14 :</span> RF = Resume Flag </p> <p class=MsoNormal><span class=GramE>15 :</span> VM = Virtual Mode Flag or to be exact Virtual 86 Mode Flag<span style='mso-spacerun:yes'> </span></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>In the case that the processor is a 386 those bits would be modifiable <span class=GramE>bits ,</span> in the 8086 processor those bits will be all set to 1 ( 1111) and wont be allowed to be modified . In case that the processor is not an 8086 and maybe an 80286 then the bits would be (0111) but we wont be implementing checking code for that because we will only care about a 386 processor and anything else would be <span class=GramE>refused .</span> </p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>Now with the <span class=GramE>coding :</span> </p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;Programmed</span> By Amgad Madkour</p> <p class=MsoNormal><span class=GramE>;First</span> of all we save the flag register by putting it into the stack</p> <p class=MsoNormal><span class=SpellE><span class=GramE>pushf</span></span> </p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;next</span> we make the high bit of the ax register = 0<span style='mso-spacerun:yes'> </span>, ah=0</p> <p class=MsoNormal><span class=SpellE><span class=GramE>xor</span></span> <span class=SpellE>ah,ah</span></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;then</span> we push ax on the stack , now we have flags and ax in the stack</p> <p class=MsoNormal><span class=GramE>push</span> ax</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;this</span> means pop <span class=SpellE>whats</span> in the stack (top element) into the flag register</p> <p class=MsoNormal>; <span class=GramE>what</span> will be popped is the ax which is all 0s into the flag register </p> <p class=MsoNormal><span class=SpellE><span class=GramE>popf</span></span></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;push</span> what is in the flag register into the stack after modification in </p> <p class=MsoNormal><span class=GramE>;the</span> flag register via ax register</p> <p class=MsoNormal><span class=SpellE><span class=GramE>pushf</span></span></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;pop</span> <span class=SpellE>whats</span> in the stack which is the modified flags into ax for inspection</p> <p class=MsoNormal><span class=GramE>pop</span> ax</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;and</span> (1111) in what is stored in the ah which represents what has been modified </p> <p class=MsoNormal><span class=GramE>;the</span> result will be stored in the accumulator (ax)</p> <p class=MsoNormal>; <span class=GramE>we</span> want to and only the high bits if the (ax)</p> <p class=MsoNormal><span class=GramE>and</span> ah,0f0h</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>; <span class=GramE>at</span> this point if the result in the ah is 1111</p> <p class=MsoNormal><span class=SpellE><span class=GramE>cmp</span></span> ah,0f0h</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;then</span><span style='mso-spacerun:yes'> </span>the processor is not a 386</p> <p class=MsoNormal><span class=SpellE><span class=GramE>je</span></span> no386</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=GramE>;else</span> if not 1111 then it had been modified , then its a 386</p> <p class=MsoNormal><span class=GramE>;print</span> that the user is having a 386+ processor</p> <p class=MsoNormal><span class=GramE>;those</span> two are just printing procedures </p> <p class=MsoNormal><span class=SpellE><span class=GramE>mov</span></span> si,is386</p> <p class=MsoNormal><span class=GramE>call</span> <span class=SpellE>kprint</span></p> <p class=MsoNormal><o:p> </o:p></p> <ul style='margin-top:0in' type=disc> <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><span class=GramE>Note :</span> some people would have said why we used <span class=SpellE>xor</span> operation for example , well that is because the (<span class=SpellE>xor</span>) is faster than a (<span class=SpellE>mov</span>) operation .</li> <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Another important point is why the many push and pops , well for one thing the an easy way to access the flag register is via using the <span class=SpellE>pushf</span> and <span class=SpellE>popf</span> instructions of the stack to deal with the flag register</li> </ul> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><b><i><span style='font-size:14.0pt'>Conclusion <o:p></o:p></span></i></b></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>This document has shown how to detect 386 + processor in a very simple way with small set of <span class=GramE>instructions .</span></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal><span class=SpellE>TiTan</span> OS <span class=GramE>Notes :</span></p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>This File Depends On </p> <p class=MsoNormal>None</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>This File is used by</p> <p class=MsoNormal>Kernel Initialization structure </p> <div style='border:none;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt: solid windowtext .75pt;padding:0in 0in 1.0pt 0in'> <p class=MsoNormal style='border:none;mso-border-bottom-alt:solid windowtext .75pt; padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'><o:p> </o:p></p> </div> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal style='margin-left:.25in'><i>Any questions and comments about what is written would be appreciated and I would receive them on my <span class=GramE>mail ,</span> amg...@ho...</i><span style='mso-spacerun:yes'> </span></p> <p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p> <p class=MsoNormal style='margin-left:.25in'><span style='mso-tab-count:7'> </span>Copyrights 2002 to the author </p> <p class=MsoNormal><o:p> </o:p></p> </div> </body> </html> |
|
From: <wol...@us...> - 2002-08-25 11:49:32
|
Update of /cvsroot/subtrick/TiTan/src/boot/kernelinit In directory usw-pr-cvs1:/tmp/cvs-serv21737/src/boot/kernelinit Added Files: kernelinit.s Log Message: Contains Definition Used By Kernelinit.asm --- NEW FILE: kernelinit.s --- ; kernel init conf ; Please read license Agreement ; Written by Adham Helal ; (c)2002 SubTrick Group ; This is info need for the kernel init ; kernelinit.s %define SEC 3 ; Number of Sectores to be loaded.(Kernel init) %define OFF_KINIT 0x0000 ; offset buffer to read the kernel init into %define SEG_KINIT 0x0700 ; Segment buffer to read the kernel init into |
|
From: <wol...@us...> - 2002-08-25 11:47:52
|
Update of /cvsroot/subtrick/TiTan/src/boot/kernelinit
In directory usw-pr-cvs1:/tmp/cvs-serv21464/src/boot/kernelinit
Added Files:
kernelinit.asm
Log Message:
Changed System To Protected Mode
Detecting 386 Processor
Detecting Physical Memory
Opening the A20 Gate
--- NEW FILE: kernelinit.asm ---
; kernelinit : kernel initialization file or as we can say system
; initialization file
;
; Contains : Checking +386 Processor : Amgad Madkour
; Changing System to protected mode : Amgad Madkour
; Opening A20 Gate : Amgad Madkour
; Code Heirarchy And On Screen Printing : Ayman El Sayed
; Detecting Physical Memory : Ayman El Sayed
; OS Stack Setting : Ayman El Sayed
;
; Assembler : Nasm (Netwide Assembler)
; Links : Sloader (Secondary Loader)
; Part Of The TiTan OS Project
; Reference : Intel Programming Reference (Found On The TiTan Web Site)
; Christopher Geise "Protected Mode" (Found On TiTan Web Site)
%include "kernelinit.s"
jmp SEG_KINIT:kstart
;extern printcolor
N equ 0xD
L equ 0xA
welcome db " >> Welcome To TiTan OS<< ",N,L,'$'
prog db " Starting Kernel Initialization ... ",N,L,'$'
kmsg db " Checking Processor Type : ",'$'
notsupported db " sorry not supported ",N,L,'$'
is386 db " 386+ ","Detected"
db " [ ",0x5,"O",0x5,"K ]",N,L,'$'
no386 db " not 386 GoodBye"
db " [ ",0x6,"F",0x6,"A",0x6,"I",0x6,"L",0x6,"E",0x6,"D ]",N,L,'$'
v86mode db " You are currently running in V86 mode",
db " [ ",0x6,"F",0x6,"A",0x6,"I",0x6,"L",0x6,"E",0x6,"D ]",N,L,'$'
nov86 db " V86 Mode Disabled"
db " [ ",0x5,"O",0x5,"K ]",N,L,'$'
checkmode db " Checking Running Modes : ",'$'
protected db " Changing to protected mode : ",'$'
eA20 db " Enabling A20 Gate : ",N,L,'$'
MEMz db " Total Availble Memory : "
val times 6 db 0
db 'k'
db " [ ",0x5,"O",0x5,"K ]",N,L,'$'
kstart:
mov ax,cs
mov ds,ax
mov es,ax
setgraph :
mov ah,00h
mov al,10h
int 0x10
mov si,welcome
call printcolor
mov si,prog
call printcolor
mov si,kmsg
call printcolor
jmp processorcheck
hang : jmp hang
;; if char-1 = 0x5 print green(char) ,if char-1 = 0x6 print red(char),
;; else print white(char)
printcolor :
lodsb
cmp al,'$'
je printret
mov bl,0Fh
cmp al,5h
je green
cmp al,6h
je red
back: mov ah,0Eh
xor bh,bh
int 0x10
jmp printcolor
green :
mov al,[si]
mov bl,02h
inc si
jmp back
red :
mov al,[si]
mov bl,04h
inc si
jmp back
printret : ret
;;Checking for 386;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
processorcheck:
pushf
xor ah,ah
push ax
popf
pushf
pop ax
and ah,0f0h
cmp ah,0f0h
je printno386
mov si,is386
call printcolor
jmp modesrunning
printno386:
mov si,no386
call printcolor
jmp hang
;-----------------------------------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Checks if we are running in Real Mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
modesrunning:
mov si,checkmode
call printcolor
mov eax,cr0
and al,1
smsw ax ;this is a better alternate way
test al,1 ;2nd step
jnz unreal
mov si,nov86
call printcolor
jmp detectMEM
unreal:
mov si,v86mode
call printcolor
jmp hang
;-------------------------------------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
detectMEM :
xor eax,eax
xor ebx,ebx
push ds
push es
mov ax,0xe801
int 0x15
here : and edx,0xffff
shl edx,6
and ecx,0xffff
add edx,ecx
mov eax,edx
mov si,val
mov ebx,10
xor edx,edx
mov cx,6
repeat: mov dl,0
div ebx
add dl,30h
mov [si],dl
inc si
loop repeat
mov si,val
push si
reverse: mov al,[si]
inc si
mov ah,[si]
inc si
mov bl,[si]
inc si
mov bh,[si]
inc si
mov cl,[si]
inc si
mov ch,[si]
pop si
mov [si],ch
inc si
mov [si],cl
inc si
mov [si],bh
inc si
mov [si],bl
inc si
mov [si],ah
inc si
mov [si],al
mov si,MEMz
call printcolor
jmp protectedmode
;Protected Mode Code------------------------------------------------------------------------------
protectedmode:
xor ebx,ebx
mov bx,cs
shl ebx,4
mov eax,ebx
mov [gdt1 + 2],ax
mov [gdt2 + 2],ax
shr eax,16
mov [gdt1 + 4],al
mov [gdt2 + 4],al
mov [gdt1 + 7],ah
mov [gdt2 + 7],ah
; point gdtr to the gdt, point idtr to the idt
add ebx,gdt
mov [gdtr + 2],ebx
add ebx,idt - gdt
mov [idtr + 2],ebx
; disable interrupts
cli
; load GDT and IDT for full protected mode
lgdt [gdtr]
lidt [idtr]
; set PE [protected mode enable] bit and go
mov eax,cr0
or al,1
mov cr0,eax
jmp SYS_CODE_SEL:do_pm
;to define that you are working in 32 bit now
;if we remove this we would get a segmentation fault
[BITS 32]
do_pm:
mov ax,SYS_DATA_SEL
mov ds,ax
mov ss,ax
nop
mov es,ax
mov fs,ax
mov gs,ax
; I want here to print 'protected' label defined above
jmp A20
;Enabling A20 Gate--------------------------------------------------------------------------------
A20:
; i want to print here 'eA20' label defined above
; then please see the 'success' and 'failed' label defined below
pusha
; Make sure interrupts are disabled
cli
mov cx, 5
trial1:
;; Wait
waitc1:
xor ax, ax
in al, 64h
bt ax, 1
jc waitc1
;read output port.
mov al, 0D0h
out 64h,al
;; Wait for the controller to be ready with a byte of data
waitd1:
xor AX, AX
in al, 64h
bt ax, 0
jnc waitd1
;; Read the current port status from port 60h
xor ax, ax
in al, 60h
;; Save value
push eax
waitc2:
in al, 64h
bt ax, 1
jc waitc2
mov al, 0D1h
out 64h, al
waitc3:
xor ax, ax
in al, 64h
bt ax, 1
jc waitc3
pop eax
; A20 enable
or al, 00000010b
out 60h, al
;RECHECK
; Wait
waitc4:
xor ax, ax
in al, 64h
bt ax, 1
jc waitc4
;read output port.
mov al, 0D0h
out 64h, al
;wait
waitd2:
xor ax, ax
in al, 64h
bt ax, 0
jnc waitd2
; Read port
xor AX, AX
in AL, 60h
bt AX, 1
;; If carry is on, A20 is on.
jc success
loop trial1
;else?
jmp fail
success:
jmp hang
fail:
jmp hang
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;default interrupt handler
handler: cli
mov ax,LINEAR_SEL
mov gs,ax
mov byte[gs:0xB8090],'!'
jmp $
;Example : Handler for interrupt
;handler for int0x20
isr20: pusha
push gs
;print something !
pop gs
popa
iret
;32-bit linear base address of GDT and IDT-----------------------------------
gdtr: dw gdt_end - gdt - 1 ; GDT limit
dd gdt ; linear, physical address of GDT
idtr: dw idt_end - idt - 1 ; IDT limit
dd idt ; linear, physical address of IDT
;--------------------------------------------------------------------------------
;Global descriptor table (GDT)
; null descriptor
gdt: dw 0 ; limit 15:0
dw 0 ; base 15:0
db 0 ; base 23:16
db 0 ; type
db 0 ; limit 19:16, flags
db 0 ; base 31:24
; linear data segment descriptor
LINEAR_SEL equ $-gdt
dw 0xFFFF ; limit 0xFFFFF
dw 0 ; base 0
db 0
db 0x92 ; present, ring 0, data, expand-up, writable
db 0xCF ; page-granular, 32-bit
db 0
; code segment descriptor
SYS_CODE_SEL equ $-gdt
gdt1: dw 0xFFFF
dw 0 ; (base gets set above)
db 0
db 0x9A ; present, ring 0, code, non-conforming, readable
db 0xCF
db 0
; data segment descriptor
SYS_DATA_SEL equ $-gdt
gdt2: dw 0xFFFF
dw 0 ; (base gets set above)
db 0
db 0x92 ; present, ring 0, data, expand-up, writable
db 0xCF
db 0
gdt_end:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;------------------------------------------------------------------------------------------
;interrupt descriptor table (IDT)
; 32 reserved interrupts:
idt: dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0 ; entry point 31:16 (XXX - unhand >> 16)
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
dw handler ; entry point 15:0
dw SYS_CODE_SEL ; selector
db 0 ; word count
db 0x8E ; type (32-bit Ring 0 interrupt gate)
dw 0
; user interrupt handler
dw isr20
dw SYS_CODE_SEL
db 0
db 0x8E
dw 0
idt_end:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
times 1512-($-$$) db 0 ; complete the code in bytes
|