How to run XGCC in a Win 3.11 (with Win32s) environment
=======================================================
10.11.1997 by Thorsten Godau  email : ntw6thgo@pcmail.rz.fht-esslingen.de

Hi all,
this document shall be a little try to help all, who don't have Win95
and want to use Alex Ramos's HP48XGCC in a Win 3.11 environment.
I wrote this, because I didn't found something like this at the web.

Introduction
------------

It is really possible to run Alex's xgcc under Win 3.11. I don't know,
if Win32s (32-bit extender, available from Microsoft) is really nescessary,
but check it out and mail me.

Xgcc ONLY runs in a DOS-box ! If you start it at DOS (without Windows
in background), you will get an error-message of missing DPMI-Server.

You only need the binary release of xgcc for Win95, neither GNU C (gcc),
nor the GNU MAKE-utility (not nescessary, but comfortable), at least not
to compile sources.

Step-by-step
------------

1. Access Alex Ramos homepage (www.concentric.net/~Ramos/hp48/hp48xgcc.htm)
   and read the manual.

2. Download the binary release of xgcc for Win95 and all available updates
   for this package.

3. Use e.g. WinZip 6.2 to unzip the package and the update(s) on your
   machine. Don't forget to check the "Use folder names"-box.
   Don't care about the long directory names. WinZip will cut them
   concurring to 8+3-DOS-format.

4. I renamed, moved and deleted some things. As an example, here is my
   directory-structure. Further descriptions depends on this structure :

D:\USR
|   
+---LIB
|       SPECS
|       AS.EXE
|       CC1.EXE
|       CPP.EXE
|       LD.EXE
|       CRT0.O
|       LIBC.SLO
|       LIBCORE.SLO
|       LIBGCC.SLO
|       LIBGRAPH.SLO
|       LIBM.SLO
|       
+---BIN
|       XGCC.EXE
|       
\---SATURN
    +---INCLUDE
    |   |   FEATURES.H
    |   |   FLOAT.H
    |   |   HUGE_VAL.H
    |   |   LIMITS.H
    |   |   MALLOC.H
    |   |   MATH.H
    |   |   STDARG.H
    |   |   STDDEF.H
    |   |   STDIO.H
    |   |   STDLIB.H
    |   |   STRING.H
    |   |   VALUES.H
    |   |   
    |   +---HP48
    |   |       CORE.H
    |   |       FB.H
    |   |       LCD.H
    |   |       MAIN.H
    |   |       OBJECT.H
    |   |       STACK.H
    |   |       TYPES.H
    |   |       
    |   \---SYS
    |           CDEFS.H
    |           TYPES.H
    |           
    +---SAMPLES
    |   |   MAKEFILE
    |   |   MAKE.DEF
    |   |   
    |   +---ASMTEST
    |   |       MAKEFILE
    |   |       LEN1.S
    |   |       LEN2.S
    |   |       LEN3.S
    |   |       
    |   +---CPPHELL
    |   |       MAKEFILE
    |   |       HELLO.CC
    |   |       
    |   +---FLOAT
    |   |       MAKEFILE
    |   |       MANDEL.C
    |   |       
    |   +---FUNC
    |   |       MAKEFILE
    |   |       EXTERNAL.C
    |   |       FUNCTION.C
    |   |       
    |   +---HELLO
    |   |       MAKEFILE
    |   |       HELLO.C
    |   |       HELLO
    |   |       
    |   +---LCD
    |   |       MAKEFILE
    |   |       LCDTEST.C
    |   |       LCDTEST
    |   |       
    |   +---LIBTEST
    |   |       MAKEFILE
    |   |       ADDR_OF.C
    |   |       BUG.C
    |   |       CMP.C
    |   |       CORELEFT.C
    |   |       FORTYTWO.C
    |   |       INC.C
    |   |       LAYOUT.CC
    |   |       LEN.C
    |   |       REVERSE.C
    |   |       
    |   +---MANDEL
    |   |       MAKEFILE
    |   |       MANDEL.C
    |   |       
    |   +---MATH
    |   |       MAKEFILE
    |   |       GAMMA.C
    |   |       
    |   \---DOWNLOAD
    |           README
    |           
    +---DOC
    |       OLD-HP48.DOC
    |       HP48XGCC.HTM
    |       COPYING
    |       COPYING.LIB
    |       
    +---DOWNLOAD
    |       LIBGCC.SL
    |       LIBC.SL
    |       LIBM.SL
    |       LIBCORE.SL
    |       LIBGRAPH.SL
    |       GCCLDD
    |       
    \---LIBSRC
        \---LIBC
                STACK.S
                
(HELLO and LCDTEST are HP48-Files i compiled from their sources)

5. Now you have to do the DOS dependend "extra work" :

   AUTOEXEC.BAT :
   
   -Append to the PATH-variable the path, where XGCC.EXE is found
    (e.g. D:\USR\BIN).

   -Declare a new environment-variable called GCC_EXEC_PREFIX that points
    to the directory, where CPP.EXE, AS.EXE, CRT0.O and such things were
    found (e.g. SET GCC_EXEC_PREFIX=D:\USR\LIB\   don't forget the backslash
    at the end !).

   -Declare a new environment-variable called C_INCLUDE_PATH that points
    to the (base)directory, where the include-files *.h were found
    (e.g. SET C_INCLUDE_PATH=D:\USR\SATURN\INCLUDE\   don't forget the backslash
    at the end !).

  (-I decided to give my DOS-environment more room with following line
    in CONFIG.SYS :
     SHELL=C:\DOS\COMMAND.COM C:\DOS\ /e:1024 /p
                                         ^^^^
     FILES should set to more than 15 files.)

6. Restart your computer.

7. An ugly thing (for DOS-users) of Unix-based files is, that Unix uses a
   Newline-character to seperate lines instead of CRLF, and also Unix uses
   '/' instead of '\' to seperate directories. 
   Because i like perfect things ;-)) ,i took all *.c, *.h and all MAKEFILE-files,
   loaded them with EDIT (from DOS), replaced all '/' with '\' and saved them.
   Now all these files are perfectly readable with Window's Notepad.
   These changes are not nescessary, but useful.

8. Now you're ready to start compiling the samples (e.g. hello.c).
   Open a DOS-box (as a window).
   Check out the respective MAKEFILE, to know, which options you have
   to use to compile a *.c file.

   Example for hello.c :

   d:                              (change to hd d:)
   cd usr\saturn\samples\hello     (change to directory, where hello.c is)
   xgcc -lcore -O2 -Wall hello.c -o hello    
   
   '-lcore' is a linker-command to link also the objectfile core (i think
   it's libcore.slo, am i right ??).
   '-O2' means "try to make it as small, as you can".
   '-Wall' enables most of the warning-messages.
   'hello.c' is the source.
   '-o hello' is the name of the output file.

   I am not very familiar with gcc (i have to learn a lot of things about
   this), so if i wrote rubbish, please correct me !

9. If you download the 'runtime-libraries' (GCCLDD, libgcc.sl...), be sure
   the *.sl-files are in lowercase letters with the extension .sl and
   GCCLDD is written in uppercase letters.
   As far as i saw, all these libraries must be in the HOME-directory of
   the HP. A compiled program can be in every other directory.

10. Now, search for a gcc-reference to program the best things for the HP.
    (smile)


Alex Ramos wrote most of these things in his manual, but i think there
are some details for DOS-users missing.
I hope this little manual (oh my god, more than 216 lines !! =8-o ) will
help all Win 3.11-users (i know, we are Dinos, but remember "never change a
running system !" ) to make xgcc running on their systems, to bring us
the most useful and fastest and .... programs for the HP48.  ;-)))

Thanks to Alex Ramos for his very fine work.
All samples, i compiled are running perfectly on my 48G.

Tell me about your experiences with this manual, but please do not ask me
things about gcc. Since 5 years, i program in c, but only with
Borland-compilers in DOS environments. I have ->NULL experiences with GNU C.
So i have to learn these things by myself.


Best regards, Thorsten Godau
(I know, my english is poor, but I did my best..)
